Jump to content

SOLVED - python - update button parameter abc archive


Doum

Recommended Posts

hey,

 

I'm new to python. I try to write a shelf button to load abc files with the alembic archive node and I try to use python to update hierarchy. 

 

I am able to set a parameter, but when I try to put 1 to this one "buildHierarchy", it tell me that it's an integer not a string. How can I do that?

 

thanks

 

Doum

Edited by Doum
Link to comment
Share on other sites

Here my code at the moment. maybe it's not clean, but I'm not a programmer :)

#Choose abc file 
filepath = hou.ui.selectFile(initpath,"select model",False,)

#create alembicarchive node call Render_Cam
iscreated = hou.node('obj/Render_Cam')

if iscreated == None:
    obj.createNode('alembicarchive','Render_Cam',True)
    newnode = hou.node('obj/Render_Cam')
    #Set abc path
    abcpath = newnode.parm("fileName")
    abcpath.set(filepath) 

else :
    newnode = hou.node('obj/Render_Cam')
    #Set abc path
    abcpath = newnode.parm("fileName")
    abcpath.set(filepath)

I would like to add an other operation if the condition is true. I want to make it click the build or update hierarchy automatically to be able to set the cam res and other parm in the camera's parameters.

 

I try something like this:

update = newnode.parm("buildHierarchy")
update.set("1")

But it doesn't seem to simulate a left click on the buildhierarchy button.

 

Any idea ?

 

Thanks 

 

Doum

 

 

Edit :

 

Problem solve by a nice guy on the sidefx mailing list Lars van der Bijl.

update = newnode.parm("buildHierarchy")
update.pressButton()
Edited by Doum
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...