gemini Posted January 21, 2019 Share Posted January 21, 2019 Hi, I have a simple problem with this python code ( part of a larger script ). It creates a rop network, opens a stored preset for it. And changes a parameter label. It works. What is wrong that the script clears the conditional string of the rop network. Does anyone has an idea ? Thanks in advance ! G The script : rop = hou.node('/obj').createNode('ropnet') drop_preset_name = 'dROP2' op_path = rop.path() cmd = 'oppresetload %s "%s"' % (op_path, drop_preset_name) hou.hscript(cmd) # set the active toggle label as sim and as render , with version is_sim = rop.userData( 'is_sim') parm_obj = rop ptg = parm_obj.parmTemplateGroup() parmname = 'active' pt = ptg.find( parmname) if is_sim == '1': rop.parm('issimtoggle').set(1) pt.setLabel('Active / [ SIM ] / '+self.version) elif is_sim == '0': rop.parm('issimtoggle').set(0) pt.setLabel('Active / [ RENDER ] / '+self.version) ptg.replace( parmname, pt) parm_obj.setParmTemplateGroup(ptg) Quote Link to comment Share on other sites More sharing options...
Atom Posted January 21, 2019 Share Posted January 21, 2019 (edited) I would guess that it is going to clear the user data because you are creating a new node each time. What if you check if the rop exists and fetch the node rather than creating it each time. Then your UserData might persist. I'm just guessing at the name generated by the create node, you may have to control the name by specifying it directly upon creation. rop = hou.node('/obj/ropnet1') if rop == None: rop = hou.node('/obj').createNode('ropnet', 'ropnet1') Edited January 21, 2019 by Atom Quote Link to comment Share on other sites More sharing options...
gemini Posted January 21, 2019 Author Share Posted January 21, 2019 (edited) THX , but sadly not. These lines clearing the conditional string: ptg = parm_obj.parmTemplateGroup() parmname = 'active' pt = ptg.find( parmname) ptg.replace( parmname, pt) parm_obj.setParmTemplateGroup(ptg) It seems like a bug. Isn't it ? Edited January 21, 2019 by gemini Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.