WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 07-16-2014, 12:12 PM
The SundanceKid The SundanceKid is offline
Member
 
Join Date: May 2014
Posts: 4
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?

Last edited by The SundanceKid; 07-16-2014 at 12:15 PM.
Reply With Quote
  #2  
Old 07-17-2014, 05:40 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
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.
Reply With Quote
Reply

Tags
alpha, color, getcolor(), reset, vizard 5.0


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:04 PM.


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