Forum: Poser Python Scripting


Subject: - Poser/Python Export Method Problem !

gbdevo opened this issue on Feb 25, 2003 ยท 4 posts


gbdevo posted Tue, 25 February 2003 at 11:24 AM

Hi ,
I am using the Export/import Poser/PythonModule , and particularly the Exprot Method :
Imex.Export ( suffixfile, pluginname, filepath [ , options, sceneselectioncallback ] )
What's the semantic and syntex for the 5th parameter sceneselectioncallback ? I tried a trivial call back func, with a body part selesction in it , but it doesnt work , the objective is to export just a body part of my figure .
THANKS MUCH for some ideas or informations about this case .
Gerald B.


ockham posted Tue, 25 February 2003 at 12:35 PM

The CL sample scripts include a pretty good example. Here's a minimum script, written with help from the sample, that works. (I tested it.) # ------------------------------# import poser scene = poser.Scene() imex = scene.ImExporter() # ------------------------------# def SSCall(actor): # The callback routine ~if actor.Name() == "ball_1": ~~return 1 ~else: ~~return 0 # ------------------------------# # You have to fill in the Options argument # even if you're only using the defaults. Options = imex.ExportOptions("obj", None) # Finally the actual Export call: imex.Export("OBJ","File Format OBJ", "POOO.OBJ", Options, SSCall) # ------------------------------# The callback just returns 1 for each Actor that belongs to your selection, or 0 for each Actor you don't want. Here I have supplied a certain name, but you could do a list check instead: if actor in MySels: ~return 1 else: ~return 0 Hint: If you are using a body part, you may need to run the selection on the basis of figure.Actor() instead of scene.Actor().

My python page
My ShareCG freebies


gbdevo posted Tue, 25 February 2003 at 12:50 PM

Thanks very much ocham, i paste your reply , have not seen this sample in my python scripts . I'll go to test that . It seems logic ( parameter actor in the callback and the return value 1 or 0 on the Name of the actor )and simple , that 's very well. Gerald B.


gbdevo posted Tue, 25 February 2003 at 12:53 PM

Sorry ockham, replace ocham by ockham in the previous post ;o)). Gerald B.