Hi,
I'm trying to make nodes 'blink' in Vizard 5. I wrote the following code to make a given node blink:
Code:
fadeColor = vizact.fadeTo(node.getColor(), time=0.333)
fadeWhite = vizact.fadeTo([1,1,1], time=0.333)
fadeSequence = vizact.sequence(fadeWhite,fadeColor,viz.FOREVER)
node.addAction(fadeSequence)
This code works. My problem arises when I want a given node to stop blinking. If I have its node.getColor() values, I can just fade the node back to those values. But this works only for one-color nodes; some nodes, for example those composed of one green node and one black node, will return values that represent a diffusion of green and black when I call node.getColor(). This means I can only reset nodes to a mix of their original colors — I can't set all of their children back to each of their respective original colors.
Of course, I could recurse through each child and each child of each child for all of the nodes, save all the color values to a list, and then access those values when resetting their colors and alphas. Surely, there's an easier way to do this, right? Isn't there some built-in function that I can call to reset a node to its original state/color/alpha?