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

[shgraph] Filter nodes in add menu when creating links

Clément Espeute 6 сар өмнө
parent
commit
f67f7a8e29

+ 1 - 1
hide/view/GenericGraphEditor.hx

@@ -133,7 +133,7 @@ class GenericGraphEditor extends hide.view.FileView implements IGraphEditor {
         throw "implement";
         throw "implement";
     }
     }
 
 
-    public function getAddNodesMenu() : Array<AddNodeMenuEntry> {
+    public function getAddNodesMenu(currentEdge: Null<Edge>) : Array<AddNodeMenuEntry> {
         throw "implement";
         throw "implement";
     }
     }
 
 

+ 40 - 245
hide/view/GraphEditor.hx

@@ -167,7 +167,7 @@ class GraphEditor extends hide.comp.Component {
 		keys.register("shadergraph.comment", commentFromSelection);
 		keys.register("shadergraph.comment", commentFromSelection);
 		keys.register("duplicateInPlace", duplicateSelection);
 		keys.register("duplicateInPlace", duplicateSelection);
 		keys.register("duplicate", duplicateSelection);
 		keys.register("duplicate", duplicateSelection);
-		keys.register("graph.openAddMenu", openAddMenu2);
+		keys.register("graph.openAddMenu", openAddMenu);
 		keys.register("cancel", cancelAll);
 		keys.register("cancel", cancelAll);
 
 
 
 
@@ -206,7 +206,7 @@ class GraphEditor extends hide.comp.Component {
 			// 		cleanupCreateEdge();
 			// 		cleanupCreateEdge();
 			// 	}
 			// 	}
 			// 	else {
 			// 	else {
-			// 		openAddMenu2();
+			// 		openAddMenu();
 			// 	}
 			// 	}
 			// 	e.preventDefault();
 			// 	e.preventDefault();
 			// 	e.stopPropagation();
 			// 	e.stopPropagation();
@@ -214,7 +214,7 @@ class GraphEditor extends hide.comp.Component {
 		});
 		});
 
 
 		heapsScene.on("contextmenu", function(e) {
 		heapsScene.on("contextmenu", function(e) {
-			openAddMenu2();
+			openAddMenu();
 			e.preventDefault();
 			e.preventDefault();
 		});
 		});
 
 
@@ -238,7 +238,7 @@ class GraphEditor extends hide.comp.Component {
 						return;
 						return;
 					}
 					}
 					else {
 					else {
-						openAddMenu2();
+						openAddMenu();
 						e.stopPropagation();
 						e.stopPropagation();
 						return;
 						return;
 					}
 					}
