diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-07-01 18:16:39 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-07-01 19:29:12 +0300 |
commit | ad717fe7373514e1695e016224b9b2180885a487 (patch) | |
tree | a122a8a6926b0d258f60b2ddab0ddc5c53284de3 /source | |
parent | 158679c9cc0f024fd54874f48e82cc00072caab4 (diff) |
Outliner: pass operator's reports to all operation callbacks.
Also define single callback func typedef, cleaner this way!
Note: maybe we want to do that for the other callbacks too (data, etc.), but will be enough for now.
Diffstat (limited to 'source')
4 files changed, 169 insertions, 131 deletions
diff --git a/source/blender/blenkernel/BKE_library_remap.h b/source/blender/blenkernel/BKE_library_remap.h index e85a3e60751..23d080e072c 100644 --- a/source/blender/blenkernel/BKE_library_remap.h +++ b/source/blender/blenkernel/BKE_library_remap.h @@ -73,4 +73,4 @@ void BKE_library_callback_remap_editor_id_reference_set(BKE_library_remap_editor } #endif -#endif /* __BKE_LIBRARY_REMAP_H__ */
\ No newline at end of file +#endif /* __BKE_LIBRARY_REMAP_H__ */ diff --git a/source/blender/editors/space_outliner/outliner_edit.c b/source/blender/editors/space_outliner/outliner_edit.c index 2618a14aa0d..45c45ffe39c 100644 --- a/source/blender/editors/space_outliner/outliner_edit.c +++ b/source/blender/editors/space_outliner/outliner_edit.c @@ -243,8 +243,9 @@ static void do_item_rename(ARegion *ar, TreeElement *te, TreeStoreElem *tselem, } } -void item_rename_cb(bContext *C, Scene *UNUSED(scene), TreeElement *te, - TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) +void item_rename_cb( + bContext *C, ReportList *UNUSED(reports), Scene *UNUSED(scene), TreeElement *te, + TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) { ARegion *ar = CTX_wm_region(C); ReportList *reports = CTX_wm_reports(C); // XXX @@ -321,8 +322,8 @@ static void id_delete(bContext *C, TreeElement *te, TreeStoreElem *tselem) } void id_delete_cb( - bContext *C, Scene *UNUSED(scene), TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, - void *UNUSED(user_data)) + bContext *C, ReportList *UNUSED(reports), Scene *UNUSED(scene), + TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) { id_delete(C, te, tselem); } @@ -520,7 +521,7 @@ void OUTLINER_OT_id_remap(wmOperatorType *ot) } void id_remap_cb( - bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(te), + bContext *C, ReportList *UNUSED(reports), Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) { wmOperatorType *ot = WM_operatortype_find("OUTLINER_OT_id_remap", false); @@ -644,7 +645,7 @@ void OUTLINER_OT_lib_relocate(wmOperatorType *ot) /* XXX This does not work with several items * (it is only called once in the end, due to the 'deferred' filebrowser invocation through event system...). */ void lib_relocate_cb( - bContext *C, Scene *UNUSED(scene), TreeElement *te, + bContext *C, ReportList *UNUSED(reports), Scene *UNUSED(scene), TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) { wmOperatorType *ot = WM_operatortype_find("WM_OT_lib_relocate", false); @@ -686,7 +687,7 @@ void OUTLINER_OT_lib_reload(wmOperatorType *ot) } void lib_reload_cb( - bContext *C, Scene *UNUSED(scene), TreeElement *te, + bContext *C, ReportList *UNUSED(reports), Scene *UNUSED(scene), TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) { wmOperatorType *ot = WM_operatortype_find("WM_OT_lib_reload", false); @@ -773,8 +774,9 @@ int common_restrict_check(bContext *C, Object *ob) /* Toggle Visibility ---------------------------------------- */ -void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, - TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) +void object_toggle_visibility_cb( + bContext *C, ReportList *UNUSED(reports), Scene *scene, TreeElement *te, + TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) { Base *base = (Base *)te->directdata; Object *ob = (Object *)tselem->id; @@ -789,21 +791,22 @@ void object_toggle_visibility_cb(bContext *C, Scene *scene, TreeElement *te, } } -void group_toggle_visibility_cb(bContext *UNUSED(C), Scene *scene, TreeElement *UNUSED(te), - TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) +void group_toggle_visibility_cb( + bContext *UNUSED(C), ReportList *UNUSED(reports), Scene *scene, TreeElement *UNUSED(te), + TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) { Group *group = (Group *)tselem->id; restrictbutton_gr_restrict_flag(scene, group, OB_RESTRICT_VIEW); } -static int outliner_toggle_visibility_exec(bContext *C, wmOperator *UNUSED(op)) +static int outliner_toggle_visibility_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); SpaceOops *soops = CTX_wm_space_outliner(C); Scene *scene = CTX_data_scene(C); ARegion *ar = CTX_wm_region(C); - outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_visibility_cb); + outliner_do_object_operation(C, op->reports, scene, soops, &soops->tree, object_toggle_visibility_cb); DAG_id_type_tag(bmain, ID_OB); WM_event_add_notifier(C, NC_SCENE | ND_OB_VISIBLE, scene); @@ -828,8 +831,9 @@ void OUTLINER_OT_visibility_toggle(wmOperatorType *ot) /* Toggle Selectability ---------------------------------------- */ -void object_toggle_selectability_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, - TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) +void object_toggle_selectability_cb( + bContext *UNUSED(C), ReportList *UNUSED(reports), Scene *scene, TreeElement *te, + TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) { Base *base = (Base *)te->directdata; @@ -839,20 +843,21 @@ void object_toggle_selectability_cb(bContext *UNUSED(C), Scene *scene, TreeEleme } } -void group_toggle_selectability_cb(bContext *UNUSED(C), Scene *scene, TreeElement *UNUSED(te), - TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) +void group_toggle_selectability_cb( + bContext *UNUSED(C), ReportList *reports, Scene *scene, TreeElement *UNUSED(te), + TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) { Group *group = (Group *)tselem->id; restrictbutton_gr_restrict_flag(scene, group, OB_RESTRICT_SELECT); } -static int outliner_toggle_selectability_exec(bContext *C, wmOperator *UNUSED(op)) +static int outliner_toggle_selectability_exec(bContext *C, wmOperator *op) { SpaceOops *soops = CTX_wm_space_outliner(C); Scene *scene = CTX_data_scene(C); ARegion *ar = CTX_wm_region(C); - outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_selectability_cb); + outliner_do_object_operation(C, op->reports, scene, soops, &soops->tree, object_toggle_selectability_cb); WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); ED_region_tag_redraw(ar); @@ -876,8 +881,9 @@ void OUTLINER_OT_selectability_toggle(wmOperatorType *ot) /* Toggle Renderability ---------------------------------------- */ -void object_toggle_renderability_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, - TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) +void object_toggle_renderability_cb( + bContext *UNUSED(C), ReportList *UNUSED(reports), Scene *scene, TreeElement *te, + TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) { Base *base = (Base *)te->directdata; @@ -887,20 +893,21 @@ void object_toggle_renderability_cb(bContext *UNUSED(C), Scene *scene, TreeEleme } } -void group_toggle_renderability_cb(bContext *UNUSED(C), Scene *scene, TreeElement *UNUSED(te), - TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) +void group_toggle_renderability_cb( + bContext *UNUSED(C), ReportList *UNUSED(reports), Scene *scene, TreeElement *UNUSED(te), + TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) { Group *group = (Group *)tselem->id; restrictbutton_gr_restrict_flag(scene, group, OB_RESTRICT_RENDER); } -static int outliner_toggle_renderability_exec(bContext *C, wmOperator *UNUSED(op)) +static int outliner_toggle_renderability_exec(bContext *C, wmOperator *op) { Main *bmain = CTX_data_main(C); SpaceOops *soops = CTX_wm_space_outliner(C); Scene *scene = CTX_data_scene(C); - outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_renderability_cb); + outliner_do_object_operation(C, op->reports, scene, soops, &soops->tree, object_toggle_renderability_cb); DAG_id_type_tag(bmain, ID_OB); WM_event_add_notifier(C, NC_SCENE | ND_OB_RENDER, scene); diff --git a/source/blender/editors/space_outliner/outliner_intern.h b/source/blender/editors/space_outliner/outliner_intern.h index d68815c5e57..d2666cd0b6d 100644 --- a/source/blender/editors/space_outliner/outliner_intern.h +++ b/source/blender/editors/space_outliner/outliner_intern.h @@ -153,44 +153,58 @@ eOLDrawState tree_element_active(struct bContext *C, struct Scene *scene, SpaceO int outliner_item_do_activate(struct bContext *C, int x, int y, bool extend, bool recursive); /* outliner_edit.c ---------------------------------------------- */ +typedef void (*outliner_operation_cb)( + struct bContext *C, struct ReportList *, struct Scene *scene, + struct TreeElement *, struct TreeStoreElem *, TreeStoreElem *, void *); void outliner_do_object_operation_ex( - struct bContext *C, struct Scene *scene, struct SpaceOops *soops, struct ListBase *lb, - void (*operation_cb)(struct bContext *C, struct Scene *scene, - struct TreeElement *, struct TreeStoreElem *, TreeStoreElem *, void *), - bool recurse_selected); + struct bContext *C, ReportList *reports, struct Scene *scene, struct SpaceOops *soops, struct ListBase *lb, + outliner_operation_cb operation_cb, bool recurse_selected); void outliner_do_object_operation( - struct bContext *C, struct Scene *scene, struct SpaceOops *soops, struct ListBase *lb, - void (*operation_cb)(struct bContext *C, struct Scene *scene, - struct TreeElement *, struct TreeStoreElem *, TreeStoreElem *, void *)); + struct bContext *C, ReportList *reports, struct Scene *scene, struct SpaceOops *soops, struct ListBase *lb, + outliner_operation_cb operation_cb); int common_restrict_check(struct bContext *C, struct Object *ob); int outliner_has_one_flag(struct SpaceOops *soops, ListBase *lb, short flag, const int curlevel); void outliner_set_flag(struct SpaceOops *soops, ListBase *lb, short flag, short set); -void object_toggle_visibility_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem, void *user_data); -void object_toggle_selectability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem, void *user_data); -void object_toggle_renderability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem, void *user_data); - - -void group_toggle_visibility_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem, void *user_data); -void group_toggle_selectability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem, void *user_data); -void group_toggle_renderability_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem, void *user_data); - -void item_rename_cb(struct bContext *C, struct Scene *scene, TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem, void *user_data); +void object_toggle_visibility_cb( + struct bContext *C, struct ReportList *reports, struct Scene *scene, + TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem, void *user_data); +void object_toggle_selectability_cb( + struct bContext *C, struct ReportList *reports, struct Scene *scene, + TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem, void *user_data); +void object_toggle_renderability_cb( + struct bContext *C, struct ReportList *reports, struct Scene *scene, + TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem, void *user_data); + + +void group_toggle_visibility_cb( + struct bContext *C, struct ReportList *reports, struct Scene *scene, + TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem, void *user_data); +void group_toggle_selectability_cb( + struct bContext *C, struct ReportList *reports, struct Scene *scene, + TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem, void *user_data); +void group_toggle_renderability_cb( + struct bContext *C, struct ReportList *reports, struct Scene *scene, + TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem, void *user_data); + +void item_rename_cb( + struct bContext *C, struct ReportList *reports, struct Scene *scene, + TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem, void *user_data); void lib_relocate_cb( - struct bContext *C, struct Scene *scene, struct TreeElement *te, + struct bContext *C, struct ReportList *reports, struct Scene *scene, struct TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem, void *user_data); void lib_reload_cb( - struct bContext *C, struct Scene *scene, struct TreeElement *te, + struct bContext *C, struct ReportList *reports, struct Scene *scene, struct TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem, void *user_data); void id_delete_cb( - struct bContext *C, struct Scene *scene, struct TreeElement *te, + struct bContext *C, struct ReportList *reports, struct Scene *scene, struct TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem, void *user_data); void id_remap_cb( - struct bContext *C, struct Scene *scene, struct TreeElement *te, + struct bContext *C, struct ReportList *reports, struct Scene *scene, struct TreeElement *te, struct TreeStoreElem *tsep, struct TreeStoreElem *tselem, void *user_data); TreeElement *outliner_dropzone_find(const struct SpaceOops *soops, const float fmval[2], const bool children); diff --git a/source/blender/editors/space_outliner/outliner_tools.c b/source/blender/editors/space_outliner/outliner_tools.c index e80ba5d40df..d92fec4c90d 100644 --- a/source/blender/editors/space_outliner/outliner_tools.c +++ b/source/blender/editors/space_outliner/outliner_tools.c @@ -134,15 +134,17 @@ static void set_operation_types(SpaceOops *soops, ListBase *lb, } } -static void unlink_action_cb(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(te), - TreeStoreElem *tsep, TreeStoreElem *UNUSED(tselem), void *UNUSED(user_data)) +static void unlink_action_cb( + bContext *C, ReportList *UNUSED(reports), Scene *UNUSED(scene), TreeElement *UNUSED(te), + TreeStoreElem *tsep, TreeStoreElem *UNUSED(tselem), void *UNUSED(user_data)) { /* just set action to NULL */ BKE_animdata_set_action(CTX_wm_reports(C), tsep->id, NULL); } -static void unlink_material_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *te, - TreeStoreElem *tsep, TreeStoreElem *UNUSED(tselem), void *UNUSED(user_data)) +static void unlink_material_cb( + bContext *UNUSED(C), ReportList *UNUSED(reports), Scene *UNUSED(scene), TreeElement *te, + TreeStoreElem *tsep, TreeStoreElem *UNUSED(tselem), void *UNUSED(user_data)) { Material **matar = NULL; int a, totcol = 0; @@ -181,8 +183,9 @@ static void unlink_material_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeEl } } -static void unlink_texture_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *te, - TreeStoreElem *tsep, TreeStoreElem *UNUSED(tselem), void *UNUSED(user_data)) +static void unlink_texture_cb( + bContext *UNUSED(C), ReportList *UNUSED(reports), Scene *UNUSED(scene), TreeElement *te, + TreeStoreElem *tsep, TreeStoreElem *UNUSED(tselem), void *UNUSED(user_data)) { MTex **mtex = NULL; int a; @@ -218,7 +221,7 @@ static void unlink_texture_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeEle } static void unlink_group_cb( - bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(te), + bContext *C, ReportList *UNUSED(reports), Scene *UNUSED(scene), TreeElement *UNUSED(te), TreeStoreElem *tsep, TreeStoreElem *tselem, void *UNUSED(user_data)) { Group *group = (Group *)tselem->id; @@ -231,13 +234,14 @@ static void unlink_group_cb( } else { Main *bmain = CTX_data_main(C); - BKE_libblock_unlink(bmain, group, false); + BKE_libblock_unlink(bmain, group, false, false); BKE_libblock_free(bmain, group); } } -static void unlink_world_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *UNUSED(te), - TreeStoreElem *tsep, TreeStoreElem *tselem, void *UNUSED(user_data)) +static void unlink_world_cb( + bContext *UNUSED(C), ReportList *UNUSED(reports), Scene *UNUSED(scene), TreeElement *UNUSED(te), + TreeStoreElem *tsep, TreeStoreElem *tselem, void *UNUSED(user_data)) { Scene *parscene = (Scene *)tsep->id; World *wo = (World *)tselem->id; @@ -248,8 +252,8 @@ static void unlink_world_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeEleme } static void outliner_do_libdata_operation( - bContext *C, Scene *scene, SpaceOops *soops, ListBase *lb, - void (*operation_cb)(bContext *C, Scene *scene, TreeElement *, TreeStoreElem *, TreeStoreElem *, void *), + bContext *C, ReportList *reports, Scene *scene, SpaceOops *soops, ListBase *lb, + outliner_operation_cb operation_cb, void *user_data) { TreeElement *te; @@ -260,11 +264,11 @@ static void outliner_do_libdata_operation( if (tselem->flag & TSE_SELECTED) { if (tselem->type == 0) { TreeStoreElem *tsep = te->parent ? TREESTORE(te->parent) : NULL; - operation_cb(C, scene, te, tsep, tselem, user_data); + operation_cb(C, reports, scene, te, tsep, tselem, user_data); } } if (TSELEM_OPEN(tselem, soops)) { - outliner_do_libdata_operation(C, scene, soops, &te->subtree, operation_cb, user_data); + outliner_do_libdata_operation(C, reports, scene, soops, &te->subtree, operation_cb, user_data); } } } @@ -354,8 +358,9 @@ void OUTLINER_OT_scene_operation(wmOperatorType *ot) } /* ******************************************** */ -static void object_select_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, - TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) +static void object_select_cb( + bContext *UNUSED(C), ReportList *UNUSED(reports), Scene *scene, TreeElement *te, + TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) { Base *base = (Base *)te->directdata; @@ -366,8 +371,9 @@ static void object_select_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, } } -static void object_select_hierarchy_cb(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(te), - TreeStoreElem *UNUSED(tsep), TreeStoreElem *UNUSED(tselem), void *UNUSED(user_data)) +static void object_select_hierarchy_cb( + bContext *C, ReportList *UNUSED(reports), Scene *UNUSED(scene), TreeElement *UNUSED(te), + TreeStoreElem *UNUSED(tsep), TreeStoreElem *UNUSED(tselem), void *UNUSED(user_data)) { /* From where do i get the x,y coordinate of the mouse event ? */ wmWindow *win = CTX_wm_window(C); @@ -377,8 +383,9 @@ static void object_select_hierarchy_cb(bContext *C, Scene *UNUSED(scene), TreeEl } -static void object_deselect_cb(bContext *UNUSED(C), Scene *scene, TreeElement *te, - TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) +static void object_deselect_cb( + bContext *UNUSED(C), ReportList *UNUSED(reports), Scene *scene, TreeElement *te, + TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) { Base *base = (Base *)te->directdata; @@ -389,8 +396,9 @@ static void object_deselect_cb(bContext *UNUSED(C), Scene *scene, TreeElement *t } } -static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, - TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) +static void object_delete_cb( + bContext *C, ReportList *UNUSED(reports), Scene *scene, TreeElement *te, + TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) { Base *base = (Base *)te->directdata; @@ -410,8 +418,9 @@ static void object_delete_cb(bContext *C, Scene *scene, TreeElement *te, } } -static void id_local_cb(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(te), - TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) +static void id_local_cb( + bContext *C, ReportList *UNUSED(reports), Scene *UNUSED(scene), TreeElement *UNUSED(te), + TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) { if (tselem->id->lib && (tselem->id->tag & LIB_TAG_EXTERN)) { /* if the ID type has no special local function, @@ -423,32 +432,36 @@ static void id_local_cb(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(t } } -static void id_fake_user_set_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *UNUSED(te), - TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) +static void id_fake_user_set_cb( + bContext *UNUSED(C), ReportList *UNUSED(reports), Scene *UNUSED(scene), TreeElement *UNUSED(te), + TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) { ID *id = tselem->id; id_fake_user_set(id); } -static void id_fake_user_clear_cb(bContext *UNUSED(C), Scene *UNUSED(scene), TreeElement *UNUSED(te), - TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) +static void id_fake_user_clear_cb( + bContext *UNUSED(C), ReportList *UNUSED(reports), Scene *UNUSED(scene), TreeElement *UNUSED(te), + TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) { ID *id = tselem->id; id_fake_user_clear(id); } -static void id_select_linked_cb(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(te), - TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) +static void id_select_linked_cb( + bContext *C, ReportList *UNUSED(reports), Scene *UNUSED(scene), TreeElement *UNUSED(te), + TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) { ID *id = tselem->id; ED_object_select_linked_by_id(C, id); } -static void singleuser_action_cb(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(te), - TreeStoreElem *tsep, TreeStoreElem *tselem, void *UNUSED(user_data)) +static void singleuser_action_cb( + bContext *C, ReportList *UNUSED(reports), Scene *UNUSED(scene), TreeElement *UNUSED(te), + TreeStoreElem *tsep, TreeStoreElem *tselem, void *UNUSED(user_data)) { ID *id = tselem->id; @@ -464,8 +477,9 @@ static void singleuser_action_cb(bContext *C, Scene *UNUSED(scene), TreeElement } } -static void singleuser_world_cb(bContext *C, Scene *UNUSED(scene), TreeElement *UNUSED(te), - TreeStoreElem *tsep, TreeStoreElem *tselem, void *UNUSED(user_data)) +static void singleuser_world_cb( + bContext *C, ReportList *UNUSED(reports), Scene *UNUSED(scene), TreeElement *UNUSED(te), + TreeStoreElem *tsep, TreeStoreElem *tselem, void *UNUSED(user_data)) { ID *id = tselem->id; @@ -482,8 +496,9 @@ static void singleuser_world_cb(bContext *C, Scene *UNUSED(scene), TreeElement * } } -static void group_linkobs2scene_cb(bContext *UNUSED(C), Scene *scene, TreeElement *UNUSED(te), - TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) +static void group_linkobs2scene_cb( + bContext *UNUSED(C), ReportList *UNUSED(reports), Scene *scene, TreeElement *UNUSED(te), + TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) { Group *group = (Group *)tselem->id; GroupObject *gob; @@ -508,8 +523,9 @@ static void group_linkobs2scene_cb(bContext *UNUSED(C), Scene *scene, TreeElemen } } -static void group_instance_cb(bContext *C, Scene *scene, TreeElement *UNUSED(te), - TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) +static void group_instance_cb( + bContext *C, ReportList *UNUSED(reports), Scene *scene, TreeElement *UNUSED(te), + TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) { Group *group = (Group *)tselem->id; @@ -523,9 +539,8 @@ static void group_instance_cb(bContext *C, Scene *scene, TreeElement *UNUSED(te) * \param select_recurse: Set to false for operations which are already recursively operating on their children. */ void outliner_do_object_operation_ex( - bContext *C, Scene *scene_act, SpaceOops *soops, ListBase *lb, - void (*operation_cb)(bContext *, Scene *, TreeElement *, TreeStoreElem *, TreeStoreElem *, void *), - bool select_recurse) + bContext *C, ReportList *reports, Scene *scene_act, SpaceOops *soops, ListBase *lb, + outliner_operation_cb operation_cb, bool select_recurse) { TreeElement *te; @@ -542,23 +557,24 @@ void outliner_do_object_operation_ex( /* important to use 'scene_owner' not scene_act else deleting objects can crash. * only use 'scene_act' when 'scene_owner' is NULL, which can happen when the * outliner isn't showing scenes: Visible Layer draw mode for eg. */ - operation_cb(C, scene_owner ? scene_owner : scene_act, te, NULL, tselem, NULL); + operation_cb(C, reports, scene_owner ? scene_owner : scene_act, te, NULL, tselem, NULL); select_handled = true; } } if (TSELEM_OPEN(tselem, soops)) { if ((select_handled == false) || select_recurse) { - outliner_do_object_operation_ex(C, scene_act, soops, &te->subtree, operation_cb, select_recurse); + outliner_do_object_operation_ex( + C, reports, scene_act, soops, &te->subtree, operation_cb, select_recurse); } } } } void outliner_do_object_operation( - bContext *C, Scene *scene_act, SpaceOops *soops, ListBase *lb, - void (*operation_cb)(bContext *, Scene *, TreeElement *, TreeStoreElem *, TreeStoreElem *, void *)) + bContext *C, ReportList *reports, Scene *scene_act, SpaceOops *soops, ListBase *lb, + outliner_operation_cb operation_cb) { - outliner_do_object_operation_ex(C, scene_act, soops, lb, operation_cb, true); + outliner_do_object_operation_ex(C, reports, scene_act, soops, lb, operation_cb, true); } /* ******************************************** */ @@ -816,7 +832,8 @@ static Base *outline_delete_hierarchy(bContext *C, Scene *scene, Base *base) } static void object_delete_hierarchy_cb( - bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) + bContext *C, ReportList *UNUSED(reports), Scene *scene, + TreeElement *te, TreeStoreElem *UNUSED(tsep), TreeStoreElem *tselem, void *UNUSED(user_data)) { Base *base = (Base *)te->directdata; Object *obedit = scene->obedit; @@ -889,7 +906,7 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op) if (event == OL_OP_SELECT) { Scene *sce = scene; // to be able to delete, scenes are set... - outliner_do_object_operation(C, scene, soops, &soops->tree, object_select_cb); + outliner_do_object_operation(C, op->reports, scene, soops, &soops->tree, object_select_cb); if (scene != sce) { ED_screen_set_scene(C, CTX_wm_screen(C), sce); } @@ -899,7 +916,7 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op) } else if (event == OL_OP_SELECT_HIERARCHY) { Scene *sce = scene; // to be able to delete, scenes are set... - outliner_do_object_operation_ex(C, scene, soops, &soops->tree, object_select_hierarchy_cb, false); + outliner_do_object_operation_ex(C, op->reports, scene, soops, &soops->tree, object_select_hierarchy_cb, false); if (scene != sce) { ED_screen_set_scene(C, CTX_wm_screen(C), sce); } @@ -907,12 +924,12 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); } else if (event == OL_OP_DESELECT) { - outliner_do_object_operation(C, scene, soops, &soops->tree, object_deselect_cb); + outliner_do_object_operation(C, op->reports, scene, soops, &soops->tree, object_deselect_cb); str = "Deselect Objects"; WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); } else if (event == OL_OP_DELETE) { - outliner_do_object_operation(C, scene, soops, &soops->tree, object_delete_cb); + outliner_do_object_operation(C, op->reports, scene, soops, &soops->tree, object_delete_cb); /* XXX: tree management normally happens from draw_outliner(), but when * you're clicking to fast on Delete object from context menu in @@ -926,7 +943,7 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene); } else if (event == OL_OP_DELETE_HIERARCHY) { - outliner_do_object_operation_ex(C, scene, soops, &soops->tree, object_delete_hierarchy_cb, false); + outliner_do_object_operation_ex(C, op->reports, scene, soops, &soops->tree, object_delete_hierarchy_cb, false); /* XXX: See OL_OP_DELETE comment above. */ outliner_cleanup_tree(soops); @@ -936,30 +953,30 @@ static int outliner_object_operation_exec(bContext *C, wmOperator *op) WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene); } else if (event == OL_OP_REMAP) { - outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_remap_cb, NULL); + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, id_remap_cb, NULL); str = "Remap ID"; } else if (event == OL_OP_LOCALIZED) { /* disabled, see above enum (ton) */ - outliner_do_object_operation(C, scene, soops, &soops->tree, id_local_cb); + outliner_do_object_operation(C, op->reports, scene, soops, &soops->tree, id_local_cb); str = "Localized Objects"; } else if (event == OL_OP_TOGVIS) { - outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_visibility_cb); + outliner_do_object_operation(C, op->reports, scene, soops, &soops->tree, object_toggle_visibility_cb); str = "Toggle Visibility"; WM_event_add_notifier(C, NC_SCENE | ND_OB_VISIBLE, scene); } else if (event == OL_OP_TOGSEL) { - outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_selectability_cb); + outliner_do_object_operation(C, op->reports, scene, soops, &soops->tree, object_toggle_selectability_cb); str = "Toggle Selectability"; WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); } else if (event == OL_OP_TOGREN) { - outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_renderability_cb); + outliner_do_object_operation(C, op->reports, scene, soops, &soops->tree, object_toggle_renderability_cb); str = "Toggle Renderability"; WM_event_add_notifier(C, NC_SCENE | ND_OB_RENDER, scene); } else if (event == OL_OP_RENAME) { - outliner_do_object_operation(C, scene, soops, &soops->tree, item_rename_cb); + outliner_do_object_operation(C, op->reports, scene, soops, &soops->tree, item_rename_cb); str = "Rename Object"; } else { @@ -1034,16 +1051,16 @@ static int outliner_group_operation_exec(bContext *C, wmOperator *op) switch (event) { case OL_GROUPOP_UNLINK: - outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_group_cb, NULL); + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, unlink_group_cb, NULL); break; case OL_GROUPOP_LOCAL: - outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_local_cb, NULL); + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, id_local_cb, NULL); break; case OL_GROUPOP_LINK: - outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_linkobs2scene_cb, NULL); + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, group_linkobs2scene_cb, NULL); break; case OL_GROUPOP_INSTANCE: - outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_instance_cb, NULL); + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, group_instance_cb, NULL); /* works without this except if you try render right after, see: 22027 */ DAG_relations_tag_update(CTX_data_main(C)); break; @@ -1051,19 +1068,19 @@ static int outliner_group_operation_exec(bContext *C, wmOperator *op) WM_operator_name_call(C, "OUTLINER_OT_id_delete", WM_OP_INVOKE_REGION_WIN, NULL); break; case OL_GROUPOP_REMAP: - outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_remap_cb, NULL); + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, id_remap_cb, NULL); break; case OL_GROUPOP_TOGVIS: - outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_visibility_cb, NULL); + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, group_toggle_visibility_cb, NULL); break; case OL_GROUPOP_TOGSEL: - outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_selectability_cb, NULL); + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, group_toggle_selectability_cb, NULL); break; case OL_GROUPOP_TOGREN: - outliner_do_libdata_operation(C, scene, soops, &soops->tree, group_toggle_renderability_cb, NULL); + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, group_toggle_renderability_cb, NULL); break; case OL_GROUPOP_RENAME: - outliner_do_libdata_operation(C, scene, soops, &soops->tree, item_rename_cb, NULL); + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, item_rename_cb, NULL); break; default: BLI_assert(0); @@ -1148,25 +1165,25 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) /* unlink datablock from its parent */ switch (idlevel) { case ID_AC: - outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_action_cb, NULL); + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, unlink_action_cb, NULL); WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL); ED_undo_push(C, "Unlink action"); break; case ID_MA: - outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_material_cb, NULL); + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, unlink_material_cb, NULL); WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, NULL); ED_undo_push(C, "Unlink material"); break; case ID_TE: - outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_texture_cb, NULL); + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, unlink_texture_cb, NULL); WM_event_add_notifier(C, NC_OBJECT | ND_OB_SHADING, NULL); ED_undo_push(C, "Unlink texture"); break; case ID_WO: - outliner_do_libdata_operation(C, scene, soops, &soops->tree, unlink_world_cb, NULL); + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, unlink_world_cb, NULL); WM_event_add_notifier(C, NC_SCENE | ND_WORLD, NULL); ED_undo_push(C, "Unlink world"); @@ -1180,7 +1197,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) case OUTLINER_IDOP_LOCAL: { /* make local */ - outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_local_cb, NULL); + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, id_local_cb, NULL); ED_undo_push(C, "Localized Data"); break; } @@ -1189,14 +1206,14 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) /* make single user */ switch (idlevel) { case ID_AC: - outliner_do_libdata_operation(C, scene, soops, &soops->tree, singleuser_action_cb, NULL); + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, singleuser_action_cb, NULL); WM_event_add_notifier(C, NC_ANIMATION | ND_NLA_ACTCHANGE, NULL); ED_undo_push(C, "Single-User Action"); break; case ID_WO: - outliner_do_libdata_operation(C, scene, soops, &soops->tree, singleuser_world_cb, NULL); + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, singleuser_world_cb, NULL); WM_event_add_notifier(C, NC_SCENE | ND_WORLD, NULL); ED_undo_push(C, "Single-User World"); @@ -1211,21 +1228,21 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) case OUTLINER_IDOP_DELETE: { if (idlevel > 0) { - outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_delete_cb, NULL); + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, id_delete_cb, NULL); } break; } case OUTLINER_IDOP_REMAP: { if (idlevel > 0) { - outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_remap_cb, NULL); + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, id_remap_cb, NULL); } break; } case OUTLINER_IDOP_FAKE_ADD: { /* set fake user */ - outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_fake_user_set_cb, NULL); + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, id_fake_user_set_cb, NULL); WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL); ED_undo_push(C, "Add Fake User"); @@ -1234,7 +1251,7 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) case OUTLINER_IDOP_FAKE_CLEAR: { /* clear fake user */ - outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_fake_user_clear_cb, NULL); + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, id_fake_user_clear_cb, NULL); WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL); ED_undo_push(C, "Clear Fake User"); @@ -1243,14 +1260,14 @@ static int outliner_id_operation_exec(bContext *C, wmOperator *op) case OUTLINER_IDOP_RENAME: { /* rename */ - outliner_do_libdata_operation(C, scene, soops, &soops->tree, item_rename_cb, NULL); + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, item_rename_cb, NULL); WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL); ED_undo_push(C, "Rename"); break; } case OUTLINER_IDOP_SELECT_LINKED: - outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_select_linked_cb, NULL); + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, id_select_linked_cb, NULL); ED_undo_push(C, "Select"); break; @@ -1324,7 +1341,7 @@ static int outliner_lib_operation_exec(bContext *C, wmOperator *op) case OL_LIB_RENAME: { /* rename */ - outliner_do_libdata_operation(C, scene, soops, &soops->tree, item_rename_cb, NULL); + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, item_rename_cb, NULL); WM_event_add_notifier(C, NC_ID | NA_EDITED, NULL); ED_undo_push(C, "Rename"); @@ -1332,19 +1349,19 @@ static int outliner_lib_operation_exec(bContext *C, wmOperator *op) } case OL_LIB_DELETE: { - outliner_do_libdata_operation(C, scene, soops, &soops->tree, id_delete_cb, NULL); + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, id_delete_cb, NULL); break; } case OL_LIB_RELOCATE: { /* rename */ - outliner_do_libdata_operation(C, scene, soops, &soops->tree, lib_relocate_cb, NULL); + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, lib_relocate_cb, NULL); break; } case OL_LIB_RELOAD: { /* rename */ - outliner_do_libdata_operation(C, scene, soops, &soops->tree, lib_reload_cb, NULL); + outliner_do_libdata_operation(C, op->reports, scene, soops, &soops->tree, lib_reload_cb, NULL); break; } default: |