SHARE
TWEET

Untitled

a guest Jan 21st, 2019 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import bz_utils.file_tools as f_tools
  2. import maya.mel as mel
  3. import maya.cmds as mc
  4.  
  5. reload(f_tools)
  6. print "running"
  7. def attach_oopsys_hair():
  8.     # Find the curves
  9.     search_list = {0:'oopsy:edge_sys_curves_GRP'}
  10.     for i in range(1,50):
  11.         search_list[i] = ('oopsy'+str(i)+":edge_sys_curves_GRP")
  12.     print search_list
  13.     for inst,namespace in search_list.iteritems():
  14.         # find if the ns exists
  15.         if mc.objExists(namespace):
  16.             # import the hair sys
  17.             empty_namespace = f_tools.return_empty_namespace('oopsy_hair_nodes')
  18.             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")
  19.            
  20.             #print namespace," exists"
  21.             # create empty group for the hair systems
  22.             if not mc.objExists('oopsy_hair_blends'+str(inst)):
  23.                 oopsy_hair_blends = mc.createNode('transform',n='oopsy_hair_blends'+str(inst),ss=1)
  24.             else:
  25.                 oopsy_hair_blends = 'oopsy_hair_blends'+str(inst)
  26.             new_curves = []
  27.            
  28.             # Go through all the hair curves in the hair export groups and bring out the curves and blendshapes them out
  29.             for hair_grp in mc.listRelatives(namespace,c=1,f=1):
  30.                 for i in mc.listRelatives(hair_grp,c=1,f=1):
  31.                     #print "working on: ",i
  32.                     print 'oops_hair_curve'+str(inst)
  33.                     print i
  34.                    
  35.                     new_curve = mc.duplicate(i,name=('oops_hair_curve'+str(inst)),rc=1)
  36.                     mc.parent(new_curve,oopsy_hair_blends)
  37.                     mc.blendShape(i,new_curve,w=( 0, 1.0 ))
  38.                     mc.setAttr(i+".visibility",0)  
  39.                     new_curves.append(new_curve)
  40.                     mel.eval('assignHairSystem %s'%(empty_namespace+":edge_hair_sys"))
  41.    
  42.  
  43.     search_list = {0:'oopsy:top_sys_curves_GRP'}
  44.     for i in range(1,50):
  45.         search_list[i] = ('oopsy'+str(i)+":top_sys_curves_GRP")
  46.     print search_list
  47.     for inst,namespace in search_list.iteritems():
  48.         # find if the ns exists
  49.         if mc.objExists(namespace):
  50.             # import the hair sys
  51.             #empty_namespace = f_tools.return_empty_namespace('oopsy_hair_nodes')
  52.             #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")
  53.            
  54.             #print namespace," exists"
  55.             # create empty group for the hair systems
  56.             if not mc.objExists('oopsy_hair_blends'+str(inst)):
  57.                 oopsy_hair_blends = mc.createNode('transform',n='oopsy_hair_blends'+str(inst),ss=1)
  58.             else:
  59.                 oopsy_hair_blends = 'oopsy_hair_blends'+str(inst)
  60.             new_curves = []
  61.            
  62.             # Go through all the hair curves in the hair export groups and bring out the curves and blendshapes them out
  63.             for hair_grp in mc.listRelatives(namespace,c=1,f=1):
  64.                 for i in mc.listRelatives(hair_grp,c=1,f=1):
  65.                     #print "working on: ",i
  66.                     print 'oops_hair_curve'+str(inst)
  67.                     print i
  68.                    
  69.                     new_curve = mc.duplicate(i,name=('oops_hair_curve'+str(inst)),rc=1)
  70.                     mc.parent(new_curve,oopsy_hair_blends)
  71.                     mc.blendShape(i,new_curve,w=( 0, 1.0 ))
  72.                     mc.setAttr(i+".visibility",0)  
  73.                     new_curves.append(new_curve)
  74.                     mel.eval('assignHairSystem %s'%(empty_namespace+":top_hair_sys"))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top