Forum: Poser - OFFICIAL


Subject: Python Script for Mass Spawning of morph targets?

onimusha opened this issue on Jun 15, 2005 ยท 10 posts


onimusha posted Wed, 15 June 2005 at 3:44 PM

Is there one out there that will spawn a morph target for every body part? I don't really need the hands or feet, but doing it by hand is such a pain...


face_off posted Wed, 15 June 2005 at 5:10 PM

Attached Link: http://www.renderosity.com/messages.ez?Form.ShowMessage=2278008

Towards the bottom of this msg I've detailed the code to do this.

Creator of PoserPhysics
Creator of OctaneRender for Poser
Blog
Facebook


mathman posted Wed, 15 June 2005 at 5:44 PM

face_off, if I am not mistaken, your script does everything (i.e. creates spawns morph targets and sets them to 1) except the last step - which is to actually create the FBM. That being the case, what scripting would you use to do this ?


onimusha posted Wed, 15 June 2005 at 5:52 PM

That script is a little confusing. Does it add a prop to the figure or something?


face_off posted Wed, 15 June 2005 at 6:12 PM

Sorry mathman - you are right - it doesn't create the actual FBM. To do this, I save the scene (as pz3), then in a text editor take the morph deltas and put them in an INJ file (pz2). This is very clunky, but as I normally only do head morhps, pretty quick. I'm sure there would be a program somewhere (DAZ?) that extracts the morph from the pz3 and creates a pz2 inject file. The script saves all the hassle of loading the original obj, spawning the props, saving them as individual obj's, and then reloading them as morph targets. Onimusha, you load the morphed obj file, and run the script. It takes the groups within the imported obj files and uses them as morph targets.

Creator of PoserPhysics
Creator of OctaneRender for Poser
Blog
Facebook


mathman posted Wed, 15 June 2005 at 9:36 PM

face_off, Can't you just do the final step of creating the FBM from within the Poser interface (Figure->Create FBM or whatever) ? What I was querying though - and what would be even better - is that maybe that step could be incorporated into Python ? .... does Python expose all of the functionality of the Poser interface, or only selected parts of its object model ? regards, Andrew


face_off posted Wed, 15 June 2005 at 10:59 PM

To be honest, for my purposes I don't use the FBM menu option, since I want to go directly to an Injection file (pz2 - which contains the script details needed to control all the actor morphs from the body actor - ie. is a FBM). AFAIK, converting to an FBM before saving to pz3 wouldn't save any of the hassle of copying deltas from the pz3 to the pz2. But I'm sure there are more knowledgeable people out there on this subject - maybe they can elaborate. I'm also pretty sure that the PoserPython library doesn't expose the FBM functionality. There are only about 2 morph functions (one of which I'm using in that script). For example, it is also not possible to delete morphs from PoserPython, nor rename them.

Creator of PoserPhysics
Creator of OctaneRender for Poser
Blog
Facebook


lourdes posted Thu, 16 June 2005 at 7:17 PM

Attached Link: http://www.rogueslair.com/tmp/LMScripts.zip

Here's some scripts that I use. I've cut and pasted below what I wrote in the notes that is in the zip file...

SpawnMorph.py

This script will spawn a morph target for each body part indiscriminately. Let's say you turned a few dials and used some magnets on parts of your figure....you would use this script to spawn the morph targets for all the body parts. Note that it will spawn morph targets for parts that aren't changed so you will still need to clean those up afterwards.

I usually use this script along with ockham's zero morphs and delete mags scripts which are available in the r'osity freestuff.

============================================================

LoadMorphs.py

This script will import morph targets from a specified directory and will create morph targets for the selected part based on the imported geometry.

Some things to note:

Although the script sets the import options to all unchecked, it still seems to rescale the imported object. To prevent this, you'll need to import a geometry into poser with all options unchecked prior to using this. i.e. import a prop with all options unchecked, then delete the prop before attempting to use this script for loading your morphs.

Save your morph targets for each body part in their own directory. For example, all the morph targets for the 'chest' body part will be in it's own directory. Give the morph targets the names you actually want them to be....this scripts uses the filenames for the morph target names.

Do not include the last '' in the path that you specify.

The script will need to be used for each body part. Make sure you have selected the body part that you wish to load the morphs onto.

This method is memory intensive since it needs to import each and every morph.

============================================================

RenameMorph.py

This scripts will change the 'external' name of a morph target. It will also rename the 'internal' name of a morph target if you check off the 'internal' option. Note that for reasons unknown, the 'internal' name will only be changed if you reinitialize python prior to using the script's internal name option...each and every time you want to use the 'internal' option. Sorry....couldn't figure out why...

============================================================

SetMorphTo1.py

This script will do just that. It will set the morphs with a specified name to 1 for the entire figure. You can then manually create the full body morph. I don't know if things have changed for P6 but for PP and P5, there is no way to access the create full body morph with python.

I also use this script along with ockham's zeromorphs script.

These scripts are freely redistributable...even if you modify them to make them work better etc. Just don't sell them....

Lourdes


ju8nkm9l posted Thu, 16 June 2005 at 10:42 PM

I'm Bookmarking this thread. Interesting stuff.


face_off posted Fri, 17 June 2005 at 12:50 AM

Lourdes. Impressive! I've come up on the same scaling problem you've had on LoadMorphs.py. If you ever find a code workaround, let me know.

Creator of PoserPhysics
Creator of OctaneRender for Poser
Blog
Facebook