2
0
Эх сурвалжийг харах

Fix missing setSelected
Fix null batch

ShiroSmith 6 жил өмнө
parent
commit
2897540b16

+ 6 - 2
hide/comp/SceneEditor.hx

@@ -864,6 +864,10 @@ class SceneEditor {
 		fillProps(edit, e);
 	}
 
+	function setObjectSelected( p : PrefabElement, ctx : hide.prefab.Context, b : Bool ) {
+		p.setSelected(ctx, b);
+	}
+
 	public function selectObjects( elts : Array<PrefabElement>, ?includeTree=true) {
 		scene.setCurrent();
 		if( curEdit != null )
@@ -882,7 +886,7 @@ class SceneEditor {
 				return;
 			map.set(e, true);
 			var ectx = context.shared.contexts.get(e);
-			e.setSelected(ectx == null ? context : ectx, b);
+			setObjectSelected(e, ectx == null ? context : ectx, b);
 			for( e in e.children )
 				selectRec(e,b);
 		}
@@ -894,7 +898,7 @@ class SceneEditor {
 			for( e in map.keys() ) {
 				if( hasBeenRemoved(e) ) continue;
 				var ectx = context.shared.contexts.get(e);
-				e.setSelected(ectx == null ? context : ectx, false);
+				setObjectSelected(e, ectx == null ? context : ectx, false);
 			}
 		});
 

+ 13 - 11
hide/prefab/fx/Emitter.hx

@@ -947,18 +947,20 @@ class Emitter extends Object3D {
 		if(debugShape != null)
 			debugShape.visible = b;
 
-		if( b ) {
-			var shader = new h3d.shader.FixedColor(0xffffff);
-			var p = emitterObj.batch.material.allocPass("highlight");
-			p.culling = None;
-			p.depthWrite = false;
-			p.addShader(shader);
-			@:privateAccess p.batchMode = true;
-		}
-		else {
-			emitterObj.batch.material.removePass(emitterObj.batch.material.getPass("highlight"));
+		if( emitterObj.batch != null ) {
+			if( b ) {
+				var shader = new h3d.shader.FixedColor(0xffffff);
+				var p = emitterObj.batch.material.allocPass("highlight");
+				p.culling = None;
+				p.depthWrite = false;
+				p.addShader(shader);
+				@:privateAccess p.batchMode = true;
+			}
+			else {
+				emitterObj.batch.material.removePass(emitterObj.batch.material.getPass("highlight"));
+			}
+			emitterObj.batch.shadersChanged = true;
 		}
-		emitterObj.batch.shadersChanged = true;
 	}
 
 	function updateEmitShape(emitterObj: EmitterObject) {