Anim: Add custom pre and post frame color to motion path #119375
No reviewers
Labels
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
5 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: blender/blender#119375
Loading…
Reference in New Issue
No description provided.
Delete Branch "ChrisLend/blender:mpath_custom_pre_post_color"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR adds an option to specify custom colors for a
motion path. One for frames before the current frame
and one frame for after. With this it is easier to see
the relation of the motion path to the current frame.
That was already the case with the default colors, but
not with custom colors.
Test Build
This has been suggested by @P2design and could also help alleviate
this suggestion from Right Click Select
The user interface has been adapted to show two colors
On a technical side note, the colors pre and post the current frame were already different.
The shader multiplied the custom color by 0.25 for anything pre current frame.
You can kind of see it in the comparison.
Only for the line though.
For the default colors I've made a design task to give them a proper entry in the theme
#119376: Theme colors for time visualization
@blender-bot package
Package build started. Download here when ready.
@blender-bot package windows
Package build started. Download here when ready.
I think this is nice. I do have a bunch of questions though.
Which user interface? Is this a per-motion-path option?
Have you considered making this a theme option, so it can be chosen to be nice & contrasty for the other viewport colours?
@dr.sybren
yes that UI is exactly where the old one was
Yep thought about that as well: #119376: Theme colors for time visualization
Tested and approved at my side.
Didn't find any bugs.
Tested on multiple objects with different color sets.
Basically looks good to me. Just some comments to update and a code structure nit.
Also works great in testing.
@ -41,3 +40,4 @@
if (frame < frameCurrent) {
if (use_custom_color) {
/* Custom color: previous frames color is darker than current frame */
This comment is out of date.
@ -78,3 +76,4 @@
interp.color.rgb = colorCurrentFrame.rgb;
}
else {
/* green - on frameCurrent */
It looks like this comment was already out of date before this PR: the current frame color is definitely not green. Maybe worth updating the comment in this PR?
There's also a similar comment in
overlay_motion_path_point_vert.glsl
(that I can't directly comment on because the line is too distant from the PR changes).@ -42,6 +42,14 @@ void main()
/* Bias more to get these on top of keyframes */
gl_Position.z -= 1e-4;
}
if (use_custom_color) {
At first glance, it wasn't clear to me that this is always exclusive with the previous if statement. Maybe something like this would be clearer:
It's a bit more verbose, but it makes the relationship between the cases more obvious IMO.
(I think some people might object to the lone if statement inside the last else, so that could be turned into an else-if instead. But IMO this code structure as-is makes the case relationships clearer, where all of the top-level branches are for the frame number, and the nested ones are for whether we're using a custom color or not. But I don't feel too strongly about it.)
agreed, makes it a lot clearer.
I left an extra comment to make it clearer that the
else
is only for theframe > frameCurrent
caseIt seems that the keys (when turning the "Keyframe" option off) are always drawn in the 'before' colour.
Ah! Good catch, @dr.sybren!
thanks @dr.sybren
I fixed that by restructuring the shader a bit. The code that checks for a keyframe is now at the end, effectively overriding the custom color. This also makes the
[ ] Keyframes
setting more useful since even with custom colors you can now see your keyframes highlightedNice work! Just some small remarks.
@ -196,1 +196,4 @@
mpath->color_post[0] = 0.1;
mpath->color_post[1] = 1.0;
mpath->color_post[2] = 0.1;
These values should be added to
DNA_action_defaults.h
as well, so that an older file with already-existing motion paths also gets these colors (instead of black).DNA_actions_defaults.h
doesn't seem to exist. It seems like previously, the versioning code was used for that, which I now also did@ -137,2 +137,3 @@
float no_custom_col[3] = {-1.0f, -1.0f, -1.0f};
float *color = (mpath->flag & MOTIONPATH_FLAG_CUSTOM) ? mpath->color : no_custom_col;
float *color_pre = (mpath->flag & MOTIONPATH_FLAG_CUSTOM) ? mpath->color : no_custom_col;
float *color_post = (mpath->flag & MOTIONPATH_FLAG_CUSTOM) ? mpath->color_post : no_custom_col;
These can be
const float
. I also think it would be nice to extract the flag check:LGTM! Just some small stuff to handle when landing.
@ -3112,0 +3116,4 @@
mpath->color_post[1] = 1.0f;
mpath->color_post[2] = 0.1f;
}
/* bones motion path */
Capitalise & end in period. But also a comment is not really necessary; given that it's conditional on
ob->pose
it's kinda clear where it's going.@ -3112,0 +3117,4 @@
mpath->color_post[2] = 0.1f;
}
/* bones motion path */
if (ob->pose) {
This could be
if (!ob->pose) { continue; }
to reduce indentation.Just a comment that I think needs updating. You can fix that while landing.
@ -27,2 +27,4 @@
}
/* Draw special dot where the current frame is.
* NOTE: this is only done when keyframes are shown, since this adds similar types of clutter
I think this comment is out of date now...? Since this code has been moved outside of the
if (showKeyFrames) {
block below, where it previously was.@blender-bot build
@blender-bot build