Hey everyone, 

I'm working on a tool that loops through a bunch of meshes, creates a joint 
for each and bakes the mesh's keyframes to the respective joint.  I have it 
working, but they way I'm doing it now is kind of slow because I am merging 
all the meshes at the end in order to collapse all the skinClusters down to 
one (so I don't have like, a million skinClusters in my export).  Does 
anyone have any ideas on how I can avoid that last merge step that is 
taking so long?  This tool will be used on files with 1000+ meshes which is 
why I am concerned about speed.

def skin_frags(self):

        cmds.cutKey(self.frags) 
        
        count = 0
        for i in self.frags:
            cmds.makeIdentity(i, apply=True)
            skinCluster = cmds.skinCluster(i, self.fragJnts[count])
            cmds.parent(self.fragJnts[count], self.scaleJnt)
            count += 1
        
        cmb = cmds.polyUniteSkinned(self.frags) #This is what makes it so 
slow!
        cmds.rename(cmb[0], "Frags_Merged")

I was trying out a separate idea too, where I create one skinCluster node, 
then add each joint and mesh to that skinCluster, something like this:

frags = cmds.ls(sl=True)

fragJnts = []
count = 0
for i in frags:
   fragPos = cmds.xform(i, query=True, t=True)
   cmds.select(clear=True)
   jnt = cmds.joint(position=fragPos, name='Frag_' + str(count) + '_JNT')
   cmds.parent(i, jnt)
   fragJnts.append(jnt)
   count += 1
   
sc = cmds.skinCluster(frags[0], fragJnts[0])

count = 1
for i in range(1, len(frags)):
    cmds.skinCluster(sc, edit=True, addInfluence=fragJnts[count], 
geometry=frags[count], useGeometry=True) #Here I am trying to one-by-one 
add the joint and respective mesh, but haven't got that                     
                                                                            
           working yet either
    count += 1


If anyone has any tips with either method I'm trying to use, I'd really 
appreciate it!

Thanks,
Aren

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/a89820b9-764a-4738-8246-9f099ec5712d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to