Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_outliner/outliner_draw.c
| Show First 20 Lines • Show All 246 Lines • ▼ Show 20 Lines | 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 enablebutton_collection_flag_cb(bContext *C, void *poin, void *poin2) | static void enablebutton_collection_flag_cb(bContext *C, void *poin, void *poin2) | ||||
| { | { | ||||
| Main *bmain = CTX_data_main(C); | Main *bmain = CTX_data_main(C); | ||||
| Scene *scene = poin; | Scene *scene = poin; | ||||
| LayerCollection *layer_collection = poin2; | LayerCollection *layer_collection = poin2; | ||||
| SceneLayer *scene_layer = BKE_scene_layer_find_from_collection(scene, layer_collection); | ViewLayer *view_layer = BKE_view_layer_find_from_collection(scene, layer_collection); | ||||
| /* We need to toggle the flag since this is called after the flag is already set. */ | /* We need to toggle the flag since this is called after the flag is already set. */ | ||||
| layer_collection->flag ^= COLLECTION_DISABLED; | layer_collection->flag ^= COLLECTION_DISABLED; | ||||
| if (layer_collection->flag & COLLECTION_DISABLED) { | if (layer_collection->flag & COLLECTION_DISABLED) { | ||||
| BKE_collection_enable(scene_layer, layer_collection); | BKE_collection_enable(view_layer, layer_collection); | ||||
| } | } | ||||
| else { | else { | ||||
| BKE_collection_disable(scene_layer, layer_collection); | BKE_collection_disable(view_layer, layer_collection); | ||||
| } | } | ||||
| DEG_relations_tag_update(bmain); | DEG_relations_tag_update(bmain); | ||||
| /* TODO(sergey): Use proper flag for tagging here. */ | /* TODO(sergey): Use proper flag for tagging here. */ | ||||
| DEG_id_tag_update(&scene->id, 0); | DEG_id_tag_update(&scene->id, 0); | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); | WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, scene); | ||||
| WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, NULL); | WM_event_add_notifier(C, NC_SCENE | ND_LAYER_CONTENT, NULL); | ||||
| } | } | ||||
| Show All 22 Lines | static void restrictbutton_id_user_toggle(bContext *UNUSED(C), void *poin, void *UNUSED(poin2)) | ||||
| } | } | ||||
| } | } | ||||
| static void namebutton_cb(bContext *C, void *tsep, char *oldname) | static void namebutton_cb(bContext *C, void *tsep, char *oldname) | ||||
| { | { | ||||
| 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); | ||||
| SceneLayer *sl = CTX_data_scene_layer(C); | ViewLayer *sl = 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) { | ||||
| ▲ Show 20 Lines • Show All 147 Lines • ▼ Show 20 Lines | #endif | ||||
| 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) { | ||||
| /* scene render layers and passes have toggle-able flags too! */ | /* scene render layers and passes have toggle-able flags too! */ | ||||
| if (tselem->type == TSE_R_LAYER) { | if (tselem->type == TSE_R_LAYER) { | ||||
| UI_block_emboss_set(block, UI_EMBOSS_NONE); | UI_block_emboss_set(block, UI_EMBOSS_NONE); | ||||
| bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE, SCENE_LAYER_RENDER, 0, ICON_CHECKBOX_HLT - 1, | bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE, VIEW_LAYER_RENDER, 0, ICON_CHECKBOX_HLT - 1, | ||||
| (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, te->directdata, 0, 0, 0, 0, TIP_("Render this RenderLayer")); | UI_UNIT_Y, te->directdata, 0, 0, 0, 0, TIP_("Render this RenderLayer")); | ||||
| UI_but_func_set(bt, restrictbutton_r_lay_cb, tselem->id, NULL); | UI_but_func_set(bt, restrictbutton_r_lay_cb, tselem->id, NULL); | ||||
| 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); | ||||
| } | } | ||||
| else if (tselem->type == TSE_R_PASS) { | else if (tselem->type == TSE_R_PASS) { | ||||
| ▲ Show 20 Lines • Show All 758 Lines • ▼ Show 20 Lines | else { | ||||
| break; | break; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| #undef ICON_DRAW | #undef ICON_DRAW | ||||
| } | } | ||||
| static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, SceneLayer *sl, SpaceOops *soops, | static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, ViewLayer *sl, SpaceOops *soops, | ||||
| ListBase *lb, int level, int xmax, int *offsx, int ys, float alpha_fac) | ListBase *lb, int level, int xmax, int *offsx, int ys, float alpha_fac) | ||||
| { | { | ||||
| TreeElement *te; | TreeElement *te; | ||||
| TreeStoreElem *tselem; | TreeStoreElem *tselem; | ||||
| eOLDrawState active; | eOLDrawState active; | ||||
| for (te = lb->first; te; te = te->next) { | for (te = lb->first; te; te = te->next) { | ||||
| /* exit drawing early */ | /* exit drawing early */ | ||||
| ▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | static void outliner_set_coord_tree_element(TreeElement *te, int startx, int starty) | ||||
| for (ten = te->subtree.first; ten; ten = ten->next) { | for (ten = te->subtree.first; ten; ten = ten->next) { | ||||
| outliner_set_coord_tree_element(ten, startx + UI_UNIT_X, starty); | outliner_set_coord_tree_element(ten, startx + UI_UNIT_X, starty); | ||||
| } | } | ||||
| } | } | ||||
| static void outliner_draw_tree_element( | static void outliner_draw_tree_element( | ||||
| bContext *C, uiBlock *block, const uiFontStyle *fstyle, Scene *scene, SceneLayer *sl, | bContext *C, uiBlock *block, const uiFontStyle *fstyle, Scene *scene, ViewLayer *sl, | ||||
| ARegion *ar, SpaceOops *soops, TreeElement *te, bool draw_grayed_out, | ARegion *ar, SpaceOops *soops, TreeElement *te, bool draw_grayed_out, | ||||
| int startx, int *starty, TreeElement **te_edit, TreeElement **te_floating) | int startx, int *starty, TreeElement **te_edit, TreeElement **te_floating) | ||||
| { | { | ||||
| 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]; | ||||
| ▲ Show 20 Lines • Show All 424 Lines • ▼ Show 20 Lines | static void outliner_draw_highlights(ARegion *ar, SpaceOops *soops, int startx, int *starty) | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | ||||
| outliner_draw_highlights_recursive(pos, ar, soops, &soops->tree, col_selection, col_highlight, col_searchmatch, | outliner_draw_highlights_recursive(pos, ar, soops, &soops->tree, col_selection, col_highlight, col_searchmatch, | ||||
| startx, starty); | startx, starty); | ||||
| immUnbindProgram(); | immUnbindProgram(); | ||||
| glDisable(GL_BLEND); | glDisable(GL_BLEND); | ||||
| } | } | ||||
| static void outliner_draw_tree( | static void outliner_draw_tree( | ||||
| bContext *C, uiBlock *block, Scene *scene, SceneLayer *sl, ARegion *ar, | bContext *C, uiBlock *block, Scene *scene, ViewLayer *sl, ARegion *ar, | ||||
| SpaceOops *soops, const bool has_restrict_icons, | SpaceOops *soops, const bool has_restrict_icons, | ||||
| TreeElement **te_edit) | TreeElement **te_edit) | ||||
| { | { | ||||
| const uiFontStyle *fstyle = UI_FSTYLE_WIDGET; | const uiFontStyle *fstyle = UI_FSTYLE_WIDGET; | ||||
| TreeElement *te_floating = NULL; | TreeElement *te_floating = NULL; | ||||
| int starty, startx; | int starty, startx; | ||||
| glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // only once | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // only once | ||||
| ▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Lines | |||||
| /* ****************************************************** */ | /* ****************************************************** */ | ||||
| /* Main Entrypoint - Draw contents of Outliner editor */ | /* Main Entrypoint - Draw contents of Outliner editor */ | ||||
| void draw_outliner(const bContext *C) | void draw_outliner(const bContext *C) | ||||
| { | { | ||||
| Main *mainvar = CTX_data_main(C); | Main *mainvar = CTX_data_main(C); | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| SceneLayer *sl = CTX_data_scene_layer(C); | ViewLayer *sl = CTX_data_view_layer(C); | ||||
| ARegion *ar = CTX_wm_region(C); | ARegion *ar = CTX_wm_region(C); | ||||
| View2D *v2d = &ar->v2d; | View2D *v2d = &ar->v2d; | ||||
| SpaceOops *soops = CTX_wm_space_outliner(C); | SpaceOops *soops = CTX_wm_space_outliner(C); | ||||
| uiBlock *block; | uiBlock *block; | ||||
| int sizey = 0, sizex = 0, sizex_rna = 0; | int sizey = 0, sizex = 0, sizex_rna = 0; | ||||
| TreeElement *te_edit = NULL; | TreeElement *te_edit = NULL; | ||||
| bool has_restrict_icons; | bool has_restrict_icons; | ||||
| ▲ Show 20 Lines • Show All 79 Lines • Show Last 20 Lines | |||||