Commit: 0b51e7d99170aa6bdb2b9a3884122a350dc3ebae
Author: Joshua Leung
Date: Sun Jun 14 01:14:03 2015 +1200
Branches: master
https://developer.blender.org/rB0b51e7d99170aa6bdb2b9a3884122a350dc3ebae
Fix: "Delete Keyframes" RMB-menu option didn't work on NLA Strip properties
===================================================================
M source/blender/editors/animation/keyframing.c
===================================================================
diff --git a/source/blender/editors/animation/keyframing.c
b/source/blender/editors/animation/keyframing.c
index cd7a326..ab43048 100644
--- a/source/blender/editors/animation/keyframing.c
+++ b/source/blender/editors/animation/keyframing.c
@@ -1801,19 +1801,55 @@ static int delete_key_button_exec(bContext *C,
wmOperator *op)
UI_context_active_but_prop_get(C, &ptr, &prop, &index);
if (ptr.id.data && ptr.data && prop) {
- path = RNA_path_from_ID_to_property(&ptr, prop);
-
- if (path) {
- if (all) {
- /* -1 indicates operating on the entire array
(or the property itself otherwise) */
- index = -1;
+ if (ptr.type == &RNA_NlaStrip) {
+ /* Handle special properties for NLA Strips, whose
F-Curves are stored on the
+ * strips themselves. These are stored separately or
else the properties will
+ * not have any effect.
+ */
+ ID *id = ptr.id.data;
+ NlaStrip *strip = (NlaStrip *)ptr.data;
+ FCurve *fcu = list_find_fcurve(&strip->fcurves,
RNA_property_identifier(prop), 0);
+
+ BLI_assert(fcu != NULL); /* NOTE: This should be true,
or else we wouldn't be able to get here */
+
+ if (BKE_fcurve_is_protected(fcu)) {
+ BKE_reportf(op->reports, RPT_WARNING,
+ "Not deleting keyframe
for locked F-Curve for NLA Strip influence on %s - %s '%s'",
+ strip->name,
BKE_idcode_to_name(GS(id->name)), id->name + 2);
}
+ else {
+ /* remove the keyframe directly
+ * NOTE: cannot use delete_keyframe_fcurve(),
as that will free the curve,
+ * and delete_keyframe() expects the
FCurve to be part of an action
+ */
+ bool found = false;
+ int i;
+
+ /* try to find index of beztriple to get rid of
*/
+ i = binarysearch_bezt_index(fcu->bezt, cfra,
fcu->totvert, &found);
+ if (found) {
+ /* delete the key at the index (will
sanity check + do recalc afterwards) */
+ delete_fcurve_key(fcu, i, 1);
+ success = true;
+ }
+ }
+ }
+ else {
+ /* standard properties */
+ path = RNA_path_from_ID_to_property(&ptr, prop);
- success = delete_keyframe(op->reports, ptr.id.data,
NULL, NULL, path, index, cfra, 0);
- MEM_freeN(path);
+ if (path) {
+ if (all) {
+ /* -1 indicates operating on the entire
array (or the property itself otherwise) */
+ index = -1;
+ }
+
+ success = delete_keyframe(op->reports,
ptr.id.data, NULL, NULL, path, index, cfra, 0);
+ MEM_freeN(path);
+ }
+ else if (G.debug & G_DEBUG)
+ printf("Button Delete-Key: no path to
property\n");
}
- else if (G.debug & G_DEBUG)
- printf("Button Delete-Key: no path to property\n");
}
else if (G.debug & G_DEBUG) {
printf("ptr.data = %p, prop = %p\n", (void *)ptr.data, (void
*)prop);
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs