Sat, Nov 23, 2:20 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 Sep 18 2:50 am)

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: What is the mystery frame incrementer?


HartyBart ( ) posted Thu, 12 August 2021 at 10:31 PM · edited Sat, 23 November 2024 at 12:29 PM

In the 2018 YouTube Poser video "Python Scripting Poser for Pseudo 3D" we see this (just about, as it was very badly filmed):

anim.jpg

Which I have out of curiosity reconstructed as this:

walker.jpg

What is the curious scene.setFrame increment command being used here (partly circled in red)? It looks like a Greek letter?



Learn the Secrets of Poser 11 and Line-art Filters.


HartyBart ( ) posted Tue, 24 August 2021 at 12:08 PM · edited Tue, 24 August 2021 at 12:09 PM

I now think it may be ka=10 which is apparently an obscure maths formula used to raise things by powers of 10.

But then how does ka=10 + k make sense?

Adding import math to the script header does not make the script run.



Learn the Secrets of Poser 11 and Line-art Filters.


primorge ( ) posted Wed, 01 September 2021 at 6:29 AM · edited Wed, 01 September 2021 at 6:30 AM

I've seen ka in Poser files before. It's similar to other shader tree designations such as ks(specular) or kd(diffuse), in this case it indicates ambient... not at Poser to check and this is just a guess, it might be totally unrelated but maybe noteworthy.


structure ( ) posted Mon, 06 September 2021 at 3:16 AM · edited Mon, 06 September 2021 at 3:27 AM
Forum Coordinator

from what I can tell, both ka and h would need a value, there is nothing telling the script what ka is - it is not a poser object or you would see something like

scene.SetFrame(poser.kCMDka * 10 + h)

it is likely a frame counter as in :

scene.SetFrame( ka * 10 + h )

Since setframe requires a frame number

SetFrame
Explanation
Set the current frame number. All frame numbers in PoserPython are relative to
a starting frame of 0. For this reason, a frame number in Python is 1 less than the
equivalent frame as referenced from the Poser GUI.
Arguments
Enter a valid frame number.
Syntax
 SetFrame( frame )
Example
scene.SetFrame(23)

and the only options available are the increments :

SetFrameOptions
Explanation
Set the values for frame rate and increment.
Arguments
Enter two integer values, for frame rate and frame increment respectively
Syntax
 SetFrameOptions( rate,  increment )
Example
moviemaker.SetFrameOptions(24, 4)

so ka is likely the start frame, multiply that 10 and add h for the resulting frame number ( I am sure there is a typo with the " = " )

Locked Out


HartyBart ( ) posted Wed, 08 September 2021 at 12:29 PM · edited Wed, 08 September 2021 at 12:30 PM

Thanks very much. I've got a little further, but I'm at the point where I'm just guessing now. Still, the only error being thrown by the non-working script seen below is that there is " an unsupported operand type(s) for * ".

walker.jpg



Learn the Secrets of Poser 11 and Line-art Filters.


structure ( ) posted Tue, 05 October 2021 at 12:45 PM
Forum Coordinator

if you could paste the code - I could try it out - finding it difficult to type atm. 

Locked Out


HartyBart ( ) posted Wed, 06 October 2021 at 2:29 PM

# Auto walker, to be used with Poser Walk Designer

import math

import poser

scene = poser.Scene()

actor = scene.CurrentActor()


sceneFigure = "Andy2"

figure = scene.Figure("Andy2")

body = figure.Actor("Body")

yRotateParam = body.Parameter ("yRotate")


frames = scene.SetNumFrames(360)

ka = actor.SetRangeConstant(10,349)


# Figure walks 10 frames then turns, then walks ten frames

for angle in range(10,360,10):

    scene.SetFrame( ka * 10 + h )

    yRotateParam.SetValue(angle)

    scene.DrawAll ()



Learn the Secrets of Poser 11 and Line-art Filters.


HartyBart ( ) posted Wed, 06 October 2021 at 3:48 PM · edited Wed, 06 October 2021 at 3:49 PM

