Python Scripted Export of Hair Data Sets slowness
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I am exporting Xgen Interactive Hair via python script. The step that is taking the longest to process is the actual alembic export of the hair. I used the regular alembic export commands in a definition:
def abc_export(self, filepath, objLs=None, start_frame=1, end_frame=1, data_format='ogawa', uv_write=True):
job_command = '-frameRange {} {} '.format(start_frame, end_frame)
job_command += '-dataFormat {} '.format(data_format)
job_command += '-attr groom_root_uv '
job_command += '-attr groom_group_id '
job_command += '-attr groom_guide '
if uv_write:
job_command += '-uvWrite '
for node in objLs:
job_command += '-root {} '.format('\"'+node+'\"')
job_command += '-file {} '.format(filepath)
cmds.AbcExport(verbose=True, j=job_command)
def hairCache_export(self, filepath, objLs=None, start_frame=1, end_frame=1, data_format='ogawa'):
job_command = ''
job_command += ' -file {} '.format('\"'+filepath+'\"')
job_command += ' -df {} '.format(data_format)
job_command = ' -fr {} {} '.format(str(start_frame), str(end_frame))
job_command += ' -mxf {} '.format('1')
job_command += ' -wfw {} '.format('1')
job_command += ' -obj {} '.format('\"'+objLs+'\"')
mel.eval('xgmSplineCache -j'+ job_command)
The above abc_export definition works, but a full head of hair can run over night and still take several more hours to finish exporting. I was careful to make sure the curves are not being selected etc (maya takes forever to select a large dataset of hair curves), I have redraw and undo off when running the code.
I decided to try the interface commands under generate and found mention of the xgmSplineCache command which is what I would user if exporting from the interface. For that, I am getting an internal error. I am not sure how to get the scripted export to be as fast as exporting via python code. As mentioned in another post I found on here (https://forums.autodesk.com/t5/maya-forum/xgen-commandline-caching/td-p/8005964), the command can be found in this mel file: Maya2018\plug-ins\xgen\scripts\xgmSplineCacheExport.mel
Any help in speeding up this process of alembic export would be greatly appreciated. Thank you.
Adnan Hussain