Forum Moderators: Staff
Poser Python Scripting F.A.Q (Last Updated: 2025 Feb 05 6:41 am)
Hello Anthony,
I promised to get back to you sooner. Apologize for the delay.
The shortest example one I have ready at hand is this: (you will ned to set the filename correct for your system)
#---------------------------------
# Get the actor and the Import-Export object
#---------------------------------
scene = poser.Scene()
print "preparing ..."
imExObject = scene.ImExporter()
print ""
print "getting OBJ Export Options..."
imoptions = imExObject.ImportOptions("obj", None)
for key in imoptions.keys():
print key, ':', imExObject.ImportOptionString("obj", None, key), '=', imoptions[key]
print "setting options"
imoptions[7] = 1
imoptions[poser.kImOptCodeCENTERED] = 0
for key in imoptions.keys():
print key, ':', imExObject.ImportOptionString("obj", None, key), '=', imoptions[key]
try:
#---------------------------------
# import it
#---------------------------------
imExObject.Import("obj", "File Format Wavefront", "C:UsersPublicDocumentsPoserMDForMD.obj", imoptions)
print "Import succeeded"
except:
print "Import failed -- please check the file name"
further control over the import options can be through setting the full bunch of import options:
imoptions[poser.kImOptCodeMAKEPOLYNORMSCONSISTENT] = 0
imoptions[poser.kImOptCodeOFFSETX] = 0.0
imoptions[poser.kImOptCodeOFFSETY] = 0.0
imoptions[poser.kImOptCodeOFFSETZ] = 0.0
imoptions[poser.kImOptCodeFLIPUTEXTCOORDS] = 0
imoptions[poser.kImOptCodeFLIPVTEXTCOORDS] = 0
imoptions[poser.kImOptCodeWELDIDENTICALVERTS] = 1
imoptions[poser.kImOptCodeCENTERED] = 0
imoptions[poser.kImOptCodePERCENTFIGSIZE] = -1
imoptions[poser.kImOptCodeFLIPNORMS] = 0
imoptions[poser.kImOptCodePLACEONFLOOR] = 0
I hope this answers your question. One thing: In the present public version of Poser imoptions[poser.kImOptCodeWELDIDENTICALVERTS] = 1 does not work. You cannot at this moment fake welded export by unwelded export, import as a prop with the welding option, and re-export. This works under manual control but not when called from Python.
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.
How can I tell a Python script to read a geometry from an .OBJ geometry file?