import poser scene = poser.Scene() #epsilon = 0.00016 epsilon = 0.000155 def run(): act = scene.CurrentActor() for parm in act.Parameters(): if parm.IsMorphTarget(): if parm.Name() != "-": name = unique_name(parm.Name(),act,"_fix") act.SpawnTarget(name) new = act.Parameter(name) for vi in range(act.Geometry().NumVertices()): delta = parm.MorphTargetDelta(vi) if (abs(delta[0]) < epsilon) and (abs(delta[1]) < epsilon) and (abs(delta[2]) < epsilon): continue else: new.SetMorphTargetDelta(vi,delta[0],delta[1],delta[2]) #=============================================================================================== #=============================================================================================== def unique_name(morphName,act,suffix,internal=0): """ Keep dial naming for the new morph from being automatically changed by Poser Used by transfer_morph, transfer_shape, inflate_normals, and the smoothing functions. """ #Morph dial names max out at 30 characters, after which Poser #won't recognize the dial as a morph (?!?) if len(morphName) >= 20 and suffix != "": morphName = morphName[0:12] if suffix != "" and morphName.find(suffix) == -1: morphName = "%s%s" %(morphName,suffix) # Check the dial name to avoid duplication if internal: parms = [p.InternalName() for p in act.Parameters()] else: parms = [p.Name() for p in act.Parameters()] if morphName in parms: temp = 1 while "%s_%i" %(morphName,temp) in parms: temp += 1 # Name the target morph dial morphName = "%s_%i" %(morphName,temp) return morphName run()