Jump to content

Mass assign shader to alembic geo


J_spad

Recommended Posts

Hello,

 

I have a imported alembic file with many objects that I would like to assign a shadow matte shader to. I do not want to have to drag that shader or assign it per object. Could anyone help me write a script to do this? I do not know the hou modal well. 

 

 

somthing like...

 

myNodes = {GET ALL NODES AND CHILDREN IN ALIMBIC}

 

for myNode in myNodes:

    if {myNode is a geo object}

        {assign shader}

Link to comment
Share on other sites

If you are just doing a pass-through render of the Alembic primitives, why not load the entire Alembic Archive in to the scene using a single object and an Alembic SOP referencing the archive.

 

Then spend a Pack Edit SOP and assign your Shadow Matte Shader to all the alembic primitives (leave group field blank).

 

 

While you are at it, move the display flag to the Pack Edit SOP and open up a Data Tree pane set to the Object Appearance plug-in option and try the assignment there as well.

Link to comment
Share on other sites

Well I feel silly now! That did the trick. I would still like to see an example of that script for educational purposes if anyone has time. I am stuck on filtering the node types into a list.

Link to comment
Share on other sites

Well I feel silly now! That did the trick. I would still like to see an example of that script for educational purposes if anyone has time. I am stuck on filtering the node types into a list.

 

it would be something like this

root = hou.node("/obj/alembicarchive1")
matpath = "/shop/shadowmatte"

geonodes = root.recursiveGlob("*", hou.nodeTypeFilter.ObjGeometry )

for geo in geonodes:
    matparm = geo.parm("shop_materialpath")
    if matparm:
        matparm.set( matpath )
  • Like 1
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...