When exporting models, global transformation matrix is automatically applied, with no option to change it. #75903

Open
opened 2020-04-19 19:17:04 +02:00 by Gabe Ambrosio · 3 comments

System Information
Operating system: Windows-10-10.0.18362 64 Bits
Graphics card: GeForce RTX 2080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 436.02

Blender Version
Broken: version: 2.81 (sub 16), branch: master, commit date: 2019-12-04 11:32, hash: blender/blender@f1aa4d18d4
Worked: (optional)

Addon Information
Name: Wavefront OBJ format (3, 7, 0)
Author: Campbell Barton, Bastien Montagne

Short description of error
When you export a .obj file using this plugin, the vertices are exported in world coordinates instead of local coordinates, which causes issues when importing into other applications. There is no option to change this, so it is the only way you can export any models.

Exact steps for others to reproduce the error
Simply move a cube to any location other than the origin, then export as .obj with all the default settings. The cubes exported file contains vertex information that is in world coordinates instead of local coordinates. I have added an option in my local version of this file, but I think you should add it to the actual program.

In init.py line 313 I added

layout.prop(operator, 'use_local_object_coordinates')

and at line 354 I added

    use_local_object_coordinates: BoolProperty(
            name="Use Local Object Transform",
            description="Use the objects local space, instead of global space when exporting the OBJ",
            default = True
    )

Then in export_obj.py I added the options in the export functions called:

use_local_object_coordinates=True
EXPORT_USE_LOCAL_OBJECT_SPACE=use_local_object_coordinates

Then, I added a simple if statement around the global transformation application around line 365:

                        #me.transform(EXPORT_GLOBAL_MATRIX @ mat)
                        if EXPORT_USE_LOCAL_OBJECT_SPACE:
                            me.transform(EXPORT_GLOBAL_MATRIX)
                        else:
                            me.transform(EXPORT_GLOBAL_MATRIX @ mat)

Please consider adding this option to the plugin, I have laid out all the necessary steps, albeit I may have missed some, but it's not that complicated and will hopefully help future developers from being misled about the contents of their exported OBJ files.

**System Information** Operating system: Windows-10-10.0.18362 64 Bits Graphics card: GeForce RTX 2080/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 436.02 **Blender Version** Broken: version: 2.81 (sub 16), branch: master, commit date: 2019-12-04 11:32, hash: `blender/blender@f1aa4d18d4` Worked: (optional) **Addon Information** Name: Wavefront OBJ format (3, 7, 0) Author: Campbell Barton, Bastien Montagne **Short description of error** When you export a .obj file using this plugin, the vertices are exported in world coordinates instead of local coordinates, which causes issues when importing into other applications. There is no option to change this, so it is the only way you can export any models. **Exact steps for others to reproduce the error** Simply move a cube to any location other than the origin, then export as .obj with all the default settings. The cubes exported file contains vertex information that is in world coordinates instead of local coordinates. I have added an option in my local version of this file, but I think you should add it to the actual program. In init.py line 313 I added ``` layout.prop(operator, 'use_local_object_coordinates') ``` and at line 354 I added ``` use_local_object_coordinates: BoolProperty( name="Use Local Object Transform", description="Use the objects local space, instead of global space when exporting the OBJ", default = True ) ``` Then in export_obj.py I added the options in the export functions called: ``` use_local_object_coordinates=True EXPORT_USE_LOCAL_OBJECT_SPACE=use_local_object_coordinates ``` Then, I added a simple if statement around the global transformation application around line 365: ``` #me.transform(EXPORT_GLOBAL_MATRIX @ mat) if EXPORT_USE_LOCAL_OBJECT_SPACE: me.transform(EXPORT_GLOBAL_MATRIX) else: me.transform(EXPORT_GLOBAL_MATRIX @ mat) ``` Please consider adding this option to the plugin, I have laid out all the necessary steps, albeit I may have missed some, but it's not that complicated and will hopefully help future developers from being misled about the contents of their exported OBJ files.
Author

Added subscriber: @ambrosiogabe

Added subscriber: @ambrosiogabe
Member

Added subscriber: @ankitm

Added subscriber: @ankitm
Member

I have added an option in my local version of this file, but I think you should add it to the actual program.

If that is working correctly, you may submit a patch at https://developer.blender.org/differential/diff/create/. Also read the links given at the top for guidance.

> I have added an option in my local version of this file, but I think you should add it to the actual program. If that is working correctly, you may submit a patch at https://developer.blender.org/differential/diff/create/. Also read the links given at the top for guidance.
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#75903
No description provided.