Merge pull request #3867 from AndrewMeadows/bispinor

don't lookup entity by ID when deleting script
This commit is contained in:
Brad Hefta-Gaub 2014-11-26 11:07:07 -08:00
commit b136f4c649
3 changed files with 6 additions and 15 deletions

View file

@ -12,4 +12,4 @@ Clément Brisset, October 22nd, 2014
3. Place the directories “include” and “src” in interface/external/gverb 3. Place the directories “include” and “src” in interface/external/gverb
(Normally next to this readme) (Normally next to this readme)
4. Clear your build directory, run cmake, build and you should be all set. 4. Clear your build directory, run cmake, build and you should be all set.

View file

@ -195,22 +195,14 @@ QScriptValue EntityTreeRenderer::loadEntityScript(EntityItem* entity) {
return entityScriptObject; // newly constructed return entityScriptObject; // newly constructed
} }
QScriptValue EntityTreeRenderer::getPreviouslyLoadedEntityScript(const EntityItemID& entityItemID) { QScriptValue EntityTreeRenderer::getPreviouslyLoadedEntityScript(const EntityItemID& entityID) {
EntityItem* entity = static_cast<EntityTree*>(_tree)->findEntityByEntityItemID(entityItemID); if (_entityScripts.contains(entityID)) {
return getPreviouslyLoadedEntityScript(entity); EntityScriptDetails details = _entityScripts[entityID];
} return details.scriptObject; // previously loaded
QScriptValue EntityTreeRenderer::getPreviouslyLoadedEntityScript(EntityItem* entity) {
if (entity) {
EntityItemID entityID = entity->getEntityItemID();
if (_entityScripts.contains(entityID)) {
EntityScriptDetails details = _entityScripts[entityID];
return details.scriptObject; // previously loaded
}
} }
return QScriptValue(); // no script return QScriptValue(); // no script
} }
void EntityTreeRenderer::setTree(Octree* newTree) { void EntityTreeRenderer::setTree(Octree* newTree) {
OctreeRenderer::setTree(newTree); OctreeRenderer::setTree(newTree);
static_cast<EntityTree*>(_tree)->setFBXService(this); static_cast<EntityTree*>(_tree)->setFBXService(this);

View file

@ -131,7 +131,6 @@ private:
QScriptValue loadEntityScript(EntityItem* entity); QScriptValue loadEntityScript(EntityItem* entity);
QScriptValue loadEntityScript(const EntityItemID& entityItemID); QScriptValue loadEntityScript(const EntityItemID& entityItemID);
QScriptValue getPreviouslyLoadedEntityScript(const EntityItemID& entityItemID); QScriptValue getPreviouslyLoadedEntityScript(const EntityItemID& entityItemID);
QScriptValue getPreviouslyLoadedEntityScript(EntityItem* entity);
QString loadScriptContents(const QString& scriptMaybeURLorText); QString loadScriptContents(const QString& scriptMaybeURLorText);
QScriptValueList createMouseEventArgs(const EntityItemID& entityID, QMouseEvent* event, unsigned int deviceID); QScriptValueList createMouseEventArgs(const EntityItemID& entityID, QMouseEvent* event, unsigned int deviceID);
QScriptValueList createMouseEventArgs(const EntityItemID& entityID, const MouseEvent& mouseEvent); QScriptValueList createMouseEventArgs(const EntityItemID& entityID, const MouseEvent& mouseEvent);