Jump to content

Set detail attribute in HDA python Module.


hitch

Recommended Posts

Hi

I am creating a HDA and I want to set the values of a detail attribute (an array) on an attribute create node. I am trying to do this in the python module of the HDA. 

In sop level, in a python node I can set an array fine, but in the python module of the HDA it errors.

GeometryPermissionError: Geometry is read-only.

I feel i am just missing something really simple, but can't get my head around it. I can find heaps of threads about this relating to the python sop, but not much for the python module window. 

I would be fine to do it all from the python sop, but I am pulling in the array from the interwebs and I want to try to chuck the HDA in unreal/unity. 

Any help would be greatly appreciated.

 

def mybutton(kwargs):
    
    node = kwargs['node']
    #works fine
    node.node("line").parm("points").set(5)
    
    testlist = [1,2,3,4,5]
    #works fine reading the empty array created in the below node
    anarray = node.node("attribcreate1").geometry().findGlobalAttrib("myArray")
    print(anarray)
    #throws read only error
    node.node("attribcreate1").geometry().setGlobalAttribValue("myArray", testlist)

 

Link to comment
Share on other sites

  • 1 year later...

if you don't want to have Python SOP pulling the information every time it cooks

you can have a callback scrip on the button that will for example store the geometry in Data Parameter on the HDA that can be referencing Stash SOP's data parameter for example 

https://www.sidefx.com/forum/topic/74110/#post-313189

Edited by anim
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...