Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2024 Dec 02 3:16 pm)
Post any questions/problems to this forum and I for one will try and help. Recommend www.python.org for tutorials and background information. For books I personally like "The Quick Python Book" by Harms and McDonald and if you want to do gui's then you have to have "Python and Tkinter Programming" by Grayson. Would heartily recommend downloading Python 2.0 or 1.5.2 and have it able to separately so that you can tutorials and learning and gui debugging. There are also a couple of freeware editors out there that recognize the special needs of Python. Check out http://www.scintilla.org Also check out http://www.coriolis.com/store/product.asp?sku=1418 as there will be a book coming out soon that should have a good Poser-Python tutorial in it ( at least it will if I can finish it in time :-)) ) As for leads check out the "Inventory" script under the "Material Mods" tab on the Python Scripts dialog supplied with the propack. FYI, tabs are significant in Python: C/C++: for( i=0 ; i < 20; i=i+1) { do something } Python for i in range(20) do something
Sounds like a good idea. I've been looking over the instruction set available and theres a script I want to write right off the bat. Basically, in the script, all figures in the world are rendered as low detailed poly/boxes until you select one. Then its render mode is set to high detail. This way only the figure you're focused on needs to be textured and high detail while editing increasing machine speed. I always wished Poser had that ability and apparently you can set on screen render attributes for seperate actors.
The two books I've found to be most useful so far are: Learning Python - Mark Lutz and David Ascher Programming Python - Mark Lutz Both are published by O'Reilly and are available at their website. I think you can also get them through Amazon.com. I'd also suggest getting a copy of WinPython. It's a pretty good learning tool. Be warned though TkInter doesn't work correctly when called from WinPython.
OK, wading through molasses here. This is a sketchy first shot. No it does not work but I have to start somewhere :) #------------------------------- Start by importing what I assume is a bunch of prewritten goodies that may prove useful #------------------------------- import poser #------------------------------- I need to define that I'm working on the currently selected figure #-------------------------------- scene = poser.Scene() actor = scene.CurrentActor() figure = actor.ItsFigure() #------------------------------ Now to go through the materials list and change the values. RGB is allowed to have value from zero to one so I'm guessing that one must be white #------------------------------ materials = figure.Materials() ________for material in materials: ________set the material.DiffuseColor (1, 1, 1) #------------------------------ Redraw the scene #------------------------------ scene.DrawAll() #------------------------------ OK I know that syntax is out of the window but am I going in the right direction?
I don't have the PPP yet - would it be possible to set a script that took user input, so you could set ALL of a figures colors to whatever you wanted; i.e. Set the main parts one color, highlights another, reflective another, and ambient colors to a fourth color, input by the user? Would that even be useful?
I'm trying to get that modification to work now. Unfortunately this has a bug somewhere that I can not see:-
R = input("Red 0 = dark, 1 = light" )
G = input("Green 0 = dark, 1 = light" )
B = input("Blue 0 = dark, 1 = light ")
materials = figure.Materials()
for material in materials:
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.
I did some basic programming way way back when a window was a hole in the wall you looked through. I can even remember adding holes to punched paper tape to try and make corrections. With the advent of the PC I went on to other things, mainly graphics, and let the programming slide. I've always wanted to get back into it and Python scripting within PPP looks like a good way to do it. My guess is that there are others out there who also would like a stab at it. Hopefully we can learn together.
I am going to try and write a script (is that the right word?) to make Poser set all of a model's object materials to white and the highlight, ambient and reflective materials to black. I regularly have to do this manually so I guess it would be a useful thing to do.
As I type this I do not know where to start. I'm at ground zero. I'm heading for the Python tutorials. If you know the answer, don't tell me.... but please lead me. Kinda like the detective novel, don't tell me who did it just point out the clues :)