Hello @Guy7,
I apologize for the delay, unfortunately we don’t use a maya pipeline for hair internally, and it seems our Houdini setup for this feature isn’t stable either. One of our technical animators was able to build off of your code snippet and export something that’ll set up the property appropriately in the alembic. I’ve quoted their response below:
This is the modified snippet that should add the haircard group attribute as “string” type. It adds the attribute to both, the transform node and each of the shape curves contained within. It also disables the
riCurvesattribute.And this is the command to export the ABC file, theattrflag should contain all the attributes that need to be exported space separated, in this case we are just exportinggroom_group_cards_idattribute:
import maya.cmds as cmds
cmds.AbcExport(j='-frameRange 0 0 -attr groom_group_cards_id -root grpone|splineone -root grptwo|splinetwo -file C:/abcstuff/Test_Splines.abc')
And below is the script they used to add the property:
from maya import cmds
attr_name = 'groom_group_cards_id'
# NOTE: change the following names to reflect your node's scene.
groups = ['grpone|splineone', 'grptwo|splinetwo']
for groom_group_id, group_name in enumerate(groups):
# get curves under xgGroom
curves = cmds.listRelatives(group_name, ad=True, type='nurbsCurve')
# tag group with group id
if not cmds.objExists('{}.{}'.format(group_name, attr_name)):
cmds.addAttr(group_name, longName=attr_name, dataType='string', keyable=True)
cmds.setAttr('{}.{}'.format(group_name, attr_name), '{}'.format(groom_group_id), type='string')
# add attribute scope
# forces Maya's alembic to export data as GeometryScope::kUniformScope
if not cmds.objExists('{}.{}_AbcGeomScope'.format(group_name, attr_name)):
cmds.addAttr(group_name, longName='{}_AbcGeomScope'.format(attr_name), dataType='string', keyable=True)
cmds.setAttr('{}.{}_AbcGeomScope'.format(group_name, attr_name), 'con', type='string')
for crv in curves:
# tag group with group id
if not cmds.objExists('{}.{}'.format(crv, attr_name)):
cmds.addAttr(crv, longName=attr_name, dataType='string', keyable=True)
cmds.setAttr('{}.{}'.format(crv, attr_name), '{}'.format(groom_group_id), type='string')
# add attribute scope
# forces Maya's alembic to export data as GeometryScope::kUniformScope
if not cmds.objExists('{}.{}_AbcGeomScope'.format(crv, attr_name)):
cmds.addAttr(crv, longName='{}_AbcGeomScope'.format(attr_name), dataType='string', keyable=True)
cmds.setAttr('{}.{}_AbcGeomScope'.format(crv, attr_name), 'con', type='string')
Their comment on this solution:
So, seems that we need to add the attribute on each of the curve shapes and ensure it is exported to ABC either without the
riCurvesattribute present or set toFalse.
I was able to load and verify that the groups appeared in the generator tool when using the abc file generated with this technique. We messed around with several other techniques, but no other method generated the property (as a string) per-curve in the alembic.
If you have a Houdini install they have some standalone utilities for checking alembic files, abcecho will show you the structure of the scene with attributes and types so you can verify the groom_group_cards_id attribute.
-Mark Winter