Game animation workflow improvements #28453

Closed
opened 2011-08-31 19:41:34 +02:00 by Tom Edwards · 18 comments

%%%This patch drastically improves workflow for game animators using Blender (but not necessarily BGE) by:

  • Allowing a library of Actions to be associated with an ID
  • Locking the preview frame range to the length of the active object's action

Action Library

This is a feature that game animators have long needed. They typically author large numbers of separate actions, but up until now have had no way to manage or easily switch between them.

An Action Library is similar to material or texture slots and is exposed to the user through a new panel in Object Properties (see attached image). It has three unique behaviours:

  • It is not possible to have the same Action in a library twice. If the user selects an Action which is already in the library, the active slot is changed to it.
  • The Library can be "locked" to prevent changes to its contents. The object's active action can still be changed, but only to one already in the library. Locking also filters the template_ID search results, providing a good way to navigate large libraries.
  • Actions can be added in bulk with ops.action.library_add_by_name().

This feature is completely backwards-compatible, and if not used (i.e. no library slots created) does not impact existing program behaviour.

Lock Preview Range to Action

This is a new button in the Timeline, placed next to the existing Preview Range button, which locks the preview frame range to the length of the active object's action.

This facilitates switching between Action Library slots, particularly if the animation is a looping one. Previously the frame range had to be manually adjusted every time.

Other changes

  • Fixed nla.add_tracks() being impossible to call without the user adding an action then manually clicking the unfreeze button in the NLA editor first.
  • Extended the PointerRNA::poll API to support polling for unlink/new/open operations. (Implemented in the patch by template_ID.)
  • Fixed a bug in BLI_strescape() that added junk to the end of the result.
  • Made the "search for unknown operator" message less confusing when the operator name is blank.%%%
%%%This patch drastically improves workflow for game animators using Blender (but not necessarily BGE) by: * Allowing a library of Actions to be associated with an ID * Locking the preview frame range to the length of the active object's action ## Action Library This is a feature that game animators have long needed. They typically author large numbers of separate actions, but up until now have had no way to manage or easily switch between them. An Action Library is similar to material or texture slots and is exposed to the user through a new panel in Object Properties (see attached image). It has three unique behaviours: * It is not possible to have the same Action in a library twice. If the user selects an Action which is already in the library, the active slot is changed to it. * The Library can be "locked" to prevent changes to its contents. The object's active action can still be changed, but only to one already in the library. Locking also filters the template_ID search results, providing a good way to navigate large libraries. * Actions can be added in bulk with ops.action.library_add_by_name(). This feature is completely backwards-compatible, and if not used (i.e. no library slots created) does not impact existing program behaviour. ## Lock Preview Range to Action This is a new button in the Timeline, placed next to the existing Preview Range button, which locks the preview frame range to the length of the active object's action. This facilitates switching between Action Library slots, particularly if the animation is a looping one. Previously the frame range had to be manually adjusted every time. ## Other changes * Fixed nla.add_tracks() being impossible to call without the user adding an action then manually clicking the unfreeze button in the NLA editor first. * Extended the PointerRNA::poll API to support polling for unlink/new/open operations. (Implemented in the patch by template_ID.) * Fixed a bug in BLI_strescape() that added junk to the end of the result. * Made the "search for unknown operator" message less confusing when the operator name is blank.%%%
Author

Changed status to: 'Open'

Changed status to: 'Open'
Author

%%%It's been a while, so I've synced the patch with SVN.%%%

%%%It's been a while, so I've synced the patch with SVN.%%%

%%%Replied to Tom by mail, request this patch is remade and split into 2-3 parts, splitting various useful improvements from larger features and fixes.%%%

%%%Replied to Tom by mail, request this patch is remade and split into 2-3 parts, splitting various useful improvements from larger features and fixes.%%%
Author

%%%* Removed the nla.add_tracks() change, I'll submit that one after this patch is in

  • Removed the BLI_strescape() fix, Campbell has committed his own version of it
  • Removed "unknown operator" change, split into a new patch

The PointerRNA::poll() change remains as it's required for the patch to function.%%%

%%%* Removed the nla.add_tracks() change, I'll submit that one after this patch is in * Removed the BLI_strescape() fix, Campbell has committed his own version of it * Removed "unknown operator" change, split into a new patch The PointerRNA::poll() change remains as it's required for the patch to function.%%%
Member

%%%Some quick general comments. I haven't gone over the specifics of the action setting stuff yet, which looks like it'll need some careful checking...

