Forum: Poser Python Scripting


Subject: OBJ Export Script Scaling

PickledPapaya opened this issue on Sep 25, 2012 ยท 8 posts


PickledPapaya posted Tue, 25 September 2012 at 4:05 PM

I was trying to put together a Python script to export the scene as an OBJ and scale it up, so that it imports into Blender in a more blenderish size.

This is my cutup of the imp/exp script in Render control. (Poser 9)

There is a code called: kExOptCodeSCALEFACTOR - Scale exported scene by this amount.

I have modified it to 1, 10, and 100 with no difference in the exported size?

Any thoughts?

#---------------------------------
# Exporting an OBJ scaled up for Blender 
# WaveFront .obj file format
#---------------------------------

#---------------------------------
# Get the scene and the Import-Export object
#---------------------------------
currentScene = poser.Scene()
imExObject = currentScene.ImExporter()


print ""
print "Setting OBJ Export Options..."
exoptions = imExObject.ExportOptions("obj", None)
#for key in exoptions.keys():
#       print key, ':', imExObject.ExportOptionString("obj", None, key), '=', exoptions[key]



#---------------------------------
#  Set some known standard OBJ Export Options...
#---------------------------------
exoptions[poser.kExOptCodeUSEINTERNALNAMES] = 0
exoptions[poser.kExOptCodeFIRSTFRAME] = 0
exoptions[poser.kExOptCodeLASTFRAME] = 29
exoptions[poser.kExOptCodeMULTIFRAME] = 0
exoptions[poser.kExOptCodeWELDSEAMS] = 1
exoptions[poser.kExOptCodeASMORPHTARGET] = 0
exoptions[poser.kExOptCodeBODYPARTNAMESINPOLYGROUPS] = 0
exoptions[poser.kExOptCodeFIGNAMESINGROUPS] = 1
exoptions[poser.kExOptCodeEXISTINGGROUPSINPOLYGROUPS] = 0
exoptions[poser.kExOptCodeSCALEFACTOR] = 100

print "Exporting in Wavefront .obj format..."
try:
        #---------------------------------
        # export it
        #---------------------------------
        imExObject.Export("obj", "File Format Wavefront", "C:TEMPyooowza.obj", exoptions)

        print "Export succeeded"

except:
        print "Export failed -- please check the file name"