Fri, Nov 8, 5:47 AM CST

Renderosity Forums / Poser - OFFICIAL



Welcome to the Poser - OFFICIAL Forum

Forum Coordinators: RedPhantom

Poser - OFFICIAL F.A.Q (Last Updated: 2024 Nov 08 12:39 am)



Subject: Python driving me mad...


troberg ( ) posted Sat, 24 November 2001 at 2:39 AM ยท edited Fri, 08 November 2024 at 5:29 AM

I have a small problem with a python script. See the enclosed snippet below: scene.SetCurrentCamera(Front) scene.Render() fileName = app.path + "f.bmp" scene.SaveImage('bmp', fileName) scene.SetCurrentCamera(Back) scene.Render() fileName = app.path + "b.bmp" scene.SetCurrentCamera(Front) It works fine, except for the SetCurrentCamera statements. I need to do a lot of these renders, and the script would save me days of work. Any ideas? /Troberg


leather-guy ( ) posted Sat, 24 November 2001 at 3:52 AM

I'd have no suggestions except one; in the margin under "topic forums", there's a link to the "Poser python scripting" forum - post you're question there & it might get a quicker response. (I've no idea how active that forum is, but it seems a good bet) Good luck with your problem.


troberg ( ) posted Sat, 24 November 2001 at 7:13 AM

Sorry, didn't see that. I'll hit myself repeatedly with a blunt object. /Troberg


FuriousGeorge ( ) posted Sat, 24 November 2001 at 12:53 PM

I'm a software developer by trade... but I haven't really played around with PPP's Python implementation... thanks for giving me an excuse. You need to reference the camera by a name Poser understands (the documentation is very sketchy). I chose to reference it by it's external name... so as an example... Replace "scene.SetCurrentCamera(Front)" with "scene.SetCurrentCamera(scene.Actor("Front Camera"))" (Ignoring the outer "s) Hope this helps. , fgeorge


troberg ( ) posted Sat, 24 November 2001 at 11:22 PM

Thanks, I'll try. I'm also a professional programmer (been programming for 17 years), but this is my first try at python, so I'm still a bit unsure about the syntax. /Troberg


lourdes ( ) posted Sun, 25 November 2001 at 3:45 AM

Didn't test this out but could you not use loop? Cameras = Scene.Cameras() For Camera in Cameras() Scene.SetCurrentCamera(Camera) For checking valid camera name maybe assign the valid cameras to a different array for checking? CameraList = ['Main', 'Back'....etc,] Then add IF statement if(Camera in CameraList): Scene.Render() Lourdes


troberg ( ) posted Sun, 25 November 2001 at 10:10 AM

Thanks fgeorge, it worked. I suggested that it was something like that, but I was in a big hurry and the documentation and samples really suck. You saved me a lot of hard work. I have more than 1000 renders to do, and without the script that would have taken me a week or two. No I ran it during one day, completely automatic. Lourdes, I probably can do it like that, but right now, it is not what I need. I'd also like to keep it as simple as possible, since this is my first try at python (in any form) and I don't have time to get bogged down on syntax details right now. It would be very helpful if it was possible to record macros which could then be edited and adapted, much like it works in Office or UltraEdit. It would reduce much of the hassle and lower the threshold for starters in python. If it were up to me, they would've used VBA instead. It is cheap and easy to include (I've done it in my software to make it user extensible) and it is widely known and easy to learn, while still being powerful and object oriented. Some documentation of the poser object model would be nice. Perhaps a project for someone with spare time and nothing to do? /Troberg


FuriousGeorge ( ) posted Sun, 25 November 2001 at 3:28 PM

You're very welcome... I agree with your comments about a macro recorder, that's really all you needed for your "script". This was really my first stab at Python too, but it was a nice little learning experience. Now I'll probably be more inclined to write up little python scriptlets to do my repetitive tasks. And you are right... the documentation was horrible (or else you would have never had the problem you did in the first place... you were doing exactly what the example showed). , fgeorge


troberg ( ) posted Sun, 25 November 2001 at 11:13 PM

Actually, a macro recorder wouldn't have been enough on its own, this is just a small snippet from a larger script. It would have made an easy start, though. It would definitely make it easier for non-progammers (those horrible people known as users) to use. /Troberg


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.