Action Libraries

  • I'm really not a fan of the whole "array of pointers" style of doing things (which you've used to store this info). In general, it's quite a hairy way of doing things, for fairly minimal gains. Better would be to just use a ListBase to store the list of actions, at storing the pointers to each action using a LinkData (or perhaps a specialised struct to be more future-proof), and doing away with the "count" var.

  • From the looks of things, you're practically assuming that actions can only exist at object level. Perhaps from the perspective of just pure GE character animators, this is sufficient. However, a large part of the animation system design revolves around the idea that AnimData represents a unit/point of animation evaluation and storage, which does its magic on whichever ID block it lives on (regardless of type of ID block). I'm not too sure what the current state of GE animation+actions stands at, but IIRC it is now possible to set up and link various actions for materials, lights, etc. too. So, I think it would pay to not make this too heavily "object only" stuff once again, as we used to have in the past.

Lock Preview Range

I've seen the requests on this for a while, so I guess this functionality+approach is ok.

  • I think it might be better to not assume start=0. While the files you may have come across use start=0 as convention, something out there may be using 1. Also, this might get used by normal animators too...
  • The recalculation of action ranges on each frame/update change is a bit worrying, although I'll let this go here, since IIRC it's done in a few places anyway when updating ;)%%%
%%%Some quick general comments. I haven't gone over the specifics of the action setting stuff yet, which looks like it'll need some careful checking... ## Action Libraries * I'm really not a fan of the whole "array of pointers" style of doing things (which you've used to store this info). In general, it's quite a hairy way of doing things, for fairly minimal gains. Better would be to just use a ListBase to store the list of actions, at storing the pointers to each action using a LinkData (or perhaps a specialised struct to be more future-proof), and doing away with the "count" var. * From the looks of things, you're practically assuming that actions can only exist at object level. Perhaps from the perspective of just pure GE character animators, this is sufficient. However, a large part of the animation system design revolves around the idea that AnimData represents a unit/point of animation evaluation and storage, which does its magic on whichever ID block it lives on (regardless of type of ID block). I'm not too sure what the current state of GE animation+actions stands at, but IIRC it is now possible to set up and link various actions for materials, lights, etc. too. So, I think it would pay to not make this too heavily "object only" stuff once again, as we used to have in the past. ## Lock Preview Range I've seen the requests on this for a while, so I guess this functionality+approach is ok. * I think it might be better to not assume start=0. While the files you may have come across use start=0 as convention, something out there may be using 1. Also, this might get used by normal animators too... * The recalculation of action ranges on each frame/update change is a bit worrying, although I'll let this go here, since IIRC it's done in a few places anyway when updating ;)%%%
Author

%%%Thanks for the review! Action setting is indeed quite fiddly, but I'm confident that I've handled all the scenarios.

  1. I looked at material/texture slots and copied what I saw there. ListBase was actually recommended to me while I was coding, but I didn't know about LinkData so concluded that the system was only suitable for lists of all possible IDs. My vote is for leaving this as-is now, then refactoring it together with material/texture/etc slots later on.

  2. The only place this is really assumed is in the UI and associated operators. Everything else is directly on AnimationData. I agree that more could be done, but I'm not sure if it's worth the extra complexity: I very much doubt that any game engine exporter will ever look at non-object animations, and anyone working on a movie or BGE game already has systems to handle multiple actions.

  3. Agreed. The start value can be left active in the UI to achieve this.

  4. Also agreed, but like you say that's just how things are done right now.%%%

%%%Thanks for the review! Action setting is indeed quite fiddly, but I'm confident that I've handled all the scenarios. 1) I looked at material/texture slots and copied what I saw there. ListBase was actually recommended to me while I was coding, but I didn't know about LinkData so concluded that the system was only suitable for lists of all possible IDs. My vote is for leaving this as-is now, then refactoring it together with material/texture/etc slots later on. 2) The only place this is really assumed is in the UI and associated operators. Everything else is directly on AnimationData. I agree that more _could_ be done, but I'm not sure if it's worth the extra complexity: I very much doubt that any game engine exporter will ever look at non-object animations, and anyone working on a movie or BGE game already has systems to handle multiple actions. 3) Agreed. The start value can be left active in the UI to achieve this. 4) Also agreed, but like you say that's just how things are done right now.%%%
Author

%%%Submitting patch version 4. I've changed the preview lock feature to allow the start and/or end of the frame range to be locked separately. This isn't as intuitive as the original design, but offers total flexibility.

The drop-down menu button is rendered incorrectly at the moment. I've opened a bug for that: http://projects.blender.org/tracker/index.php?func=detail&aid=28742&group_id=9&atid=498%%%

