Browse Source

[scene] Reference edit don't rebuild the prefab

Clément Espeute 11 tháng trước cách đây
mục cha
commit
e3f15458ea
2 tập tin đã thay đổi với 14 bổ sung4 xóa
  1. 2 0
      hrt/prefab/Object3D.hx
  2. 12 4
      hrt/prefab/Reference.hx

+ 2 - 0
hrt/prefab/Object3D.hx

@@ -455,6 +455,8 @@ class Object3D extends Prefab {
 			local3d.remove();
 		if (editorIcon != null)
 			editorIcon.remove();
+		local3d = null;
+		editorIcon = null;
 		super.editorRemoveInstanceObjects();
 	}
 

+ 12 - 4
hrt/prefab/Reference.hx

@@ -212,8 +212,10 @@ class Reference extends Object3D {
 		var props = ctx.properties.add(element, this, function(pname) {
 			ctx.onChange(this, pname);
 			if(pname == "source" || pname == "editMode") {
-				editorRemoveObjects();
-				refInstance = null;
+				if (pname == "source") {
+					editorRemoveObjects();
+					refInstance = null;
+				}
 				if (hasCycle()) {
 					hide.Ide.inst.quickError('Reference to $source would create a cycle. The reference change was aborted.');
 					ctx.properties.undo.undo();
@@ -221,8 +223,14 @@ class Reference extends Object3D {
 					return;
 				}
 				updateProps();
-				if(!ctx.properties.isTempChange)
-					ctx.rebuildPrefab(this);
+				if(!ctx.properties.isTempChange) {
+					if (pname == "source") {
+						ctx.rebuildPrefab(this);
+					}
+					else {
+						@:privateAccess shared.editor.refreshTree();
+					}
+				}
 			}
 		});