tebop opened this issue on Oct 30, 2007 · 56 posts
diolma posted Sat, 03 November 2007 at 3:59 PM
Well, to help cut down on a little of that overhead, here is the entire python script to "flatten" V4's feet. :-)
Copy into a text editor, save somewhere in Poser's Python scripts (with a .py extension, not .txt)
Operates from within Poser.
I've re-jigged it slightly; it now takes less than 1 second for a 100 frame anim.
Oh, and the previw display will (probably) look distorted when the script finishes (it seems to get confused as to whether it should be showing the 1st or last frame), but move the cursor into the preview and everything is OK.
The script:
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
from Tkinter import *
import poser
scene = poser.Scene()
#-----------------------------------------------------------------------------
#------------------------------------------------------------
class App:
# - - - - - - - - - - - - - - - - - -
def init(self, master, textMessage):
self.master = master
master.title("V4 Flat-foot")
self.StatusEntry = Entry(self.master,width=50)
self.StatusEntry.grid(row=0,column=0,columnspan=2)
self.StatusEntry.insert(0,"Select the figure then click GO")
# Go/nogo buttons.
self.buttonGo = Button(self.master, text="GO", command=self.doGo)
self.buttonGo.grid(row=3, column=0)
self.buttonCancel = Button(self.master, text="Cancel", command=self.doCancel)
self.buttonCancel.grid(row=3, column=1)
self.master.protocol('WM_DELETE_WINDOW', self.doCancel)
# - - - - - - - - - - - - - - - - - -
def ShowStatus(self,S): # Just saving repetition
self.StatusEntry.delete(0,END)
self.StatusEntry.insert(0,S)
self.StatusEntry.update_idletasks()
# - - - - - - - - - - - - - - - - - -
def Update(self):
if scene: scene.ProcessSomeEvents(1)
root.lift()
root.after(100, self.Update)
# - - - - - - - - - - - - - - - - - -
def doGo(self):
# - Sanity check...
try:
Figure = scene.CurrentFigure()
LFoot = Figure.Actor( "Left Foot" )
RFoot = Figure.Actor( "Right Foot" )
except:
if not Figure:
self.ShowStatus( "No figure selected" )
else:
self.ShowStatus( "%s: One or both feet missing!" % Figure.Name() )
return
# - OK, do it.
self.ShowStatus( "Left Foot" )
self.doActor( LFoot )
self.ShowStatus( "Right Foot" )
self.doActor( RFoot )
scene.SetFrame(0)
self.master.destroy()
# - - - - - - - - - - - - - - - - - -
def doCancel(self):
self.master.destroy()
# - - - - - - - - - - - - - - - - - -
def doActor( self, Actor ):
Bend = Actor.Parameter( "Bend" )
F=0 # Init Frame number
while 1: # Forever (except we'll break out eventually)
scene.SetFrame(F)
# Deal with this frame
Bend.SetValue( Bend.Value() - 25.0 ) # 25.0 is approx V4's "Flatfoot"
F=Bend.NextKeyFrame()
if not F: break # No more - break out of the loop.
# End while 1
#------------------------------------------------------------
#------------------------------------------------------------
root = Tk()
app = App(root, '')
app.Update()
root.mainloop()
#------------------------------------------------------------
#-----------------------------------------------------------------------------
That's all there is.
My 1st ever Python script!
Cheers,
Diolma