%%%Submitting patch version 4. I've changed the preview lock feature to allow the start and/or end of the frame range to be locked separately. This isn't as intuitive as the original design, but offers total flexibility. The drop-down menu button is rendered incorrectly at the moment. I've opened a bug for that: http://projects.blender.org/tracker/index.php?func=detail&aid=28742&group_id=9&atid=498%%%
Member

%%%Checking this again after being quite busy for a while. As we've now moved into bcon3, this will have to wait till the next dev cycle before being included.

In response to reply @ 2011-09-25 03:13:

  1. -1 on that idea. For new code, we should not be accepting code which borrows from some of the uglier stuff that used to lurk around on the presumption that at some point it can get refactored along with said bad code.

Patch 4 Comments:

  • Separate locking is overkill IMO. Just a single lock or no lock for preview range which deals with both at the same time should be sufficient IMO
  • Popup menus with options isn't that nice, especially from headers%%%
%%%Checking this again after being quite busy for a while. As we've now moved into bcon3, this will have to wait till the next dev cycle before being included. In response to reply @ 2011-09-25 03:13: 1) -1 on that idea. For new code, we should not be accepting code which borrows from some of the uglier stuff that used to lurk around on the presumption that at some point it can get refactored along with said bad code. Patch 4 Comments: - Separate locking is overkill IMO. Just a single lock or no lock for preview range which deals with both at the same time should be sufficient IMO - Popup menus with options isn't that nice, especially from headers%%%
Author

%%%Attaching patch v5! :)

  • Updated to r44717
  • Switched from an array of pointers to ListBase+LinkData
  • Reverted to the one-button preview range lock
  • Fixed incorrect Outliner action selection when there are empty slots
  • Added 'add()' and 'remove()' Python funcs to the ActLib collection
  • Moved 'active' and 'locked' Python vars from AnimData to the ActLib collection

Joshua, last year you were concerned that the UI only applied to objects. I could adjust things so that Actions have their own top-row category like Textures. It's cramped up there though, and I for one really dislike the way you have to switch context with that set-up. Textures are only on Materials, Worlds, or Brushes but Actions can be almost anywhere...%%%

%%%Attaching patch v5! :) * Updated to r44717 * Switched from an array of pointers to ListBase+LinkData * Reverted to the one-button preview range lock * Fixed incorrect Outliner action selection when there are empty slots * Added 'add()' and 'remove()' Python funcs to the ActLib collection * Moved 'active' and 'locked' Python vars from AnimData to the ActLib collection Joshua, last year you were concerned that the UI only applied to objects. I could adjust things so that Actions have their own top-row category like Textures. It's cramped up there though, and I for one really dislike the way you have to switch context with that set-up. Textures are only on Materials, Worlds, or Brushes but Actions can be almost anywhere...%%%
Author

%%%(Attaching updated screenshot)%%%

%%%(Attaching updated screenshot)%%%
Author

%%%(Attaching annotated screenshot)%%%

%%%(Attaching annotated screenshot)%%%
Author

%%%v6 fixes a memory leak when freeing AnimData and moves the new operators from the "action" category to "object".

I've tried making a unified set of operators and UI (with the goal of mimicking the way Custom Properties works) but I've run into a showstopper: poll functions don't take any parameters so you can't tell them where in context to look. There would need to be a different set of operators for each context location. :(%%%

%%%v6 fixes a memory leak when freeing AnimData and moves the new operators from the "action" category to "object". I've tried making a unified set of operators and UI (with the goal of mimicking the way Custom Properties works) but I've run into a showstopper: poll functions don't take any parameters so you can't tell them where in context to look. There would need to be a different set of operators for each context location. :(%%%
Author

%%%v7 fixes a Python error in the new panel.%%%

%%%v7 fixes a Python error in the new panel.%%%
Author

%%%Patch updated to r46603.%%%

%%%Patch updated to r46603.%%%
Author

%%%Updated to r60065. I've removed library locking since the new filtering system solves the problem of browsing large lists in a much nicer way.%%%

%%%Updated to r60065. I've removed library locking since the new filtering system solves the problem of browsing large lists in a much nicer way.%%%

Added subscriber: @dfelinto

Added subscriber: @dfelinto

Changed status from 'Confirmed' to: 'Archived'

Changed status from 'Confirmed' to: 'Archived'

Hi, thanks for your patch.

We are undergoing a Tracker Curfew where we are automatically closing old patches.

If you think the patch is still relevant please update and re-submit it. For new features make sure there is a clear design from the user level perspective.

Hi, thanks for your patch. We are undergoing a [Tracker Curfew ](https://code.blender.org/?p=3861) where we are automatically closing old patches. If you think the patch is still relevant please update and re-submit it. For new features make sure there is a clear design from the user level perspective.
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
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
4 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#28453
No description provided.