How to get the user-defined attribute value of Alembic file in Houdini?
Hi all,
I am new to Houdini, and I'm sorry if this question is too simple.
I use the following function to add user attributes on node:
def addAttrs():
nodeName = ‘|objects:pCylinder1|objects:pCylinderShape1’
# compound attribute
cmpAttrName = ‘crease__objects_cyCreaseSet0’
cmds.addAttr(nodeName, ln=cmpAttrName, sn=cmpAttrName, at='compound', readable=True, writable=True, storable=True, keyable=True, numberOfChildren=6)
# child attribues
attrName = cmpAttrName+'name'
cmds.addAttr(nodeName, ln=attrName, sn=attrName, dt='string', readable=True, writable=True, storable=True, keyable=True, parent=cmpAttrName)
attrName = cmpAttrName+'owner'
cmds.addAttr(nodeName, ln=attrName, sn=attrName, dt='string', readable=True, writable=True, storable=True, keyable=True, parent=cmpAttrName)
attrName = cmpAttrName+'level'
cmds.addAttr(nodeName, ln=attrName, sn=attrName, at='float', readable=True, writable=True, storable=True, keyable=True, parent=cmpAttrName)
attrName = cmpAttrName+'edgecnt'
cmds.addAttr(nodeName, ln=attrName, sn=attrName, at='long', readable=True, writable=True, storable=True, keyable=True, parent=cmpAttrName)
attrName = cmpAttrName+'edges'
cmds.addAttr(nodeName, ln=attrName, sn=attrName, dt='Int32Array', readable=True, writable=True, storable=True, keyable=True, parent=cmpAttrName)
attrName = cmpAttrName+'vertex'
cmds.addAttr(nodeName, ln=attrName, sn=attrName, dt='Int32Array', readable=True, writable=True, storable=True, keyable=True, parent=cmpAttrName)
And I export the alembic file from Maya with the following command:
cmds.AbcExport(jobArg=' -frameRange 1 2 -userAttrPrefix “crease__” -file “test.ma.crease__.abc”')
I use abcecho command to confirm that the user-defined attributes are exported into abc file:
Object name=/objects:pCylinder1
CompoundProperty name=.xform;schema=AbcGeom_Xform_v3
Object name=/objects:pCylinder1/objects:pCylinderShape1
CompoundProperty name=.geom;schema=AbcGeom_PolyMesh_v1
ScalarProperty name=.selfBnds;interpretation=box;datatype=float64_t;arraysize=6;numsamps=1
ArrayProperty name=P;interpretation=point;datatype=float32_t;arraysize=42;numsamps=1
ArrayProperty name=.faceIndices;interpretation=;datatype=int32_t;arraysize=200;numsamps=1
ArrayProperty name=.faceCounts;interpretation=;datatype=int32_t;arraysize=60;numsamps=1
CompoundProperty name=.arbGeomParams;schema=
CompoundProperty name=.userProperties;schema=
ScalarProperty name=crease__objects_cyCreaseSet0name;interpretation=;datatype=string;arraysize=1;numsamps=1
ScalarProperty name=crease__objects_cyCreaseSet0owner;interpretation=;datatype=string;arraysize=1;numsamps=1
ScalarProperty name=crease__objects_cyCreaseSet0level;interpretation=;datatype=float32_t;arraysize=1;numsamps=1
ScalarProperty name=crease__objects_cyCreaseSet0edgecnt;interpretation=;datatype=int32_t;arraysize=1;numsamps=1
ArrayProperty name=crease__objects_cyCreaseSet0edges;interpretation=;datatype=int32_t;arraysize=20;numsamps=1
ArrayProperty name=crease__objects_cyCreaseSet0vertex;interpretation=;datatype=int32_t;arraysize=40;numsamps=1
ScalarProperty name=crease__objects_cyCreaseSet1name;interpretation=;datatype=string;arraysize=1;numsamps=1
ScalarProperty name=crease__objects_cyCreaseSet1owner;interpretation=;datatype=string;arraysize=1;numsamps=1
ScalarProperty name=crease__objects_cyCreaseSet1level;interpretation=;datatype=float32_t;arraysize=1;numsamps=1
ScalarProperty name=crease__objects_cyCreaseSet1edgecnt;interpretation=;datatype=int32_t;arraysize=1;numsamps=1
ArrayProperty name=crease__objects_cyCreaseSet1edges;interpretation=;datatype=int32_t;arraysize=3;numsamps=1
ArrayProperty name=crease__objects_cyCreaseSet1vertex;interpretation=;datatype=int32_t;arraysize=6;numsamps=1
ArrayProperty name=N;interpretation=normal;datatype=float32_t;arraysize=200;numsamps=1
I'm going to use these attributes to control the softness of the mesh edges in rendering. But I don't know how to get these user-defined attributes in Houdini.
I use Houdini 12~14, and it seems that Houdini doesn't show the user-defined attributes by default, but I'm not sure about this.
So, my question is:
Could you tell me how to get these user-defined attributes in Houdini?
Cheers
yao
P.S.
I can access the user attributes with the following scripts:
import _alembic_hom_extensions as abc
print ‘——————’
a = abc.alembicUserProperty('/test.ma.crease__.abc', ‘/objects:pCylinder1/objects:pCylinderShape1’, ‘crease__objects_cyCreaseSet0name’, 1)
print a
b = abc.alembicUserProperty('/test.ma.crease__.abc', ‘/objects:pCylinder1/objects:pCylinderShape1’, ‘crease__objects_cyCreaseSet0edges’, 1)
print b
c = abc.alembicUserProperty('/test.ma.crease__.abc', ‘/objects:pCylinder1/objects:pCylinderShape1’, ‘crease__objects_cyCreaseSet0vertex’, 1)
print c
But, my question is:
Could I connect the user-defined attribute(source attribute) to another node's attribute(destination attribute)? I prefer this way because if the source attribute is changed the destination attribute will be changed synchronously.
How to get the user-defined attribute of Alembic file in H
2510 0 1- yaoyansi
- Member
- 5 posts
- Joined: 12月 2012
- Offline
-
- Quick Links