Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 pm)
Y-Phil posted at 4:39 AM Thu, 21 July 2022 - #4441630
I tried it with a fresh started P12 (Trial). Opened a Python Terminal and typed in:Did you add key frames to your character?
poser.Scene().SetFrame(10)
Poser updated the framecounter as expected.
How do you try to change the current figure?
FYI:
fig = poser.Scene().CurrentFigure()
actor = fig.Actor("Chest")
geom = actor.Geometry()
geom.Vertices() (the base mesh) stays the same in every frame. It doesn't change. What changes is geom.WorldVertices(). It reflects what morphs, weightmaps etc did to modify the base mesh. But it makes no sense to change these values frame by frame. Better use morphs and activate/deactivate or set value to these morphs the way you need them at certain frames.
Example:
Assumed you have a figure with a morph called "Breath". To get a handle to that morph, do this:
figure = poser.Scene().CurrentFigure()
breath_morph = figure.Parameter("Breath")
Say you want to start with Breath == 0 at frame == 0 and a full breath (value=1) every 10 seconds. We further assume your scene goes with 25 frames per second. So, we have a full breath at 10 Seconds * 25 Frames == Frame 250, 500, 750, 1000, etc.
full = True
for frame in range(0, poser.Scene().NumFrames(), 125):
breath_morph.SetValue(int(full))
full = not full
That's all it needs. Poser does the rest, interpolating all the steps in between.
To set a scene length that makes sense with those values, do something like:
poser.Scene().SetNumFrames(1000)
Thank you for your response!
Thank you for your kindness.
I'm setting a keyframe.
Then select body parts (eg chest) for each frame and
I'm trying to select that vertex coordinate and edit the chest area as I like.
First I tried it with a simple script.(The chest is greatly deformed for easy understanding)
However, even if I edit only the 6th frame as shown below, all the frames will be edited in the same way when I look at Poser.
In this case, I want to edit only a specific frame (6th).
I haven't been able to edit frame by frame.
Is this a failed frame selection?
Or is it not possible to select and edit vertices for each frame?
Sorry for the lack of understanding of Poser.
---------------------------------------------------------------------------------------------------------------------------------------------------
import poser
import time
import os
x_axis = 0
y_axis = 1
z_axis = 2
scene = poser.Scene()
for test_num in range( 0, 6):
actors = scene.CurrentFigure()
scene.SetFrame(test_num)
actor = scene.Actor("Chest")
actGeom = actor.Geometry()
#verts = actGeom.Vertices()
verts = actGeom.WorldVertices()
vert_num = actGeom.NumVertices()
vert_list = [[0 for k in range(3) ] for j in range(vert_num)]
#x,y,z vertices
list_num = 0
while list_num < vert_num:
vert = actGeom.Vertices()[list_num]
Vx = vert.X()
Vy = vert.Y()
Vz = vert.Z()
vert_list[list_num][x_axis] = Vx
vert_list[list_num][y_axis] = Vy
vert_list[list_num][z_axis] = Vz
list_num = list_num + 1
j = 0
while j < vert_num:
if test_num == 5:
set_z.SetZ(vert_list[j][z_axis] - 0.5)
---------------------------------------------------------------------------------------------------------------------------------------------------
Thank you.
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.
Hi.
I want to select a frame of a moving model (animation) and edit the model.
(For example, I want to give the model a walking animation and do something that makes the breathing rougher every frame)
It takes time to manually edit the model frame by frame.
Therefore, I want to automate it with a Python script.
1. Select the first frame
2. Select a chest
3. Edit the shape of the chest
4. Select the second frame
5. Select a chest
6. Select the shape of the chest
・・・repert
I want to know if the script can recognize the model frame by frame and edit the image.
scene.SetFrame(frame_num)
actors = scene.Actors()
actor = scene.Actor("Chest")
・・・
I repeated the following script and edited the model frame by frame but it didn't work.
The edited content given in the first frame was reflected in all frames.
If you know the right way, please let me know.
Thank you.