Test of HTML pre and code :

<pre>Your code here</pre> 

<code>Your code here</code>

No, that doesn't work.

'''

does this

'''

No, that doesn't work either.



Learn the Secrets of Poser 11 and Line-art Filters.


HartyBart ( ) posted Wed, 06 October 2021 at 3:54 PM · edited Wed, 06 October 2021 at 3:55 PM

```

Can code be enclosed in backticks?

```

Or in [code]bracketed code blocks[/code]?

No, those don't work either.



Learn the Secrets of Poser 11 and Line-art Filters.


structure ( ) posted Wed, 06 October 2021 at 5:00 PM · edited Mon, 25 October 2021 at 1:26 PM
Forum Coordinator

ok first you have no value for h

multiplying a tuple  (ka) will loop the tuple between the 2 numbers x times

e.g.

print( 10 * (36, 30) )

results in the output 

(36, 30, 36, 30, 36, 30, 36, 30, 36, 30, 36, 30, 36, 30, 36, 30, 36, 30, 36, 30)

trying to add the h 

results in an error

>>> ka = (10, 349)

>>> h  = 90

>>> print (ka * 10 + h)

Traceback (most recent call last):

  File "<pyshell#2>", line 1, in <module>

    print (ka * 10 + h)

TypeError: can only concatenate tuple (not "int") to tuple

>>> 

to make a turn at the end of each 10 frames doesn't need a complicated formula 

class anim:
    def createAnim(self, parm, frame):
        for i in range(0, 4):
            frame += 10
            scene.SetFrame(frame)
            parm.SetValue(parm.Value() + 90)
            scene.DrawAll()

Locked Out


structure ( ) posted Wed, 06 October 2021 at 5:13 PM · edited Mon, 25 October 2021 at 1:29 PM
Forum Coordinator
# Auto walker, to be used with Poser Walk Designer

import poser
scene = poser.Scene()


class Anim:
    def createanim(self, parm, frame):
        for i in range(0, 4):
            frame += 10
            scene.SetFrame(frame)
            parm.SetValue(parm.Value() + 90)
        scene.DrawAll()


body = scene.Figure(scene.CurrentFigure().Name()).Actor("Body")
if body:
    yRotateParam = body.Parameter("yRotate")

    frames = scene.SetNumFrames(360)

    # Figure walks 10 frames then turns, then walks ten frames
    Anim().createanim(yRotateParam, 0)

Locked Out


3dcheapskate ( ) posted Wed, 06 October 2021 at 11:24 PM · edited Wed, 06 October 2021 at 11:25 PM

An auto walker, eh?

For use with Poser Walk Designer ?

D'you think it'd work for a millipede ? 😃

I couldn't find any info on the walk designer (well, to be honest I didn't actually look) and ended up cobbling together a load of callbacks over there The first four segments of a millipede - not sure if this'll go anywhere :) | HiveWire 3D Community

So I'm intrigued by what you're doing here as it may be a better approach...



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



HartyBart ( ) posted Thu, 07 October 2021 at 12:40 PM

Thanks Structure, I'll test that soon when I have time. So, it sounds like the mystery line was being used by the scripter to save having to write/calculate a string of numbers.

3dcheapskate - the original video was by Bill Nye. He made a 10-frame walk cycle with the Poser Walk Designer, and then every ten frames had the script rotate the figure. He was making flat-colour 'psuedo 3D' walking sprites for Flash.

xUeGAMYEWtLmdXraYJP5JdQR5HbYrtETU4mTtH0w.jpg7ohI9iDHd68n3oK8TEcEK5Bmndgn9E3Gs8en93Zd.jpg

I assume if you have a maybe five frame walk for each leg of a millipede, simply swinging back and forth, then you could apply that to all legs, but then stagger the timing on each so as to get the flowing 'ripple effect' of a millipede's legs?  Once you have that, then the whole creature could be made to walk around in a circle. How you would then make it wiggle a bit I don't know.



Learn the Secrets of Poser 11 and Line-art Filters.


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.