Forum: Poser Python Scripting


Subject: getting point at info ?

markschum opened this issue on Apr 23, 2011 · 11 posts


markschum posted Sat, 23 April 2011 at 11:18 PM

anyone know a way to get whats pointed at what without looking at the pz3 or other files ?

I am rigging  a complex model and wanted to check all the parts , but didnt see a way of getting that information. :(

 

 

 


semidieu posted Sun, 24 April 2011 at 5:07 AM

If someone knows how to do it, I would be glad to know too :)

 

But... the only way I could think would be to save the scene and read the scene file.


semidieu posted Sun, 24 April 2011 at 5:08 AM

poser.Scene().CurrentActor().ParameterByCode(poser.kParmCodePOINTAT)

 

This just tells if an actor is pointing at something... but is it possible to know to what ?


Dizzi posted Sun, 24 April 2011 at 5:26 AM

You can't do it directly akaik, but you could do something like this:

  1. Check if actor points at something with poser.Scene().CurrentActor().ParameterByCode(poser.kParmCodePOINTAT)

  2. Get WorldQuaternion

  3. move all other actors in the scene and compare WorldQuaternion, move actors back in place...

Rather ugly approach I guess ;-)



Cage posted Wed, 04 May 2011 at 6:18 PM

You could also try getting the world displacement for all of the actors in the scene, then compare the vector between each of these and the pointed actor to the orientation vector of the pointed actor, found along the axis between its origin and endpoint.  Unfortunately this can only identify good candidates for point at target, because it can't differentiate between actors which might line up along that same vector.

So I think Dizzi has the best idea.  :laugh:

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


markschum posted Thu, 05 May 2011 at 7:18 PM

I did a script to  read the pz3 to get whats pointing at what.


semidieu posted Thu, 05 May 2011 at 11:50 PM

Thanks for the info. Can you tell us how 'fast' it can give the answer ?


markschum posted Fri, 06 May 2011 at 1:32 AM

Its this codeand only takes a few seconds to run.

On my system it can take up to 10 minutes or so to save a large scene so I did not automate that.

import string
mypz3 = "C:Documents and SettingsOwnerMy DocumentsPoser Scenesdystopian_picnic.pz3"
stuff = ["acto","prop","ligh","came"]
fi = file(mypz3,"r")
myfig = ""
for line in fi:
    line = line.strip("n")
    if line[0:7] == "figure ":
        myfig = line
    if line[0:4] in stuff:
        myact = line
    p = line.strip(" tn")
    if p.startswith("pointAtTarget"):
        print myfig," / ",myact," / " ,p


semidieu posted Fri, 06 May 2011 at 1:56 AM

Thanks for the info... and I now I'm curious to see what your scene look like... Dystopian Picnic ?


markschum posted Fri, 06 May 2011 at 3:55 PM

I made a picnic basket to go with the cooler, and the rsident bear wondered where such a picnic might occur. Thus a picture was born... 

semidieu posted Sat, 07 May 2011 at 4:39 AM

I love it :)