Browse Source

Compile working kinda

Clement Espeute 2 years ago
parent
commit
80fc34f51c
2 changed files with 11 additions and 9 deletions
  1. 1 3
      hrt/shgraph/ShaderGraph.hx
  2. 10 6
      hrt/shgraph/nodes/SubGraph.hx

+ 1 - 3
hrt/shgraph/ShaderGraph.hx

@@ -422,8 +422,6 @@ class ShaderGraph {
 			var inputVars : Map<String, TVar> = [];
 			for (input in currentNode.instance.inputs2) {
 				if (input.to != currentNode) throw "node connection missmatch";
-				if (input.from.type == "hrt.shgraph.nodes.Add")
-					trace("break");
 				var outputs = getOutputs(input.from);
 				var outputVar = outputs[input.fromName];
 				if (outputVar == null) throw "null tvar";
@@ -500,7 +498,7 @@ class ShaderGraph {
 							}
 							else {
 								var id = getNewVarId();
-								var outVar = {id: id, name: nodeVar.name, type: nodeVar.type, kind : Param, qualifiers: [SgOutput]};
+								var outVar = {id: id, name: nodeVar.name, type: nodeVar.type, kind : Param, qualifiers: [SgInput]};
 								replacement = {e: TVar(outVar), p:pos, t: nodeVar.type};
 								graphInputVars.push(outVar);
 								externs.push(outVar);

+ 10 - 6
hrt/shgraph/nodes/SubGraph.hx

@@ -40,12 +40,16 @@ class SubGraph extends ShaderNode {
 		var shader = new ShaderGraph(pathShaderGraph);
 		var gen = shader.generate2();
 
-		/*for (i => outVar in gen.outVars) {
-			var prefixSubGraph = "shgraph_" + id + "_";
-
-			outVar.name = prefixSubGraph + i;
-			outputs.set(prefixSubGraph + i, outVar);
-		}*/
+		for (tvar in gen.externVars) {
+			if (tvar.qualifiers != null) {
+				if (tvar.qualifiers.contains(SgInput)) {
+					gen.inVars.push(tvar);
+				}
+				if (tvar.qualifiers.contains(SgOutput)) {
+					gen.outVars.push(tvar);
+				}
+			}
+		}
 
 		return gen;
 	}