Last active
January 27, 2022 21:04
-
-
Save jamesrobinsonvfx/3e751c7cb7e6d51bee4ae257cd917d5d to your computer and use it in GitHub Desktop.
Easiest way to get multiparm instance index
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
Author
jamesrobinsonvfx
commented
Jan 27, 2022
very exciting
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment