Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bz_utils.file_tools as f_tools
- import maya.mel as mel
- import maya.cmds as mc
- reload(f_tools)
- print "running"
- def attach_oopsys_hair():
- # Find the curves
- search_list = {0:'oopsy:edge_sys_curves_GRP'}
- for i in range(1,50):
- search_list[i] = ('oopsy'+str(i)+":edge_sys_curves_GRP")
- print search_list
- for inst,namespace in search_list.iteritems():
- # find if the ns exists
- if mc.objExists(namespace):
- # import the hair sys
- empty_namespace = f_tools.return_empty_namespace('oopsy_hair_nodes')
- mc.file("Y:/Snapper/0573s_QPootle5/QP100_Shared/04_MayaAssets/01_Chars/02_OOPSY/WIP/Maya/Hair/Hair_nodes_stripped/oopssy_hair_v03.ma",r=1,namespace=empty_namespace,options= "v=0")
- #print namespace," exists"
- # create empty group for the hair systems
- if not mc.objExists('oopsy_hair_blends'+str(inst)):
- oopsy_hair_blends = mc.createNode('transform',n='oopsy_hair_blends'+str(inst),ss=1)
- else:
- oopsy_hair_blends = 'oopsy_hair_blends'+str(inst)
- new_curves = []
- # Go through all the hair curves in the hair export groups and bring out the curves and blendshapes them out
- for hair_grp in mc.listRelatives(namespace,c=1,f=1):
- for i in mc.listRelatives(hair_grp,c=1,f=1):
- #print "working on: ",i
- print 'oops_hair_curve'+str(inst)
- print i
- new_curve = mc.duplicate(i,name=('oops_hair_curve'+str(inst)),rc=1)
- mc.parent(new_curve,oopsy_hair_blends)
- mc.blendShape(i,new_curve,w=( 0, 1.0 ))
- mc.setAttr(i+".visibility",0)
- new_curves.append(new_curve)
- mel.eval('assignHairSystem %s'%(empty_namespace+":edge_hair_sys"))
- search_list = {0:'oopsy:top_sys_curves_GRP'}
- for i in range(1,50):
- search_list[i] = ('oopsy'+str(i)+":top_sys_curves_GRP")
- print search_list
- for inst,namespace in search_list.iteritems():
- # find if the ns exists
- if mc.objExists(namespace):
- # import the hair sys
- #empty_namespace = f_tools.return_empty_namespace('oopsy_hair_nodes')
- #mc.file("Y:/Snapper/0573s_QPootle5/QP100_Shared/04_MayaAssets/01_Chars/02_OOPSY/WIP/Maya/Hair/Hair_nodes_stripped/oopssy_hair_v03.ma",r=1,namespace=empty_namespace,options= "v=0")
- #print namespace," exists"
- # create empty group for the hair systems
- if not mc.objExists('oopsy_hair_blends'+str(inst)):
- oopsy_hair_blends = mc.createNode('transform',n='oopsy_hair_blends'+str(inst),ss=1)
- else:
- oopsy_hair_blends = 'oopsy_hair_blends'+str(inst)
- new_curves = []
- # Go through all the hair curves in the hair export groups and bring out the curves and blendshapes them out
- for hair_grp in mc.listRelatives(namespace,c=1,f=1):
- for i in mc.listRelatives(hair_grp,c=1,f=1):
- #print "working on: ",i
- print 'oops_hair_curve'+str(inst)
- print i
- new_curve = mc.duplicate(i,name=('oops_hair_curve'+str(inst)),rc=1)
- mc.parent(new_curve,oopsy_hair_blends)
- mc.blendShape(i,new_curve,w=( 0, 1.0 ))
- mc.setAttr(i+".visibility",0)
- new_curves.append(new_curve)
- mel.eval('assignHairSystem %s'%(empty_namespace+":top_hair_sys"))
Add Comment
Please, Sign In to add comment