Mon, Oct 21, 10:25 PM CDT

Renderosity Forums / Poser - OFFICIAL



Welcome to the Poser - OFFICIAL Forum

Forum Coordinators: RedPhantom

Poser - OFFICIAL F.A.Q (Last Updated: 2024 Oct 21 9:06 pm)



Subject: Animating Using Python


Enivob ( ) posted Thu, 10 June 2004 at 12:40 PM ยท edited Mon, 21 October 2024 at 10:24 PM

Hi All, I am an experienced scripter in MaxScript and MEL and now i am dabbling in Python. I know what I want to do. I have the DAZ african elephant and I want to build a walk designer for this quadraped. My first attempt is simply to translate the hip in the Z direction. So I want to record Z tran keys incrementing over time. I have some code here, that does not work. # My attempt to try to use python to animate a quadraped. scene = poser.Scene() theFigure = scene.Figure("Figure 1") theHip = theFigure.Actor("Hip") theAnimationSet = scene.CreateAnimSet("Animate Elephant") theAnimationSet.AddObjectRange(theHip,0,90) # Animate the hip forward. I thought you may have to add keys before you set them? AddKeyFrame(0) AddKeyFrame(14) AddKeyFrame(29) AddKeyFrame(44) AddKeyFrame(59) scene.SetFrame(0) theHip.SetParameter(poser.kParmCodeZTRAN, 0.0) scene.SetFrame(14) theHip.SetParameter(poser.kParmCodeZTRAN, 0.4) scene.SetFrame(29) theHip.SetParameter(poser.kParmCodeZTRAN, 0.8) scene.SetFrame(44) theHip.SetParameter(poser.kParmCodeZTRAN, 1.2) scene.SetFrame(59) theHip.SetParameter(poser.kParmCodeZTRAN, 1.6) # Redraw the scene scene.DrawAll() I'm wondering what I am doing wrong, am I close? The documentation is sketchy at best. Any reply is apreciated. Thanks! Enivob


stewer ( ) posted Thu, 10 June 2004 at 1:01 PM

Try this:

scene = poser.Scene()<br></br>theFigure = scene.Figure("Figure 1")<br></br>theHip = theFigure.Actor("Hip")<br></br>theAnimationSet = scene.CreateAnimSet("Animate Elephant")<br></br>theAnimationSet.AddObjectRange(theHip,0,90)<br></br><br></br>scene.SetFrame(0)<br></br>theHip.ParameterByCode(poser.kParmCodeZTRAN).SetValue(0.0)<br></br>theHip.AddKeyFrame()<br></br>scene.SetFrame(14)<br></br>theHip.ParameterByCode(poser.kParmCodeZTRAN).SetValue(0.4)<br></br>theHip.AddKeyFrame()<br></br>scene.SetFrame(29)<br></br>theHip.ParameterByCode(poser.kParmCodeZTRAN).SetValue(0.8)<br></br>theHip.AddKeyFrame()<br></br>scene.SetFrame(44)<br></br>theHip.ParameterByCode(poser.kParmCodeZTRAN).SetValue(1.2)<br></br>theHip.AddKeyFrame()<br></br>scene.SetFrame(59)<br></br>theHip.ParameterByCode(poser.kParmCodeZTRAN).SetValue(1.6)<br></br>theHip.AddKeyFrame()<br></br><br></br># Redraw the scene<br></br>scene.DrawAll()


saxon ( ) posted Thu, 10 June 2004 at 1:07 PM

Sounds intriguing, a walk designer designed for quadrupeds. I wish you every success. Please keep us informed...


stewer ( ) posted Thu, 10 June 2004 at 1:11 PM

oh, and one more thing: Try to use the "internal" names of the actors in your script, that'll make your scripts compatible with localized versions of Poser. In this case, you'd replace

theHip = theFigure.Actor("Hip")

with theHip = theFigure.ActorByInternalName("hip")

You can find the internal names of the actors in P5 in the right tab of the Parm dial palette.


PhilC ( ) posted Thu, 10 June 2004 at 6:45 PM

who3D has an African Elephant walk cycle in the freestuff you may want to see for reference. I'm interested to see how you'd do it using python. I wonder if it could be easily adapted to other quadrupeds?

philc_agatha_white_on_black.jpg


Soulpainter ( ) posted Thu, 10 June 2004 at 7:17 PM

seems it would work with any quadraped that had the joints named the same.


scourge ( ) posted Thu, 10 June 2004 at 7:26 PM ยท edited Thu, 10 June 2004 at 7:29 PM

Attached Link: http://www.renderosity.com/messages.ez?Form.ShowMessage=1719246

I have done something similar with Python, a couple of scripts that make a figure follow a target (see the attached thread, at first it was about snooker dynamics but turned out people were more interested in the follow script). It works for almost any kind of characters and moving animations (walking, smimming, flying, crawling). The project is still a WIP (that's why the currently available working versions aren't too well written and there are no code comments). Edit: You may want to ignore posts 1-50 in that thread.

Message edited on: 06/10/2004 19:29


Enivob ( ) posted Thu, 10 June 2004 at 9:56 PM

Stewer, I tried your code, but I get an error. Traceback (innermost last): File "", line 9, in ? AttributeError: AddKeyFrame I'm using Poser 4, if that matters. Any clues on why the code can not add a key frame? Scourge, I did pull down the scripts from that thread. I was not sure how I could make use of it, correct me if I'm wrong, but it looks like the script requires a walk cycle to be already in existance before you begin? I quickly scanned the code looking for syntax on how to add keys and could not find any. I'm not sure how the script is making the figure walk, care to rough outline it here? Thanks All Enivob Thanks


stewer ( ) posted Fri, 11 June 2004 at 2:42 AM

Ah, I see. I'm using Poser 5, and I had to change your AddKeyFrame(n) to theHip.AddKeyFrame(). I don't have P4 here to test it there, unfortunately, but try changing these AddKeyFrame lines back to as they were, maybe that helps.


scourge ( ) posted Fri, 11 June 2004 at 4:42 AM

Okay, I posted here a little too hasty. Yes, my scripts need an existing animation pose file to work. Sorry 'bout that.


who3d ( ) posted Fri, 11 June 2004 at 8:02 AM

The current bipedal walk designer actually works, sortof, for quadrupedal animals. I've got a lot of work to do yet to discover why some animals work well (e.g. the DAZ elephants) and others work really badly (the Bengal Tiger, for example) but provided everything in the model is designed & named appropriately it's surprising (IMHO) how well the Poser walk designer works with quadrupeds. Youi DO however have to design a 30-second animation to save in the "Walk Designer" pose folder to get the quadruped walk to show up in the WD itself - but from there on in it "just works" (for me, so far). I imagine that an elephant walk will be suitable for a number of quadrupeds, but most other animals have more than 1 walking style (for different speeds at least). Cheers, Cliff


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.