I'm trying to write a simple exporter script to do an FBX export with all the settings I want already selected, for convenience. Reviewing the API on export_scene.fbx, I don't see a parameter matching the "Transform -> Apply Scalings" option in the regular export UI (as in the image below). Is this something that's absent from the documentation, or is there no way currently to assign this from script? Thanks!

enter image description here


I'm not sure because I'm pretty new to blender scripting but it appears to me that dropdown in question is not selecting parameters for the fbx export function, it's just applying a transformation to the objects that it's exporting using the regular mechanism for applying a transformation. That is: it's scaling by a factor, applying the transformation, running the fbx export, then scaling by the inverse factor to undo the first scaling, then applying the transformation again. So in my script, I'm basically doing the same thing.

What I'm doing that seems to be working for me is scaling by some constant factor (100 in my case):

obj.scale = (100, 100, 100)

Then applying the scaling:

bpy.ops.object.transform_apply(location=False, rotation=False, scale=True, properties=False)

Then exporting with the global_scale set to the inverse of my scaling factor:

    filepath=fname + ".fbx",

and finally setting and applying the opposite scaling factor after running the export:

obj.scale = (0.01, 0.01, 0.01)
bpy.ops.object.transform_apply(location=False, rotation=False, scale=True, properties=False)

this may be a very whacky and roundabout way of doing it, but it seems to be working for me and sets my object back to how it was before I ran my script.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.