Animation: Add in Parent space alignment option to the Transform Orientation gizmo #104724

Merged
Nate Rupsis merged 47 commits from nrupsis/blender:parent-space into main 2023-04-20 17:40:31 +02:00
Member

Overview

Transformation (translate, rotate, scale) gizmo needs Parent Orientation space for working with bones. This PR adds in "Parent Orientation" to align the transformation axes to the object's parent space.


Objective.

A desired animation workflow is to work in parent space (for a targeted bone) rather than local space. To achieve this, in pose mode you can turn off "Local Location" and the bone will work in it's parent's space. However, the orientation gizmo doesn't reflect this, and still displays in the bones local space.

Gizmo in global space (which is the parent bones orientation)
image

Deselecting "Local Location" on the child bone:
image

Transformation Gizmo displays child local, but the desire is to show parent (I.e, global in this instance)
image


This Change

This Patch adds a new "Parent Space" Orientation option for the Transformation Gizmo.

For objects:

  • with a parent, the gizmo orients to it's parents orientation
  • without a parent, the gizmo orients to Global space

For Armatures:

  • Child bone shows parent's space regardless if "Local Location" is set for parent bone
  • For root bone without "Local Location" set, use the armature objects space.
  • For root bone with "Local Location" set, use local bone space.

Object Parent Space

Armature Parent Space. Always use parent space, even if local location is set.

Thankfully, no new transformation orientation code needs to be written, we can achieve the desired results be using the existing transform_orientations_create_from_axis, ED_getTransformOrientationMatrix, and unit_m3 methods. To do this, we check to see if the bone has a parent, if so, we use the bones pose matrix (pose_mat). This is done similarly for objects using the parent's object matrix (object_to_world).


To document

  • [x ] add to the manual
  • add to the release notes

Ref:

## Overview Transformation (translate, rotate, scale) gizmo needs Parent Orientation space for working with bones. This PR adds in "Parent Orientation" to align the transformation axes to the object's parent space. --- ### Objective. A desired animation workflow is to work in parent space (for a targeted bone) rather than local space. To achieve this, in pose mode you can turn off "Local Location" and the bone will work in it's parent's space. However, the orientation gizmo doesn't reflect this, and still displays in the bones local space. Gizmo in global space (which is the parent bones orientation) ![image](https://d3a2gvihmbqfjo.cloudfront.net/f4/f4be034c005bf902cdba8455b3a347ba/f4be034c005bf902cdba8455b3a347ba.png) Deselecting "Local Location" on the child bone: ![image](https://d3a2gvihmbqfjo.cloudfront.net/93/93e22a72c5b5524f00ac7ba71299714f/93e22a72c5b5524f00ac7ba71299714f.png) Transformation Gizmo displays child local, but the desire is to show parent (I.e, global in this instance) ![image](https://d3a2gvihmbqfjo.cloudfront.net/bf/bfcee20f71f9479de404bfb155a39f11/bfcee20f71f9479de404bfb155a39f11.png) --- ### This Change This Patch adds a new "Parent Space" Orientation option for the Transformation Gizmo. For objects: * with a parent, the gizmo orients to it's parents orientation * without a parent, the gizmo orients to Global space For Armatures: * Child bone shows parent's space regardless if "Local Location" is set for parent bone * For root bone **without** "Local Location" set, use the armature objects space. * For root bone **with** "Local Location" set, use local bone space. Object Parent Space <video controls src="https://projects.blender.org/attachments/dd9512f5-761f-4456-99f1-a537930a2a7a" > </video> Armature Parent Space. Always use parent space, even if local location is set. <video controls src="https://projects.blender.org/attachments/15a90c8f-9de0-4557-b832-30fcb6ad3756" > </video> Thankfully, no new transformation orientation code needs to be written, we can achieve the desired results be using the existing `transform_orientations_create_from_axis`, `ED_getTransformOrientationMatrix`, and `unit_m3` methods. To do this, we check to see if the bone has a parent, if so, we use the bones pose matrix (`pose_mat`). This is done similarly for objects using the parent's object matrix (`object_to_world`). --- ## To document - [x ] add to the manual - [x] add to the release notes --- Ref: * [Right click Select proposal](https://blender.community/c/rightclickselect/E0Ol/?sorting=hot)
Nate Rupsis added the
Module
Animation & Rigging
label 2023-02-13 23:59:48 +01:00
Brad Clark was assigned by Nate Rupsis 2023-02-13 23:59:48 +01:00
Nate Rupsis added 3 commits 2023-02-13 23:59:50 +01:00
Author
Member

Just making a note that if this lands we need to:

  1. add it to the manual
  2. add it to the release notes?
