Cleanup: rename 'ct' to 'len' for editors

This commit is contained in:
2018-07-08 13:19:10 +02:00
parent 9fb9125184
commit 73d2d75eed
9 changed files with 59 additions and 59 deletions

View File

@@ -6,24 +6,24 @@
#ifdef DOUBLE_MANIFOLD
# ifdef USE_INVOC_EXT
# define invoc_ct 2
# define invoc_len 2
# else
# define vert_ct 6
# define vert_len 6
# endif
#else
# ifdef USE_INVOC_EXT
# define invoc_ct 2
# define invoc_len 2
# else
# define vert_ct 6
# define vert_len 6
# endif
#endif
#ifdef USE_INVOC_EXT
layout(triangles, invocations = invoc_ct) in;
layout(triangles, invocations = invoc_len) in;
layout(triangle_strip, max_vertices = 3) out;
#else
layout(triangles) in;
layout(triangle_strip, max_vertices = vert_ct) out;
layout(triangle_strip, max_vertices = vert_len) out;
#endif
uniform vec3 lightDirection = vec3(0.57, 0.57, -0.57);

View File

@@ -6,24 +6,24 @@
#ifdef DOUBLE_MANIFOLD
# ifdef USE_INVOC_EXT
# define invoc_ct 2
# define invoc_len 2
# else
# define vert_ct 8
# define vert_len 8
# endif
#else
# ifdef USE_INVOC_EXT
# define invoc_ct 1
# define invoc_len 1
# else
# define vert_ct 4
# define vert_len 4
# endif
#endif
#ifdef USE_INVOC_EXT
layout(lines_adjacency, invocations = invoc_ct) in;
layout(lines_adjacency, invocations = invoc_len) in;
layout(triangle_strip, max_vertices = 4) out;
#else
layout(lines_adjacency) in;
layout(triangle_strip, max_vertices = vert_ct) out;
layout(triangle_strip, max_vertices = vert_len) out;
#endif
uniform vec3 lightDirection = vec3(0.57, 0.57, -0.57);

View File

