Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_outliner/outliner_draw.c
| Show First 20 Lines • Show All 242 Lines • ▼ Show 20 Lines | static void restrictbutton_ebone_visibility_cb(bContext *C, void *UNUSED(poin), void *poin2) | ||||
| WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL); | WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL); | ||||
| } | } | ||||
| static void restrictbutton_gp_layer_flag_cb(bContext *C, void *UNUSED(poin), void *UNUSED(poin2)) | static void restrictbutton_gp_layer_flag_cb(bContext *C, void *UNUSED(poin), void *UNUSED(poin2)) | ||||
| { | { | ||||
| WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL); | WM_event_add_notifier(C, NC_GPENCIL | ND_DATA | NA_EDITED, NULL); | ||||
| } | } | ||||
| static void restrictbutton_collection_flag_cb(bContext *C, void *poin, void *UNUSED(poin2)) | |||||
| { | |||||
| ID *id = (ID *)poin; | |||||
| /* TODO(sergey): Use proper flag for tagging here. */ | |||||
| DEG_id_tag_update(id, 0); | |||||
| if (GS(id->name) == ID_SCE) { | |||||
| WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, id); | |||||
| } | |||||
| WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, NULL); | |||||
| } | |||||
| static void restrictbutton_id_user_toggle(bContext *UNUSED(C), void *poin, void *UNUSED(poin2)) | static void restrictbutton_id_user_toggle(bContext *UNUSED(C), void *poin, void *UNUSED(poin2)) | ||||
| { | { | ||||
| ID *id = (ID *)poin; | ID *id = (ID *)poin; | ||||
| BLI_assert(id != NULL); | BLI_assert(id != NULL); | ||||
| if (id->flag & LIB_FAKEUSER) { | if (id->flag & LIB_FAKEUSER) { | ||||
| id_us_plus(id); | id_us_plus(id); | ||||
| } | } | ||||
| else { | else { | ||||
| id_us_min(id); | id_us_min(id); | ||||
| } | } | ||||
| } | } | ||||
| static void layer_collection_exclude_recursive_set(LayerCollection *lc) | |||||
| { | |||||
| for (LayerCollection *nlc = lc->layer_collections.first; nlc; nlc = nlc->next) { | |||||
| if (lc->flag & LAYER_COLLECTION_EXCLUDE) { | |||||
| nlc->flag |= LAYER_COLLECTION_EXCLUDE; | |||||
| } | |||||
| else { | |||||
| nlc->flag &= ~LAYER_COLLECTION_EXCLUDE; | |||||
| } | |||||
| layer_collection_exclude_recursive_set(nlc); | |||||
| } | |||||
| } | |||||
| static void layer_collection_exclude_cb(bContext *C, void *poin, void *poin2) | |||||
| { | |||||
| Main *bmain = CTX_data_main(C); | |||||
| Scene *scene = (Scene *)poin; | |||||
| LayerCollection *lc = (LayerCollection *)poin2; | |||||
| ViewLayer *view_layer = BKE_view_layer_find_from_collection(scene, lc); | |||||
| layer_collection_exclude_recursive_set(lc); | |||||
| BKE_layer_collection_sync(scene, view_layer); | |||||
| /* TODO(sergey): Use proper flag for tagging here. */ | |||||
| DEG_id_tag_update(&scene->id, 0); | |||||
| DEG_relations_tag_update(bmain); | |||||
| WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL); | |||||
| } | |||||
| static void namebutton_cb(bContext *C, void *tsep, char *oldname) | static void namebutton_cb(bContext *C, void *tsep, char *oldname) | ||||
| { | { | ||||
| Main *bmain = CTX_data_main(C); | |||||
| SpaceOops *soops = CTX_wm_space_outliner(C); | SpaceOops *soops = CTX_wm_space_outliner(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| ViewLayer *view_layer = CTX_data_view_layer(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| Object *obedit = CTX_data_edit_object(C); | Object *obedit = CTX_data_edit_object(C); | ||||
| BLI_mempool *ts = soops->treestore; | BLI_mempool *ts = soops->treestore; | ||||
| TreeStoreElem *tselem = tsep; | TreeStoreElem *tselem = tsep; | ||||
| if (ts && tselem) { | if (ts && tselem) { | ||||
| TreeElement *te = outliner_find_tree_element(&soops->tree, tselem); | TreeElement *te = outliner_find_tree_element(&soops->tree, tselem); | ||||
| if (tselem->type == 0) { | if (tselem->type == 0) { | ||||
| BLI_libblock_ensure_unique_name(G.main, tselem->id->name); | BLI_libblock_ensure_unique_name(bmain, tselem->id->name); | ||||
| switch (GS(tselem->id->name)) { | switch (GS(tselem->id->name)) { | ||||
| case ID_MA: | case ID_MA: | ||||
| WM_event_add_notifier(C, NC_MATERIAL, NULL); break; | WM_event_add_notifier(C, NC_MATERIAL, NULL); break; | ||||
| case ID_TE: | case ID_TE: | ||||
| WM_event_add_notifier(C, NC_TEXTURE, NULL); break; | WM_event_add_notifier(C, NC_TEXTURE, NULL); break; | ||||
| case ID_IM: | case ID_IM: | ||||
| WM_event_add_notifier(C, NC_IMAGE, NULL); break; | WM_event_add_notifier(C, NC_IMAGE, NULL); break; | ||||
| case ID_SCE: | case ID_SCE: | ||||
| WM_event_add_notifier(C, NC_SCENE, NULL); break; | WM_event_add_notifier(C, NC_SCENE, NULL); break; | ||||
| default: | default: | ||||
| WM_event_add_notifier(C, NC_ID | NA_RENAME, NULL); break; | WM_event_add_notifier(C, NC_ID | NA_RENAME, NULL); break; | ||||
| } | } | ||||
| /* Check the library target exists */ | /* Check the library target exists */ | ||||
| if (te->idcode == ID_LI) { | if (te->idcode == ID_LI) { | ||||
| Library *lib = (Library *)tselem->id; | Library *lib = (Library *)tselem->id; | ||||
| char expanded[FILE_MAX]; | char expanded[FILE_MAX]; | ||||
| BKE_library_filepath_set(lib, lib->name); | BKE_library_filepath_set(lib, lib->name); | ||||
| BLI_strncpy(expanded, lib->name, sizeof(expanded)); | BLI_strncpy(expanded, lib->name, sizeof(expanded)); | ||||
| BLI_path_abs(expanded, G.main->name); | BLI_path_abs(expanded, bmain->name); | ||||
| if (!BLI_exists(expanded)) { | if (!BLI_exists(expanded)) { | ||||
| BKE_reportf(CTX_wm_reports(C), RPT_ERROR, | BKE_reportf(CTX_wm_reports(C), RPT_ERROR, | ||||
| "Library path '%s' does not exist, correct this before saving", expanded); | "Library path '%s' does not exist, correct this before saving", expanded); | ||||
| } | } | ||||
| else if (lib->id.tag & LIB_TAG_MISSING) { | else if (lib->id.tag & LIB_TAG_MISSING) { | ||||
| BKE_reportf(CTX_wm_reports(C), RPT_INFO, | BKE_reportf(CTX_wm_reports(C), RPT_INFO, | ||||
| "Library path '%s' is now valid, please reload the library", expanded); | "Library path '%s' is now valid, please reload the library", expanded); | ||||
| lib->id.tag &= ~LIB_TAG_MISSING; | lib->id.tag &= ~LIB_TAG_MISSING; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| switch (tselem->type) { | switch (tselem->type) { | ||||
| case TSE_DEFGROUP: | case TSE_DEFGROUP: | ||||
| defgroup_unique_name(te->directdata, (Object *)tselem->id); // id = object | defgroup_unique_name(te->directdata, (Object *)tselem->id); // id = object | ||||
| break; | break; | ||||
| case TSE_NLA_ACTION: | case TSE_NLA_ACTION: | ||||
| BLI_libblock_ensure_unique_name(G.main, tselem->id->name); | BLI_libblock_ensure_unique_name(bmain, tselem->id->name); | ||||
| break; | break; | ||||
| case TSE_EBONE: | case TSE_EBONE: | ||||
| { | { | ||||
| bArmature *arm = (bArmature *)tselem->id; | bArmature *arm = (bArmature *)tselem->id; | ||||
| if (arm->edbo) { | if (arm->edbo) { | ||||
| EditBone *ebone = te->directdata; | EditBone *ebone = te->directdata; | ||||
| char newname[sizeof(ebone->name)]; | char newname[sizeof(ebone->name)]; | ||||
| ▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | else { | ||||
| // XXX: name needs translation stuff | // XXX: name needs translation stuff | ||||
| BLI_uniquename(&gpd->layers, gpl, "GP Layer", '.', | BLI_uniquename(&gpd->layers, gpl, "GP Layer", '.', | ||||
| offsetof(bGPDlayer, info), sizeof(gpl->info)); | offsetof(bGPDlayer, info), sizeof(gpl->info)); | ||||
| WM_event_add_notifier(C, NC_GPENCIL | ND_DATA, gpd); | WM_event_add_notifier(C, NC_GPENCIL | ND_DATA, gpd); | ||||
| break; | break; | ||||
| } | } | ||||
| case TSE_R_LAYER: | case TSE_R_LAYER: | ||||
| { | |||||
| break; | break; | ||||
| case TSE_SCENE_COLLECTION: | } | ||||
| case TSE_LAYER_COLLECTION: | case TSE_LAYER_COLLECTION: | ||||
| { | { | ||||
| SceneCollection *sc = outliner_scene_collection_from_tree_element(te); | BLI_libblock_ensure_unique_name(bmain, tselem->id->name); | ||||
| BKE_collection_rename(tselem->id, sc, te->name); | WM_event_add_notifier(C, NC_ID | NA_RENAME, NULL); break; | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_LAYER, scene); | |||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| tselem->flag &= ~TSE_TEXTBUT; | tselem->flag &= ~TSE_TEXTBUT; | ||||
| } | } | ||||
| } | } | ||||
| static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar, SpaceOops *soops, ListBase *lb) | static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar, SpaceOops *soops, ListBase *lb) | ||||
| { | { | ||||
| uiBut *bt; | uiBut *bt; | ||||
| TreeElement *te; | TreeElement *te; | ||||
| TreeStoreElem *tselem; | TreeStoreElem *tselem; | ||||
| Object *ob = NULL; | Object *ob = NULL; | ||||
| #if 0 | /* get RNA properties (once for speed) */ | ||||
| PropertyRNA *object_prop_hide, *object_prop_hide_select, *object_prop_hide_render; | PropertyRNA *collection_prop_hide_viewport; | ||||
| PropertyRNA *collection_prop_hide_select; | |||||
| /* get RNA properties (once) */ | PropertyRNA *collection_prop_hide_render; | ||||
| object_prop_hide = RNA_struct_type_find_property(&RNA_Object, "hide"); | PropertyRNA *collection_prop_exclude; | ||||
| object_prop_hide_select = RNA_struct_type_find_property(&RNA_Object, "hide_select"); | collection_prop_hide_select = RNA_struct_type_find_property(&RNA_Collection, "hide_select"); | ||||
| object_prop_hide_render = RNA_struct_type_find_property(&RNA_Object, "hide_render"); | collection_prop_hide_viewport = RNA_struct_type_find_property(&RNA_Collection, "hide_viewport"); | ||||
| BLI_assert(object_prop_hide && object_prop_hide_select && object_prop_hide_render); | collection_prop_hide_render = RNA_struct_type_find_property(&RNA_Collection, "hide_render"); | ||||
| #endif | collection_prop_exclude = RNA_struct_type_find_property(&RNA_LayerCollection, "use"); | ||||
| BLI_assert(collection_prop_hide_viewport && | |||||
| collection_prop_hide_select && | |||||
| collection_prop_hide_render && | |||||
| collection_prop_exclude); | |||||
| for (te = lb->first; te; te = te->next) { | for (te = lb->first; te; te = te->next) { | ||||
| tselem = TREESTORE(te); | tselem = TREESTORE(te); | ||||
| if (te->ys + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { | if (te->ys + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { | ||||
| if (tselem->type == TSE_R_LAYER && (soops->outlinevis == SO_SCENES)) { | if (tselem->type == TSE_R_LAYER && (soops->outlinevis == SO_SCENES)) { | ||||
| /* View layer render toggle. */ | /* View layer render toggle. */ | ||||
| ViewLayer *view_layer = te->directdata; | ViewLayer *view_layer = te->directdata; | ||||
| ▲ Show 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | if (te->ys + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && te->ys <= ar->v2d.cur.ymax) { | ||||
| TIP_("Restrict/Allow editing of strokes and keyframes in this layer")); | TIP_("Restrict/Allow editing of strokes and keyframes in this layer")); | ||||
| UI_but_func_set(bt, restrictbutton_gp_layer_flag_cb, NULL, gpl); | UI_but_func_set(bt, restrictbutton_gp_layer_flag_cb, NULL, gpl); | ||||
| UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | ||||
| /* TODO: visibility in renders */ | /* TODO: visibility in renders */ | ||||
| UI_block_emboss_set(block, UI_EMBOSS); | UI_block_emboss_set(block, UI_EMBOSS); | ||||
| } | } | ||||
| else if (tselem->type == TSE_LAYER_COLLECTION) { | else if (outliner_is_collection_tree_element(te)) { | ||||
| LayerCollection *collection = te->directdata; | LayerCollection *lc = (tselem->type == TSE_LAYER_COLLECTION) ? te->directdata : NULL; | ||||
| Collection *collection = outliner_collection_from_tree_element(te); | |||||
| const bool is_enabled = (collection->flag & COLLECTION_DISABLED) == 0; | |||||
| UI_block_emboss_set(block, UI_EMBOSS_NONE); | UI_block_emboss_set(block, UI_EMBOSS_NONE); | ||||
| if (collection->scene_collection->type == COLLECTION_TYPE_NONE) { | if (soops->outlinevis == SO_VIEW_LAYER) { | ||||
| bt = uiDefIconButBitS(block, UI_BTYPE_ICON_TOGGLE_N, COLLECTION_SELECTABLE, 0, ICON_RESTRICT_SELECT_OFF, | if (lc && !(collection->flag & COLLECTION_IS_MASTER)) { | ||||
| (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, | PointerRNA layer_collection_ptr; | ||||
| UI_UNIT_Y, &collection->flag, 0, 0, 0, 0, | RNA_pointer_create(&scene->id, &RNA_LayerCollection, lc, &layer_collection_ptr); | ||||
| TIP_("Restrict/Allow 3D View selection of objects in the collection")); | |||||
| UI_but_func_set(bt, restrictbutton_collection_flag_cb, scene, collection); | bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, | ||||
| (lc->flag & LAYER_COLLECTION_EXCLUDE) ? ICON_CHECKBOX_DEHLT : ICON_CHECKBOX_HLT, | |||||
| (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X, | |||||
| UI_UNIT_Y, &layer_collection_ptr, collection_prop_exclude, -1, 0, 0, 0, 0, NULL); | |||||
| UI_but_func_set(bt, layer_collection_exclude_cb, scene, lc); | |||||
| UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | ||||
| } | } | ||||
| else if ((soops->outlinevis == SO_GROUPS) && | } | ||||
| (collection->scene_collection->type == COLLECTION_TYPE_GROUP_INTERNAL)) | else if (!lc || !(lc->flag & LAYER_COLLECTION_EXCLUDE)) { | ||||
| { | PointerRNA collection_ptr; | ||||
| bt = uiDefIconButBitS(block, UI_BTYPE_ICON_TOGGLE_N, COLLECTION_VIEWPORT, 0, ICON_RESTRICT_VIEW_OFF, | RNA_id_pointer_create(&collection->id, &collection_ptr); | ||||
| bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, ICON_RESTRICT_VIEW_OFF, | |||||
| (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, | (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, | ||||
| UI_UNIT_Y, &collection->flag, 0, 0, 0, 0, | UI_UNIT_Y, &collection_ptr, collection_prop_hide_viewport, -1, 0, 0, 0, 0, NULL); | ||||
| TIP_("Restrict/Allow 3D View selection of objects in the collection")); | |||||
| UI_but_func_set(bt, restrictbutton_collection_flag_cb, tselem->id, collection); | |||||
| UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | ||||
| bt = uiDefIconButBitS(block, UI_BTYPE_ICON_TOGGLE_N, COLLECTION_RENDER, 0, ICON_RESTRICT_RENDER_OFF, | bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, ICON_RESTRICT_RENDER_OFF, | ||||
| (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, | (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X, | ||||
| UI_UNIT_Y, &collection->flag, 0, 0, 0, 0, | UI_UNIT_Y, &collection_ptr, collection_prop_hide_render, -1, 0, 0, 0, 0, NULL); | ||||
| TIP_("Restrict/Allow 3D View selection of objects in the collection")); | |||||
| UI_but_func_set(bt, restrictbutton_collection_flag_cb, tselem->id, collection); | |||||
| UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | ||||
| } | |||||
| bt = uiDefIconButBitS(block, UI_BTYPE_BUT_TOGGLE, COLLECTION_DISABLED, 0, | bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, ICON_RESTRICT_SELECT_OFF, | ||||
| is_enabled ? ICON_CHECKBOX_HLT : ICON_CHECKBOX_DEHLT, | (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, | ||||
| (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X, | UI_UNIT_Y, &collection_ptr, collection_prop_hide_select, -1, 0, 0, 0, 0, NULL); | ||||
| UI_UNIT_Y, &collection->flag, 0, 0, 0, 0, | |||||
| TIP_("Enable/Disable collection")); | |||||
| UI_but_func_set(bt, restrictbutton_collection_flag_cb, tselem->id, collection); | |||||
| UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | ||||
| } | |||||
| UI_block_emboss_set(block, UI_EMBOSS); | UI_block_emboss_set(block, UI_EMBOSS); | ||||
| } | } | ||||
| } | } | ||||
| if (TSELEM_OPEN(tselem, soops)) outliner_draw_restrictbuts(block, scene, ar, soops, &te->subtree); | if (TSELEM_OPEN(tselem, soops)) outliner_draw_restrictbuts(block, scene, ar, soops, &te->subtree); | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 494 Lines • ▼ Show 20 Lines | switch (tselem->type) { | ||||
| tselem_draw_icon_uibut(&arg, RNA_struct_ui_icon(te->rnaptr.type)); | tselem_draw_icon_uibut(&arg, RNA_struct_ui_icon(te->rnaptr.type)); | ||||
| } | } | ||||
| else { | else { | ||||
| int icon = RNA_struct_ui_icon(te->rnaptr.type); | int icon = RNA_struct_ui_icon(te->rnaptr.type); | ||||
| ICON_DRAW(icon); | ICON_DRAW(icon); | ||||
| } | } | ||||
| break; | break; | ||||
| case TSE_LAYER_COLLECTION: | case TSE_LAYER_COLLECTION: | ||||
| case TSE_SCENE_COLLECTION: | case TSE_SCENE_COLLECTION_BASE: | ||||
| ICON_DRAW(ICON_COLLAPSEMENU); | ICON_DRAW(ICON_GROUP); | ||||
| break; | break; | ||||
| /* Removed the icons from outliner. Need a better structure with Layers, Palettes and Colors */ | /* Removed the icons from outliner. Need a better structure with Layers, Palettes and Colors */ | ||||
| #if 0 | #if 0 | ||||
| case TSE_GP_LAYER: | case TSE_GP_LAYER: | ||||
| tselem_draw_gp_icon_uibut(&arg, tselem->id, te->directdata); | tselem_draw_gp_icon_uibut(&arg, tselem->id, te->directdata); | ||||
| break; | break; | ||||
| #endif | #endif | ||||
| default: | default: | ||||
| Show All 23 Lines | if (GS(tselem->id->name) == ID_OB) { | ||||
| tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_FONT); break; | tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_FONT); break; | ||||
| case OB_SURF: | case OB_SURF: | ||||
| tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_SURFACE); break; | tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_SURFACE); break; | ||||
| case OB_SPEAKER: | case OB_SPEAKER: | ||||
| tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_SPEAKER); break; | tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_SPEAKER); break; | ||||
| case OB_LIGHTPROBE: | case OB_LIGHTPROBE: | ||||
| tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_LIGHTPROBE); break; | tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_LIGHTPROBE); break; | ||||
| case OB_EMPTY: | case OB_EMPTY: | ||||
| tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_EMPTY); break; | if (ob->dup_group) { | ||||
| tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_GROUP_INSTANCE); | |||||
| } | |||||
| else { | |||||
| tselem_draw_icon_uibut(&arg, ICON_OUTLINER_OB_EMPTY); | |||||
| } | |||||
| break; | |||||
| } | } | ||||
| } | } | ||||
| else { | else { | ||||
| /* TODO(sergey): Casting to short here just to handle ID_NLA which is | /* TODO(sergey): Casting to short here just to handle ID_NLA which is | ||||
| * NOT inside of IDType enum. | * NOT inside of IDType enum. | ||||
| */ | */ | ||||
| switch ((short)GS(tselem->id->name)) { | switch ((short)GS(tselem->id->name)) { | ||||
| case ID_SCE: | case ID_SCE: | ||||
| ▲ Show 20 Lines • Show All 185 Lines • ▼ Show 20 Lines | static void outliner_draw_tree_element( | ||||
| TreeStoreElem *tselem; | TreeStoreElem *tselem; | ||||
| float ufac = UI_UNIT_X / 20.0f; | float ufac = UI_UNIT_X / 20.0f; | ||||
| int offsx = 0; | int offsx = 0; | ||||
| eOLDrawState active = OL_DRAWSEL_NONE; | eOLDrawState active = OL_DRAWSEL_NONE; | ||||
| float color[4]; | float color[4]; | ||||
| tselem = TREESTORE(te); | tselem = TREESTORE(te); | ||||
| if (*starty + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && *starty <= ar->v2d.cur.ymax) { | if (*starty + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && *starty <= ar->v2d.cur.ymax) { | ||||
| const float alpha_fac = draw_grayed_out ? 0.5f : 1.0f; | const float alpha_fac = ((te->flag & TE_DISABLED) || draw_grayed_out) ? 0.5f : 1.0f; | ||||
| const float alpha = 0.5f * alpha_fac; | const float alpha = 0.5f * alpha_fac; | ||||
| int xmax = ar->v2d.cur.xmax; | int xmax = ar->v2d.cur.xmax; | ||||
| if ((tselem->flag & TSE_TEXTBUT) && (*te_edit == NULL)) { | if ((tselem->flag & TSE_TEXTBUT) && (*te_edit == NULL)) { | ||||
| *te_edit = te; | *te_edit = te; | ||||
| } | } | ||||
| if ((te->drag_data != NULL) && (*te_floating == NULL)) { | if ((te->drag_data != NULL) && (*te_floating == NULL)) { | ||||
| *te_floating = te; | *te_floating = te; | ||||
| ▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | if (active != OL_DRAWSEL_NONE) { | ||||
| (float)startx + 2.0f * UI_UNIT_X - 1.0f * ufac, | (float)startx + 2.0f * UI_UNIT_X - 1.0f * ufac, | ||||
| (float)*starty + UI_UNIT_Y - 1.0f * ufac, | (float)*starty + UI_UNIT_Y - 1.0f * ufac, | ||||
| UI_UNIT_Y / 2.0f - 1.0f * ufac, color); | UI_UNIT_Y / 2.0f - 1.0f * ufac, color); | ||||
| glEnable(GL_BLEND); /* roundbox disables it */ | glEnable(GL_BLEND); /* roundbox disables it */ | ||||
| te->flag |= TE_ACTIVE; // for lookup in display hierarchies | te->flag |= TE_ACTIVE; // for lookup in display hierarchies | ||||
| } | } | ||||
| if ((soops->outlinevis == SO_COLLECTIONS) && (tselem->type == TSE_R_LAYER)) { | if (tselem->type == TSE_R_LAYER && ELEM(soops->outlinevis, SO_VIEW_LAYER, SO_COLLECTIONS, SO_OBJECTS)) { | ||||
| /* View layer in collections can't expand/collapse. */ | /* View layer in collections can't expand/collapse. */ | ||||
| } | } | ||||
| else if (te->subtree.first || (tselem->type == 0 && te->idcode == ID_SCE) || (te->flag & TE_LAZY_CLOSED)) { | else if (te->subtree.first || (tselem->type == 0 && te->idcode == ID_SCE) || (te->flag & TE_LAZY_CLOSED)) { | ||||
| /* open/close icon, only when sublevels, except for scene */ | /* open/close icon, only when sublevels, except for scene */ | ||||
| int icon_x = startx; | int icon_x = startx; | ||||
| // icons a bit higher | // icons a bit higher | ||||
| if (TSELEM_OPEN(tselem, soops)) | if (TSELEM_OPEN(tselem, soops)) | ||||
| Show All 9 Lines | if (*starty + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && *starty <= ar->v2d.cur.ymax) { | ||||
| if (!(ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM))) { | if (!(ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM))) { | ||||
| tselem_draw_icon(block, xmax, (float)startx + offsx, (float)*starty, tselem, te, alpha_fac); | tselem_draw_icon(block, xmax, (float)startx + offsx, (float)*starty, tselem, te, alpha_fac); | ||||
| offsx += UI_UNIT_X + 2 * ufac; | offsx += UI_UNIT_X + 2 * ufac; | ||||
| } | } | ||||
| else | else | ||||
| offsx += 2 * ufac; | offsx += 2 * ufac; | ||||
| if (tselem->type == 0 && ID_IS_LINKED(tselem->id)) { | if (ELEM(tselem->type, 0, TSE_LAYER_COLLECTION) && ID_IS_LINKED(tselem->id)) { | ||||
| if (tselem->id->tag & LIB_TAG_MISSING) { | if (tselem->id->tag & LIB_TAG_MISSING) { | ||||
| UI_icon_draw_alpha((float)startx + offsx + 2 * ufac, (float)*starty + 2 * ufac, ICON_LIBRARY_DATA_BROKEN, | UI_icon_draw_alpha((float)startx + offsx + 2 * ufac, (float)*starty + 2 * ufac, ICON_LIBRARY_DATA_BROKEN, | ||||
| alpha_fac); | alpha_fac); | ||||
| } | } | ||||
| else if (tselem->id->tag & LIB_TAG_INDIRECT) { | else if (tselem->id->tag & LIB_TAG_INDIRECT) { | ||||
| UI_icon_draw_alpha((float)startx + offsx + 2 * ufac, (float)*starty + 2 * ufac, ICON_LIBRARY_DATA_INDIRECT, | UI_icon_draw_alpha((float)startx + offsx + 2 * ufac, (float)*starty + 2 * ufac, ICON_LIBRARY_DATA_INDIRECT, | ||||
| alpha_fac); | alpha_fac); | ||||
| } | } | ||||
| else { | else { | ||||
| UI_icon_draw_alpha((float)startx + offsx + 2 * ufac, (float)*starty + 2 * ufac, ICON_LIBRARY_DATA_DIRECT, | UI_icon_draw_alpha((float)startx + offsx + 2 * ufac, (float)*starty + 2 * ufac, ICON_LIBRARY_DATA_DIRECT, | ||||
| alpha_fac); | alpha_fac); | ||||
| } | } | ||||
| offsx += UI_UNIT_X + 2 * ufac; | offsx += UI_UNIT_X + 2 * ufac; | ||||
| } | } | ||||
| else if (tselem->type == 0 && ID_IS_STATIC_OVERRIDE(tselem->id)) { | else if (ELEM(tselem->type, 0, TSE_LAYER_COLLECTION) && ID_IS_STATIC_OVERRIDE(tselem->id)) { | ||||
| UI_icon_draw_alpha((float)startx + offsx + 2 * ufac, (float)*starty + 2 * ufac, ICON_LIBRARY_DATA_OVERRIDE, | UI_icon_draw_alpha((float)startx + offsx + 2 * ufac, (float)*starty + 2 * ufac, ICON_LIBRARY_DATA_OVERRIDE, | ||||
| alpha_fac); | alpha_fac); | ||||
| offsx += UI_UNIT_X + 2 * ufac; | offsx += UI_UNIT_X + 2 * ufac; | ||||
| } | } | ||||
| glDisable(GL_BLEND); | glDisable(GL_BLEND); | ||||
| /* name */ | /* name */ | ||||
| if ((tselem->flag & TSE_TEXTBUT) == 0) { | if ((tselem->flag & TSE_TEXTBUT) == 0) { | ||||
| ▲ Show 20 Lines • Show All 522 Lines • Show Last 20 Lines | |||||