Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_outliner/outliner_select.c
| Show First 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | |||||
| #include "UI_view2d.h" | #include "UI_view2d.h" | ||||
| #include "RNA_access.h" | #include "RNA_access.h" | ||||
| #include "RNA_define.h" | #include "RNA_define.h" | ||||
| #include "outliner_intern.h" | #include "outliner_intern.h" | ||||
| static bool do_outliner_activate_common(bContext *C, | static bool do_outliner_activate_common(bContext *C, | ||||
| Main *bmain, | |||||
| Depsgraph *depsgraph, | Depsgraph *depsgraph, | ||||
| Scene *scene, | Scene *scene, | ||||
| ViewLayer *view_layer, | ViewLayer *view_layer, | ||||
| Base *base, | Base *base, | ||||
| const bool extend, | const bool extend, | ||||
| const bool do_exit) | const bool do_exit) | ||||
| { | { | ||||
| bool use_all = false; | bool use_all = false; | ||||
| if (do_exit) { | if (do_exit) { | ||||
| FOREACH_OBJECT_BEGIN (view_layer, ob_iter) { | FOREACH_OBJECT_BEGIN (view_layer, ob_iter) { | ||||
| ED_object_mode_generic_exit(bmain, depsgraph, scene, ob_iter); | ED_object_mode_generic_exit(C, depsgraph, scene, ob_iter); | ||||
| } | } | ||||
| FOREACH_OBJECT_END; | FOREACH_OBJECT_END; | ||||
| } | } | ||||
| /* Just like clicking in the object changes the active object, | /* Just like clicking in the object changes the active object, | ||||
| * clicking on the object data should change it as well. */ | * clicking on the object data should change it as well. */ | ||||
| ED_object_base_activate(C, base); | ED_object_base_activate(C, base); | ||||
| Show All 28 Lines | if (obact == NULL) { | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); | WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); | ||||
| obact = ob; | obact = ob; | ||||
| use_all = true; | use_all = true; | ||||
| } | } | ||||
| else if (obact->data == ob->data) { | else if (obact->data == ob->data) { | ||||
| use_all = true; | use_all = true; | ||||
| } | } | ||||
| else if (obact->mode == OB_MODE_OBJECT) { | else if (obact->mode == OB_MODE_OBJECT) { | ||||
| use_all = do_outliner_activate_common( | use_all = do_outliner_activate_common(C, depsgraph, scene, view_layer, base, extend, false); | ||||
| C, bmain, depsgraph, scene, view_layer, base, extend, false); | |||||
| } | } | ||||
| else if ((ob->type != obact->type) || ((obact->mode & OB_MODE_EDIT) == 0) || | else if ((ob->type != obact->type) || ((obact->mode & OB_MODE_EDIT) == 0) || | ||||
| ((obact->mode & OB_MODE_POSE) && ELEM(OB_ARMATURE, ob->type, obact->type)) || !extend) { | ((obact->mode & OB_MODE_POSE) && ELEM(OB_ARMATURE, ob->type, obact->type)) || !extend) { | ||||
| use_all = do_outliner_activate_common( | use_all = do_outliner_activate_common(C, depsgraph, scene, view_layer, base, extend, true); | ||||
| C, bmain, depsgraph, scene, view_layer, base, extend, true); | |||||
| } | } | ||||
| if (use_all) { | if (use_all) { | ||||
| WM_operator_name_call(C, "OBJECT_OT_editmode_toggle", WM_OP_INVOKE_REGION_WIN, NULL); | WM_operator_name_call(C, "OBJECT_OT_editmode_toggle", WM_OP_INVOKE_REGION_WIN, NULL); | ||||
| } | } | ||||
| else { | else { | ||||
| bool ok; | bool ok; | ||||
| if (BKE_object_is_in_editmode(ob)) { | if (BKE_object_is_in_editmode(ob)) { | ||||
| Show All 25 Lines | if (obact == NULL) { | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); | WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); | ||||
| obact = ob; | obact = ob; | ||||
| use_all = true; | use_all = true; | ||||
| } | } | ||||
| else if (obact->data == ob->data) { | else if (obact->data == ob->data) { | ||||
| use_all = true; | use_all = true; | ||||
| } | } | ||||
| else if (obact->mode == OB_MODE_OBJECT) { | else if (obact->mode == OB_MODE_OBJECT) { | ||||
| use_all = do_outliner_activate_common( | use_all = do_outliner_activate_common(C, depsgraph, scene, view_layer, base, extend, false); | ||||
| C, bmain, depsgraph, scene, view_layer, base, extend, false); | |||||
| } | } | ||||
| else if ((!ELEM(ob->type, obact->type)) || | else if ((!ELEM(ob->type, obact->type)) || | ||||
| ((obact->mode & OB_MODE_EDIT) && ELEM(OB_ARMATURE, ob->type, obact->type))) { | ((obact->mode & OB_MODE_EDIT) && ELEM(OB_ARMATURE, ob->type, obact->type))) { | ||||
| use_all = do_outliner_activate_common( | use_all = do_outliner_activate_common(C, depsgraph, scene, view_layer, base, extend, true); | ||||
| C, bmain, depsgraph, scene, view_layer, base, extend, true); | |||||
| } | } | ||||
| if (use_all) { | if (use_all) { | ||||
| WM_operator_name_call(C, "OBJECT_OT_posemode_toggle", WM_OP_INVOKE_REGION_WIN, NULL); | WM_operator_name_call(C, "OBJECT_OT_posemode_toggle", WM_OP_INVOKE_REGION_WIN, NULL); | ||||
| } | } | ||||
| else { | else { | ||||
| bool ok = false; | bool ok = false; | ||||
| if (ob->mode & OB_MODE_POSE) { | if (ob->mode & OB_MODE_POSE) { | ||||
| ▲ Show 20 Lines • Show All 143 Lines • ▼ Show 20 Lines | static eOLDrawState tree_element_set_active_object(bContext *C, | ||||
| base = BKE_view_layer_base_find(view_layer, ob); | base = BKE_view_layer_base_find(view_layer, ob); | ||||
| if (scene->toolsettings->object_flag & SCE_OBJECT_MODE_LOCK) { | if (scene->toolsettings->object_flag & SCE_OBJECT_MODE_LOCK) { | ||||
| if (base != NULL) { | if (base != NULL) { | ||||
| Object *obact = OBACT(view_layer); | Object *obact = OBACT(view_layer); | ||||
| const eObjectMode object_mode = obact ? obact->mode : OB_MODE_OBJECT; | const eObjectMode object_mode = obact ? obact->mode : OB_MODE_OBJECT; | ||||
| if (base && !BKE_object_is_mode_compat(base->object, object_mode)) { | if (base && !BKE_object_is_mode_compat(base->object, object_mode)) { | ||||
| if (object_mode == OB_MODE_OBJECT) { | if (object_mode == OB_MODE_OBJECT) { | ||||
| struct Main *bmain = CTX_data_main(C); | |||||
| Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
| ED_object_mode_generic_exit(bmain, depsgraph, scene, base->object); | ED_object_mode_generic_exit(C, depsgraph, scene, base->object); | ||||
| } | } | ||||
| if (!BKE_object_is_mode_compat(base->object, object_mode)) { | if (!BKE_object_is_mode_compat(base->object, object_mode)) { | ||||
| base = NULL; | base = NULL; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,425 Lines • Show Last 20 Lines | |||||