Last active
March 12, 2021 09:21
-
-
Save taikomatsu/f1021a0d01a22309e67f9ef928040e8c to your computer and use it in GitHub Desktop.
Add shading group info to object for export Alembic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# transformではなくshapeにアトリビュートを持たせないとHoudiniに持っていけないところがミソ | |
from pymel.core import * | |
sgs = ls(type='shadingEngine') | |
for sg in sgs: | |
shapes = listConnections(sg.dagSetMembers, s=True, d=False, p=False) | |
for sh in shapes: | |
shs = sh.getShapes() if objectType(sh, i='transform') else [sh] | |
for o in shs: | |
attrname = 'sg' | |
addAttr(o, ln=attrname, dt='string') | |
o.attr(attrname).set(sg.name()) | |
print('# Done') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment