Ver código fonte

Meshspray: children updateInstance + sceneEditor: fix resetCamera 3D

Tom SPIRA 5 anos atrás
pai
commit
fdc1cb625d
2 arquivos alterados com 6 adições e 2 exclusões
  1. 4 1
      hide/comp/SceneEditor.hx
  2. 2 1
      hrt/prefab/l3d/MeshSpray.hx

+ 4 - 1
hide/comp/SceneEditor.hx

@@ -406,6 +406,8 @@ class SceneEditor {
 				selectObjects([]);
 			}
 		};
+		if (!camera2D) 
+			resetCamera();
 
 
 		var cam = @:privateAccess view.getDisplayState("Camera");
@@ -427,9 +429,10 @@ class SceneEditor {
 			context.shared.root2d.setScale(cam2d.z);
 		}
 		cameraController2D.loadFromScene();
+		if (camera2D) 
+			resetCamera();
 
 		scene.onUpdate = update;
-		resetCamera();
 
 		// BUILD scene tree
 

+ 2 - 1
hrt/prefab/l3d/MeshSpray.hx

@@ -142,13 +142,14 @@ class MeshSpray extends Object3D {
 	var wasEdited = false;
 	var previewModels : Array<hrt.prefab.Prefab> = [];
 	override function edit( ectx : EditContext ) {
-		if (x != 0 || y != 0) {
+		if ( x != 0 || y != 0 ) {
 			// move meshSpray to origin
 			for (c in this.children) {
 				var obj3d = Std.downcast(c, Object3D);
 				if (obj3d != null) {
 					obj3d.x += x;
 					obj3d.y += y;
+					obj3d.updateInstance(ectx.getContext(obj3d));
 				}
 			}
 			x = 0;