diff options
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_draw.c')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_draw.c | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 99242fd12f9..d8d6b09ac6b 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -401,7 +401,7 @@ void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag) if (group_restrict_flag(gr, flag)) { for (gob = gr->gobject.first; gob; gob = gob->next) { - if (ID_IS_LINKED_DATABLOCK(gob->ob)) + if (ID_IS_LINKED(gob->ob)) continue; gob->ob->restrictflag &= ~flag; @@ -413,7 +413,7 @@ void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag) } else { for (gob = gr->gobject.first; gob; gob = gob->next) { - if (ID_IS_LINKED_DATABLOCK(gob->ob)) + if (ID_IS_LINKED(gob->ob)) continue; /* not in editmode */ @@ -654,7 +654,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar int but_flag = UI_BUT_DRAG_LOCK; gr = (Group *)tselem->id; - if (ID_IS_LINKED_DATABLOCK(gr)) + if (ID_IS_LINKED(gr)) but_flag |= UI_BUT_DISABLED; UI_block_emboss_set(block, UI_EMBOSS_NONE); @@ -827,7 +827,7 @@ static void outliner_draw_userbuts(uiBlock *block, ARegion *ar, SpaceOops *soops char buf[16] = ""; int but_flag = UI_BUT_DRAG_LOCK; - if (ID_IS_LINKED_DATABLOCK(id)) + if (ID_IS_LINKED(id)) but_flag |= UI_BUT_DISABLED; UI_block_emboss_set(block, UI_EMBOSS_NONE); @@ -993,7 +993,7 @@ static void tselem_draw_icon_uibut(struct DrawIconArg *arg, int icon) else { 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 && ID_IS_LINKED_DATABLOCK(arg->id)) ? arg->id->lib->name : ""); + (arg->id && ID_IS_LINKED(arg->id)) ? arg->id->lib->name : ""); if (arg->id) UI_but_drag_set_id(but, arg->id); @@ -1040,9 +1040,6 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto struct DrawIconArg arg; float aspect; - /* icons tiny bit away from text */ - x -= 0.15f * UI_UNIT_Y; - /* make function calls a bit compacter */ arg.block = block; arg.id = tselem->id; @@ -1053,8 +1050,10 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto /* placement of icons, copied from interface_widgets.c */ aspect = (0.8f * UI_UNIT_Y) / ICON_DEFAULT_HEIGHT; - arg.x = x = x + 4.0f * aspect; - arg.y = y = y + 0.1f * UI_UNIT_Y; + x += 2.0f * aspect; + y += 2.0f * aspect; + arg.x = x; + arg.y = y; if (tselem->type) { switch (tselem->type) { @@ -1126,6 +1125,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto case eModifierType_Cast: UI_icon_draw(x, y, ICON_MOD_CAST); break; case eModifierType_MeshDeform: + case eModifierType_SurfaceDeform: UI_icon_draw(x, y, ICON_MOD_MESHDEFORM); break; case eModifierType_Bevel: UI_icon_draw(x, y, ICON_MOD_BEVEL); break; @@ -1273,7 +1273,10 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto } } else { - switch (GS(tselem->id->name)) { + /* TODO(sergey): Casting to short here just to handle ID_NLA which is + * NOT inside of IDType enum. + */ + switch ((short)GS(tselem->id->name)) { case ID_SCE: tselem_draw_icon_uibut(&arg, ICON_SCENE_DATA); break; case ID_ME: @@ -1343,6 +1346,8 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto tselem_draw_icon_uibut(&arg, ICON_LINE_DATA); break; case ID_GD: tselem_draw_icon_uibut(&arg, ICON_GREASEPENCIL); break; + default: + break; } } } @@ -1388,9 +1393,9 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa UI_draw_roundbox_corner_set(UI_CNR_ALL); glColor4ub(255, 255, 255, 100); UI_draw_roundbox( - (float) *offsx - 1.0f * ufac, + (float) *offsx + 1.0f * ufac, (float)ys + 1.0f * ufac, - (float)*offsx + UI_UNIT_X - 2.0f * ufac, + (float)*offsx + UI_UNIT_X - 1.0f * ufac, (float)ys + UI_UNIT_Y - ufac, (float)UI_UNIT_Y / 2.0f - ufac); glEnable(GL_BLEND); /* roundbox disables */ @@ -1535,9 +1540,9 @@ static void outliner_draw_tree_element( if (active != OL_DRAWSEL_NONE) { UI_draw_roundbox_corner_set(UI_CNR_ALL); UI_draw_roundbox( - (float)startx + UI_UNIT_X, + (float)startx + UI_UNIT_X + 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 - 1.0f * ufac, (float)*starty + UI_UNIT_Y - 1.0f * ufac, UI_UNIT_Y / 2.0f - 1.0f * ufac); glEnable(GL_BLEND); /* roundbox disables it */ @@ -1548,16 +1553,13 @@ static void outliner_draw_tree_element( /* 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)) { int icon_x; - if (tselem->type == 0 && ELEM(te->idcode, ID_OB, ID_SCE)) - icon_x = startx; - else - icon_x = startx + 5 * ufac; + icon_x = startx; // icons a bit higher if (TSELEM_OPEN(tselem, soops)) - UI_icon_draw((float)icon_x, (float)*starty + 2 * ufac, ICON_DISCLOSURE_TRI_DOWN); + UI_icon_draw((float)icon_x + 2 * ufac, (float)*starty + 1 * ufac, ICON_DISCLOSURE_TRI_DOWN); else - UI_icon_draw((float)icon_x, (float)*starty + 2 * ufac, ICON_DISCLOSURE_TRI_RIGHT); + UI_icon_draw((float)icon_x + 2 * ufac, (float)*starty + 1 * ufac, ICON_DISCLOSURE_TRI_RIGHT); } offsx += UI_UNIT_X; @@ -1567,24 +1569,24 @@ static void outliner_draw_tree_element( tselem_draw_icon(block, xmax, (float)startx + offsx, (float)*starty, tselem, te, 1.0f); - offsx += UI_UNIT_X; + offsx += UI_UNIT_X + 2 * ufac; } else offsx += 2 * ufac; - if (tselem->type == 0 && ID_IS_LINKED_DATABLOCK(tselem->id)) { + if (tselem->type == 0 && ID_IS_LINKED(tselem->id)) { glPixelTransferf(GL_ALPHA_SCALE, 0.5f); if (tselem->id->tag & LIB_TAG_MISSING) { - UI_icon_draw((float)startx + offsx, (float)*starty + 2 * ufac, ICON_LIBRARY_DATA_BROKEN); + UI_icon_draw((float)startx + offsx + 2 * ufac, (float)*starty + 2 * ufac, ICON_LIBRARY_DATA_BROKEN); } else if (tselem->id->tag & LIB_TAG_INDIRECT) { - UI_icon_draw((float)startx + offsx, (float)*starty + 2 * ufac, ICON_LIBRARY_DATA_INDIRECT); + UI_icon_draw((float)startx + offsx + 2 * ufac, (float)*starty + 2 * ufac, ICON_LIBRARY_DATA_INDIRECT); } else { - UI_icon_draw((float)startx + offsx, (float)*starty + 2 * ufac, ICON_LIBRARY_DATA_DIRECT); + UI_icon_draw((float)startx + offsx + 2 * ufac, (float)*starty + 2 * ufac, ICON_LIBRARY_DATA_DIRECT); } glPixelTransferf(GL_ALPHA_SCALE, 1.0f); - offsx += UI_UNIT_X; + offsx += UI_UNIT_X + 2 * ufac; } glDisable(GL_BLEND); @@ -1756,7 +1758,7 @@ static void outliner_draw_tree(bContext *C, uiBlock *block, Scene *scene, ARegio // gray hierarchy lines UI_ThemeColorBlend(TH_BACK, TH_TEXT, 0.4f); starty = (int)ar->v2d.tot.ymax - UI_UNIT_Y / 2 - OL_Y_OFFSET; - startx = 6; + startx = UI_UNIT_X / 2 - 1.0f; outliner_draw_hierarchy(soops, &soops->tree, startx, &starty); // items themselves |