Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_outliner/outliner_draw.c
| Show First 20 Lines • Show All 754 Lines • ▼ Show 20 Lines | else { | ||||
| TreeViewContext tvc; | TreeViewContext tvc; | ||||
| outliner_viewcontext_init(C, &tvc); | outliner_viewcontext_init(C, &tvc); | ||||
| bArmature *arm = (bArmature *)tselem->id; | bArmature *arm = (bArmature *)tselem->id; | ||||
| Bone *bone = te->directdata; | Bone *bone = te->directdata; | ||||
| char newname[sizeof(bone->name)]; | char newname[sizeof(bone->name)]; | ||||
| /* always make current object active */ | /* always make current object active */ | ||||
| tree_element_active(C, &tvc, space_outliner, te, OL_SETSEL_NORMAL, true); | tree_element_activate(C, &tvc, te, OL_SETSEL_NORMAL, true); | ||||
| /* restore bone name */ | /* restore bone name */ | ||||
| BLI_strncpy(newname, bone->name, sizeof(bone->name)); | BLI_strncpy(newname, bone->name, sizeof(bone->name)); | ||||
| BLI_strncpy(bone->name, oldname, sizeof(bone->name)); | BLI_strncpy(bone->name, oldname, sizeof(bone->name)); | ||||
| ED_armature_bone_rename(bmain, arm, oldname, newname); | ED_armature_bone_rename(bmain, arm, oldname, newname); | ||||
| WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL); | WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL); | ||||
| break; | break; | ||||
| } | } | ||||
| case TSE_POSE_CHANNEL: { | case TSE_POSE_CHANNEL: { | ||||
| TreeViewContext tvc; | TreeViewContext tvc; | ||||
| outliner_viewcontext_init(C, &tvc); | outliner_viewcontext_init(C, &tvc); | ||||
| Object *ob = (Object *)tselem->id; | Object *ob = (Object *)tselem->id; | ||||
| bPoseChannel *pchan = te->directdata; | bPoseChannel *pchan = te->directdata; | ||||
| char newname[sizeof(pchan->name)]; | char newname[sizeof(pchan->name)]; | ||||
| /* always make current pose-bone active */ | /* always make current pose-bone active */ | ||||
| tree_element_active(C, &tvc, space_outliner, te, OL_SETSEL_NORMAL, true); | tree_element_activate(C, &tvc, te, OL_SETSEL_NORMAL, true); | ||||
| BLI_assert(ob->type == OB_ARMATURE); | BLI_assert(ob->type == OB_ARMATURE); | ||||
| /* restore bone name */ | /* restore bone name */ | ||||
| BLI_strncpy(newname, pchan->name, sizeof(pchan->name)); | BLI_strncpy(newname, pchan->name, sizeof(pchan->name)); | ||||
| BLI_strncpy(pchan->name, oldname, sizeof(pchan->name)); | BLI_strncpy(pchan->name, oldname, sizeof(pchan->name)); | ||||
| ED_armature_bone_rename(bmain, ob->data, oldname, newname); | ED_armature_bone_rename(bmain, ob->data, oldname, newname); | ||||
| WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL); | WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL); | ||||
| ▲ Show 20 Lines • Show All 2,077 Lines • ▼ Show 20 Lines | if (level < 1 || (tselem->type == 0 && te->idcode == ID_OB)) { | ||||
| if (tselem->type == 0) { | if (tselem->type == 0) { | ||||
| if (te->idcode == ID_OB) { | if (te->idcode == ID_OB) { | ||||
| active = (tvc->obact == (Object *)tselem->id) ? OL_DRAWSEL_NORMAL : OL_DRAWSEL_NONE; | active = (tvc->obact == (Object *)tselem->id) ? OL_DRAWSEL_NORMAL : OL_DRAWSEL_NONE; | ||||
| } | } | ||||
| else if (is_object_data_in_editmode(tselem->id, tvc->obact)) { | else if (is_object_data_in_editmode(tselem->id, tvc->obact)) { | ||||
| active = OL_DRAWSEL_ACTIVE; | active = OL_DRAWSEL_ACTIVE; | ||||
| } | } | ||||
| else { | else { | ||||
| active = tree_element_active(C, tvc, space_outliner, te, OL_SETSEL_NONE, false); | active = tree_element_active_state_get(tvc, te, tselem); | ||||
| } | } | ||||
| } | } | ||||
| else if (tselem->type == TSE_GP_LAYER) { | |||||
| bGPDlayer *gpl = te->directdata; | |||||
| active = (gpl->flag & GP_LAYER_ACTIVE) ? OL_DRAWSEL_ACTIVE : OL_DRAWSEL_NONE; | |||||
| } | |||||
| else { | else { | ||||
| active = tree_element_type_active( | active = tree_element_type_active_state_get(C, tvc, te, tselem); | ||||
| C, tvc, space_outliner, te, tselem, OL_SETSEL_NONE, false); | |||||
| } | } | ||||
| if (!ELEM(tselem->type, 0, TSE_LAYER_COLLECTION, TSE_R_LAYER, TSE_GP_LAYER)) { | if (!ELEM(tselem->type, 0, TSE_LAYER_COLLECTION, TSE_R_LAYER, TSE_GP_LAYER)) { | ||||
| outliner_draw_iconrow_doit(block, te, fstyle, xmax, offsx, ys, alpha_fac, active, 1); | outliner_draw_iconrow_doit(block, te, fstyle, xmax, offsx, ys, alpha_fac, active, 1); | ||||
| } | } | ||||
| else { | else { | ||||
| const int index = tree_element_id_type_to_index(te); | const int index = tree_element_id_type_to_index(te); | ||||
| merged->num_elements[index]++; | merged->num_elements[index]++; | ||||
| ▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | if (*starty + 2 * UI_UNIT_Y >= region->v2d.cur.ymin && *starty <= region->v2d.cur.ymax) { | ||||
| if (restrict_column_width > 0) { | if (restrict_column_width > 0) { | ||||
| xmax -= restrict_column_width + UI_UNIT_X; | xmax -= restrict_column_width + UI_UNIT_X; | ||||
| } | } | ||||
| GPU_blend(GPU_BLEND_ALPHA); | GPU_blend(GPU_BLEND_ALPHA); | ||||
| /* Colors for active/selected data. */ | /* Colors for active/selected data. */ | ||||
| if (tselem->type == 0) { | if (tselem->type == 0) { | ||||
| if (te->idcode == ID_SCE) { | if (te->idcode == ID_OB) { | ||||
| if (tselem->id == (ID *)tvc->scene) { | |||||
| /* Active scene. */ | |||||
| icon_bgcolor[3] = 0.2f; | |||||
| active = OL_DRAWSEL_ACTIVE; | |||||
| } | |||||
| } | |||||
| else if (te->idcode == ID_OB) { | |||||
| Object *ob = (Object *)tselem->id; | Object *ob = (Object *)tselem->id; | ||||
| Base *base = (te->directdata) ? (Base *)te->directdata : | Base *base = (te->directdata) ? (Base *)te->directdata : | ||||
| BKE_view_layer_base_find(tvc->view_layer, ob); | BKE_view_layer_base_find(tvc->view_layer, ob); | ||||
| const bool is_selected = (base != NULL) && ((base->flag & BASE_SELECTED) != 0); | const bool is_selected = (base != NULL) && ((base->flag & BASE_SELECTED) != 0); | ||||
| if (ob == tvc->obact) { | if (ob == tvc->obact) { | ||||
| active = OL_DRAWSEL_ACTIVE; | active = OL_DRAWSEL_ACTIVE; | ||||
| } | } | ||||
| Show All 13 Lines | if (tselem->type == 0) { | ||||
| } | } | ||||
| else if (is_object_data_in_editmode(tselem->id, tvc->obact)) { | else if (is_object_data_in_editmode(tselem->id, tvc->obact)) { | ||||
| /* Objects being edited. */ | /* Objects being edited. */ | ||||
| UI_GetThemeColor4fv(TH_EDITED_OBJECT, icon_bgcolor); | UI_GetThemeColor4fv(TH_EDITED_OBJECT, icon_bgcolor); | ||||
| icon_border[3] = 0.3f; | icon_border[3] = 0.3f; | ||||
| active = OL_DRAWSEL_ACTIVE; | active = OL_DRAWSEL_ACTIVE; | ||||
| } | } | ||||
| else { | else { | ||||
| if (tree_element_active(C, tvc, space_outliner, te, OL_SETSEL_NONE, false)) { | if (tree_element_active_state_get(tvc, te, tselem)) { | ||||
| /* Active items like camera or material. */ | /* Active items like camera or material. */ | ||||
| icon_bgcolor[3] = 0.2f; | icon_bgcolor[3] = 0.2f; | ||||
| active = OL_DRAWSEL_ACTIVE; | active = OL_DRAWSEL_ACTIVE; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| else if (tselem->type == TSE_GP_LAYER) { | |||||
| /* Active grease pencil layer. */ | |||||
| if (((bGPDlayer *)te->directdata)->flag & GP_LAYER_ACTIVE) { | |||||
| icon_bgcolor[3] = 0.2f; | |||||
| active = OL_DRAWSEL_ACTIVE; | |||||
| } | |||||
| } | |||||
| else { | else { | ||||
| active = tree_element_type_active(C, tvc, space_outliner, te, tselem, OL_SETSEL_NONE, false); | active = tree_element_type_active_state_get(C, tvc, te, tselem); | ||||
| /* Active collection. */ | |||||
| } | } | ||||
| /* Active circle. */ | /* Active circle. */ | ||||
| if (active != OL_DRAWSEL_NONE) { | if (active != OL_DRAWSEL_NONE) { | ||||
| outliner_draw_active_indicator((float)startx + offsx + UI_UNIT_X, | outliner_draw_active_indicator((float)startx + offsx + UI_UNIT_X, | ||||
| (float)*starty, | (float)*starty, | ||||
| (float)startx + offsx + 2.0f * UI_UNIT_X, | (float)startx + offsx + 2.0f * UI_UNIT_X, | ||||
| (float)*starty + UI_UNIT_Y, | (float)*starty + UI_UNIT_Y, | ||||
| ▲ Show 20 Lines • Show All 647 Lines • Show Last 20 Lines | |||||