mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
CR fixes
This commit is contained in:
parent
ba8d445444
commit
74343c71d8
4 changed files with 12 additions and 8 deletions
|
@ -40,9 +40,6 @@ namespace render { namespace entities {
|
|||
|
||||
} }
|
||||
|
||||
// Allow the use of std::unordered_map with QUuid keys
|
||||
namespace std { template<> struct hash<EntityItemID> { size_t operator()(const EntityItemID& id) const; }; }
|
||||
|
||||
using EntityRenderer = render::entities::EntityRenderer;
|
||||
using EntityRendererPointer = render::entities::EntityRendererPointer;
|
||||
using EntityRendererWeakPointer = render::entities::EntityRendererWeakPointer;
|
||||
|
|
|
@ -45,4 +45,7 @@ QScriptValue EntityItemIDtoScriptValue(QScriptEngine* engine, const EntityItemID
|
|||
void EntityItemIDfromScriptValue(const QScriptValue &object, EntityItemID& properties);
|
||||
QVector<EntityItemID> qVectorEntityItemIDFromScriptValue(const QScriptValue& array);
|
||||
|
||||
// Allow the use of std::unordered_map with QUuid keys
|
||||
namespace std { template<> struct hash<EntityItemID> { size_t operator()(const EntityItemID& id) const; }; }
|
||||
|
||||
#endif // hifi_EntityItemID_h
|
||||
|
|
|
@ -223,10 +223,11 @@ ScriptEngine::ScriptEngine(Context context, const QString& scriptContents, const
|
|||
if (_type == Type::ENTITY_CLIENT || _type == Type::ENTITY_SERVER) {
|
||||
QObject::connect(this, &ScriptEngine::update, this, [this]() {
|
||||
// process pending entity script content
|
||||
if (_contentAvailableQueue.size()) {
|
||||
auto pending = _contentAvailableQueue.values().toStdList();
|
||||
_contentAvailableQueue.clear();
|
||||
for (auto& args : pending) {
|
||||
if (!_contentAvailableQueue.empty()) {
|
||||
EntityScriptContentAvailableMap pending;
|
||||
std::swap(_contentAvailableQueue, pending);
|
||||
for (auto& pair : pending) {
|
||||
auto& args = pair.second;
|
||||
entityScriptContentAvailable(args.entityID, args.scriptOrURL, args.contents, args.isURL, args.success, args.status);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#ifndef hifi_ScriptEngine_h
|
||||
#define hifi_ScriptEngine_h
|
||||
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
@ -80,6 +81,8 @@ struct EntityScriptContentAvailable {
|
|||
QString status;
|
||||
};
|
||||
|
||||
typedef std::unordered_map<EntityItemID, EntityScriptContentAvailable> EntityScriptContentAvailableMap;
|
||||
|
||||
typedef QList<CallbackData> CallbackList;
|
||||
typedef QHash<QString, CallbackList> RegisteredEventHandlers;
|
||||
|
||||
|
@ -771,7 +774,7 @@ protected:
|
|||
QHash<EntityItemID, EntityScriptDetails> _entityScripts;
|
||||
QHash<QString, EntityItemID> _occupiedScriptURLs;
|
||||
QList<DeferredLoadEntity> _deferredEntityLoads;
|
||||
QMap<EntityItemID, EntityScriptContentAvailable> _contentAvailableQueue;
|
||||
EntityScriptContentAvailableMap _contentAvailableQueue;
|
||||
|
||||
bool _isThreaded { false };
|
||||
QScriptEngineDebugger* _debugger { nullptr };
|
||||
|
|
Loading…
Reference in a new issue