Skip to content

Instantly share code, notes, and snippets.

@jamesrobinsonvfx
Last active January 27, 2022 21:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesrobinsonvfx/3e751c7cb7e6d51bee4ae257cd917d5d to your computer and use it in GitHub Desktop.
Save jamesrobinsonvfx/3e751c7cb7e6d51bee4ae257cd917d5d to your computer and use it in GitHub Desktop.
Easiest way to get multiparm instance index
# Callbacks
idx = kwargs["script_multiparm_index"]
# In a parameter expression
idx = evaluatingParm().multiParmInstanceIndices[0] # Returns a tuple. Will need subscript for the right level, and test for IndexError
# In a parameter expression, better
import re
idx = re.match(r".+(\d+)$", evaluatingParm().name()).group(1)
# Disable/Hide when syntax
{ enable# == 0 }
# In Type Properties / Edit Parameter Interface Defaults
# according to this excellent tip https://www.sidefx.com/forum/topic/23552/?page=1#post-153410
# not only can you use # in disable when/hide when expressions, but also parameter defaults!
# You could even just put "#" and it will evaluate it for you as if that were the default
# it only seems to work once though, so if you need multiple refs, store in a variable
# ie ch("parm_a#") + ch("parm_b#") will not work
i = #
return i + 123
@jamesrobinsonvfx
Copy link
Author

image

@jamesrobinsonvfx
Copy link
Author

image

@jamesrobinsonvfx
Copy link
Author

very exciting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment