Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/object/object_select.c
| Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | |||||
| #include "BLI_listbase.h" | #include "BLI_listbase.h" | ||||
| #include "BLI_rand.h" | #include "BLI_rand.h" | ||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BLT_translation.h" | #include "BLT_translation.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_group.h" | #include "BKE_group.h" | ||||
| #include "BKE_layer.h" | |||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_material.h" | #include "BKE_material.h" | ||||
| #include "BKE_particle.h" | #include "BKE_particle.h" | ||||
| #include "BKE_property.h" | #include "BKE_property.h" | ||||
| #include "BKE_report.h" | #include "BKE_report.h" | ||||
| #include "BKE_scene.h" | #include "BKE_scene.h" | ||||
| #include "BKE_library.h" | #include "BKE_library.h" | ||||
| #include "BKE_deform.h" | #include "BKE_deform.h" | ||||
| ▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | if (base) { | ||||
| // select_actionchannel_by_name(base->object->action, "Object", 1); | // select_actionchannel_by_name(base->object->action, "Object", 1); | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene); | WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, scene); | ||||
| } | } | ||||
| else | else | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, NULL); | WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, NULL); | ||||
| } | } | ||||
| void ED_object_base_select(ObjectBase *base, short mode) | |||||
| { | |||||
| if (base) { | |||||
| if (mode == BA_SELECT) { | |||||
| if (!(base->object->restrictflag & OB_RESTRICT_SELECT)) | |||||
| base->flag |= BASE_SELECTED; | |||||
| } | |||||
| else if (mode == BA_DESELECT) { | |||||
| base->flag &= ~BASE_SELECTED; | |||||
| } | |||||
| } | |||||
| } | |||||
| void ED_object_base_activate(bContext *C, ObjectBase *base) | |||||
| { | |||||
| SceneLayer *sl = CTX_data_scene_layer(C); | |||||
| sl->basact = base; | |||||
| if (base) { | |||||
| WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, sl); | |||||
| } | |||||
| else { | |||||
| WM_event_add_notifier(C, NC_SCENE | ND_OB_ACTIVE, NULL); | |||||
| } | |||||
| } | |||||
| /********************** Selection Operators **********************/ | /********************** Selection Operators **********************/ | ||||
| static int objects_selectable_poll(bContext *C) | static int objects_selectable_poll(bContext *C) | ||||
| { | { | ||||
| /* we don't check for linked scenes here, selection is | /* we don't check for linked scenes here, selection is | ||||
| * still allowed then for inspection of scene */ | * still allowed then for inspection of scene */ | ||||
| Object *obact = CTX_data_active_object(C); | Object *obact = CTX_data_active_object(C); | ||||
| ▲ Show 20 Lines • Show All 431 Lines • ▼ Show 20 Lines | CTX_DATA_BEGIN (C, Base *, base, selectable_bases) | ||||
| } | } | ||||
| } | } | ||||
| CTX_DATA_END; | CTX_DATA_END; | ||||
| return changed; | return changed; | ||||
| } | } | ||||
| static bool select_grouped_parent(bContext *C) /* Makes parent active and de-selected OBACT */ | static bool select_grouped_parent(bContext *C) /* Makes parent active and de-selected OBACT */ | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | SceneLayer *sl = CTX_data_scene_layer(C); | ||||
| View3D *v3d = CTX_wm_view3d(C); | View3D *v3d = CTX_wm_view3d(C); | ||||
| ObjectBase *baspar, *basact = CTX_data_active_base(C); | |||||
| bool changed = false; | bool changed = false; | ||||
| Base *baspar, *basact = CTX_data_active_base(C); | |||||
| if (!basact || !(basact->object->parent)) return 0; /* we know OBACT is valid */ | if (!basact || !(basact->object->parent)) { | ||||
| return 0; /* we know OBACT is valid */ | |||||
| } | |||||
| baspar = BKE_scene_base_find(scene, basact->object->parent); | baspar = BKE_scene_layer_base_find(sl, basact->object->parent); | ||||
| /* can be NULL if parent in other scene */ | /* can be NULL if parent in other scene */ | ||||
| if (baspar && BASE_SELECTABLE(v3d, baspar)) { | if (baspar && BASE_SELECTABLE(v3d, baspar)) { | ||||
| ED_base_object_select(baspar, BA_SELECT); | ED_object_base_select(baspar, BA_SELECT); | ||||
| ED_base_object_activate(C, baspar); | ED_object_base_activate(C, baspar); | ||||
| changed = true; | changed = true; | ||||
| } | } | ||||
| return changed; | return changed; | ||||
| } | } | ||||
| #define GROUP_MENU_MAX 24 | #define GROUP_MENU_MAX 24 | ||||
| static bool select_grouped_group(bContext *C, Object *ob) /* Select objects in the same group as the active */ | static bool select_grouped_group(bContext *C, Object *ob) /* Select objects in the same group as the active */ | ||||
| ▲ Show 20 Lines • Show All 747 Lines • Show Last 20 Lines | |||||