Quellcode durchsuchen

Added icon visibility option to all scene editors

Clement Espeute vor 2 Jahren
Ursprung
Commit
f84152490f
4 geänderte Dateien mit 11 neuen und 3 gelöschten Zeilen
  1. 1 1
      hide/comp/Toolbar.hx
  2. 1 0
      hide/view/FXEditor.hx
  3. 8 1
      hide/view/Model.hx
  4. 1 1
      hide/view/Prefab.hx

+ 1 - 1
hide/comp/Toolbar.hx

@@ -80,7 +80,7 @@ class Toolbar extends Component {
 		return e;
 	}
 
-	public function addToggle( icon : String, ?title : String, ?label : String, ?onToggle : Bool -> Void, ?defValue = false, ?toggledIcon : String ) : ToolToggle {
+	public function addToggle( icon : String, ?title : String, ?label : String, ?onToggle : Bool -> Void, ?defValue = false, ?toggledIcon : String) : ToolToggle {
 		var e = new Element('<div class="button2" title="${title==null ? "" : title}"><div class="icon ico ico-$icon"/></div>');
 		if(label != null) {
 			new Element('<label>$label</label>').appendTo(e);

+ 1 - 0
hide/view/FXEditor.hx

@@ -637,6 +637,7 @@ class FXEditor extends FileView {
 		toolsDefs.push({id: "gridToggle", title : "Toggle grid", icon : "th", type : Toggle((v) -> { showGrid = v; updateGrid(); }) });
 		toolsDefs.push({id: "axisToggle", title : "Toggle model axis", icon : "cube", type : Toggle((v) -> { sceneEditor.showBasis = v; sceneEditor.updateBasis(); }) });
 		toolsDefs.push({id: "iconVisibility", title : "Toggle 3d icons visibility", icon : "image", type : Toggle((v) -> { hide.Ide.inst.show3DIcons = v; }), defaultValue: true });
+		toolsDefs.push({id: "iconVisibility-menu", title : "", icon: "", type : Popup((e) -> new hide.comp.SceneEditor.IconVisibilityPopup(null, e, sceneEditor))});
 
 
 		tools.saveDisplayKey = "FXScene/tools";

+ 8 - 1
hide/view/Model.hx

@@ -56,6 +56,7 @@ class Model extends FileView {
 		super.save();
 	}
 
+
 	override function onFileChanged( wasDeleted : Bool, rebuildView = true ) {
 		if (wasDeleted ) {
 			super.onFileChanged(wasDeleted);
@@ -297,7 +298,7 @@ class Model extends FileView {
 			}
 		}
 		var saveCallback = function(_) {
-			var mat = findMat(matLib.val()); 
+			var mat = findMat(matLib.val());
 			if ( mat != null ) {
 				for ( f in Reflect.fields((m.props:Dynamic)) )
 					Reflect.deleteField((m.props:Dynamic), f);
@@ -648,6 +649,12 @@ class Model extends FileView {
 			showSelectionAxes = v;
 			refreshSelectionHighlight(lastSelectedObject);
 		});
+
+		var toolsDefs : Array<hide.comp.Toolbar.ToolDef> = [];
+		toolsDefs.push({id: "iconVisibility", title : "Toggle 3d icons visibility", icon : "image", type : Toggle((v) -> { hide.Ide.inst.show3DIcons = v; }), defaultValue: true });
+        toolsDefs.push({id: "iconVisibility-menu", title : "", icon: "", type : Popup((e) -> new hide.comp.SceneEditor.IconVisibilityPopup(null, e, sceneEditor))});
+		tools.makeToolbar(toolsDefs);
+
 		tools.addToggle("connectdevelop", "Wireframe",(b) -> {
 			sceneEditor.setWireframe(b);
 		});

+ 1 - 1
hide/view/Prefab.hx

@@ -415,7 +415,7 @@ class Prefab extends FileView {
 		toolsDefs.push({id: "gridToggle", title : "Toggle grid", icon : "th", type : Toggle((v) -> { showGrid = v; updateGrid(); }) });
 		toolsDefs.push({id: "axisToggle", title : "Toggle model axis", icon : "cube", type : Toggle((v) -> { sceneEditor.showBasis = v; sceneEditor.updateBasis(); }) });
 		toolsDefs.push({id: "iconVisibility", title : "Toggle 3d icons visibility", icon : "image", type : Toggle((v) -> { hide.Ide.inst.show3DIcons = v; }), defaultValue: true });
-        toolsDefs.push({id: "iconVisibility-menu", title : "", icon: "", type : Popup((e) -> new hide.comp.SceneEditor.IconVisibilityPopup(null, e, sceneEditor))});
+		toolsDefs.push({id: "iconVisibility-menu", title : "", icon: "", type : Popup((e) -> new hide.comp.SceneEditor.IconVisibilityPopup(null, e, sceneEditor))});
 
 
 		var texContent : Element = null;