Page MenuHome

Fix T97559: Undoing an NLA strip duplication leaves the duplicated NLA strip in an unexpected state
ClosedPublic

Authored by Colin Basnett (cmbasnett) on Jun 1 2022, 3:58 AM.

Details

Summary

This fixes T97559: Undoing an NLA strip duplication leaves the duplicated NLA strip in an unexpected state.

The cause of this was that the operator was not using the operator macro system to combine both the duplication and the translate operators into one. Instead, the old code was simply manually invoking invoking the translate operator after the duplicate operator had completed.

This patch requires the default keymap to be modified to include the two new macro operators, NLA_OT_duplicate_move and NLA_OT_duplicate_linked_move in favour of the old keymap that simply called NLA_OT_duplicate and passed along a linked argument.

duplicate_move and duplicate_move_linked are two different enough operations to justify having their own operators from user's point-of-view, especially since we cannot yet have different tool-tips based on an operator's settings.

Diff Detail

Repository
rB Blender

Event Timeline

Colin Basnett (cmbasnett) requested review of this revision.Jun 1 2022, 3:58 AM
Colin Basnett (cmbasnett) created this revision.
Bastien Montagne (mont29) requested changes to this revision.Jun 1 2022, 9:23 AM

Because macro operators apparently cannot accept arguments, the linked and non-linked versions must be separated in this way.

I don't think this is true, check e.g. keymap for node.duplicate_move macro... Think the only other example (Object one) being split is more because of historical limitations? That being said, duplicate_move and duplicate_move_linked are two different enough operations to justify having their own operators from user PoV imho, especially since we cannot give different tooltips based on settings of an operator currently. So I think it's better to have them split here too.

source/blender/editors/space_nla/nla_ops.c
157

That kind of comment is really not that useful, it just duplicates what is written in actual code one line below.

Either explain what those two macro operators are doing and their differences (although this should already be done by their tooltip), or just remove the comments.

This revision now requires changes to proceed.Jun 1 2022, 9:23 AM
source/blender/editors/space_nla/nla_ops.c
160

This tooltip is totally wrong btw.

This comment was removed by Colin Basnett (cmbasnett).
This comment was removed by Colin Basnett (cmbasnett).

Addressed PR feedback.

LGTM, besides suggested tweak to tooltip of the 'complete' duplicate operation.

source/blender/editors/space_nla/nla_ops.c
150

"Duplicate selected strips and their Actions, and move them"

This revision is now accepted and ready to land.Jun 2 2022, 5:08 PM
Sybren A. Stüvel (sybren) requested changes to this revision.Jul 12 2022, 11:58 AM

Nice fix, I think the use of macro operators is a good way to resolve this.

duplicate_move and duplicate_move_linked are two different enough operations to justify having their own operators from user PoV imho, especially since we cannot give different tooltips based on settings of an operator currently. So I think it's better to have them split here too.

I agree with Bastien here. @Colin Basnett (cmbasnett) could you update the patch description for this?

Also I agree with Bastien's notes about the operator tooltips.


I'm getting a compiler warning:

[2481/2841] Building C object source/blender/editors/space_nla/CMakeFiles/bf_editor_space_nla.dir/nla_edit.c.o
blender/source/blender/editors/space_nla/nla_edit.c: In function ‘nlaedit_duplicate_invoke’:
blender/source/blender/editors/space_nla/nla_edit.c:1219:81: warning: unused parameter ‘event’ [-Wunused-parameter]
 1219 | static int nlaedit_duplicate_invoke(bContext *C, wmOperator *op, const wmEvent *event)
      |                                                                  ~~~~~~~~~~~~~~~^~~~~
[2841/2841] Linking CXX executable bin/tests/blender_test
This revision now requires changes to proceed.Jul 12 2022, 11:58 AM
Colin Basnett (cmbasnett) marked 2 inline comments as done.

Added different language for the non-linked duplicate operator & fixed a compiler warning.

Colin Basnett (cmbasnett) marked an inline comment as done.Jul 14 2022, 2:39 AM
This revision is now accepted and ready to land.Jul 19 2022, 4:06 PM