def GetCustomDataPoseName( theFigure=None, theActor=None, theFrame=None, useLast=False, baseOnly=False, \ stripExt=False, useActor=False ): """ Check theFigure or theActor for customData 'PoseName#nn' keys matching the specified frame. If both theFigure and theActor are None, default to the currently selected scene actor. If useLast is set, return the customData 'PoseName' if 'PoseName#nn' is absent for that frame. Return the customData value (or None if not found) and which key was located. theFigure The figure, if any selected for saving theActor In the absence of a selected figure, the actor whose customData 'PoseName' is to be returned theFrame The frame component of the 'PoseName#nn' customData key being searched for. If None, default to the current scene frame useLast Allows the 'PoseName' customData to be returned if frame specific version is absent baseOnly Remove the path component and return only the basename stripExt Remove the '.pz2' or other extension if True useActor If theFigure is not None, try theActor before falling back to theFigure. (Single recursion) """ global CustomDataListKey global CustomDataKeyDelimiter global CustomDataFrameDelimiter global CustomDataPoseNameKey global CustomDataPoseNameFrameFmt poseName = None keyFound = None if theFrame is None: theFrame = poser.Scene().Frame() framekey = CustomDataPoseNameFrameFmt.format(CustomDataPoseNameKey, CustomDataFrameDelimiter, theFrame) if useActor: # Try theActor PoseName before testing theFigure theObject = theActor elif theFigure is not None: # Figure PoseName will override individual actor PoseName theObject = theFigure else: # Check theActor PoseName theObject = theActor if theObject is None: theObject = poser.Scene().CurrentActor() customKeys = theObject.CustomData(CustomDataListKey) keys = [] if customKeys is not None: # Extract existing customData Keys value into keys list keys = customKeys.split(CustomDataKeyDelimiter) if framekey in keys: poseName = theObject.CustomData(framekey) keyFound = framekey elif useLast and CustomDataPoseNameKey in keys: poseName = theObject.CustomData(CustomDataPoseNameKey) keyFound = CustomDataPoseNameKey if poseName is not None: if baseOnly: poseName = os.path.basename(poseName) if stripExt: poseName, ext = os.path.splitext(poseName) elif useActor: # No actor PoseName customData, so try falling back to theFigure poseName, keyFound = GetCustomDataPoseName(theFigure, theActor, theFrame, useLast, baseOnly, stripExt, False) return poseName, keyFound
def getSelection(): actor = poser.Scene().CurrentActor() material = poser.Scene().CurrentMaterial() if not material: raise "No material selected." if actor.IsBodyPart(): return actor.ItsFigure(), material elif actor.IsProp(): return actor, material elif actor.IsCamera(): actor = poser.Scene().CurrentFigure() if actor: return actor, material raise "Invalid selection. Please select a body part or prop."
def getPropbyName( sPattern ): oFoundProps = [] for oActor in poser.Scene().Actors(): if oActor.IsProp() and re.match(sPattern,oActor.Name()): oFoundProps.append(oActor) return oFoundProps
def loadFx6(path, actor, names): targets = ss6Materials.namesToMaterials(actor, names) if not path: return None DIR_MANAGER.set('fx6', os.path.dirname(path)) fx6 = eval(quickDecompress(path)) for mat in targets: st = mat.ShaderTree() processEffectDict(st, fx6) removeOrphans.removeOrphans(mat) st.UpdatePreview() poser.Scene().Draw()
def DialValueFrames(theParm, firstFrame, lastFrame): """ This method returns a list of the dial settings of the specified parameter within a specified range of frames, excluding any valueOperation influence. NOTE: If the PoserDialValue.remove global is ignored. Value operations for the parameter will be removed and restored to avoid their influence while the parameter's values are being determined. NOTE: Python callbacks are not removed as they cannot be re-instated. NOTE: Removal and reinstatement of value operations is minimised when compared to iterating calls to DialValue() over multiple frames. NOTE: If a single frame value is sought and the UnaffectedValue() method is available, it will be used. theParm : the parameter whose dial setting (rather than value) is to be returned. firstFrame : the first frame (zero based) at which the parameter's dial setting is to be returned. lastFrame : the last frame (zero based) at which the parameter's dial setting is to be returned. """ theValues = [] if lastFrame == firstFrame: # Only one frame, so we can avoid slow iterations over the frame range try: scene = poser.Scene() frame = scene.Frame() if frame != firstFrame: scene.SetFrame(firstFrame) theValues.append(theParm.UnaffectedValue()) if frame != firstFrame: scene.SetFrame(frame) return theValues except: # Assume no UnaffectedValue() method available pass if debug: ListValueOperations(theParm) if theParm.NumValueOperations() > 0: if remove: # Delete all non-Python ValueOperations, record dial value then re-create ValueOperations. theValOps = RemoveValueOperations(theParm) if debug: print "{}Removed existing Value Operations. Value() = {:0g}".format( indent * 1, theParm.Value()) ListValueOperations(theParm) for frame in range(firstFrame, lastFrame + 1): theValues.append(theParm.ValueFrame(frame)) if debug: print "{}Restoring {:d} deleted Value Operation{}".format( indent*1, len( theValOps ), \ Plural( len( theValOps ) ) ) RestoreValueOperations(theParm, theValOps) if debug: print "{}Restored deleted Value Operations.".format(indent * 1) ListValueOperations(theParm) else: # Original interpolation method for frame in range(firstFrame, lastFrame + 1): theValues.append(theParm.ValueFrame(frame)) else: # No valueOp influence for frame in range(firstFrame, lastFrame + 1): theValues.append(theParm.ValueFrame(frame)) return theValues
def AskConnectToWhat(self, inputName): action = self.actionMap[inputName] nodeList = [] nodes = self.possibleNodes.keys() nodes.sort() st = poser.Scene().CurrentMaterial().ShaderTree() for key in nodes: for input in self.possibleNodes[key]["Inputs"].keys(): nodeList.append( key + " : " + input) chosenInput = poser.DialogSimple.AskMenu("Plug connected nodes into...", "Connect to...", nodeList) if chosenInput: self.actionMap[inputName] = chosenInput self.dlg.SetText(inputName+"B",chosenInput)
def TestMethods(theParm=None): """ This method determines whether Poser Python supports the HasKeyAtFrame parameter method. This method determines whether Poser Python supports the IsControlProp actor method. theParm: An optionally supplied parameter to use for the method existence test """ global PoserPythonMethods global TestParmName global PPM_HASKEYATFRAME global PPM_ISCONTROLPROP RemoveTestParm = False if theParm is None: scene = poser.Scene() actor = scene.Actors()[ 0] # Scene should always have at least UNIVERSE actor parm = None try: # Previously assumed UNIVERSE actor always had parameters parm = actor.Parameters()[ 0] # assume UNIVERSE actor always has parameters except: # Let's create a parameter to test on if parm is None: parm = actor.CreateValueParameter(TestParmName) RemoveTestParm = True else: # We had some other problem, so Crash and burn - major problems with the environment raise Exception, 'Actor "{}" has no parameters!'.format( actor.InternalName()) else: parm = theParm actor = theParm.Actor( ) # We need an actor for the IsControlProp method test if PoserPythonMethod[PPM_ISCONTROLPROP] is None: # Not tested yet try: test = None test = actor.IsControlProp() if test is not None: PoserPythonMethod[PPM_ISCONTROLPROP] = True except: PoserPythonMethod[PPM_ISCONTROLPROP] = False if PoserPythonMethod[PPM_HASKEYATFRAME] is None: # Not tested yet try: test = None test = parm.HasKeyAtFrame(0) if test is not None: PoserPythonMethod[PPM_HASKEYATFRAME] = True except: PoserPythonMethod[PPM_HASKEYATFRAME] = False if RemoveTestParm: # actor and parm to be removed must exist if we got here actor.RemoveValueParameter(TestParmName)
def ListAllCustomData(theObject=None): """ Print a list of all customData for theObject, or the entire scene, with frame references numerically sorted Excludes the CustomDataListKey itself, which is only there to provide missing customData lookup functionality theObject: figure or actor type scene object. If None, report customData for the entire scene """ global CustomDataListKey global CustomDataKeyDelimiter global CustomDataFrameDelimiter global CustomDataPoseNameKey global CustomDataPoseNameFrameFmt if theObject is not None: customKeys = theObject.CustomData(CustomDataListKey) if customKeys is not None: keyList = sorted(customKeys.split(CustomDataKeyDelimiter), key=StringSplitByNumbers) keyList = [elem for elem in keyList if elem != CustomDataListKey] for key in keyList: data = theObject.CustomData(key) print '{}, {} "{}"'.format(theObject.Name(), key, data) else: scene = poser.Scene() for actor in scene.Actors( ): # This parses all unparented actors in the scene as well as actors in figures. customKeys = actor.CustomData(CustomDataListKey) if customKeys is not None: keyList = sorted(customKeys.split(CustomDataKeyDelimiter), key=StringSplitByNumbers) keyList = [ elem for elem in keyList if elem != CustomDataListKey ] for key in keyList: data = actor.CustomData(key) print '{}, {} "{}"'.format(actor.Name(), key, data) else: for figure in scene.Figures(): customKeys = figure.CustomData(CustomDataListKey) if customKeys is not None: keyList = sorted(customKeys.split(CustomDataKeyDelimiter), key=StringSplitByNumbers) keyList = [ elem for elem in keyList if elem != CustomDataListKey ] for key in keyList: data = figure.CustomData(key) print '{}, {} "{}"'.format(figure.Name(), key, data)
def GetAnimSetAttribute(theAnimSetName, theAttribute): """ Given an existing AnimSet name, return the value of the attribute with key theAttribute or None if not found. theAnimSetName The name of the animSet whose attribute value is to be returned. theAttribute The name of the attribute whose value is to be returned. """ attribute = None # Indicate no such attribute in animSet try: animSet = poser.Scene().AnimSet(theAnimSetName) for attrib in animSet.Attributes(): # attrib is a (key, value) tuple if attrib[0] == theAttribute: attribute = attrib[1] break except: # Indicate no such attribute in animSet pass return attribute
def actor_choices(choicelist=None): """ Demonstrates wx.control MultiChoiceDialog """ if choicelist is None: choicelist = poser.Scene().Actors() choices = list(generate_names(choicelist)) with wx.MultiChoiceDialog(None, caption="My Actor Dialog", message="Select one actor", choices=choices, style=wx.CHOICEDLG_STYLE ) as dlg: if dlg.ShowModal() == wx.ID_OK: return [choices[i] for i in dlg.GetSelections()] else: return None
def askMaterials(actor): methods = [ "All materials.", "Material group...", "Specific materials...", "Matching materials...", "Current material." ] selector = AskSelectMethod("Include...", methods=methods) if selector.Show(): method = selector.get() if method == methods[0]: return ss6Materials.getMaterialNames(actor) elif method == methods[1]: return askGroup(actor) elif method == methods[2]: return askSpecificMaterials(actor) elif method == methods[3]: return askMatchingMaterials(actor) else: return [poser.Scene().CurrentMaterial().Name()] else: return []
def export(self): # get selected figure figure = poser.Scene().CurrentFigure() #figure = poser.Scene().CurrentActor() body_part = False assert figure, 'No currently selected figure!' figureName = fix_name(figure.Name()) abort = False getSaveFile = poser.DialogFileChooser(2, 0, "Save Egg File", figureName, '', '*.egg') getSaveFile.Show() fileName = getSaveFile.Path() if os.path.exists(fileName) and not Poser2Egg.SKIP_OVERWRITE: if not poser.DialogSimple.YesNo("Overwrite " + fileName + "?"): abort = True if not abort: if body_part: ikStatusList = self.remove_ik_chains(figure) print 'Exporting character:', figureName, 'to', fileName try: egg_obj = EggObject(figure) lines = egg_obj.export() output = open(fileName, 'w') output.write("".join(lines)) output.close() # write anim lines = egg_obj.write_animation() #print lines output = open(os.path.join(os.path.dirname(fileName), "a.egg"), 'w') output.write("".join(lines)) output.close() except IOError, (errno, strerror): print 'failed to open file', fileName, 'for writing' print "I/O error(%s): %s" % (errno, strerror) else: print 'finished writing data' if body_part: self.restore_ik_chains(figure, ikStatusList) if Poser2Egg.RECOMPUTE_NORMALS: self.recompute_egg_normals(fileName)
def GetAnimSetActorParms(theAnimSetName): """ Given an existing AnimSet name, return an OrderedDict of actors and their parameters specified by the AnimSet. Return None if no such named animSet found NOTE: Though the animSet will naturally return a list of parameters, their actors must be subsequently determined. NOTE: We are making the assumption that all of the actors are either unparented props or belong to a single figure. NOTE: Should multiple figures be referenced by the animSet.Parameters() list, the dict returned should probably NOTE: be indexed by figure and actor, rather than just actor, so saving schemes can wrap the parameters. """ try: animSet = poser.Scene().AnimSet(theAnimSetName) animSetActors = OrderedDict() for parm in animSet.Parameters(): actor = parm.Actor() if actor in animSetActors: animSetActors[actor].append(parm) else: animSetActors[actor] = [parm] except: animSetActors = None # Indicate no such animSet in scene return animSetActors
def UpdateCustomData(theObject, theData): """ Given theObject, which may refer to either a figure or an actor, update its customData with theData. The value of the special key 'PoseName' is replicated with a key of the form 'PoseName#<n>', where <n> is the frame number to which this pose is being applied, so multiple keyframes can be labelled with the name of the pose. All referenced keys will be included in the CustomDataListKey value, delimited by CustomDataKeyDelimiter: ';' theObject the entity (figure or actor) whose customData is to be updated. theData an OrderedDict() containing customData key, value pairs to be updated for the object. NOTE: Each value is a Custom namedtuple of the format ( storeWithPoses, storeWithMaterials, string ) """ global CustomDataListKey global CustomDataKeyDelimiter global CustomDataFrameDelimiter global CustomDataPoseNameKey global CustomDataPoseNameFrameFmt if len(theData) > 0: # Need to maintain customData Keys list customKeys = theObject.CustomData(CustomDataListKey) keys = [] if customKeys is not None: # Extract existing customData Keys value into keys list keys = customKeys.split(CustomDataKeyDelimiter) for (key, data) in theData.iteritems(): if key not in keys: # Avoid duplicating existing keys keys.append(key) theObject.SetCustomData(key, data.value, data.storeWithPoses, data.storeWithMaterials) if key == CustomDataPoseNameKey: # Replicate this customData for the current frame framekey = CustomDataPoseNameFrameFmt.format( CustomDataPoseNameKey, CustomDataFrameDelimiter, \ poser.Scene().Frame() ) if framekey not in keys: keys.append(framekey) theObject.SetCustomData(framekey, data.value, data.storeWithPoses, data.storeWithMaterials) customKeys = CustomDataKeyDelimiter.join(keys) theObject.SetCustomData(CustomDataListKey, customKeys, 0, 0) # Save lookup for customData Keys
def GetAnimSetNames(): """ Return a list of names of animSets in the poser scene. AnimSet Names are not yet exposed to Python in 11.0.6.33735 Names will either consist of the value of the 'Name' attribute of the animSet or the animSets() list index in the form 'AnimSet {}'.format(index) """ global AnimSetNameFmt global AnimSetNameAttr AnimSetNameList = [] setNum = 0 for animSet in poser.Scene().AnimSets(): foundName = False for attrib in animSet.Attributes(): if attrib[0] == AnimSetNameAttr: foundName = True setName = attrib[1] break setNum += 1 if not foundName: # AnimSet names are not currently exposed to python in Poser Pro 11.0.6.33735 setName = AnimSetNameFmt.format(setNum) AnimSetNameList.append(setName) return AnimSetNameList
path = AskDirectory(dir=DIR_MANAGER.get("pz2"), title="Select PZ2 Folder...", parent=self.dlg) if path: DIR_MANAGER.set("pz2", path) self.pz2p = path self.dlg.SetText("PZ", self.shorten(self.pz2p)) def askMc6(self, v=None): path = AskDirectory(dir=DIR_MANAGER.get("mc6"), title="Select MC6 Folder...", parent=self.dlg) if path: DIR_MANAGER.set("mc6", path) self.mc6p = path self.dlg.SetText("P6", self.shorten(self.mc6p)) def askDs(self, v=None): path = AskDirectory(dir=DIR_MANAGER.get("ds"), title="Select DS Folder...", parent=self.dlg) if path: DIR_MANAGER.set("ds", path) self.dsp = path self.dlg.SetText("DS", self.shorten(self.dsp)) if __name__ == '__main__': #print AskMaterials(poser.Scene().CurrentFigure()) ge = GroupEditor(poser.Scene().CurrentFigure()) ge.Show() #AskConnectNode(poser.Scene().CurrentMaterial().ShaderTree().Node(0).Inputs(), [], actionMap={"Diffuse_Color":"Apeshit"}).Dialog() pass
def copyFrom(source, destinations): src = collectShader(source) for dest in destinations: createFromStored(src, dest) poser.Scene().Draw()
return inames[iname][1] else: return 0 def AskName(node): txt = poser.DialogTextEntry(message="Enter new name for %s." % node.Name()) txt.Show() return txt.Text() def RenameNode(material): st = material.ShaderTree() node = AskNode(st) if node: newName = AskName(node) if newName: newName = re.sub("""\W""", '_', newName) node.SetName(newName) st.UpdatePreview() if __name__ == '__main__': curmat = poser.Scene().CurrentMaterial() if curmat: RenameNode(curmat) else: raise "No materials selected." pass
import poser, os, sys sys.path.append(os.path.join("Runtime","Python","PoseWorks","ShaderSpider","Data")) import ss6Gui from ss6Constants import * start = 1 scene = poser.Scene() actor = scene.CurrentActor() if not actor.IsBodyPart() and not actor.IsProp(): if actor.IsCamera(): actor = scene.CurrentFigure() else: actor = None if not actor: start = poser.DialogSimple.YesNo("SS6 may not run properly without a\nfigure or prop selected. Continue anyways?") else: start = 1 if start: base = ":Runtime:Python:PoseWorks:ShaderSpider:wacros:" poser.DefineMaterialWacroButton(1, base + "Copy_To_All.py", "Copy to All") poser.DefineMaterialWacroButton(2, base + "Copy_To_Group.py", "Copy to Material Group") poser.DefineMaterialWacroButton(3, base + "Copy_To_Matching.py", "Copy to Matching") poser.DefineMaterialWacroButton(4, base + "Copy_To_Skin.py", "Smart Copy to Skin") poser.DefineMaterialWacroButton(5, base + "Edit_Groups.py", "Edit Material Groups") poser.DefineMaterialWacroButton(6, base + "Rename_Node.py", "Rename Node") poser.DefineMaterialWacroButton(7, base + "Save_Fx6.py", "Save Partial Shader (FX6)")
'\tsetNumericProperty( "Displacement Strength", [ %f ] %s);' % (1.0, DI_VM), '\tsetNumericProperty( "Minimum Displacement", [ %f ] );' % (0), '\tsetNumericProperty( "Maximum Displacement", [ %f ] );' % (DI), '\tsetColorProperty( "Reflection Color", [ [ %i, %i, %i ] ] %s);' % (KR_R, KR_G, KR_B, KR_CM), '\tsetNumericProperty( "Reflection Strength", [ %f ] %s);' % (KR, KR_VM), '\tsetColorProperty( "Refraction Color", [ [ %i, %i, %i ] ] %s);' % (KT_R, KT_G, KT_B, KT_CM), '\tsetNumericProperty( "Refraction Strength", [ %f ] %s);' % (KT, KT_VM), '\tsetNumericProperty( "Index of Refraction", [ %f ] );' % ETA, '\tsetNumericProperty( "Lighting Model", [ %i ] );' % LT_MODEL, '\tbreak;' ]: self.add(item) def add(self, data): self.cases = self.cases + "\n\t\t\t" + data if __name__ == '__main__': dsPropBuilder = DsMaterialProperties() dsPropBuilder.addMaterial(poser.Scene().CurrentMaterial()) print dsPropBuilder.get() pass
def createSelectPz2(actor, mats): files = [] for m in mats: m.SetSelected(1) outpath = os.path.abspath(m.Name() + ".mt5") m.SaveMaterialSet(outpath) files.append(outpath) files.append(os.path.abspath(m.Name() + ".mz5")) if hasattr(actor, "ConformTarget"): actorStr = "figure" p4ActorStr = actorStr else: actorStr = "actor $CURRENT" p4ActorStr = "actor %s" % actor.InternalName() mc6ActorStr = "mtlCollection" completeP4 = """{\n\nversion\n\t{\n\tnumber 4.01\n\t}\n%s\n\t{""" % p4ActorStr completePP = """{\n\nversion\n\t{\n\tnumber 4.01\n\t}\n%s\n\t{""" % actorStr completeP5 = """{\n\nversion\n\t{\n\tnumber 5\n\t}\n%s\n\t{""" % actorStr completeP6 = """{\n\nversion\n\t{\n\tnumber 6\n\t}\n%s\n\t{""" % mc6ActorStr for path in files: if not os.path.exists(path): continue fir = "" if path.endswith(".mz5"): fi = gzip.open(path, "rb") fir = fi.read() fi.close() else: fi = open(path, "r") fir = fi.read() fi.close() cleaned = cleanMaterial(fir) completeP4 = completeP4 + cleaned[0] completePP = completePP + cleaned[1] completeP5 = completeP5 + cleaned[2] completeP6 = completeP6 + cleaned[2] completeP4 = completeP4 + """\n\t}\n}""" completePP = completePP + """\n\t}\n}""" completeP5 = completeP5 + """\n\t}\n}""" completeP6 = completeP6 + """\n\t}\n}""" completeDS = createMatDs(mats) invalidBracketPattern = re.compile('{\t{') completeP4 = invalidBracketPattern.sub('{', completeP4) completeP5 = invalidBracketPattern.sub('{', completeP5) completeP6 = invalidBracketPattern.sub('{', completeP6) invalidBracketPattern = re.compile('}\t{') completeP4 = invalidBracketPattern.sub('}', completeP4) completeP5 = invalidBracketPattern.sub('}', completeP5) completeP6 = invalidBracketPattern.sub('}', completeP6) invalidNoMapPattern = re.compile('"NO_MAP"') completeP4 = invalidNoMapPattern.sub('NO_MAP', completeP4) completeP5 = invalidNoMapPattern.sub('NO_MAP', completeP5) completeP6 = invalidNoMapPattern.sub('NO_MAP', completeP6) invalidNoMapPattern = re.compile('file (("+\s*:*NO_MAP\s*"+\s*"*)|(""))') completeP5 = invalidNoMapPattern.sub("file NO_MAP", completeP5) completeP6 = invalidNoMapPattern.sub("file NO_MAP", completeP6) invalidFilteringPattern = re.compile( '\s*nodeInput "Filtering"\s*\{\s*name "Filtering"\s*value \d+ \d+ \d+\s*parmR \S+\s*parmG \S+\s*parmB \S+\s*node \S+\s*file \S+\s*\}' ) completeP5 = invalidFilteringPattern.sub("", completeP5) completeP6 = invalidFilteringPattern.sub("", completeP6) basePath = DIR_MANAGER.get("matFileName") outP4 = os.path.join(DIR_MANAGER.get("pz2"), basePath + " P4.pz2") outPP = os.path.join(DIR_MANAGER.get("pz2"), basePath + " PP.pz2") outP5 = os.path.join(DIR_MANAGER.get("pz2"), basePath + " P5.pz2") outP6 = os.path.join(DIR_MANAGER.get("mc6"), basePath + " P6.mc6") outDS = os.path.join(DIR_MANAGER.get("ds"), basePath + ".ds") pngPaths = [] for doMat, outPath, outText in [("doP4", outP4, completeP4), ("doPP", outPP, completePP), ("doP5", outP5, completeP5), ("doP6", outP6, completeP6), ("doDS", outDS, completeDS)]: if DIR_MANAGER.get(doMat): writeFile(outPath, outText) pngPaths.append(os.path.splitext(outPath)[0] + ".png") if DIR_MANAGER.get("doPng"): png_path = "pose.png" poser.Scene().SaveLibraryCamera("pose.cm2") i = 0 for png in pngPaths: shutil.copyfile(png_path, png) files.append("pose.cm2") for path in files: if os.path.exists(path): os.remove(path) if os.path.exists(path[:-3] + "png"): os.remove(path[:-3] + "png") return (outP4, outPP, outP5, outP6, outDS)
P4 = P5 bump_refs = [] for b in bumps: if b != "NO_MAP" and not (b in bump_refs): bump_refs.append(b) for b in bump_refs: cleaned = p4Bump(b) P4 = string.join(string.split(P4, runtime(b)), cleaned) shaderTree = re.compile("""reflectionStrength\s\S*(?P<st>.*?)\n\t\t\}""", re.S) sts = shaderTree.findall(P4) for st in sts: P4 = string.join(string.split(P4, st), '') PP = P5 sts = shaderTree.findall(PP) for st in sts: PP = string.join(string.split(PP, st), '') return (P4[44:-6], PP[44:-6], P5[44:-6]) if __name__ == '__main__': figure = poser.Scene().CurrentFigure() askfile = poser.DialogFileChooser(type=poser.kDialogFileChooserSave, message="Save as...", startDir=os.path.join( "Runtime", "libraries")) if (askfile.Show()): path = askfile.Path() #SaveMATPose(path) CreateSelectPZ2(figure, figure.Materials(), path) pass
'.lt2': '.lt2', '.ltz': '.lt2', \ '.mc6': '.mc6', '.mcz': '.mc6', \ '.mt5': '.mt5', '.mz5': '.mt5', \ '.obj': '.obj', '.obz': '.obj', \ '.pz2': '.pz2', '.p2z': '.pz2', \ '.pz3': '.pz3', '.pzz': '.pz3' } # Map any poser file suffix to its uncompressed equivalent CameraSuffix = 0 FaceSuffix = 1 FigureSuffix = 2 HairSuffix = 3 HandSuffix = 4 LightSuffix = 5 PoseSuffix = 6 PropSuffix = 7 SceneSuffix = 8 SaveMethod = { uncompressedSuffixes[ CameraSuffix ] : poser.Scene().SaveLibraryCamera, \ uncompressedSuffixes[ FaceSuffix ] : poser.Scene().SaveLibraryFace, \ uncompressedSuffixes[ FigureSuffix ] : poser.Scene().SaveLibraryFigure, \ uncompressedSuffixes[ HairSuffix ] : poser.Scene().SaveLibraryHair, \ uncompressedSuffixes[ HandSuffix ] : poser.Scene().SaveLibraryHand, \ uncompressedSuffixes[ LightSuffix ] : poser.Scene().SaveLibraryLight, \ uncompressedSuffixes[ PoseSuffix ] : poser.Scene().SaveLibraryPose, \ uncompressedSuffixes[ PropSuffix ] : poser.Scene().SaveLibraryProp, \ uncompressedSuffixes[ SceneSuffix ] : poser.SaveDocument } def TestMethods(theParm=None): """ This method determines whether Poser Python supports the HasKeyAtFrame parameter method. This method determines whether Poser Python supports the IsControlProp actor method.