Reading custom ABC attributes from Maya

   6807   3   1
User Avatar
Member
2624 posts
Joined: Aug. 2006
Offline
Hi All , Is it impossible to read custom attributes from Maya in a Alembic format when attached to a locator ? .

See below for a simple example with a float attribute called dave attached to a locator in Maya abc format. Houdini seems unable to extract the attribute. Unless I am mistaken

h15

Edited by circusmonkey - May 23, 2016 20:10:53

Attachments:
read_abc_data.hip (54.6 KB)

Gone fishing
User Avatar
Member
2624 posts
Joined: Aug. 2006
Offline
Adding abc file
Gone fishing
User Avatar
Member
2624 posts
Joined: Aug. 2006
Offline
Solved > seems like you can only apply attributes to the shape node

Rob
Gone fishing
User Avatar
Member
30 posts
Joined:
Offline
Hey Rob,

you can extract custom attrs from maya transforms if you're prepared to drop into python to do it. the other advantage is that you can keep the geo packed.

this code will pull out an attr from the alembic archive. useTransform=False will look on the shape, useTransform=True will look on the transform.

import _alembic_hom_extensions as abc
def getAbcAttr(attrName, useTransform=False):
    """
    Gets an alembic attribute from the cache
    Requires an 'abcFileName' detail attribute
    
    @attrName: name of attribute to retrieve
    @useTransform: looks on the parent node instead. Equivalent to using maya's transform instead of shape
    """
    geo = hou.pwd().curPrim().geometry()
    if geo.findGlobalAttrib("abcFileName") is not None:
        abcPath = geo.attribValue("abcFileName")
        
        path = hou.pwd().curPrim().attribValue("path")
        if useTransform:
            path = path.rsplit("/", 1)[0]
        
        x =  abc.alembicArbGeometry(abcPath, path, attrName, hou.frame() / hou.fps())
        if x[0]:
            return x[0][0]
        else:
            return ''
return getAbcAttr('myAttrname', useTransform=True)

you could use this in a python sop to set an attribute on your geo, or use it in a partition to group things… all sorts of uses.

requires the “add filename attribute” flag to be turned on in your alembic node (there is a way to slurp that out of the prim intrinsics, but i'm feeling lazy this morning).

cheers,
chrisg
Edited by doctorbob - May 24, 2016 18:44:34
  • Quick Links