Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_outliner/outliner_draw.c
| Show First 20 Lines • Show All 578 Lines • ▼ Show 20 Lines | for (te = lb->first; te; te = te->next) { | ||||
| 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) { | ||||
| /* objects have toggle-able restriction flags */ | /* objects have toggle-able restriction flags */ | ||||
| if (tselem->type == 0 && te->idcode == ID_OB) { | if (tselem->type == 0 && te->idcode == ID_OB) { | ||||
| PointerRNA ptr; | PointerRNA ptr; | ||||
| ob = (Object *)tselem->id; | ob = (Object *)tselem->id; | ||||
| RNA_pointer_create((ID *)ob, &RNA_Object, ob, &ptr); | RNA_pointer_create((ID *)ob, &RNA_Object, ob, &ptr); | ||||
| uiBlockSetEmboss(block, UI_EMBOSSN); | UI_block_emboss_set(block, UI_EMBOSS_NONE); | ||||
| bt = uiDefIconButR_prop(block, ICONTOG, 0, ICON_RESTRICT_VIEW_OFF, | 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, UI_UNIT_Y, | (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, | ||||
| &ptr, object_prop_hide, -1, 0, 0, -1, -1, | &ptr, object_prop_hide, -1, 0, 0, -1, -1, | ||||
| TIP_("Restrict viewport visibility (Ctrl - Recursive)")); | TIP_("Restrict viewport visibility (Ctrl - Recursive)")); | ||||
| uiButSetFunc(bt, restrictbutton_view_cb, scene, ob); | UI_but_func_set(bt, restrictbutton_view_cb, scene, ob); | ||||
| uiButSetFlag(bt, UI_BUT_DRAG_LOCK); | UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | ||||
| bt = uiDefIconButR_prop(block, ICONTOG, 0, ICON_RESTRICT_SELECT_OFF, | bt = uiDefIconButR_prop(block, UI_BTYPE_ICON_TOGGLE, 0, ICON_RESTRICT_SELECT_OFF, | ||||
| (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, UI_UNIT_Y, | (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, UI_UNIT_Y, | ||||
| &ptr, object_prop_hide_select, -1, 0, 0, -1, -1, | &ptr, object_prop_hide_select, -1, 0, 0, -1, -1, | ||||
| TIP_("Restrict viewport selection (Ctrl - Recursive)")); | TIP_("Restrict viewport selection (Ctrl - Recursive)")); | ||||
| uiButSetFunc(bt, restrictbutton_sel_cb, scene, ob); | UI_but_func_set(bt, restrictbutton_sel_cb, scene, ob); | ||||
| uiButSetFlag(bt, UI_BUT_DRAG_LOCK); | UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | ||||
| bt = uiDefIconButR_prop(block, ICONTOG, 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_RENDERX), te->ys, UI_UNIT_X, UI_UNIT_Y, | (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X, UI_UNIT_Y, | ||||
| &ptr, object_prop_hide_render, -1, 0, 0, -1, -1, | &ptr, object_prop_hide_render, -1, 0, 0, -1, -1, | ||||
| TIP_("Restrict rendering (Ctrl - Recursive)")); | TIP_("Restrict rendering (Ctrl - Recursive)")); | ||||
| uiButSetFunc(bt, restrictbutton_rend_cb, scene, ob); | UI_but_func_set(bt, restrictbutton_rend_cb, scene, ob); | ||||
| uiButSetFlag(bt, UI_BUT_DRAG_LOCK); | UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | ||||
| uiBlockSetEmboss(block, UI_EMBOSS); | UI_block_emboss_set(block, UI_EMBOSS); | ||||
| } | } | ||||
| if (tselem->type == 0 && te->idcode == ID_GR) { | if (tselem->type == 0 && te->idcode == ID_GR) { | ||||
| int restrict_bool; | int restrict_bool; | ||||
| int but_flag = UI_BUT_DRAG_LOCK; | int but_flag = UI_BUT_DRAG_LOCK; | ||||
| gr = (Group *)tselem->id; | gr = (Group *)tselem->id; | ||||
| if (gr->id.lib) | if (gr->id.lib) | ||||
| but_flag |= UI_BUT_DISABLED; | but_flag |= UI_BUT_DISABLED; | ||||
| uiBlockSetEmboss(block, UI_EMBOSSN); | UI_block_emboss_set(block, UI_EMBOSS_NONE); | ||||
| restrict_bool = group_restrict_flag(gr, OB_RESTRICT_VIEW); | restrict_bool = group_restrict_flag(gr, OB_RESTRICT_VIEW); | ||||
| bt = uiDefIconBut(block, ICONTOG, 0, restrict_bool ? ICON_RESTRICT_VIEW_ON : ICON_RESTRICT_VIEW_OFF, | bt = uiDefIconBut(block, UI_BTYPE_ICON_TOGGLE, 0, restrict_bool ? ICON_RESTRICT_VIEW_ON : ICON_RESTRICT_VIEW_OFF, | ||||
| (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, | (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X, UI_UNIT_Y, | ||||
| NULL, 0, 0, 0, 0, TIP_("Restrict/Allow visibility in the 3D View")); | NULL, 0, 0, 0, 0, TIP_("Restrict/Allow visibility in the 3D View")); | ||||
| uiButSetFunc(bt, restrictbutton_gr_restrict_view, scene, gr); | UI_but_func_set(bt, restrictbutton_gr_restrict_view, scene, gr); | ||||
| uiButSetFlag(bt, but_flag); | UI_but_flag_enable(bt, but_flag); | ||||
| restrict_bool = group_restrict_flag(gr, OB_RESTRICT_SELECT); | restrict_bool = group_restrict_flag(gr, OB_RESTRICT_SELECT); | ||||
| bt = uiDefIconBut(block, ICONTOG, 0, restrict_bool ? ICON_RESTRICT_SELECT_ON : ICON_RESTRICT_SELECT_OFF, | bt = uiDefIconBut(block, UI_BTYPE_ICON_TOGGLE, 0, restrict_bool ? ICON_RESTRICT_SELECT_ON : ICON_RESTRICT_SELECT_OFF, | ||||
| (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, UI_UNIT_Y, | (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, UI_UNIT_Y, | ||||
| NULL, 0, 0, 0, 0, TIP_("Restrict/Allow selection in the 3D View")); | NULL, 0, 0, 0, 0, TIP_("Restrict/Allow selection in the 3D View")); | ||||
| uiButSetFunc(bt, restrictbutton_gr_restrict_select, scene, gr); | UI_but_func_set(bt, restrictbutton_gr_restrict_select, scene, gr); | ||||
| uiButSetFlag(bt, but_flag); | UI_but_flag_enable(bt, but_flag); | ||||
| restrict_bool = group_restrict_flag(gr, OB_RESTRICT_RENDER); | restrict_bool = group_restrict_flag(gr, OB_RESTRICT_RENDER); | ||||
| bt = uiDefIconBut(block, ICONTOG, 0, restrict_bool ? ICON_RESTRICT_RENDER_ON : ICON_RESTRICT_RENDER_OFF, | bt = uiDefIconBut(block, UI_BTYPE_ICON_TOGGLE, 0, restrict_bool ? ICON_RESTRICT_RENDER_ON : ICON_RESTRICT_RENDER_OFF, | ||||
| (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X, UI_UNIT_Y, | (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X, UI_UNIT_Y, | ||||
| NULL, 0, 0, 0, 0, TIP_("Restrict/Allow renderability")); | NULL, 0, 0, 0, 0, TIP_("Restrict/Allow renderability")); | ||||
| uiButSetFunc(bt, restrictbutton_gr_restrict_render, scene, gr); | UI_but_func_set(bt, restrictbutton_gr_restrict_render, scene, gr); | ||||
| uiButSetFlag(bt, but_flag); | UI_but_flag_enable(bt, but_flag); | ||||
| uiBlockSetEmboss(block, UI_EMBOSS); | UI_block_emboss_set(block, UI_EMBOSS); | ||||
| } | } | ||||
| /* scene render layers and passes have toggle-able flags too! */ | /* scene render layers and passes have toggle-able flags too! */ | ||||
| else if (tselem->type == TSE_R_LAYER) { | else if (tselem->type == TSE_R_LAYER) { | ||||
| uiBlockSetEmboss(block, UI_EMBOSSN); | UI_block_emboss_set(block, UI_EMBOSS_NONE); | ||||
| bt = uiDefIconButBitI(block, ICONTOGN, SCE_LAY_DISABLE, 0, ICON_CHECKBOX_HLT - 1, | bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE_N, SCE_LAY_DISABLE, 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")); | ||||
| uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL); | UI_but_func_set(bt, restrictbutton_r_lay_cb, tselem->id, NULL); | ||||
| uiButSetFlag(bt, UI_BUT_DRAG_LOCK); | UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | ||||
| uiBlockSetEmboss(block, UI_EMBOSS); | UI_block_emboss_set(block, UI_EMBOSS); | ||||
| } | } | ||||
| else if (tselem->type == TSE_R_PASS) { | else if (tselem->type == TSE_R_PASS) { | ||||
| int *layflag = te->directdata; | int *layflag = te->directdata; | ||||
| int passflag = 1 << tselem->nr; | int passflag = 1 << tselem->nr; | ||||
| uiBlockSetEmboss(block, UI_EMBOSSN); | UI_block_emboss_set(block, UI_EMBOSS_NONE); | ||||
| bt = uiDefIconButBitI(block, ICONTOG, passflag, 0, ICON_CHECKBOX_HLT - 1, | bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE, passflag, 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, layflag, 0, 0, 0, 0, TIP_("Render this Pass")); | UI_UNIT_Y, layflag, 0, 0, 0, 0, TIP_("Render this Pass")); | ||||
| uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL); | UI_but_func_set(bt, restrictbutton_r_lay_cb, tselem->id, NULL); | ||||
| uiButSetFlag(bt, UI_BUT_DRAG_LOCK); | UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | ||||
| layflag++; /* is lay_xor */ | layflag++; /* is lay_xor */ | ||||
| if (ELEM(passflag, SCE_PASS_SPEC, SCE_PASS_SHADOW, SCE_PASS_AO, SCE_PASS_REFLECT, SCE_PASS_REFRACT, | if (ELEM(passflag, SCE_PASS_SPEC, SCE_PASS_SHADOW, SCE_PASS_AO, SCE_PASS_REFLECT, SCE_PASS_REFRACT, | ||||
| SCE_PASS_INDIRECT, SCE_PASS_EMIT, SCE_PASS_ENVIRONMENT)) | SCE_PASS_INDIRECT, SCE_PASS_EMIT, SCE_PASS_ENVIRONMENT)) | ||||
| { | { | ||||
| bt = uiDefIconButBitI(block, TOG, passflag, 0, (*layflag & passflag) ? ICON_DOT : ICON_BLANK1, | bt = uiDefIconButBitI(block, UI_BTYPE_TOGGLE, passflag, 0, (*layflag & passflag) ? ICON_DOT : ICON_BLANK1, | ||||
| (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, | (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, | ||||
| UI_UNIT_Y, layflag, 0, 0, 0, 0, TIP_("Exclude this Pass from Combined")); | UI_UNIT_Y, layflag, 0, 0, 0, 0, TIP_("Exclude this Pass from Combined")); | ||||
| uiButSetFunc(bt, restrictbutton_r_lay_cb, tselem->id, NULL); | UI_but_func_set(bt, restrictbutton_r_lay_cb, tselem->id, NULL); | ||||
| uiButSetFlag(bt, UI_BUT_DRAG_LOCK); | UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | ||||
| } | } | ||||
| uiBlockSetEmboss(block, UI_EMBOSS); | UI_block_emboss_set(block, UI_EMBOSS); | ||||
| } | } | ||||
| else if (tselem->type == TSE_MODIFIER) { | else if (tselem->type == TSE_MODIFIER) { | ||||
| ModifierData *md = (ModifierData *)te->directdata; | ModifierData *md = (ModifierData *)te->directdata; | ||||
| ob = (Object *)tselem->id; | ob = (Object *)tselem->id; | ||||
| uiBlockSetEmboss(block, UI_EMBOSSN); | UI_block_emboss_set(block, UI_EMBOSS_NONE); | ||||
| bt = uiDefIconButBitI(block, ICONTOGN, eModifierMode_Realtime, 0, ICON_RESTRICT_VIEW_OFF, | bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE_N, eModifierMode_Realtime, 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, &(md->mode), 0, 0, 0, 0, | UI_UNIT_Y, &(md->mode), 0, 0, 0, 0, | ||||
| TIP_("Restrict/Allow visibility in the 3D View")); | TIP_("Restrict/Allow visibility in the 3D View")); | ||||
| uiButSetFunc(bt, restrictbutton_modifier_cb, scene, ob); | UI_but_func_set(bt, restrictbutton_modifier_cb, scene, ob); | ||||
| uiButSetFlag(bt, UI_BUT_DRAG_LOCK); | UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | ||||
| bt = uiDefIconButBitI(block, ICONTOGN, eModifierMode_Render, 0, ICON_RESTRICT_RENDER_OFF, | bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE_N, eModifierMode_Render, 0, ICON_RESTRICT_RENDER_OFF, | ||||
| (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X, | (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X, | ||||
| UI_UNIT_Y, &(md->mode), 0, 0, 0, 0, TIP_("Restrict/Allow renderability")); | UI_UNIT_Y, &(md->mode), 0, 0, 0, 0, TIP_("Restrict/Allow renderability")); | ||||
| uiButSetFunc(bt, restrictbutton_modifier_cb, scene, ob); | UI_but_func_set(bt, restrictbutton_modifier_cb, scene, ob); | ||||
| uiButSetFlag(bt, UI_BUT_DRAG_LOCK); | UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | ||||
| uiBlockSetEmboss(block, UI_EMBOSS); | UI_block_emboss_set(block, UI_EMBOSS); | ||||
| } | } | ||||
| else if (tselem->type == TSE_POSE_CHANNEL) { | else if (tselem->type == TSE_POSE_CHANNEL) { | ||||
| bPoseChannel *pchan = (bPoseChannel *)te->directdata; | bPoseChannel *pchan = (bPoseChannel *)te->directdata; | ||||
| Bone *bone = pchan->bone; | Bone *bone = pchan->bone; | ||||
| ob = (Object *)tselem->id; | ob = (Object *)tselem->id; | ||||
| uiBlockSetEmboss(block, UI_EMBOSSN); | UI_block_emboss_set(block, UI_EMBOSS_NONE); | ||||
| bt = uiDefIconButBitI(block, ICONTOG, BONE_HIDDEN_P, 0, ICON_RESTRICT_VIEW_OFF, | bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE, BONE_HIDDEN_P, 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, &(bone->flag), 0, 0, 0, 0, | UI_UNIT_Y, &(bone->flag), 0, 0, 0, 0, | ||||
| TIP_("Restrict/Allow visibility in the 3D View")); | TIP_("Restrict/Allow visibility in the 3D View")); | ||||
| uiButSetFunc(bt, restrictbutton_bone_visibility_cb, ob->data, bone); | UI_but_func_set(bt, restrictbutton_bone_visibility_cb, ob->data, bone); | ||||
| uiButSetFlag(bt, UI_BUT_DRAG_LOCK); | UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | ||||
| bt = uiDefIconButBitI(block, ICONTOG, BONE_UNSELECTABLE, 0, ICON_RESTRICT_SELECT_OFF, | bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE, BONE_UNSELECTABLE, 0, ICON_RESTRICT_SELECT_OFF, | ||||
| (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, | (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, | ||||
| UI_UNIT_Y, &(bone->flag), 0, 0, 0, 0, | UI_UNIT_Y, &(bone->flag), 0, 0, 0, 0, | ||||
| TIP_("Restrict/Allow selection in the 3D View")); | TIP_("Restrict/Allow selection in the 3D View")); | ||||
| uiButSetFunc(bt, restrictbutton_bone_select_cb, ob->data, bone); | UI_but_func_set(bt, restrictbutton_bone_select_cb, ob->data, bone); | ||||
| uiButSetFlag(bt, UI_BUT_DRAG_LOCK); | UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | ||||
| uiBlockSetEmboss(block, UI_EMBOSS); | UI_block_emboss_set(block, UI_EMBOSS); | ||||
| } | } | ||||
| else if (tselem->type == TSE_EBONE) { | else if (tselem->type == TSE_EBONE) { | ||||
| EditBone *ebone = (EditBone *)te->directdata; | EditBone *ebone = (EditBone *)te->directdata; | ||||
| uiBlockSetEmboss(block, UI_EMBOSSN); | UI_block_emboss_set(block, UI_EMBOSS_NONE); | ||||
| bt = uiDefIconButBitI(block, ICONTOG, BONE_HIDDEN_A, 0, ICON_RESTRICT_VIEW_OFF, | bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE, BONE_HIDDEN_A, 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, &(ebone->flag), 0, 0, 0, 0, | UI_UNIT_Y, &(ebone->flag), 0, 0, 0, 0, | ||||
| TIP_("Restrict/Allow visibility in the 3D View")); | TIP_("Restrict/Allow visibility in the 3D View")); | ||||
| uiButSetFunc(bt, restrictbutton_ebone_visibility_cb, NULL, ebone); | UI_but_func_set(bt, restrictbutton_ebone_visibility_cb, NULL, ebone); | ||||
| uiButSetFlag(bt, UI_BUT_DRAG_LOCK); | UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | ||||
| bt = uiDefIconButBitI(block, ICONTOG, BONE_UNSELECTABLE, 0, ICON_RESTRICT_SELECT_OFF, | bt = uiDefIconButBitI(block, UI_BTYPE_ICON_TOGGLE, BONE_UNSELECTABLE, 0, ICON_RESTRICT_SELECT_OFF, | ||||
| (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, | (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X, | ||||
| UI_UNIT_Y, &(ebone->flag), 0, 0, 0, 0, | UI_UNIT_Y, &(ebone->flag), 0, 0, 0, 0, | ||||
| TIP_("Restrict/Allow selection in the 3D View")); | TIP_("Restrict/Allow selection in the 3D View")); | ||||
| uiButSetFunc(bt, restrictbutton_ebone_select_cb, NULL, ebone); | UI_but_func_set(bt, restrictbutton_ebone_select_cb, NULL, ebone); | ||||
| uiButSetFlag(bt, UI_BUT_DRAG_LOCK); | UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK); | ||||
| uiBlockSetEmboss(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); | ||||
| } | } | ||||
| } | } | ||||
| static void outliner_draw_rnacols(ARegion *ar, int sizex) | static void outliner_draw_rnacols(ARegion *ar, int sizex) | ||||
| Show All 19 Lines | |||||
| static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, SpaceOops *soops, int sizex, ListBase *lb) | static void outliner_draw_rnabuts(uiBlock *block, Scene *scene, ARegion *ar, SpaceOops *soops, int sizex, ListBase *lb) | ||||
| { | { | ||||
| TreeElement *te; | TreeElement *te; | ||||
| TreeStoreElem *tselem; | TreeStoreElem *tselem; | ||||
| PointerRNA *ptr; | PointerRNA *ptr; | ||||
| PropertyRNA *prop; | PropertyRNA *prop; | ||||
| uiBlockSetEmboss(block, UI_EMBOSST); | UI_block_emboss_set(block, UI_EMBOSS_TABLE); | ||||
| 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_RNA_PROPERTY) { | if (tselem->type == TSE_RNA_PROPERTY) { | ||||
| ptr = &te->rnaptr; | ptr = &te->rnaptr; | ||||
| prop = te->directdata; | prop = te->directdata; | ||||
| if (!TSELEM_OPEN(tselem, soops)) { | if (!TSELEM_OPEN(tselem, soops)) { | ||||
| if (RNA_property_type(prop) == PROP_POINTER) { | if (RNA_property_type(prop) == PROP_POINTER) { | ||||
| uiBut *but = uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, sizex, te->ys, | uiBut *but = uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, sizex, te->ys, | ||||
| OL_RNA_COL_SIZEX, UI_UNIT_Y - 1); | OL_RNA_COL_SIZEX, UI_UNIT_Y - 1); | ||||
| uiButSetFlag(but, UI_BUT_DISABLED); | UI_but_flag_enable(but, UI_BUT_DISABLED); | ||||
| } | } | ||||
| else if (RNA_property_type(prop) == PROP_ENUM) { | else if (RNA_property_type(prop) == PROP_ENUM) { | ||||
| uiDefAutoButR(block, ptr, prop, -1, NULL, ICON_NONE, sizex, te->ys, OL_RNA_COL_SIZEX, | uiDefAutoButR(block, ptr, prop, -1, NULL, ICON_NONE, sizex, te->ys, OL_RNA_COL_SIZEX, | ||||
| UI_UNIT_Y - 1); | UI_UNIT_Y - 1); | ||||
| } | } | ||||
| else { | else { | ||||
| uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, sizex, te->ys, OL_RNA_COL_SIZEX, | uiDefAutoButR(block, ptr, prop, -1, "", ICON_NONE, sizex, te->ys, OL_RNA_COL_SIZEX, | ||||
| UI_UNIT_Y - 1); | UI_UNIT_Y - 1); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| else if (tselem->type == TSE_RNA_ARRAY_ELEM) { | else if (tselem->type == TSE_RNA_ARRAY_ELEM) { | ||||
| ptr = &te->rnaptr; | ptr = &te->rnaptr; | ||||
| prop = te->directdata; | prop = te->directdata; | ||||
| uiDefAutoButR(block, ptr, prop, te->index, "", ICON_NONE, sizex, te->ys, OL_RNA_COL_SIZEX, | uiDefAutoButR(block, ptr, prop, te->index, "", ICON_NONE, sizex, te->ys, OL_RNA_COL_SIZEX, | ||||
| UI_UNIT_Y - 1); | UI_UNIT_Y - 1); | ||||
| } | } | ||||
| } | } | ||||
| if (TSELEM_OPEN(tselem, soops)) outliner_draw_rnabuts(block, scene, ar, soops, sizex, &te->subtree); | if (TSELEM_OPEN(tselem, soops)) outliner_draw_rnabuts(block, scene, ar, soops, sizex, &te->subtree); | ||||
| } | } | ||||
| uiBlockSetEmboss(block, UI_EMBOSS); | UI_block_emboss_set(block, UI_EMBOSS); | ||||
| } | } | ||||
| static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, TreeElement *te) | static void outliner_buttons(const bContext *C, uiBlock *block, ARegion *ar, TreeElement *te) | ||||
| { | { | ||||
| uiBut *bt; | uiBut *bt; | ||||
| TreeStoreElem *tselem; | TreeStoreElem *tselem; | ||||
| int spx, dx, len; | int spx, dx, len; | ||||
| tselem = TREESTORE(te); | tselem = TREESTORE(te); | ||||
| BLI_assert(tselem->flag & TSE_TEXTBUT); | BLI_assert(tselem->flag & TSE_TEXTBUT); | ||||
| /* If we add support to rename Sequence. | /* If we add support to rename Sequence. | ||||
| * need change this. | * need change this. | ||||
| */ | */ | ||||
| if (tselem->type == TSE_EBONE) len = sizeof(((EditBone *) 0)->name); | if (tselem->type == TSE_EBONE) len = sizeof(((EditBone *) 0)->name); | ||||
| else if (tselem->type == TSE_MODIFIER) len = sizeof(((ModifierData *) 0)->name); | else if (tselem->type == TSE_MODIFIER) len = sizeof(((ModifierData *) 0)->name); | ||||
| else if (tselem->id && GS(tselem->id->name) == ID_LI) len = sizeof(((Library *) 0)->name); | else if (tselem->id && GS(tselem->id->name) == ID_LI) len = sizeof(((Library *) 0)->name); | ||||
| else len = MAX_ID_NAME - 2; | else len = MAX_ID_NAME - 2; | ||||
| spx = te->xs + 1.8f * UI_UNIT_X; | spx = te->xs + 1.8f * UI_UNIT_X; | ||||
| dx = ar->v2d.cur.xmax - (spx + 3.2f * UI_UNIT_X); | dx = ar->v2d.cur.xmax - (spx + 3.2f * UI_UNIT_X); | ||||
| bt = uiDefBut(block, TEX, OL_NAMEBUTTON, "", spx, te->ys, dx, UI_UNIT_Y - 1, (void *)te->name, | bt = uiDefBut(block, UI_BTYPE_TEXT, OL_NAMEBUTTON, "", spx, te->ys, dx, UI_UNIT_Y - 1, (void *)te->name, | ||||
| 1.0, (float)len, 0, 0, ""); | 1.0, (float)len, 0, 0, ""); | ||||
| uiButSetRenameFunc(bt, namebutton_cb, tselem); | UI_but_func_rename_set(bt, namebutton_cb, tselem); | ||||
| /* returns false if button got removed */ | /* returns false if button got removed */ | ||||
| if (false == uiButActiveOnly(C, ar, block, bt)) { | if (false == UI_but_active_only(C, ar, block, bt)) { | ||||
| tselem->flag &= ~TSE_TEXTBUT; | tselem->flag &= ~TSE_TEXTBUT; | ||||
| /* bad! (notifier within draw) without this, we don't get a refesh */ | /* bad! (notifier within draw) without this, we don't get a refesh */ | ||||
| WM_event_add_notifier(C, NC_SPACE | ND_SPACE_OUTLINER, NULL); | WM_event_add_notifier(C, NC_SPACE | ND_SPACE_OUTLINER, NULL); | ||||
| } | } | ||||
| } | } | ||||
| /* ****************************************************** */ | /* ****************************************************** */ | ||||
| Show All 11 Lines | |||||
| { | { | ||||
| /* restrict column clip... it has been coded by simply overdrawing, doesnt work for buttons */ | /* restrict column clip... it has been coded by simply overdrawing, doesnt work for buttons */ | ||||
| if (arg->x >= arg->xmax) { | if (arg->x >= arg->xmax) { | ||||
| glEnable(GL_BLEND); | glEnable(GL_BLEND); | ||||
| UI_icon_draw_aspect(arg->x, arg->y, icon, 1.0f / UI_DPI_FAC, arg->alpha); | UI_icon_draw_aspect(arg->x, arg->y, icon, 1.0f / UI_DPI_FAC, arg->alpha); | ||||
| glDisable(GL_BLEND); | glDisable(GL_BLEND); | ||||
| } | } | ||||
| else { | else { | ||||
| uiBut *but = uiDefIconBut(arg->block, LABEL, 0, icon, arg->xb, arg->yb, UI_UNIT_X, UI_UNIT_Y, NULL, | uiBut *but = uiDefIconBut(arg->block, UI_BTYPE_LABEL, 0, icon, arg->xb, arg->yb, UI_UNIT_X, UI_UNIT_Y, NULL, | ||||
| 0.0, 0.0, 1.0, arg->alpha, (arg->id && arg->id->lib) ? arg->id->lib->name : ""); | 0.0, 0.0, 1.0, arg->alpha, (arg->id && arg->id->lib) ? arg->id->lib->name : ""); | ||||
| if (arg->id) | if (arg->id) | ||||
| uiButSetDragID(but, arg->id); | UI_but_drag_set_id(but, arg->id); | ||||
| } | } | ||||
| } | } | ||||
| static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeStoreElem *tselem, TreeElement *te, | static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeStoreElem *tselem, TreeElement *te, | ||||
| float alpha) | float alpha) | ||||
| { | { | ||||
| struct DrawIconArg arg; | struct DrawIconArg arg; | ||||
| ▲ Show 20 Lines • Show All 315 Lines • ▼ Show 20 Lines | if (level < 1 || (tselem->type == 0 && te->idcode == ID_OB)) { | ||||
| } | } | ||||
| else { | else { | ||||
| active = tree_element_type_active(NULL, scene, soops, te, tselem, OL_SETSEL_NONE, false); | active = tree_element_type_active(NULL, scene, soops, te, tselem, OL_SETSEL_NONE, false); | ||||
| } | } | ||||
| if (active != OL_DRAWSEL_NONE) { | if (active != OL_DRAWSEL_NONE) { | ||||
| float ufac = UI_UNIT_X / 20.0f; | float ufac = UI_UNIT_X / 20.0f; | ||||
| uiSetRoundBox(UI_CNR_ALL); | UI_draw_roundbox_corner_set(UI_CNR_ALL); | ||||
| glColor4ub(255, 255, 255, 100); | glColor4ub(255, 255, 255, 100); | ||||
| uiRoundBox((float) *offsx - 1.0f * ufac, | UI_draw_roundbox( | ||||
| (float) *offsx - 1.0f * ufac, | |||||
| (float)ys + 1.0f * ufac, | (float)ys + 1.0f * ufac, | ||||
| (float)*offsx + UI_UNIT_X - 2.0f * ufac, | (float)*offsx + UI_UNIT_X - 2.0f * ufac, | ||||
| (float)ys + UI_UNIT_Y - ufac, | (float)ys + UI_UNIT_Y - ufac, | ||||
| (float)UI_UNIT_Y / 2.0f - ufac); | (float)UI_UNIT_Y / 2.0f - ufac); | ||||
| glEnable(GL_BLEND); /* roundbox disables */ | glEnable(GL_BLEND); /* roundbox disables */ | ||||
| } | } | ||||
| tselem_draw_icon(block, xmax, (float)*offsx, (float)ys, tselem, te, 0.5f); | tselem_draw_icon(block, xmax, (float)*offsx, (float)ys, tselem, te, 0.5f); | ||||
| te->xs = *offsx; | te->xs = *offsx; | ||||
| te->ys = ys; | te->ys = ys; | ||||
| te->xend = (short)*offsx + UI_UNIT_X; | te->xend = (short)*offsx + UI_UNIT_X; | ||||
| te->flag |= TE_ICONROW; // for click | te->flag |= TE_ICONROW; // for click | ||||
| ▲ Show 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | else { | ||||
| if (tree_element_type_active(NULL, scene, soops, te, tselem, OL_SETSEL_NONE, false) != OL_DRAWSEL_NONE) { | if (tree_element_type_active(NULL, scene, soops, te, tselem, OL_SETSEL_NONE, false) != OL_DRAWSEL_NONE) { | ||||
| active = OL_DRAWSEL_ACTIVE; | active = OL_DRAWSEL_ACTIVE; | ||||
| } | } | ||||
| glColor4ub(220, 220, 255, alpha); | glColor4ub(220, 220, 255, alpha); | ||||
| } | } | ||||
| /* active circle */ | /* active circle */ | ||||
| if (active != OL_DRAWSEL_NONE) { | if (active != OL_DRAWSEL_NONE) { | ||||
| uiSetRoundBox(UI_CNR_ALL); | UI_draw_roundbox_corner_set(UI_CNR_ALL); | ||||
| uiRoundBox((float)startx + UI_UNIT_X, | UI_draw_roundbox( | ||||
| (float)startx + UI_UNIT_X, | |||||
| (float)*starty + 1.0f * ufac, | (float)*starty + 1.0f * ufac, | ||||
| (float)startx + 2.0f * UI_UNIT_X - 2.0f * ufac, | (float)startx + 2.0f * UI_UNIT_X - 2.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); | UI_UNIT_Y / 2.0f - 1.0f * ufac); | ||||
| 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 | ||||
| } | } | ||||
| /* open/close icon, only when sublevels, except for scene */ | /* open/close icon, only when sublevels, except for scene */ | ||||
| if (te->subtree.first || (tselem->type == 0 && te->idcode == ID_SCE) || (te->flag & TE_LAZY_CLOSED)) { | if (te->subtree.first || (tselem->type == 0 && te->idcode == ID_SCE) || (te->flag & TE_LAZY_CLOSED)) { | ||||
| int icon_x; | int icon_x; | ||||
| Show All 32 Lines | if (*starty + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && *starty <= ar->v2d.cur.ymax) { | ||||
| } | } | ||||
| glDisable(GL_BLEND); | glDisable(GL_BLEND); | ||||
| /* name */ | /* name */ | ||||
| if (active == OL_DRAWSEL_NORMAL) UI_ThemeColor(TH_TEXT_HI); | if (active == OL_DRAWSEL_NORMAL) UI_ThemeColor(TH_TEXT_HI); | ||||
| else if (ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) UI_ThemeColorBlend(TH_BACK, TH_TEXT, 0.75f); | else if (ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM)) UI_ThemeColorBlend(TH_BACK, TH_TEXT, 0.75f); | ||||
| else UI_ThemeColor(TH_TEXT); | else UI_ThemeColor(TH_TEXT); | ||||
| UI_DrawString(startx + offsx, *starty + 5 * ufac, te->name); | UI_draw_string(startx + offsx, *starty + 5 * ufac, te->name); | ||||
| offsx += (int)(UI_UNIT_X + UI_GetStringWidth(te->name)); | offsx += (int)(UI_UNIT_X + UI_fontstyle_string_width(te->name)); | ||||
| /* closed item, we draw the icons, not when it's a scene, or master-server list though */ | /* closed item, we draw the icons, not when it's a scene, or master-server list though */ | ||||
| if (!TSELEM_OPEN(tselem, soops)) { | if (!TSELEM_OPEN(tselem, soops)) { | ||||
| if (te->subtree.first) { | if (te->subtree.first) { | ||||
| if (tselem->type == 0 && te->idcode == ID_SCE) { | if (tselem->type == 0 && te->idcode == ID_SCE) { | ||||
| /* pass */ | /* pass */ | ||||
| } | } | ||||
| else if (tselem->type != TSE_R_LAYER) { | else if (tselem->type != TSE_R_LAYER) { | ||||
| ▲ Show 20 Lines • Show All 259 Lines • ▼ Show 20 Lines | void draw_outliner(const bContext *C) | ||||
| /* force display to pixel coords */ | /* force display to pixel coords */ | ||||
| v2d->flag |= (V2D_PIXELOFS_X | V2D_PIXELOFS_Y); | v2d->flag |= (V2D_PIXELOFS_X | V2D_PIXELOFS_Y); | ||||
| /* set matrix for 2d-view controls */ | /* set matrix for 2d-view controls */ | ||||
| UI_view2d_view_ortho(v2d); | UI_view2d_view_ortho(v2d); | ||||
| /* draw outliner stuff (background, hierarchy lines and names) */ | /* draw outliner stuff (background, hierarchy lines and names) */ | ||||
| outliner_back(ar); | outliner_back(ar); | ||||
| block = uiBeginBlock(C, ar, __func__, UI_EMBOSS); | block = UI_block_begin(C, ar, __func__, UI_EMBOSS); | ||||
| outliner_draw_tree((bContext *)C, block, scene, ar, soops, &te_edit); | outliner_draw_tree((bContext *)C, block, scene, ar, soops, &te_edit); | ||||
| if (ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF)) { | if (ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF)) { | ||||
| /* draw rna buttons */ | /* draw rna buttons */ | ||||
| outliner_draw_rnacols(ar, sizex_rna); | outliner_draw_rnacols(ar, sizex_rna); | ||||
| outliner_draw_rnabuts(block, scene, ar, soops, sizex_rna, &soops->tree); | outliner_draw_rnabuts(block, scene, ar, soops, sizex_rna, &soops->tree); | ||||
| } | } | ||||
| else if (!(soops->flag & SO_HIDE_RESTRICTCOLS)) { | else if (!(soops->flag & SO_HIDE_RESTRICTCOLS)) { | ||||
| /* draw restriction columns */ | /* draw restriction columns */ | ||||
| outliner_draw_restrictcols(ar); | outliner_draw_restrictcols(ar); | ||||
| outliner_draw_restrictbuts(block, scene, ar, soops, &soops->tree); | outliner_draw_restrictbuts(block, scene, ar, soops, &soops->tree); | ||||
| } | } | ||||
| /* draw edit buttons if nessecery */ | /* draw edit buttons if nessecery */ | ||||
| if (te_edit) { | if (te_edit) { | ||||
| outliner_buttons(C, block, ar, te_edit); | outliner_buttons(C, block, ar, te_edit); | ||||
| } | } | ||||
| uiEndBlock(C, block); | UI_block_end(C, block); | ||||
| uiDrawBlock(C, block); | UI_block_draw(C, block); | ||||
| /* clear flag that allows quick redraws */ | /* clear flag that allows quick redraws */ | ||||
| soops->storeflag &= ~SO_TREESTORE_REDRAW; | soops->storeflag &= ~SO_TREESTORE_REDRAW; | ||||
| } | } | ||||