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:
authorNathan Craddock <nzcraddock@gmail.com>2020-07-03 22:46:19 +0300
committerNathan Craddock <nzcraddock@gmail.com>2020-07-03 23:01:15 +0300
commit3a7101f9e8c8e97f521c63e09c04f948297d2359 (patch)
treea2660305f35c58b7086f420c7765d8e6c3bef642 /source/blender/editors/space_outliner/outliner_draw.c
parentb485592901b197279b34cd714a687d70003b90eb (diff)
parent4bf56b37ca98637c94bc1fc66c78f136ed709afb (diff)
Merge branch 'master' into soc-2020-outliner
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_draw.c')
-rw-r--r--source/blender/editors/space_outliner/outliner_draw.c127
1 files changed, 61 insertions, 66 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c
index 2708eb84639..c0ff88ee9af 100644
--- a/source/blender/editors/space_outliner/outliner_draw.c
+++ b/source/blender/editors/space_outliner/outliner_draw.c
@@ -81,8 +81,8 @@
#include "outliner_intern.h"
-/* disable - this is far too slow - campbell */
-// #define USE_GROUP_SELECT
+/* Disable - this is far too slow - campbell. */
+/* #define USE_GROUP_SELECT */
/* ****************************************************** */
/* Tree Size Functions */
@@ -174,12 +174,12 @@ static void restrictbutton_recursive_bone(Bone *bone_parent, int flag, bool set_
}
}
-static void restrictbutton_r_lay_cb(bContext *C, void *poin, void *UNUSED(poin2))
+static void restrictbutton_r_lay_fn(bContext *C, void *poin, void *UNUSED(poin2))
{
WM_event_add_notifier(C, NC_SCENE | ND_RENDER_OPTIONS, poin);
}
-static void restrictbutton_bone_visibility_cb(bContext *C, void *poin, void *UNUSED(poin2))
+static void restrictbutton_bone_visibility_fn(bContext *C, void *poin, void *UNUSED(poin2))
{
Bone *bone = (Bone *)poin;
@@ -188,7 +188,7 @@ static void restrictbutton_bone_visibility_cb(bContext *C, void *poin, void *UNU
}
}
-static void restrictbutton_bone_select_cb(bContext *C, void *UNUSED(poin), void *poin2)
+static void restrictbutton_bone_select_fn(bContext *C, void *UNUSED(poin), void *poin2)
{
Bone *bone = (Bone *)poin2;
if (bone->flag & BONE_UNSELECTABLE) {
@@ -202,7 +202,7 @@ static void restrictbutton_bone_select_cb(bContext *C, void *UNUSED(poin), void
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
}
-static void restrictbutton_ebone_select_cb(bContext *C, void *UNUSED(poin), void *poin2)
+static void restrictbutton_ebone_select_fn(bContext *C, void *UNUSED(poin), void *poin2)
{
EditBone *ebone = (EditBone *)poin2;
@@ -218,7 +218,7 @@ static void restrictbutton_ebone_select_cb(bContext *C, void *UNUSED(poin), void
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
}
-static void restrictbutton_ebone_visibility_cb(bContext *C, void *UNUSED(poin), void *poin2)
+static void restrictbutton_ebone_visibility_fn(bContext *C, void *UNUSED(poin), void *poin2)
{
EditBone *ebone = (EditBone *)poin2;
if (ebone->flag & BONE_HIDDEN_A) {
@@ -232,7 +232,7 @@ static void restrictbutton_ebone_visibility_cb(bContext *C, void *UNUSED(poin),
WM_event_add_notifier(C, NC_OBJECT | ND_POSE, NULL);
}
-static void restrictbutton_gp_layer_flag_cb(bContext *C, void *poin, void *UNUSED(poin2))
+static void restrictbutton_gp_layer_flag_fn(bContext *C, void *poin, void *UNUSED(poin2))
{
ID *id = (ID *)poin;
@@ -254,7 +254,7 @@ static void restrictbutton_id_user_toggle(bContext *UNUSED(C), void *poin, void
}
}
-static void outliner_object_set_flag_recursive_cb(bContext *C,
+static void outliner_object_set_flag_recursive_fn(bContext *C,
Base *base,
Object *ob,
const char *propname)
@@ -314,21 +314,21 @@ static void outliner_object_set_flag_recursive_cb(bContext *C,
/**
* Object properties.
* */
-static void outliner__object_set_flag_recursive_cb(bContext *C, void *poin, void *poin2)
+static void outliner__object_set_flag_recursive_fn(bContext *C, void *poin, void *poin2)
{
Object *ob = poin;
char *propname = poin2;
- outliner_object_set_flag_recursive_cb(C, NULL, ob, propname);
+ outliner_object_set_flag_recursive_fn(C, NULL, ob, propname);
}
/**
* Base properties.
* */
-static void outliner__base_set_flag_recursive_cb(bContext *C, void *poin, void *poin2)
+static void outliner__base_set_flag_recursive_fn(bContext *C, void *poin, void *poin2)
{
Base *base = poin;
char *propname = poin2;
- outliner_object_set_flag_recursive_cb(C, base, NULL, propname);
+ outliner_object_set_flag_recursive_fn(C, base, NULL, propname);
}
/** Create either a RNA_LayerCollection or a RNA_Collection pointer. */
@@ -569,7 +569,7 @@ void outliner_collection_isolate_flag(Scene *scene,
}
}
-static void outliner_collection_set_flag_recursive_cb(bContext *C,
+static void outliner_collection_set_flag_recursive_fn(bContext *C,
LayerCollection *layer_collection,
Collection *collection,
const char *propname)
@@ -633,24 +633,24 @@ static void outliner_collection_set_flag_recursive_cb(bContext *C,
* Layer collection properties called from the ViewLayer mode.
* Change the (non-excluded) collection children, and the objects nested to them all.
*/
-static void view_layer__layer_collection_set_flag_recursive_cb(bContext *C,
+static void view_layer__layer_collection_set_flag_recursive_fn(bContext *C,
void *poin,
void *poin2)
{
LayerCollection *layer_collection = poin;
char *propname = poin2;
- outliner_collection_set_flag_recursive_cb(C, layer_collection, NULL, propname);
+ outliner_collection_set_flag_recursive_fn(C, layer_collection, NULL, propname);
}
/**
* Collection properties called from the ViewLayer mode.
* Change the (non-excluded) collection children, and the objects nested to them all.
*/
-static void view_layer__collection_set_flag_recursive_cb(bContext *C, void *poin, void *poin2)
+static void view_layer__collection_set_flag_recursive_fn(bContext *C, void *poin, void *poin2)
{
LayerCollection *layer_collection = poin;
char *propname = poin2;
- outliner_collection_set_flag_recursive_cb(
+ outliner_collection_set_flag_recursive_fn(
C, layer_collection, layer_collection->collection, propname);
}
@@ -658,14 +658,14 @@ static void view_layer__collection_set_flag_recursive_cb(bContext *C, void *poin
* Collection properties called from the Scenes mode.
* Change the collection children but no objects.
*/
-static void scenes__collection_set_flag_recursive_cb(bContext *C, void *poin, void *poin2)
+static void scenes__collection_set_flag_recursive_fn(bContext *C, void *poin, void *poin2)
{
Collection *collection = poin;
char *propname = poin2;
- outliner_collection_set_flag_recursive_cb(C, NULL, collection, propname);
+ outliner_collection_set_flag_recursive_fn(C, NULL, collection, propname);
}
-static void namebutton_cb(bContext *C, void *tsep, char *oldname)
+static void namebutton_fn(bContext *C, void *tsep, char *oldname)
{
Main *bmain = CTX_data_main(C);
SpaceOutliner *soops = CTX_wm_space_outliner(C);
@@ -732,7 +732,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
else {
switch (tselem->type) {
case TSE_DEFGROUP:
- BKE_object_defgroup_unique_name(te->directdata, (Object *)tselem->id); // id = object
+ BKE_object_defgroup_unique_name(te->directdata, (Object *)tselem->id); /* id = object. */
break;
case TSE_NLA_ACTION:
BLI_libblock_ensure_unique_name(bmain, tselem->id->name);
@@ -791,7 +791,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
break;
}
case TSE_POSEGRP: {
- Object *ob = (Object *)tselem->id; // id = object
+ Object *ob = (Object *)tselem->id; /* id = object. */
bActionGroup *grp = te->directdata;
BLI_uniquename(&ob->pose->agroups,
@@ -810,7 +810,7 @@ static void namebutton_cb(bContext *C, void *tsep, char *oldname)
/* always make layer active */
BKE_gpencil_layer_active_set(gpd, gpl);
- // XXX: name needs translation stuff
+ /* XXX: name needs translation stuff. */
BLI_uniquename(
&gpd->layers, gpl, "GP Layer", '.', offsetof(bGPDlayer, info), sizeof(gpl->info));
@@ -1074,7 +1074,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
0,
0,
TIP_("Use view layer for rendering"));
- UI_but_func_set(bt, restrictbutton_r_lay_cb, tselem->id, NULL);
+ UI_but_func_set(bt, restrictbutton_r_lay_fn, tselem->id, NULL);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
}
@@ -1112,7 +1112,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
TIP_("Temporarily hide in viewport\n"
"* Shift to set children"));
UI_but_func_set(
- bt, outliner__base_set_flag_recursive_cb, base, (void *)"hide_viewport");
+ bt, outliner__base_set_flag_recursive_fn, base, (void *)"hide_viewport");
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
if (!props_active.base_hide_viewport) {
UI_but_flag_enable(bt, UI_BUT_INACTIVE);
@@ -1138,7 +1138,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
-1,
TIP_("Disable selection in viewport\n"
"* Shift to set children"));
- UI_but_func_set(bt, outliner__object_set_flag_recursive_cb, ob, (char *)"hide_select");
+ UI_but_func_set(bt, outliner__object_set_flag_recursive_fn, ob, (char *)"hide_select");
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
if (!props_active.object_hide_select) {
UI_but_flag_enable(bt, UI_BUT_INACTIVE);
@@ -1163,7 +1163,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
-1,
TIP_("Globally disable in viewports\n"
"* Shift to set children"));
- UI_but_func_set(bt, outliner__object_set_flag_recursive_cb, ob, (void *)"hide_viewport");
+ UI_but_func_set(bt, outliner__object_set_flag_recursive_fn, ob, (void *)"hide_viewport");
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
if (!props_active.object_hide_viewport) {
UI_but_flag_enable(bt, UI_BUT_INACTIVE);
@@ -1188,7 +1188,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
-1,
TIP_("Globally disable in renders\n"
"* Shift to set children"));
- UI_but_func_set(bt, outliner__object_set_flag_recursive_cb, ob, (char *)"hide_render");
+ UI_but_func_set(bt, outliner__object_set_flag_recursive_fn, ob, (char *)"hide_render");
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
if (!props_active.object_hide_render) {
UI_but_flag_enable(bt, UI_BUT_INACTIVE);
@@ -1302,7 +1302,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
-1,
-1,
TIP_("Restrict visibility in the 3D View"));
- UI_but_func_set(bt, restrictbutton_bone_visibility_cb, bone, NULL);
+ UI_but_func_set(bt, restrictbutton_bone_visibility_fn, bone, NULL);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
}
@@ -1323,7 +1323,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
0,
0,
TIP_("Restrict selection in the 3D View"));
- UI_but_func_set(bt, restrictbutton_bone_select_cb, ob->data, bone);
+ UI_but_func_set(bt, restrictbutton_bone_select_fn, ob->data, bone);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
}
@@ -1347,7 +1347,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
0,
0,
TIP_("Restrict visibility in the 3D View"));
- UI_but_func_set(bt, restrictbutton_ebone_visibility_cb, NULL, ebone);
+ UI_but_func_set(bt, restrictbutton_ebone_visibility_fn, NULL, ebone);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
}
@@ -1368,7 +1368,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
0,
0,
TIP_("Restrict selection in the 3D View"));
- UI_but_func_set(bt, restrictbutton_ebone_select_cb, NULL, ebone);
+ UI_but_func_set(bt, restrictbutton_ebone_select_fn, NULL, ebone);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
}
@@ -1393,7 +1393,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
0,
0,
TIP_("Restrict visibility in the 3D View"));
- UI_but_func_set(bt, restrictbutton_gp_layer_flag_cb, id, gpl);
+ UI_but_func_set(bt, restrictbutton_gp_layer_flag_fn, id, gpl);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
UI_but_drawflag_enable(bt, UI_BUT_ICON_REVERSE);
}
@@ -1414,7 +1414,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
0,
0,
TIP_("Restrict editing of strokes and keyframes in this layer"));
- UI_but_func_set(bt, restrictbutton_gp_layer_flag_cb, id, gpl);
+ UI_but_func_set(bt, restrictbutton_gp_layer_flag_fn, id, gpl);
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
}
}
@@ -1451,7 +1451,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
"* Ctrl to isolate collection\n"
"* Shift to set inside collections and objects"));
UI_but_func_set(bt,
- view_layer__layer_collection_set_flag_recursive_cb,
+ view_layer__layer_collection_set_flag_recursive_fn,
layer_collection,
(char *)"hide_viewport");
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
@@ -1480,7 +1480,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
"* Ctrl to isolate collection\n"
"* Shift to set inside collections"));
UI_but_func_set(bt,
- view_layer__layer_collection_set_flag_recursive_cb,
+ view_layer__layer_collection_set_flag_recursive_fn,
layer_collection,
(char *)"holdout");
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
@@ -1511,7 +1511,7 @@ static void outliner_draw_restrictbuts(uiBlock *block,
"* Ctrl to isolate collection\n"
"* Shift to set inside collections"));
UI_but_func_set(bt,
- view_layer__layer_collection_set_flag_recursive_cb,
+ view_layer__layer_collection_set_flag_recursive_fn,
layer_collection,
(char *)"indirect_only");
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
@@ -1543,13 +1543,13 @@ static void outliner_draw_restrictbuts(uiBlock *block,
"* Shift to set inside collections and objects"));
if (layer_collection != NULL) {
UI_but_func_set(bt,
- view_layer__collection_set_flag_recursive_cb,
+ view_layer__collection_set_flag_recursive_fn,
layer_collection,
(char *)"hide_viewport");
}
else {
UI_but_func_set(bt,
- scenes__collection_set_flag_recursive_cb,
+ scenes__collection_set_flag_recursive_fn,
collection,
(char *)"hide_viewport");
}
@@ -1580,13 +1580,13 @@ static void outliner_draw_restrictbuts(uiBlock *block,
"* Shift to set inside collections and objects"));
if (layer_collection != NULL) {
UI_but_func_set(bt,
- view_layer__collection_set_flag_recursive_cb,
+ view_layer__collection_set_flag_recursive_fn,
layer_collection,
(char *)"hide_render");
}
else {
UI_but_func_set(
- bt, scenes__collection_set_flag_recursive_cb, collection, (char *)"hide_render");
+ bt, scenes__collection_set_flag_recursive_fn, collection, (char *)"hide_render");
}
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
if (!props_active.collection_hide_render) {
@@ -1615,13 +1615,13 @@ static void outliner_draw_restrictbuts(uiBlock *block,
"* Shift to set inside collections and objects"));
if (layer_collection != NULL) {
UI_but_func_set(bt,
- view_layer__collection_set_flag_recursive_cb,
+ view_layer__collection_set_flag_recursive_fn,
layer_collection,
(char *)"hide_select");
}
else {
UI_but_func_set(
- bt, scenes__collection_set_flag_recursive_cb, collection, (char *)"hide_select");
+ bt, scenes__collection_set_flag_recursive_fn, collection, (char *)"hide_select");
}
UI_but_flag_enable(bt, UI_BUT_DRAG_LOCK);
if (!props_active.collection_hide_select) {
@@ -1870,7 +1870,7 @@ static void outliner_buttons(const bContext *C,
0,
0,
"");
- UI_but_func_rename_set(bt, namebutton_cb, tselem);
+ UI_but_func_rename_set(bt, namebutton_fn, tselem);
/* returns false if button got removed */
if (false == UI_but_active_only(C, region, block, bt)) {
@@ -2950,13 +2950,11 @@ int tree_element_id_type_to_index(TreeElement *te)
if (id_index < INDEX_ID_OB) {
return id_index;
}
- else if (id_index == INDEX_ID_OB) {
+ if (id_index == INDEX_ID_OB) {
const Object *ob = (Object *)tselem->id;
return INDEX_ID_OB + ob->type;
}
- else {
- return id_index + OB_TYPE_MAX;
- }
+ return id_index + OB_TYPE_MAX;
}
typedef struct MergedIconRow {
@@ -3204,7 +3202,7 @@ static void outliner_draw_tree_element(bContext *C,
icon_border);
GPU_blend(true); /* roundbox disables it */
- te->flag |= TE_ACTIVE; // for lookup in display hierarchies
+ te->flag |= TE_ACTIVE; /* For lookup in display hierarchies. */
}
/* collection colors */
@@ -3236,7 +3234,7 @@ static void outliner_draw_tree_element(bContext *C,
/* open/close icon, only when sublevels, except for scene */
int icon_x = startx;
- // icons a bit higher
+ /* Icons a bit higher. */
if (TSELEM_OPEN(tselem, soops)) {
UI_icon_draw_alpha((float)icon_x + 2 * ufac,
(float)*starty + 1 * ufac,
@@ -3325,9 +3323,9 @@ static void outliner_draw_tree_element(bContext *C,
*starty -= UI_UNIT_Y;
LISTBASE_FOREACH (TreeElement *, ten, &te->subtree) {
- /* check if element needs to be drawn grayed out, but also gray out
- * childs of a grayed out parent (pass on draw_grayed_out to childs) */
- bool draw_childs_grayed_out = draw_grayed_out || (ten->flag & TE_DRAGGING);
+ /* Check if element needs to be drawn grayed out, but also gray out
+ * children of a grayed out parent (pass on draw_grayed_out to children). */
+ bool draw_children_grayed_out = draw_grayed_out || (ten->flag & TE_DRAGGING);
outliner_draw_tree_element(C,
block,
fstyle,
@@ -3335,7 +3333,7 @@ static void outliner_draw_tree_element(bContext *C,
region,
soops,
ten,
- draw_childs_grayed_out,
+ draw_children_grayed_out,
startx + UI_UNIT_X,
starty,
restrict_column_width,
@@ -3382,10 +3380,10 @@ static void outliner_draw_hierarchy_lines_recursive_old(uint pos,
/* For vertical lines between objects. */
y1 = y2 = y1_dashed = y2_dashed = *starty;
for (te = lb->first; te; te = te->next) {
- bool draw_childs_grayed_out = draw_grayed_out || (te->flag & TE_DRAGGING);
+ bool draw_children_grayed_out = draw_grayed_out || (te->flag & TE_DRAGGING);
TreeStoreElem *tselem = TREESTORE(te);
- if (draw_childs_grayed_out) {
+ if (draw_children_grayed_out) {
immUniformColor3ubvAlpha(col, grayed_alpha);
}
else {
@@ -3422,7 +3420,7 @@ static void outliner_draw_hierarchy_lines_recursive_old(uint pos,
if (TSELEM_OPEN(tselem, soops)) {
outliner_draw_hierarchy_lines_recursive_old(
- pos, soops, &te->subtree, startx + UI_UNIT_X, col, draw_childs_grayed_out, starty);
+ pos, soops, &te->subtree, startx + UI_UNIT_X, col, draw_children_grayed_out, starty);
}
}
@@ -3724,7 +3722,7 @@ static void outliner_draw_tree(bContext *C,
short mode_column_offset = (use_mode_column && (soops->outlinevis == SO_SCENES)) ? UI_UNIT_X : 0;
GPU_blend_set_func_separate(
- GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); // only once
+ GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); /* Only once. */
if (soops->outlinevis == SO_DATA_API) {
/* struct marks */
@@ -3747,13 +3745,12 @@ static void outliner_draw_tree(bContext *C,
GPU_scissor(0, 0, mask_x, region->winy);
}
- // gray hierarchy lines
-
+ /* Gray hierarchy lines. */
starty = (int)region->v2d.tot.ymax - OL_Y_OFFSET;
startx = mode_column_offset + UI_UNIT_X / 2 - (U.pixelsize + 1) / 2;
outliner_draw_hierarchy_lines(soops, &soops->tree, startx, &starty);
- // items themselves
+ /* Items themselves. */
starty = (int)region->v2d.tot.ymax - UI_UNIT_Y - OL_Y_OFFSET;
startx = mode_column_offset;
LISTBASE_FOREACH (TreeElement *, te, &soops->tree) {
@@ -3825,9 +3822,7 @@ static int outliner_width(SpaceOutliner *soops, int max_tree_width, float restri
if (soops->outlinevis == SO_DATA_API) {
return outliner_data_api_buttons_start_x(max_tree_width) + OL_RNA_COL_SIZEX + 10 * UI_DPI_FAC;
}
- else {
- return max_tree_width + restrict_column_width;
- }
+ return max_tree_width + restrict_column_width;
}
static void outliner_update_viewable_area(ARegion *region,
@@ -3860,7 +3855,7 @@ void draw_outliner(const bContext *C)
TreeViewContext tvc;
outliner_viewcontext_init(C, &tvc);
- outliner_build_tree(mainvar, tvc.scene, tvc.view_layer, soops, region); // always
+ outliner_build_tree(mainvar, tvc.scene, tvc.view_layer, soops, region); /* Always. */
/* If global sync select is dirty, flag other outliners */
if (ED_outliner_select_sync_is_dirty(C)) {