Browse Source

fixed terrain with refs

Nicolas Cannasse 5 years ago
parent
commit
86d2006fc8
2 changed files with 6 additions and 2 deletions
  1. 3 0
      hrt/prefab/Reference.hx
  2. 3 2
      hrt/prefab/terrain/Terrain.hx

+ 3 - 0
hrt/prefab/Reference.hx

@@ -79,7 +79,10 @@ class Reference extends Object3D {
 		if(isFile()) {
 			ctx = super.makeInstance(ctx);
 			ctx.isRef = true;
+			var prevPath = ctx.shared.currentPath;
+			ctx.shared.currentPath = refpath;
 			p.make(ctx);
+			ctx.shared.currentPath = prevPath;
 
 			#if editor
 			if (ctx.local2d == null) {

+ 3 - 2
hrt/prefab/terrain/Terrain.hx

@@ -150,13 +150,14 @@ class Terrain extends Object3D {
 	}
 
 	function loadTiles( ctx : Context, height = true, index = true , weight = true ) {
-		var prevWatch = @:privateAccess hxd.res.Image.ENABLE_AUTO_WATCH;
-		@:privateAccess hxd.res.Image.ENABLE_AUTO_WATCH = false;
 		var resDir = ctx.shared.loadDir(name);
 
 		if( resDir == null )
 			return;
 
+		var prevWatch = @:privateAccess hxd.res.Image.ENABLE_AUTO_WATCH;
+		@:privateAccess hxd.res.Image.ENABLE_AUTO_WATCH = false;
+
 		// Avoid texture alloc for unpacking
 		var tmpPackedWeightTexture = new h3d.mat.Texture(terrain.weightMapResolution.x, terrain.weightMapResolution.y, [Target]);