Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_outliner/outliner_select.c
| Show All 33 Lines | |||||
| #include "DNA_armature_types.h" | #include "DNA_armature_types.h" | ||||
| #include "DNA_group_types.h" | #include "DNA_group_types.h" | ||||
| #include "DNA_lamp_types.h" | #include "DNA_lamp_types.h" | ||||
| #include "DNA_material_types.h" | #include "DNA_material_types.h" | ||||
| #include "DNA_object_types.h" | #include "DNA_object_types.h" | ||||
| #include "DNA_scene_types.h" | #include "DNA_scene_types.h" | ||||
| #include "DNA_sequence_types.h" | #include "DNA_sequence_types.h" | ||||
| #include "DNA_world_types.h" | #include "DNA_world_types.h" | ||||
| #include "DNA_gpencil_types.h" | |||||
| #include "BLI_utildefines.h" | #include "BLI_utildefines.h" | ||||
| #include "BLI_listbase.h" | #include "BLI_listbase.h" | ||||
| #include "BKE_armature.h" | #include "BKE_armature.h" | ||||
| #include "BKE_collection.h" | #include "BKE_collection.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| #include "BKE_gpencil.h" | |||||
| #include "BKE_layer.h" | #include "BKE_layer.h" | ||||
| #include "BKE_main.h" | #include "BKE_main.h" | ||||
| #include "BKE_object.h" | #include "BKE_object.h" | ||||
| #include "BKE_paint.h" | |||||
| #include "BKE_scene.h" | #include "BKE_scene.h" | ||||
| #include "BKE_sequencer.h" | #include "BKE_sequencer.h" | ||||
| #include "BKE_workspace.h" | #include "BKE_workspace.h" | ||||
| #include "DEG_depsgraph.h" | #include "DEG_depsgraph.h" | ||||
| #include "ED_armature.h" | #include "ED_armature.h" | ||||
| #include "ED_object.h" | #include "ED_object.h" | ||||
| #include "ED_screen.h" | #include "ED_screen.h" | ||||
| #include "ED_sequencer.h" | #include "ED_sequencer.h" | ||||
| #include "ED_undo.h" | #include "ED_undo.h" | ||||
| #include "ED_gpencil.h" | |||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| #include "UI_view2d.h" | #include "UI_view2d.h" | ||||
| ▲ Show 20 Lines • Show All 376 Lines • ▼ Show 20 Lines | else { | ||||
| if (ob == OBACT(view_layer)) | if (ob == OBACT(view_layer)) | ||||
| if (ob->actdef == te->index + 1) { | if (ob->actdef == te->index + 1) { | ||||
| return OL_DRAWSEL_NORMAL; | return OL_DRAWSEL_NORMAL; | ||||
| } | } | ||||
| } | } | ||||
| return OL_DRAWSEL_NONE; | return OL_DRAWSEL_NONE; | ||||
| } | } | ||||
| static eOLDrawState UNUSED_FUNCTION(tree_element_active_gplayer)( | |||||
| bContext *C, Scene *UNUSED(scene), TreeElement *te, TreeStoreElem *tselem, const eOLSetState set) | |||||
| { | |||||
| bGPdata *gpd = (bGPdata *)tselem->id; | |||||
| bGPDlayer *gpl = te->directdata; | |||||
| /* We can only have a single "active" layer at a time | |||||
| * and there must always be an active layer... | |||||
| */ | |||||
| if (set != OL_SETSEL_NONE) { | |||||
| if (gpl) { | |||||
| BKE_gpencil_layer_setactive(gpd, gpl); | |||||
| WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_SELECTED, gpd); | |||||
| } | |||||
| } | |||||
| else { | |||||
| return OL_DRAWSEL_NORMAL; | |||||
| } | |||||
| return OL_DRAWSEL_NONE; | |||||
| } | |||||
| static eOLDrawState tree_element_active_posegroup( | static eOLDrawState tree_element_active_posegroup( | ||||
| bContext *C, Scene *UNUSED(scene), ViewLayer *view_layer, TreeElement *te, TreeStoreElem *tselem, const eOLSetState set) | bContext *C, Scene *UNUSED(scene), ViewLayer *view_layer, TreeElement *te, TreeStoreElem *tselem, const eOLSetState set) | ||||
| { | { | ||||
| Object *ob = (Object *)tselem->id; | Object *ob = (Object *)tselem->id; | ||||
| if (set != OL_SETSEL_NONE) { | if (set != OL_SETSEL_NONE) { | ||||
| if (ob->pose) { | if (ob->pose) { | ||||
| ob->pose->active_group = te->index + 1; | ob->pose->active_group = te->index + 1; | ||||
| ▲ Show 20 Lines • Show All 519 Lines • ▼ Show 20 Lines | else if (OB_DATA_SUPPORT_EDITMODE(te->idcode)) { | ||||
| Object *ob = (Object *)outliner_search_back(soops, te, ID_OB); | Object *ob = (Object *)outliner_search_back(soops, te, ID_OB); | ||||
| if ((ob != NULL) && (ob->data == tselem->id)) { | if ((ob != NULL) && (ob->data == tselem->id)) { | ||||
| Base *base = BKE_view_layer_base_find(view_layer, ob); | Base *base = BKE_view_layer_base_find(view_layer, ob); | ||||
| if ((base != NULL) && (base->flag & BASE_VISIBLED)) { | if ((base != NULL) && (base->flag & BASE_VISIBLED)) { | ||||
| do_outliner_activate_obdata(C, scene, view_layer, base); | do_outliner_activate_obdata(C, scene, view_layer, base); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| else if (ELEM(te->idcode, ID_GD)) { | |||||
| /* set grease pencil to object mode */ | |||||
| WM_operator_name_call(C, "GPENCIL_OT_editmode_toggle", WM_OP_INVOKE_REGION_WIN, NULL); | |||||
| } | |||||
| else { // rest of types | else { // rest of types | ||||
| tree_element_active(C, scene, view_layer, soops, te, OL_SETSEL_NORMAL, false); | tree_element_active(C, scene, view_layer, soops, te, OL_SETSEL_NORMAL, false); | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| tree_element_type_active(C, scene, view_layer, soops, te, tselem, | tree_element_type_active(C, scene, view_layer, soops, te, tselem, | ||||
| extend ? OL_SETSEL_EXTEND : OL_SETSEL_NORMAL, | extend ? OL_SETSEL_EXTEND : OL_SETSEL_NORMAL, | ||||
| ▲ Show 20 Lines • Show All 210 Lines • Show Last 20 Lines | |||||