Skip to content

Blender exporter option to remove global transforms #5841

@Densaugeo

Description

@Densaugeo

The Blender exporter automatically bakes global transforms into meshes, but sometimes I need to export models without applying their global transform. Mostly, this is for exporting several separate models from the same Blender project.

Right now this can be done by commenting out lines 1,617 and 1,618 in export_threejs.py:

def extract_meshes(objects, scene, export_single_model, option_scale, flipyz):

    # Other stuff...

            if export_single_model:

                if flipyz:

                    # that's what Blender's native export_obj.py does to flip YZ

                    X_ROT = mathutils.Matrix.Rotation(-math.pi/2, 4, 'X')
                    mesh.transform(X_ROT * object.matrix_world)

                # When these next two lines are commented out, global transform is not applied:
                # else:
                    # mesh.transform(object.matrix_world)

            # More other stuff...

    return meshes

I'd like to have this as an option in the export script (similar to the 'flipyz' option). Is this something other people would use, and is it likely to affect other stuff? (The exporter handles a lot of bones and animations and stuff I don't know anything about).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions