diff options
Diffstat (limited to 'source/blender/editors/space_outliner/outliner_draw.c')
-rw-r--r-- | source/blender/editors/space_outliner/outliner_draw.c | 117 |
1 files changed, 56 insertions, 61 deletions
diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 6f5f1294167..a45b415b629 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -80,8 +80,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 */ @@ -173,12 +173,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; @@ -187,7 +187,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) { @@ -201,7 +201,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; @@ -217,7 +217,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) { @@ -231,7 +231,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; @@ -253,7 +253,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) @@ -313,21 +313,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. */ @@ -568,7 +568,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) @@ -632,24 +632,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); } @@ -657,14 +657,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); @@ -731,7 +731,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); @@ -790,7 +790,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, @@ -809,7 +809,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)); @@ -1073,7 +1073,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); } @@ -1111,7 +1111,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); @@ -1137,7 +1137,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); @@ -1162,7 +1162,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); @@ -1187,7 +1187,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); @@ -1301,7 +1301,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); } @@ -1322,7 +1322,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); } @@ -1346,7 +1346,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); } @@ -1367,7 +1367,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); } @@ -1376,13 +1376,13 @@ static void outliner_draw_restrictbuts(uiBlock *block, ID *id = tselem->id; bGPDlayer *gpl = (bGPDlayer *)te->directdata; - if (soops->show_restrict_flags & SO_RESTRICT_VIEWPORT) { + if (soops->show_restrict_flags & SO_RESTRICT_HIDE) { bt = uiDefIconButBitS(block, UI_BTYPE_ICON_TOGGLE, GP_LAYER_HIDE, 0, ICON_HIDE_OFF, - (int)(region->v2d.cur.xmax - restrict_offsets.viewport), + (int)(region->v2d.cur.xmax - restrict_offsets.hide), te->ys, UI_UNIT_X, UI_UNIT_Y, @@ -1392,7 +1392,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); } @@ -1413,7 +1413,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); } } @@ -1450,7 +1450,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); @@ -1479,7 +1479,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); @@ -1510,7 +1510,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); @@ -1542,13 +1542,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"); } @@ -1579,13 +1579,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) { @@ -1614,13 +1614,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) { @@ -1869,7 +1869,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)) { @@ -2816,13 +2816,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 { @@ -3071,7 +3069,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. */ } if (tselem->type == TSE_VIEW_COLLECTION_BASE) { @@ -3082,7 +3080,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, @@ -3489,7 +3487,7 @@ static void outliner_draw_tree(bContext *C, int starty, startx; 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 */ @@ -3512,13 +3510,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 - UI_UNIT_Y / 2 - OL_Y_OFFSET; startx = 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 = 0; LISTBASE_FOREACH (TreeElement *, te, &soops->tree) { @@ -3590,9 +3587,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, @@ -3625,7 +3620,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)) { |