Forráskód Böngészése

Entity Instances will now reload in the entity editor when the linked file is re-saved

Ivan Safrin 12 éve
szülő
commit
48b186021c

+ 1 - 1
Core/Contents/Source/PolySceneEntityInstance.cpp

@@ -495,10 +495,10 @@ void SceneEntityInstance::clearInstance() {
     resourcePools.clear();
     resourcePools.clear();
     topLevelResourcePool = CoreServices::getInstance()->getResourceManager()->getGlobalPool();
     topLevelResourcePool = CoreServices::getInstance()->getResourceManager()->getGlobalPool();
 	for(int i=0; i < children.size(); i++) {
 	for(int i=0; i < children.size(); i++) {
-		removeChild(children[i]);
 		children[i]->setOwnsChildrenRecursive(true);
 		children[i]->setOwnsChildrenRecursive(true);
 		delete children[i];
 		delete children[i];
 	}
 	}
+    children.clear();
 }
 }
 
 
 bool SceneEntityInstance::loadFromFile(const String& fileName) {
 bool SceneEntityInstance::loadFromFile(const String& fileName) {

+ 4 - 0
IDE/Contents/Source/PolycodeEntityEditor.cpp

@@ -477,6 +477,10 @@ void EntityEditorMainView::setEditorProps(Entity *entity) {
     if(instance && instance != objectRootInstance) {
     if(instance && instance != objectRootInstance) {
         for(int i=0; i < instance->getNumChildren(); i++) {
         for(int i=0; i < instance->getNumChildren(); i++) {
             setLinkedEntityPropsRecursive(instance, instance->getChildAtIndex(i));
             setLinkedEntityPropsRecursive(instance, instance->getChildAtIndex(i));
+            instance->getResourceEntry()->reloadOnFileModify = true;
+            if(!CoreServices::getInstance()->getResourceManager()->getGlobalPool()->hasResource(instance->getResourceEntry())) {
+                CoreServices::getInstance()->getResourceManager()->getGlobalPool()->addResource(instance->getResourceEntry());
+            }
         }
         }
     }
     }