Just making a note that if this lands we need to: 1) add it to the [manual](https://docs.blender.org/manual/en/latest/editors/3dview/controls/orientation.html?highlight=orientation) 2) add it to the release notes?
Nate Rupsis added 1 commit 2023-02-16 00:08:29 +01:00
Nate Rupsis changed title from WIP: Add in Parent space alignment to option to the gimble to WIP: Add in Parent space alignment to option to the gizmo 2023-02-16 00:08:35 +01:00
Nate Rupsis added 1 commit 2023-02-16 06:34:05 +01:00
Author
Member

Another question I have. I feel like this warrants a new icon?

Another question I have. I feel like this warrants a new icon?
Nate Rupsis added 6 commits 2023-02-16 22:04:34 +01:00
Nate Rupsis added 1 commit 2023-02-17 22:55:36 +01:00
Nate Rupsis added 1 commit 2023-02-20 19:52:36 +01:00
Nate Rupsis added 1 commit 2023-02-20 19:53:40 +01:00
buildbot/vexp-code-patch-coordinator Build done. Details
a8c43a7e24
Merge branch 'main' into parent-space
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR104724) when ready.
Nate Rupsis added 3 commits 2023-02-23 17:39:47 +01:00
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR104724) when ready.
Nate Rupsis changed title from WIP: Add in Parent space alignment to option to the gizmo to WIP: Animation: Add in Parent space alignment to option to the gizmo 2023-03-14 20:53:03 +01:00
Nate Rupsis added 5 commits 2023-03-22 22:58:10 +01:00
Nate Rupsis changed title from WIP: Animation: Add in Parent space alignment to option to the gizmo to Animation: Add in Parent space alignment option to the Transform Orientation gizmo 2023-03-22 23:49:46 +01:00
Nate Rupsis added this to the Animation & Rigging project 2023-03-22 23:49:56 +01:00
Nate Rupsis requested review from Sybren A. Stüvel 2023-03-22 23:50:11 +01:00
Nate Rupsis requested review from Brad Clark 2023-03-22 23:50:12 +01:00
Nate Rupsis added 1 commit 2023-03-22 23:52:48 +01:00
buildbot/vexp-code-patch-coordinator Build done. Details
2b2738b392
comment cleanup
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR104724) when ready.
Nate Rupsis added 1 commit 2023-03-22 23:54:48 +01:00
Nate Rupsis added 1 commit 2023-03-24 03:19:56 +01:00
buildbot/vexp-code-patch-coordinator Build done. Details
624550d7d8
need to use parent pose matrix, instead of armature_mat
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR104724) when ready.
Sybren A. Stüvel approved these changes 2023-03-24 16:01:55 +01:00
Sybren A. Stüvel left a comment
Member

Nice patch, cleaner than I would have expected from messing around with the transform system ;-)

Just two minor nags, no need to re-review after addressing them.

