Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_outliner/outliner_tools.c
| Context not available. | |||||
| void (*operation_cb)(bContext *C, Scene *scene, TreeElement *, | void (*operation_cb)(bContext *C, Scene *scene, TreeElement *, | ||||
| TreeStoreElem *, TreeStoreElem *)) | TreeStoreElem *, TreeStoreElem *)) | ||||
| { | { | ||||
| /* if you edit this function then there's a good chance you should also edit | |||||
| * function 'bool outliner_do_object_query_any_true(...)' */ | |||||
| TreeElement *te; | TreeElement *te; | ||||
| TreeStoreElem *tselem; | TreeStoreElem *tselem; | ||||
| Context not available. | |||||
| } | } | ||||
| } | } | ||||
| bool outliner_do_object_query_any_true(bContext *C, Scene *scene_act, SpaceOops *soops, ListBase *lb, | |||||
| bool(*operation_cb)(bContext *C, Scene *scene, TreeElement *, | |||||
| TreeStoreElem *, TreeStoreElem *)) | |||||
| { | |||||
| /* if you edit this function then there's a good chance you should also edit | |||||
| * function 'void outliner_do_object_operation(...)' */ | |||||
| TreeElement *te; | |||||
| TreeStoreElem *tselem; | |||||
| for (te = lb->first; te; te = te->next) { | |||||
| tselem = TREESTORE(te); | |||||
| if (tselem->flag & TSE_SELECTED) { | |||||
| if (tselem->type == 0 && te->idcode == ID_OB) { | |||||
| // when objects selected in other scenes... dunno if that should be allowed | |||||
| Scene *scene_owner = (Scene *)outliner_search_back(soops, te, ID_SCE); | |||||
| if (scene_owner && scene_act != scene_owner) { | |||||
| ED_screen_set_scene(C, CTX_wm_screen(C), scene_owner); | |||||
| } | |||||
| /* 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. */ | |||||
| if (operation_cb(C, scene_owner ? scene_owner : scene_act, te, NULL, tselem)) { | |||||
| return true; | |||||
| } | |||||
| } | |||||
| } | |||||
| if (TSELEM_OPEN(tselem, soops)) { | |||||
| if (outliner_do_object_query_any_true(C, scene_act, soops, &te->subtree, operation_cb)) { | |||||
| return true; | |||||
| } | |||||
| } | |||||
| } | |||||
| return false; | |||||
| } | |||||
| /* ******************************************** */ | /* ******************************************** */ | ||||
| static void clear_animdata_cb(int UNUSED(event), TreeElement *UNUSED(te), | static void clear_animdata_cb(int UNUSED(event), TreeElement *UNUSED(te), | ||||
| Context not available. | |||||
| str = "Localized Objects"; | str = "Localized Objects"; | ||||
| } | } | ||||
| else if (event == OL_OP_TOGVIS) { | else if (event == OL_OP_TOGVIS) { | ||||
| outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_visibility_cb); | bool b_any_restricted_vis = outliner_do_object_query_any_true(C, scene, soops, &soops->tree, object_query__is_restricted_vis_cb); | ||||
| outliner_do_object_operation(C, scene, soops, &soops->tree, | |||||
| b_any_restricted_vis ? object_unrestrict_visibility_cb : object_restrict_visibility_cb); | |||||
| str = "Toggle Visibility"; | str = "Toggle Visibility"; | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_OB_VISIBLE, scene); | WM_event_add_notifier(C, NC_SCENE | ND_OB_VISIBLE, scene); | ||||
| } | } | ||||
| else if (event == OL_OP_TOGSEL) { | else if (event == OL_OP_TOGSEL) { | ||||
| outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_selectability_cb); | bool b_any_restricted_sel = outliner_do_object_query_any_true(C, scene, soops, &soops->tree, object_query__is_restricted_sel_cb); | ||||
| outliner_do_object_operation(C, scene, soops, &soops->tree, | |||||
| b_any_restricted_sel ? object_unrestrict_selectability_cb : object_restrict_selectability_cb); | |||||
| str = "Toggle Selectability"; | str = "Toggle Selectability"; | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); | WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); | ||||
| } | } | ||||
| else if (event == OL_OP_TOGREN) { | else if (event == OL_OP_TOGREN) { | ||||
| outliner_do_object_operation(C, scene, soops, &soops->tree, object_toggle_renderability_cb); | bool b_any_restricted_rend = outliner_do_object_query_any_true(C, scene, soops, &soops->tree, object_query__is_restricted_renderability_cb); | ||||
| outliner_do_object_operation(C, scene, soops, &soops->tree, | |||||
| b_any_restricted_rend ? object_unrestrict_renderability_cb : object_restrict_renderability_cb); | |||||
| str = "Toggle Renderability"; | str = "Toggle Renderability"; | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_OB_RENDER, scene); | WM_event_add_notifier(C, NC_SCENE | ND_OB_RENDER, scene); | ||||
| } | } | ||||
| Context not available. | |||||