Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 pm)
It's easy within a CR2 or PP2. Just add a pythonStartupScript line. Note that the line goes just after the figure-type stuff and before the materials section in a CR2. You will need to experiment some, because the exact timing of the call makes some actions impossible. I don't recall the specifics, but I tried it once and decided it wouldn't work for my purpose because the call seemed to happen before the CR2 was all done loading. You might try putting the call at the very end of the file? ........... origFigureType 1318 canonType 8 conforming 0 pythonStartupScript 0 0 ":Runtime:python:abcde.py" material Skin { KdColor 1 0.790311 0.660014 1 KaColor 0 0 0 1 etc
My python page
My ShareCG freebies
Ockham......Fan-tastic. Thank you!!!!! You are a champion.
Creator of PoserPhysics
Creator
of OctaneRender
for Poser
Blog
Facebook
PS: I just tried the experiment (again, probably) and found that the line definitely has to be in that location. It won't run at the very end of the CR2. In a PZ3 it goes at the very end of the Doc section: ......... TwoPortsTopBottom_p2 MAIN_CAMERA pythonStartupScript 0 0 ":Runtime:Python:poo.py" } illustrationParms { combineGradient 0 etc............ I can't seem to make it work in a PZ2, though.
My python page
My ShareCG freebies
Mmmmm, I also just tried it in a pz2 file - the Pz2 loads ok, but the python script gets ignored.
Creator of PoserPhysics
Creator
of OctaneRender
for Poser
Blog
Facebook
Yup, that's what it seemed to do for me. Most of the stuff that normally goes in a PZ3 can be "trojanned" by a PZ2, but this must be one of the exceptions.
My python page
My ShareCG freebies
Bummer. Would be awesome to be able to fire off python scripts via a pose, rather than the buggy python window.
Creator of PoserPhysics
Creator
of OctaneRender
for Poser
Blog
Facebook
Bit more experimenting. It is possible; I took a simple PZ3 containing the line, renamed it to PZ2, and loaded it as a Pose. The script took effect. So it's just a question of finding how much of the PZ3 stuff has to be there....
My python page
My ShareCG freebies
Well it seems to need more than just a version and doc command....will try adding stuff...
Creator of PoserPhysics
Creator
of OctaneRender
for Poser
Blog
Facebook
Yeah, it's weird. Somewhere between a full PZ3 and the bare minimum is a key of some kind. I haven't found it yet.
My python page
My ShareCG freebies
I've adding everything but the figure - and no go. Maybe the trigger could be when it actually loads a new figure.
Creator of PoserPhysics
Creator
of OctaneRender
for Poser
Blog
Facebook
That's probably the point. My sample PZ3 does include a real figure. In that case the PZ2 wouldn't be useful anyway; might just as well use a CR2!
My python page
My ShareCG freebies
Yes - I guess the real downside is that you can't run a python script for an existing character - only a new one via a cr2.
Creator of PoserPhysics
Creator
of OctaneRender
for Poser
Blog
Facebook
Ockham, does this mean that when I release the nextgen figures, we can have the naturalizer and jiggles combined script load automatically with the figure, so the customer doesn't have to actually do anything? This is really going to give EAP a kickstart. I still can't get the animated pose file to load properly with a CR2. Anybody know how to do this?
Your specialist military, sci-fi, historical and real world site.
Yes, it does. Running from CR2 is definitely possible. Which animated pose file?
My python page
My ShareCG freebies
Ockham, I am trying to make a system that is easier for people to use. Example: I have a room, with ceiling fans. I have an animated pose file that rotates the fans, say a 200 frame animated pose file. When the customer loads the CR2 of the room, I want the animated pose file to load as well. So all the customer has to do is load his characters, animate them, and render. The "automatic" animations, like the fans turning that are tedious to animate, is done for him already. I must be doing something wrong, because it keeps messing up and I can't get it to work.
Your specialist military, sci-fi, historical and real world site.
Attached Link: http://wooyah.com/ubbt/prod/showflat.php?Cat=&Number=7028&page=0&view=collapsed&sb=5&o=&fpart=1
Ockham, I posted a technique on Wooyah.com's forums about using hacked CR2 files to load python scripts rather than relying on the scripts window. I played with library-loaded Python quite a bit working on Particles 2 [shameless plug]due out January from DAZ [/shameless plug] and this was the best method I found. Interesting side note: Poser does apply pythonStartupScript lines from PZ2's to the current figure, it just doesn't execute them like it does when loading CR2s and PZ3s. I attempted to splice doc pystart lines into CM2 and LT2 files as well, with little success.Hi Poseworks - this is awesome. I'm not sure what you mean by "does apply pythonStartupScript lines from PZ2's to the current figure, it just doesn't execute them like it does when loading CR2s and PZ3s". I found that it parsed the line, but didn't execute the script. Maybe I was doing something wrong. I tried your cr2 method. Very interesting. If you Replace the current figure with the script (ie. double-click the icon) - your figure gets removed from the scene and then the script runs. But if you select the script in the character list, and click the Create New Figure button - it adds a new figure (called PyTrojanFig - from your cr2) and runs the script - and leaves the PyTrojan in the scene. I need to play with this some more I think....
Creator of PoserPhysics
Creator
of OctaneRender
for Poser
Blog
Facebook
I guess a way of handling the "PyTrojan" being left in the scene would be to have the script delete it! The issue I've got is that I need to have a figure selected when I run the script. Having the script fire-off from a .cr2 file results in a new figure being created, so the original selected figure is no longer current. That's why I was heading down the "run the script from a pz2 file" path.
Creator of PoserPhysics
Creator
of OctaneRender
for Poser
Blog
Facebook
Interesting technique! Not sure that it would be worthwhile for simple actions; deleting takes noticeable time and sometimes leaves odd stuff behind. But for a script that's going to do serious work anyway, this would be worth the trouble.
My python page
My ShareCG freebies
LtD, now THAT'S an idea. Not sure how to autoparent in a cr2 though. Do you know of any tutorial's on this?
Creator of PoserPhysics
Creator
of OctaneRender
for Poser
Blog
Facebook
Face_off--be sure to use a "caller" script like the one described in the WooYah thread to kill the PyTrojan figure and then process its deletion. Ockham--I've noticed that the interface will cling to remnants of PyTrojanFig, but as long as you have the script process a Poser event after deletion, there should be no trace of the PyTrojanFig after your script is done running. What artifacts/messiness have you encountered? LtD--Could you describe this technique some more? It sounds promising.
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.
Hi All Just wondering if anyone had ever found a way to execute a python script from within a pz2, pz3 or cr2 file (ie. when you load the file, it fires off the script)? I assume it's not possible, but thought I ask anyway.
Creator of PoserPhysics
Creator of OctaneRender for Poser
Blog
Facebook