Quellcode durchsuchen

ShaderGraph prefab + some fix

Tom SPIRA vor 6 Jahren
Ursprung
Commit
709e314c59

+ 1 - 1
hide/comp/PropsEditor.hx

@@ -54,7 +54,7 @@ class PropsEditor extends Component {
 			new Element('<font color="red">' + StringTools.htmlEscape(text) + '</font>').appendTo(parent);
 		case PVec(n, min, max):
 			var isColor = p.name.toLowerCase().indexOf("color") >= 0;
-			if(isColor && n == 3) {
+			if(isColor && (n == 3 || n == 4)) {
 				new Element('<input type="color" field="${p.name}">').appendTo(parent);
 			}
 			else {

+ 7 - 3
hide/tools/ShaderLoader.hx

@@ -4,7 +4,7 @@ typedef CachedShader = {
 	var file : String;
 	var name : String;
 	var shader : hxsl.SharedShader;
-	var inits : Array<{ v : hxsl.Ast.TVar, e : hxsl.Ast.TExpr }>;
+	var inits : Array<{ variable : hxsl.Ast.TVar, value : Dynamic }>;
 	var watch : Void -> Void;
 }
 
@@ -25,7 +25,7 @@ class ShaderLoader {
 			return null;
 		var d = new hxsl.DynamicShader(s.shader);
 		for( v in s.inits )
-			d.hscriptSet(v.v.name, hxsl.Ast.Tools.evalConst(v.e));
+			d.hscriptSet(v.variable.name, hxsl.Ast.Tools.evalConst(v.value));
 		return d;
 	}
 
@@ -46,7 +46,11 @@ class ShaderLoader {
 		var s = new hxsl.SharedShader("");
 		s.data = chk.check(name, e.expr);
 		@:privateAccess s.initialize();
-		var s : CachedShader = { file : e.file, name : name, shader : s, inits : chk.inits, watch : null };
+		var convertedInits = [];
+		for (init in chk.inits) {
+			convertedInits.push({variable: init.v, value: hrt.prefab.Shader.evalConst(init.e) });
+		}
+		var s : CachedShader = { file : e.file, name : name, shader : s, inits : convertedInits, watch : null };
 		if(sys.FileSystem.exists(s.file)) {
 			s.watch = onShaderChanged.bind(s);
 			ide.fileWatcher.register(s.file, s.watch);

+ 2 - 2
hide/tools/TypesCache.hx

@@ -145,9 +145,9 @@ class TypesCache {
 							fmap.set(v.name, fl);
 						}
 						for( i in shader.inits ) {
-							var fl = fmap.get(i.v.name);
+							var fl = fmap.get(i.variable.name);
 							if( !fl.t.match(PUnsupported(_)) )
-								fl.def = hrt.prefab.Shader.evalConst(i.e);
+								fl.def = i.value;
 						}
 					}
 					file.models.push({ id : pack + c.name, kind : Shader, file : file, fields : fields });

+ 1 - 1
hide/view/Graph.hx

@@ -34,7 +34,7 @@ class Graph extends FileView {
 	static var CENTER_OFFSET_Y = 0.1; // percent of height
 
 	// used for moving when mouse is close to borders
-	static var BORDER_SIZE = 75;
+	static var BORDER_SIZE = 50;
 	static var SPEED_BORDER_MOVE = 0.05;
 	var timerUpdateView : Timer;
 

+ 51 - 38
hide/view/shadereditor/ShaderEditor.hx

@@ -1,5 +1,6 @@
 package hide.view.shadereditor;
 
+import hxsl.DynamicShader;
 import h3d.Vector;
 import h3d.Engine;
 import hrt.shgraph.ShaderParam;
@@ -42,7 +43,7 @@ class ShaderEditor extends hide.view.Graph {
 	var timerCompileShader : Timer;
 	var COMPILE_SHADER_DEBOUNCE : Int = 100;
 	var VIEW_VISIBLE_CHECK_TIMER : Int = 500;
-	var shaderGenerated : Shader;
+	var currentShader : DynamicShader;
 
 	override function onDisplay() {
 		super.onDisplay();
@@ -266,10 +267,8 @@ class ShaderEditor extends hide.view.Graph {
 				var paramNode = Std.instance(node.instance, ShaderParam);
 				if (paramNode != null) {
 					var paramShader = shaderGraph.getParameter(paramNode.parameterId);
-					paramNode.variable = paramShader.variable;
 					paramNode.setName(paramShader.name);
 					setDisplayValue(paramNode, paramShader.type, paramShader.defaultValue);
-					paramNode.computeOutputs();
 					shaderGraph.nodeUpdated(paramNode.id);
 					addBox(new Point(node.x, node.y), ShaderParam, paramNode);
 				} else {
@@ -371,15 +370,15 @@ class ShaderEditor extends hide.view.Graph {
 					}
 					if (!shaderGraph.setParameterDefaultValue(id, inputText.val()))
 						return;
+					var param = shaderGraph.getParameter(id);
 					for (b in listOfBoxes) {
 						var shaderParam = Std.instance(b.getInstance(), ShaderParam);
 						if (shaderParam != null && shaderParam.parameterId == id) {
-							var param = shaderGraph.getParameter(shaderParam.parameterId);
 							setDisplayValue(shaderParam, param.type, param.defaultValue);
 							b.generateProperties(editor);
 						}
 					}
-					launchCompileShader();
+					updateParam(param);
 				});
 				typeName = "Number";
 			case TVec(4, VFloat):
@@ -388,23 +387,24 @@ class ShaderEditor extends hide.view.Graph {
 
 				var start : h3d.Vector;
 				if (value != null)
-					start = h3d.Vector.fromArray([value.x, value.y, value.z, value.w]);
+					start = h3d.Vector.fromArray(value);
 				else
 					start = h3d.Vector.fromArray([0, 0, 0, 1]);
 				picker.value = start.toColor();
 
 				picker.onChange = function(move) {
-					if (!shaderGraph.setParameterDefaultValue(id, h3d.Vector.fromColor(picker.value)))
+					var vecColor = h3d.Vector.fromColor(picker.value);
+					if (!shaderGraph.setParameterDefaultValue(id, [vecColor.x, vecColor.y, vecColor.z, vecColor.w]))
 						return;
+					var param = shaderGraph.getParameter(id);
 					for (b in listOfBoxes) {
 						var shaderParam = Std.instance(b.getInstance(), ShaderParam);
 						if (shaderParam != null && shaderParam.parameterId == id) {
-							var param = shaderGraph.getParameter(shaderParam.parameterId);
 							setDisplayValue(shaderParam, param.type, param.defaultValue);
 							b.generateProperties(editor);
 						}
 					}
-					launchCompileShader();
+					updateParam(param);
 				};
 				typeName = "Color";
 			case TSampler2D:
@@ -415,27 +415,18 @@ class ShaderEditor extends hide.view.Graph {
 				tselect.onChange = function() {
 					if (!shaderGraph.setParameterDefaultValue(id, tselect.path))
 						return;
+					var param = shaderGraph.getParameter(id);
 					for (b in listOfBoxes) {
 						var shaderParam = Std.instance(b.getInstance(), ShaderParam);
 						if (shaderParam != null && shaderParam.parameterId == id) {
-							var param = shaderGraph.getParameter(shaderParam.parameterId);
 							setDisplayValue(shaderParam, param.type, param.defaultValue);
 							b.generateProperties(editor);
 						}
 					}
-					launchCompileShader();
+					updateParam(param);
 				}
 				typeName = "Texture";
 			default:
-				var inputText = new Element('<input type="text" />').appendTo(defaultValue);
-				if (value != null && value.length > 0) inputText.val(value);
-				inputText.on("change", function() {
-					if (inputText.val().length > 0) {
-						shaderGraph.setParameterDefaultValue(id, inputText.val());
-						launchCompileShader();
-					}
-				});
-				typeName = "String";
 		}
 
 		var header = new Element('<div class="header">
@@ -496,7 +487,7 @@ class ShaderEditor extends hide.view.Graph {
 			case TSampler2D:
 				node.setDisplayValue('file://${ide.getPath(defaultValue)}');
 			case TVec(4, VFloat):
-				var vec : Vector = defaultValue;
+				var vec = Vector.fromArray(defaultValue);
 				var hexa = StringTools.hex(vec.toColor(),8);
 				var hexaFormatted = "";
 				if (hexa.length == 8) {
@@ -557,21 +548,24 @@ class ShaderEditor extends hide.view.Graph {
 	}
 
 	function compileShader() {
-		var saveShader : Shader = null;
-		if (shaderGenerated != null)
-			saveShader = shaderGenerated.clone();
+		var newShader : DynamicShader = null;
 		try {
 			sceneEditor.scene.setCurrent();
 			var timeStart = Date.now().getTime();
 
-			if (shaderGenerated != null)
+			if (currentShader != null)
 				for (m in obj.getMaterials())
-					m.mainPass.removeShader(shaderGenerated);
+					m.mainPass.removeShader(currentShader);
 
-			shaderGenerated = shaderGraph.compile();
+			var shaderGraphDef = shaderGraph.compile();
+			newShader = new hxsl.DynamicShader(shaderGraphDef.shader);
+			for (init in shaderGraphDef.inits) {
+				setParamValue(newShader, init.variable, init.value);
+			}
 			for (m in obj.getMaterials()) {
-				m.mainPass.addShader(shaderGenerated);
+				m.mainPass.addShader(newShader);
 			}
+			currentShader = newShader;
 			@:privateAccess sceneEditor.scene.render(sceneEditor.scene.engine);
 			info('Shader compiled in  ${Date.now().getTime() - timeStart}ms');
 
@@ -587,13 +581,12 @@ class ShaderEditor extends hide.view.Graph {
 					} else {
 						error("Compilation of shader failed > " + str);
 					}
-					if (shaderGenerated != null)
+					if (newShader != null)
 						for (m in obj.getMaterials())
-							m.mainPass.removeShader(shaderGenerated);
-					if (saveShader != null) {
-						shaderGenerated = saveShader;
+							m.mainPass.removeShader(newShader);
+					if (currentShader != null) {
 						for (m in obj.getMaterials()) {
-							m.mainPass.addShader(shaderGenerated);
+							m.mainPass.addShader(currentShader);
 						}
 					}
 					return;
@@ -603,18 +596,38 @@ class ShaderEditor extends hide.view.Graph {
 				return;
 			}
 			error("Compilation of shader failed > " + e);
-			if (shaderGenerated != null)
+			if (newShader != null)
 				for (m in obj.getMaterials())
-					m.mainPass.removeShader(shaderGenerated);
-			if (saveShader != null) {
-				shaderGenerated = saveShader;
+					m.mainPass.removeShader(newShader);
+			if (currentShader != null) {
 				for (m in obj.getMaterials()) {
-					m.mainPass.addShader(shaderGenerated);
+					m.mainPass.addShader(currentShader);
 				}
 			}
 		}
 	}
 
+	function updateParam(param : Parameter) {
+		setParamValue(currentShader, param.variable, param.defaultValue);
+	}
+
+	function setParamValue(shader : DynamicShader, variable : hxsl.Ast.TVar, value : Dynamic) {
+		try {
+			switch (variable.type) {
+				case TSampler2D:
+					shader.setParamValue(variable, hxd.Res.load(value).toTexture());
+				default:
+					if (variable.name.toLowerCase().indexOf("color") != -1) {
+						shader.setParamValue(variable, Vector.fromArray(value));
+					} else {
+						shader.setParamValue(variable, value);
+					}
+			}
+		} catch (e : Dynamic) {
+			// The parameter is not used
+		}
+	}
+
 	function addNode(p : Point, nodeClass : Class<ShaderNode>) {
 		var node = shaderGraph.addNode(p.x, p.y, nodeClass);
 

+ 1 - 1
hrt/prefab/ContextShared.hx

@@ -2,7 +2,7 @@ package hrt.prefab;
 
 typedef ShaderDef = {
 	var shader : hxsl.SharedShader;
-	var inits : Array<{ v : hxsl.Ast.TVar, e : hxsl.Ast.TExpr }>;
+	var inits : Array<{ variable : hxsl.Ast.TVar, value : Dynamic }>;
 }
 
 typedef ShaderDefCache = Map<String, ShaderDef>;

+ 3 - 5
hrt/prefab/Shader.hx

@@ -57,11 +57,10 @@ class Shader extends Prefab {
 			return ctx;
 		var shader = new hxsl.DynamicShader(shaderDef.shader);
 		for( v in shaderDef.inits ) {
-			var defVal = evalConst(v.e);
 			#if !hscript
 			throw "hscript required";
 			#else
-			shader.hscriptSet(v.v.name, defVal);
+			shader.hscriptSet(v.variable.name, v.value);
 			#end
 		}
 		if(ctx.local3d != null) {
@@ -102,9 +101,8 @@ class Shader extends Prefab {
 		#if editor
 		// TODO: Where to init prefab default values?
 		for( v in shaderDef.inits ) {
-			if(!Reflect.hasField(props, v.v.name)) {
-				var defVal = evalConst(v.e);
-				Reflect.setField(props, v.v.name, defVal);
+			if(!Reflect.hasField(props, v.variable.name)) {
+				Reflect.setField(props, v.variable.name, v.value);
 			}
 		}
 		for(v in shaderDef.shader.data.vars) {

+ 48 - 0
hrt/prefab/ShaderGraph.hx

@@ -0,0 +1,48 @@
+package hrt.prefab;
+
+class ShaderGraph extends Shader {
+
+	public function new(?parent) {
+		super(parent);
+		type = "shadergraph";
+	}
+
+	override function fixSourcePath() {
+		#if editor
+		var ide = hide.Ide.inst;
+		var shadersPath = ide.projectDir + "/res";
+
+		var path = source.split("\\").join("/");
+		if( StringTools.startsWith(path.toLowerCase(), shadersPath.toLowerCase()+"/") ) {
+			path = path.substr(shadersPath.length + 1);
+		}
+		source = shadersPath + "/" + path;
+		#end
+	}
+
+	override public function loadShaderDef(ctx: Context) {
+		if(shaderDef == null) {
+			fixSourcePath();
+			var shaderGraph = new hrt.shgraph.ShaderGraph(source);
+			shaderDef = shaderGraph.compile();
+		}
+		if(shaderDef == null)
+			return;
+
+		#if editor
+		for( v in shaderDef.inits ) {
+			if(!Reflect.hasField(props, v.variable.name)) {
+				Reflect.setField(props, v.variable.name, v.value);
+			}
+		}
+		#end
+	}
+
+	#if editor
+	override function getHideProps() : HideProps {
+		return { icon : "cog", name : "Shader Graph", fileSource : ["hlshader"], allowParent : function(p) return p.to(Object3D) != null };
+	}
+	#end
+
+	static var _ = Library.register("hlshader", ShaderGraph);
+}

+ 2 - 0
hrt/shgraph/ParseFieldsMacro.hx

@@ -129,12 +129,14 @@ class ParseFieldsMacro {
 		var clPath = cl.pack.copy();
 		clPath.push(cl.name);
 
+		#if editor
 		fields.push({
 			name: "_",
 			access: [Access.AStatic],
 			kind: FieldType.FVar(macro:Bool, macro ShaderNode.register($v{cl.name}, ${clPath.toFieldExpr()})),
 			pos: Context.currentPos(),
 		});
+		#end
 
 		return fields;
 	}

+ 16 - 11
hrt/shgraph/ShaderGraph.hx

@@ -1,7 +1,6 @@
 package hrt.shgraph;
 
 import hxsl.SharedShader;
-import hxsl.DynamicShader;
 using hxsl.Ast;
 
 typedef Node = {
@@ -76,6 +75,13 @@ class ShaderGraph {
 			n.instance.loadProperties(n.properties);
 			n.instance.setId(n.id);
 			this.nodes.set(n.id, n);
+
+			var shaderParam = Std.instance(n.instance, ShaderParam);
+			if (shaderParam != null) {
+				var paramShader = getParameter(shaderParam.parameterId);
+				shaderParam.computeOutputs();
+				shaderParam.variable = paramShader.variable;
+			}
 		}
 		if (nodes[nodes.length-1] != null)
 			this.current_node_id = nodes[nodes.length-1].id+1;
@@ -269,7 +275,7 @@ class ShaderGraph {
 		return false;
 	}
 
-	public function compile() : DynamicShader {
+	public function compile() : hrt.prefab.ContextShared.ShaderDef {
 
 		allVariables = [];
 		var allParameters = [];
@@ -278,9 +284,11 @@ class ShaderGraph {
 
 		for (n in nodes) {
 			n.instance.outputCompiled = [];
+			#if !editor
 			if (Std.is(n.instance, ShaderInput) || Std.is(n.instance, ShaderParam)) {
-				//updateOutputs(n);
+				updateOutputs(n);
 			}
+			#end
 		}
 
 		var outputs : Array<String> = [];
@@ -335,17 +343,14 @@ class ShaderGraph {
 		var s = new SharedShader("");
 		s.data = shaderData;
 		@:privateAccess s.initialize();
-		var shaderCompiled = new hxsl.DynamicShader(s);
+		var inits : Array<{ variable : hxsl.Ast.TVar, value : Dynamic }> = [];
 
 		for (i in 0...allParameters.length) {
-			switch (allParameters[i].type) {
-				case TSampler2D:
-					shaderCompiled.setParamValue(allParameters[i], hxd.Res.load(allParamDefaultValue[i]).toTexture());
-				default:
-					shaderCompiled.setParamValue(allParameters[i], allParamDefaultValue[i]);
-			}
+			inits.push({ variable : allParameters[i], value : allParamDefaultValue[i] });
 		}
-		return shaderCompiled;
+
+		var shaderDef = { shader : s, inits : inits };
+		return shaderDef;
 	}
 
 	public function save() {

+ 5 - 7
hrt/shgraph/ShaderInput.hx

@@ -1,7 +1,5 @@
 package hrt.shgraph;
 
-import hide.Element;
-
 using hxsl.Ast;
 
 @name("Inputs")
@@ -64,10 +62,10 @@ class ShaderInput extends ShaderNode {
 	}
 
 	#if editor
-	override public function getPropertiesHTML(width : Float) : Array<Element> {
+	override public function getPropertiesHTML(width : Float) : Array<hide.Element> {
 		var elements = super.getPropertiesHTML(width);
-		var element = new Element('<div style="width: 110px; height: 30px"></div>');
-		element.append(new Element('<select id="variable"></select>'));
+		var element = new hide.Element('<div style="width: 110px; height: 30px"></div>');
+		element.append(new hide.Element('<select id="variable"></select>'));
 
 		if (this.variable == null) {
 			this.variable = ShaderNode.availableVariables[0];
@@ -75,14 +73,14 @@ class ShaderInput extends ShaderNode {
 		var input = element.children("select");
 		var indexOption = 0;
 		for (c in ShaderNode.availableVariables) {
-			input.append(new Element('<option value="${indexOption}">${c.name}</option>'));
+			input.append(new hide.Element('<option value="${indexOption}">${c.name}</option>'));
 			if (this.variable.name == c.name) {
 				input.val(indexOption);
 			}
 			indexOption++;
 		}
 		for (c in ShaderInput.availableInputs) {
-			input.append(new Element('<option value="${indexOption}">${c.name}</option>'));
+			input.append(new hide.Element('<option value="${indexOption}">${c.name}</option>'));
 			if (this.variable.name == c.name) {
 				input.val(indexOption);
 			}

+ 1 - 2
hrt/shgraph/ShaderNode.hx

@@ -1,6 +1,5 @@
 package hrt.shgraph;
 
-import hide.Element;
 using hxsl.Ast;
 
 typedef InputInfo = { type : ShaderType.SType, hasProperty : Bool };
@@ -175,7 +174,7 @@ class ShaderNode {
 	}
 
 	#if editor
-	public function getPropertiesHTML(width : Float) : Array<Element> {
+	public function getPropertiesHTML(width : Float) : Array<hide.Element> {
 		return [];
 	}
 

+ 5 - 7
hrt/shgraph/ShaderOutput.hx

@@ -1,7 +1,5 @@
 package hrt.shgraph;
 
-import hide.Element;
-
 using hxsl.Ast;
 
 @name("Outputs")
@@ -63,10 +61,10 @@ class ShaderOutput extends ShaderNode {
 
 
 	#if editor
-	override public function getPropertiesHTML(width : Float) : Array<Element> {
+	override public function getPropertiesHTML(width : Float) : Array<hide.Element> {
 		var elements = super.getPropertiesHTML(width);
-		var element = new Element('<div style="width: 110px; height: 30px"></div>');
-		element.append(new Element('<select id="variable"></select>'));
+		var element = new hide.Element('<div style="width: 110px; height: 30px"></div>');
+		element.append(new hide.Element('<select id="variable"></select>'));
 
 		if (this.variable == null) {
 			this.variable = ShaderNode.availableVariables[0];
@@ -74,14 +72,14 @@ class ShaderOutput extends ShaderNode {
 		var input = element.children("select");
 		var indexOption = 0;
 		for (c in ShaderNode.availableVariables) {
-			input.append(new Element('<option value="${indexOption}">${c.name}</option>'));
+			input.append(new hide.Element('<option value="${indexOption}">${c.name}</option>'));
 			if (this.variable.name == c.name) {
 				input.val(indexOption);
 			}
 			indexOption++;
 		}
 		for (c in ShaderOutput.availableOutputs) {
-			input.append(new Element('<option value="${indexOption}">${c.name}</option>'));
+			input.append(new hide.Element('<option value="${indexOption}">${c.name}</option>'));
 			if (this.variable.name == c.name) {
 				input.val(indexOption);
 			}

+ 8 - 10
hrt/shgraph/ShaderParam.hx

@@ -1,7 +1,5 @@
 package hrt.shgraph;
 
-import hide.Element;
-
 using hxsl.Ast;
 
 @noheader()
@@ -44,10 +42,10 @@ class ShaderParam extends ShaderNode {
 
 	#if editor
 	private var parameterName : String;
-	private var eltName : Element;
+	private var eltName : hide.Element;
 
 	private var parameterDisplay : String;
-	private var displayDiv : Element;
+	private var displayDiv : hide.Element;
 	public function setName(s : String) {
 		parameterName = s;
 		if (eltName != null)
@@ -68,28 +66,28 @@ class ShaderParam extends ShaderNode {
 			default:
 		}
 	}
-	override public function getPropertiesHTML(width : Float) : Array<Element> {
+	override public function getPropertiesHTML(width : Float) : Array<hide.Element> {
 		var elements = super.getPropertiesHTML(width);
 		var height = 25;
 		switch (this.variable.type) {
 			case TFloat:
-				displayDiv = new Element('<div class="float-preview" ></div>');
+				displayDiv = new hide.Element('<div class="float-preview" ></div>');
 				height += 20;
 			case TSampler2D:
-				displayDiv = new Element('<div class="texture-preview" ></div>');
+				displayDiv = new hide.Element('<div class="texture-preview" ></div>');
 				height += 50;
 			case TVec(4, VFloat):
-				displayDiv = new Element('<div class="color-preview" ></div>');
+				displayDiv = new hide.Element('<div class="color-preview" ></div>');
 				height += 25;
 			default:
 				displayDiv = null;
 		}
-		var element = new Element('<div style="width: 110px; height: ${height}px"></div>');
+		var element = new hide.Element('<div style="width: 110px; height: ${height}px"></div>');
 		if (displayDiv != null) {
 			setDisplayValue(parameterDisplay);
 			displayDiv.appendTo(element);
 		}
-		eltName = new Element('<div class="paramVisible" >${parameterName}</div>').appendTo(element);
+		eltName = new hide.Element('<div class="paramVisible" >${parameterName}</div>').appendTo(element);
 
 		elements.push(element);
 

+ 3 - 4
hrt/shgraph/nodes/BoolConst.hx

@@ -1,6 +1,5 @@
 package hrt.shgraph.nodes;
 
-import hide.Element;
 using hxsl.Ast;
 
 @name("Bool")
@@ -26,10 +25,10 @@ class BoolConst extends ShaderConst {
 	}
 
 	#if editor
-	override public function getPropertiesHTML(width : Float) : Array<Element> {
+	override public function getPropertiesHTML(width : Float) : Array<hide.Element> {
 		var elements = super.getPropertiesHTML(width);
-		var element = new Element('<div style="width: 15px; height: 30px"></div>');
-		element.append(new Element('<input type="checkbox" id="value" ></select>'));
+		var element = new hide.Element('<div style="width: 15px; height: 30px"></div>');
+		element.append(new hide.Element('<input type="checkbox" id="value" ></select>'));
 
 		var input = element.children("input");
 		input.on("change", function(e) {

+ 2 - 3
hrt/shgraph/nodes/Color.hx

@@ -1,6 +1,5 @@
 package hrt.shgraph.nodes;
 
-import hide.Element;
 using hxsl.Ast;
 
 @name("Color")
@@ -68,9 +67,9 @@ class Color extends ShaderNode {
 	}
 
 	#if editor
-	override public function getPropertiesHTML(width : Float) : Array<Element> {
+	override public function getPropertiesHTML(width : Float) : Array<hide.Element> {
 		var elements = super.getPropertiesHTML(width);
-		var element = new Element('<div style="width: 47px; height: 35px"></div>');
+		var element = new hide.Element('<div style="width: 47px; height: 35px"></div>');
 		var picker = new hide.comp.ColorPicker(true, element);
 
 

+ 4 - 5
hrt/shgraph/nodes/Cond.hx

@@ -1,6 +1,5 @@
 package hrt.shgraph.nodes;
 
-import hide.Element;
 using hxsl.Ast;
 
 @name("Condition")
@@ -73,11 +72,11 @@ class Cond extends ShaderNode {
 	}
 
 	#if editor
-	override public function getPropertiesHTML(width : Float) : Array<Element> {
+	override public function getPropertiesHTML(width : Float) : Array<hide.Element> {
 		var elements = super.getPropertiesHTML(width);
-		var element = new Element('<div style="width: ${width * 0.8}px; height: 40px"></div>');
+		var element = new hide.Element('<div style="width: ${width * 0.8}px; height: 40px"></div>');
 		element.append('<span>Condition</span>');
-		element.append(new Element('<select id="condition"></select>'));
+		element.append(new hide.Element('<select id="condition"></select>'));
 
 		if (this.condition == null) {
 			this.condition = availableConditions[0];
@@ -85,7 +84,7 @@ class Cond extends ShaderNode {
 		var input = element.children("select");
 		var indexOption = 0;
 		for (c in conditionStrings) {
-			input.append(new Element('<option value="${indexOption}">${c}</option>'));
+			input.append(new hide.Element('<option value="${indexOption}">${c}</option>'));
 			if (this.condition == availableConditions[indexOption]) {
 				input.val(indexOption);
 			}

+ 3 - 4
hrt/shgraph/nodes/FloatConst.hx

@@ -1,6 +1,5 @@
 package hrt.shgraph.nodes;
 
-import hide.Element;
 using hxsl.Ast;
 
 @name("Number")
@@ -31,10 +30,10 @@ class FloatConst extends ShaderConst {
 	}
 
 	#if editor
-	override public function getPropertiesHTML(width : Float) : Array<Element> {
+	override public function getPropertiesHTML(width : Float) : Array<hide.Element> {
 		var elements = super.getPropertiesHTML(width);
-		var element = new Element('<div style="width: 75px; height: 30px"></div>');
-		element.append(new Element('<input type="text" id="value" style="width: ${width*0.65}px" value="${value}" />'));
+		var element = new hide.Element('<div style="width: 75px; height: 30px"></div>');
+		element.append(new hide.Element('<input type="text" id="value" style="width: ${width*0.65}px" value="${value}" />'));
 
 		var input = element.children("input");
 		input.on("change", function(e) {