Block Parameter on Digital Asset

   3539   5   2
User Avatar
Member
5 posts
Joined: Oct. 2008
Offline
Hello guys,
I'd like to add on a Digital Asset a control to be able to switch the parameter “block” of the nodes! Like a toggle to decide from outside if block or not a node inside the digital Asset! Is it possible? Can someone help me please…

Thanks a lot!
User Avatar
Member
121 posts
Joined: July 2008
Offline
You can do this with a switch node.
Checkout the attached file.

Attachments:
block.hipnc (47.2 KB)

Available for new projects
User Avatar
Member
5 posts
Joined: Oct. 2008
Offline
Thanks but I think that this way can't work for me…



In my case I have a node in the CHOP Network that needs to be blocked otherwise it will reloads everything everytime… but it needs to be unlocked sometime to let it load the new scene! I'd like have the control of that red botton on the Digital Asset! Is it possible?
User Avatar
Member
121 posts
Joined: July 2008
Offline
Then you can do it with python with the function setUnloadFlag(). (hou.ChopNode [sidefx.com])
Available for new projects
User Avatar
Member
5 posts
Joined: Oct. 2008
Offline
Sorry but I don't have a lot of experience about scripts… could you explain me better where to put it and how to use it please? Thank You!
User Avatar
Member
121 posts
Joined: July 2008
Offline
Hi Davide,
Instead of doing it with the setUnloadFlag I did it with the bypass() function.
First thing I did was create a HDA in CHOPS and added a toggle parameter called “Block”.
On that parameter I set the following callback script.

kwargs.hdaModule().bypass(kwargs)

Then in the script tab of the HDA you'll find a little script that is called by the callback script and sets the bypass flag of every node that begins with BYPASS. If you add new nodes in the HDA with the prefix BYPASS you'll see that they change also.

import re

def bypass(node):

# Unlock Asset
node.allowEditingOfContents(True)



#Loop through every child of the HDA
for child in node.children():

#If part of the name of the node matches BYPASS go on
if re.match(“BYPASS?”, child.name()):

# If there is a child that starts with the name BYPASS
# then check if the bypass flag is checked.
# If it is checked then set it to off
if child.isBypassed():
child.bypass(0)


# Else if it's not checked then set it to on
else:
child.bypass(1)

Attachments:
block.zip (9.4 KB)

Available for new projects
  • Quick Links