Forum: Poser Python Scripting


Subject: Getting the same view from dolly/orbiting cameras using Python ?

3dcheapskate opened this issue on Feb 05, 2020 · 10 posts


3dcheapskate posted Wed, 05 February 2020 at 1:19 AM

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

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

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

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

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

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..