[Bf-blender-cvs] [7a1c405bb4c] master: Cleanup: Comment formatting in interface_panel.c
Hans Goudey
noreply at git.blender.org
Thu Sep 17 05:57:06 CEST 2020
Commit: 7a1c405bb4c10f100e90752f5032de38f8b9c0db
Author: Hans Goudey
Date: Wed Sep 16 22:56:29 2020 -0500
Branches: master
https://developer.blender.org/rB7a1c405bb4c10f100e90752f5032de38f8b9c0db
Cleanup: Comment formatting in interface_panel.c
Also cleaned up some grammar and wording issues, and switched a case
in an if statement to remove a double negative.
===================================================================
M source/blender/editors/interface/interface_panel.c
===================================================================
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index aee2529134c..7312c410bba 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -500,7 +500,7 @@ static bool panel_set_expand_from_list_data_recursive(Panel *panel, short flag,
/**
* Set the expansion of the panel and its sub-panels from the flag stored by the list data
- * corresponding to this panel. The flag has expansion stored in each bit in depth first
+ * corresponding to each panel. The flag has expansion stored in each bit in depth first
* order.
*/
void UI_panel_set_expand_from_list_data(const bContext *C, Panel *panel)
@@ -566,7 +566,7 @@ static void set_panels_list_data_expand_flag(const bContext *C, const ARegion *r
/* Check for #PNL_ACTIVE so we only set the expand flag for active panels. */
if (panel_type->flag & PNL_INSTANCED && panel->runtime_flag & PNL_ACTIVE) {
- short expand_flag = 0; /* Initialize to quite complaining compiler, value not used. */
+ short expand_flag;
short flag_index = 0;
get_panel_expand_flag(panel, &expand_flag, &flag_index);
if (panel->type->set_list_data_expand_flag) {
@@ -611,7 +611,7 @@ static void panels_collapse_all(ARegion *region, const Panel *from_panel)
LISTBASE_FOREACH (Panel *, panel, ®ion->panels) {
PanelType *pt = panel->type;
- /* close panels with headers in the same context */
+ /* Close panels with headers in the same context. */
if (pt && from_pt && !(pt->flag & PNL_NO_HEADER)) {
if (!pt->context[0] || !from_pt->context[0] || STREQ(pt->context, from_pt->context)) {
if ((panel->flag & PNL_PIN) || !category || !pt->category[0] ||
@@ -661,11 +661,7 @@ Panel *UI_panel_begin(
const char *idname = pt->idname;
const bool newpanel = (panel == NULL);
- if (!newpanel) {
- panel->type = pt;
- }
- else {
- /* new panel */
+ if (newpanel) {
panel = MEM_callocN(sizeof(Panel), "new panel");
panel->type = pt;
BLI_strncpy(panel->panelname, idname, sizeof(panel->panelname));
@@ -684,11 +680,15 @@ Panel *UI_panel_begin(
BLI_addtail(lb, panel);
}
+ else {
+ /* Panel already exists. */
+ panel->type = pt;
+ }
/* Do not allow closed panels without headers! Else user could get "disappeared" UI! */
if ((pt->flag & PNL_NO_HEADER) && (panel->flag & PNL_CLOSED)) {
panel->flag &= ~PNL_CLOSED;
- /* Force update of panels' positions! */
+ /* Force update of panels' positions. */
panel->sizex = 0;
panel->sizey = 0;
panel->blocksizex = 0;
@@ -697,9 +697,8 @@ Panel *UI_panel_begin(
BLI_strncpy(panel->drawname, drawname, sizeof(panel->drawname));
- /* if a new panel is added, we insert it right after the panel
- * that was last added. this way new panels are inserted in the
- * right place between versions */
+ /* If a new panel is added, we insert it right after the panel that was last added.
+ * This way new panels are inserted in the right place between versions */
for (panel_last = lb->first; panel_last; panel_last = panel_last->next) {
if (panel_last->runtime_flag & PNL_LAST_ADDED) {
BLI_remlink(lb, panel);
@@ -722,7 +721,7 @@ Panel *UI_panel_begin(
panel_last->runtime_flag &= ~PNL_LAST_ADDED;
}
- /* assign to block */
+ /* Assign the new panel to the block. */
block->panel = panel;
panel->runtime_flag |= PNL_ACTIVE | PNL_LAST_ADDED;
if (region->alignment == RGN_ALIGN_FLOAT) {
@@ -777,7 +776,7 @@ void UI_panel_end(const ARegion *region, uiBlock *block, int width, int height,
const int old_sizex = panel->sizex, old_sizey = panel->sizey;
const int old_region_ofsx = panel->runtime.region_ofsx;
- /* update width/height if non-zero */
+ /* Update width/height if non-zero. */
if (width != 0) {
panel->sizex = width;
}
@@ -785,7 +784,7 @@ void UI_panel_end(const ARegion *region, uiBlock *block, int width, int height,
panel->sizey = height;
}
- /* check if we need to do an animation */
+ /* Check if we need to do an animation. */
if (panel->sizex != old_sizex || panel->sizey != old_sizey) {
panel->runtime_flag |= PNL_ANIM_ALIGN;
panel->ofsy += old_sizey - panel->sizey;
@@ -802,7 +801,7 @@ static void ui_offset_panel_block(uiBlock *block)
{
const uiStyle *style = UI_style_get_dpi();
- /* compute bounds and offset */
+ /* Compute bounds and offset. */
ui_block_bounds_calc(block);
const int ofsy = block->panel->sizey - style->panelspace;
@@ -898,12 +897,12 @@ void UI_draw_icon_tri(float x, float y, char dir, const float color[4])
else if (dir == 't') {
UI_draw_anti_tria(x - f5, y - f7, x + f5, y - f7, x, y + f3, color);
}
- else { /* 'v' = vertical, down */
+ else { /* 'v' = vertical, down. */
UI_draw_anti_tria(x - f5, y + f3, x + f5, y + f3, x, y - f7, color);
}
}
-#define PNL_ICON UI_UNIT_X /* could be UI_UNIT_Y too */
+#define PNL_ICON UI_UNIT_X /* Could be UI_UNIT_Y too. */
/* For button layout next to label. */
void UI_panel_label_offset(uiBlock *block, int *r_x, int *r_y)
@@ -929,10 +928,10 @@ static void ui_draw_aligned_panel_header(const uiStyle *style,
const bool is_subpanel = (panel->type && panel->type->parent);
const uiFontStyle *fontstyle = (is_subpanel) ? &style->widgetlabel : &style->paneltitle;
- /* + 0.001f to avoid flirting with float inaccuracy */
+ /* + 0.001f to avoid flirting with float inaccuracy .*/
const int pnl_icons = (panel->labelofs + (1.1f * PNL_ICON)) / block->aspect + 0.001f;
- /* draw text label */
+ /* Draw text label.s */
uchar col_title[4];
panel_title_color_get(
panel, show_background, is_subpanel, region_search_filter_active, col_title);
@@ -951,7 +950,7 @@ static void ui_draw_aligned_panel_header(const uiStyle *style,
}
/**
- * Panel integrated in buttons-window, tool/property lists etc
+ * Draw a panel integrated in buttons-window, tool/property lists etc
*/
void ui_draw_aligned_panel(const uiStyle *style,
const uiBlock *block,
@@ -1032,7 +1031,7 @@ void ui_draw_aligned_panel(const uiStyle *style,
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
GPU_blend(GPU_BLEND_ALPHA);
- /* draw with background color */
+ /* Draw with background color. */
immUniformThemeColor(UI_panel_matches_search_filter(panel) ? TH_MATCH : TH_PANEL_HEADER);
immRectf(pos, minx, headrect.ymin, rect->xmax, y);
@@ -1067,7 +1066,7 @@ void ui_draw_aligned_panel(const uiStyle *style,
GPU_blend(GPU_BLEND_NONE);
}
- /* horizontal title */
+ /* Draw the title. */
rcti titlerect = headrect;
if (is_subpanel) {
titlerect.xmin += (0.7f * UI_UNIT_X) / block->aspect + 0.001f;
@@ -1159,7 +1158,7 @@ void ui_draw_aligned_panel(const uiStyle *style,
immUnbindProgram();
}
- /* draw collapse icon */
+ /* Draw collapse icon. */
{
rctf itemrect = {.xmin = titlerect.xmin,
.xmax = itemrect.xmin + BLI_rcti_size_y(&titlerect),
@@ -1196,7 +1195,7 @@ static void imm_buf_append(
(*index)++;
}
-/* based on UI_draw_roundbox, check on making a version which allows us to skip some sides */
+/* Based on UI_draw_roundbox, check on making a version which allows us to skip some sides. */
static void ui_panel_category_draw_tab(bool filled,
float minx,
float miny,
@@ -1212,7 +1211,6 @@ static void ui_panel_category_draw_tab(bool filled,
{
float vec[4][2] = {{0.195, 0.02}, {0.55, 0.169}, {0.831, 0.45}, {0.98, 0.805}};
- /* Multiply `vec` by radius. */
for (int a = 0; a < 4; a++) {
mul_v2_fl(vec[a], rad);
}
@@ -1234,7 +1232,7 @@ static void ui_panel_category_draw_tab(bool filled,
uchar cbuf[24][3];
int buf_index = 0;
- /* start with corner right-top */
+ /* Start right-top corner. */
if (use_highlight) {
if (roundboxtype & UI_CNR_TOP_RIGHT) {
imm_buf_append(vbuf, cbuf, maxx, maxy - rad, col, &buf_index);
@@ -1247,7 +1245,7 @@ static void ui_panel_category_draw_tab(bool filled,
imm_buf_append(vbuf, cbuf, maxx, maxy, col, &buf_index);
}
- /* corner left-top */
+ /* Left top-corner. */
if (roundboxtype & UI_CNR_TOP_LEFT) {
imm_buf_append(vbuf, cbuf, minx + rad, maxy, col, &buf_index);
for (int a = 0; a < 4; a++) {
@@ -1265,7 +1263,7 @@ static void ui_panel_category_draw_tab(bool filled,
vbuf, cbuf, minx, miny + rad, highlight_fade ? col : highlight_fade, &buf_index);
}
else {
- /* corner left-bottom */
+ /* Left bottom-corner. */
if (roundboxtype & UI_CNR_BOTTOM_LEFT) {
imm_buf_append(vbuf, cbuf, minx, miny + rad, col, &buf_index);
for (int a = 0; a < 4; a++) {
@@ -1277,7 +1275,7 @@ static void ui_panel_category_draw_tab(bool filled,
imm_buf_append(vbuf, cbuf, minx, miny, col, &buf_index);
}
- /* corner right-bottom */
+ /* Right-bottom corner. */
if (roundboxtype & UI_CNR_BOTTOM_RIGHT) {
imm_buf_append(vbuf, cbuf, maxx - rad, miny, col, &buf_index);
for (int a = 0; a < 4; a++) {
@@ -1313,12 +1311,10 @@ static void ui_panel_category_draw_tab(bool filled,
}
/**
- * Draw vertical tabs on the left side of the region,
- * one tab per category.
+ * Draw vertical tabs on the left side of the region, one tab per category.
*/
void UI_panel_category_draw_all(ARegion *region, const char *category_id_active)
{
- /* no tab outlines for */
// #define USE_FLAT_INACTIVE
const bool is_left = RGN_ALIGN_ENUM_FROM_MASK(region->alignment != RGN_ALIGN_RIGHT);
View2D *v2d = ®ion->v2d;
@@ -1332,9 +1328,9 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active)
const int px_x_sign = is_left ? px : -px;
const int category_tabs_width = round_fl_to_int(UI_PANEL_CATEGORY_MARGIN_WIDTH * zoom);
const float dpi_fac = UI_DPI_FAC;
- /* padding of tabs around text */
+ /* Padding of tabs around text. */
const int tab_v_pad_text = round_fl_to_int((2 + ((px * 3) * dpi_fac)) * zoom);
- /* padding betwe
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list