Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_draw.c')
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c292
1 files changed, 146 insertions, 146 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 58c2deaf6df..0ea69164034 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -102,7 +102,7 @@ static void outliner_width(SpaceOops *soops, ListBase *lb, int *w)
TreeElement *te = lb->first;
while (te) {
// TreeStoreElem *tselem = TREESTORE(te);
-
+
// XXX fixme... te->xend is not set yet
if (!TSELEM_OPEN(tselem, soops)) {
if (te->xend > *w)
@@ -142,7 +142,7 @@ static void restrictbutton_recursive_ebone(bContext *C, EditBone *ebone_parent,
Object *obedit = CTX_data_edit_object(C);
bArmature *arm = obedit->data;
EditBone *ebone;
-
+
for (ebone = arm->edbo->first; ebone; ebone = ebone->next) {
if (ED_armature_ebone_is_child_recursive(ebone_parent, ebone)) {
if (set_flag) {
@@ -228,12 +228,12 @@ static void restrictbutton_view_cb(bContext *C, void *poin, void *poin2)
{
Scene *scene = (Scene *)poin;
Object *ob = (Object *)poin2;
-
+
if (!common_restrict_check(C, ob)) return;
-
+
/* deselect objects that are invisible */
if (ob->restrictflag & OB_RESTRICT_VIEW) {
- /* Ouch! There is no backwards pointer from Object to Base,
+ /* Ouch! There is no backwards pointer from Object to Base,
* so have to do loop to find it. */
ED_base_object_select(BKE_scene_base_find(scene, ob), BA_DESELECT);
}
@@ -251,12 +251,12 @@ static void restrictbutton_sel_cb(bContext *C, void *poin, void *poin2)
{
Scene *scene = (Scene *)poin;
Object *ob = (Object *)poin2;
-
+
if (!common_restrict_check(C, ob)) return;
-
+
/* if select restriction has just been turned on */
if (ob->restrictflag & OB_RESTRICT_SELECT) {
- /* Ouch! There is no backwards pointer from Object to Base,
+ /* Ouch! There is no backwards pointer from Object to Base,
* so have to do loop to find it. */
ED_base_object_select(BKE_scene_base_find(scene, ob), BA_DESELECT);
}
@@ -290,7 +290,7 @@ static void restrictbutton_r_lay_cb(bContext *C, void *poin, void *UNUSED(poin2)
static void restrictbutton_modifier_cb(bContext *C, void *UNUSED(poin), void *poin2)
{
Object *ob = (Object *)poin2;
-
+
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
WM_event_add_notifier(C, NC_OBJECT | ND_MODIFIER, ob);
}
@@ -405,7 +405,7 @@ void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag)
continue;
gob->ob->restrictflag &= ~flag;
-
+
if (flag == OB_RESTRICT_VIEW)
if (gob->ob->flag & SELECT)
ED_base_object_select(BKE_scene_base_find(scene, gob->ob), BA_DESELECT);
@@ -428,7 +428,7 @@ void restrictbutton_gr_restrict_flag(void *poin, void *poin2, int flag)
}
}
}
-}
+}
static void restrictbutton_gr_restrict_view(bContext *C, void *poin, void *poin2)
{
@@ -450,9 +450,9 @@ static void restrictbutton_gr_restrict_render(bContext *C, void *poin, void *poi
static void restrictbutton_id_user_toggle(bContext *UNUSED(C), void *poin, void *UNUSED(poin2))
{
ID *id = (ID *)poin;
-
+
BLI_assert(id != NULL);
-
+
if (id->flag & LIB_FAKEUSER) {
id_us_plus(id);
}
@@ -470,13 +470,13 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
Object *obedit = CTX_data_edit_object(C);
BLI_mempool *ts = soops->treestore;
TreeStoreElem *tselem = tsep;
-
+
if (ts && tselem) {
TreeElement *te = outliner_find_tree_element(&soops->tree, tselem);
-
+
if (tselem->type == 0) {
BLI_libblock_ensure_unique_name(bmain, tselem->id->name);
-
+
switch (GS(tselem->id->name)) {
case ID_MA:
WM_event_add_notifier(C, NC_MATERIAL, NULL); break;
@@ -538,11 +538,11 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
Bone *bone = te->directdata;
Object *ob;
char newname[sizeof(bone->name)];
-
+
/* always make current object active */
tree_element_active(C, scene, soops, te, OL_SETSEL_NORMAL, true);
ob = OBACT;
-
+
/* restore bone name */
BLI_strncpy(newname, bone->name, sizeof(bone->name));
BLI_strncpy(bone->name, oldname, sizeof(bone->name));
@@ -555,13 +555,13 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
bPoseChannel *pchan = te->directdata;
Object *ob;
char newname[sizeof(pchan->name)];
-
+
/* always make current pose-bone active */
tree_element_active(C, scene, soops, te, OL_SETSEL_NORMAL, true);
ob = OBACT;
BLI_assert(ob->type == OB_ARMATURE);
-
+
/* restore bone name */
BLI_strncpy(newname, pchan->name, sizeof(pchan->name));
BLI_strncpy(pchan->name, oldname, sizeof(pchan->name));
@@ -573,7 +573,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
{
Object *ob = (Object *)tselem->id; // id = object
bActionGroup *grp = te->directdata;
-
+
BLI_uniquename(&ob->pose->agroups, grp, CTX_DATA_(BLT_I18NCONTEXT_ID_ACTION, "Group"), '.',
offsetof(bActionGroup, name), sizeof(grp->name));
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, ob);
@@ -583,7 +583,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
{
bGPdata *gpd = (bGPdata *)tselem->id; // id = GP Datablock
bGPDlayer *gpl = te->directdata;
-
+
// XXX: name needs translation stuff
BLI_uniquename(&gpd->layers, gpl, "GP Layer", '.',
offsetof(bGPDlayer, info), sizeof(gpl->info));
@@ -599,7 +599,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
}
static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar, SpaceOops *soops, ListBase *lb)
-{
+{
uiBut *bt;
TreeElement *te;
TreeStoreElem *tselem;
@@ -632,23 +632,23 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
TIP_("Restrict viewport visibility (Ctrl - Recursive)"));
UI_but_func_set(bt, restrictbutton_view_cb, scene, ob);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
-
+
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,
&ptr, object_prop_hide_select, -1, 0, 0, -1, -1,
TIP_("Restrict viewport selection (Ctrl - Recursive)"));
UI_but_func_set(bt, restrictbutton_sel_cb, scene, ob);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
-
+
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,
&ptr, object_prop_hide_render, -1, 0, 0, -1, -1,
TIP_("Restrict rendering (Ctrl - Recursive)"));
UI_but_func_set(bt, restrictbutton_rend_cb, scene, ob);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
-
+
UI_block_emboss_set(block, UI_EMBOSS);
-
+
}
if (tselem->type == 0 && te->idcode == ID_GR) {
int restrict_bool;
@@ -657,7 +657,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
if (ID_IS_LINKED(gr))
but_flag |= UI_BUT_DISABLED;
-
+
UI_block_emboss_set(block, UI_EMBOSS_NONE);
restrict_bool = group_restrict_flag(gr, OB_RESTRICT_VIEW);
@@ -686,28 +686,28 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
/* scene render layers and passes have toggle-able flags too! */
else if (tselem->type == TSE_R_LAYER) {
UI_block_emboss_set(block, UI_EMBOSS_NONE);
-
+
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,
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_flag_enable(bt, UI_BUT_DRAG_LOCK);
-
+
UI_block_emboss_set(block, UI_EMBOSS);
}
else if (tselem->type == TSE_R_PASS) {
int *layflag = te->directdata;
int passflag = 1 << tselem->nr;
-
+
UI_block_emboss_set(block, UI_EMBOSS_NONE);
-
-
+
+
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,
UI_UNIT_Y, layflag, 0, 0, 0, 0, TIP_("Render this Pass"));
UI_but_func_set(bt, restrictbutton_r_lay_cb, tselem->id, NULL);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
-
+
layflag++; /* is lay_xor */
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))
@@ -718,13 +718,13 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
UI_but_func_set(bt, restrictbutton_r_lay_cb, tselem->id, NULL);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
}
-
+
UI_block_emboss_set(block, UI_EMBOSS);
}
else if (tselem->type == TSE_MODIFIER) {
ModifierData *md = (ModifierData *)te->directdata;
ob = (Object *)tselem->id;
-
+
UI_block_emboss_set(block, UI_EMBOSS_NONE);
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,
@@ -732,7 +732,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
TIP_("Restrict/Allow visibility in the 3D View"));
UI_but_func_set(bt, restrictbutton_modifier_cb, scene, ob);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
-
+
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,
UI_UNIT_Y, &(md->mode), 0, 0, 0, 0, TIP_("Restrict/Allow renderability"));
@@ -745,7 +745,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
bPoseChannel *pchan = (bPoseChannel *)te->directdata;
Bone *bone = pchan->bone;
ob = (Object *)tselem->id;
-
+
UI_block_emboss_set(block, UI_EMBOSS_NONE);
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,
@@ -753,7 +753,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
TIP_("Restrict/Allow visibility in the 3D View"));
UI_but_func_set(bt, restrictbutton_bone_visibility_cb, ob->data, bone);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
-
+
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,
UI_UNIT_Y, &(bone->flag), 0, 0, 0, 0,
@@ -765,7 +765,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
}
else if (tselem->type == TSE_EBONE) {
EditBone *ebone = (EditBone *)te->directdata;
-
+
UI_block_emboss_set(block, UI_EMBOSS_NONE);
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,
@@ -773,7 +773,7 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
TIP_("Restrict/Allow visibility in the 3D View"));
UI_but_func_set(bt, restrictbutton_ebone_visibility_cb, NULL, ebone);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
-
+
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,
UI_UNIT_Y, &(ebone->flag), 0, 0, 0, 0,
@@ -785,29 +785,29 @@ static void outliner_draw_restrictbuts(uiBlock *block, Scene *scene, ARegion *ar
}
else if (tselem->type == TSE_GP_LAYER) {
bGPDlayer *gpl = (bGPDlayer *)te->directdata;
-
+
UI_block_emboss_set(block, UI_EMBOSS_NONE);
-
+
bt = uiDefIconButBitS(block, UI_BTYPE_ICON_TOGGLE, GP_LAYER_HIDE, 0, ICON_RESTRICT_VIEW_OFF,
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_VIEWX), te->ys, UI_UNIT_X,
UI_UNIT_Y, &gpl->flag, 0, 0, 0, 0,
TIP_("Restrict/Allow visibility in the 3D View"));
UI_but_func_set(bt, restrictbutton_gp_layer_flag_cb, NULL, gpl);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
-
+
bt = uiDefIconButBitS(block, UI_BTYPE_ICON_TOGGLE, GP_LAYER_LOCKED, 0, ICON_UNLOCKED,
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys, UI_UNIT_X,
UI_UNIT_Y, &gpl->flag, 0, 0, 0, 0,
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_flag_enable(bt, UI_BUT_DRAG_LOCK);
-
+
/* TODO: visibility in renders */
-
+
UI_block_emboss_set(block, UI_EMBOSS);
}
}
-
+
if (TSELEM_OPEN(tselem, soops)) outliner_draw_restrictbuts(block, scene, ar, soops, &te->subtree);
}
}
@@ -846,16 +846,16 @@ static void outliner_draw_userbuts(uiBlock *block, ARegion *ar, SpaceOops *soops
&id->flag, 0, 0, 0, 0, tip);
UI_but_func_set(bt, restrictbutton_id_user_toggle, id, NULL);
UI_but_flag_enable(bt, but_flag);
-
-
+
+
BLI_str_format_int_grouped(buf, id->us);
- bt = uiDefBut(block, UI_BTYPE_BUT, 1, buf,
- (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys,
+ bt = uiDefBut(block, UI_BTYPE_BUT, 1, buf,
+ (int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_SELECTX), te->ys,
UI_UNIT_X, UI_UNIT_Y, NULL, 0.0, 0.0, 0, 0,
TIP_("Number of users of this data-block"));
UI_but_flag_enable(bt, but_flag);
-
-
+
+
bt = uiDefButBitS(block, UI_BTYPE_TOGGLE, LIB_FAKEUSER, 1, (id->flag & LIB_FAKEUSER) ? "F" : " ",
(int)(ar->v2d.cur.xmax - OL_TOG_RESTRICT_RENDERX), te->ys, UI_UNIT_X, UI_UNIT_Y,
&id->flag, 0, 0, 0, 0,
@@ -863,11 +863,11 @@ static void outliner_draw_userbuts(uiBlock *block, ARegion *ar, SpaceOops *soops
"even if nothing else uses it"));
UI_but_func_set(bt, restrictbutton_id_user_toggle, id, NULL);
UI_but_flag_enable(bt, but_flag);
-
+
UI_block_emboss_set(block, UI_EMBOSS);
}
}
-
+
if (TSELEM_OPEN(tselem, soops)) outliner_draw_userbuts(block, ar, soops, &te->subtree);
}
}
@@ -926,12 +926,12 @@ static void outliner_draw_rnabuts(uiBlock *block, ARegion *ar, SpaceOops *soops,
else if (tselem->type == TSE_RNA_ARRAY_ELEM) {
ptr = &te->rnaptr;
prop = te->directdata;
-
+
uiDefAutoButR(block, ptr, prop, te->index, "", ICON_NONE, sizex, te->ys, OL_RNA_COL_SIZEX,
UI_UNIT_Y - 1);
}
}
-
+
if (TSELEM_OPEN(tselem, soops)) outliner_draw_rnabuts(block, ar, soops, sizex, &te->subtree);
}
@@ -995,7 +995,7 @@ static void tselem_draw_icon_uibut(struct DrawIconArg *arg, int icon)
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(arg->id)) ? arg->id->lib->name : "");
-
+
if (arg->id)
UI_but_drag_set_id(but, arg->id);
}
@@ -1019,17 +1019,17 @@ static void UNUSED_FUNCTION(tselem_draw_gp_icon_uibut)(struct DrawIconArg *arg,
RNA_pointer_create(id, &RNA_GPencilLayer, gpl, &ptr);
UI_block_align_begin(arg->block);
-
+
UI_block_emboss_set(arg->block, is_stroke_visible ? UI_EMBOSS : UI_EMBOSS_NONE);
uiDefButR(arg->block, UI_BTYPE_COLOR, 1, "", arg->xb, arg->yb, w, h,
&ptr, "color", -1,
0, 0, 0, 0, NULL);
-
+
UI_block_emboss_set(arg->block, is_fill_visible ? UI_EMBOSS : UI_EMBOSS_NONE);
uiDefButR(arg->block, UI_BTYPE_COLOR, 1, "", arg->xb + w, arg->yb, w, h,
&ptr, "fill_color", -1,
0, 0, 0, 0, NULL);
-
+
UI_block_emboss_set(arg->block, UI_EMBOSS_NONE);
UI_block_align_end(arg->block);
}
@@ -1040,7 +1040,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
{
struct DrawIconArg arg;
float aspect;
-
+
/* make function calls a bit compacter */
arg.block = block;
arg.id = tselem->id;
@@ -1048,7 +1048,7 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
arg.xb = x; /* for ui buttons */
arg.yb = y;
arg.alpha = alpha;
-
+
/* placement of icons, copied from interface_widgets.c */
aspect = (0.8f * UI_UNIT_Y) / ICON_DEFAULT_HEIGHT;
x += 2.0f * aspect;
@@ -1086,29 +1086,29 @@ static void tselem_draw_icon(uiBlock *block, int xmax, float x, float y, TreeSto
Object *ob = (Object *)tselem->id;
ModifierData *md = BLI_findlink(&ob->modifiers, tselem->nr);
switch ((ModifierType)md->type) {
- case eModifierType_Subsurf:
+ case eModifierType_Subsurf:
UI_icon_draw(x, y, ICON_MOD_SUBSURF); break;
- case eModifierType_Armature:
+ case eModifierType_Armature:
UI_icon_draw(x, y, ICON_MOD_ARMATURE); break;
- case eModifierType_Lattice:
+ case eModifierType_Lattice:
UI_icon_draw(x, y, ICON_MOD_LATTICE); break;
- case eModifierType_Curve:
+ case eModifierType_Curve:
UI_icon_draw(x, y, ICON_MOD_CURVE); break;
- case eModifierType_Build:
+ case eModifierType_Build:
UI_icon_draw(x, y, ICON_MOD_BUILD); break;
- case eModifierType_Mirror:
+ case eModifierType_Mirror:
UI_icon_draw(x, y, ICON_MOD_MIRROR); break;
- case eModifierType_Decimate:
+ case eModifierType_Decimate:
UI_icon_draw(x, y, ICON_MOD_DECIM); break;
- case eModifierType_Wave:
+ case eModifierType_Wave:
UI_icon_draw(x, y, ICON_MOD_WAVE); break;
- case eModifierType_Hook:
+ case eModifierType_Hook:
UI_icon_draw(x, y, ICON_HOOK); break;
- case eModifierType_Softbody:
+ case eModifierType_Softbody:
UI_icon_draw(x, y, ICON_MOD_SOFT); break;
- case eModifierType_Boolean:
+ case eModifierType_Boolean:
UI_icon_draw(x, y, ICON_MOD_BOOLEAN); break;
- case eModifierType_ParticleSystem:
+ case eModifierType_ParticleSystem:
UI_icon_draw(x, y, ICON_MOD_PARTICLES); break;
case eModifierType_ParticleInstance:
UI_icon_draw(x, y, ICON_MOD_PARTICLES); break;
@@ -1362,13 +1362,13 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa
eOLDrawState active;
for (te = lb->first; te; te = te->next) {
-
+
/* exit drawing early */
if ((*offsx) - UI_UNIT_X > xmax)
break;
tselem = TREESTORE(te);
-
+
/* object hierarchy always, further constrained on level */
if (level < 1 || (tselem->type == 0 && te->idcode == ID_OB)) {
@@ -1401,32 +1401,32 @@ static void outliner_draw_iconrow(bContext *C, uiBlock *block, Scene *scene, Spa
(float)UI_UNIT_Y / 2.0f - ufac);
glEnable(GL_BLEND); /* roundbox disables */
}
-
+
tselem_draw_icon(block, xmax, (float)*offsx, (float)ys, tselem, te, 0.5f);
te->xs = *offsx;
te->ys = ys;
te->xend = (short)*offsx + UI_UNIT_X;
te->flag |= TE_ICONROW; // for click
-
+
(*offsx) += UI_UNIT_X;
}
-
+
/* this tree element always has same amount of branches, so don't draw */
if (tselem->type != TSE_R_LAYER)
outliner_draw_iconrow(C, block, scene, soops, &te->subtree, level + 1, xmax, offsx, ys);
}
-
+
}
/* closed tree element */
static void outliner_set_coord_tree_element(TreeElement *te, int startx, int starty)
{
TreeElement *ten;
-
+
/* store coord and continue, we need coordinates for elements outside view too */
te->xs = startx;
te->ys = starty;
-
+
for (ten = te->subtree.first; ten; ten = ten->next) {
outliner_set_coord_tree_element(ten, startx + UI_UNIT_X, starty);
}
@@ -1442,13 +1442,13 @@ static void outliner_draw_tree_element(
float ufac = UI_UNIT_X / 20.0f;
int offsx = 0;
eOLDrawState active = OL_DRAWSEL_NONE;
-
+
tselem = TREESTORE(te);
if (*starty + 2 * UI_UNIT_Y >= ar->v2d.cur.ymin && *starty <= ar->v2d.cur.ymax) {
int xmax = ar->v2d.cur.xmax;
unsigned char alpha = 128;
-
+
if ((tselem->flag & TSE_TEXTBUT) && (*te_edit == NULL)) {
*te_edit = te;
}
@@ -1456,12 +1456,12 @@ static void outliner_draw_tree_element(
/* icons can be ui buts, we don't want it to overlap with restrict */
if ((soops->flag & SO_HIDE_RESTRICTCOLS) == 0)
xmax -= OL_TOGW + UI_UNIT_X;
-
+
glEnable(GL_BLEND);
- /* start by highlighting search matches
- * we don't expand items when searching in the datablocks but we
- * still want to highlight any filter matches.
+ /* start by highlighting search matches
+ * we don't expand items when searching in the datablocks but we
+ * still want to highlight any filter matches.
*/
if ((SEARCHING_OUTLINER(soops) || (soops->outlinevis == SO_DATABLOCKS && soops->search_string[0] != 0)) &&
(tselem->flag & TSE_SEARCHMATCH))
@@ -1475,7 +1475,7 @@ static void outliner_draw_tree_element(
/* colors for active/selected data */
if (tselem->type == 0) {
-
+
if (te->idcode == ID_SCE) {
if (tselem->id == (ID *)scene) {
glColor4ub(255, 255, 255, alpha);
@@ -1489,35 +1489,35 @@ static void outliner_draw_tree_element(
UI_GetThemeColorType4ubv(TH_SELECT, SPACE_VIEW3D, col);
col[3] = alpha;
glColor4ubv((GLubyte *)col);
-
+
active = OL_DRAWSEL_ACTIVE;
}
}
else if (te->idcode == ID_OB) {
Object *ob = (Object *)tselem->id;
-
+
if (ob == OBACT || (ob->flag & SELECT)) {
char col[4] = {0, 0, 0, 0};
-
+
/* outliner active ob: always white text, circle color now similar to view3d */
-
+
active = OL_DRAWSEL_ACTIVE;
if (ob == OBACT) {
if (ob->flag & SELECT) {
UI_GetThemeColorType4ubv(TH_ACTIVE, SPACE_VIEW3D, col);
col[3] = alpha;
}
-
+
active = OL_DRAWSEL_NORMAL;
}
else if (ob->flag & SELECT) {
UI_GetThemeColorType4ubv(TH_SELECT, SPACE_VIEW3D, col);
col[3] = alpha;
}
-
+
glColor4ubv((GLubyte *)col);
}
-
+
}
else if (scene->obedit && scene->obedit->data == tselem->id) {
glColor4ub(255, 255, 255, alpha);
@@ -1536,7 +1536,7 @@ static void outliner_draw_tree_element(
}
glColor4ub(220, 220, 255, alpha);
}
-
+
/* active circle */
if (active != OL_DRAWSEL_NONE) {
UI_draw_roundbox_corner_set(UI_CNR_ALL);
@@ -1547,15 +1547,15 @@ static void outliner_draw_tree_element(
(float)*starty + UI_UNIT_Y - 1.0f * ufac,
UI_UNIT_Y / 2.0f - 1.0f * ufac);
glEnable(GL_BLEND); /* roundbox disables it */
-
+
te->flag |= TE_ACTIVE; // for lookup in display hierarchies
}
-
+
/* 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;
icon_x = startx;
-
+
// icons a bit higher
if (TSELEM_OPEN(tselem, soops))
UI_icon_draw((float)icon_x + 2 * ufac, (float)*starty + 1 * ufac, ICON_DISCLOSURE_TRI_DOWN);
@@ -1563,18 +1563,18 @@ static void outliner_draw_tree_element(
UI_icon_draw((float)icon_x + 2 * ufac, (float)*starty + 1 * ufac, ICON_DISCLOSURE_TRI_RIGHT);
}
offsx += UI_UNIT_X;
-
+
/* datatype icon */
-
+
if (!(ELEM(tselem->type, TSE_RNA_PROPERTY, TSE_RNA_ARRAY_ELEM))) {
-
+
tselem_draw_icon(block, xmax, (float)startx + offsx, (float)*starty, tselem, te, 1.0f);
-
+
offsx += UI_UNIT_X + 2 * ufac;
}
else
offsx += 2 * ufac;
-
+
if (tselem->type == 0 && ID_IS_LINKED(tselem->id)) {
glPixelTransferf(GL_ALPHA_SCALE, 0.5f);
if (tselem->id->tag & LIB_TAG_MISSING) {
@@ -1590,7 +1590,7 @@ static void outliner_draw_tree_element(
offsx += UI_UNIT_X + 2 * ufac;
}
glDisable(GL_BLEND);
-
+
/* name */
if ((tselem->flag & TSE_TEXTBUT) == 0) {
if (active == OL_DRAWSEL_NORMAL) {
@@ -1605,9 +1605,9 @@ static void outliner_draw_tree_element(
UI_fontstyle_draw_simple(fstyle, startx + offsx, *starty + 5 * ufac, te->name);
}
-
+
offsx += (int)(UI_UNIT_X + UI_fontstyle_string_width(fstyle, te->name));
-
+
/* closed item, we draw the icons, not when it's a scene, or master-server list though */
if (!TSELEM_OPEN(tselem, soops)) {
if (te->subtree.first) {
@@ -1618,19 +1618,19 @@ static void outliner_draw_tree_element(
/* this tree element always has same amount of branches, so don't draw */
int tempx = startx + offsx;
-
+
/* divider */
UI_ThemeColorShade(TH_BACK, -40);
glRecti(tempx - 10.0f * ufac,
*starty + 4.0f * ufac,
tempx - 8.0f * ufac,
*starty + UI_UNIT_Y - 4.0f * ufac);
-
+
glEnable(GL_BLEND);
glPixelTransferf(GL_ALPHA_SCALE, 0.5);
-
+
outliner_draw_iconrow(C, block, scene, soops, &te->subtree, 0, xmax, &tempx, *starty);
-
+
glPixelTransferf(GL_ALPHA_SCALE, 1.0);
glDisable(GL_BLEND);
}
@@ -1641,7 +1641,7 @@ static void outliner_draw_tree_element(
te->xs = startx;
te->ys = *starty;
te->xend = startx + offsx;
-
+
if (TSELEM_OPEN(tselem, soops)) {
*starty -= UI_UNIT_Y;
@@ -1653,7 +1653,7 @@ static void outliner_draw_tree_element(
for (ten = te->subtree.first; ten; ten = ten->next) {
outliner_set_coord_tree_element(ten, startx, *starty);
}
-
+
*starty -= UI_UNIT_Y;
}
}
@@ -1663,30 +1663,30 @@ static void outliner_draw_hierarchy(SpaceOops *soops, ListBase *lb, int startx,
TreeElement *te;
TreeStoreElem *tselem;
int y1, y2;
-
+
if (BLI_listbase_is_empty(lb)) return;
-
+
y1 = y2 = *starty; /* for vertical lines between objects */
for (te = lb->first; te; te = te->next) {
y2 = *starty;
tselem = TREESTORE(te);
-
+
/* horizontal line? */
if (tselem->type == 0 && (te->idcode == ID_OB || te->idcode == ID_SCE))
glRecti(startx, *starty, startx + UI_UNIT_X, *starty - 1);
-
+
*starty -= UI_UNIT_Y;
-
+
if (TSELEM_OPEN(tselem, soops))
outliner_draw_hierarchy(soops, &te->subtree, startx + UI_UNIT_X, starty);
}
-
+
/* vertical line */
te = lb->last;
if (te->parent || lb->first != lb->last) {
tselem = TREESTORE(te);
if (tselem->type == 0 && te->idcode == ID_OB) {
-
+
glRecti(startx, y1 + UI_UNIT_Y, startx + 1, y2);
}
}
@@ -1696,10 +1696,10 @@ static void outliner_draw_struct_marks(ARegion *ar, SpaceOops *soops, ListBase *
{
TreeElement *te;
TreeStoreElem *tselem;
-
+
for (te = lb->first; te; te = te->next) {
tselem = TREESTORE(te);
-
+
/* selection status */
if (TSELEM_OPEN(tselem, soops))
if (tselem->type == TSE_RNA_STRUCT)
@@ -1718,10 +1718,10 @@ static void outliner_draw_selection(ARegion *ar, SpaceOops *soops, ListBase *lb,
{
TreeElement *te;
TreeStoreElem *tselem;
-
+
for (te = lb->first; te; te = te->next) {
tselem = TREESTORE(te);
-
+
/* selection status */
if (tselem->flag & TSE_SELECTED) {
glRecti(0, *starty + 1, (int)ar->v2d.cur.xmax, *starty + UI_UNIT_Y - 1);
@@ -1739,9 +1739,9 @@ static void outliner_draw_tree(bContext *C, uiBlock *block, Scene *scene, ARegio
TreeElement *te;
int starty, startx;
float col[3];
-
+
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); // only once
-
+
if (ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF)) {
/* struct marks */
UI_ThemeColorShadeAlpha(TH_BACK, -15, -200);
@@ -1749,19 +1749,19 @@ static void outliner_draw_tree(bContext *C, uiBlock *block, Scene *scene, ARegio
starty = (int)ar->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET;
outliner_draw_struct_marks(ar, soops, &soops->tree, &starty);
}
-
+
/* always draw selection fill before hierarchy */
UI_GetThemeColor3fv(TH_SELECT_HIGHLIGHT, col);
glColor3fv(col);
starty = (int)ar->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET;
outliner_draw_selection(ar, soops, &soops->tree, &starty);
-
+
// 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 = UI_UNIT_X / 2 - 1.0f;
outliner_draw_hierarchy(soops, &soops->tree, startx, &starty);
-
+
// items themselves
starty = (int)ar->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET;
startx = 0;
@@ -1774,11 +1774,11 @@ static void outliner_draw_tree(bContext *C, uiBlock *block, Scene *scene, ARegio
static void outliner_back(ARegion *ar)
{
int ystart;
-
+
UI_ThemeColorShade(TH_BACK, 6);
ystart = (int)ar->v2d.tot.ymax;
ystart = UI_UNIT_Y * (ystart / (UI_UNIT_Y)) - OL_Y_OFFSET;
-
+
while (ystart + 2 * UI_UNIT_Y > ar->v2d.cur.ymin) {
glRecti(0, ystart, (int)ar->v2d.cur.xmax, ystart + UI_UNIT_Y);
ystart -= 2 * UI_UNIT_Y;
@@ -1788,21 +1788,21 @@ static void outliner_back(ARegion *ar)
static void outliner_draw_restrictcols(ARegion *ar)
{
int ystart;
-
+
/* background underneath */
UI_ThemeColor(TH_BACK);
glRecti((int)(ar->v2d.cur.xmax - OL_TOGW),
(int)(ar->v2d.cur.ymin - 1), (int)ar->v2d.cur.xmax, (int)ar->v2d.cur.ymax);
-
+
UI_ThemeColorShade(TH_BACK, 6);
ystart = (int)ar->v2d.tot.ymax;
ystart = UI_UNIT_Y * (ystart / (UI_UNIT_Y)) - OL_Y_OFFSET;
-
+
while (ystart + 2 * UI_UNIT_Y > ar->v2d.cur.ymin) {
glRecti((int)ar->v2d.cur.xmax - OL_TOGW, ystart, (int)ar->v2d.cur.xmax, ystart + UI_UNIT_Y);
ystart -= 2 * UI_UNIT_Y;
}
-
+
UI_ThemeColorShadeAlpha(TH_BACK, -15, -200);
/* view */
@@ -1829,7 +1829,7 @@ static void outliner_draw_restrictcols(ARegion *ar)
void draw_outliner(const bContext *C)
{
- Main *mainvar = CTX_data_main(C);
+ Main *mainvar = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
ARegion *ar = CTX_wm_region(C);
View2D *v2d = &ar->v2d;
@@ -1839,7 +1839,7 @@ void draw_outliner(const bContext *C)
TreeElement *te_edit = NULL;
outliner_build_tree(mainvar, scene, soops); // always
-
+
/* get extents of data */
outliner_height(soops, &soops->tree, &sizey);
@@ -1851,11 +1851,11 @@ void draw_outliner(const bContext *C)
*
* (*) XXX max width for now is a fixed factor of (UI_UNIT_X * (max_indention + 100))
*/
-
+
/* get actual width of column 1 */
outliner_rna_width(soops, &soops->tree, &sizex_rna, 0);
sizex_rna = max_ii(OL_RNA_COLX, sizex_rna + OL_RNA_COL_SPACEX);
-
+
/* get width of data (for setting 'tot' rect, this is column 1 + column 2 + a bit extra) */
sizex = sizex_rna + OL_RNA_COL_SIZEX + 50;
}
@@ -1864,14 +1864,14 @@ void draw_outliner(const bContext *C)
//outliner_width(soops, &soops->tree, &sizex);
// XXX should use outliner_width instead when te->xend will be set correctly...
outliner_rna_width(soops, &soops->tree, &sizex, 0);
-
+
/* constant offset for restriction columns */
// XXX this isn't that great yet...
if ((soops->flag & SO_HIDE_RESTRICTCOLS) == 0)
sizex += OL_TOGW * 3;
-
+
}
-
+
/* adds vertical offset */
sizey += OL_Y_OFFSET;
@@ -1887,7 +1887,7 @@ void draw_outliner(const bContext *C)
outliner_back(ar);
block = UI_block_begin(C, ar, __func__, UI_EMBOSS);
outliner_draw_tree((bContext *)C, block, scene, ar, soops, &te_edit);
-
+
if (ELEM(soops->outlinevis, SO_DATABLOCKS, SO_USERDEF)) {
/* draw rna buttons */
outliner_draw_rnacols(ar, sizex_rna);
@@ -1914,4 +1914,4 @@ void draw_outliner(const bContext *C)
/* clear flag that allows quick redraws */
soops->storeflag &= ~SO_TREESTORE_REDRAW;
-}
+}