Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_action')
-rw-r--r--source/blender/editors/space_action/action_data.c81
-rw-r--r--source/blender/editors/space_action/action_edit.c13
-rw-r--r--source/blender/editors/space_action/action_intern.h5
-rw-r--r--source/blender/editors/space_action/space_action.c4
4 files changed, 49 insertions, 54 deletions
diff --git a/source/blender/editors/space_action/action_data.c b/source/blender/editors/space_action/action_data.c
index b5a0c4a9e22..bffd6cc421d 100644
--- a/source/blender/editors/space_action/action_data.c
+++ b/source/blender/editors/space_action/action_data.c
@@ -337,10 +337,9 @@ static int action_pushdown_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_WARNING, "Action must have at least one keyframe or F-Modifier");
return OPERATOR_CANCELLED;
}
- else {
- /* action can be safely added */
- BKE_nla_action_pushdown(adt);
- }
+
+ /* action can be safely added */
+ BKE_nla_action_pushdown(adt);
/* Stop displaying this action in this editor
* NOTE: The editor itself doesn't set a user...
@@ -383,24 +382,23 @@ static int action_stash_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_WARNING, "Action must have at least one keyframe or F-Modifier");
return OPERATOR_CANCELLED;
}
- else {
- /* stash the action */
- if (BKE_nla_action_stash(adt)) {
- /* 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;
- }
- else {
- /* action has already been added - simply warn about this, and clear */
- BKE_report(op->reports, RPT_ERROR, "Action has already been stashed");
- }
- /* clear action refs from editor, and then also the backing data (not necessary) */
- actedit_change_action(C, NULL);
+ /* stash the action */
+ if (BKE_nla_action_stash(adt)) {
+ /* 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;
+ }
+ else {
+ /* action has already been added - simply warn about this, and clear */
+ BKE_report(op->reports, RPT_ERROR, "Action has already been stashed");
}
+
+ /* clear action refs from editor, and then also the backing data (not necessary) */
+ actedit_change_action(C, NULL);
}
/* Send notifiers that stuff has changed */
@@ -486,28 +484,27 @@ static int action_stash_create_exec(bContext *C, wmOperator *op)
BKE_report(op->reports, RPT_WARNING, "Action must have at least one keyframe or F-Modifier");
return OPERATOR_CANCELLED;
}
- else {
- /* stash the action */
- if (BKE_nla_action_stash(adt)) {
- bAction *new_action = NULL;
- /* Create new action not based on the old one
- * (since the "new" operator already does that). */
- new_action = action_create_new(C, NULL);
+ /* stash the action */
+ if (BKE_nla_action_stash(adt)) {
+ bAction *new_action = NULL;
- /* 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;
- 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);
- }
+ /* Create new action not based on the old one
+ * (since the "new" operator already does that). */
+ new_action = action_create_new(C, NULL);
+
+ /* 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;
+ 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);
}
}
@@ -709,11 +706,11 @@ static NlaStrip *action_layer_get_nlastrip(ListBase *strips, float ctime)
/* in range - use this one */
return strip;
}
- else if ((ctime < strip->start) && (strip->prev == NULL)) {
+ if ((ctime < strip->start) && (strip->prev == NULL)) {
/* before first - use this one */
return strip;
}
- else if ((ctime > strip->end) && (strip->next == NULL)) {
+ if ((ctime > strip->end) && (strip->next == NULL)) {
/* after last - use this one */
return strip;
}
diff --git a/source/blender/editors/space_action/action_edit.c b/source/blender/editors/space_action/action_edit.c
index aa784800be0..af8e0e9d9de 100644
--- a/source/blender/editors/space_action/action_edit.c
+++ b/source/blender/editors/space_action/action_edit.c
@@ -272,9 +272,8 @@ static int actkeys_previewrange_exec(bContext *C, wmOperator *UNUSED(op))
if (ac.scene == NULL) {
return OPERATOR_CANCELLED;
}
- else {
- scene = ac.scene;
- }
+
+ scene = ac.scene;
/* set the range directly */
get_keyframe_extents(&ac, &min, &max, false);
@@ -725,9 +724,10 @@ static void insert_action_keys(bAnimContext *ac, short mode)
flag = ANIM_get_keyframing_flags(scene, true);
/* insert keyframes */
+ const AnimationEvalContext anim_eval_context = BKE_animsys_eval_context_construct(ac->depsgraph,
+ (float)CFRA);
for (ale = anim_data.first; ale; ale = ale->next) {
FCurve *fcu = (FCurve *)ale->key_data;
- float cfra = (float)CFRA;
/* Read value from property the F-Curve represents, or from the curve only?
* - ale->id != NULL:
@@ -746,7 +746,7 @@ static void insert_action_keys(bAnimContext *ac, short mode)
((fcu->grp) ? (fcu->grp->name) : (NULL)),
fcu->rna_path,
fcu->array_index,
- cfra,
+ &anim_eval_context,
ts->keyframe_type,
&nla_cache,
flag);
@@ -755,8 +755,9 @@ static void insert_action_keys(bAnimContext *ac, short mode)
AnimData *adt = ANIM_nla_mapping_get(ac, ale);
/* adjust current frame for NLA-scaling */
+ float cfra = anim_eval_context.eval_time;
if (adt) {
- cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP);
+ cfra = BKE_nla_tweakedit_remap(adt, cfra, NLATIME_CONVERT_UNMAP);
}
const float curval = evaluate_fcurve(fcu, cfra);
diff --git a/source/blender/editors/space_action/action_intern.h b/source/blender/editors/space_action/action_intern.h
index bf1b90bbe98..ffe0606c98f 100644
--- a/source/blender/editors/space_action/action_intern.h
+++ b/source/blender/editors/space_action/action_intern.h
@@ -21,8 +21,7 @@
* \ingroup spaction
*/
-#ifndef __ACTION_INTERN_H__
-#define __ACTION_INTERN_H__
+#pragma once
struct ARegion;
struct ARegionType;
@@ -142,5 +141,3 @@ enum eActKeys_Mirror_Mode {
/* action_ops.c */
void action_operatortypes(void);
void action_keymap(struct wmKeyConfig *keyconf);
-
-#endif /* __ACTION_INTERN_H__ */
diff --git a/source/blender/editors/space_action/space_action.c b/source/blender/editors/space_action/space_action.c
index 079cee290ae..db55eff8284 100644
--- a/source/blender/editors/space_action/space_action.c
+++ b/source/blender/editors/space_action/space_action.c
@@ -60,7 +60,7 @@
/* ******************** default callbacks for action space ***************** */
-static SpaceLink *action_new(const ScrArea *area, const Scene *scene)
+static SpaceLink *action_create(const ScrArea *area, const Scene *scene)
{
SpaceAction *saction;
ARegion *region;
@@ -863,7 +863,7 @@ void ED_spacetype_action(void)
st->spaceid = SPACE_ACTION;
strncpy(st->name, "Action", BKE_ST_MAXNAME);
- st->new = action_new;
+ st->create = action_create;
st->free = action_free;
st->init = action_init;
st->duplicate = action_duplicate;