Pārlūkot izejas kodu

only show in edit mode

ncannasse 7 gadi atpakaļ
vecāks
revīzija
0e3a0974cc
2 mainītis faili ar 6 papildinājumiem un 10 dzēšanām
  1. 4 6
      hide/prefab/Blur.hx
  2. 2 4
      hide/prefab/Noise.hx

+ 4 - 6
hide/prefab/Blur.hx

@@ -83,10 +83,6 @@ class Blur extends Prefab {
 		return { name : "Blur", icon : "bullseye" };
 		return { name : "Blur", icon : "bullseye" };
 	}
 	}
 
 
-	override function setSelected( ctx : Context, b : Bool ) {
-		ctx.shared.contexts.get(this).local2d.visible = b;
-	}
-
 	override function edit( ctx : EditContext ) {
 	override function edit( ctx : EditContext ) {
 		var e : hide.Element;
 		var e : hide.Element;
 		function sync( bmp : h2d.Bitmap ) {
 		function sync( bmp : h2d.Bitmap ) {
@@ -112,8 +108,10 @@ class Blur extends Prefab {
 			syncBitmap(bmp, ctx);
 			syncBitmap(bmp, ctx);
 			sync(bmp);
 			sync(bmp);
 		});
 		});
-		var ctx = ctx.getContext(this);
-		var bmp = cast(ctx.local2d, h2d.Bitmap);
+		var lctx = ctx.getContext(this);
+		var bmp = cast(lctx.local2d, h2d.Bitmap);
+		bmp.visible = true;
+		ctx.cleanups.push(function() bmp.visible = false);
 		sync(bmp);
 		sync(bmp);
 	}
 	}
 	#end
 	#end

+ 2 - 4
hide/prefab/Noise.hx

@@ -146,10 +146,6 @@ class Noise extends Prefab {
 		return { icon : "cloud", name : "Noise Generator" };
 		return { icon : "cloud", name : "Noise Generator" };
 	}
 	}
 
 
-	override function setSelected( ctx : Context, b : Bool ) {
-		ctx.shared.contexts.get(this).local2d.visible = b;
-	}
-
 	override function edit( ctx : EditContext ) {
 	override function edit( ctx : EditContext ) {
 		var e = ctx.properties.add(new hide.Element('
 		var e = ctx.properties.add(new hide.Element('
 			<dl>
 			<dl>
@@ -209,6 +205,8 @@ class Noise extends Prefab {
 				}
 				}
 			});
 			});
 		});
 		});
+		bmp.visible = true;
+		ctx.cleanups.push(function() bmp.visible = false);
 	}
 	}
 
 
 	#end
 	#end