Page MenuHome

Context: implement an active_action property that returns a single action.
ClosedPublic

Authored by Alexander Gavrilov (angavrilov) on Jul 10 2022, 11:34 AM.

Details

Summary

Although e.g. in the dopesheet there is no specific concept of
active action, displaying panels requires singling out one action
reference. It is more efficient and clearer to implement this
natively in the context rather than using selected_visible_actions[0].

Diff Detail

Repository
rB Blender

Event Timeline

Alexander Gavrilov (angavrilov) requested review of this revision.Jul 10 2022, 11:34 AM
Alexander Gavrilov (angavrilov) created this revision.

One question to consider: should this be active_action or active_visible_action to match selected_visible_actions.

There is also active_editable_fcurve in the Graph Editor, I wonder if it should also have active_visible_fcurve for completeness.

One question to consider: should this be active_action or active_visible_action to match selected_visible_actions.

IMO the concept of "visible Action" is a bit weird, since Actions themselves don't have any visibility. So, for me active_action would be preferred.

There is also active_editable_fcurve in the Graph Editor, I wonder if it should also have active_visible_fcurve for completeness.

If we have a concrete need for it.

Actions themselves don't have any visibility.

It is derived from 'visible fcurve' (there are selected_visible_fcurves and selected_editable_fcurves, as well as editable_fcurves/visible_fcurves etc), which means 'visible in the current editor based on whatever filters are active'. In the end it corresponds to a filter flag given to the animation channel enumeration code.

Accepting but I'd like to confirm that the active vertex shown in the UI panel should always be from the active action (if that's not the case I think it makes the concept of active less useful).

If this is not the case it should be documented that "active_action" is more of a convenience utility and doesn't work the same way "active" does elsewhere.


Also, if accessing the active action via a filter function could be made into a utility function, especially if this logic is being duplicated (BKE for example where the context isn't accessible, then that could be moved into a utility function, from a quick check it seems this may not be the case though).

This revision is now accepted and ready to land.Jul 18 2022, 2:03 PM