소스 검색

Prevent self-referencing references

trethaller 7 년 전
부모
커밋
c1ed87a6ec
1개의 변경된 파일8개의 추가작업 그리고 2개의 파일을 삭제
  1. 8 2
      hide/prefab/Reference.hx

+ 8 - 2
hide/prefab/Reference.hx

@@ -29,8 +29,14 @@ class Reference extends Prefab {
 		var lib = getParent(hxd.prefab.Library);
 		if(lib == null)
 			return null;
-		ref = lib.getOpt(Prefab, refpath);
-		return ref;
+		var all = lib.getAll(Prefab);
+		for(p in all) {
+			if(!Std.is(p, Reference) && p.getAbsPath() == refpath) {
+				ref = p;
+				return ref;
+			}
+		}
+		return null;
 	}
 
 	override function makeInstance(ctx: Context) : Context {