Просмотр исходного кода

Renamed inputs2 to connections

Clement Espeute 2 лет назад
Родитель
Сommit
2b63ab5832
3 измененных файлов с 11 добавлено и 11 удалено
  1. 2 2
      hide/view/shadereditor/ShaderEditor.hx
  2. 8 8
      hrt/shgraph/ShaderGraph.hx
  3. 1 1
      hrt/shgraph/ShaderNode.hx

+ 2 - 2
hide/view/shadereditor/ShaderEditor.hx

@@ -520,7 +520,7 @@ class ShaderEditor extends hide.view.Graph {
 	function generateEdgesFromBox(box : Box) {
 
 		for (b in listOfBoxes) {
-			for (inputName => connection in b.getInstance().inputs2) {
+			for (inputName => connection in b.getInstance().connections) {
 				if (connection.from.id == box.getId()) {
 					var nodeFrom = box.getElement().find('[field=${connection.fromName}]');
 					var nodeTo = b.getElement().find('[field=${inputName}]');
@@ -533,7 +533,7 @@ class ShaderEditor extends hide.view.Graph {
 	}
 
 	function generateEdgesToBox(box : Box) {
-		for (inputName => connection in box.getInstance().inputs2) {
+		for (inputName => connection in box.getInstance().connections) {
 			var fromBox : Box = null;
 			for (boxFrom in listOfBoxes) {
 				if (boxFrom.getId() == connection.from.id) {

+ 8 - 8
hrt/shgraph/ShaderGraph.hx

@@ -142,7 +142,7 @@ class ShaderGraph {
 		}
 
 		var connection : Connection = {from: output, fromName: edge.nameOutput};
-		node.instance.inputs2.set(edge.nameInput, connection);
+		node.instance.connections.set(edge.nameInput, connection);
 
 		#if editor
 		if (hasCycle()){
@@ -175,9 +175,9 @@ class ShaderGraph {
 
 	public function removeEdge(idNode, nameInput, update = true) {
 		var node = this.nodes.get(idNode);
-		this.nodes.get(node.instance.inputs2[nameInput].from.id).outputs.remove(node);
+		this.nodes.get(node.instance.connections[nameInput].from.id).outputs.remove(node);
 
-		node.instance.inputs2.remove(nameInput);
+		node.instance.connections.remove(nameInput);
 		if (update) {
 			updateOutputs(node);
 		}
@@ -259,7 +259,7 @@ class ShaderGraph {
 		var outputNodes : Array<Node> = [];
 		var inits : Array<{ variable : hxsl.Ast.TVar, value : Dynamic }> = [];
 
-		var allConnections : Array<Connection> = [for (node in nodes) for (connection in node.instance.inputs2) connection];
+		var allConnections : Array<Connection> = [for (node in nodes) for (connection in node.instance.connections) connection];
 
 
 		// find all node with no output
@@ -290,7 +290,7 @@ class ShaderGraph {
 			while (nodeToExplore.length > 0) {
 				var currentNode = nodeToExplore.pop();
 				sortedNodes.push(currentNode);
-				for (connection in currentNode.instance.inputs2) {
+				for (connection in currentNode.instance.connections) {
 					var targetNode = connection.from;
 					if (!allConnections.remove(connection)) throw "connection not in graph";
 					if (allConnections.find((n:Connection) -> n.from == targetNode) == null) {
@@ -369,7 +369,7 @@ class ShaderGraph {
 				for (nodeVar in def.externVars) {
 					if (nodeVar.qualifiers != null) {
 						if (nodeVar.qualifiers.has(SgInput)) {
-							var connection = currentNode.instance.inputs2.get(nodeVar.name);
+							var connection = currentNode.instance.connections.get(nodeVar.name);
 
 							var replacement : TExpr = null;
 
@@ -535,7 +535,7 @@ class ShaderGraph {
 			var node = queue[currentIndex];
 			currentIndex++;
 
-			for (connection in node.instance.inputs2) {
+			for (connection in node.instance.connections) {
 				var nodeInput = connection.from;
 				nodeInput.indegree -= 1;
 				if (nodeInput.indegree == 0) {
@@ -605,7 +605,7 @@ class ShaderGraph {
 	public function save() {
 		var edgesJson : Array<Edge> = [];
 		for (n in nodes) {
-			for (inputName => connection in n.instance.inputs2) {
+			for (inputName => connection in n.instance.connections) {
 				edgesJson.push({ idOutput: connection.from.id, nameOutput: connection.fromName, idInput: n.id, nameInput: inputName });
 			}
 		}

+ 1 - 1
hrt/shgraph/ShaderNode.hx

@@ -28,7 +28,7 @@ class ShaderNode {
 	var inputs : Map<String, NodeVar> = [];
 	// var outputs : Map<String, TVar> = [];
 
-	public var inputs2 : Map<String, ShaderGraph.Connection> = [];
+	public var connections : Map<String, ShaderGraph.Connection> = [];
 
 	public var outputCompiled : Map<String, Bool> = []; // todo: put with outputs variable