Sat, Dec 28, 8:04 PM 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: Getting the same view from dolly/orbiting cameras using Python ?


3dcheapskate ( ) posted Wed, 05 February 2020 at 1:19 AM · edited Sat, 28 December 2024 at 7:35 PM

I've had a sitemail request to do a script to get the same view from dolly/orbiting cameras. I was also asked whether it's possible to code a script to transform relative rotation values to absolute values and vice versa.

I'm assuming that the correspondent read one of my old 2014 threads, i.e.

However, my Python is very rusty (and it was never particularly good even when well-oiled), so I'm really not the best person to direct this question to. I've started this thread in the hopes that somebody else can pick this up,or direct the correspondent to a suitable script.

TIA


The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident.
And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU.

*also available in ShareCG, DAZ, and HiveWire3D flavours (the DeviantArt and CGBytes flavour have been discontinued).



3dcheapskate ( ) posted Wed, 05 February 2020 at 1:28 AM · edited Wed, 05 February 2020 at 1:31 AM

To get the ball rolling - back in 2014 at various points in those two threads....

Ockham's post from the first thread suggests (with a caveat) the *{the forum once again deleted my URL link)* (which no longer seems to appear on the main Python page,although there area couple of other camera-related scripts)

bagginsbill suggested simply asking poser where the camera is as the key to it - poser.Scene().CurrentCamera().WorldDisplacement()


The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident.
And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU.

*also available in ShareCG, DAZ, and HiveWire3D flavours (the DeviantArt and CGBytes flavour have been discontinued).



adp001 ( ) posted Wed, 05 February 2020 at 6:10 AM

You got a perfect answer from Bagginsbill 6 years ago and want to discus this again?

Use WorldDisplacement(). Simple and clear. Don't try to make the world more complicated than it is.




maur_2005 ( ) posted Wed, 05 February 2020 at 8:00 AM

Hi adp001, could you please briefly explain to me how to use WorldDisplacement()


adp001 ( ) posted Wed, 05 February 2020 at 10:07 AM

I think I don't know what you mean.

WorldDisplacement() returns X, Y, Z world coordinates in Poser units. If you need to know how to convert PNUs, visit your Poser manual.




3dcheapskate ( ) posted Wed, 05 February 2020 at 7:46 PM · edited Wed, 05 February 2020 at 7:52 PM

Hi maur_2005, glad you could join us. I hadn't realized that your second question (transforming relative rotations to absolute rotations) wasn't directly related to the camera question, so I think it may be better to start a separate thread for that, although I think the post on that previous camera thread that mentions 'Get the mid-point of the relevant bone, which is the centre of rotation' may have some relevant code in it.

Regarding the dolly/orbiting camera question, as bagginsbill and adp pointed out, using WorldDisplacement() seems to be the key. So I think what we're after in this thread is a sample script extract using WorldDisplacement() to convert between dolly/orbiting cameras, probably something similar to my original one here, but using WorldDisplacement().

I've always found that short code samples can be very helpful, especially to a rusty/new Python user.


The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident.
And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU.

*also available in ShareCG, DAZ, and HiveWire3D flavours (the DeviantArt and CGBytes flavour have been discontinued).



maur_2005 ( ) posted Wed, 05 February 2020 at 8:35 PM

Thank you. You were right, WorldDisplacement() is the key, I think I might figure out

cam = scn.ActorByInternalName("FACE_CAMERA") wd = cam.WorldDisplacement() wdx=di[0] wdy=di[1] wdz=di[2]


3dcheapskate ( ) posted Thu, 06 February 2020 at 12:16 AM · edited Thu, 06 February 2020 at 12:24 AM

Posting code on these forums is quite a challenge, as anybody who's tried knows only too well.

cam = scn.ActorByInternalName("FACE_CAMERA")
...etc...

Hopefully there's a code snippet above - one line, followed by another that says '...etc...', and a screenshot attached showing how it was done, which is I think the easiest way that I'm aware of. As long as your code doesn't contain backslashes. This forum does things with backslashes that would confuse a professional magician !

HolyTripleBackticks1Batman!.jpg

The screenshot below is from the 'Markdown' link below the post editing box, explaining the use of the triple backtick

HolyTripleBackticksBatman!.jpg

My aide-mémoire for this is:

"Holy triple backticks batman, it's some correctly displayed code ! "

"Yes Robin, but don't forget that the Joker holds the backslashes !"


The 3Dcheapskate* occasionally posts sensible stuff. Usually by accident.
And it usually uses Poser 11, with units set to inches. Except when it's using Poser 6 or PP2014, or when its units are set to PNU.

*also available in ShareCG, DAZ, and HiveWire3D flavours (the DeviantArt and CGBytes flavour have been discontinued).



ironsoul ( ) posted Thu, 06 February 2020 at 2:40 AM · edited Thu, 06 February 2020 at 2:45 AM

Ah so back ticks switch off formatting so the following should contain a backslash C:runtime Edit - which it does Edit - until I edit the comment again when the slash is removed by the editor.



ironsoul ( ) posted Thu, 06 February 2020 at 2:46 AM · edited Thu, 06 February 2020 at 2:50 AM

Just trying again without edit c:runtime which still does not work. Ok give up - think taking a screenshot is probably the most reliable approach..



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.