Forum Coordinators: RedPhantom
Poser - OFFICIAL F.A.Q (Last Updated: 2024 Nov 26 6:11 am)
Yes, it is possible.
Look up the posts by lesbentley for all kinds of .pz2 tricks, including running scripts from pose files.
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
That's all my PMD INjection PZ2 files do.
Here's a sample that loads PMD morphs via a python script then injects them and creates FBM Morphs from them:
Quote -
{
version
{
number 6
}
#---------------------------------------------------------------------------------------------------Run a python script to pre-create the morph target channels so they are created in the right place
(Poser 6 first release doesn't add the morphs in the correct order with the injectPMDFileMorphs command)
#---------------------------------------------------------------------------------------------------
runPythonScript ":Runtime:!Adam:Adam1:addAdamTargetParms.py"
injectPMDFileMorphs ":runtime:!Adam:Adam1:MWAdamFBMPMD.pmd"
createFullBodyMorph Muscles
injectPMDFileMorphs ":runtime:!Adam:Adam1:MWAdamHeadPMD.pmd"
readScript ":runtime:!Adam:Adam1:AdamDials.pz2"
}
Okay,
Worked. I dial up a character with A3, use a pose file to run svld's spawn FBM and then run the REM pose lesbently taught me to make... this is fastest bestest way to dial a character on a non-INJ figure and then strip out the unwanted morphs without losing the facial expressions and JCM morphs.
Cool!
LostinSpaceman, would you please share with us your "addAdamTargetParms.py" script - I would like to create these empty channels AND inject the morphs by using a single pose file !
Alice's and
GND4's Tailor !
Check my free clothing
fits : www.alizea3d.com
Here it is:
Quote -
import poser
scene = poser.Scene() #---------------------------------------------------------------------
# We need to pre-create specific morph channels
# In this case, there are two lists because the NoGenFBMs must exist on the hip and chest only.
# Other morphs are created on all the other main body parts
#---------------------------------------------------------------------
actorList1 = ["hip", "chest"]
morphList1 = ["Muscles"]actorList2 = ["Chest", "Abdomen", "Neck", "upNeck", "Head", "rCollar", "rShldr", "rForeArm", "lCollar", "lShldr", "lForeArm", "rButtock", "rThigh", "rShin", "lButtock", "lThigh", "lShin"]
morphList2 = ["Muscles"]figureToChange = scene.CurrentFigure()
for actrName in actorList1:
actr = figureToChange.Actor(actrName)
if (actr) :
for morphName in morphList1:
curParm = actr.Parameter(morphName)
if (curParm == None) :
actr.SpawnTarget(morphName)for actrName in actorList2:
actr = figureToChange.Actor(actrName)
if (actr) :
for morphName in morphList2:
curParm = actr.Parameter(morphName)
if (curParm == None) :
actr.SpawnTarget(morphName)
This is for a figure that uses geometry switching to turn genitals on and off. Just eliminate the extra actorList1 parts for a figure without the geometry switching.
This script works very well !
One little trouble , I have a warning message as the figure has not all these bodyparts .Would it be possible to have an "universal" python script that gives me no warning if there are any missing bodyparts ?
Thank you !
Alice's and
GND4's Tailor !
Check my free clothing
fits : www.alizea3d.com
No because every figure has different body parts. You'll need to add the ones missing for yours and remove any non-working ones. Unfortunately until there's a universal figure grouping method, it's not possible other than just adding every known body part ever made and living with the error messages for the non-existant body parts.
Oh that's too bad :( Thank you anyway !
Alice's and
GND4's Tailor !
Check my free clothing
fits : www.alizea3d.com
I've got this message, even if I've put only the needed bodyparts :
Traceback (most recent call last):
File "C:Program FilesImages de synthèsePoser ProRuntimePythonposerScriptsScriptsMenuCreateChannels1.py", line 13, in ?
actr = figureToChange.Actor(actrName)
poser.error: Error parsing Actor()
Usage: ActorByInternalName( name)
Anybody reads chinese ;) ?
Alice's and
GND4's Tailor !
Check my free clothing
fits : www.alizea3d.com
It would certainly help if you actually posted the Python file so we could make certain all your coding is correct including comma's, and what not. It's telling you that the error is on line 13 of the Python file which is calling for a body part to add the FBM to so you need to be certain that your listing of body parts has all the proper commas in it as well between body parts.
Something I noticed in the script posted above: some body parts are referenced by their internal names (hip, chest) others by their external names.
It's usually best to only use internal names, since the external names may vary from language version to language version.
And ignoring errors: well, if you rewrite the script around line 13 to:
try:<br></br>
actr=figureToChange.ActorByInternalName(actrName)<br></br>
except:<br></br>
continue<br></br><br></br>
the script will just skip actors that it doesn't recognize.
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
Hi everybody ; I 've lost the trace of this thread but finally found it !
So here is the script I'm using :
import poser
scene = poser.Scene()
actorList1 = ["hip", "chest","abdomen","lcollar","rcollar"]
morphList1 = ["Muscles_01","Muscles_02"]
figureToChange = scene.CurrentFigure()
for actrName in actorList1:
actr = figureToChange.Actor(actrName)
if (actr) :
for morphName in morphList1:
curParm = actr.Parameter(morphName)
if (curParm == None) :
actr.SpawnTarget(morphName)
For this script I have this message :
Traceback (most recent call last):
File "C:Program FilesImages de synthèsePoser ProRuntimePythonposerscriptsscriptsMenuAddChannels2.py", line 10, in ?
actr = figureToChange.Actor(actrName)
poser.error: Figure has no actor by that name
(the script works as it adds the two channels)
(the figure has only hip, abdomen and chest bodyparts)
if I add this block at the end of the script:
try :
actr=figureToChange.ActorByInternalName(actrName)
except :
continue
I have this message ( and there are no channels added ):
File "C:Program FilesImages de synthèsePoser ProRuntimePythonposerscriptsscriptsMenuAddChannels2.py", line 20
continue
SyntaxError: 'continue' not properly in loop
I've tried adding this block at the end of the script:
try :
actr=figureToChange.ActorByInternalName(actrName)
except :
pass
but I have the same result as the original script (poser.error: Figure has no actor by that name ; but new channels were added )
I've tried this "try ...except" with ActorByInternalName or simply Actor , same result .
I'm sure there must be a way , I have programming notions , unfortunately not in Python language ;)
Thank you all !
Alice's and
GND4's Tailor !
Check my free clothing
fits : www.alizea3d.com
The actor names are case sensitive: change "rcollar" to "rCollar" and "lcollar" to "lCollar".
That's the cause of the "Figure has no actor by that name" exception.
The cause of the "continue not properly in loop" exception might be caused by an indentation error: make sure the "continue" statement is at exact the same indentation level as the
statiement below the "try"
If you just copy/pasted the Python code in your post, this is the most likely cause.
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
Hi svdl !
About the "rCollar" you're right -it is case sensitive .
I have uploaded the python script in .py format here :
http://www.alizea3d.fr/alizeadownld/AddChannels2.py
I have intentedly tried it on a figure that has no "rCollar" neither "lCollar" ( on a bikini figure ) and still got the error message .
In fact I would need a single script ( I would put in actorList1 all V4's bodyparts ) so it would be useable for any clothing piece .
I've already using this "CreateChannels" script ( yours !) which works this way :
import poser
parmName="FBMEmptyChannel"
fig=poser.Scene().CurrentFigure()
for act in fig.Actors():
if act.IsBodyPart() and act.Geometry():
if act==fig.ParentActor():
act.CreateValueParameter(parmName)
else:
act.SpawnTarget(parmName)
The only problem is that I can't launch it-I've tried but it's not working- at the same time as the INJ pose ( I've dreamed of a "one click " solution : a single pose file creates the empty channels via the scipt AND injects the morphs into these channels ).
The "AddChannels" script works fine for this : it is possible to create the empty channels AND inject the morphs at the same time ! But I'm bothered as the figure must have all bodyparts as in actorList1 otherwise I have a error message .
Thanks !
Alice's and
GND4's Tailor !
Check my free clothing
fits : www.alizea3d.com
OK, here's a rewrite of your script: This should work.
import poser<br></br>
scene = poser.Scene()<br></br><br></br>
actorList1 = ["hip",
"chest","abdomen","lCollar","rCollar"]<br></br>
morphList1 = ["Muscles_01","Muscles_02"]<br></br><br></br>
figureToChange = scene.CurrentFigure()<br></br><br></br>
for actrName in actorList1:<br></br>
try:<br></br>
actr=figureToChange.ActorByInternalName(actrName)<br></br>
except:<br></br>
continue<br></br><br></br>
if (actr) :<br></br>
for morphName in
morphList1:<br></br>
curParm = actr.Parameter(morphName)<br></br>
if (curParm == None) :<br></br>
actr.SpawnTarget(morphName)<br></br>
Notice the indentation! I usually use 3 or 4 spaces for indents, so that it's easier to see where a block starts and where it ends.
The difference between the AddChannels script and my script is that my script doesn't check for existing channels, and that my script also creates a value parameter for the FBM. Apparently, that should be done using the createFullBodyMorph command.
The fix is this: change the lines
if act==fig.ParentActor():
act.CreateValueParameter(parmName)
to
if act==fig.ParentActor():<br></br>
continue:
in the python script.
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
Oh, and for some great background information on injection creation, see the following link:
http://www.nerd3d.com/modules.php?name=Content&pa=showpage&pid=13
The pen is mightier than the sword. But if you literally want to have some impact, use a typewriter
Thank you svdl , it works just perfect , yepee!
Nerd3d's site has very interesting tutorials over there, gotta take a closer look !
Hugz,
Alizea
Alice's and
GND4's Tailor !
Check my free clothing
fits : www.alizea3d.com
This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.
Is it possible to write a .pz2 file that does nothing other than invoking a python script .py?