Collada: fix broken export of transforms (and adds new bake transforms option) #34062

Closed
opened 2013-01-30 22:37:14 +01:00 by Daniel Balster · 10 comments

%%%This patch fixes the COLLADA export of blender (svn rev ~54214) where each node has redundant/broken transforms:

    <node ...>
      <matrix sid="transform">...</matrix>
      <rotate sid="rotationZ">...</rotate>
      <rotate sid="rotationY">...</rotate>
      <rotate sid="rotationX">...</rotate>
      <scale sid="scale">...</scale>
      <translate sid="location">...</translate>
    </node>

If "transform" is already present, rot/scale/translate are not necessary. Additionally, it should be translate -> rotate -> scale to get the correct results.

This patch adds a new option "bake transforms" (default off) that lets you export all transforms as a single matrix, if set. If unset, you get the old behavior (translate, rotate, scale).

Verification:

  • just export the default blender scene (cube,camera,light) as COLLADA with default options. Open the resulting untitled.dae file and search for
    <node id="Cube" name="Cube" type="NODE">
      <translate sid="location">0 0 0</translate>
      <rotate sid="rotationZ">0 0 1 0</rotate>
      <rotate sid="rotationY">0 1 0 0</rotate>
      <rotate sid="rotationX">1 0 0 0</rotate>
      <scale sid="scale">1 1 1</scale>
  • now export with "bake transforms" checked and you'll get
    <node id="Cube" name="Cube" type="NODE">
      <matrix sid="transform">1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1</matrix>

%%%

%%%This patch fixes the COLLADA export of blender (svn rev ~54214) where each node has redundant/broken transforms: ``` <node ...> <matrix sid="transform">...</matrix> <rotate sid="rotationZ">...</rotate> <rotate sid="rotationY">...</rotate> <rotate sid="rotationX">...</rotate> <scale sid="scale">...</scale> <translate sid="location">...</translate> </node> ``` If "transform" is already present, rot/scale/translate are not necessary. Additionally, it should be translate -> rotate -> scale to get the correct results. This patch adds a new option "bake transforms" (default off) that lets you export all transforms as a single matrix, if set. If unset, you get the old behavior (translate, rotate, scale). Verification: - just export the default blender scene (cube,camera,light) as COLLADA with default options. Open the resulting untitled.dae file and search for ``` <node id="Cube" name="Cube" type="NODE"> <translate sid="location">0 0 0</translate> <rotate sid="rotationZ">0 0 1 0</rotate> <rotate sid="rotationY">0 1 0 0</rotate> <rotate sid="rotationX">1 0 0 0</rotate> <scale sid="scale">1 1 1</scale> ``` - now export with "bake transforms" checked and you'll get ``` <node id="Cube" name="Cube" type="NODE"> <matrix sid="transform">1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1</matrix> ``` %%%
Author

Changed status to: 'Open'

Changed status to: 'Open'
Member

%%%I have fixed the duplicate transforms by removing the trans/rot/scale version, see revision 54477.

I am not sure if we should add an option for "bake transforms"
Can you give an example where that would be needed ?%%%

%%%I have fixed the duplicate transforms by removing the trans/rot/scale version, see revision 54477. I am not sure if we should add an option for "bake transforms" Can you give an example where that would be needed ?%%%
Author

%%%I'd prefer explicitly named transforms like 0 0 1 0 instead of a baked matrix. COLLADA is a verbose exchange format, allowing the user to spot and find each bit she's interested in. This is why I proposed an option for this - I'm very happy with rot/loc/scale, but if others want matrices they have an option now.

Animations can also target these named transforms, I'm not sure if baking would break this system.%%%

%%%I'd prefer explicitly named transforms like <rotate sid="rotationZ">0 0 1 0</rotate> instead of a baked matrix. COLLADA is a verbose exchange format, allowing the user to spot and find each bit she's interested in. This is why I proposed an option for this - I'm very happy with rot/loc/scale, but if others want matrices they have an option now. Animations can also target these named transforms, I'm not sure if baking would break this system.%%%
Member

Closed as duplicate of #43298

Closed as duplicate of #43298

Changed status from 'Duplicate' to: 'Open'

Changed status from 'Duplicate' to: 'Open'
Member

Changed status from 'Open' to: 'Resolved'

Changed status from 'Open' to: 'Resolved'
Member

@dbalster The Blender 2.80 exporter now has 2 options for exporting transforms either as "Matrix" or as "Decomposed". The restrictions from older Blender releases no longer apply.

I believe the feature makes this patch obsolete. Please tell me if you do not agree. Then we can reopen this task.

cheers,
Gaia

@dbalster The Blender 2.80 exporter now has 2 options for exporting transforms either as "Matrix" or as "Decomposed". The restrictions from older Blender releases no longer apply. I believe the feature makes this patch obsolete. Please tell me if you do not agree. Then we can reopen this task. cheers, Gaia

Added subscriber: @Mick-P-2

Added subscriber: @Mick-P-2

For the record, if matrix and the others are present, then both should be applied by the COLLADA software. It's not a multi-representational option in other words. Second, regarding:

Additionally, it should be translate -> rotate -> scale to get the correct results.

I don't know how Blender's transforms work, but traditionally translation is the last step. When you multiply a vector with a matrix the final column (or row) does translation, and it's simply to add its value to the vector.

For the record, if matrix and the others are present, then both should be applied by the COLLADA software. It's not a multi-representational option in other words. Second, regarding: > Additionally, it should be translate -> rotate -> scale to get the correct results. I don't know how Blender's transforms work, but traditionally translation is the last step. When you multiply a vector with a matrix the final column (or row) does translation, and it's simply to add its value to the vector.

This issue was referenced by 820e4d4303

This issue was referenced by 820e4d4303906020136b9a81ee0e878caee1f199
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
6 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#34062
No description provided.