Forum: Poser Python Scripting


Subject: I need a shortcut key script example

Uncanny_Film opened this issue on Feb 10, 2022 ยท 10 posts


Uncanny_Film posted Thu, 10 February 2022 at 1:15 PM

Hello, I'm new to programming. But I would like to write a code for poser.

I'm a complete noob who doesn't know the basics. But I was wondering if somebody could give me an example code for a shortcut imposer.

I would like a script so I can press a key to select a body part on a figure.

Is there somebody that can give me an example that I will really appreciate?

Thank





Win10 - AMD 2nd Gen Ryzen Threadripper 2950X, 16-Core, 32 Thread 4.4 GHz - 128GB Ram - X2 GeForce RTX 3060 Ti - 3D-connexion  

Poser 12 | Octane Render |  Real-Flow | 3DCoat | Speed Tree | Adobe Premiere  |  Adobe After Effects |  Adobe Audition |  Adobe Photoshop


FVerbaas posted Mon, 14 February 2022 at 3:55 PM Forum Coordinator

Sorry but it is not very clear to me what you want.

You want a script that selects say the left hand of the current figure?

Once a script is in the scripts folder you can assign a shortcut to it via the shortcut editor:




FVerbaas posted Mon, 14 February 2022 at 4:26 PM Forum Coordinator

for a script to call think of something like:



sc = poser.Scene()
try:
    fig = sc.CurrentFigure()
    try:
        act = fig.ActorByInternalName('rHand')
        sc.SelectActor(act)
    except:
        pass
except:
    pass


Sure it could be condensed further but with this layout I hope the proces is more clear.



Uncanny_Film posted Tue, 15 February 2022 at 12:09 PM

Sorry for not being specific. Here is a link to what I'm making. 

https://www.renderosity.com/forums/threads/2942016/is-there-a-script-a-way-to-apply-a-keyboard-key-to-move-figure-parts

And also thank you for the example.

I'm going to use the unused keys that are in Windows but are not on a standard keyboard and set them to select and control the figure.

Here's an example of how I'm going to set the keys.

Set key F13 to select the right hand Set key F14 to move Zrotate 1 Set key F15 to move Zrotate -1

Also, the F14 and F15 will be on a rotary encoder dial, not actual keys or buttons.


I hope all this makes since






Win10 - AMD 2nd Gen Ryzen Threadripper 2950X, 16-Core, 32 Thread 4.4 GHz - 128GB Ram - X2 GeForce RTX 3060 Ti - 3D-connexion  

Poser 12 | Octane Render |  Real-Flow | 3DCoat | Speed Tree | Adobe Premiere  |  Adobe After Effects |  Adobe Audition |  Adobe Photoshop


FVerbaas posted Wed, 16 February 2022 at 5:35 AM Forum Coordinator

Thank you for explaining. I see you have some excellent examples already from a previous version.

Is there anything i can still help you with?


Uncanny_Film posted Wed, 16 February 2022 at 3:34 PM

FVerbaas posted at 5:35 AM Wed, 16 February 2022 - #4434845

Thank you for explaining. I see you have some excellent examples already from a previous version.

Is there anything i can still help you with?

Yes, If I have a script for each command. Let's say 20. So in total, I will have 20 scripts and poser. Is there a way to set those scripts shortcuts quickly? Or will I have to still put in the script shortcut individually? One by one.




Win10 - AMD 2nd Gen Ryzen Threadripper 2950X, 16-Core, 32 Thread 4.4 GHz - 128GB Ram - X2 GeForce RTX 3060 Ti - 3D-connexion  

Poser 12 | Octane Render |  Real-Flow | 3DCoat | Speed Tree | Adobe Premiere  |  Adobe After Effects |  Adobe Audition |  Adobe Photoshop


FVerbaas posted Wed, 16 February 2022 at 4:10 PM Forum Coordinator

The links may be in some file somewhere and you may be able to hack it but I think it will be hard to beat double-clicking the line and making the shortcut combination in the editor.


Uncanny_Film posted Mon, 21 February 2022 at 4:12 PM

FVerbaas posted at 4:10 PM Wed, 16 February 2022 - #4434868

The links may be in some file somewhere and you may be able to hack it but I think it will be hard to beat double-clicking the line and making the shortcut combination in the editor.

Okay yeah that sounds the best

Also, I'm having trouble understanding this previous Script example I was given. Like I told you before I'm a noob at this. So with this code that I was given can you rewrite it so I can understand it better.
As in giving me an example of moving the current select item on the yRotate 1 point.
Thanks.




Win10 - AMD 2nd Gen Ryzen Threadripper 2950X, 16-Core, 32 Thread 4.4 GHz - 128GB Ram - X2 GeForce RTX 3060 Ti - 3D-connexion  

Poser 12 | Octane Render |  Real-Flow | 3DCoat | Speed Tree | Adobe Premiere  |  Adobe After Effects |  Adobe Audition |  Adobe Photoshop


FVerbaas posted Fri, 25 February 2022 at 12:37 PM Forum Coordinator

You may want to try the below. 

I have set the increment to 15 degrees: (par.SetValue(val+15.0) so you see more easily the effect. Trust you can change this to your liking.
note this approach does not respect limits.

sc = poser.Scene()
try:
    act = sc.CurrentActor()
    try:
        par = act.Parameter('yRotate')
        try:
            val = par.Value()
            par.SetValue(val+15.0)
            sc.DrawAll()
        except:
            pass           
    except:
        pass
except:
    pass





Uncanny_Film posted Tue, 15 March 2022 at 1:29 PM

FVerbaas posted at 12:37 PM Fri, 25 February 2022 - #4435143

You may want to try the below. 

I have set the increment to 15 degrees: (par.SetValue(val+15.0) so you see more easily the effect. Trust you can change this to your liking.
note this approach does not respect limits.

sc = poser.Scene()
try:
    act = sc.CurrentActor()
    try:
        par = act.Parameter('yRotate')
        try:
            val = par.Value()
            par.SetValue(val+15.0)
            sc.DrawAll()
        except:
            pass           
    except:
        pass
except:
    pass




Thank you. this is perfect.

Is there a document with all the python script command that poser uses?






Win10 - AMD 2nd Gen Ryzen Threadripper 2950X, 16-Core, 32 Thread 4.4 GHz - 128GB Ram - X2 GeForce RTX 3060 Ti - 3D-connexion  

Poser 12 | Octane Render |  Real-Flow | 3DCoat | Speed Tree | Adobe Premiere  |  Adobe After Effects |  Adobe Audition |  Adobe Photoshop