1.将角色引用文件导入maya
2.选中毛发笔刷转化为曲线
3.基础功能介绍
Display Quality显示质量
Hairs per clump每根曲线生成的发量
Sub segments 曲线顶点中间生成几个
Thinning 毛发长差
4、select 下 all cvs可以查看曲线顶点数,曲线做适当优化
5、将转为出的曲线做个父子组
Python代码
from maya import cmds
#Get object group
Source_Group_Name = 'liuhai_pfxHair1_newShapeMainCurves'
Destination_Curves = 'LiuHai'
# get curves under group
curves = cmds.listRelatives(Source_Group_Name, ad=True, type='nurbsCurve')
# create new group
Curves_group = cmds.createNode('transform', name=Destination_Curves)
# forces Maya's alembic to export curves as one group.
cmds.addAttr(Curves_group, longName='riCurves', attributeType='bool', defaultValue=1, keyable=True)
# parent curves under guides group
for curve in curves:
cmds.parent(curve,Curves_group, shape=True, relative=True)
6.剩下几个毛发组依次执行获取,注意修改源组名和目标组名
7.开始给毛发设置ID
Python代码
from maya import cmds
attr_name = 'groom_group_id'
# 注意:更改以下命名以反映节点场景。
groups = ['Liuhai', 'Jiujiu', 'Houfa','Binjiao','Ding']
for groom_group_id, group_name in enumerate(groups):
# 获取xgGroom下的曲线
curves = cmds.listRelatives(group_name, ad=True, type='nurbsCurve')
# 用组id标记组
cmds.addAttr(group_name, longName=attr_name, attributeType='short', defaultValue=groom_group_id, keyable=True)
# 添加属性范围
# 强制Maya的alembic将数据导出为GeometryScope::kConstantScope
cmds.addAttr(group_name, longName='{}_AbcGeomScope'.format(attr_name), dataType='string', keyable=True)
cmds.setAttr('{}.{}_AbcGeomScope'.format(group_name, attr_name), 'con', type='string')
8.执行完代码后,我们可以看到曲线添加了几个新属性
9.修改毛发Scale X为-1
10.导出Abc缓存,把groom_group_id属性加上
11.导入引擎的时候我们就可以看毛发组了,然后调整一下轴向