Motion Paths: Refresh all. #83068

Closed
opened 2020-11-26 19:15:21 +01:00 by Luciano Muñoz Sessarego · 16 comments

Context:
While working on character animation you often may have more motion paths than just one or often you may have a motion path attached to a "thing" that isn't necessarily what you're currently handling like an the torso while wanting to keep track of what's happening with the arcs of the head.

Problem:
As it stands currently, to force update a motion path you need to go into the "thing" that holds the motion path go under object properties > update motion paths..
Meaning you need to deselect the current "thing" and select the one that does hold the motion path go to the object properties (or in the case of a bone, go to armature and update. This is even more convoluted if you for instance attach an empty to a specific point in the character you want to track, because it means you need to leave pose mode, select the object update, select the armature go back to pose mode make a change, and repeat.

Solution:
Add a "refresh all motion paths" option in the context menu (right click), just under "calculate and clear motion paths" that will refresh all motion paths in the scene.

Context: While working on character animation you often may have more motion paths than just one or often you may have a motion path attached to a "thing" that isn't necessarily what you're currently handling like an the torso while wanting to keep track of what's happening with the arcs of the head. Problem: As it stands currently, to force update a motion path you need to go into the "thing" that holds the motion path go under object properties > update motion paths.. Meaning you need to deselect the current "thing" and select the one that does hold the motion path go to the object properties (or in the case of a bone, go to armature and update. This is even more convoluted if you for instance attach an empty to a specific point in the character you want to track, because it means you need to leave pose mode, select the object update, select the armature go back to pose mode make a change, and repeat. Solution: Add a "refresh all motion paths" option in the context menu (right click), just under "calculate and clear motion paths" that will refresh all motion paths in the scene.
Author
Member

Added subscriber: @LucianoMunoz

Added subscriber: @LucianoMunoz
Member

Added subscriber: @wbmoss_dev

Added subscriber: @wbmoss_dev
Contributor

Added subscriber: @RedMser

Added subscriber: @RedMser

Added subscriber: @propersquid

Added subscriber: @propersquid

This sounds like something I can tackle.

This sounds like something I can tackle.
Scott Wilson was assigned by bassam kurdali 2021-04-03 01:23:40 +02:00

Added subscriber: @dr.sybren

Added subscriber: @dr.sybren

So, I'm currently investigating right now, and there's a few questions that I was hoping that @LucianoMunoz or @dr.sybren could answer.

For @dr.sybren:

  • It looks like the the motion paths are only for poses and objects. Are there any other types that I need to make sure this works with?
  • I'm guessing I'm more or less going to create an iterator over the objects and posed bones, and if they have motion paths enabled, then run the functions in POSE_OT_paths_update and OBJECT_OT_paths_update. I'm not sure how to run operators in C, and I'm not sure if we need to go to the C level for this... so could do in Python?
  • For C/Python, where's the best place for this operator to live? If we're limiting this to posed bones in a selected armature, then it makes sense to have this in source/blender/editors/armature/pose_edit.c. If this is update ALL motion paths, then it would be a combination of objects and posed bones, so having it live in the armature/object editor doesn't make sense to me (maybe in source/blender/editors/scene?).

For @LucianoMunoz:

  • I think the answer is yes to this, but you want all motion paths for all objects/armatures to be updated regardless of whether you're posing a rig or moving an object. So, once you hit that button, everything gets updated all the time no matter what.
  • Do you want an update selected variant of this? If so, if you have an armature selected in object mode, do you want all the bones in the object to have their motion paths updated?
  • There's no "Calculate and clear motion paths" in the right click menu when in object mode. I'm guessing you'll probably want that as well as the other item.
  • I think having this somewhere else in addition to the right click menu makes sense to me. Where do we think would be a good place to have the refresh all available for those that don't have the right click menu set up?
So, I'm currently investigating right now, and there's a few questions that I was hoping that @LucianoMunoz or @dr.sybren could answer. For @dr.sybren: - It looks like the the motion paths are only for poses and objects. Are there any other types that I need to make sure this works with? - I'm guessing I'm more or less going to create an iterator over the objects and posed bones, and if they have motion paths enabled, then run the functions in `POSE_OT_paths_update` and `OBJECT_OT_paths_update`. I'm not sure how to run operators in C, and I'm not sure if we need to go to the C level for this... so could do in Python? - For C/Python, where's the best place for this operator to live? If we're limiting this to posed bones in a selected armature, then it makes sense to have this in `source/blender/editors/armature/pose_edit.c`. If this is update ALL motion paths, then it would be a combination of objects and posed bones, so having it live in the armature/object editor doesn't make sense to me (maybe in `source/blender/editors/scene`?). For @LucianoMunoz: - I think the answer is yes to this, but you want all motion paths for all objects/armatures to be updated regardless of whether you're posing a rig or moving an object. So, once you hit that button, everything gets updated all the time no matter what. - Do you want an update selected variant of this? If so, if you have an armature selected in object mode, do you want all the bones in the object to have their motion paths updated? - There's no "Calculate and clear motion paths" in the right click menu when in object mode. I'm guessing you'll probably want that as well as the other item. - I think having this somewhere else in addition to the right click menu makes sense to me. Where do we think would be a good place to have the refresh all available for those that don't have the right click menu set up?
Author
Member

Hey @propersquid welcome aboard!

  • I think the answer is yes to this, but you want all motion paths for all objects/armatures to be updated regardless of whether you're posing a rig or moving an object. So, once you hit that button, everything gets updated all the time no matter what.

Exactly the idea is that you can update paths that are in other modes than you are currently using: sample case: you use an empty to track a particular part of the body where there isn't a bone to hang on to, so you've created the empty attached it to a part of the body, and then you keep working in pose mode with your character so when you refresh all the path of that empty will refresh without you having to exit pose mode select the empty, update paths, select armature, get into pose mode and tweak your pose again

  • Do you want an update selected variant of this? If so, if you have an armature selected in object mode, do you want all the bones in the object to have their motion paths updated?

possibly? I mean you only use one or two motion paths at the same time, so it could be overkill, the idea of update all motion paths its that you update the paths without there being a need to go and select the specific path for the purpose but all in all most of the times you'll just use one or two, so I think it might be overkill

  • There's no "Calculate and clear motion paths" in the right click menu when in object mode. I'm guessing you'll probably want that as well as the other item.

the reason that those dont exist in the right click in object mode is because you normally use it when you're animating, that's not for me to decide those buttons DO exist, just not in the right click menu, they're under the motion paths tab of the object properties tab of the properties of properties tab tab. -- you know what i mean. --

  • I think having this somewhere else in addition to the right click menu makes sense to me. Where do we think would be a good place to have the refresh all available for those that don't have the right click menu set up?

I'd propose a button in the tool header in pose mode would be nice, i think its extremely underused and these sort of "global" options should definitely go there IMO.

Now in hindsight I've had a grand masterplan for the motion paths that would basically change all the ways it's represented in the interface completely, but this is one functionality that will fit into that plan anyways... maybe I should create a design task for that so we can discuss it.

Hey @propersquid welcome aboard! > - I think the answer is yes to this, but you want all motion paths for all objects/armatures to be updated regardless of whether you're posing a rig or moving an object. So, once you hit that button, everything gets updated all the time no matter what. > Exactly the idea is that you can update paths that are in other modes than you are currently using: sample case: you use an empty to track a particular part of the body where there isn't a bone to hang on to, so you've created the empty attached it to a part of the body, and then you keep working in pose mode with your character so when you refresh all the path of that empty will refresh without you having to exit pose mode select the empty, update paths, select armature, get into pose mode and tweak your pose again > - Do you want an update selected variant of this? If so, if you have an armature selected in object mode, do you want all the bones in the object to have their motion paths updated? > possibly? I mean you only use one or two motion paths at the same time, so it could be overkill, the idea of update all motion paths its that you update the paths without there being a need to go and select the specific path for the purpose but all in all most of the times you'll just use one or two, so I think it might be overkill > - There's no "Calculate and clear motion paths" in the right click menu when in object mode. I'm guessing you'll probably want that as well as the other item. > the reason that those dont exist in the right click in object mode is because you normally use it when you're animating, that's not for me to decide those buttons DO exist, just not in the right click menu, they're under the motion paths tab of the object properties tab of the properties of properties tab tab. -- you know what i mean. -- > - I think having this somewhere else in addition to the right click menu makes sense to me. Where do we think would be a good place to have the refresh all available for those that don't have the right click menu set up? > I'd propose a button in the tool header in pose mode would be nice, i think its extremely underused and these sort of "global" options should definitely go there IMO. Now in hindsight I've had a grand masterplan for the motion paths that would basically change all the ways it's represented in the interface completely, but this is one functionality that will fit into that plan anyways... maybe I should create a design task for that so we can discuss it.

In #83068#1140414, @propersquid wrote:

  • It looks like the the motion paths are only for poses and objects. Are there any other types that I need to make sure this works with?

I think so, yes, because in the C code I only see ANIMVIZ_RECALC_PATHS used in the context of objects and bones. In any case if something was missed I'm sure users will complain about it soon enough, and you can add support for that to the code as well ;-)

  • I'm guessing I'm more or less going to create an iterator over the objects and posed bones, and if they have motion paths enabled, then run the functions in POSE_OT_paths_update and OBJECT_OT_paths_update. I'm not sure how to run operators in C, and I'm not sure if we need to go to the C level for this... so could do in Python?

Both OBJECT_OT_paths_update calls ED_objects_recalculate_paths(), and POSE_OT_paths_update calls ED_pose_recalculate_paths(). Both create their own dependency graph for evaluating the scene at various points in time. That's quite an expensive operation, so you definitely don't want to do that for every bone and every object in the scene.

To determine what exactly gets its motion paths refreshed, ED_pose_recalculate_paths() does this:

  ListBase targets = {NULL, NULL};
  /* set flag to force recalc, then grab the relevant bones to target */
  ob->pose->avs.recalc |= ANIMVIZ_RECALC_PATHS;
  animviz_get_object_motionpaths(ob, &targets);

This determines what exactly gets "targeted" for motion path reevaluation, and can add both objects and bones (bPoseChannel in C); ED_objects_recalculate_paths does something very similar.

I think it would be a good idea to split up ED_objects_recalculate_paths into a few smaller functions that each do only one thing. You can then create a function like ED_objects_recalculate_all_paths that also uses those functions, but has a different target selection mechanism (to tag all objects instead of just selected ones, and to also tag ob->pose if it exists).

It may be tempting to add a bool use_all_objects parameter, but I feel that such "selection parameters" are a bad idea (see Clean Code by Robert Martin, section "Flag Arguments").

  • For C/Python, where's the best place for this operator to live? If we're limiting this to posed bones in a selected armature, then it makes sense to have this in source/blender/editors/armature/pose_edit.c. If this is update ALL motion paths, then it would be a combination of objects and posed bones, so having it live in the armature/object editor doesn't make sense to me (maybe in source/blender/editors/scene?).

Since it's going to behave pretty much like ED_objects_recalculate_paths, I think it's fine to put it into object_edit.c.

> In #83068#1140414, @propersquid wrote: > - It looks like the the motion paths are only for poses and objects. Are there any other types that I need to make sure this works with? I think so, yes, because in the C code I only see `ANIMVIZ_RECALC_PATHS` used in the context of objects and bones. In any case if something was missed I'm sure users will complain about it soon enough, and you can add support for that to the code as well ;-) > - I'm guessing I'm more or less going to create an iterator over the objects and posed bones, and if they have motion paths enabled, then run the functions in `POSE_OT_paths_update` and `OBJECT_OT_paths_update`. I'm not sure how to run operators in C, and I'm not sure if we need to go to the C level for this... so could do in Python? Both `OBJECT_OT_paths_update` calls `ED_objects_recalculate_paths()`, and `POSE_OT_paths_update` calls `ED_pose_recalculate_paths()`. Both create their own dependency graph for evaluating the scene at various points in time. That's quite an expensive operation, so you definitely don't want to do that for every bone and every object in the scene. To determine what exactly gets its motion paths refreshed, `ED_pose_recalculate_paths()` does this: ``` ListBase targets = {NULL, NULL}; /* set flag to force recalc, then grab the relevant bones to target */ ob->pose->avs.recalc |= ANIMVIZ_RECALC_PATHS; animviz_get_object_motionpaths(ob, &targets); ``` This determines what exactly gets "targeted" for motion path reevaluation, and can add both objects and bones (`bPoseChannel` in C); `ED_objects_recalculate_paths` does something very similar. I think it would be a good idea to split up `ED_objects_recalculate_paths` into a few smaller functions that each do only one thing. You can then create a function like `ED_objects_recalculate_all_paths` that also uses those functions, but has a different target selection mechanism (to tag all objects instead of just selected ones, and to also tag `ob->pose` if it exists). It may be tempting to add a `bool use_all_objects` parameter, but I feel that such "selection parameters" are a bad idea (see Clean Code by Robert Martin, section "Flag Arguments"). > - For C/Python, where's the best place for this operator to live? If we're limiting this to posed bones in a selected armature, then it makes sense to have this in `source/blender/editors/armature/pose_edit.c`. If this is update ALL motion paths, then it would be a combination of objects and posed bones, so having it live in the armature/object editor doesn't make sense to me (maybe in `source/blender/editors/scene`?). Since it's going to behave pretty much like `ED_objects_recalculate_paths`, I think it's fine to put it into `object_edit.c`.
Author
Member

whats the progress on this? anything i can be of help with?

whats the progress on this? anything i can be of help with?
Scott Wilson was unassigned by Sybren A. Stüvel 2021-09-21 10:00:15 +02:00

Added subscriber: @AndyCuccaro

Added subscriber: @AndyCuccaro

This issue was referenced by 4de0e2e771

This issue was referenced by 4de0e2e7717f458b496fdf2b00a724412abb88a0

Changed status from 'Needs Triage' to: 'Resolved'

Changed status from 'Needs Triage' to: 'Resolved'
Sybren A. Stüvel self-assigned this 2021-10-18 14:38:55 +02:00

In #83068#1221064, @LucianoMunoz wrote:
whats the progress on this? anything i can be of help with?

The only thing left to do now is to wait until the daily build picks up this change & enjoy the functionality :)

> In #83068#1221064, @LucianoMunoz wrote: > whats the progress on this? anything i can be of help with? The only thing left to do now is to wait until the daily build picks up this change & enjoy the functionality :)
Author
Member

Tested, love it.

Tested, love it.

Added subscriber: @ArtisticBee

Added subscriber: @ArtisticBee
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
8 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#83068
No description provided.