Jump to content

Python : hou creating/adding material style sheet ?


Recommended Posts

You can create stylesheets with hou.StyleSheet.__init__(json text). The json text is a string formatted as a json file, so I assume you can create presets, create a json file for each preset, and then load this json file and dump it in the init method.

More infos here : https://www.sidefx.com/docs/houdini/hom/hou/StyleSheet.html

 

 

Link to comment
Share on other sites

Am I correct to understand that Material Stylesheets operate at a global level and the association with the OBJ nodes are defined within the json text ? i.e. in a HIP file, there can be only one Material Style Sheet?

How does one retrieve a given Material Stylesheets (so that I can call asJSON() to study the format) ?

If there are multiple stylesheets, how does one assign them to Nodes ?

Cheers

Link to comment
Share on other sites

you can have any number of stylesheets, both on scene level and object level. I tend to use scene level stylesheets however, as they're more versatile and I've experienced some odd behaviour when object level and scene level stylesheets are mixed together (may already have been fixed thou).

Stylesheets rely on json language and I think it's currently not possible to populate stylesheets using Python. However, with Python you can create an empty stylesheet and inject it with pre-existing json script, containing all the assignments and overrides. 

This json script can be either written from scratch, or generated from an existing stylesheet (that's a good way how to take existing material assignments and deploy it to different hip files).

cheers, D. 

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