浏览代码

prevent remove of 2d context if not our own

Nicolas Cannasse 5 年之前
父节点
当前提交
bbc8869e6b
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      hrt/prefab/l3d/Instance.hx

+ 4 - 2
hrt/prefab/l3d/Instance.hx

@@ -116,8 +116,10 @@ class Instance extends Object3D {
 	override function removeInstance(ctx:Context):Bool {
 		if(!super.removeInstance(ctx))
 			return false;
-		if(ctx.local2d != null)
-			ctx.local2d.remove();
+		if(ctx.local2d != null ) {
+			var pctx = ctx.shared.getContexts(parent)[0];
+			if( pctx != null && pctx.local2d != ctx.local2d ) ctx.local2d.remove();
+		}
 		return true;
 	}