Sat, Jan 11, 7:58 AM CST

Renderosity Forums / Poser Python Scripting



Welcome to the Poser Python Scripting Forum

Forum Moderators: Staff

Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 pm)

We now have a ProPack Section in the Poser FreeStuff.
Check out the new Poser Python Wish List thread. If you have an idea for a script, jot it down and maybe someone can write it. If you're looking to write a script, check out this thread for useful suggestions.

Also, check out the official Python site for interpreters, sample code, applications, cool links and debuggers. This is THE central site for Python.

You can now attach text files to your posts to pass around scripts. Just attach the script as a txt file like you would a jpg or gif. Since the forum will use a random name for the file in the link, you should give instructions on what the file name should be and where to install it. Its a good idea to usually put that info right in the script file as well.

Checkout the Renderosity MarketPlace - Your source for digital art content!



Subject: "offset" script request


Adom ( ) posted Fri, 07 May 2010 at 9:21 AM · edited Tue, 30 July 2024 at 8:15 AM

Hi,
ussualy I can make the script for myself but I havent used python lately and I'm not a programmer so it would take ages to go through all docs again.

Script itself is simply (but it shoud have small GUI).

Scene:
 - there is a figure in the scene (feet IK on),
 - we are in frame 1,
 - figure has some pose applied to it (so all IK goal actors have key frame),
 
 - now we skip to frame 11,
 - apply another pose (so all IK goal actors have key frame),
 
while in frame 11:
 - make sure that actor with IK goal is selected - it will be "anchor" actor,
 - run script.
 
shortly about the script:
script should "offset" second pose (all IK goals actors which are "on" + hip) so "anchor" actor in frame 11 moves to exact position from frame 1 and all other IK goals actors (which are "on" + hip) shift the same distance as "anchor" actor did.

  • if selected actor is not an active IK goal actor (or hip) while running the script then nothig happens
  • if actual frame is 1 then nothing happens - there is no reference pose
  • the script "assumes" that key frames are on all IK goals actors + hip in both frames (here fr1 and fr11) (there is no "partial" key frames between)
  • ONLY x,y,z trans must be affected - NO ROTATIONS.

GUI:

  • start frame - which is always actual frame (but should be editable - just in case),

  • end frame - initially blank - focus on that field when window appears - if you write here any number greater then actual frame then whole range should be affected by this script - if it is left empty then actual frame is taken as end frame so only actual frame will be shifted.

  • check box - trans x

  • check box - trans y

  • check box - trans z
    all of them set to "on" by default

it should be possible to skip between GUI entries with TAB or ENTER key

Script should be executed after pressing CTR ENTER.

I made similar script for myself long time ago - it works perfect but I have to put all numbers manually (so first I need to use calculator to find out offset and then I have to run it each time for each direction: x, y, z).

Thanks.

ps:
it is really short script - only MY description is such loooong.:)


Adom ( ) posted Sat, 08 May 2010 at 12:13 PM

so I managed to make it myself (yet not all conditions from above but it works).

One question:
how to find out if current actor has IK "on" - looks like I can only get names of whole IK chains  which can be totaly different from actual IK goal actor's name.


Cage ( ) posted Thu, 13 May 2010 at 4:56 PM

I think IK queries are supposed to work sort of like this:

import poser<br></br><br></br>
scene = poser.Scene()<br></br><br></br>
def run():<br></br>
    fig = scene.CurrentFigure()<br></br>
    if not fig:<br></br>
        return<br></br>
    if
fig.NumIkChains():       <br></br>
        for i in
range(fig.NumIkChains()):<br></br>
           
print fig.IkNames()[i], fig.IkStatus(i)<br></br>
           
#fig.SetIkStatus(i,0)<br></br><br></br>
run()<br></br>

There doesn't seem to be a way to determine what actors make up a chain, much less what the goal actor is.  So if you specifically want to query the leg IK status, say, on an undetermined figure, I guess you'd have to get the list of names and make some guesses about which chains are for the legs.  Or allow a user to specify handling.  Or parse a .cr2 for the information, perhaps, but I think that would require user input to select the .cr2.

===========================sigline======================================================

Cage can be an opinionated jerk who posts without thinking.  He apologizes for this.  He's honestly not trying to be a turkeyhead.

Cage had some freebies, compatible with Poser 11 and below.  His Python scripts were saved at archive.org, along with the rest of the Morphography site, where they were hosted.


Adom ( ) posted Mon, 17 May 2010 at 1:52 PM

Thanks for reply,
that's what I was thinking too - so I just gave up the idea with finding IK actor's name.


Privacy Notice

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.