WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Resetting the Color and Alpha of Nodes (https://forum.worldviz.com/showthread.php?t=5106)

The SundanceKid 07-16-2014 11:12 AM

Resetting the Color and Alpha of Nodes
 
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?

Jeff 07-17-2014 04:40 PM

Saving the values to a list is probably the way to do this. Is this a model with sub-parts or is the parent/child hierarchy defined through the script? The fadeTo action takes an optional 'node' argument which applies the action to a sub-part.


All times are GMT -7. The time now is 04:59 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC