TOPS and global context options

   852   0   1
User Avatar
Member
207 posts
Joined: Nov. 2015
Offline
Hi there;

I have a scene in which I am randomly populating a few global Context Options - in my specific case, I am storing three numbers which represent RGB values, to which I refer at various points throughout my scene.

I also have a bit of my scene that procedurally generates some geometry; for this, I use TOPs. I use the Wedge top to drive a few params on my procedural geo, then bake these out to disk.

Programmatically, I am using Hython to open the scene file, randomize the Context Options, save the scene as a new hip file, then run the TOP graph.

I notice something odd when I do this, though: even though I am randomizing my Context Options and saving the scene, my procedural geo - as baked out by TOPS - seems to be 'stuck' using the Context Options as they exist in the original scene. This is to say: they don't seem to be updated when I run my TOP graph to bake out the geo.

I can work around this by adding a variable on my Wedge node, parsing the Context Option in this variable, and then 'pulling' on it from the geo network. This is to say that in my geometry network, this works:

// read my context option, and store it in a variable used in TOPs
@wedge_color.r = @context_option_r
@wedge_color.g = @context_option_g
@wedge_color.b = @context_option_b

// Read the 'cached' TOP-ified context option
@Cd.r = @wedge_color.r
@Cd.g = @wedge_color.g
@Cd.b = @wedge_color.b

but this does not:

// Would much rather be able to just do this directly
@Cd.r = @context_option_r
@Cd.g = @context_option_g
@Cd.b = @context_option_b

The former option seems like unnecessary rigamarole, however, and I would prefer to use the latter strategy.

Could someone help me understand what I might be doing wrong, that would prevent the second strategy from working?
  • Quick Links