Access parent node in Shake scripting?

Hello all! I’ve been a member for a while but never actually posted before. But this morning, I ran into a mind-twister that had me going all day. Here I am, workday over, 2 pots of coffee emptied, and still no result. So, I bring it to you guys!

The goal here is to be able to write a macro that deals with the values of other input nodes. For simplicity’s sake, what’s below isn’t what I’m actually coding, but it deals with the same issues. If you guys want to see the full source, I can certainly provide! And I’ll definitely make this macro publicly available when all is said and done.

Let’s say that I want to write a macro called AverageBrightness, where I can input two brightness nodes and it performs a brightness operation based on both inputs. Consider:

Code:

image BrightnessAverage(
  image In1=0,
  image In2=0,
  float brightnessAverage=0
)  {
  Brightness1 = Brightness(0,(In1.value+In2.value)/2);
}


Theoretically, Brightness1.value should be the average of the second and third inputs. But, Shake doesn’t allow access to parent node parameters this way.

There’s another option, to manually input the NAMES of the reference nodes. Problem with this, though, is that there’s no kind of "Eval" statement. Consider:

Code:

image BrightnessAverage(
  string inputNode1="Brightness1",
  string inputNode2="Brightness2"
) {
  Brightness1 = Brightness(0,({inputNode1}.value+{inputNode2}.value)/2);
}


Anybody with some more Shake scripting/C experience have any thoughts?? :confused:

No Responses to “Access parent node in Shake scripting?”

Post a Comment