[Bf-blender-cvs] [bce4b7c] master: Code Cleanup: Fix up various odds and ends

Joshua Leung noreply at git.blender.org
Fri Apr 15 15:13:01 CEST 2016


Commit: bce4b7c868c5a30f1e888da7cc69e56330cd93ee
Author: Joshua Leung
Date:   Fri Apr 15 22:08:13 2016 +1200
Branches: master
https://developer.blender.org/rBbce4b7c868c5a30f1e888da7cc69e56330cd93ee

Code Cleanup: Fix up various odds and ends

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

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 a54b7e1..1932596 100644
--- a/source/blender/editors/space_graph/graph_edit.c
+++ b/source/blender/editors/space_graph/graph_edit.c
@@ -2642,10 +2642,10 @@ static int graph_driver_vars_copy_exec(bContext *C, wmOperator *op)
 	}
 	
 	/* successful or not? */
-	if (ok == 0)
-		return OPERATOR_CANCELLED;
-	else
+	if (ok)
 		return OPERATOR_FINISHED;
+	else
+		return OPERATOR_CANCELLED;
 }
  
 void GRAPH_OT_driver_variables_copy(wmOperatorType *ot)
@@ -2684,32 +2684,23 @@ static int graph_driver_vars_paste_exec(bContext *C, wmOperator *op)
 	filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_ACTIVE | ANIMFILTER_FOREDIT | ANIMFILTER_NODUPLIS);
 	ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
 	
-	/* paste modifiers */
+	/* paste variables */
 	for (ale = anim_data.first; ale; ale = ale->next) {
 		FCurve *fcu = (FCurve *)ale->data;
-		bool paste_ok;
-		
-		printf("pasting vars to %p -> %p\n", fcu, fcu->driver);
-		paste_ok = ANIM_driver_vars_paste(op->reports, fcu, replace);
-		
-		if (paste_ok) {
-			//ale->update |= ANIM_UPDATE_DEPS;
-			printf("now we have: %d vars\n",  BLI_listbase_count(&fcu->driver->variables));
-			ok = true;
-		}
+		ok |= ANIM_driver_vars_paste(op->reports, fcu, replace);
 	}
 	
-	// XXX: something causes a crash after adding the copies (to empty list), if we do an update immediately
-	if (ok) {
-		DAG_relations_tag_update(CTX_data_main(C));
-		//ANIM_animdata_update(&ac, &anim_data);
-	}
+	/* cleanup */
 	ANIM_animdata_freelist(&anim_data);
 	
 	/* successful or not? */
 	if (ok) {
+		/* rebuild depsgraph, now that there are extra deps here */
+		DAG_relations_tag_update(CTX_data_main(C));
+		
 		/* set notifier that keyframes have changed */
 		WM_event_add_notifier(C, NC_SCENE | ND_FRAME, CTX_data_scene(C));
+		
 		return OPERATOR_FINISHED;
 	}
 	else {
@@ -2732,9 +2723,8 @@ void GRAPH_OT_driver_variables_paste(wmOperatorType *ot)
 	ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
 	
 	/* properties */
-	RNA_def_boolean(ot->srna, "only_active", true, "Only Active", "Only paste F-Modifiers on active F-Curve");
 	RNA_def_boolean(ot->srna, "replace", false, "Replace Existing", 
-	                "Replace existing F-Modifiers, instead of just appending to the end of the existing list");
+	                "Replace existing driver variables, instead of just appending to the end of the existing list");
 }
 
 /* ************************************************************************** */




More information about the Bf-blender-cvs mailing list