UI: Asset Shelf (Experimental Feature) #104831
|
@ -192,7 +192,7 @@ struct LightTreeNode {
|
|||
* and considers additional orientation and energy information */
|
||||
class LightTree {
|
||||
unique_ptr<LightTreeNode> root_;
|
||||
atomic<int> num_nodes_ = 0;
|
||||
std::atomic<int> num_nodes_ = 0;
|
||||
uint max_lights_in_leaf_;
|
||||
|
||||
public:
|
||||
|
|
|
@ -217,7 +217,11 @@ bool BKE_collection_object_cyclic_check(struct Main *bmain,
|
|||
|
||||
struct ListBase BKE_collection_object_cache_get(struct Collection *collection);
|
||||
ListBase BKE_collection_object_cache_instanced_get(struct Collection *collection);
|
||||
/** Free the object cache of given `collection` and all of its ancestors (recursively). */
|
||||
void BKE_collection_object_cache_free(struct Collection *collection);
|
||||
/** Free the object cache of all collections in given `bmain`, including master collections of
|
||||
* scenes. */
|
||||
void BKE_main_collections_object_cache_free(const struct Main *bmain);
|
||||
|
||||
struct Base *BKE_collection_or_layer_objects(const struct Scene *scene,
|
||||
struct ViewLayer *view_layer,
|
||||
|
|
|
@ -82,6 +82,8 @@ static CollectionParent *collection_find_parent(Collection *child, Collection *c
|
|||
static bool collection_find_child_recursive(const Collection *parent,
|
||||
const Collection *collection);
|
||||
|
||||
static void collection_object_cache_free(Collection *collection);
|
||||
|
||||
static void collection_gobject_hash_ensure(Collection *collection);
|
||||
static void collection_gobject_hash_update_object(Collection *collection,
|
||||
Object *ob_old,
|
||||
|
@ -160,7 +162,7 @@ static void collection_free_data(ID *id)
|
|||
BLI_freelistN(&collection->children);
|
||||
BLI_freelistN(&collection->runtime.parents);
|
||||
|
||||
BKE_collection_object_cache_free(collection);
|
||||
collection_object_cache_free(collection);
|
||||
}
|
||||
|
||||
static void collection_foreach_id(ID *id, LibraryForeachIDData *data)
|
||||
|
@ -887,15 +889,27 @@ static void collection_object_cache_free(Collection *collection)
|
|||
collection->flag &= ~(COLLECTION_HAS_OBJECT_CACHE | COLLECTION_HAS_OBJECT_CACHE_INSTANCED);
|
||||
BLI_freelistN(&collection->runtime.object_cache);
|
||||
BLI_freelistN(&collection->runtime.object_cache_instanced);
|
||||
}
|
||||
|
||||
void BKE_collection_object_cache_free(Collection *collection)
|
||||
{
|
||||
collection_object_cache_free(collection);
|
||||
|
||||
LISTBASE_FOREACH (CollectionParent *, parent, &collection->runtime.parents) {
|
||||
collection_object_cache_free(parent->collection);
|
||||
}
|
||||
}
|
||||
|
||||
void BKE_collection_object_cache_free(Collection *collection)
|
||||
void BKE_main_collections_object_cache_free(const Main *bmain)
|
||||
{
|
||||
collection_object_cache_free(collection);
|
||||
for (Scene *scene = bmain->scenes.first; scene != NULL; scene = scene->id.next) {
|
||||
collection_object_cache_free(scene->master_collection);
|
||||
}
|
||||
|
||||
for (Collection *collection = bmain->collections.first; collection != NULL;
|
||||
collection = collection->id.next) {
|
||||
collection_object_cache_free(collection);
|
||||
}
|
||||
}
|
||||
|
||||
Base *BKE_collection_or_layer_objects(const Scene *scene,
|
||||
|
|
|
@ -1431,6 +1431,8 @@ void BKE_main_collection_sync_remap(const Main *bmain)
|
|||
/* On remapping of object or collection pointers free caches. */
|
||||
/* TODO: try to make this faster */
|
||||
|
||||
BKE_main_collections_object_cache_free(bmain);
|
||||
|
||||
for (Scene *scene = static_cast<Scene *>(bmain->scenes.first); scene;
|
||||
scene = static_cast<Scene *>(scene->id.next)) {
|
||||
LISTBASE_FOREACH (ViewLayer *, view_layer, &scene->view_layers) {
|
||||
|
@ -1447,14 +1449,12 @@ void BKE_main_collection_sync_remap(const Main *bmain)
|
|||
view_layer_bases_hash_create(view_layer, true);
|
||||
}
|
||||
|
||||
BKE_collection_object_cache_free(scene->master_collection);
|
||||
DEG_id_tag_update_ex((Main *)bmain, &scene->master_collection->id, ID_RECALC_COPY_ON_WRITE);
|
||||
DEG_id_tag_update_ex((Main *)bmain, &scene->id, ID_RECALC_COPY_ON_WRITE);
|
||||
}
|
||||
|
||||
for (Collection *collection = static_cast<Collection *>(bmain->collections.first); collection;
|
||||
collection = static_cast<Collection *>(collection->id.next)) {
|
||||
BKE_collection_object_cache_free(collection);
|
||||
DEG_id_tag_update_ex((Main *)bmain, &collection->id, ID_RECALC_COPY_ON_WRITE);
|
||||
}
|
||||
|
||||
|
|
|
@ -148,6 +148,7 @@ typedef enum eKeyframeIterFlags {
|
|||
* iterator callbacks then. */
|
||||
KEYFRAME_ITER_HANDLES_DEFAULT_INVISIBLE = (1 << 3),
|
||||
} eKeyframeIterFlags;
|
||||
ENUM_OPERATORS(eKeyframeIterFlags, KEYFRAME_ITER_HANDLES_DEFAULT_INVISIBLE)
|
||||
|
||||
/** \} */
|
||||
|
||||
|
|
|
@ -23,15 +23,15 @@ set(INC_SYS
|
|||
)
|
||||
|
||||
set(SRC
|
||||
action_buttons.c
|
||||
action_data.c
|
||||
action_draw.c
|
||||
action_edit.c
|
||||
action_ops.c
|
||||
action_select.c
|
||||
space_action.c
|
||||
action_buttons.cc
|
||||
action_data.cc
|
||||
action_draw.cc
|
||||
action_edit.cc
|
||||
action_ops.cc
|
||||
action_select.cc
|
||||
space_action.cc
|
||||
|
||||
action_intern.h
|
||||
action_intern.hh
|
||||
)
|
||||
|
||||
set(LIB
|
||||
|
|
|
@ -5,30 +5,30 @@
|
|||
* \ingroup spaction
|
||||
*/
|
||||
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <cfloat>
|
||||
#include <cmath>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
#include "BKE_context.h"
|
||||
#include "BKE_screen.h"
|
||||
|
||||
#include "action_intern.h" /* own include */
|
||||
#include "action_intern.hh" /* own include */
|
||||
|
||||
/* ******************* action editor space & buttons ************** */
|
||||
|
||||
/* ******************* general ******************************** */
|
||||
|
||||
void action_buttons_register(ARegionType *UNUSED(art))
|
||||
void action_buttons_register(ARegionType * /*art*/)
|
||||
{
|
||||
#if 0
|
||||
PanelType *pt;
|
||||
|
||||
/* TODO: AnimData / Actions List */
|
||||
|
||||
pt = MEM_callocN(sizeof(PanelType), "spacetype action panel properties");
|
||||
pt = MEM_cnew<PanelType>("spacetype action panel properties");
|
||||
strcpy(pt->idname, "ACTION_PT_properties");
|
||||
strcpy(pt->label, N_("Active F-Curve"));
|
||||
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
|
||||
|
@ -36,7 +36,7 @@ void action_buttons_register(ARegionType *UNUSED(art))
|
|||
pt->poll = action_anim_panel_poll;
|
||||
BLI_addtail(&art->paneltypes, pt);
|
||||
|
||||
pt = MEM_callocN(sizeof(PanelType), "spacetype action panel properties");
|
||||
pt = MEM_cnew<PanelType>("spacetype action panel properties");
|
||||
strcpy(pt->idname, "ACTION_PT_key_properties");
|
||||
strcpy(pt->label, N_("Active Keyframe"));
|
||||
strcpy(pt->translation_context, BLT_I18NCONTEXT_DEFAULT_BPYRNA);
|
|
@ -5,10 +5,10 @@
|
|||
* \ingroup spaction
|
||||
*/
|
||||
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <cfloat>
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "BLI_utildefines.h"
|
||||
|
||||
|
@ -52,7 +52,7 @@
|
|||
|
||||
#include "UI_interface.h"
|
||||
|
||||
#include "action_intern.h"
|
||||
#include "action_intern.hh"
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Utilities
|
||||
|
@ -62,7 +62,7 @@ AnimData *ED_actedit_animdata_from_context(const bContext *C, ID **r_adt_id_owne
|
|||
{
|
||||
SpaceAction *saction = (SpaceAction *)CTX_wm_space_data(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
AnimData *adt = NULL;
|
||||
AnimData *adt = nullptr;
|
||||
|
||||
/* Get AnimData block to use */
|
||||
if (saction->mode == SACTCONT_ACTION) {
|
||||
|
@ -146,11 +146,11 @@ static void actedit_change_action(bContext *C, bAction *act)
|
|||
RNA_pointer_create(&screen->id, &RNA_SpaceDopeSheetEditor, saction, &ptr);
|
||||
prop = RNA_struct_find_property(&ptr, "action");
|
||||
|
||||
/* NOTE: act may be NULL here, so better to just use a cast here */
|
||||
/* NOTE: act may be nullptr here, so better to just use a cast here */
|
||||
RNA_id_pointer_create((ID *)act, &idptr);
|
||||
|
||||
/* set the new pointer, and force a refresh */
|
||||
RNA_property_pointer_set(&ptr, prop, idptr, NULL);
|
||||
RNA_property_pointer_set(&ptr, prop, idptr, nullptr);
|
||||
RNA_property_update(C, &ptr, prop);
|
||||
}
|
||||
|
||||
|
@ -181,7 +181,7 @@ static bool action_new_poll(bContext *C)
|
|||
if (saction->mode == SACTCONT_ACTION) {
|
||||
/* XXX: This assumes that actions are assigned to the active object in this mode */
|
||||
if (ob) {
|
||||
if ((ob->adt == NULL) || (ob->adt->flag & ADT_NLA_EDIT_ON) == 0) {
|
||||
if ((ob->adt == nullptr) || (ob->adt->flag & ADT_NLA_EDIT_ON) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ static bool action_new_poll(bContext *C)
|
|||
else if (saction->mode == SACTCONT_SHAPEKEY) {
|
||||
Key *key = BKE_key_from_object(ob);
|
||||
if (key) {
|
||||
if ((key->adt == NULL) || (key->adt->flag & ADT_NLA_EDIT_ON) == 0) {
|
||||
if ((key->adt == nullptr) || (key->adt->flag & ADT_NLA_EDIT_ON) == 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -205,14 +205,14 @@ static bool action_new_poll(bContext *C)
|
|||
return false;
|
||||
}
|
||||
|
||||
static int action_new_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
static int action_new_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
PointerRNA ptr, idptr;
|
||||
PropertyRNA *prop;
|
||||
|
||||
bAction *oldact = NULL;
|
||||
AnimData *adt = NULL;
|
||||
ID *adt_id_owner = NULL;
|
||||
bAction *oldact = nullptr;
|
||||
AnimData *adt = nullptr;
|
||||
ID *adt_id_owner = nullptr;
|
||||
/* hook into UI */
|
||||
UI_context_active_but_prop_get_templateID(C, &ptr, &prop);
|
||||
|
||||
|
@ -225,7 +225,7 @@ static int action_new_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
|
||||
/* stash the old action to prevent it from being lost */
|
||||
if (ptr.type == &RNA_AnimData) {
|
||||
adt = ptr.data;
|
||||
adt = static_cast<AnimData *>(ptr.data);
|
||||
adt_id_owner = ptr.owner_id;
|
||||
}
|
||||
else if (ptr.type == &RNA_SpaceDopeSheetEditor) {
|
||||
|
@ -237,11 +237,11 @@ static int action_new_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
oldact = adt->action;
|
||||
}
|
||||
{
|
||||
bAction *action = NULL;
|
||||
bAction *action = nullptr;
|
||||
|
||||
/* Perform stashing operation - But only if there is an action */
|
||||
if (adt && oldact) {
|
||||
BLI_assert(adt_id_owner != NULL);
|
||||
BLI_assert(adt_id_owner != nullptr);
|
||||
/* stash the action */
|
||||
if (BKE_nla_action_stash(adt, ID_IS_OVERRIDE_LIBRARY(adt_id_owner))) {
|
||||
/* The stash operation will remove the user already
|
||||
|
@ -252,8 +252,8 @@ static int action_new_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
* or else the user gets decremented twice!
|
||||
*/
|
||||
if (ptr.type == &RNA_SpaceDopeSheetEditor) {
|
||||
SpaceAction *saction = ptr.data;
|
||||
saction->action = NULL;
|
||||
SpaceAction *saction = static_cast<SpaceAction *>(ptr.data);
|
||||
saction->action = nullptr;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -272,13 +272,13 @@ static int action_new_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
* NOTE: we can't use actedit_change_action, as this function is also called from the NLA
|
||||
*/
|
||||
RNA_id_pointer_create(&action->id, &idptr);
|
||||
RNA_property_pointer_set(&ptr, prop, idptr, NULL);
|
||||
RNA_property_pointer_set(&ptr, prop, idptr, nullptr);
|
||||
RNA_property_update(C, &ptr, prop);
|
||||
}
|
||||
}
|
||||
|
||||
/* set notifier that keyframes have changed */
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_ADDED, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_ADDED, nullptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -313,7 +313,7 @@ static bool action_pushdown_poll(bContext *C)
|
|||
{
|
||||
if (ED_operator_action_active(C)) {
|
||||
SpaceAction *saction = (SpaceAction *)CTX_wm_space_data(C);
|
||||
AnimData *adt = ED_actedit_animdata_from_context(C, NULL);
|
||||
AnimData *adt = ED_actedit_animdata_from_context(C, nullptr);
|
||||
|
||||
/* Check for AnimData, Actions, and that tweak-mode is off. */
|
||||
if (adt && saction->action) {
|
||||
|
@ -333,7 +333,7 @@ static bool action_pushdown_poll(bContext *C)
|
|||
static int action_pushdown_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
SpaceAction *saction = (SpaceAction *)CTX_wm_space_data(C);
|
||||
ID *adt_id_owner = NULL;
|
||||
ID *adt_id_owner = nullptr;
|
||||
AnimData *adt = ED_actedit_animdata_from_context(C, &adt_id_owner);
|
||||
|
||||
/* Do the deed... */
|
||||
|
@ -349,7 +349,7 @@ static int action_pushdown_exec(bContext *C, wmOperator *op)
|
|||
/* action can be safely added */
|
||||
BKE_nla_action_pushdown(adt, ID_IS_OVERRIDE_LIBRARY(adt_id_owner));
|
||||
|
||||
struct Main *bmain = CTX_data_main(C);
|
||||
Main *bmain = CTX_data_main(C);
|
||||
DEG_id_tag_update_ex(bmain, adt_id_owner, ID_RECALC_ANIMATION);
|
||||
|
||||
/* The action needs updating too, as FCurve modifiers are to be reevaluated. They won't extend
|
||||
|
@ -359,11 +359,11 @@ static int action_pushdown_exec(bContext *C, wmOperator *op)
|
|||
/* Stop displaying this action in this editor
|
||||
* NOTE: The editor itself doesn't set a user...
|
||||
*/
|
||||
saction->action = NULL;
|
||||
saction->action = nullptr;
|
||||
}
|
||||
|
||||
/* Send notifiers that stuff has changed */
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, nullptr);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
|
@ -391,7 +391,7 @@ void ACTION_OT_push_down(wmOperatorType *ot)
|
|||
static int action_stash_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
SpaceAction *saction = (SpaceAction *)CTX_wm_space_data(C);
|
||||
ID *adt_id_owner = NULL;
|
||||
ID *adt_id_owner = nullptr;
|
||||
AnimData *adt = ED_actedit_animdata_from_context(C, &adt_id_owner);
|
||||
|
||||
/* Perform stashing operation */
|
||||
|
@ -410,7 +410,7 @@ static int action_stash_exec(bContext *C, wmOperator *op)
|
|||
* the user-count fixes. Hence, we must unset this ref
|
||||
* first before setting the new action.
|
||||
*/
|
||||
saction->action = NULL;
|
||||
saction->action = nullptr;
|
||||
}
|
||||
else {
|
||||
/* action has already been added - simply warn about this, and clear */
|
||||
|
@ -418,11 +418,11 @@ static int action_stash_exec(bContext *C, wmOperator *op)
|
|||
}
|
||||
|
||||
/* clear action refs from editor, and then also the backing data (not necessary) */
|
||||
actedit_change_action(C, NULL);
|
||||
actedit_change_action(C, nullptr);
|
||||
}
|
||||
|
||||
/* Send notifiers that stuff has changed */
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, nullptr);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
|
@ -461,7 +461,7 @@ void ACTION_OT_stash(wmOperatorType *ot)
|
|||
static bool action_stash_create_poll(bContext *C)
|
||||
{
|
||||
if (ED_operator_action_active(C)) {
|
||||
AnimData *adt = ED_actedit_animdata_from_context(C, NULL);
|
||||
AnimData *adt = ED_actedit_animdata_from_context(C, nullptr);
|
||||
|
||||
/* Check tweak-mode is off (as you don't want to be tampering with the action in that case) */
|
||||
/* NOTE: unlike for pushdown,
|
||||
|
@ -494,13 +494,13 @@ static bool action_stash_create_poll(bContext *C)
|
|||
static int action_stash_create_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
SpaceAction *saction = (SpaceAction *)CTX_wm_space_data(C);
|
||||
ID *adt_id_owner = NULL;
|
||||
ID *adt_id_owner = nullptr;
|
||||
AnimData *adt = ED_actedit_animdata_from_context(C, &adt_id_owner);
|
||||
|
||||
/* Check for no action... */
|
||||
if (saction->action == NULL) {
|
||||
if (saction->action == nullptr) {
|
||||
/* just create a new action */
|
||||
bAction *action = action_create_new(C, NULL);
|
||||
bAction *action = action_create_new(C, nullptr);
|
||||
actedit_change_action(C, action);
|
||||
}
|
||||
else if (adt) {
|
||||
|
@ -513,29 +513,29 @@ static int action_stash_create_exec(bContext *C, wmOperator *op)
|
|||
|
||||
/* stash the action */
|
||||
if (BKE_nla_action_stash(adt, ID_IS_OVERRIDE_LIBRARY(adt_id_owner))) {
|
||||
bAction *new_action = NULL;
|
||||
bAction *new_action = nullptr;
|
||||
|
||||
/* Create new action not based on the old one
|
||||
* (since the "new" operator already does that). */
|
||||
new_action = action_create_new(C, NULL);
|
||||
new_action = action_create_new(C, nullptr);
|
||||
|
||||
/* The stash operation will remove the user already,
|
||||
* so the flushing step later shouldn't double up
|
||||
* the user-count fixes. Hence, we must unset this ref
|
||||
* first before setting the new action.
|
||||
*/
|
||||
saction->action = NULL;
|
||||
saction->action = nullptr;
|
||||
actedit_change_action(C, new_action);
|
||||
}
|
||||
else {
|
||||
/* action has already been added - simply warn about this, and clear */
|
||||
BKE_report(op->reports, RPT_ERROR, "Action has already been stashed");
|
||||
actedit_change_action(C, NULL);
|
||||
actedit_change_action(C, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
/* Send notifiers that stuff has changed */
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, nullptr);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
|
@ -598,19 +598,19 @@ void ED_animedit_unlink_action(
|
|||
NlaTrack *nlt, *nlt_next;
|
||||
NlaStrip *strip, *nstrip;
|
||||
|
||||
for (nlt = adt->nla_tracks.first; nlt; nlt = nlt_next) {
|
||||
for (nlt = static_cast<NlaTrack *>(adt->nla_tracks.first); nlt; nlt = nlt_next) {
|
||||
nlt_next = nlt->next;
|
||||
|
||||
if (strstr(nlt->name, DATA_("[Action Stash]"))) {
|
||||
for (strip = nlt->strips.first; strip; strip = nstrip) {
|
||||
for (strip = static_cast<NlaStrip *>(nlt->strips.first); strip; strip = nstrip) {
|
||||
nstrip = strip->next;
|
||||
|
||||
if (strip->act == act) {
|
||||
/* Remove this strip, and the track too if it doesn't have anything else */
|
||||
BKE_nlastrip_remove_and_free(&nlt->strips, strip, true);
|
||||
|
||||
if (nlt->strips.first == NULL) {
|
||||
BLI_assert(nstrip == NULL);
|
||||
if (nlt->strips.first == nullptr) {
|
||||
BLI_assert(nstrip == nullptr);
|
||||
BKE_nlatrack_remove_and_free(&adt->nla_tracks, nlt, true);
|
||||
}
|
||||
}
|
||||
|
@ -628,15 +628,15 @@ void ED_animedit_unlink_action(
|
|||
BKE_nla_tweakmode_exit(adt);
|
||||
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
if (scene != NULL) {
|
||||
if (scene != nullptr) {
|
||||
scene->flag &= ~SCE_NLA_EDIT_ON;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Unlink normally - Setting it to NULL should be enough to get the old one unlinked */
|
||||
/* Unlink normally - Setting it to nullptr should be enough to get the old one unlinked */
|
||||
if (area->spacetype == SPACE_ACTION) {
|
||||
/* clear action editor -> action */
|
||||
actedit_change_action(C, NULL);
|
||||
actedit_change_action(C, nullptr);
|
||||
}
|
||||
else {
|
||||
/* clear AnimData -> action */
|
||||
|
@ -648,7 +648,7 @@ void ED_animedit_unlink_action(
|
|||
prop = RNA_struct_find_property(&ptr, "action");
|
||||
|
||||
/* clear... */
|
||||
RNA_property_pointer_set(&ptr, prop, PointerRNA_NULL, NULL);
|
||||
RNA_property_pointer_set(&ptr, prop, PointerRNA_NULL, nullptr);
|
||||
RNA_property_update(C, &ptr, prop);
|
||||
}
|
||||
}
|
||||
|
@ -660,7 +660,7 @@ static bool action_unlink_poll(bContext *C)
|
|||
{
|
||||
if (ED_operator_action_active(C)) {
|
||||
SpaceAction *saction = (SpaceAction *)CTX_wm_space_data(C);
|
||||
AnimData *adt = ED_actedit_animdata_from_context(C, NULL);
|
||||
AnimData *adt = ED_actedit_animdata_from_context(C, nullptr);
|
||||
|
||||
/* Only when there's an active action, in the right modes... */
|
||||
if (saction->action && adt) {
|
||||
|
@ -674,15 +674,15 @@ static bool action_unlink_poll(bContext *C)
|
|||
|
||||
static int action_unlink_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
AnimData *adt = ED_actedit_animdata_from_context(C, NULL);
|
||||
AnimData *adt = ED_actedit_animdata_from_context(C, nullptr);
|
||||
bool force_delete = RNA_boolean_get(op->ptr, "force_delete");
|
||||
|
||||
if (adt && adt->action) {
|
||||
ED_animedit_unlink_action(C, NULL, adt, adt->action, op->reports, force_delete);
|
||||
ED_animedit_unlink_action(C, nullptr, adt, adt->action, op->reports, force_delete);
|
||||
}
|
||||
|
||||
/* Unlink is also abused to exit NLA tweak mode. */
|
||||
WM_main_add_notifier(NC_ANIMATION | ND_NLA_ACTCHANGE, NULL);
|
||||
WM_main_add_notifier(NC_ANIMATION | ND_NLA_ACTCHANGE, nullptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -733,24 +733,24 @@ static NlaStrip *action_layer_get_nlastrip(ListBase *strips, float ctime)
|
|||
{
|
||||
NlaStrip *strip;
|
||||
|
||||
for (strip = strips->first; strip; strip = strip->next) {
|
||||
for (strip = static_cast<NlaStrip *>(strips->first); strip; strip = strip->next) {
|
||||
/* Can we use this? */
|
||||
if (IN_RANGE_INCL(ctime, strip->start, strip->end)) {
|
||||
/* in range - use this one */
|
||||
return strip;
|
||||
}
|
||||
if ((ctime < strip->start) && (strip->prev == NULL)) {
|
||||
if ((ctime < strip->start) && (strip->prev == nullptr)) {
|
||||
/* before first - use this one */
|
||||
return strip;
|
||||
}
|
||||
if ((ctime > strip->end) && (strip->next == NULL)) {
|
||||
if ((ctime > strip->end) && (strip->next == nullptr)) {
|
||||
/* after last - use this one */
|
||||
return strip;
|
||||
}
|
||||
}
|
||||
|
||||
/* nothing suitable found... */
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* Switch NLA Strips/Actions. */
|
||||
|
@ -809,7 +809,7 @@ static bool action_layer_next_poll(bContext *C)
|
|||
{
|
||||
/* Action Editor's action editing modes only */
|
||||
if (ED_operator_action_active(C)) {
|
||||
AnimData *adt = ED_actedit_animdata_from_context(C, NULL);
|
||||
AnimData *adt = ED_actedit_animdata_from_context(C, nullptr);
|
||||
if (adt) {
|
||||
/* only allow if we're in tweak-mode, and there's something above us... */
|
||||
if (adt->flag & ADT_NLA_EDIT_ON) {
|
||||
|
@ -829,7 +829,7 @@ static bool action_layer_next_poll(bContext *C)
|
|||
* to "move to an empty layer", even though this means
|
||||
* that we won't actually have an action.
|
||||
*/
|
||||
// return (adt->tmpact != NULL);
|
||||
// return (adt->tmpact != nullptr);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -843,7 +843,7 @@ static bool action_layer_next_poll(bContext *C)
|
|||
|
||||
static int action_layer_next_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
AnimData *adt = ED_actedit_animdata_from_context(C, NULL);
|
||||
AnimData *adt = ED_actedit_animdata_from_context(C, nullptr);
|
||||
NlaTrack *act_track;
|
||||
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
@ -852,7 +852,7 @@ static int action_layer_next_exec(bContext *C, wmOperator *op)
|
|||
/* Get active track */
|
||||
act_track = BKE_nlatrack_find_tweaked(adt);
|
||||
|
||||
if (act_track == NULL) {
|
||||
if (act_track == nullptr) {
|
||||
BKE_report(op->reports, RPT_ERROR, "Could not find current NLA Track");
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
@ -924,7 +924,7 @@ static bool action_layer_prev_poll(bContext *C)
|
|||
{
|
||||
/* Action Editor's action editing modes only */
|
||||
if (ED_operator_action_active(C)) {
|
||||
AnimData *adt = ED_actedit_animdata_from_context(C, NULL);
|
||||
AnimData *adt = ED_actedit_animdata_from_context(C, nullptr);
|
||||
if (adt) {
|
||||
if (adt->flag & ADT_NLA_EDIT_ON) {
|
||||
/* Tweak Mode: We need to check if there are any tracks below the active one
|
||||
|
@ -947,7 +947,7 @@ static bool action_layer_prev_poll(bContext *C)
|
|||
}
|
||||
else {
|
||||
/* Normal Mode: If there are any tracks, we can try moving to those */
|
||||
return (adt->nla_tracks.first != NULL);
|
||||
return (adt->nla_tracks.first != nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -958,7 +958,7 @@ static bool action_layer_prev_poll(bContext *C)
|
|||
|
||||
static int action_layer_prev_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
AnimData *adt = ED_actedit_animdata_from_context(C, NULL);
|
||||
AnimData *adt = ED_actedit_animdata_from_context(C, nullptr);
|
||||
NlaTrack *act_track;
|
||||
NlaTrack *nlt;
|
||||
|
||||
|
@ -966,7 +966,7 @@ static int action_layer_prev_exec(bContext *C, wmOperator *op)
|
|||
float ctime = BKE_scene_ctime_get(scene);
|
||||
|
||||
/* Sanity Check */
|
||||
if (adt == NULL) {
|
||||
if (adt == nullptr) {
|
||||
BKE_report(
|
||||
op->reports, RPT_ERROR, "Internal Error: Could not find Animation Data/NLA Stack to use");
|
||||
return OPERATOR_CANCELLED;
|
||||
|
@ -982,7 +982,7 @@ static int action_layer_prev_exec(bContext *C, wmOperator *op)
|
|||
}
|
||||
else {
|
||||
/* Active Action - Use the top-most track */
|
||||
nlt = adt->nla_tracks.last;
|
||||
nlt = static_cast<NlaTrack *>(adt->nla_tracks.last);
|
||||
}
|
||||
|
||||
/* Find previous action and hook it up */
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
/* System includes ----------------------------------------------------- */
|
||||
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <cfloat>
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_math.h"
|
||||
|
@ -42,7 +42,7 @@
|
|||
#include "ED_anim_api.h"
|
||||
#include "ED_keyframes_draw.h"
|
||||
|
||||
#include "action_intern.h"
|
||||
#include "action_intern.hh"
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Channel List
|
||||
|
@ -50,23 +50,23 @@
|
|||
|
||||
void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *region)
|
||||
{
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
ListBase anim_data = {nullptr, nullptr};
|
||||
bAnimListElem *ale;
|
||||
int filter;
|
||||
eAnimFilter_Flags filter;
|
||||
|
||||
View2D *v2d = ®ion->v2d;
|
||||
size_t items;
|
||||
|
||||
/* build list of channels to draw */
|
||||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS);
|
||||
items = ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
items = ANIM_animdata_filter(ac, &anim_data, filter, ac->data, eAnimCont_Types(ac->datatype));
|
||||
|
||||
const int height = ANIM_UI_get_channels_total_height(v2d, items);
|
||||
const float pad_bottom = BLI_listbase_is_empty(ac->markers) ? 0 : UI_MARKER_MARGIN_Y;
|
||||
v2d->tot.ymin = -(height + pad_bottom);
|
||||
|
||||
/* need to do a view-sync here, so that the keys area doesn't jump around (it must copy this) */
|
||||
UI_view2d_sync(NULL, ac->area, v2d, V2D_LOCK_COPY);
|
||||
UI_view2d_sync(nullptr, ac->area, v2d, V2D_LOCK_COPY);
|
||||
|
||||
const float channel_step = ANIM_UI_get_channel_step();
|
||||
/* Loop through channels, and set up drawing depending on their type. */
|
||||
|
@ -74,7 +74,8 @@ void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *region)
|
|||
size_t channel_index = 0;
|
||||
float ymax = ANIM_UI_get_first_channel_top(v2d);
|
||||
|
||||
for (ale = anim_data.first; ale; ale = ale->next, ymax -= channel_step, channel_index++) {
|
||||
for (ale = static_cast<bAnimListElem *>(anim_data.first); ale;
|
||||
ale = ale->next, ymax -= channel_step, channel_index++) {
|
||||
const float ymin = ymax - ANIM_UI_get_channel_height();
|
||||
|
||||
/* check if visible */
|
||||
|
@ -90,7 +91,8 @@ void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *region)
|
|||
size_t channel_index = 0;
|
||||
float ymax = ANIM_UI_get_first_channel_top(v2d);
|
||||
|
||||
for (ale = anim_data.first; ale; ale = ale->next, ymax -= channel_step, channel_index++) {
|
||||
for (ale = static_cast<bAnimListElem *>(anim_data.first); ale;
|
||||
ale = ale->next, ymax -= channel_step, channel_index++) {
|
||||
const float ymin = ymax - ANIM_UI_get_channel_height();
|
||||
|
||||
/* check if visible */
|
||||
|
@ -124,8 +126,8 @@ void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *region)
|
|||
static void draw_channel_action_ranges(ListBase *anim_data, View2D *v2d)
|
||||
{
|
||||
/* Variables for coalescing the Y region of one action. */
|
||||
bAction *cur_action = NULL;
|
||||
AnimData *cur_adt = NULL;
|
||||
bAction *cur_action = nullptr;
|
||||
AnimData *cur_adt = nullptr;
|
||||
float cur_ymax;
|
||||
|
||||
/* Walk through channels, grouping contiguous spans referencing the same action. */
|
||||
|
@ -133,9 +135,10 @@ static void draw_channel_action_ranges(ListBase *anim_data, View2D *v2d)
|
|||
const float ystep = ANIM_UI_get_channel_step();
|
||||
float ymin = ymax - ystep;
|
||||
|
||||
for (bAnimListElem *ale = anim_data->first; ale; ale = ale->next, ymax = ymin, ymin -= ystep) {
|
||||
bAction *action = NULL;
|
||||
AnimData *adt = NULL;
|
||||
for (bAnimListElem *ale = static_cast<bAnimListElem *>(anim_data->first); ale;
|
||||
ale = ale->next, ymax = ymin, ymin -= ystep) {
|
||||
bAction *action = nullptr;
|
||||
AnimData *adt = nullptr;
|
||||
|
||||
/* check if visible */
|
||||
if (IN_RANGE(ymin, v2d->cur.ymin, v2d->cur.ymax) ||
|
||||
|
@ -170,12 +173,12 @@ static void draw_channel_action_ranges(ListBase *anim_data, View2D *v2d)
|
|||
|
||||
void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *region)
|
||||
{
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
ListBase anim_data = {nullptr, nullptr};
|
||||
bAnimListElem *ale;
|
||||
|
||||
View2D *v2d = ®ion->v2d;
|
||||
bDopeSheet *ads = &saction->ads;
|
||||
AnimData *adt = NULL;
|
||||
AnimData *adt = nullptr;
|
||||
|
||||
uchar col1[4], col2[4];
|
||||
uchar col1a[4], col2a[4];
|
||||
|
@ -196,8 +199,10 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *region
|
|||
UI_GetThemeColor4ubv(TH_DOPESHEET_CHANNELSUBOB, col2b);
|
||||
|
||||
/* build list of channels to draw */
|
||||
int filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS);
|
||||
size_t items = ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
eAnimFilter_Flags filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE |
|
||||
ANIMFILTER_LIST_CHANNELS);
|
||||
size_t items = ANIM_animdata_filter(
|
||||
ac, &anim_data, filter, ac->data, eAnimCont_Types(ac->datatype));
|
||||
|
||||
const int height = ANIM_UI_get_channels_total_height(v2d, items);
|
||||
const float pad_bottom = BLI_listbase_is_empty(ac->markers) ? 0 : UI_MARKER_MARGIN_Y;
|
||||
|
@ -220,7 +225,8 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *region
|
|||
/* first backdrop strips */
|
||||
float ymax = ANIM_UI_get_first_channel_top(v2d);
|
||||
const float channel_step = ANIM_UI_get_channel_step();
|
||||
for (ale = anim_data.first; ale; ale = ale->next, ymax -= channel_step) {
|
||||
for (ale = static_cast<bAnimListElem *>(anim_data.first); ale;
|
||||
ale = ale->next, ymax -= channel_step) {
|
||||
const float ymin = ymax - ANIM_UI_get_channel_height();
|
||||
|
||||
/* check if visible */
|
||||
|
@ -255,7 +261,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *region
|
|||
break;
|
||||
}
|
||||
case ANIMTYPE_GROUP: {
|
||||
bActionGroup *agrp = ale->data;
|
||||
bActionGroup *agrp = static_cast<bActionGroup *>(ale->data);
|
||||
if (show_group_colors && agrp->customCol) {
|
||||
if (sel) {
|
||||
immUniformColor3ubvAlpha((uchar *)agrp->cs.select, col1a[3]);
|
||||
|
@ -270,7 +276,7 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *region
|
|||
break;
|
||||
}
|
||||
case ANIMTYPE_FCURVE: {
|
||||
FCurve *fcu = ale->data;
|
||||
FCurve *fcu = static_cast<FCurve *>(ale->data);
|
||||
if (show_group_colors && fcu->grp && fcu->grp->customCol) {
|
||||
immUniformColor3ubvAlpha((uchar *)fcu->grp->cs.active, sel ? col1[3] : col2[3]);
|
||||
}
|
||||
|
@ -375,11 +381,12 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *region
|
|||
|
||||
ymax = ANIM_UI_get_first_channel_top(v2d);
|
||||
|
||||
struct AnimKeylistDrawList *draw_list = ED_keylist_draw_list_create();
|
||||
AnimKeylistDrawList *draw_list = ED_keylist_draw_list_create();
|
||||
|
||||
const float scale_factor = ANIM_UI_get_keyframe_scale_factor();
|
||||
|
||||
for (ale = anim_data.first; ale; ale = ale->next, ymax -= channel_step) {
|
||||
for (ale = static_cast<bAnimListElem *>(anim_data.first); ale;
|
||||
ale = ale->next, ymax -= channel_step) {
|
||||
const float ymin = ymax - ANIM_UI_get_channel_height();
|
||||
float ycenter = (ymin + ymax) / 2.0f;
|
||||
|
||||
|
@ -393,28 +400,67 @@ void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *region
|
|||
/* draw 'keyframes' for each specific datatype */
|
||||
switch (ale->datatype) {
|
||||
case ALE_ALL:
|
||||
draw_summary_channel(draw_list, ale->data, ycenter, scale_factor, action_flag);
|
||||
draw_summary_channel(draw_list,
|
||||
static_cast<bAnimContext *>(ale->data),
|
||||
ycenter,
|
||||
scale_factor,
|
||||
action_flag);
|
||||
break;
|
||||
case ALE_SCE:
|
||||
draw_scene_channel(draw_list, ads, ale->key_data, ycenter, scale_factor, action_flag);
|
||||
draw_scene_channel(draw_list,
|
||||
ads,
|
||||
static_cast<Scene *>(ale->key_data),
|
||||
ycenter,
|
||||
scale_factor,
|
||||
action_flag);
|
||||
break;
|
||||
case ALE_OB:
|
||||
draw_object_channel(draw_list, ads, ale->key_data, ycenter, scale_factor, action_flag);
|
||||
draw_object_channel(draw_list,
|
||||
ads,
|
||||
static_cast<Object *>(ale->key_data),
|
||||
ycenter,
|
||||
scale_factor,
|
||||
action_flag);
|
||||
break;
|
||||
case ALE_ACT:
|
||||
draw_action_channel(draw_list, adt, ale->key_data, ycenter, scale_factor, action_flag);
|
||||
draw_action_channel(draw_list,
|
||||
adt,
|
||||
static_cast<bAction *>(ale->key_data),
|
||||
ycenter,
|
||||
scale_factor,
|
||||
action_flag);
|
||||
break;
|
||||
case ALE_GROUP:
|
||||
draw_agroup_channel(draw_list, adt, ale->data, ycenter, scale_factor, action_flag);
|
||||
draw_agroup_channel(draw_list,
|
||||
adt,
|
||||
static_cast<bActionGroup *>(ale->data),
|
||||
ycenter,
|
||||
scale_factor,
|
||||
action_flag);
|
||||
break;
|
||||
case ALE_FCURVE:
|
||||
draw_fcurve_channel(draw_list, adt, ale->key_data, ycenter, scale_factor, action_flag);
|
||||
draw_fcurve_channel(draw_list,
|
||||
adt,
|
||||
static_cast<FCurve *>(ale->key_data),
|
||||
ycenter,
|
||||
scale_factor,
|
||||
action_flag);
|
||||
break;
|
||||
case ALE_GPFRAME:
|
||||
draw_gpl_channel(draw_list, ads, ale->data, ycenter, scale_factor, action_flag);
|
||||
draw_gpl_channel(draw_list,
|
||||
ads,
|
||||
static_cast<bGPDlayer *>(ale->data),
|
||||
ycenter,
|
||||
scale_factor,
|
||||
action_flag);
|
||||
break;
|
||||
case ALE_MASKLAY:
|
||||
draw_masklay_channel(draw_list, ads, ale->data, ycenter, scale_factor, action_flag);
|
||||
draw_masklay_channel(draw_list,
|
||||
ads,
|
||||
static_cast<MaskLayer *>(ale->data),
|
||||
ycenter,
|
||||
scale_factor,
|
||||
action_flag);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -630,7 +676,7 @@ static void timeline_cache_draw_single(PTCacheID *pid, float y_offset, float hei
|
|||
|
||||
void timeline_draw_cache(SpaceAction *saction, Object *ob, Scene *scene)
|
||||
{
|
||||
if ((saction->cache_display & TIME_CACHE_DISPLAY) == 0 || ob == NULL) {
|
||||
if ((saction->cache_display & TIME_CACHE_DISPLAY) == 0 || ob == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -651,7 +697,7 @@ void timeline_draw_cache(SpaceAction *saction, Object *ob, Scene *scene)
|
|||
continue;
|
||||
}
|
||||
|
||||
if (pid->cache->cached_frames == NULL) {
|
||||
if (pid->cache->cached_frames == nullptr) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -5,10 +5,10 @@
|
|||
* \ingroup spaction
|
||||
*/
|
||||
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <cfloat>
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include "BLI_blenlib.h"
|
||||
#include "BLI_math.h"
|
||||
|
@ -52,7 +52,7 @@
|
|||
|
||||
#include "UI_interface.h"
|
||||
|
||||
#include "action_intern.h"
|
||||
#include "action_intern.hh"
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Pose Markers: Localize Markers
|
||||
|
@ -69,7 +69,7 @@ static bool act_markers_make_local_poll(bContext *C)
|
|||
SpaceAction *sact = CTX_wm_space_action(C);
|
||||
|
||||
/* 1) */
|
||||
if (sact == NULL) {
|
||||
if (sact == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -77,7 +77,7 @@ static bool act_markers_make_local_poll(bContext *C)
|
|||
if (ELEM(sact->mode, SACTCONT_ACTION, SACTCONT_SHAPEKEY) == 0) {
|
||||
return 0;
|
||||
}
|
||||
if (sact->action == NULL) {
|
||||
if (sact->action == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -87,25 +87,25 @@ static bool act_markers_make_local_poll(bContext *C)
|
|||
}
|
||||
|
||||
/* 4) */
|
||||
return ED_markers_get_first_selected(ED_context_get_markers(C)) != NULL;
|
||||
return ED_markers_get_first_selected(ED_context_get_markers(C)) != nullptr;
|
||||
}
|
||||
|
||||
static int act_markers_make_local_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
static int act_markers_make_local_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
ListBase *markers = ED_context_get_markers(C);
|
||||
|
||||
SpaceAction *sact = CTX_wm_space_action(C);
|
||||
bAction *act = (sact) ? sact->action : NULL;
|
||||
bAction *act = (sact) ? sact->action : nullptr;
|
||||
|
||||
TimeMarker *marker, *markern = NULL;
|
||||
TimeMarker *marker, *markern = nullptr;
|
||||
|
||||
/* sanity checks */
|
||||
if (ELEM(NULL, markers, act)) {
|
||||
if (ELEM(nullptr, markers, act)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
/* migrate markers */
|
||||
for (marker = markers->first; marker; marker = markern) {
|
||||
for (marker = static_cast<TimeMarker *>(markers->first); marker; marker = markern) {
|
||||
markern = marker->next;
|
||||
|
||||
/* move if marker is selected */
|
||||
|
@ -120,8 +120,8 @@ static int act_markers_make_local_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
sact->flag |= SACTION_POSEMARKERS_SHOW;
|
||||
|
||||
/* notifiers - both sets, as this change affects both */
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, NULL);
|
||||
WM_event_add_notifier(C, NC_SCENE | ND_MARKERS, nullptr);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_MARKERS, nullptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -150,9 +150,9 @@ void ACTION_OT_markers_make_local(wmOperatorType *ot)
|
|||
/* Get the min/max keyframes. */
|
||||
static bool get_keyframe_extents(bAnimContext *ac, float *min, float *max, const short onlySel)
|
||||
{
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
ListBase anim_data = {nullptr, nullptr};
|
||||
bAnimListElem *ale;
|
||||
int filter;
|
||||
eAnimFilter_Flags filter;
|
||||
bool found = false;
|
||||
|
||||
/* get data to filter, from Action or Dopesheet */
|
||||
|
@ -160,7 +160,7 @@ static bool get_keyframe_extents(bAnimContext *ac, float *min, float *max, const
|
|||
* Commented it, was breaking things (eg. the "auto preview range" tool). */
|
||||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE /*| ANIMFILTER_SEL */ |
|
||||
ANIMFILTER_NODUPLIS);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, eAnimCont_Types(ac->datatype));
|
||||
|
||||
/* set large values to try to override */
|
||||
*min = 999999999.0f;
|
||||
|
@ -169,14 +169,14 @@ static bool get_keyframe_extents(bAnimContext *ac, float *min, float *max, const
|
|||
/* check if any channels to set range with */
|
||||
if (anim_data.first) {
|
||||
/* go through channels, finding max extents */
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
for (ale = static_cast<bAnimListElem *>(anim_data.first); ale; ale = ale->next) {
|
||||
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
|
||||
if (ale->datatype == ALE_GPFRAME) {
|
||||
bGPDlayer *gpl = ale->data;
|
||||
bGPDlayer *gpl = static_cast<bGPDlayer *>(ale->data);
|
||||
bGPDframe *gpf;
|
||||
|
||||
/* Find gp-frame which is less than or equal to current-frame. */
|
||||
for (gpf = gpl->frames.first; gpf; gpf = gpf->next) {
|
||||
for (gpf = static_cast<bGPDframe *>(gpl->frames.first); gpf; gpf = gpf->next) {
|
||||
if (!onlySel || (gpf->flag & GP_FRAME_SELECT)) {
|
||||
const float framenum = (float)gpf->framenum;
|
||||
*min = min_ff(*min, framenum);
|
||||
|
@ -186,11 +186,12 @@ static bool get_keyframe_extents(bAnimContext *ac, float *min, float *max, const
|
|||
}
|
||||
}
|
||||
else if (ale->datatype == ALE_MASKLAY) {
|
||||
MaskLayer *masklay = ale->data;
|
||||
MaskLayer *masklay = static_cast<MaskLayer *>(ale->data);
|
||||
MaskLayerShape *masklay_shape;
|
||||
|
||||
/* Find mask layer which is less than or equal to current-frame. */
|
||||
for (masklay_shape = masklay->splines_shapes.first; masklay_shape;
|
||||
for (masklay_shape = static_cast<MaskLayerShape *>(masklay->splines_shapes.first);
|
||||
masklay_shape;
|
||||
masklay_shape = masklay_shape->next) {
|
||||
const float framenum = (float)masklay_shape->frame;
|
||||
*min = min_ff(*min, framenum);
|
||||
|
@ -248,7 +249,7 @@ static bool get_keyframe_extents(bAnimContext *ac, float *min, float *max, const
|
|||
/** \name View: Automatic Preview-Range Operator
|
||||
* \{ */
|
||||
|
||||
static int actkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
static int actkeys_previewrange_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
bAnimContext ac;
|
||||
Scene *scene;
|
||||
|
@ -258,7 +259,7 @@ static int actkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
if (ANIM_animdata_get_context(C, &ac) == 0) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
if (ac.scene == NULL) {
|
||||
if (ac.scene == nullptr) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
|
@ -311,21 +312,22 @@ void ACTION_OT_previewrange_set(wmOperatorType *ot)
|
|||
*/
|
||||
static bool actkeys_channels_get_selected_extents(bAnimContext *ac, float *r_min, float *r_max)
|
||||
{
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
ListBase anim_data = {nullptr, nullptr};
|
||||
bAnimListElem *ale;
|
||||
int filter;
|
||||
eAnimFilter_Flags filter;
|
||||
|
||||
/* NOTE: not bool, since we want prioritize individual channels over expanders. */
|
||||
short found = 0;
|
||||
|
||||
/* get all items - we need to do it this way */
|
||||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_LIST_CHANNELS);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, eAnimCont_Types(ac->datatype));
|
||||
|
||||
/* loop through all channels, finding the first one that's selected */
|
||||
float ymax = ANIM_UI_get_first_channel_top(&ac->region->v2d);
|
||||
const float channel_step = ANIM_UI_get_channel_step();
|
||||
for (ale = anim_data.first; ale; ale = ale->next, ymax -= channel_step) {
|
||||
for (ale = static_cast<bAnimListElem *>(anim_data.first); ale;
|
||||
ale = ale->next, ymax -= channel_step) {
|
||||
const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
|
||||
|
||||
/* must be selected... */
|
||||
|
@ -407,7 +409,7 @@ static int actkeys_viewall(bContext *C, const bool only_sel)
|
|||
float ymid = (ymax - ymin) / 2.0f + ymin;
|
||||
float x_center;
|
||||
|
||||
UI_view2d_center_get(v2d, &x_center, NULL);
|
||||
UI_view2d_center_get(v2d, &x_center, nullptr);
|
||||
UI_view2d_center_set(v2d, x_center, ymid);
|
||||
}
|
||||
}
|
||||
|
@ -423,13 +425,13 @@ static int actkeys_viewall(bContext *C, const bool only_sel)
|
|||
|
||||
/* ......... */
|
||||
|
||||
static int actkeys_viewall_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
static int actkeys_viewall_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
/* whole range */
|
||||
return actkeys_viewall(C, false);
|
||||
}
|
||||
|
||||
static int actkeys_viewsel_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
static int actkeys_viewsel_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
/* only selected */
|
||||
return actkeys_viewall(C, true);
|
||||
|
@ -506,8 +508,9 @@ void ACTION_OT_view_frame(wmOperatorType *ot)
|
|||
|
||||
static short copy_action_keys(bAnimContext *ac)
|
||||
{
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
int filter, ok = 0;
|
||||
ListBase anim_data = {nullptr, nullptr};
|
||||
eAnimFilter_Flags filter;
|
||||
short ok = 0;
|
||||
|
||||
/* clear buffer first */
|
||||
ANIM_fcurves_copybuf_free();
|
||||
|
@ -515,7 +518,7 @@ static short copy_action_keys(bAnimContext *ac)
|
|||
/* filter data */
|
||||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FCURVESONLY |
|
||||
ANIMFILTER_NODUPLIS);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, eAnimCont_Types(ac->datatype));
|
||||
|
||||
/* copy keyframes */
|
||||
ok = copy_animedit_keys(ac, &anim_data);
|
||||
|
@ -531,8 +534,8 @@ static eKeyPasteError paste_action_keys(bAnimContext *ac,
|
|||
const eKeyMergeMode merge_mode,
|
||||
bool flip)
|
||||
{
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
int filter;
|
||||
ListBase anim_data = {nullptr, nullptr};
|
||||
eAnimFilter_Flags filter;
|
||||
|
||||
/* filter data
|
||||
* - First time we try to filter more strictly, allowing only selected channels
|
||||
|
@ -543,8 +546,9 @@ static eKeyPasteError paste_action_keys(bAnimContext *ac,
|
|||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT |
|
||||
ANIMFILTER_FCURVESONLY | ANIMFILTER_NODUPLIS);
|
||||
|
||||
if (ANIM_animdata_filter(ac, &anim_data, filter | ANIMFILTER_SEL, ac->data, ac->datatype) == 0) {
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
if (ANIM_animdata_filter(
|
||||
ac, &anim_data, filter | ANIMFILTER_SEL, ac->data, eAnimCont_Types(ac->datatype)) == 0) {
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, eAnimCont_Types(ac->datatype));
|
||||
}
|
||||
|
||||
/* Value offset is always None because the user cannot see the effect of it. */
|
||||
|
@ -614,8 +618,8 @@ static int actkeys_paste_exec(bContext *C, wmOperator *op)
|
|||
{
|
||||
bAnimContext ac;
|
||||
|
||||
const eKeyPasteOffset offset_mode = RNA_enum_get(op->ptr, "offset");
|
||||
const eKeyMergeMode merge_mode = RNA_enum_get(op->ptr, "merge");
|
||||
const eKeyPasteOffset offset_mode = eKeyPasteOffset(RNA_enum_get(op->ptr, "offset"));
|
||||
const eKeyMergeMode merge_mode = eKeyMergeMode(RNA_enum_get(op->ptr, "merge"));
|
||||
const bool flipped = RNA_boolean_get(op->ptr, "flipped");
|
||||
|
||||
bool gpframes_inbuf = false;
|
||||
|
@ -668,17 +672,15 @@ static int actkeys_paste_exec(bContext *C, wmOperator *op)
|
|||
|
||||
/* Grease Pencil needs extra update to refresh the added keyframes. */
|
||||
if (ac.datatype == ANIMCONT_GPENCIL || gpframes_inbuf) {
|
||||
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA, NULL);
|
||||
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA, nullptr);
|
||||
}
|
||||
/* set notifier that keyframes have changed */
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, nullptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
static char *actkeys_paste_description(bContext *UNUSED(C),
|
||||
wmOperatorType *UNUSED(op),
|
||||
PointerRNA *ptr)
|
||||
static char *actkeys_paste_description(bContext * /*C*/, wmOperatorType * /*op*/, PointerRNA *ptr)
|
||||
{
|
||||
/* Custom description if the 'flipped' option is used. */
|
||||
if (RNA_boolean_get(ptr, "flipped")) {
|
||||
|
@ -686,7 +688,7 @@ static char *actkeys_paste_description(bContext *UNUSED(C),
|
|||
}
|
||||
|
||||
/* Use the default description in the other cases. */
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ACTION_OT_paste(wmOperatorType *ot)
|
||||
|
@ -738,7 +740,7 @@ static const EnumPropertyItem prop_actkeys_insertkey_types[] = {
|
|||
{2, "SEL", 0, "Only Selected Channels", ""},
|
||||
/* XXX not in all cases. */
|
||||
{3, "GROUP", 0, "In Active Group", ""},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
static void insert_gpencil_key(bAnimContext *ac,
|
||||
|
@ -770,10 +772,10 @@ static void insert_fcurve_key(bAnimContext *ac,
|
|||
ToolSettings *ts = scene->toolsettings;
|
||||
|
||||
/* Read value from property the F-Curve represents, or from the curve only?
|
||||
* - ale->id != NULL:
|
||||
* - ale->id != nullptr:
|
||||
* Typically, this means that we have enough info to try resolving the path.
|
||||
*
|
||||
* - ale->owner != NULL:
|
||||
* - ale->owner != nullptr:
|
||||
* If this is set, then the path may not be resolvable from the ID alone,
|
||||
* so it's easier for now to just read the F-Curve directly.
|
||||
* (TODO: add the full-blown PointerRNA relative parsing case here...)
|
||||
|
@ -782,12 +784,12 @@ static void insert_fcurve_key(bAnimContext *ac,
|
|||
insert_keyframe(ac->bmain,
|
||||
reports,
|
||||
ale->id,
|
||||
NULL,
|
||||
((fcu->grp) ? (fcu->grp->name) : (NULL)),
|
||||
nullptr,
|
||||
((fcu->grp) ? (fcu->grp->name) : (nullptr)),
|
||||
fcu->rna_path,
|
||||
fcu->array_index,
|
||||
&anim_eval_context,
|
||||
ts->keyframe_type,
|
||||
eBezTriple_KeyframeType(ts->keyframe_type),
|
||||
nla_cache,
|
||||
flag);
|
||||
}
|
||||
|
@ -801,7 +803,8 @@ static void insert_fcurve_key(bAnimContext *ac,
|
|||
}
|
||||
|
||||
const float curval = evaluate_fcurve(fcu, cfra);
|
||||
insert_vert_fcurve(fcu, cfra, curval, ts->keyframe_type, 0);
|
||||
insert_vert_fcurve(
|
||||
fcu, cfra, curval, eBezTriple_KeyframeType(ts->keyframe_type), eInsertKeyFlags(0));
|
||||
}
|
||||
|
||||
ale->update |= ANIM_UPDATE_DEFAULT;
|
||||
|
@ -810,17 +813,17 @@ static void insert_fcurve_key(bAnimContext *ac,
|
|||
/* this function is responsible for inserting new keyframes */
|
||||
static void insert_action_keys(bAnimContext *ac, short mode)
|
||||
{
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
ListBase nla_cache = {NULL, NULL};
|
||||
ListBase anim_data = {nullptr, nullptr};
|
||||
ListBase nla_cache = {nullptr, nullptr};
|
||||
bAnimListElem *ale;
|
||||
int filter;
|
||||
eAnimFilter_Flags filter;
|
||||
|
||||
Scene *scene = ac->scene;
|
||||
ToolSettings *ts = scene->toolsettings;
|
||||
eInsertKeyFlags flag;
|
||||
|
||||
eGP_GetFrame_Mode add_frame_mode;
|
||||
bGPdata *gpd_old = NULL;
|
||||
bGPdata *gpd_old = nullptr;
|
||||
|
||||
/* filter data */
|
||||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT |
|
||||
|
@ -832,7 +835,7 @@ static void insert_action_keys(bAnimContext *ac, short mode)
|
|||
filter |= ANIMFILTER_ACTGROUPED;
|
||||
}
|
||||
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, eAnimCont_Types(ac->datatype));
|
||||
|
||||
/* Init keyframing flag. */
|
||||
flag = ANIM_get_keyframing_flags(scene, true);
|
||||
|
@ -848,7 +851,7 @@ static void insert_action_keys(bAnimContext *ac, short mode)
|
|||
/* insert keyframes */
|
||||
const AnimationEvalContext anim_eval_context = BKE_animsys_eval_context_construct(
|
||||
ac->depsgraph, (float)scene->r.cfra);
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
for (ale = static_cast<bAnimListElem *>(anim_data.first); ale; ale = ale->next) {
|
||||
switch (ale->type) {
|
||||
case ANIMTYPE_GPLAYER:
|
||||
insert_gpencil_key(ac, ale, add_frame_mode, &gpd_old);
|
||||
|
@ -894,9 +897,9 @@ static int actkeys_insertkey_exec(bContext *C, wmOperator *op)
|
|||
|
||||
/* set notifier that keyframes have changed */
|
||||
if (ac.datatype == ANIMCONT_GPENCIL) {
|
||||
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL);
|
||||
WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, nullptr);
|
||||
}
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_ADDED, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_ADDED, nullptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -928,18 +931,18 @@ void ACTION_OT_keyframe_insert(wmOperatorType *ot)
|
|||
|
||||
static bool duplicate_action_keys(bAnimContext *ac)
|
||||
{
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
ListBase anim_data = {nullptr, nullptr};
|
||||
bAnimListElem *ale;
|
||||
int filter;
|
||||
eAnimFilter_Flags filter;
|
||||
bool changed = false;
|
||||
|
||||
/* filter data */
|
||||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT |
|
||||
ANIMFILTER_NODUPLIS);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, eAnimCont_Types(ac->datatype));
|
||||
|
||||
/* loop through filtered data and delete selected keys */
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
for (ale = static_cast<bAnimListElem *>(anim_data.first); ale; ale = ale->next) {
|
||||
if (ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE)) {
|
||||
changed |= duplicate_fcurve_keys((FCurve *)ale->key_data);
|
||||
}
|
||||
|
@ -965,7 +968,7 @@ static bool duplicate_action_keys(bAnimContext *ac)
|
|||
|
||||
/* ------------------- */
|
||||
|
||||
static int actkeys_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
static int actkeys_duplicate_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
bAnimContext ac;
|
||||
|
||||
|
@ -980,7 +983,7 @@ static int actkeys_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
}
|
||||
|
||||
/* set notifier that keyframes have changed */
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_ADDED, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_ADDED, nullptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -1008,18 +1011,18 @@ void ACTION_OT_duplicate(wmOperatorType *ot)
|
|||
|
||||
static bool delete_action_keys(bAnimContext *ac)
|
||||
{
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
ListBase anim_data = {nullptr, nullptr};
|
||||
bAnimListElem *ale;
|
||||
int filter;
|
||||
eAnimFilter_Flags filter;
|
||||
bool changed_final = false;
|
||||
|
||||
/* filter data */
|
||||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT |
|
||||
ANIMFILTER_NODUPLIS);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, eAnimCont_Types(ac->datatype));
|
||||
|
||||
/* loop through filtered data and delete selected keys */
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
for (ale = static_cast<bAnimListElem *>(anim_data.first); ale; ale = ale->next) {
|
||||
bool changed = false;
|
||||
|
||||
if (ale->type == ANIMTYPE_GPLAYER) {
|
||||
|
@ -1038,7 +1041,7 @@ static bool delete_action_keys(bAnimContext *ac)
|
|||
/* Only delete curve too if it won't be doing anything anymore */
|
||||
if (BKE_fcurve_is_empty(fcu)) {
|
||||
ANIM_fcurve_delete_from_animdata(ac, adt, fcu);
|
||||
ale->key_data = NULL;
|
||||
ale->key_data = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1056,7 +1059,7 @@ static bool delete_action_keys(bAnimContext *ac)
|
|||
|
||||
/* ------------------- */
|
||||
|
||||
static int actkeys_delete_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
static int actkeys_delete_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
bAnimContext ac;
|
||||
|
||||
|
@ -1071,7 +1074,7 @@ static int actkeys_delete_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
}
|
||||
|
||||
/* set notifier that keyframes have changed */
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_REMOVED, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_REMOVED, nullptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -1101,17 +1104,17 @@ void ACTION_OT_delete(wmOperatorType *ot)
|
|||
|
||||
static void clean_action_keys(bAnimContext *ac, float thresh, bool clean_chan)
|
||||
{
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
ListBase anim_data = {nullptr, nullptr};
|
||||
bAnimListElem *ale;
|
||||
int filter;
|
||||
eAnimFilter_Flags filter;
|
||||
|
||||
/* filter data */
|
||||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT |
|
||||
ANIMFILTER_SEL | ANIMFILTER_FCURVESONLY | ANIMFILTER_NODUPLIS);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, eAnimCont_Types(ac->datatype));
|
||||
|
||||
/* loop through filtered data and clean curves */
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
for (ale = static_cast<bAnimListElem *>(anim_data.first); ale; ale = ale->next) {
|
||||
clean_fcurve(ac, ale, thresh, clean_chan);
|
||||
|
||||
ale->update |= ANIM_UPDATE_DEFAULT;
|
||||
|
@ -1147,7 +1150,7 @@ static int actkeys_clean_exec(bContext *C, wmOperator *op)
|
|||
clean_action_keys(&ac, thresh, clean_chan);
|
||||
|
||||
/* set notifier that keyframes have changed */
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, nullptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -1182,17 +1185,17 @@ void ACTION_OT_clean(wmOperatorType *ot)
|
|||
/* Evaluates the curves between each selected keyframe on each frame, and keys the value. */
|
||||
static void sample_action_keys(bAnimContext *ac)
|
||||
{
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
ListBase anim_data = {nullptr, nullptr};
|
||||
bAnimListElem *ale;
|
||||
int filter;
|
||||
eAnimFilter_Flags filter;
|
||||
|
||||
/* filter data */
|
||||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT |
|
||||
ANIMFILTER_FCURVESONLY | ANIMFILTER_NODUPLIS);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, eAnimCont_Types(ac->datatype));
|
||||
|
||||
/* Loop through filtered data and add keys between selected keyframes on every frame. */
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
for (ale = static_cast<bAnimListElem *>(anim_data.first); ale; ale = ale->next) {
|
||||
sample_fcurve((FCurve *)ale->key_data);
|
||||
|
||||
ale->update |= ANIM_UPDATE_DEPS;
|
||||
|
@ -1222,7 +1225,7 @@ static int actkeys_sample_exec(bContext *C, wmOperator *op)
|
|||
sample_action_keys(&ac);
|
||||
|
||||
/* set notifier that keyframes have changed */
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, nullptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -1275,23 +1278,23 @@ static const EnumPropertyItem prop_actkeys_expo_types[] = {
|
|||
0,
|
||||
"Clear Cyclic (F-Modifier)",
|
||||
"Remove Cycles F-Modifier if not needed anymore"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
/* this function is responsible for setting extrapolation mode for keyframes */
|
||||
static void setexpo_action_keys(bAnimContext *ac, short mode)
|
||||
{
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
ListBase anim_data = {nullptr, nullptr};
|
||||
bAnimListElem *ale;
|
||||
int filter;
|
||||
eAnimFilter_Flags filter;
|
||||
|
||||
/* filter data */
|
||||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT |
|
||||
ANIMFILTER_SEL | ANIMFILTER_FCURVESONLY | ANIMFILTER_NODUPLIS);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, eAnimCont_Types(ac->datatype));
|
||||
|
||||
/* loop through setting mode per F-Curve */
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
for (ale = static_cast<bAnimListElem *>(anim_data.first); ale; ale = ale->next) {
|
||||
FCurve *fcu = (FCurve *)ale->data;
|
||||
|
||||
if (mode >= 0) {
|
||||
|
@ -1311,9 +1314,9 @@ static void setexpo_action_keys(bAnimContext *ac, short mode)
|
|||
}
|
||||
else if (mode == CLEAR_CYCLIC_EXPO) {
|
||||
/* remove all the modifiers fitting this description */
|
||||
FModifier *fcm, *fcn = NULL;
|
||||
FModifier *fcm, *fcn = nullptr;
|
||||
|
||||
for (fcm = fcu->modifiers.first; fcm; fcm = fcn) {
|
||||
for (fcm = static_cast<FModifier *>(fcu->modifiers.first); fcm; fcm = fcn) {
|
||||
fcn = fcm->next;
|
||||
|
||||
if (fcm->type == FMODIFIER_TYPE_CYCLES) {
|
||||
|
@ -1354,7 +1357,7 @@ static int actkeys_expo_exec(bContext *C, wmOperator *op)
|
|||
setexpo_action_keys(&ac, mode);
|
||||
|
||||
/* set notifier that keyframe properties have changed */
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME_PROP, nullptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -1410,7 +1413,7 @@ static int actkeys_ipo_exec(bContext *C, wmOperator *op)
|
|||
ANIM_editkeyframes_ipo(mode));
|
||||
|
||||
/* set notifier that keyframe properties have changed */
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME_PROP, nullptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -1464,7 +1467,7 @@ static int actkeys_easing_exec(bContext *C, wmOperator *op)
|
|||
ANIM_editkeyframes_easing(mode));
|
||||
|
||||
/* set notifier that keyframe properties have changed */
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME_PROP, nullptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -1499,9 +1502,9 @@ void ACTION_OT_easing_type(wmOperatorType *ot)
|
|||
/* this function is responsible for setting handle-type of selected keyframes */
|
||||
static void sethandles_action_keys(bAnimContext *ac, short mode)
|
||||
{
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
ListBase anim_data = {nullptr, nullptr};
|
||||
bAnimListElem *ale;
|
||||
int filter;
|
||||
eAnimFilter_Flags filter;
|
||||
|
||||
KeyframeEditFunc edit_cb = ANIM_editkeyframes_handles(mode);
|
||||
KeyframeEditFunc sel_cb = ANIM_editkeyframes_ok(BEZT_OK_SELECTED);
|
||||
|
@ -1509,19 +1512,19 @@ static void sethandles_action_keys(bAnimContext *ac, short mode)
|
|||
/* filter data */
|
||||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT |
|
||||
ANIMFILTER_FCURVESONLY | ANIMFILTER_NODUPLIS);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, eAnimCont_Types(ac->datatype));
|
||||
|
||||
/* Loop through setting flags for handles
|
||||
* NOTE: we do not supply KeyframeEditData to the looper yet.
|
||||
* Currently that's not necessary here.
|
||||
*/
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
for (ale = static_cast<bAnimListElem *>(anim_data.first); ale; ale = ale->next) {
|
||||
FCurve *fcu = (FCurve *)ale->key_data;
|
||||
|
||||
/* any selected keyframes for editing? */
|
||||
if (ANIM_fcurve_keyframes_loop(NULL, fcu, NULL, sel_cb, NULL)) {
|
||||
if (ANIM_fcurve_keyframes_loop(nullptr, fcu, nullptr, sel_cb, nullptr)) {
|
||||
/* change type of selected handles */
|
||||
ANIM_fcurve_keyframes_loop(NULL, fcu, NULL, edit_cb, BKE_fcurve_handles_recalc);
|
||||
ANIM_fcurve_keyframes_loop(nullptr, fcu, nullptr, edit_cb, BKE_fcurve_handles_recalc);
|
||||
|
||||
ale->update |= ANIM_UPDATE_DEFAULT;
|
||||
}
|
||||
|
@ -1555,7 +1558,7 @@ static int actkeys_handletype_exec(bContext *C, wmOperator *op)
|
|||
sethandles_action_keys(&ac, mode);
|
||||
|
||||
/* set notifier that keyframe properties have changed */
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME_PROP, nullptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -1588,29 +1591,30 @@ void ACTION_OT_handle_type(wmOperatorType *ot)
|
|||
/* this function is responsible for setting keyframe type for keyframes */
|
||||
static void setkeytype_action_keys(bAnimContext *ac, short mode)
|
||||
{
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
ListBase anim_data = {nullptr, nullptr};
|
||||
bAnimListElem *ale;
|
||||
int filter;
|
||||
eAnimFilter_Flags filter;
|
||||
KeyframeEditFunc set_cb = ANIM_editkeyframes_keytype(mode);
|
||||
|
||||
/* filter data */
|
||||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT |
|
||||
ANIMFILTER_NODUPLIS);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, eAnimCont_Types(ac->datatype));
|
||||
|
||||
/* Loop through setting BezTriple interpolation
|
||||
* NOTE: we do not supply KeyframeEditData to the looper yet.
|
||||
* Currently that's not necessary here.
|
||||
*/
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
for (ale = static_cast<bAnimListElem *>(anim_data.first); ale; ale = ale->next) {
|
||||
switch (ale->type) {
|
||||
case ANIMTYPE_GPLAYER:
|
||||
ED_gpencil_layer_frames_keytype_set(ale->data, mode);
|
||||
ED_gpencil_layer_frames_keytype_set(static_cast<bGPDlayer *>(ale->data), mode);
|
||||
ale->update |= ANIM_UPDATE_DEPS;
|
||||
break;
|
||||
|
||||
case ANIMTYPE_FCURVE:
|
||||
ANIM_fcurve_keyframes_loop(NULL, ale->key_data, NULL, set_cb, NULL);
|
||||
ANIM_fcurve_keyframes_loop(
|
||||
nullptr, static_cast<FCurve *>(ale->key_data), nullptr, set_cb, nullptr);
|
||||
ale->update |= ANIM_UPDATE_DEPS | ANIM_UPDATE_HANDLES;
|
||||
break;
|
||||
|
||||
|
@ -1647,7 +1651,7 @@ static int actkeys_keytype_exec(bContext *C, wmOperator *op)
|
|||
setkeytype_action_keys(&ac, mode);
|
||||
|
||||
/* set notifier that keyframe properties have changed */
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME_PROP, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME_PROP, nullptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -1688,13 +1692,13 @@ static bool actkeys_framejump_poll(bContext *C)
|
|||
}
|
||||
|
||||
/* snap current-frame indicator to 'average time' of selected keyframe */
|
||||
static int actkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
static int actkeys_framejump_exec(bContext *C, wmOperator * /*op*/)
|
||||
{
|
||||
bAnimContext ac;
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
ListBase anim_data = {nullptr, nullptr};
|
||||
bAnimListElem *ale;
|
||||
int filter;
|
||||
KeyframeEditData ked = {{NULL}};
|
||||
eAnimFilter_Flags filter;
|
||||
KeyframeEditData ked = {{nullptr}};
|
||||
|
||||
/* get editor data */
|
||||
if (ANIM_animdata_get_context(C, &ac) == 0) {
|
||||
|
@ -1704,15 +1708,15 @@ static int actkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
/* init edit data */
|
||||
/* loop over action data, averaging values */
|
||||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_NODUPLIS);
|
||||
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
|
||||
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, eAnimCont_Types(ac.datatype));
|
||||
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
for (ale = static_cast<bAnimListElem *>(anim_data.first); ale; ale = ale->next) {
|
||||
switch (ale->datatype) {
|
||||
case ALE_GPFRAME: {
|
||||
bGPDlayer *gpl = ale->data;
|
||||
bGPDlayer *gpl = static_cast<bGPDlayer *>(ale->data);
|
||||
bGPDframe *gpf;
|
||||
|
||||
for (gpf = gpl->frames.first; gpf; gpf = gpf->next) {
|
||||
for (gpf = static_cast<bGPDframe *>(gpl->frames.first); gpf; gpf = gpf->next) {
|
||||
/* only if selected */
|
||||
if (!(gpf->flag & GP_FRAME_SELECT)) {
|
||||
continue;
|
||||
|
@ -1728,13 +1732,14 @@ static int actkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op))
|
|||
|
||||
case ALE_FCURVE: {
|
||||
AnimData *adt = ANIM_nla_mapping_get(&ac, ale);
|
||||
FCurve *fcurve = static_cast<FCurve *>(ale->key_data);
|
||||
if (adt) {
|
||||
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 1);
|
||||
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, bezt_calc_average, NULL);
|
||||
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 1);
|
||||
ANIM_nla_mapping_apply_fcurve(adt, fcurve, 0, 1);
|
||||
ANIM_fcurve_keyframes_loop(&ked, fcurve, nullptr, bezt_calc_average, nullptr);
|
||||
ANIM_nla_mapping_apply_fcurve(adt, fcurve, 1, 1);
|
||||
}
|
||||
else {
|
||||
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, bezt_calc_average, NULL);
|
||||
ANIM_fcurve_keyframes_loop(&ked, fcurve, nullptr, bezt_calc_average, nullptr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1803,17 +1808,17 @@ static const EnumPropertyItem prop_actkeys_snap_types[] = {
|
|||
0,
|
||||
"Selection to Nearest Marker",
|
||||
"Snap selected keyframes to the nearest marker"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
/* this function is responsible for snapping keyframes to frame-times */
|
||||
static void snap_action_keys(bAnimContext *ac, short mode)
|
||||
{
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
ListBase anim_data = {nullptr, nullptr};
|
||||
bAnimListElem *ale;
|
||||
int filter;
|
||||
eAnimFilter_Flags filter;
|
||||
|
||||
KeyframeEditData ked = {{NULL}};
|
||||
KeyframeEditData ked = {{nullptr}};
|
||||
KeyframeEditFunc edit_cb;
|
||||
|
||||
/* filter data */
|
||||
|
@ -1824,38 +1829,40 @@ static void snap_action_keys(bAnimContext *ac, short mode)
|
|||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT |
|
||||
ANIMFILTER_NODUPLIS);
|
||||
}
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, eAnimCont_Types(ac->datatype));
|
||||
|
||||
/* get beztriple editing callbacks */
|
||||
edit_cb = ANIM_editkeyframes_snap(mode);
|
||||
|
||||
ked.scene = ac->scene;
|
||||
if (mode == ACTKEYS_SNAP_NEAREST_MARKER) {
|
||||
ked.list.first = (ac->markers) ? ac->markers->first : NULL;
|
||||
ked.list.last = (ac->markers) ? ac->markers->last : NULL;
|
||||
ked.list.first = (ac->markers) ? ac->markers->first : nullptr;
|
||||
ked.list.last = (ac->markers) ? ac->markers->last : nullptr;
|
||||
}
|
||||
|
||||
/* snap keyframes */
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
for (ale = static_cast<bAnimListElem *>(anim_data.first); ale; ale = ale->next) {
|
||||
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
|
||||
|
||||
if (ale->type == ANIMTYPE_GPLAYER) {
|
||||
ED_gpencil_layer_snap_frames(ale->data, ac->scene, mode);
|
||||
ED_gpencil_layer_snap_frames(static_cast<bGPDlayer *>(ale->data), ac->scene, mode);
|
||||
}
|
||||
else if (ale->type == ANIMTYPE_MASKLAYER) {
|
||||
ED_masklayer_snap_frames(ale->data, ac->scene, mode);
|
||||
ED_masklayer_snap_frames(static_cast<MaskLayer *>(ale->data), ac->scene, mode);
|
||||
}
|
||||
else if (adt) {
|
||||
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0);
|
||||
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, BKE_fcurve_handles_recalc);
|
||||
FCurve *fcurve = static_cast<FCurve *>(ale->key_data);
|
||||
ANIM_nla_mapping_apply_fcurve(adt, fcurve, 0, 0);
|
||||
ANIM_fcurve_keyframes_loop(&ked, fcurve, nullptr, edit_cb, BKE_fcurve_handles_recalc);
|
||||
BKE_fcurve_merge_duplicate_keys(
|
||||
ale->key_data, SELECT, false); /* only use handles in graph editor */
|
||||
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 0);
|
||||
fcurve, SELECT, false); /* only use handles in graph editor */
|
||||
ANIM_nla_mapping_apply_fcurve(adt, fcurve, 1, 0);
|
||||
}
|
||||
else {
|
||||
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, BKE_fcurve_handles_recalc);
|
||||
FCurve *fcurve = static_cast<FCurve *>(ale->key_data);
|
||||
ANIM_fcurve_keyframes_loop(&ked, fcurve, nullptr, edit_cb, BKE_fcurve_handles_recalc);
|
||||
BKE_fcurve_merge_duplicate_keys(
|
||||
ale->key_data, SELECT, false); /* only use handles in graph editor */
|
||||
fcurve, SELECT, false); /* only use handles in graph editor */
|
||||
}
|
||||
|
||||
ale->update |= ANIM_UPDATE_DEFAULT;
|
||||
|
@ -1884,7 +1891,7 @@ static int actkeys_snap_exec(bContext *C, wmOperator *op)
|
|||
snap_action_keys(&ac, mode);
|
||||
|
||||
/* set notifier that keyframes have changed */
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, nullptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
@ -1931,17 +1938,17 @@ static const EnumPropertyItem prop_actkeys_mirror_types[] = {
|
|||
0,
|
||||
"By Times Over First Selected Marker",
|
||||
"Flip times of selected keyframes using the first selected marker as the reference point"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
{0, nullptr, 0, nullptr, nullptr},
|
||||
};
|
||||
|
||||
/* this function is responsible for mirroring keyframes */
|
||||
static void mirror_action_keys(bAnimContext *ac, short mode)
|
||||
{
|
||||
ListBase anim_data = {NULL, NULL};
|
||||
ListBase anim_data = {nullptr, nullptr};
|
||||
bAnimListElem *ale;
|
||||
int filter;
|
||||
eAnimFilter_Flags filter;
|
||||
|
||||
KeyframeEditData ked = {{NULL}};
|
||||
KeyframeEditData ked = {{nullptr}};
|
||||
KeyframeEditFunc edit_cb;
|
||||
|
||||
/* get beztriple editing callbacks */
|
||||
|
@ -1965,25 +1972,27 @@ static void mirror_action_keys(bAnimContext *ac, short mode)
|
|||
/* filter data */
|
||||
filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_LIST_VISIBLE | ANIMFILTER_FOREDIT |
|
||||
ANIMFILTER_NODUPLIS);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
|
||||
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, eAnimCont_Types(ac->datatype));
|
||||
|
||||
/* mirror keyframes */
|
||||
for (ale = anim_data.first; ale; ale = ale->next) {
|
||||
for (ale = static_cast<bAnimListElem *>(anim_data.first); ale; ale = ale->next) {
|
||||
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
|
||||
|
||||
if (ale->type == ANIMTYPE_GPLAYER) {
|
||||
ED_gpencil_layer_mirror_frames(ale->data, ac->scene, mode);
|
||||
ED_gpencil_layer_mirror_frames(static_cast<bGPDlayer *>(ale->data), ac->scene, mode);
|
||||
}
|
||||
else if (ale->type == ANIMTYPE_MASKLAYER) {
|
||||
/* TODO */
|
||||
}
|
||||
else if (adt) {
|
||||
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 0, 0);
|
||||
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, BKE_fcurve_handles_recalc);
|
||||
ANIM_nla_mapping_apply_fcurve(adt, ale->key_data, 1, 0);
|
||||
FCurve *fcurve = static_cast<FCurve *>(ale->key_data);
|
||||
ANIM_nla_mapping_apply_fcurve(adt, fcurve, 0, 0);
|
||||
ANIM_fcurve_keyframes_loop(&ked, fcurve, nullptr, edit_cb, BKE_fcurve_handles_recalc);
|
||||
ANIM_nla_mapping_apply_fcurve(adt, fcurve, 1, 0);
|
||||
}
|
||||
else {
|
||||
ANIM_fcurve_keyframes_loop(&ked, ale->key_data, NULL, edit_cb, BKE_fcurve_handles_recalc);
|
||||
ANIM_fcurve_keyframes_loop(
|
||||
&ked, static_cast<FCurve *>(ale->key_data), nullptr, edit_cb, BKE_fcurve_handles_recalc);
|
||||
}
|
||||
|
||||
ale->update |= ANIM_UPDATE_DEFAULT;
|
||||
|
@ -2012,7 +2021,7 @@ static int actkeys_mirror_exec(bContext *C, wmOperator *op)
|
|||
mirror_action_keys(&ac, mode);
|
||||
|
||||
/* set notifier that keyframes have changed */
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, NULL);
|
||||
WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_EDITED, nullptr);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
|
@ -1,135 +0,0 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
* Copyright 2008 Blender Foundation. All rights reserved. */
|
||||
|
||||
/** \file
|
||||
* \ingroup spaction
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
struct ARegion;
|
||||
struct ARegionType;
|
||||
struct Object;
|
||||
struct Scene;
|
||||
struct SpaceAction;
|
||||
struct bAnimContext;
|
||||
struct bContext;
|
||||
struct wmOperatorType;
|
||||
|
||||
/* internal exports only */
|
||||
|
||||
/* **************************************** */
|
||||
/* space_action.c / action_buttons.c */
|
||||
|
||||
void action_buttons_register(struct ARegionType *art);
|
||||
|
||||
/* ***************************************** */
|
||||
/* action_draw.c */
|
||||
|
||||
/**
|
||||
* Left hand part.
|
||||
*/
|
||||
void draw_channel_names(struct bContext *C, struct bAnimContext *ac, struct ARegion *region);
|
||||
/**
|
||||
* Draw keyframes in each channel.
|
||||
*/
|
||||
void draw_channel_strips(struct bAnimContext *ac,
|
||||
struct SpaceAction *saction,
|
||||
struct ARegion *region);
|
||||
|
||||
void timeline_draw_cache(struct SpaceAction *saction, struct Object *ob, struct Scene *scene);
|
||||
|
||||
/* ***************************************** */
|
||||
/* action_select.c */
|
||||
|
||||
void ACTION_OT_select_all(struct wmOperatorType *ot);
|
||||
void ACTION_OT_select_box(struct wmOperatorType *ot);
|
||||
void ACTION_OT_select_lasso(struct wmOperatorType *ot);
|
||||
void ACTION_OT_select_circle(struct wmOperatorType *ot);
|
||||
void ACTION_OT_select_column(struct wmOperatorType *ot);
|
||||
void ACTION_OT_select_linked(struct wmOperatorType *ot);
|
||||
void ACTION_OT_select_more(struct wmOperatorType *ot);
|
||||
void ACTION_OT_select_less(struct wmOperatorType *ot);
|
||||
void ACTION_OT_select_leftright(struct wmOperatorType *ot);
|
||||
void ACTION_OT_clickselect(struct wmOperatorType *ot);
|
||||
|
||||
/* defines for left-right select tool */
|
||||
enum eActKeys_LeftRightSelect_Mode {
|
||||
ACTKEYS_LRSEL_TEST = 0,
|
||||
ACTKEYS_LRSEL_LEFT,
|
||||
ACTKEYS_LRSEL_RIGHT,
|
||||
};
|
||||
|
||||
/* defines for column-select mode */
|
||||
enum eActKeys_ColumnSelect_Mode {
|
||||
ACTKEYS_COLUMNSEL_KEYS = 0,
|
||||
ACTKEYS_COLUMNSEL_CFRA,
|
||||
ACTKEYS_COLUMNSEL_MARKERS_COLUMN,
|
||||
ACTKEYS_COLUMNSEL_MARKERS_BETWEEN,
|
||||
};
|
||||
|
||||
/* ***************************************** */
|
||||
/* action_edit.c */
|
||||
|
||||
void ACTION_OT_previewrange_set(struct wmOperatorType *ot);
|
||||
void ACTION_OT_view_all(struct wmOperatorType *ot);
|
||||
void ACTION_OT_view_selected(struct wmOperatorType *ot);
|
||||
void ACTION_OT_view_frame(struct wmOperatorType *ot);
|
||||
|
||||
void ACTION_OT_copy(struct wmOperatorType *ot);
|
||||
void ACTION_OT_paste(struct wmOperatorType *ot);
|
||||
|
||||
void ACTION_OT_keyframe_insert(struct wmOperatorType *ot);
|
||||
void ACTION_OT_duplicate(struct wmOperatorType *ot);
|
||||
void ACTION_OT_delete(struct wmOperatorType *ot);
|
||||
void ACTION_OT_clean(struct wmOperatorType *ot);
|
||||
void ACTION_OT_sample(struct wmOperatorType *ot);
|
||||
|
||||
void ACTION_OT_keyframe_type(struct wmOperatorType *ot);
|
||||
void ACTION_OT_handle_type(struct wmOperatorType *ot);
|
||||
void ACTION_OT_interpolation_type(struct wmOperatorType *ot);
|
||||
void ACTION_OT_extrapolation_type(struct wmOperatorType *ot);
|
||||
void ACTION_OT_easing_type(struct wmOperatorType *ot);
|
||||
|
||||
void ACTION_OT_frame_jump(struct wmOperatorType *ot);
|
||||
|
||||
void ACTION_OT_snap(struct wmOperatorType *ot);
|
||||
void ACTION_OT_mirror(struct wmOperatorType *ot);
|
||||
|
||||
void ACTION_OT_new(struct wmOperatorType *ot);
|
||||
void ACTION_OT_unlink(struct wmOperatorType *ot);
|
||||
|
||||
void ACTION_OT_push_down(struct wmOperatorType *ot);
|
||||
void ACTION_OT_stash(struct wmOperatorType *ot);
|
||||
void ACTION_OT_stash_and_create(struct wmOperatorType *ot);
|
||||
|
||||
void ACTION_OT_layer_next(struct wmOperatorType *ot);
|
||||
void ACTION_OT_layer_prev(struct wmOperatorType *ot);
|
||||
|
||||
void ACTION_OT_markers_make_local(struct wmOperatorType *ot);
|
||||
|
||||
/* defines for snap keyframes
|
||||
* NOTE: keep in sync with eEditKeyframes_Snap (in ED_keyframes_edit.h)
|
||||
*/
|
||||
enum eActKeys_Snap_Mode {
|
||||
ACTKEYS_SNAP_CFRA = 1,
|
||||
ACTKEYS_SNAP_NEAREST_FRAME,
|
||||
ACTKEYS_SNAP_NEAREST_SECOND,
|
||||
ACTKEYS_SNAP_NEAREST_MARKER,
|
||||
};
|
||||
|
||||
/* defines for mirror keyframes
|
||||
* NOTE: keep in sync with eEditKeyframes_Mirror (in ED_keyframes_edit.h)
|
||||
*/
|
||||
enum eActKeys_Mirror_Mode {
|
||||
ACTKEYS_MIRROR_CFRA = 1,
|
||||
ACTKEYS_MIRROR_YAXIS,
|
||||
ACTKEYS_MIRROR_XAXIS,
|
||||
ACTKEYS_MIRROR_MARKER,
|
||||
};
|
||||
|
||||
/* ***************************************** */
|
||||
/* action_ops.c */
|
||||
|
||||
void action_operatortypes(void);
|
||||
void action_keymap(struct wmKeyConfig *keyconf);
|
|
@ -0,0 +1,133 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
* Copyright 2008 Blender Foundation. All rights reserved. */
|
||||
|
||||
/** \file
|
||||
* \ingroup spaction
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
struct ARegion;
|
||||
struct ARegionType;
|
||||
struct Object;
|
||||
struct Scene;
|
||||
struct SpaceAction;
|
||||
struct bAnimContext;
|
||||
struct bContext;
|
||||
struct wmOperatorType;
|
||||
|
||||
/* internal exports only */
|
||||
|
||||
/* **************************************** */
|
||||
/* space_action.c / action_buttons.c */
|
||||
|
||||
void action_buttons_register(ARegionType *art);
|
||||
|
||||
/* ***************************************** */
|
||||
/* action_draw.c */
|
||||
|
||||
/**
|
||||
* Left hand part.
|
||||
*/
|
||||
void draw_channel_names(bContext *C, bAnimContext *ac, ARegion *region);
|
||||
/**
|
||||
* Draw keyframes in each channel.
|
||||
*/
|
||||
void draw_channel_strips(bAnimContext *ac, SpaceAction *saction, ARegion *region);
|
||||
|
||||
void timeline_draw_cache(SpaceAction *saction, Object *ob, Scene *scene);
|
||||
|
||||
/* ***************************************** */
|
||||
/* action_select.c */
|
||||
|
||||
void ACTION_OT_select_all(wmOperatorType *ot);
|
||||
void ACTION_OT_select_box(wmOperatorType *ot);
|
||||
void ACTION_OT_select_lasso(wmOperatorType *ot);
|
||||
void ACTION_OT_select_circle(wmOperatorType *ot);
|
||||
void ACTION_OT_select_column(wmOperatorType *ot);
|
||||
void ACTION_OT_select_linked(wmOperatorType *ot);
|
||||
void ACTION_OT_select_more(wmOperatorType *ot);
|
||||
void ACTION_OT_select_less(wmOperatorType *ot);
|
||||
void ACTION_OT_select_leftright(wmOperatorType *ot);
|
||||
void ACTION_OT_clickselect(wmOperatorType *ot);
|
||||
|
||||
/* defines for left-right select tool */
|
||||
enum eActKeys_LeftRightSelect_Mode {
|
||||
ACTKEYS_LRSEL_TEST = 0,
|
||||
ACTKEYS_LRSEL_LEFT,
|
||||
ACTKEYS_LRSEL_RIGHT,
|
||||
};
|
||||
|
||||
/* defines for column-select mode */
|
||||
enum eActKeys_ColumnSelect_Mode {
|
||||
ACTKEYS_COLUMNSEL_KEYS = 0,
|
||||
ACTKEYS_COLUMNSEL_CFRA,
|
||||
ACTKEYS_COLUMNSEL_MARKERS_COLUMN,
|
||||
ACTKEYS_COLUMNSEL_MARKERS_BETWEEN,
|
||||
};
|
||||
|
||||
/* ***************************************** */
|
||||
/* action_edit.c */
|
||||
|
||||
void ACTION_OT_previewrange_set(wmOperatorType *ot);
|
||||
void ACTION_OT_view_all(wmOperatorType *ot);
|
||||
void ACTION_OT_view_selected(wmOperatorType *ot);
|
||||
void ACTION_OT_view_frame(wmOperatorType *ot);
|
||||
|
||||
void ACTION_OT_copy(wmOperatorType *ot);
|
||||
void ACTION_OT_paste(wmOperatorType *ot);
|
||||
|
||||
void ACTION_OT_keyframe_insert(wmOperatorType *ot);
|
||||
void ACTION_OT_duplicate(wmOperatorType *ot);
|
||||
void ACTION_OT_delete(wmOperatorType *ot);
|
||||
void ACTION_OT_clean(wmOperatorType *ot);
|
||||
void ACTION_OT_sample(wmOperatorType *ot);
|
||||
|
||||
void ACTION_OT_keyframe_type(wmOperatorType *ot);
|
||||
void ACTION_OT_handle_type(wmOperatorType *ot);
|
||||
void ACTION_OT_interpolation_type(wmOperatorType *ot);
|
||||
void ACTION_OT_extrapolation_type(wmOperatorType *ot);
|
||||
void ACTION_OT_easing_type(wmOperatorType *ot);
|
||||
|
||||
void ACTION_OT_frame_jump(wmOperatorType *ot);
|
||||
|
||||
void ACTION_OT_snap(wmOperatorType *ot);
|
||||
void ACTION_OT_mirror(wmOperatorType *ot);
|
||||
|
||||
void ACTION_OT_new(wmOperatorType *ot);
|
||||
void ACTION_OT_unlink(wmOperatorType *ot);
|
||||
|
||||
void ACTION_OT_push_down(wmOperatorType *ot);
|
||||
void ACTION_OT_stash(wmOperatorType *ot);
|
||||
void ACTION_OT_stash_and_create(wmOperatorType *ot);
|
||||
|
||||
void ACTION_OT_layer_next(wmOperatorType *ot);
|
||||
void ACTION_OT_layer_prev(wmOperatorType *ot);
|
||||
|
||||
void ACTION_OT_markers_make_local(wmOperatorType *ot);
|
||||
|
||||
/* defines for snap keyframes
|
||||
* NOTE: keep in sync with eEditKeyframes_Snap (in ED_keyframes_edit.h)
|
||||
*/
|
||||
enum eActKeys_Snap_Mode {
|
||||
ACTKEYS_SNAP_CFRA = 1,
|
||||
ACTKEYS_SNAP_NEAREST_FRAME,
|
||||
ACTKEYS_SNAP_NEAREST_SECOND,
|
||||
ACTKEYS_SNAP_NEAREST_MARKER,
|
||||
};
|
||||
|
||||
/* defines for mirror keyframes
|
||||
* NOTE: keep in sync with eEditKeyframes_Mirror (in ED_keyframes_edit.h)
|
||||
*/
|
||||
enum eActKeys_Mirror_Mode {
|
||||
ACTKEYS_MIRROR_CFRA = 1,
|
||||
ACTKEYS_MIRROR_YAXIS,
|
||||
ACTKEYS_MIRROR_XAXIS,
|
||||
ACTKEYS_MIRROR_MARKER,
|
||||
};
|
||||
|
||||
/* ***************************************** */
|
||||
/* action_ops.c */
|
||||
|
||||
void action_operatortypes(void);
|
||||
void action_keymap(wmKeyConfig *keyconf);
|
|
@ -5,15 +5,15 @@
|
|||
* \ingroup spaction
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <cmath>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "DNA_space_types.h"
|
||||
|
||||
#include "ED_anim_api.h"
|
||||
#include "ED_transform.h"
|
||||
|
||||
#include "action_intern.h"
|
||||
#include "action_intern.hh"
|
||||
|
||||
#include "RNA_access.h"
|
||||
|
File diff suppressed because it is too large
Load Diff
|
@ -5,8 +5,8 @@
|
|||
* \ingroup spaction
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
|
||||
#include "DNA_action_types.h"
|
||||
#include "DNA_anim_types.h"
|
||||
|
@ -44,7 +44,7 @@
|
|||
|
||||
#include "BLO_read_write.h"
|
||||
|
||||
#include "action_intern.h" /* own include */
|
||||
#include "action_intern.hh" /* own include */
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Default Callbacks for Action Space
|
||||
|
@ -55,7 +55,7 @@ static SpaceLink *action_create(const ScrArea *area, const Scene *scene)
|
|||
SpaceAction *saction;
|
||||
ARegion *region;
|
||||
|
||||
saction = MEM_callocN(sizeof(SpaceAction), "initaction");
|
||||
saction = MEM_cnew<SpaceAction>("initaction");
|
||||
saction->spacetype = SPACE_ACTION;
|
||||
|
||||
saction->autosnap = SACTSNAP_FRAME;
|
||||
|
@ -72,14 +72,14 @@ static SpaceLink *action_create(const ScrArea *area, const Scene *scene)
|
|||
saction->cache_display |= TIME_CACHE_RIGIDBODY;
|
||||
|
||||
/* header */
|
||||
region = MEM_callocN(sizeof(ARegion), "header for action");
|
||||
region = MEM_cnew<ARegion>("header for action");
|
||||
|
||||
BLI_addtail(&saction->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_HEADER;
|
||||
region->alignment = (U.uiflag & USER_HEADER_BOTTOM) ? RGN_ALIGN_BOTTOM : RGN_ALIGN_TOP;
|
||||
|
||||
/* channel list region */
|
||||
region = MEM_callocN(sizeof(ARegion), "channel region for action");
|
||||
region = MEM_cnew<ARegion>("channel region for action");
|
||||
BLI_addtail(&saction->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_CHANNELS;
|
||||
region->alignment = RGN_ALIGN_LEFT;
|
||||
|
@ -89,14 +89,14 @@ static SpaceLink *action_create(const ScrArea *area, const Scene *scene)
|
|||
region->v2d.flag = V2D_VIEWSYNC_AREA_VERTICAL;
|
||||
|
||||
/* ui buttons */
|
||||
region = MEM_callocN(sizeof(ARegion), "buttons region for action");
|
||||
region = MEM_cnew<ARegion>("buttons region for action");
|
||||
|
||||
BLI_addtail(&saction->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_UI;
|
||||
region->alignment = RGN_ALIGN_RIGHT;
|
||||
|
||||
/* main region */
|
||||
region = MEM_callocN(sizeof(ARegion), "main region for action");
|
||||
region = MEM_cnew<ARegion>("main region for action");
|
||||
|
||||
BLI_addtail(&saction->regionbase, region);
|
||||
region->regiontype = RGN_TYPE_WINDOW;
|
||||
|
@ -127,21 +127,21 @@ static SpaceLink *action_create(const ScrArea *area, const Scene *scene)
|
|||
}
|
||||
|
||||
/* not spacelink itself */
|
||||
static void action_free(SpaceLink *UNUSED(sl))
|
||||
static void action_free(SpaceLink * /*sl*/)
|
||||
{
|
||||
// SpaceAction *saction = (SpaceAction *) sl;
|
||||
}
|
||||
|
||||
/* spacetype; init callback */
|
||||
static void action_init(struct wmWindowManager *UNUSED(wm), ScrArea *area)
|
||||
static void action_init(wmWindowManager * /*wm*/, ScrArea *area)
|
||||
{
|
||||
SpaceAction *saction = area->spacedata.first;
|
||||
SpaceAction *saction = static_cast<SpaceAction *>(area->spacedata.first);
|
||||
saction->runtime.flag |= SACTION_RUNTIME_FLAG_NEED_CHAN_SYNC;
|
||||
}
|
||||
|
||||
static SpaceLink *action_duplicate(SpaceLink *sl)
|
||||
{
|
||||
SpaceAction *sactionn = MEM_dupallocN(sl);
|
||||
SpaceAction *sactionn = static_cast<SpaceAction *>(MEM_dupallocN(sl));
|
||||
|
||||
memset(&sactionn->runtime, 0x0, sizeof(sactionn->runtime));
|
||||
|
||||
|
@ -192,7 +192,7 @@ static void action_main_region_draw(const bContext *C, ARegion *region)
|
|||
|
||||
/* Draw the manually set intended playback frame range highlight in the Action editor. */
|
||||
if (ELEM(saction->mode, SACTCONT_ACTION, SACTCONT_SHAPEKEY) && saction->action) {
|
||||
AnimData *adt = ED_actedit_animdata_from_context(C, NULL);
|
||||
AnimData *adt = ED_actedit_animdata_from_context(C, nullptr);
|
||||
|
||||
ANIM_draw_action_framerange(adt, saction->action, v2d, -FLT_MAX, FLT_MAX);
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ static void action_main_region_draw_overlay(const bContext *C, ARegion *region)
|
|||
ED_time_scrub_draw_current_frame(region, scene, saction->flag & SACTION_DRAWTIME);
|
||||
|
||||
/* scrollers */
|
||||
UI_view2d_scrollers_draw(v2d, NULL);
|
||||
UI_view2d_scrollers_draw(v2d, nullptr);
|
||||
}
|
||||
|
||||
/* add handlers, stuff you only do once or on area/region changes */
|
||||
|
@ -293,7 +293,7 @@ static void action_channel_region_draw(const bContext *C, ARegion *region)
|
|||
}
|
||||
|
||||
/* add handlers, stuff you only do once or on area/region changes */
|
||||
static void action_header_region_init(wmWindowManager *UNUSED(wm), ARegion *region)
|
||||
static void action_header_region_init(wmWindowManager * /*wm*/, ARegion *region)
|
||||
{
|
||||
ED_region_header_init(region);
|
||||
}
|
||||
|
@ -360,7 +360,7 @@ static void action_channel_region_listener(const wmRegionListenerParams *params)
|
|||
|
||||
static void saction_channel_region_message_subscribe(const wmRegionMessageSubscribeParams *params)
|
||||
{
|
||||
struct wmMsgBus *mbus = params->message_bus;
|
||||
wmMsgBus *mbus = params->message_bus;
|
||||
bScreen *screen = params->screen;
|
||||
ScrArea *area = params->area;
|
||||
ARegion *region = params->region;
|
||||
|
@ -368,11 +368,10 @@ static void saction_channel_region_message_subscribe(const wmRegionMessageSubscr
|
|||
PointerRNA ptr;
|
||||
RNA_pointer_create(&screen->id, &RNA_SpaceDopeSheetEditor, area->spacedata.first, &ptr);
|
||||
|
||||
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
|
||||
.owner = region,
|
||||
.user_data = region,
|
||||
.notify = ED_region_do_msg_notify_tag_redraw,
|
||||
};
|
||||
wmMsgSubscribeValue msg_sub_value_region_tag_redraw{};
|
||||
msg_sub_value_region_tag_redraw.owner = region;
|
||||
msg_sub_value_region_tag_redraw.user_data = region;
|
||||
msg_sub_value_region_tag_redraw.notify = ED_region_do_msg_notify_tag_redraw;
|
||||
|
||||
/* All dopesheet filter settings, etc. affect the drawing of this editor,
|
||||
* also same applies for all animation-related datatypes that may appear here,
|
||||
|
@ -477,7 +476,7 @@ static void action_main_region_listener(const wmRegionListenerParams *params)
|
|||
|
||||
static void saction_main_region_message_subscribe(const wmRegionMessageSubscribeParams *params)
|
||||
{
|
||||
struct wmMsgBus *mbus = params->message_bus;
|
||||
wmMsgBus *mbus = params->message_bus;
|
||||
Scene *scene = params->scene;
|
||||
bScreen *screen = params->screen;
|
||||
ScrArea *area = params->area;
|
||||
|
@ -486,11 +485,10 @@ static void saction_main_region_message_subscribe(const wmRegionMessageSubscribe
|
|||
PointerRNA ptr;
|
||||
RNA_pointer_create(&screen->id, &RNA_SpaceDopeSheetEditor, area->spacedata.first, &ptr);
|
||||
|
||||
wmMsgSubscribeValue msg_sub_value_region_tag_redraw = {
|
||||
.owner = region,
|
||||
.user_data = region,
|
||||
.notify = ED_region_do_msg_notify_tag_redraw,
|
||||
};
|
||||
wmMsgSubscribeValue msg_sub_value_region_tag_redraw{};
|
||||
msg_sub_value_region_tag_redraw.owner = region;
|
||||
msg_sub_value_region_tag_redraw.user_data = region;
|
||||
msg_sub_value_region_tag_redraw.notify = ED_region_do_msg_notify_tag_redraw;
|
||||
|
||||
/* Timeline depends on scene properties. */
|
||||
{
|
||||
|
@ -578,7 +576,7 @@ static void action_listener(const wmSpaceTypeListenerParams *params)
|
|||
case ND_FRAME_RANGE:
|
||||
LISTBASE_FOREACH (ARegion *, region, &area->regionbase) {
|
||||
if (region->regiontype == RGN_TYPE_WINDOW) {
|
||||
Scene *scene = wmn->reference;
|
||||
Scene *scene = static_cast<Scene *>(wmn->reference);
|
||||
region->v2d.tot.xmin = (float)(scene->r.sfra - 4);
|
||||
region->v2d.tot.xmax = (float)(scene->r.efra + 4);
|
||||
break;
|
||||
|
@ -801,7 +799,7 @@ static void action_refresh(const bContext *C, ScrArea *area)
|
|||
* or else they don't update #28962.
|
||||
*/
|
||||
ED_area_tag_redraw(area);
|
||||
for (region = area->regionbase.first; region; region = region->next) {
|
||||
for (region = static_cast<ARegion *>(area->regionbase.first); region; region = region->next) {
|
||||
ED_region_tag_redraw(region);
|
||||
}
|
||||
}
|
||||
|
@ -810,9 +808,7 @@ static void action_refresh(const bContext *C, ScrArea *area)
|
|||
/* XXX re-sizing y-extents of tot should go here? */
|
||||
}
|
||||
|
||||
static void action_id_remap(ScrArea *UNUSED(area),
|
||||
SpaceLink *slink,
|
||||
const struct IDRemapper *mappings)
|
||||
static void action_id_remap(ScrArea * /*area*/, SpaceLink *slink, const IDRemapper *mappings)
|
||||
{
|
||||
SpaceAction *sact = (SpaceAction *)slink;
|
||||
|
||||
|
@ -828,13 +824,13 @@ static void action_id_remap(ScrArea *UNUSED(area),
|
|||
*/
|
||||
static int action_space_subtype_get(ScrArea *area)
|
||||
{
|
||||
SpaceAction *sact = area->spacedata.first;
|
||||
SpaceAction *sact = static_cast<SpaceAction *>(area->spacedata.first);
|
||||
return sact->mode == SACTCONT_TIMELINE ? SACTCONT_TIMELINE : SACTCONT_DOPESHEET;
|
||||
}
|
||||
|
||||
static void action_space_subtype_set(ScrArea *area, int value)
|
||||
{
|
||||
SpaceAction *sact = area->spacedata.first;
|
||||
SpaceAction *sact = static_cast<SpaceAction *>(area->spacedata.first);
|
||||
if (value == SACTCONT_TIMELINE) {
|
||||
if (sact->mode != SACTCONT_TIMELINE) {
|
||||
sact->mode_prev = sact->mode;
|
||||
|
@ -846,14 +842,14 @@ static void action_space_subtype_set(ScrArea *area, int value)
|
|||
}
|
||||
}
|
||||
|
||||
static void action_space_subtype_item_extend(bContext *UNUSED(C),
|
||||
static void action_space_subtype_item_extend(bContext * /*C*/,
|
||||
EnumPropertyItem **item,
|
||||
int *totitem)
|
||||
{
|
||||
RNA_enum_items_add(item, totitem, rna_enum_space_action_mode_items);
|
||||
}
|
||||
|
||||
static void action_blend_read_data(BlendDataReader *UNUSED(reader), SpaceLink *sl)
|
||||
static void action_blend_read_data(BlendDataReader * /*reader*/, SpaceLink *sl)
|
||||
{
|
||||
SpaceAction *saction = (SpaceAction *)sl;
|
||||
memset(&saction->runtime, 0x0, sizeof(saction->runtime));
|
||||
|
@ -877,7 +873,7 @@ static void action_blend_write(BlendWriter *writer, SpaceLink *sl)
|
|||
BLO_write_struct(writer, SpaceAction, sl);
|
||||
}
|
||||
|
||||
static void action_main_region_view2d_changed(const bContext *UNUSED(C), ARegion *region)
|
||||
static void action_main_region_view2d_changed(const bContext * /*C*/, ARegion *region)
|
||||
{
|
||||
/* V2D_KEEPTOT_STRICT cannot be used to clamp scrolling
|
||||
* because it also clamps the x-axis to 0. */
|
||||
|
@ -886,7 +882,7 @@ static void action_main_region_view2d_changed(const bContext *UNUSED(C), ARegion
|
|||
|
||||
void ED_spacetype_action(void)
|
||||
{
|
||||
SpaceType *st = MEM_callocN(sizeof(SpaceType), "spacetype action");
|
||||
SpaceType *st = MEM_cnew<SpaceType>("spacetype action");
|
||||
ARegionType *art;
|
||||
|
||||
st->spaceid = SPACE_ACTION;
|
||||
|
@ -909,7 +905,7 @@ void ED_spacetype_action(void)
|
|||
st->blend_write = action_blend_write;
|
||||
|
||||
/* regions: main window */
|
||||
art = MEM_callocN(sizeof(ARegionType), "spacetype action region");
|
||||
art = MEM_cnew<ARegionType>("spacetype action region");
|
||||
art->regionid = RGN_TYPE_WINDOW;
|
||||
art->init = action_main_region_init;
|
||||
art->draw = action_main_region_draw;
|
||||
|
@ -922,7 +918,7 @@ void ED_spacetype_action(void)
|
|||
BLI_addhead(&st->regiontypes, art);
|
||||
|
||||
/* regions: header */
|
||||
art = MEM_callocN(sizeof(ARegionType), "spacetype action region");
|
||||
art = MEM_cnew<ARegionType>("spacetype action region");
|
||||
art->regionid = RGN_TYPE_HEADER;
|
||||
art->prefsizey = HEADERY;
|
||||
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES | ED_KEYMAP_HEADER;
|
||||
|
@ -934,7 +930,7 @@ void ED_spacetype_action(void)
|
|||
BLI_addhead(&st->regiontypes, art);
|
||||
|
||||
/* regions: channels */
|
||||
art = MEM_callocN(sizeof(ARegionType), "spacetype action region");
|
||||
art = MEM_cnew<ARegionType>("spacetype action region");
|
||||
art->regionid = RGN_TYPE_CHANNELS;
|
||||
art->prefsizex = 200;
|
||||
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D | ED_KEYMAP_FRAMES;
|
||||
|
@ -947,7 +943,7 @@ void ED_spacetype_action(void)
|
|||
BLI_addhead(&st->regiontypes, art);
|
||||
|
||||
/* regions: UI buttons */
|
||||
art = MEM_callocN(sizeof(ARegionType), "spacetype action region");
|
||||
art = MEM_cnew<ARegionType>("spacetype action region");
|
||||
art->regionid = RGN_TYPE_UI;
|
||||
art->prefsizex = UI_SIDEBAR_PANEL_WIDTH;
|
||||
art->keymapflag = ED_KEYMAP_UI;
|
Loading…
Reference in New Issue