For my review I just looked at the code. Well, of course I also tried it out and it seems to do the right thing to me (it's now instantly one of my favourite transform orientations), but I'll leave the final judgement to an actual animator!

Nice patch, cleaner than I would have expected from messing around with the transform system ;-) Just two minor nags, no need to re-review after addressing them. For my review I just looked at the code. Well, of course I also tried it out and it seems to do the right thing to me (it's now instantly one of my favourite transform orientations), but I'll leave the final judgement to an actual animator!
.gitignore Outdated
@ -13,1 +13,4 @@
# CLion cmake folders
cmake-*

Changes to this file should be in a separate PR, if necessary at all. It's likely enough to put this one in .git/info/exclude instead -- that way it doesn't get accidentally committed.

Changes to this file should be in a separate PR, if necessary at all. It's likely enough to put this one in `.git/info/exclude` instead -- that way it doesn't get accidentally committed.
nrupsis marked this conversation as resolved
@ -622,3 +675,3 @@
if (ob->mode & OB_MODE_POSE) {
/* Each bone moves on its own local axis, but to avoid confusion,
* use the active pones axis for display #33575, this works as expected on a single
* use the active bone's axis for display #33575, this works as expected on a single

No need to put this fix into this PR, if you want, please commit that directly to main.

No need to put this fix into this PR, if you want, please commit that directly to `main`.
Author
Member

I tried to, but it kept asking for my credentials, and I'd get a 403...

I tried to, but it kept asking for my credentials, and I'd get a 403...

We should include review from the Modeling module, because they own the transform system. @ideasman42 are you interested, or could you pick someone else from the module?

We should include review from the Modeling module, because they own the transform system. @ideasman42 are you interested, or could you pick someone else from the module?
Sybren A. Stüvel added the
Interest
Modeling
label 2023-03-24 16:25:58 +01:00
Author
Member

Note:

Note: * [Windows version](https://builder.blender.org/download/patch/blender-3.6.0-alpha+main-PR104724.624550d7d855-windows.amd64-release.zip) * [Apple Intel](https://builder.blender.org/download/patch/blender-3.6.0-alpha+main-PR104724.624550d7d855-darwin.x86_64-release.dmg) * [Apple Metal](https://builder.blender.org/download/patch/blender-3.6.0-alpha+main-PR104724.624550d7d855-darwin.arm64-release.dmg) * [Linux](https://builder.blender.org/download/patch/blender-3.6.0-alpha+main-PR104724.624550d7d855-linux.x86_64-release.tar.xz) for: Child bone always using parent space, regardless of Local location settings.
Nate Rupsis added 2 commits 2023-04-03 20:22:34 +02:00
Nate Rupsis added 1 commit 2023-04-03 20:38:23 +02:00
buildbot/vexp-code-patch-coordinator Build done. Details
928e06c5e1
7 was not a lucky number
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR104724) when ready.
Author
Member

Note:

Note: * [Windows](https://builder.blender.org/download/patch/blender-3.6.0-alpha+main-PR104724.928e06c5e166-windows.amd64-release.zip) * [Apple Intel](https://builder.blender.org/download/patch/blender-3.6.0-alpha+main-PR104724.928e06c5e166-darwin.x86_64-release.dmg) * [Apple Metal](https://builder.blender.org/download/patch/blender-3.6.0-alpha+main-PR104724.928e06c5e166-darwin.arm64-release.dmg) * [Linux](https://builder.blender.org/download/patch/blender-3.6.0-alpha+main-PR104724.928e06c5e166-linux.x86_64-release.tar.xz) for: or: Child bone respecting Local Location, and only uses parent space if setting is off.

The Modeling module have been completely silent about this, even though I asked for feedback twice. I've told them 'silence will be taken as implicit agreement after day X' and we're a week after 'day X', so let's thank them for their agreement and move forward.

The Modeling module have been completely silent about this, even though I asked for feedback twice. I've told them 'silence will be taken as implicit agreement after day X' and we're a week after 'day X', so let's thank them for their agreement and move forward.
Nate Rupsis added 11 commits 2023-04-17 00:44:13 +02:00
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR104724) when ready.
Nate Rupsis requested review from Sybren A. Stüvel 2023-04-17 00:46:08 +02:00
Member

For root bone with "Local Location" set, use local bone space.

For consistency, I think it probably makes sense to use the armature object's space for this as well. The armature effectively being the "parent".

> For root bone **with** "Local Location" set, use local bone space. For consistency, I think it probably makes sense to use the armature object's space for this as well. The armature effectively being the "parent".
Nate Rupsis added 3 commits 2023-04-17 20:18:08 +02:00
Author
Member

@blender-bot package

@blender-bot package
Member

Package build started. Download here when ready.

Package build started. [Download here](https://builder.blender.org/download/patch/PR104724) when ready.
Brad Clark approved these changes 2023-04-18 23:32:09 +02:00
Brad Clark left a comment
Member

From art/animation side, testing it on armatures and objects, I am happy with how it is interacting with the file.

From art/animation side, testing it on armatures and objects, I am happy with how it is interacting with the file.
Sybren A. Stüvel approved these changes 2023-04-20 10:30:22 +02:00
Sybren A. Stüvel left a comment
Member

💜 the comments in the low-level functions. Makes it so much easier to read & understand.

All I have left is a tiny nag about the comment style, otherwise it all LGTM!
Just land after addressing those.

💜 the comments in the low-level functions. Makes it so much easier to read & understand. All I have left is a tiny nag about the comment style, otherwise it all LGTM! Just land after addressing those.
@ -583,0 +587,4 @@
// Check if target bone is a child.
if (active_pchan->parent) {
// For child, show parent local regardless if "local location" is set for parent bone

Some style remarks:

  • Even for C++ the C-style of comments is preferred (ref)
  • End comments with a period.

And this one is more of a personal preference, but I'd remove the newline between the if and its body, as they form one 'unit' within the function. No strong feelings either way, so do with this one as you wish.

Some style remarks: - Even for C++ the C-style of comments is preferred ([ref](https://wiki.blender.org/wiki/Style_Guide/C_Cpp#C.2FC.2B.2B_Comments)) - End comments with a period. And this one is more of a personal preference, but I'd remove the newline between the `if` and its body, as they form one 'unit' within the function. No strong feelings either way, so do with this one as you wish.
Nate Rupsis added 5 commits 2023-04-20 17:33:07 +02:00
Nate Rupsis merged commit 5c4b0c98d3 into main 2023-04-20 17:40:31 +02:00
Nate Rupsis deleted branch parent-space 2023-04-20 17:40:32 +02:00
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 Assignees
5 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#104724
No description provided.