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:
-rw-r--r--release/scripts/startup/bl_operators/rigidbody.py2
-rw-r--r--source/blender/editors/animation/keyframing.c113
2 files changed, 34 insertions, 81 deletions
diff --git a/release/scripts/startup/bl_operators/rigidbody.py b/release/scripts/startup/bl_operators/rigidbody.py
index 7f5edac4dfb..1ef92a90754 100644
--- a/release/scripts/startup/bl_operators/rigidbody.py
+++ b/release/scripts/startup/bl_operators/rigidbody.py
@@ -176,7 +176,7 @@ class BakeToKeyframes(Operator):
# NOTE: assume that on first frame, the starting rotation is appropriate
obj.rotation_euler = mat.to_euler(rot_mode, obj.rotation_euler)
- bpy.ops.anim.keyframe_insert(type='BUILTIN_KSI_LocRot', confirm_success=False)
+ bpy.ops.anim.keyframe_insert(type='BUILTIN_KSI_LocRot')
# remove baked objects from simulation
bpy.ops.rigidbody.objects_remove()
diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c
index 1ef7ee755ea..95df8b69cd4 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -1879,6 +1879,7 @@ static int insert_key_exec(bContext *C, wmOperator *op)
float cfra = (float)CFRA; /* XXX for now, don't bother about all the yucky offset crap */
int num_channels;
+ const bool confirm = op->flag & OP_IS_INVOKE;
KeyingSet *ks = keyingset_get_from_op_with_error(op, op->type->prop, scene);
if (ks == NULL) {
@@ -1915,20 +1916,22 @@ static int insert_key_exec(bContext *C, wmOperator *op)
}
if (num_channels > 0) {
- /* if the appropriate properties have been set, make a note that we've inserted something */
- if (RNA_boolean_get(op->ptr, "confirm_success")) {
+ /* send notifiers that keyframes have been changed */
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_ADDED, NULL);
+ }
+
+ if (confirm) {
+ /* if called by invoke (from the UI), make a note that we've inserted keyframes */
+ if (num_channels > 0) {
BKE_reportf(op->reports,
RPT_INFO,
"Successfully added %d keyframes for keying set '%s'",
num_channels,
ks->name);
}
-
- /* send notifiers that keyframes have been changed */
- WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_ADDED, NULL);
- }
- else {
- BKE_report(op->reports, RPT_WARNING, "Keying set failed to insert any keyframes");
+ else {
+ BKE_report(op->reports, RPT_WARNING, "Keying set failed to insert any keyframes");
+ }
}
return OPERATOR_FINISHED;
@@ -1957,16 +1960,6 @@ void ANIM_OT_keyframe_insert(wmOperatorType *ot)
RNA_def_enum_funcs(prop, ANIM_keying_sets_enum_itemf);
RNA_def_property_flag(prop, PROP_HIDDEN);
ot->prop = prop;
-
- /* confirm whether a keyframe was added by showing a popup
- * - by default, this is enabled, since this operator is assumed to be called independently
- */
- prop = RNA_def_boolean(ot->srna,
- "confirm_success",
- 1,
- "Confirm Successful Insert",
- "Show a popup when the keyframes get successfully added");
- RNA_def_property_flag(prop, PROP_HIDDEN);
}
/* Clone of 'ANIM_OT_keyframe_insert' which uses a name for the keying set instead of an enum. */
@@ -1990,16 +1983,6 @@ void ANIM_OT_keyframe_insert_by_name(wmOperatorType *ot)
prop = RNA_def_string_file_path(ot->srna, "type", "Type", MAX_ID_NAME - 2, "", "");
RNA_def_property_flag(prop, PROP_HIDDEN);
ot->prop = prop;
-
- /* confirm whether a keyframe was added by showing a popup
- * - by default, this is enabled, since this operator is assumed to be called independently
- */
- prop = RNA_def_boolean(ot->srna,
- "confirm_success",
- 1,
- "Confirm Successful Insert",
- "Show a popup when the keyframes get successfully added");
- RNA_def_property_flag(prop, PROP_HIDDEN);
}
/* Insert Key Operator (With Menu) ------------------------ */
@@ -2027,8 +2010,6 @@ static int insert_key_menu_invoke(bContext *C, wmOperator *op, const wmEvent *UN
/* just call the exec() on the active keyingset */
RNA_enum_set(op->ptr, "type", 0);
- RNA_boolean_set(op->ptr, "confirm_success", true);
-
return op->type->exec(C, op);
}
@@ -2057,17 +2038,6 @@ void ANIM_OT_keyframe_insert_menu(wmOperatorType *ot)
RNA_def_property_flag(prop, PROP_HIDDEN);
ot->prop = prop;
- /* confirm whether a keyframe was added by showing a popup
- * - by default, this is disabled so that if a menu is shown, this doesn't come up too
- */
- /* XXX should this just be always on? */
- prop = RNA_def_boolean(ot->srna,
- "confirm_success",
- 0,
- "Confirm Successful Insert",
- "Show a popup when the keyframes get successfully added");
- RNA_def_property_flag(prop, PROP_HIDDEN);
-
/* whether the menu should always be shown
* - by default, the menu should only be shown when there is no active Keying Set (2.5 behavior),
* although in some cases it might be useful to always shown (pre 2.5 behavior)
@@ -2094,6 +2064,7 @@ static int delete_key_using_keying_set(bContext *C, wmOperator *op, KeyingSet *k
Scene *scene = CTX_data_scene(C);
float cfra = (float)CFRA; /* XXX for now, don't bother about all the yucky offset crap */
int num_channels;
+ const bool confirm = op->flag & OP_IS_INVOKE;
/* try to delete keyframes for the channels specified by KeyingSet */
num_channels = ANIM_apply_keyingset(C, NULL, NULL, ks, MODIFYKEY_MODE_DELETE, cfra);
@@ -2107,26 +2078,23 @@ static int delete_key_using_keying_set(bContext *C, wmOperator *op, KeyingSet *k
return OPERATOR_CANCELLED;
}
- PropertyRNA *prop = RNA_struct_find_property(op->ptr, "confirm_success");
- bool confirm = (prop != NULL && RNA_property_boolean_get(op->ptr, prop));
-
if (num_channels > 0) {
- /* if the appropriate properties have been set, make a note that we've inserted something */
- if (confirm) {
+ WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_REMOVED, NULL);
+ }
+
+ if (confirm) {
+ /* if called by invoke (from the UI), make a note that we've removed keyframes */
+ if (num_channels > 0) {
BKE_reportf(op->reports,
RPT_INFO,
"Successfully removed %d keyframes for keying set '%s'",
num_channels,
ks->name);
}
-
- /* send notifiers that keyframes have been changed */
- WM_event_add_notifier(C, NC_ANIMATION | ND_KEYFRAME | NA_REMOVED, NULL);
- }
- else if (confirm) {
- BKE_report(op->reports, RPT_WARNING, "Keying set failed to remove any keyframes");
+ else {
+ BKE_report(op->reports, RPT_WARNING, "Keying set failed to remove any keyframes");
+ }
}
-
return OPERATOR_FINISHED;
}
@@ -2153,15 +2121,6 @@ void ANIM_OT_keyframe_delete(wmOperatorType *ot)
RNA_def_enum_funcs(prop, ANIM_keying_sets_enum_itemf);
RNA_def_property_flag(prop, PROP_HIDDEN);
ot->prop = prop;
-
- /* confirm whether a keyframe was added by showing a popup
- * - by default, this is enabled, since this operator is assumed to be called independently
- */
- RNA_def_boolean(ot->srna,
- "confirm_success",
- 1,
- "Confirm Successful Delete",
- "Show a popup when the keyframes get successfully removed");
}
void ANIM_OT_keyframe_delete_by_name(wmOperatorType *ot)
@@ -2184,15 +2143,6 @@ void ANIM_OT_keyframe_delete_by_name(wmOperatorType *ot)
prop = RNA_def_string_file_path(ot->srna, "type", "Type", MAX_ID_NAME - 2, "", "");
RNA_def_property_flag(prop, PROP_HIDDEN);
ot->prop = prop;
-
- /* confirm whether a keyframe was added by showing a popup
- * - by default, this is enabled, since this operator is assumed to be called independently
- */
- RNA_def_boolean(ot->srna,
- "confirm_success",
- 1,
- "Confirm Successful Delete",
- "Show a popup when the keyframes get successfully removed");
}
/* Delete Key Operator ------------------------ */
@@ -2291,7 +2241,7 @@ static int delete_key_v3d_without_keying_set(bContext *C, wmOperator *op)
int selected_objects_success_len = 0;
int success_multi = 0;
- bool confirm = op->flag & OP_IS_INVOKE;
+ const bool confirm = op->flag & OP_IS_INVOKE;
CTX_DATA_BEGIN (C, Object *, ob, selected_objects) {
ID *id = &ob->id;
@@ -2372,21 +2322,24 @@ static int delete_key_v3d_without_keying_set(bContext *C, wmOperator *op)
}
CTX_DATA_END;
- /* report success (or failure) */
if (selected_objects_success_len) {
- if (confirm) {
+ /* send updates */
+ WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, NULL);
+ }
+
+ if (confirm) {
+ /* if called by invoke (from the UI), make a note that we've removed keyframes */
+ if (selected_objects_success_len) {
BKE_reportf(op->reports,
RPT_INFO,
"%d object(s) successfully had %d keyframes removed",
selected_objects_success_len,
success_multi);
}
- /* send updates */
- WM_event_add_notifier(C, NC_OBJECT | ND_KEYS, NULL);
- }
- else if (confirm) {
- BKE_reportf(
- op->reports, RPT_ERROR, "No keyframes removed from %d object(s)", selected_objects_len);
+ else {
+ BKE_reportf(
+ op->reports, RPT_ERROR, "No keyframes removed from %d object(s)", selected_objects_len);
+ }
}
return OPERATOR_FINISHED;
}