@@ -585,20 +585,20 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa
copy_v4_v4(unsel_mhcol, unsel_color);
unsel_mhcol[3] *= 0.8f;
unsigned int block_ct = 0;
uint block_len = 0;
for (ActKeyBlock *ab = blocks->first; ab; ab = ab->next) {
if (actkeyblock_is_valid(ab, keys)) {
block_ct++;
block_len++;
}
}
if (block_ct > 0) {
if (block_len > 0) {
Gwn_VertFormat *format = immVertexFormat();
uint pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
uint color_id = GWN_vertformat_attr_add(format, "color", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
immBegin(GWN_PRIM_TRIS, 6 * block_ct);
immBegin(GWN_PRIM_TRIS, 6 * block_len);
for (ActKeyBlock *ab = blocks->first; ab; ab = ab->next) {
if (actkeyblock_is_valid(ab, keys)) {
if (ab->flag & ACTKEYBLOCK_FLAG_MOVING_HOLD) {
@@ -622,16 +622,16 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa
if (keys) {
/* count keys */
unsigned int key_ct = 0;
uint key_len = 0;
for (ActKeyColumn *ak = keys->first; ak; ak = ak->next) {
/* optimization: if keyframe doesn't appear within 5 units (screenspace) in visible area, don't draw
* - this might give some improvements, since we current have to flip between view/region matrices
*/
if (IN_RANGE_INCL(ak->cfra, v2d->cur.xmin, v2d->cur.xmax))
key_ct++;
key_len++;
}
if (key_ct > 0) {
if (key_len > 0) {
/* draw keys */
Gwn_VertFormat *format = immVertexFormat();
uint pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -640,7 +640,7 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa
uint outline_color_id = GWN_vertformat_attr_add(format, "outlineColor", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND);
GPU_enable_program_point_size();
immBegin(GWN_PRIM_POINTS, key_ct);
immBegin(GWN_PRIM_POINTS, key_len);
for (ActKeyColumn *ak = keys->first; ak; ak = ak->next) {
if (IN_RANGE_INCL(ak->cfra, v2d->cur.xmin, v2d->cur.xmax)) {

View File

@@ -166,16 +166,16 @@ void UI_draw_roundbox_4fv(bool filled, float minx, float miny, float maxx, float
mul_v2_fl(vec[a], rad);
}
unsigned int vert_ct = 0;
vert_ct += (roundboxtype & UI_CNR_BOTTOM_RIGHT) ? 9 : 1;
vert_ct += (roundboxtype & UI_CNR_TOP_RIGHT) ? 9 : 1;
vert_ct += (roundboxtype & UI_CNR_TOP_LEFT) ? 9 : 1;
vert_ct += (roundboxtype & UI_CNR_BOTTOM_LEFT) ? 9 : 1;
uint vert_len = 0;
vert_len += (roundboxtype & UI_CNR_BOTTOM_RIGHT) ? 9 : 1;
vert_len += (roundboxtype & UI_CNR_TOP_RIGHT) ? 9 : 1;
vert_len += (roundboxtype & UI_CNR_TOP_LEFT) ? 9 : 1;
vert_len += (roundboxtype & UI_CNR_BOTTOM_LEFT) ? 9 : 1;
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformColor4fv(col);
immBegin(filled ? GWN_PRIM_TRI_FAN : GWN_PRIM_LINE_LOOP, vert_ct);
immBegin(filled ? GWN_PRIM_TRI_FAN : GWN_PRIM_LINE_LOOP, vert_len);
/* start with corner right-bottom */
if (roundboxtype & UI_CNR_BOTTOM_RIGHT) {
immVertex2f(pos, maxx - rad, miny);

View File

@@ -1738,22 +1738,22 @@ static void ui_panel_category_draw_tab(
mul_v2_fl(vec[a], rad);
}
unsigned int vert_ct = 0;
uint vert_len = 0;
if (use_highlight) {
vert_ct += (roundboxtype & UI_CNR_TOP_RIGHT) ? 6 : 1;
vert_ct += (roundboxtype & UI_CNR_TOP_LEFT) ? 6 : 1;
vert_len += (roundboxtype & UI_CNR_TOP_RIGHT) ? 6 : 1;
vert_len += (roundboxtype & UI_CNR_TOP_LEFT) ? 6 : 1;
}
if (use_highlight && !use_shadow) {
vert_ct++;
vert_len++;
}
else {
vert_ct += (roundboxtype & UI_CNR_BOTTOM_RIGHT) ? 6 : 1;
vert_ct += (roundboxtype & UI_CNR_BOTTOM_LEFT) ? 6 : 1;
vert_len += (roundboxtype & UI_CNR_BOTTOM_RIGHT) ? 6 : 1;
vert_len += (roundboxtype & UI_CNR_BOTTOM_LEFT) ? 6 : 1;
}
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
immBegin(filled ? GWN_PRIM_TRI_FAN : GWN_PRIM_LINE_STRIP, vert_ct);
immBegin(filled ? GWN_PRIM_TRI_FAN : GWN_PRIM_LINE_STRIP, vert_len);
/* start with corner right-top */
if (use_highlight) {

View File

@@ -128,7 +128,7 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene)
float strip[4], selected_strip[4];
float height = (dopesheet->tot_channel * CHANNEL_STEP) + (CHANNEL_HEIGHT);
unsigned int keyframe_ct = 0;
uint keyframe_len = 0;
Gwn_VertFormat *format = immVertexFormat();
uint pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -186,10 +186,10 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene)
if (start_frame != end_frame) {
immRectf(pos_id, start_frame, (float) y - STRIP_HEIGHT_HALF,
end_frame, (float) y + STRIP_HEIGHT_HALF);
keyframe_ct += 2;
keyframe_len += 2;
}
else {
keyframe_ct++;
keyframe_len++;
}
}
@@ -199,7 +199,7 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene)
MovieTrackingMarker *marker = &track->markers[i];
if ((marker->flag & (MARKER_DISABLED | MARKER_TRACKED)) == 0) {
keyframe_ct++;
keyframe_len++;
}
i++;
@@ -212,7 +212,7 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene)
immUnbindProgram();
if (keyframe_ct > 0) {
if (keyframe_len > 0) {
/* draw keyframe markers */
format = immVertexFormat();
pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
@@ -222,7 +222,7 @@ void clip_draw_dopesheet_main(SpaceClip *sc, ARegion *ar, Scene *scene)
immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND);
GPU_enable_program_point_size();
immBegin(GWN_PRIM_POINTS, keyframe_ct);
immBegin(GWN_PRIM_POINTS, keyframe_len);
/* all same size with black outline */
immAttrib1f(size_id, 2.0f * STRIP_HEIGHT_HALF);

View File

@@ -138,9 +138,9 @@ static void nla_action_draw_keyframes(AnimData *adt, bAction *act, float y, floa
/* count keys before drawing */
/* Note: It's safe to cast DLRBT_Tree, as it's designed to degrade down to a ListBase */
unsigned int key_ct = BLI_listbase_count((ListBase *)&keys);
uint key_len = BLI_listbase_count((ListBase *)&keys);
if (key_ct > 0) {
if (key_len > 0) {
format = immVertexFormat();
pos_id = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
uint size_id = GWN_vertformat_attr_add(format, "size", GWN_COMP_F32, 1, GWN_FETCH_FLOAT);
@@ -148,7 +148,7 @@ static void nla_action_draw_keyframes(AnimData *adt, bAction *act, float y, floa
uint outline_color_id = GWN_vertformat_attr_add(format, "outlineColor", GWN_COMP_U8, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_KEYFRAME_DIAMOND);
GPU_enable_program_point_size();
immBegin(GWN_PRIM_POINTS, key_ct);
immBegin(GWN_PRIM_POINTS, key_len);
/* - disregard the selection status of keyframes so they draw a certain way
* - size is 6.0f which is smaller than the editable keyframes, so that there is a distinction

View File

@@ -758,10 +758,10 @@ void node_draw_shadow(SpaceNode *snode, bNode *node, float radius, float alpha)
void node_draw_sockets(View2D *v2d, const bContext *C, bNodeTree *ntree, bNode *node, bool draw_outputs, bool select_all)
{
const unsigned int total_input_ct = BLI_listbase_count(&node->inputs);
const unsigned int total_output_ct = BLI_listbase_count(&node->outputs);
const uint total_input_len = BLI_listbase_count(&node->inputs);
const uint total_output_len = BLI_listbase_count(&node->outputs);
if (total_input_ct + total_output_ct == 0) {
if (total_input_len + total_output_len == 0) {
return;
}
@@ -788,17 +788,17 @@ void node_draw_sockets(View2D *v2d, const bContext *C, bNodeTree *ntree, bNode *
immUniform1f("outlineWidth", 1.0f);
immUniform4f("outlineColor", 0.0f, 0.0f, 0.0f, 0.6f);
immBeginAtMost(GWN_PRIM_POINTS, total_input_ct + total_output_ct);
immBeginAtMost(GWN_PRIM_POINTS, total_input_len + total_output_len);
}
/* socket inputs */
short selected_input_ct = 0;
short selected_input_len = 0;
bNodeSocket *sock;
for (sock = node->inputs.first; sock; sock = sock->next) {
if (nodeSocketIsHidden(sock))
continue;
if (select_all || (sock->flag & SELECT)) {
++selected_input_ct;
++selected_input_len;
continue;
}
@@ -806,13 +806,13 @@ void node_draw_sockets(View2D *v2d, const bContext *C, bNodeTree *ntree, bNode *
}
/* socket outputs */
short selected_output_ct = 0;
short selected_output_len = 0;
if (draw_outputs) {
for (sock = node->outputs.first; sock; sock = sock->next) {
if (nodeSocketIsHidden(sock))
continue;
if (select_all || (sock->flag & SELECT)) {
++selected_output_ct;
++selected_output_len;
continue;
}
@@ -825,36 +825,36 @@ void node_draw_sockets(View2D *v2d, const bContext *C, bNodeTree *ntree, bNode *
}
/* go back and draw selected sockets */
if (selected_input_ct + selected_output_ct > 0) {
if (selected_input_len + selected_output_len > 0) {
/* outline for selected sockets */
float c[3];
UI_GetThemeColor3fv(TH_TEXT_HI, c);
immUniform4f("outlineColor", c[0], c[1], c[2], 1.0f);
immUniform1f("outlineWidth", 1.5f);
immBegin(GWN_PRIM_POINTS, selected_input_ct + selected_output_ct);
immBegin(GWN_PRIM_POINTS, selected_input_len + selected_output_len);
if (selected_input_ct) {
if (selected_input_len) {
/* socket inputs */
for (sock = node->inputs.first; sock; sock = sock->next) {
if (nodeSocketIsHidden(sock))
continue;
if (select_all || (sock->flag & SELECT)) {
node_socket_circle_draw(C, ntree, node_ptr, sock, pos, col);
if (--selected_input_ct == 0)
if (--selected_input_len == 0)
break; /* stop as soon as last one is drawn */
}
}
}
if (selected_output_ct) {
if (selected_output_len) {
/* socket outputs */
for (sock = node->outputs.first; sock; sock = sock->next) {
if (nodeSocketIsHidden(sock))
continue;
if (select_all || (sock->flag & SELECT)) {
node_socket_circle_draw(C, ntree, node_ptr, sock, pos, col);
if (--selected_output_ct == 0)
if (--selected_output_len == 0)
break; /* stop as soon as last one is drawn */
}
}

View File

@@ -1539,10 +1539,10 @@ static void draw_seq_backdrop(View2D *v2d)
/* Darker lines separating the horizontal bands */
i = max_ii(1, ((int)v2d->cur.ymin) - 1);
int line_ct = (int)v2d->cur.ymax - i + 1;
int line_len = (int)v2d->cur.ymax - i + 1;
immUniformThemeColor(TH_GRID);
immBegin(GWN_PRIM_LINES, line_ct * 2);
while (line_ct--) {
immBegin(GWN_PRIM_LINES, line_len * 2);
while (line_len--) {
immVertex2f(pos, v2d->cur.xmax, i);
immVertex2f(pos, v2d->cur.xmin, i);
}