Python MaterialX image node -> signature parameter

   1864   2   1
User Avatar
Member
11 posts
Joined: March 2022
Offline
Hi,

I'm building a MaterialX UDIM Material Creator with Python.
I've been able to make everything work except for this one thing.

I've been able to correctly set "Connector Kind" menu to "Output" through python.


It works as intended with the follwing python code:
randomVariableName.parm("connectorkind").set(1)

When inspecting the "edit parameter interface" up in the right corner I can see that the type is set to "Ordered Menu".


Everything good so far!


However, when I try to access/change the "signature" parameter on a materialX image node, then I run into trouble.


Upon opening the "edit parameter interface" in the top right corner, I see that the type "signature" is set to string.



When trying to change the type "signature" parameter with the same code as stated above, I receive an error message saying I can't use an integer to set a string variable.

I then tried to set it as a string;
RandomVariableName.parm("signature").set("Vector3")

With this, I do not receive any error messages, however, it defaults to being set as "Float". Since this is a normal map
I am trying to set, I require it to be a Vector3.

I've been racking my brain around with for a few days now and have come to a dead end.
I'm quite new to python in houdini & python in general so this might be quite easy for someone else.

Thanks for reading!

Attachments:
materialx dropdown.png (27.8 KB)
materialX signature edit pref.png (49.9 KB)
materialx subnet output pref.png (58.5 KB)
output dropdown.png (19.8 KB)

User Avatar
Member
8186 posts
Joined: Sept. 2011
Offline
Always check parm().menuItems()

>>> node.parm("signature").menuItems()
('default', 'color3', 'color4', 'vector2', 'vector3', 'vector4')
>>> node.parm("signature").set("vector3")
>>> node.parm("signature").eval()
'vector3'
User Avatar
Member
11 posts
Joined: March 2022
Offline
Thank you so much!
This has resolved my issue!

Cheers!
  • Quick Links