[Bf-blender-cvs] [5d4ffb42a32] master: Delete Invalid Drivers: more lenient poll function

Sybren A. Stüvel noreply at git.blender.org
Wed Jan 17 17:47:01 CET 2018


Commit: 5d4ffb42a327b08542e3556e7a98f1bc14d21c70
Author: Sybren A. Stüvel
Date:   Wed Jan 17 17:14:31 2018 +0100
Branches: master
https://developer.blender.org/rB5d4ffb42a327b08542e3556e7a98f1bc14d21c70

Delete Invalid Drivers: more lenient poll function

This function is faster and also allows for deletion of invalid drivers in
nested data blocks (for example in shape keys). Thanks @sergey!

===================================================================

M	source/blender/editors/space_graph/graph_edit.c

===================================================================

diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c
index 69feae6ee24..43a83929eb0 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -2803,6 +2803,20 @@ static int graph_driver_delete_invalid_exec(bContext *C, wmOperator *op)
 	return OPERATOR_FINISHED;
 }
 
+static int graph_driver_delete_invalid_poll(bContext *C)
+{
+	bAnimContext ac;
+	ScrArea *sa = CTX_wm_area(C);
+
+	/* firstly, check if in Graph Editor */
+	if ((sa == NULL) || (sa->spacetype != SPACE_IPO))
+		return 0;
+
+	/* try to init Anim-Context stuff ourselves and check */
+	return ANIM_animdata_get_context(C, &ac) != 0;
+}
+
+
 void GRAPH_OT_driver_delete_invalid(wmOperatorType *ot)
 {
 	/* identifiers */
@@ -2812,7 +2826,7 @@ void GRAPH_OT_driver_delete_invalid(wmOperatorType *ot)
 
 	/* api callbacks */
 	ot->exec = graph_driver_delete_invalid_exec;
-	ot->poll = graphop_visible_keyframes_poll;
+	ot->poll = graph_driver_delete_invalid_poll;
 
 	/* flags */
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;



More information about the Bf-blender-cvs mailing list