@@ -538,17 +538,21 @@ class GraphEditor extends hide.comp.Component {
 
 
 	static var lastOpenAddMenuPoint = new Point();
 	static var lastOpenAddMenuPoint = new Point();
 
 
-	function openAddMenu2() {
-		if (getDisplayState("useOldAddMenu") != null) {
-			openAddMenu();
-			return;
-		}
-
+	function openAddMenu() {
 		if (contextMenu != null)
 		if (contextMenu != null)
 			return;
 			return;
 		lastOpenAddMenuPoint.set(lX(ide.mouseX), lY(ide.mouseY));
 		lastOpenAddMenuPoint.set(lX(ide.mouseX), lY(ide.mouseY));
 
 
-		var nodes = editor.getAddNodesMenu();
+		var edge : Edge = null;
+		if (edgeCreationOutput != null) {
+			var unpack = unpackIO(edgeCreationOutput);
+			edge = { nodeFromId: unpack.nodeId, outputFromId: unpack.ioId};
+		} else if (edgeCreationInput != null) {
+			var unpack = unpackIO(edgeCreationInput);
+			edge = { nodeToId: unpack.nodeId, inputToId: unpack.ioId};
+		}
+
+		var nodes = editor.getAddNodesMenu(edge);
 
 
 		var groups: Map<String, Array<hide.view.GraphInterface.AddNodeMenuEntry>> = [];
 		var groups: Map<String, Array<hide.view.GraphInterface.AddNodeMenuEntry>> = [];
 
 
@@ -567,14 +571,6 @@ class GraphEditor extends hide.comp.Component {
 			var createLinkOutput = edgeCreationOutput;
 			var createLinkOutput = edgeCreationOutput;
 			var fromInput = createLinkInput != null;
 			var fromInput = createLinkInput != null;
 
 
-
-			if (createLinkInput != null) {
-				createLinkOutput = packIO(instance.id, 0);
-			}
-			else if (createLinkOutput != null) {
-				createLinkInput = packIO(instance.id, 0);
-			}
-
 			var pos = new h2d.col.Point();
 			var pos = new h2d.col.Point();
 			pos.load(lastOpenAddMenuPoint);
 			pos.load(lastOpenAddMenuPoint);
 			if (createLinkInput != null) {
 			if (createLinkInput != null) {
@@ -584,6 +580,30 @@ class GraphEditor extends hide.comp.Component {
 
 
 			instance.setPos(pos);
 			instance.setPos(pos);
 			opBox(instance, true, currentUndoBuffer);
 			opBox(instance, true, currentUndoBuffer);
+
+			if (createLinkInput != null) {
+				// Find first output that is compatible with our input type
+				var input = unpackIO(createLinkInput);
+				for (i in 0...instance.getInfo().outputs.length) {
+					var edge : Edge = {nodeToId: input.nodeId, inputToId: input.ioId, nodeFromId: instance.id, outputFromId: i};
+					if (editor.canAddEdge(edge)) {
+						createLinkOutput = packIO(instance.id, i);
+						break;
+					}
+				}
+			}
+			else if (createLinkOutput != null) {
+				// Find first input that is compatible with our input type
+				var output = unpackIO(createLinkOutput);
+				for (i in 0...instance.getInfo().inputs.length) {
+					var edge : Edge = {nodeToId: instance.id, inputToId: i, nodeFromId: output.nodeId, outputFromId: output.ioId};
+					if (editor.canAddEdge(edge)) {
+						createLinkInput = packIO(instance.id, i);
+						break;
+					}
+				}
+			}
+
 			if (createLinkInput != null && createLinkOutput != null) {
 			if (createLinkInput != null && createLinkOutput != null) {
 				var box = boxes[instance.id];
 				var box = boxes[instance.id];
 				var x = (fromInput ? @:privateAccess box.width : 0) - Box.NODE_HITBOX_RADIUS;
 				var x = (fromInput ? @:privateAccess box.width : 0) - Box.NODE_HITBOX_RADIUS;
@@ -608,237 +628,12 @@ class GraphEditor extends hide.comp.Component {
 			});
 			});
 		}
 		}
 
 
-		contextMenu = hide.comp.ContextMenu.createFromPoint(ide.mouseX, ide.mouseY, menu, {search: Visible, noIcons: true});
+		contextMenu = hide.comp.ContextMenu.createFromPoint(ide.mouseX, ide.mouseY, menu, {search: Visible, noIcons: true, flat: nodes.length < 10});
 		contextMenu.onClose = () -> {
 		contextMenu.onClose = () -> {
 			contextMenu = null;
 			contextMenu = null;
 		};
 		};
 	}
 	}
 
 
-	function openAddMenu(x : Int = 0, y : Int = 0) {
-
-		var boundsWidth = Std.int(element.width());
-		var boundsHeight = Std.int(element.height());
-
-		lastOpenAddMenuPoint.set(lX(ide.mouseX), lY(ide.mouseY));
-
-		var posCursor = new Point(Std.int(ide.mouseX - heapsScene.offset().left) + x, Std.int(ide.mouseY - heapsScene.offset().top) + y);
-		if( posCursor.x < 0 )
-			posCursor.x = 0;
-		if( posCursor.y < 0)
-			posCursor.y = 0;
-
-		if (addMenu != null) {
-			var menuWidth = Std.parseInt(addMenu.css("width")) + 10;
-			var menuHeight = Std.parseInt(addMenu.css("height")) + 10;
-			if( posCursor.x + menuWidth > boundsWidth )
-				posCursor.x = boundsWidth - menuWidth;
-			if( posCursor.y + menuHeight > boundsHeight )
-				posCursor.y = boundsHeight - menuHeight;
-
-			var input = addMenu.find("#search-input");
-			input.val("");
-			addMenu.show();
-			input.focus();
-
-			addMenu.css("left", posCursor.x);
-			addMenu.css("top", posCursor.y);
-
-			for (c in addMenu.find("#results").children().elements()) {
-				c.show();
-			}
-			return;
-		}
-
-		addMenu = new Element('
-		<div id="add-menu">
-			<div class="search-container">
-				<div class="icon" >
-					<i class="ico ico-search"></i>
-				</div>
-				<div class="search-bar" >
-					<input type="text" id="search-input" autocomplete="off" >
-				</div>
-			</div>
-			<div id="results">
-			</div>
-		</div>').appendTo(heapsScene);
-
-		addMenu.on("pointerdown", function(e) {
-			e.stopPropagation();
-		});
-
-		addMenu.on("blur", function(e) {
-			closeAddMenu();
-		});
-
-		var results = addMenu.find("#results");
-		results.on("wheel", function(e) {
-			e.stopPropagation();
-		});
-
-		var nodes = editor.getAddNodesMenu();
-		var prevGroups : Map<String, Element> = [];
-		for (i => node in nodes) {
-			if (prevGroups.get(node.group) == null) {
-				var groupEl = new Element('
-				<div class="group" >
-					<span> ${node.group} </span>
-				</div>').appendTo(results);
-				prevGroups.set(node.group, groupEl);
-			}
-
-			new Element('
-				<div node="$i" >
-					<span> ${node.name} </span> <span> ${node.description} </span>
-				</div>').insertAfter(prevGroups.get(node.group));
-		}
-
-		var menuWidth = Std.parseInt(addMenu.css("width")) + 10;
-		var menuHeight = Std.parseInt(addMenu.css("height")) + 10;
-		if( posCursor.x + menuWidth > boundsWidth )
-			posCursor.x = boundsWidth - menuWidth;
-		if( posCursor.y + menuHeight > boundsHeight )
-			posCursor.y = boundsHeight - menuHeight;
-		addMenu.css("left", posCursor.x);
-		addMenu.css("top", posCursor.y);
-
-		var input = addMenu.find("#search-input");
-		input.focus();
-		var divs = new Element("#results > div");
-		input.on("keydown", function(ev) {
-			if (ev.key == "Escape") {
-				cancelAll();
-				ev.stopPropagation();
-				ev.preventDefault();
-			}
-			if (ev.keyCode == 38 || ev.keyCode == 40) {
-				ev.stopPropagation();
-				ev.preventDefault();
-
-				if (this.selectedNode != null)
-					this.selectedNode.removeClass("selected");
-
-				var selector = "div[node]:not([style*='display: none'])";
-				var elt = this.selectedNode;
-
-				if (ev.keyCode == 38) {
-					do {
-						elt = elt.prev();
-					} while (elt.length > 0 && !elt.is(selector));
-				} else if (ev.keyCode == 40) {
-					do {
-						elt = elt.next();
-					} while (elt.length > 0 && !elt.is(selector));
-				}
-				if (elt.length == 1) {
-					this.selectedNode = elt;
-				}
-				if (this.selectedNode != null)
-					this.selectedNode.addClass("selected");
-
-				var offsetDiff = this.selectedNode.offset().top - results.offset().top;
-				if (offsetDiff > 225) {
-					results.scrollTop((offsetDiff-225)+results.scrollTop());
-				} else if (offsetDiff < 35) {
-					results.scrollTop(results.scrollTop()-(35-offsetDiff));
-				}
-			}
-		});
-
-		function doAdd() {
-			var key = Std.parseInt(this.selectedNode.attr("node"));
-			//var posCursor = new Point(lX(ide.mouseX - 25), lY(ide.mouseY - 10));
-
-			var instance = nodes[key].onConstructNode();
-
-			var createLinkInput = edgeCreationInput;
-			var createLinkOutput = edgeCreationOutput;
-			var fromInput = createLinkInput != null;
-
-
-			if (createLinkInput != null) {
-				createLinkOutput = packIO(instance.id, 0);
-			}
-			else if (createLinkOutput != null) {
-				createLinkInput = packIO(instance.id, 0);
-			}
-
-			var pos = new h2d.col.Point();
-			pos.load(lastOpenAddMenuPoint);
-			if (createLinkInput != null) {
-				pos.set(lastCurveX, lastCurveY);
-			}
-			cleanupCreateEdge();
-
-			instance.setPos(pos);
-			opBox(instance, true, currentUndoBuffer);
-			if (createLinkInput != null && createLinkOutput != null) {
-				var box = boxes[instance.id];
-				var x = (fromInput ? @:privateAccess box.width : 0) - Box.NODE_HITBOX_RADIUS;
-				var y = box.getNodeHeight(0) - Box.NODE_HITBOX_RADIUS;
-				opMove(boxes[instance.id], pos.x - x, pos.y - y, currentUndoBuffer);
-				opEdge(createLinkOutput, createLinkInput, true, currentUndoBuffer);
-			}
-
-			commitUndo();
-			closeAddMenu();
-		}
-
-		input.on("keyup", function(ev) {
-			if (ev.keyCode == 38 || ev.keyCode == 40) {
-				return;
-			}
-
-			if (ev.keyCode == 13) {
-				doAdd();
-			} else {
-				if (this.selectedNode != null)
-					this.selectedNode.removeClass("selected");
-				var value = StringTools.trim(input.val());
-				var children = divs.elements();
-				var isFirst = true;
-				var lastGroup = null;
-				for (elt in children) {
-					if (elt.hasClass("group")) {
-						lastGroup = elt;
-						elt.hide();
-						continue;
-					}
-					if (value.length == 0 || elt.children().first().html().toLowerCase().indexOf(value.toLowerCase()) != -1) {
-						if (isFirst) {
-							this.selectedNode = elt;
-							isFirst = false;
-						}
-						elt.show();
-						if (lastGroup != null)
-							lastGroup.show();
-					} else {
-						elt.hide();
-					}
-				}
-				if (this.selectedNode != null)
-					this.selectedNode.addClass("selected");
-			}
-		});
-		divs.on("pointerover", function(ev) {
-			if (ev.currentTarget.classList.contains("group")) {
-				return;
-			}
-			if (this.selectedNode != null)
-				this.selectedNode.removeClass("selected");
-			this.selectedNode = new Element(ev.currentTarget); // Todo : not make this jquery
-			this.selectedNode.addClass("selected");
-		});
-		divs.on("pointerup", function(ev) {
-			if (ev.currentTarget.classList.contains("group")) {
-				return;
-			}
-
-			doAdd();
-			ev.stopPropagation();
-		});
-	}
-
 	function closeAddMenu() {
 	function closeAddMenu() {
 		if (addMenu != null) {
 		if (addMenu != null) {
 			addMenu.hide();
 			addMenu.hide();

+ 11 - 5
hide/view/GraphInterface.hx

@@ -76,10 +76,10 @@ typedef AddNodeMenuEntry = {
 
 
 /**An edge between 2 nodes. the inputs/outpus id are based on the order of the inputs/ouputs returned by IGraphNode.getInfo()**/
 /**An edge between 2 nodes. the inputs/outpus id are based on the order of the inputs/ouputs returned by IGraphNode.getInfo()**/
 typedef Edge = {
 typedef Edge = {
-    nodeFromId : Int,
-    outputFromId : Int,
-    nodeToId : Int,
-    inputToId : Int,
+    ?nodeFromId : Int,
+    ?outputFromId : Int,
+    ?nodeToId : Int,
+    ?inputToId : Int,
 };
 };
 
 
 interface IGraphNode {
 interface IGraphNode {
@@ -100,7 +100,13 @@ interface IGraphNode {
 interface IGraphEditor {
 interface IGraphEditor {
     public function getNodes() : Iterator<IGraphNode>;
     public function getNodes() : Iterator<IGraphNode>;
     public function getEdges() : Iterator<Edge>;
     public function getEdges() : Iterator<Edge>;
-    public function getAddNodesMenu() : Array<AddNodeMenuEntry>;
+
+    /**
+        currentEdge is not null it there is a link being created.
+        You can use this information to filter the list of nodes in the
+        output entry based on compatible types
+    **/
+    public function getAddNodesMenu(currentEdge: Null<Edge>) : Array<AddNodeMenuEntry>;
 
 
     public function addNode(node : IGraphNode) : Void;
     public function addNode(node : IGraphNode) : Void;
     public function removeNode(id:Int) : Void;
     public function removeNode(id:Int) : Void;

+ 1 - 1
hide/view/animgraph/AnimGraphEditor.hx

@@ -447,7 +447,7 @@ class AnimGraphEditor extends GenericGraphEditor {
         return edges.iterator();
         return edges.iterator();
     }
     }
 
 
-    override function getAddNodesMenu():Array<AddNodeMenuEntry> {
+    override function getAddNodesMenu(currentEdge: Null<Edge>):Array<AddNodeMenuEntry> {
         var menu : Array<AddNodeMenuEntry> = [];
         var menu : Array<AddNodeMenuEntry> = [];
         for (nodeInternalName => type in hrt.animgraph.Node.registeredNodes) {
         for (nodeInternalName => type in hrt.animgraph.Node.registeredNodes) {
             var info = Type.createEmptyInstance(type);
             var info = Type.createEmptyInstance(type);

+ 60 - 31
hide/view/shadereditor/ShaderEditor.hx

@@ -293,7 +293,6 @@ class ShaderEditor extends hide.view.FileView implements GraphInterface.IGraphEd
 						<select id="domainSelection"></select>
 						<select id="domainSelection"></select>
 					</div>
 					</div>
 					<div> Preview Alpha<input id="previewAlpha" type="checkbox" /></div>
 					<div> Preview Alpha<input id="previewAlpha" type="checkbox" /></div>
-					<div> Use old add menu<input id="oldAddMenu" type="checkbox" /></div>
 
 
 					<input id="centerView" type="button" value="Center Graph" />
 					<input id="centerView" type="button" value="Center Graph" />
 					<input id="debugMenu" type="button" value="Debug Menu"/>
 					<input id="debugMenu" type="button" value="Debug Menu"/>
@@ -366,15 +365,7 @@ class ShaderEditor extends hide.view.FileView implements GraphInterface.IGraphEd
 		});
 		});
 		(cast previewAlpha[0]:Dynamic).checked = previewSettings.previewAlpha;
 		(cast previewAlpha[0]:Dynamic).checked = previewSettings.previewAlpha;
 
 
-		var oldAddMenu = rightPannel.find("#oldAddMenu");
-		oldAddMenu.on("change", (e) -> {
-			if (untyped oldAddMenu.get(0).checked) {
-				graphEditor.saveDisplayState("useOldAddMenu", true);
-			} else {
-				graphEditor.removeDisplayState("useOldAddMenu");
-			}
-		});
-		untyped oldAddMenu.get(0).checked = graphEditor.getDisplayState("useOldAddMenu") != null;
+
 
 
 		rightPannel.appendTo(element);
 		rightPannel.appendTo(element);
 
 
@@ -1870,9 +1861,40 @@ class ShaderEditor extends hide.view.FileView implements GraphInterface.IGraphEd
 		return node;
 		return node;
 	}
 	}
 
 
-	public function getAddNodesMenu() : Array<AddNodeMenuEntry> {
+	public function getAddNodesMenu(currentEdge: Null<Edge>) : Array<AddNodeMenuEntry> {
 		var entries : Array<AddNodeMenuEntry> = [];
 		var entries : Array<AddNodeMenuEntry> = [];
 
 
+		final needCompatibilityCheck = currentEdge != null;
+
+		function checkCompatibilityWithEdge(node: ShaderNode) {
+			if (currentEdge != null) {
+				node.graph = currentGraph;
+				if (currentEdge.nodeToId != null) {
+					var to = currentGraph.nodes[currentEdge.nodeToId];
+					var input = to.getInputs()[currentEdge.inputToId];
+					var outputs = node.getOutputs();
+					for (output in outputs) {
+						if(ShaderGraph.Graph.areTypesCompatible(input.type, output.type)) {
+							return true;
+						}
+					}
+				}
+
+				if (currentEdge.nodeFromId != null) {
+					var from = currentGraph.nodes[currentEdge.nodeFromId];
+					var output = from.getOutputs()[currentEdge.outputFromId];
+					var inputs = node.getInputs();
+					for (input in inputs) {
+						if (ShaderGraph.Graph.areTypesCompatible(input.type, output.type)) {
+							return true;
+						}
+					}
+				}
+				return false;
+			}
+			return true;
+		}
+
 		var id = 0;
 		var id = 0;
 		for (i => node in ShaderNode.registeredNodes) {
 		for (i => node in ShaderNode.registeredNodes) {
 			var metas = haxe.rtti.Meta.getType(node);
 			var metas = haxe.rtti.Meta.getType(node);
@@ -1880,40 +1902,47 @@ class ShaderEditor extends hide.view.FileView implements GraphInterface.IGraphEd
 				continue;
 				continue;
 			}
 			}
 
 
+			if (metas.hideInAddMenu != null)
+				continue;
+
 			var group = metas.group != null ? metas.group[0] : "Other";
 			var group = metas.group != null ? metas.group[0] : "Other";
 			var name = metas.name != null ? metas.name[0] : "unknown";
 			var name = metas.name != null ? metas.name[0] : "unknown";
 			var description = metas.description != null ? metas.description[0] : "";
 			var description = metas.description != null ? metas.description[0] : "";
 
 
-			entries.push(
-				{
-					name: name,
-					group: group,
-					description: description,
-					onConstructNode: () -> {
-						@:privateAccess var id = currentGraph.current_node_id++;
-						var inst = std.Type.createInstance(node, []);
-						inst.setId(id);
-						return inst;
-					},
-				}
-			);
-
-			var aliases = std.Type.createEmptyInstance(node).getAliases(name, group, description) ?? [];
-			for (alias in aliases) {
+			if (!needCompatibilityCheck || checkCompatibilityWithEdge(Type.createInstance(node, []))) {
 				entries.push(
 				entries.push(
 					{
 					{
-						name: alias.nameSearch ?? alias.nameOverride ?? name,
-						group: alias.group ?? group,
-						description: alias.description ?? description,
+						name: name,
+						group: group,
+						description: description,
 						onConstructNode: () -> {
 						onConstructNode: () -> {
 							@:privateAccess var id = currentGraph.current_node_id++;
 							@:privateAccess var id = currentGraph.current_node_id++;
-							var inst = std.Type.createInstance(node, alias.args ?? []);
+							var inst = std.Type.createInstance(node, []);
 							inst.setId(id);
 							inst.setId(id);
 							return inst;
 							return inst;
 						},
 						},
 					}
 					}
 				);
 				);
 			}
 			}
+
+			var aliases = std.Type.createEmptyInstance(node).getAliases(name, group, description) ?? [];
+			for (alias in aliases) {
+				if (!needCompatibilityCheck || checkCompatibilityWithEdge(std.Type.createInstance(node, alias.args ?? []))) {
+					entries.push(
+						{
+							name: alias.nameSearch ?? alias.nameOverride ?? name,
+							group: alias.group ?? group,
+							description: alias.description ?? description,
+							onConstructNode: () -> {
+								@:privateAccess var id = currentGraph.current_node_id++;
+								var inst = std.Type.createInstance(node, alias.args ?? []);
+								inst.setId(id);
+								return inst;
+							},
+						}
+					);
+				}
+			}
 		}
 		}
 		return entries;
 		return entries;
 	}
 	}

+ 1 - 1
hide/view/textureeditor/TextureEditor.hx

@@ -279,7 +279,7 @@ class TextureEditor extends hide.view.FileView implements GraphInterface.IGraphE
 		return edges.iterator();
 		return edges.iterator();
 	}
 	}
 
 
-	public function getAddNodesMenu():Array<AddNodeMenuEntry> {
+	public function getAddNodesMenu(currentEdge: Null<Edge>):Array<AddNodeMenuEntry> {
 		var entries : Array<AddNodeMenuEntry> = [];
 		var entries : Array<AddNodeMenuEntry> = [];
 		var id = 0;
 		var id = 0;
 		for (i => node in hrt.texgraph.TexNode.registeredNodes) {
 		for (i => node in hrt.texgraph.TexNode.registeredNodes) {

+ 1 - 1
hrt/shgraph/ShaderGraph.hx

@@ -980,7 +980,7 @@ class Graph {
 		this.nodes.set(shNode.id, shNode);
 		this.nodes.set(shNode.id, shNode);
 	}
 	}
 
 
-	public function areTypesCompatible(input: SgType, output: SgType) : Bool {
+	static public function areTypesCompatible(input: SgType, output: SgType) : Bool {
 		return switch (input) {
 		return switch (input) {
 			case SgFloat(_):
 			case SgFloat(_):
 				switch (output) {
 				switch (output) {

+ 1 - 0
hrt/shgraph/nodes/VarRead.hx

@@ -5,6 +5,7 @@ package hrt.shgraph.nodes;
 @description("Read a value from a local variable")
 @description("Read a value from a local variable")
 @width(80)
 @width(80)
 @group("Variables")
 @group("Variables")
+@hideInAddMenu
 class VarRead extends ShaderVar {
 class VarRead extends ShaderVar {
 
 
 	public function new() {
 	public function new() {

+ 2 - 0
hrt/shgraph/nodes/VarWrite.hx

@@ -4,6 +4,7 @@ package hrt.shgraph.nodes;
 @description("Write a value to a local variable")
 @description("Write a value to a local variable")
 @width(80)
 @width(80)
 @group("Variables")
 @group("Variables")
+@hideInAddMenu
 class VarWrite extends ShaderVar {
 class VarWrite extends ShaderVar {
 
 
 	public function new() {
 	public function new() {
@@ -18,6 +19,7 @@ class VarWrite extends ShaderVar {
 		inputs[0].name = graph.parent.variables[varId]?.name ?? "error";
 		inputs[0].name = graph.parent.variables[varId]?.name ?? "error";
 		inputs[0].type = graph.parent.variables[varId]?.type ?? SgBool;
 		inputs[0].type = graph.parent.variables[varId]?.type ?? SgBool;
 		return inputs;
 		return inputs;
+
 	}
 	}
 
 
 	override function generate(ctx:NodeGenContext) {
 	override function generate(ctx:NodeGenContext) {