In this final excerpt of Poser 7 Revealed, Kelly L. Murdock describes how to access various pre-built Python scripts.
This is the last in a new series of excerpts from the Thomson Course Technology book Poser 7 Revealed: The e frontier Official Guide. VFXWorld readers were introduced to the skills needed to create, render and animate scenes and projects using the amazing tools offered by Poser 7. Step-by-step tutorials were offered for each task, followed by projects that allowed readers to apply each new skill.
What Youll Do
In this lesson, you learn how to access the various pre-built Python scripts.
You can execute PoserPython scripts within Poser in a couple of different ways. The easiest way to access existing Python scripts is with the Scripts menu. Another way is to use the File, Run Python Script menu command and another is with the Python Scripts palette.
NEW POSER 7 FEATURE The Scripts menu is new to Poser 7.
Finding Default Python Scripts
Several default Python scripts are included with the default installation of Poser and looking at these scripts is a good way to start to learn the Python syntax. To locate the default PoserPython scripts, look in the RuntimePythonposerScripts directory where Poser is installed. You can open and edit all Poser scripts that have the .PY file extension within a text editor.
Using the Scripts Menu
All Python scripts that are added to the poserScripts/ScriptsMenu directory will automatically appear in the Scripts menu. If a folder exists within the PoserScripts/ScriptsMenu directory, the scripts contained in the folder will appear within a submenu in the Scripts menu.
Note: The PoserScripts directory also includes a Wacros folder that holds all the Wacros scripts found in the Material Rooms Shader window.
Using the Python Scripts Palette
You can also open the Python Scripts palette by selecting Window, Python Scripts. This palette, shown in Figure 1, includes several buttons. Each button can be attached to an external script. Clicking a script button executes the script and clicking an empty button opens the Open dialog box where you can load a script for the button. Clicking a script button with the Alt/Option key pressed clears the selected button.
Note: Some of the buttons in the Python Scripts palette are simple scripts that open additional button sets.
Selecting File, Run Python Script makes an Open dialog box appear where you can select a script file to execute. This dialog box can open both Python source files with a .PY file extension and Python compiled files with the .PYC file extension.
Learning the Pre-Built Scripts
The available pre-built scripts are divided into several different categories. Some of these scripts will add simple props to the scene and others will give you access to utilities that can be helpful. The following sections list the available scripts and how they can be used.
Note: Some scripts are only available in the Scripts menu and others are only available in the Scripts palette.
Learn the Prop Samples Scripts
Within the Prop Samples category are several scripts for creating props, including:
Bucky Ball. Adds a geometric Bucky Ball to the scene.
Tetra. Adds a geometric tetrahedron to the scene.
Sinwaved Mesh. Adds a sin wave mesh to the scene.
Fractal Terrain. Adds a terrain plane to the scene.
Learn the Geom Mods Scripts
Within the Geom Mods category are several scripts for modifying the selected object, including:
Randomize Figures. Randomly repositions all the polygons that make up a figure to create an odd effect, shown in Figure 2.
Bulge Figures. Causes the entire figure to be bulged along its normal vectors, resulting in a puffy figure as shown in Figure 3.
Unimesh Demo. Creates a prop from the current figure. The figure prop is a single mesh item without different body parts.
Copy Morph/Group data. Creates a copy of the current morph target and/or group.
Check Paths of cr2/pz3. Checks all the paths within the selected Poser file for missing files.
Randomize Morphs. Creates a unique body style by randomizing all the available morph targets for the selected element.
Geometry Subdivide 2. Increases the resolution of the selected element by subdividing all its polygons.
Random Expression. Applies a random expression to the figure.
Shrink Figures. The opposite of the Bulge Figure script. This script reduces the bulge of the muscles along the normal vectors.
Learn the Utility Functions Scripts
Within the Utility Functions category are several utility scripts for automatically changing settings including:
Drop Actor All Frames. Drops the current actor to the ground in all frames. This is useful if want to align the selected element to the ground for the entire animation.
Drop Fig All Frames. Drops the entire figure to the ground in all frames. This is useful if youve animated a walk cycle that is above the ground plane.
Apply Gravity. Enables gravity for the current selection to all simulations for all frames.
Copy Parameters. Copies all keyframes from one parameter to another parameter.
Compress Files. This utility lets you select a folder and automatically compress all the various Poser files found within the designated folder. You can also select to compress all .OBJ files that are found. Another option lets you delete the original file after they are compressed.
Uncompress Files. This utility is the opposite of the Compress Files utility. It lets you select a folder to search for Poser files. All files that are found are uncompressed. You can also uncompress .OBJ files and delete the compressed file once its uncompressed.
Delete All Lights. Lets you quickly delete all the lights from the scene.
Collect Scene Inventory. This utility lets you print a list of all the files currently opened in the scene including scripts, texture maps, geometry files, morph target files and backgrounds, as shown in Figure 4. This utility also includes an option to copy all these files to a specified folder. This is a great help if you need to collect all the files for a specific scene and you dont want to miss any texture files.
[Figure 4] Scene inventory list.
Convert to Universal Pose. Poser 7 uses a Universal Pose format and this utility lets you select a folder and all the poses within that folder will be converted to the new format. This lets you quickly update any older content.
Search and Replace Files. This utility searches for problem files and replaces them with fixed files.
Learn the Sample Callbacks Scripts
Within the Sample Callbacks category are several scripts that return valuable information about the scene back to the debug window, including:
Add Muscle Magnets. Adds a new magnet deformers to the left and right bicep muscles for the current figure.
Random Head Verts. Randomizes all the vertices for the head polygons creating a distorted localized mess.
Bend Arms by Frame. Enables the Bend options for both arms in all frames.
World Space Print Vert. Prints out the World-Space vertex coordinates for the selected element.
Print Event Callbacks. Prints out all events that happen within the Poser interface.
Parameter Callback. Prints all parameter changes that occur in the Poser interface.
Learn the Render Control Scripts
Within the Render Control category are several scripts that automate the exporting of certain file types and a valuable script for rendering individual passes, including:
Mini-Me. Creates a miniature version of the current figure by exporting the figure to the OBJ format and then importing it again using a different scale value, as shown in Figure 5.
Animated Trans. This script lets you animate the transformations of the figure.
Export Flash. This script searches a designated directory and converts all found Poser files to the Flash format automatically.
Export MTX. This script searches a designated directory and converts all found Poser files to the MTX format automatically.
Export DXF. This script searches a designated directory and converts all found Poser files to the DXF format automatically.
Calculate Depth of Field Focal Distance. Prints the current focal distance value used for the Depth of Field effect where the camera is in focus.
Render Passes. This script renders the current scene out into several passes, one for each light. You can also select to do a separate ambient lighting pass and a separate occlusion pass. These passes are saved into a designated directory where the light name is attached after the file name. These passes can then be used in a compositor to recreate and edit the lighting effects.
Learn the Material Mods Scripts
Within the Material Mods category are several scripts for creating props, including:
Set Materials. The script sets the material inventory for the current scene.
Write Materials. This script creates an inventory of all the materials used within a scene.
Learn the Print Info Scripts
Within the Print Info category are several scripts that output vital information to the debug window, including:
Print Geometry Stats. Prints the number of polygons and vertices included in each of the various body parts, as shown in Figure 6.
Scene Inventory. Prints a quick list detailing the number of figures, body parts, props, lights, cameras, geometries, image maps, and bump maps.
List Files Used. Prints all the files included in the current scene, including scripts, geometry, and texture files.
Figure Actor Info. Prints a detailed list of the current selection, including its hierarchy, actor info, polygon and vertices totals, and all the polys and vertices for the remaining non-figure actors in the scene. It also includes the parameter values for each frame for the selected actor.
Check Figure Magnets. Checks the placement of all magnets within the current scene.
Print Figure WD Stats. Prints the hip height and feet size for the current figure.
Some content creators use complex magnet rigs, and this script identifies any missing elements.
Run a Python Script
1. Open Poser with the default figure visible.
2. Choose File, Run Python Script.
An Open dialog box appears.
3. Navigate to the RuntimePythonposerScriptsCreateProps directory where Poser is installed.
4. Select the FractalTerrain.py file and click the Open button.
A fractal terrain object is added to the scene, as shown in Figure 7.
5. Select File, Save As and save the file as Fractal terrain script.pz3.
Use the Python Scripts Palette
1. Open Poser with the default figure visible.
2. Choose Window, Python Scripts.
The Python Scripts palette appears.
3. Click Print Info in the Python Scripts palette.
A new set of buttons is loaded into the Python Scripts palette.
4. Click the Scene Inventory button.
A dialog box opens that lists all the objects in the scene, as shown in Figure 8.
Find out more about how to put the power of Poser 7 to work as you learn how to use the new Talk Designer to automatically sync facial animations to an audio track, combine the power of Poser 7 with other software packages, create new motions using the new animation layers feature and much more.
Poser 7 Revealed: The e frontier Official Guide by Kelly L. Murdock. Boston, MA: Thomson Course Technology, 2007. 592 pages with illustrations. ISBN 13: 978-1-59863-296-5; ISBN 10: 1-59863-296-5 ($29.99).
Kelly L. Murdock has a background in engineering, specializing in computer graphics. He has worked on several large-scale visualization projects, created 3D models for several blockbuster movies and has worked as a freelance 3D artist and designer. Murdock is the author or co-author of several books, including seven editions of the 3ds Max Bible, two editions of the Illustrator Bible, Adobe Creative Suite Bible, Maya 7 Revealed, LightWave 3D 8 Revealed and Poser 6 Revealed. He works with his brother at his co-founded design company, Logical Paradox Design.