diff options
-rw-r--r-- | source/blender/editors/animation/anim_deps.c | 14 | ||||
-rw-r--r-- | source/blender/editors/animation/drivers.c | 4 | ||||
-rw-r--r-- | source/blender/editors/animation/keyframing.c | 10 | ||||
-rw-r--r-- | source/blender/editors/animation/keyingsets.c | 4 | ||||
-rw-r--r-- | source/blender/editors/armature/poseobject.c | 8 | ||||
-rw-r--r-- | source/blender/editors/include/ED_anim_api.h | 5 | ||||
-rw-r--r-- | source/blender/editors/object/object_add.c | 6 | ||||
-rw-r--r-- | source/blender/editors/object/object_edit.c | 5 | ||||
-rw-r--r-- | source/blender/editors/object/object_relations.c | 18 | ||||
-rw-r--r-- | source/blender/editors/object/object_transform.c | 4 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_buttons.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/view3d_snap.c | 8 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_fcurve.c | 39 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_scene_api.c | 16 |
14 files changed, 69 insertions, 80 deletions
diff --git a/source/blender/editors/animation/anim_deps.c b/source/blender/editors/animation/anim_deps.c index 9d39911548b..7a96c3b32a3 100644 --- a/source/blender/editors/animation/anim_deps.c +++ b/source/blender/editors/animation/anim_deps.c @@ -55,20 +55,6 @@ #include "WM_api.h" #include "WM_types.h" -/* ***************** depsgraph calls and anim updates ************* */ -/* ***************** only these can be called from editors ******** */ - -void ED_anim_dag_flush_update(const bContext *C) -{ - DAG_ids_flush_update(0); -} - -/* flushes changes from object to all relations in scene */ -void ED_anim_object_flush_update(const bContext *C, Object *ob) -{ - DAG_id_update_flags(&ob->id); -} - /* **************************** pose <-> action syncing ******************************** */ /* Summary of what needs to be synced between poses and actions: * 1) Flags diff --git a/source/blender/editors/animation/drivers.c b/source/blender/editors/animation/drivers.c index a91e67ffc91..e731faaf103 100644 --- a/source/blender/editors/animation/drivers.c +++ b/source/blender/editors/animation/drivers.c @@ -398,7 +398,7 @@ static int add_driver_button_exec (bContext *C, wmOperator *op) if (success) { /* send updates */ - ED_anim_dag_flush_update(C); + DAG_ids_flush_update(0); /* for now, only send ND_KEYS for KeyingSets */ WM_event_add_notifier(C, ND_KEYS, NULL); // XXX @@ -462,7 +462,7 @@ static int remove_driver_button_exec (bContext *C, wmOperator *op) if (success) { /* send updates */ - ED_anim_dag_flush_update(C); + DAG_ids_flush_update(0); /* for now, only send ND_KEYS for KeyingSets */ WM_event_add_notifier(C, ND_KEYS, NULL); // XXX diff --git a/source/blender/editors/animation/keyframing.c b/source/blender/editors/animation/keyframing.c index 1854f602761..bc706271359 100644 --- a/source/blender/editors/animation/keyframing.c +++ b/source/blender/editors/animation/keyframing.c @@ -1023,7 +1023,7 @@ static int insert_key_exec (bContext *C, wmOperator *op) } /* send updates */ - ED_anim_dag_flush_update(C); + DAG_ids_flush_update(0); return OPERATOR_FINISHED; } @@ -1210,7 +1210,7 @@ static int delete_key_exec (bContext *C, wmOperator *op) } /* send updates */ - ED_anim_dag_flush_update(C); + DAG_ids_flush_update(0); return OPERATOR_FINISHED; } @@ -1277,7 +1277,7 @@ static int delete_key_v3d_exec (bContext *C, wmOperator *op) CTX_DATA_END; /* send updates */ - ED_anim_dag_flush_update(C); + DAG_ids_flush_update(0); WM_event_add_notifier(C, NC_OBJECT|ND_KEYS, NULL); @@ -1367,7 +1367,7 @@ static int insert_key_button_exec (bContext *C, wmOperator *op) if (success) { /* send updates */ - ED_anim_dag_flush_update(C); + DAG_ids_flush_update(0); /* for now, only send ND_KEYS for KeyingSets */ WM_event_add_notifier(C, ND_KEYS, NULL); @@ -1437,7 +1437,7 @@ static int delete_key_button_exec (bContext *C, wmOperator *op) if(success) { /* send updates */ - ED_anim_dag_flush_update(C); + DAG_ids_flush_update(0); /* for now, only send ND_KEYS for KeyingSets */ WM_event_add_notifier(C, ND_KEYS, NULL); diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index d7406a7bcfd..39dd652e649 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -366,7 +366,7 @@ static int add_keyingset_button_exec (bContext *C, wmOperator *op) if (success) { /* send updates */ - ED_anim_dag_flush_update(C); + DAG_ids_flush_update(0); /* for now, only send ND_KEYS for KeyingSets */ WM_event_add_notifier(C, NC_SCENE|ND_KEYINGSET, NULL); @@ -444,7 +444,7 @@ static int remove_keyingset_button_exec (bContext *C, wmOperator *op) if (success) { /* send updates */ - ED_anim_dag_flush_update(C); + DAG_ids_flush_update(0); /* for now, only send ND_KEYS for KeyingSets */ WM_event_add_notifier(C, NC_SCENE|ND_KEYINGSET, NULL); diff --git a/source/blender/editors/armature/poseobject.c b/source/blender/editors/armature/poseobject.c index 18750d96f86..846e6fcc23b 100644 --- a/source/blender/editors/armature/poseobject.c +++ b/source/blender/editors/armature/poseobject.c @@ -241,10 +241,10 @@ void ED_pose_recalculate_paths(bContext *C, Scene *scene, Object *ob) /* hack: for unsaved files, set OB_RECALC so that paths can get calculated */ if ((ob->recalc & OB_RECALC)==0) { ob->recalc |= OB_RECALC; - ED_anim_object_flush_update(C, ob); + DAG_id_update_flags(&ob->id); } else - ED_anim_object_flush_update(C, ob); + DAG_id_update_flags(&ob->id); /* calculate path over requested range */ for (CFRA=sfra; CFRA<=efra; CFRA++) { @@ -355,10 +355,10 @@ static int pose_calculate_paths_exec (bContext *C, wmOperator *op) /* hack: for unsaved files, set OB_RECALC so that paths can get calculated */ if ((ob->recalc & OB_RECALC)==0) { ob->recalc |= OB_RECALC; - ED_anim_object_flush_update(C, ob); + DAG_id_update_flags(&ob->id); } else - ED_anim_object_flush_update(C, ob); + DAG_id_update_flags(&ob->id); /* alloc the path cache arrays */ for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h index 9e6a757baa2..af24402f3ca 100644 --- a/source/blender/editors/include/ED_anim_api.h +++ b/source/blender/editors/include/ED_anim_api.h @@ -481,11 +481,6 @@ void ED_nla_postop_refresh(bAnimContext *ac); /* --------- anim_deps.c, animation updates -------- */ - /* generic update flush, does tagged objects only, reads from Context screen (layers) and scene */ -void ED_anim_dag_flush_update(const struct bContext *C); - /* only flush object */ -void ED_anim_object_flush_update(const struct bContext *C, struct Object *ob); - /* pose <-> action syncing */ void ANIM_action_to_pose_sync(struct Object *ob); void ANIM_pose_to_action_sync(struct Object *ob, struct ScrArea *sa); diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c index e58170ebab6..16be0e32e17 100644 --- a/source/blender/editors/object/object_add.c +++ b/source/blender/editors/object/object_add.c @@ -755,7 +755,7 @@ static int object_delete_exec(bContext *C, wmOperator *op) if(islamp) reshadeall_displist(scene); /* only frees displist */ DAG_scene_sort(scene); - ED_anim_dag_flush_update(C); + DAG_ids_flush_update(0); WM_event_add_notifier(C, NC_SCENE|ND_OB_ACTIVE, CTX_data_scene(C)); @@ -951,7 +951,7 @@ static int object_duplicates_make_real_exec(bContext *C, wmOperator *op) CTX_DATA_END; DAG_scene_sort(scene); - ED_anim_dag_flush_update(C); + DAG_ids_flush_update(0); WM_event_add_notifier(C, NC_SCENE, scene); return OPERATOR_FINISHED; @@ -1480,7 +1480,7 @@ static int duplicate_exec(bContext *C, wmOperator *op) copy_object_set_idnew(C, dupflag); DAG_scene_sort(scene); - ED_anim_dag_flush_update(C); + DAG_ids_flush_update(0); WM_event_add_notifier(C, NC_SCENE|ND_OB_SELECT, scene); diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 3f731696ef8..ecb9226e5f7 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1062,7 +1062,7 @@ void flip_subdivison(Scene *scene, View3D *v3d, int level) } } - ED_anim_dag_flush_update(C); + DAG_ids_flush_update(0); } static void copymenu_properties(Scene *scene, View3D *v3d, Object *ob) @@ -1549,8 +1549,7 @@ void copy_attr(Scene *scene, View3D *v3d, short event) if(do_scene_sort) DAG_scene_sort(scene); - ED_anim_dag_flush_update(C); - + DAG_ids_flush_update(0); } void copy_attr_menu(Scene *scene, View3D *v3d) diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index ac7e76abc13..c0979e410fd 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -458,7 +458,7 @@ static int parent_clear_exec(bContext *C, wmOperator *op) CTX_DATA_END; DAG_scene_sort(CTX_data_scene(C)); - ED_anim_dag_flush_update(C); + DAG_ids_flush_update(0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -684,7 +684,7 @@ static int parent_set_exec(bContext *C, wmOperator *op) CTX_DATA_END; DAG_scene_sort(scene); - ED_anim_dag_flush_update(C); + DAG_ids_flush_update(0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -772,7 +772,7 @@ static int parent_noinv_set_exec(bContext *C, wmOperator *op) CTX_DATA_END; DAG_scene_sort(CTX_data_scene(C)); - ED_anim_dag_flush_update(C); + DAG_ids_flush_update(0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -812,7 +812,7 @@ static int object_slow_parent_clear_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - ED_anim_dag_flush_update(C); + DAG_ids_flush_update(0); WM_event_add_notifier(C, NC_SCENE, scene); return OPERATOR_FINISHED; @@ -850,7 +850,7 @@ static int object_slow_parent_set_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - ED_anim_dag_flush_update(C); + DAG_ids_flush_update(0); WM_event_add_notifier(C, NC_SCENE, scene); return OPERATOR_FINISHED; @@ -899,8 +899,8 @@ static int object_track_clear_exec(bContext *C, wmOperator *op) } CTX_DATA_END; + DAG_ids_flush_update(0); DAG_scene_sort(CTX_data_scene(C)); - ED_anim_dag_flush_update(C); return OPERATOR_FINISHED; } @@ -992,7 +992,7 @@ static int track_set_exec(bContext *C, wmOperator *op) CTX_DATA_END; } DAG_scene_sort(scene); - ED_anim_dag_flush_update(C); + DAG_ids_flush_update(0); return OPERATOR_FINISHED; } @@ -1172,7 +1172,7 @@ static int make_links_scene_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - ED_anim_dag_flush_update(C); + DAG_ids_flush_update(0); /* one day multiple scenes will be visible, then we should have some update function for them */ return OPERATOR_FINISHED; @@ -1240,7 +1240,7 @@ static int make_links_data_exec(bContext *C, wmOperator *op) } CTX_DATA_END; - ED_anim_dag_flush_update(C); + DAG_ids_flush_update(0); WM_event_add_notifier(C, NC_SPACE|ND_SPACE_VIEW3D, CTX_wm_view3d(C)); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/object/object_transform.c b/source/blender/editors/object/object_transform.c index cb66384b1f8..c8f1bb55136 100644 --- a/source/blender/editors/object/object_transform.c +++ b/source/blender/editors/object/object_transform.c @@ -341,7 +341,7 @@ static int object_origin_clear_exec(bContext *C, wmOperator *op) CTX_DATA_END; if(armature_clear==0) /* in this case flush was done */ - ED_anim_dag_flush_update(C); + DAG_ids_flush_update(0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); @@ -1010,7 +1010,7 @@ static int object_center_set_exec(bContext *C, wmOperator *op) CTX_DATA_END; if (tot_change) { - ED_anim_dag_flush_update(C); + DAG_ids_flush_update(0); } /* Warn if any errors occured */ diff --git a/source/blender/editors/space_graph/graph_buttons.c b/source/blender/editors/space_graph/graph_buttons.c index a13df292990..97b3dd29ef9 100644 --- a/source/blender/editors/space_graph/graph_buttons.c +++ b/source/blender/editors/space_graph/graph_buttons.c @@ -235,13 +235,13 @@ static void do_graph_region_driver_buttons(bContext *C, void *arg, int event) DAG_scene_sort(scene); /* force an update of depsgraph */ - ED_anim_dag_flush_update(C); + DAG_ids_flush_update(0); } break; } /* default for now */ - WM_event_add_notifier(C, NC_SCENE, scene); // XXX does this always work? + WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); // XXX could use better notifier } /* callback to remove the active driver */ @@ -342,7 +342,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa) /* show expression box if doing scripted drivers, and/or error messages when invalid drivers exist */ if (driver->type == DRIVER_TYPE_PYTHON) { /* expression */ - uiItemR(col, "Expr:", 0, &driver_ptr, "expression", 0); + uiItemR(col, "Expr", 0, &driver_ptr, "expression", 0); /* errors? */ if (driver->flag & DRIVER_FLAG_INVALID) @@ -377,7 +377,7 @@ static void graph_panel_drivers(const bContext *C, Panel *pa) uiItemR(row, "", 0, &dtar_ptr, "name", 0); /* remove button */ - but= uiDefIconBut(block, BUT, B_REDR, ICON_X, 290, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Delete target variable."); + but= uiDefIconBut(block, BUT, B_IPO_DEPCHANGE, ICON_X, 290, 0, UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0.0, 0.0, "Delete target variable."); uiButSetFunc(but, driver_delete_var_cb, driver, dtar); diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 933b12ae679..a23163f4a5c 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -543,7 +543,8 @@ static int snap_sel_to_grid(bContext *C, wmOperator *op) } CTX_DATA_END; } - ED_anim_dag_flush_update(C); + + DAG_ids_flush_update(0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -667,7 +668,8 @@ static int snap_sel_to_curs(bContext *C, wmOperator *op) } CTX_DATA_END; } - ED_anim_dag_flush_update(C); + + DAG_ids_flush_update(0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return OPERATOR_FINISHED; @@ -1058,7 +1060,7 @@ static int snap_selected_to_center(bContext *C, wmOperator *op) CTX_DATA_END; } - ED_anim_dag_flush_update(C); + DAG_ids_flush_update(0); WM_event_add_notifier(C, NC_OBJECT|ND_TRANSFORM, NULL); return OPERATOR_FINISHED; diff --git a/source/blender/makesrna/intern/rna_fcurve.c b/source/blender/makesrna/intern/rna_fcurve.c index 10a4a9f5fbd..0b295f4c613 100644 --- a/source/blender/makesrna/intern/rna_fcurve.c +++ b/source/blender/makesrna/intern/rna_fcurve.c @@ -89,16 +89,39 @@ static StructRNA *rna_FModifierType_refine(struct PointerRNA *ptr) #include "BKE_fcurve.h" #include "BKE_depsgraph.h" +#include "BKE_animsys.h" static void rna_ChannelDriver_update_data(bContext *C, PointerRNA *ptr) { ID *id= ptr->id.data; + ChannelDriver *driver= ptr->data; + + driver->flag &= ~DRIVER_FLAG_INVALID; // TODO: this really needs an update guard... DAG_scene_sort(CTX_data_scene(C)); - DAG_id_flush_update(id, OB_RECALC_DATA); + DAG_id_flush_update(id, OB_RECALC_OB|OB_RECALC_DATA); - WM_event_add_notifier(C, NC_SCENE, id); + WM_event_add_notifier(C, NC_SCENE|ND_FRAME, CTX_data_scene(C)); +} + +static void rna_DriverTarget_update_data(bContext *C, PointerRNA *ptr) +{ + PointerRNA driverptr; + ChannelDriver *driver; + FCurve *fcu; + AnimData *adt= BKE_animdata_from_id(ptr->id.data); + + /* find the driver this belongs to and update it */ + for(fcu=adt->drivers.first; fcu; fcu=fcu->next) { + driver= fcu->driver; + + if(driver && BLI_findindex(&driver->targets, ptr->data) != -1) { + RNA_pointer_create(ptr->id.data, &RNA_Driver, driver, &driverptr); + rna_ChannelDriver_update_data(C, &driverptr); + return; + } + } } /* ----------- */ @@ -641,7 +664,7 @@ static void rna_def_drivertarget(BlenderRNA *brna) prop= RNA_def_property(srna, "name", PROP_STRING, PROP_NONE); RNA_def_struct_name_property(srna, prop); RNA_def_property_ui_text(prop, "Name", "Name to use in scripted expressions/functions. (No spaces or dots are allowed. Also, must not start with a symbol or digit)"); - //RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data"); // XXX disabled for now, until we can turn off auto updates + RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data"); /* Target Properties - ID-block to Drive */ prop= RNA_def_property(srna, "id", PROP_POINTER, PROP_NONE); @@ -650,7 +673,7 @@ static void rna_def_drivertarget(BlenderRNA *brna) RNA_def_property_editable_func(prop, "rna_DriverTarget_id_editable"); RNA_def_property_pointer_funcs(prop, NULL, NULL, "rna_DriverTarget_id_typef"); RNA_def_property_ui_text(prop, "ID", "ID-block that the specific property used can be found from (id_type property must be set first)"); - //RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data"); // XXX disabled for now, until we can turn off auto updates + RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data"); prop= RNA_def_property(srna, "id_type", PROP_ENUM, PROP_NONE); RNA_def_property_enum_sdna(prop, NULL, "idtype"); @@ -658,17 +681,17 @@ static void rna_def_drivertarget(BlenderRNA *brna) RNA_def_property_enum_default(prop, ID_OB); RNA_def_property_enum_funcs(prop, NULL, "rna_DriverTarget_id_type_set", NULL); RNA_def_property_ui_text(prop, "ID Type", "Type of ID-block that can be used."); - //RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data"); // XXX disabled for now, until we can turn off auto updates + RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data"); /* Target Properties - Property to Drive */ prop= RNA_def_property(srna, "rna_path", PROP_STRING, PROP_NONE); RNA_def_property_string_funcs(prop, "rna_DriverTarget_RnaPath_get", "rna_DriverTarget_RnaPath_length", "rna_DriverTarget_RnaPath_set"); RNA_def_property_ui_text(prop, "RNA Path", "RNA Path (from Object) to property used"); - //RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data"); // XXX disabled for now, until we can turn off auto updates + RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data"); prop= RNA_def_property(srna, "array_index", PROP_INT, PROP_NONE); RNA_def_property_ui_text(prop, "RNA Array Index", "Index to the specific property used (if applicable)"); - //RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data"); // XXX disabled for now, until we can turn off auto updates + RNA_def_property_update(prop, 0, "rna_DriverTarget_update_data"); } @@ -727,7 +750,7 @@ static void rna_def_channeldriver(BlenderRNA *brna) /* String values */ prop= RNA_def_property(srna, "expression", PROP_STRING, PROP_NONE); RNA_def_property_ui_text(prop, "Expression", "Expression to use for Scripted Expression."); - //RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data"); // XXX disabled for now, until we can turn off auto updates + RNA_def_property_update(prop, 0, "rna_ChannelDriver_update_data"); /* Collections */ prop= RNA_def_property(srna, "targets", PROP_COLLECTION, PROP_NONE); diff --git a/source/blender/makesrna/intern/rna_scene_api.c b/source/blender/makesrna/intern/rna_scene_api.c index 05fd9889e31..89e9c2ee5ca 100644 --- a/source/blender/makesrna/intern/rna_scene_api.c +++ b/source/blender/makesrna/intern/rna_scene_api.c @@ -57,18 +57,6 @@ static void rna_Scene_set_frame(Scene *scene, bContext *C, int frame) WM_event_add_notifier(C, NC_SCENE|ND_FRAME, scene); } -static void rna_Scene_update(Scene *scene, bContext *C) -{ - /* added to update driver deps, copied from do_graph_region_driver_buttons - * but can be extended with update options */ - - /* rebuild depsgraph for the new deps */ - DAG_scene_sort(scene); - - /* force an update of depsgraph */ - ED_anim_dag_flush_update(C); -} - static KeyingSet *rna_Scene_add_keying_set(Scene *sce, ReportList *reports, char name[], int absolute, int insertkey_needed, int insertkey_visual) { @@ -109,10 +97,6 @@ void RNA_api_scene(StructRNA *srna) parm= RNA_def_int(func, "frame", 0, MINAFRAME, MAXFRAME, "", "Frame number to set.", MINAFRAME, MAXFRAME); RNA_def_property_flag(parm, PROP_REQUIRED); - func= RNA_def_function(srna, "update", "rna_Scene_update"); - RNA_def_function_flag(func, FUNC_USE_CONTEXT); - RNA_def_function_ui_description(func, "Rebuild the scene dependancy graph."); - /* Add Keying Set */ func= RNA_def_function(srna, "add_keying_set", "rna_Scene_add_keying_set"); RNA_def_function_ui_description(func, "Add a new Keying Set to Scene."); |