Anim: prevent pushing down layered Actions onto the NLA
Prevent creating NLA strips from layered Actions via the 'Push Down' operator. Maybe in the future the NLA will support layered Actions (as a transitional phase, before the NLA is replaced with layered Actions itself). For now, it's better to create stable boundaries to prevent their use in the NLA. When NLA support is being worked on, those boundaries can be removed again. Pull Request: https://projects.blender.org/blender/blender/pulls/123467
This commit is contained in:
@@ -33,6 +33,7 @@ set(SRC
|
||||
|
||||
set(LIB
|
||||
bf_blenkernel
|
||||
PRIVATE bf::animrig
|
||||
PRIVATE bf::blenlib
|
||||
PRIVATE bf::depsgraph
|
||||
PRIVATE bf::dna
|
||||
@@ -40,6 +41,9 @@ set(LIB
|
||||
PRIVATE bf::animrig
|
||||
)
|
||||
|
||||
if(WITH_EXPERIMENTAL_FEATURES)
|
||||
add_definitions(-DWITH_ANIM_BAKLAVA)
|
||||
endif()
|
||||
|
||||
blender_add_lib(bf_editor_space_action "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
|
||||
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
#include "BKE_report.hh"
|
||||
#include "BKE_scene.hh"
|
||||
|
||||
#include "ANIM_action.hh"
|
||||
|
||||
#include "ED_anim_api.hh"
|
||||
#include "ED_screen.hh"
|
||||
|
||||
@@ -311,6 +313,14 @@ static bool action_pushdown_poll(bContext *C)
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef WITH_ANIM_BAKLAVA
|
||||
blender::animrig::Action &action = saction->action->wrap();
|
||||
if (!action.is_action_legacy()) {
|
||||
CTX_wm_operator_poll_msg_set(C, "Layered Actions cannot be used as NLA strips");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* NOTE: We check this for the AnimData block in question and not the global flag,
|
||||
* as the global flag may be left dirty by some of the browsing ops here.
|
||||
*/
|
||||
|
||||
@@ -32,12 +32,17 @@ set(SRC
|
||||
|
||||
set(LIB
|
||||
bf_blenkernel
|
||||
PRIVATE bf::animrig
|
||||
PRIVATE bf::blenlib
|
||||
PRIVATE bf::depsgraph
|
||||
PRIVATE bf::dna
|
||||
PRIVATE bf::intern::guardedalloc
|
||||
)
|
||||
|
||||
if(WITH_EXPERIMENTAL_FEATURES)
|
||||
add_definitions(-DWITH_ANIM_BAKLAVA)
|
||||
endif()
|
||||
|
||||
blender_add_lib(bf_editor_space_nla "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
|
||||
|
||||
# RNA_prototypes.h dna_type_offsets.h
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "BKE_nla.h"
|
||||
#include "BKE_report.hh"
|
||||
|
||||
#include "ANIM_action.hh"
|
||||
|
||||
#include "ED_anim_api.hh"
|
||||
#include "ED_keyframes_edit.hh"
|
||||
#include "ED_object.hh"
|
||||
@@ -434,6 +436,16 @@ static int nlatracks_pushdown_exec(bContext *C, wmOperator *op)
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
#ifdef WITH_ANIM_BAKLAVA
|
||||
/* Reject layered Actions, until the NLA knows how to handle them.
|
||||
* Ideally this would happen in the poll function, but the way it's determined which Action to
|
||||
* push down is a bit convoluted (see code above). */
|
||||
if (!adt->action->wrap().is_action_legacy()) {
|
||||
BKE_report(op->reports, RPT_ERROR, "Layered Actions cannot be used as NLA strips");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
#endif // WITH_ANIM_BAKLAVA
|
||||
|
||||
/* 'push-down' action - only usable when not in Tweak-mode. */
|
||||
BKE_nla_action_pushdown(adt, ID_IS_OVERRIDE_LIBRARY(id));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user