Forum: Poser Python Scripting


Subject: Am I correct in thinking that one cannot create a new Figure in PP?

phlsphr opened this issue on Feb 23, 2001 ยท 7 posts


phlsphr posted Fri, 23 February 2001 at 9:01 AM

I see no constructor method for figures or actors either for that matter. I also tried simply fig1 = FigureType() but that doesn't seem to work. So apparently if you want to create a new figure in your scene you have to pull one in from the library or something and then alter it...?


phlsphr posted Fri, 23 February 2001 at 9:24 AM

BTW, the reason I'm asking this question is because I want to create a script that loads morph targets for an entire figure all at once by pulling them in from an external file. Doesn't seem to be any easy way to load multi-object geometry in using PP, however. If you use the import function Poser just creates a prop, glomming all the objects together. Not good for MT's.


okkulta posted Sun, 25 February 2001 at 11:00 AM

Try to analize the dependencies of the poser's dll, you will find all the method to implement all poser 's functionality.


bushi posted Mon, 26 February 2001 at 12:38 AM

There are methods for manipulating MTs. Take a scan through the Pro Pack docs in the methods section. It appears to me that you'll need to have two scripts. One to suck the geometries for the MTs off of the figure. Another to actually apply the MTs to the figure. The first one will have to save the part name with the geometries so the second will know where to apply the MT. As to creating a brand-new figure using PP, take a look at the sample scripts. There are some there that create new props from scratch. That will be at least a point of departure for creating full fledged figures.


jbrugion posted Mon, 26 February 2001 at 9:33 AM

If someone could figure (sorry no pun intended) out how to make a new figure I'd like to see it. I don't see a way to do it with the current interface. I emailed CL on it to see if they knew since that seems like an obvious thing we would want to be able to do. I did some hacking with the dir() and vars() functions against scene and didn't see anything undocumented that looked like a new figure function. FYI, the morph targets are under the Actor and Parameter methods. To see the current morph targets do parameters=actor.Parameters() then for parameter in parameters: and then parameter.IsMorphTarget(). Set the morph target deltas with a parameter.SetMorphTargetDelta() if the target allready exists or try a actor.SpawnTargetFromGeometry() where you provide the target geometry. If you only have deltas you'll have to pull the current geometry, add the deltas to it and then use that as the target geometry. Let me know if that doesn't work for you or if you need more help.


phlsphr posted Mon, 26 February 2001 at 9:54 AM

Here's the best I can do with the problem of loading in multiple MTs from one file. This script looks at each body part of your figure and loads in MT's for it from preset directories. The morph target target files still have to be individual files with appropriate names (e.g. lShldr1.obj), but I wrote a Maxscript so that my modeling program, 3DMax, takes one big file (the one I was working on) and splits it into files, one for each body part. Still tedious, but it does save time. Hope this isn't too confusing....feel free to suggest improvements. ***************** import poser mtname = "newpython" mtval = 1 mtnamepos = string.join([mtname,"1"],"") mtnameneg = string.join([mtname,"0"],"") print mtnamepos print mtnameneg donegmorph = 1 #--------------------------------- # Get the scene and the importExport object #--------------------------------- currentScene = poser.Scene() imExObject = currentScene.ImExporter() #be sure to manually import something in to set the options options = imExObject.ImportOptions("obj", None) options['Make polygon normals consistent'] = 1 print options fig1 = currentScene.CurrentFigure() #act = currentScene.CurrentActor() #if act == act: for act in fig1.Actors(): name1 = act.InternalName() name2 = name1[0:(len(name1) - 2)] print name2 pathpos = string.join(["temppythontemppos",name2,"1.obj"], "") pathneg = string.join(["temppythontempneg",name2,"0.obj"], "") # print "Importing in Wavefront .obj format..." try: act.SetParameter(mtnamepos,0) if donegmorph: act.SetParameter(mtnameneg,0) except: print "no earlier morph targets found" try: print "here" f = open(pathpos,'r') print f f.close() imExObject.Import('obj', 'File Format Wavefront', pathpos, options) act2 = currentScene.CurrentActor() geom2 = act2.Geometry() act.SpawnTargetFromGeometry(geom2,mtnamepos) act.SetParameter(mtnamepos,1) currentScene.DeleteCurrentProp() if donegmorph: #act.SpawnTarget(mtnameneg) #act.SetParameter(mtnameneg,-1) imExObject.Import('obj', 'File Format Wavefront', pathneg, options) act2 = currentScene.CurrentActor() geom2 = act2.Geometry() act.SpawnTargetFromGeometry(geom2,mtnameneg) act.SetParameter(mtnameneg,-1) currentScene.DeleteCurrentProp() print "Import succeeded" except: print "Import failed -- please check the file name"


jbrugion posted Fri, 09 March 2001 at 3:29 PM

Anybody found a way to generate or load body morphs using Poser-Python?