Cleanup: use static variables

This commit is contained in:
2018-07-31 20:44:49 +10:00
parent f945303877
commit 31fcd40efd
20 changed files with 43 additions and 38 deletions

View File

@@ -99,7 +99,7 @@ enum StudioLightFlag {
STUDIOLIGHT_EQUIRECTANGULAR_IRRADIANCE_GPUTEXTURE = (1 << 10),
STUDIOLIGHT_RADIANCE_BUFFERS_CALCULATED = (1 << 11),
STUDIOLIGHT_UI_EXPANDED = (1 << 13),
} StudioLightFlag;
};
#define STUDIOLIGHT_FLAG_ALL (STUDIOLIGHT_INTERNAL | STUDIOLIGHT_EXTERNAL_FILE)
#define STUDIOLIGHT_FLAG_ORIENTATIONS (STUDIOLIGHT_ORIENTATION_CAMERA | STUDIOLIGHT_ORIENTATION_WORLD | STUDIOLIGHT_ORIENTATION_VIEWNORMAL)

View File

@@ -2098,6 +2098,7 @@ static void mesh_calc_modifiers(
/* XXX: Is build_shapekey_layers ever even true? This should have crashed long ago... */
BLI_assert(!build_shapekey_layers);
UNUSED_VARS_NDEBUG(build_shapekey_layers);
//if (build_shapekey_layers)
// add_shapekey_layers(*r_deform_mesh, me, ob);

View File

@@ -89,6 +89,7 @@ bUserMenuItem *BKE_blender_user_menu_item_add(ListBase *lb, int type)
size = sizeof(bUserMenuItem_Prop);
}
else {
size = sizeof(bUserMenuItem);
BLI_assert(0);
}

View File

@@ -90,10 +90,12 @@ typedef struct MPATH_Data {
MPATH_StorageList *stl;
} MPATH_Data;
struct {
#if 0
static struct {
GPUShader *mpath_line_sh;
GPUShader *mpath_points_sh;
} e_data = {0};
#endif
/* *************************** Path Cache *********************************** */

View File

@@ -460,7 +460,7 @@ static void drw_shgroup_bone_ik_spline_lines(const float start[3], const float e
* \{ */
/* global here is reset before drawing each bone */
struct {
static struct {
const ThemeWireColor *bcolor;
} g_color;

View File

@@ -242,13 +242,15 @@ static GPUVertBuf *sphere_wire_vbo(const float rad)
cv[0] = p[(i + j) % NSEGMENTS][0];
cv[1] = p[(i + j) % NSEGMENTS][1];
if (axis == 0)
v[0] = cv[0], v[1] = cv[1], v[2] = 0.0f;
else if (axis == 1)
v[0] = cv[0], v[1] = 0.0f, v[2] = cv[1];
else
v[0] = 0.0f, v[1] = cv[0], v[2] = cv[1];
if (axis == 0) {
ARRAY_SET_ITEMS(v, cv[0], cv[1], 0.0f);
}
else if (axis == 1) {
ARRAY_SET_ITEMS(v, cv[0], 0.0f, cv[1]);
}
else {
ARRAY_SET_ITEMS(v, 0.0f, cv[0], cv[1]);
}
GPU_vertbuf_attr_set(vbo, attr_id.pos, i * 2 + j + (NSEGMENTS * 2 * axis), v);
}
}
@@ -825,17 +827,17 @@ GPUBatch *DRW_cache_empty_cone_get(void)
cv[1] = p[(i) % NSEGMENTS][1];
/* cone sides */
v[0] = cv[0], v[1] = 0.0f, v[2] = cv[1];
ARRAY_SET_ITEMS(v, cv[0], 0.0f, cv[1]);
GPU_vertbuf_attr_set(vbo, attr_id.pos, i * 4, v);
v[0] = 0.0f, v[1] = 2.0f, v[2] = 0.0f;
ARRAY_SET_ITEMS(v, 0.0f, 2.0f, 0.0f);
GPU_vertbuf_attr_set(vbo, attr_id.pos, i * 4 + 1, v);
/* end ring */
v[0] = cv[0], v[1] = 0.0f, v[2] = cv[1];
ARRAY_SET_ITEMS(v, cv[0], 0.0f, cv[1]);
GPU_vertbuf_attr_set(vbo, attr_id.pos, i * 4 + 2, v);
cv[0] = p[(i + 1) % NSEGMENTS][0];
cv[1] = p[(i + 1) % NSEGMENTS][1];
v[0] = cv[0], v[1] = 0.0f, v[2] = cv[1];
ARRAY_SET_ITEMS(v, cv[0], 0.0f, cv[1]);
GPU_vertbuf_attr_set(vbo, attr_id.pos, i * 4 + 3, v);
}
@@ -1578,9 +1580,9 @@ GPUBatch *DRW_cache_lamp_spot_get(void)
cv[1] = p[i % NSEGMENTS][1];
/* cone sides */
v[0] = cv[0], v[1] = cv[1], v[2] = -1.0f;
ARRAY_SET_ITEMS(v, cv[0], cv[1], -1.0f);
GPU_vertbuf_attr_set(vbo, attr_id.pos, i * 4, v);
v[0] = 0.0f, v[1] = 0.0f, v[2] = 0.0f;
ARRAY_SET_ITEMS(v, 0.0f, 0.0f, 0.0f);
GPU_vertbuf_attr_set(vbo, attr_id.pos, i * 4 + 1, v);
GPU_vertbuf_attr_set(vbo, attr_id.n1, i * 4, n[(i) % NSEGMENTS]);
@@ -1589,11 +1591,11 @@ GPUBatch *DRW_cache_lamp_spot_get(void)
GPU_vertbuf_attr_set(vbo, attr_id.n2, i * 4 + 1, n[(i + 1) % NSEGMENTS]);
/* end ring */
v[0] = cv[0], v[1] = cv[1], v[2] = -1.0f;
ARRAY_SET_ITEMS(v, cv[0], cv[1], -1.0f);
GPU_vertbuf_attr_set(vbo, attr_id.pos, i * 4 + 2, v);
cv[0] = p[(i + 1) % NSEGMENTS][0];
cv[1] = p[(i + 1) % NSEGMENTS][1];
v[0] = cv[0], v[1] = cv[1], v[2] = -1.0f;
ARRAY_SET_ITEMS(v, cv[0], cv[1], -1.0f);
GPU_vertbuf_attr_set(vbo, attr_id.pos, i * 4 + 3, v);
GPU_vertbuf_attr_set(vbo, attr_id.n1, i * 4 + 2, n[(i) % NSEGMENTS]);

View File

@@ -95,7 +95,7 @@
/** Render State: No persistent data between draw calls. */
DRWManager DST = {NULL};
ListBase DRW_engines = {NULL, NULL};
static ListBase DRW_engines = {NULL, NULL};
extern struct GPUUniformBuffer *view_ubo; /* draw_manager_exec.c */

View File

@@ -574,7 +574,7 @@ static void gp_add_filldata_tobuffer(
mul_v3_m4v3(fpt, diff_mat, &pt->x);
/* if 2d, need conversion */
if (!flag & GP_STROKE_3DSPACE) {
if (!(flag & GP_STROKE_3DSPACE)) {
gp_calc_2d_stroke_fxy(fpt, flag, offsx, offsy, winx, winy, co);
copy_v2_v2(fpt, co);
fpt[2] = 0.0f; /* 2d always is z=0.0f */

View File

@@ -780,7 +780,7 @@ void ui_draw_preview_item(struct uiFontStyle *fstyle, rcti *rect, const char *na
#define UI_POPUP_MENU_TOP (int)(8 * UI_DPI_FAC)
#define UI_PIXEL_AA_JITTER 8
const float ui_pixel_jitter[UI_PIXEL_AA_JITTER][2];
extern const float ui_pixel_jitter[UI_PIXEL_AA_JITTER][2];
/* interface_style.c */
void uiStyleInit(void);

View File

@@ -1083,7 +1083,7 @@ static void widgetbase_set_uniform_colors_ubv(
#define MAX_WIDGET_BASE_BATCH 6
#define MAX_WIDGET_PARAMETERS 11
struct {
static struct {
GPUBatch *batch; /* Batch type */
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH];
int count;

View File

@@ -365,11 +365,11 @@ void MESH_OT_extrude_repeat(wmOperatorType *ot)
#ifdef USE_GIZMO
const float extrude_button_scale = 0.15f;
const float extrude_button_offset_scale = 1.5f;
const float extrude_arrow_scale = 1.0f;
const float extrude_arrow_xyz_axis_scale = 1.0f;
const float extrude_arrow_normal_axis_scale = 1.75f;
static const float extrude_button_scale = 0.15f;
static const float extrude_button_offset_scale = 1.5f;
static const float extrude_arrow_scale = 1.0f;
static const float extrude_arrow_xyz_axis_scale = 1.0f;
static const float extrude_arrow_normal_axis_scale = 1.75f;
static const uchar shape_plus[] = {
0x5f, 0xfb, 0x40, 0xee, 0x25, 0xda, 0x11, 0xbf, 0x4, 0xa0, 0x0, 0x80, 0x4, 0x5f, 0x11,

View File

@@ -3422,7 +3422,7 @@ bool node_link_bezier_points(View2D *v2d, SpaceNode *snode, bNodeLink *link, flo
static float arrow_verts[3][2] = {{-1.0f, 1.0f}, {0.0f, 0.0f}, {-1.0f, -1.0f}};
static float arrow_expand_axis[3][2] = {{0.7071f, 0.7071f}, {M_SQRT2, 0.0f}, {0.7071f, -0.7071f}};
struct {
static struct {
GPUBatch *batch; /* for batching line together */
GPUBatch *batch_single; /* for single line */
GPUVertBuf *inst_vbo;

View File

@@ -131,7 +131,7 @@ struct NavigateGizmoInfo {
#define SHAPE_VARS(shape_id) shape = shape_id, .shape_size = ARRAY_SIZE(shape_id)
struct NavigateGizmoInfo g_navigate_params[MPR_TOTAL] = {
static struct NavigateGizmoInfo g_navigate_params[MPR_TOTAL] = {
{
.opname = "VIEW3D_OT_move",
.gizmo = "GIZMO_GT_button_2d",

View File

@@ -107,7 +107,7 @@
#define MAN_SCALE_C (MAN_SCALE_X | MAN_SCALE_Y | MAN_SCALE_Z)
/* threshold for testing view aligned gizmo axis */
struct {
static struct {
float min, max;
} g_tw_axis_range[2] = {
/* Regular range */

View File

@@ -34,6 +34,7 @@
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_enum_types.h"
#include "rna_internal.h" /* own include */

View File

@@ -77,7 +77,7 @@ const EnumPropertyItem rna_enum_rigidbody_constraint_type_items[] = {
{0, NULL, 0, NULL, NULL}};
/* bullet spring type */
const EnumPropertyItem rna_enum_rigidbody_constraint_spring_type_items[] = {
static const EnumPropertyItem rna_enum_rigidbody_constraint_spring_type_items[] = {
{RBC_SPRING_TYPE1, "SPRING1", ICON_NONE, "Blender 2.7", "Spring implementation used in blender 2.7. Damping is capped at 1.0"},
{RBC_SPRING_TYPE2, "SPRING2", ICON_NONE, "Blender 2.8", "New implementation available since 2.8"},
{0, NULL, 0, NULL, NULL}};

View File

@@ -76,12 +76,12 @@ const EnumPropertyItem rna_enum_gpencil_sculpt_brush_items[] = {
{ 0, NULL, 0, NULL, NULL }
};
EnumPropertyItem rna_enum_gpencil_weight_brush_items[] = {
#ifndef RNA_RUNTIME
static EnumPropertyItem rna_enum_gpencil_weight_brush_items[] = {
{ GP_EDITBRUSH_TYPE_WEIGHT, "WEIGHT", ICON_GPBRUSH_WEIGHT, "Weight", "Weight Paint for Vertex Groups" },
{ 0, NULL, 0, NULL, NULL }
};
#ifndef RNA_RUNTIME
static const EnumPropertyItem rna_enum_gpencil_lockaxis_items[] = {
{ GP_LOCKAXIS_NONE, "GP_LOCKAXIS_NONE", ICON_UNLOCKED, "None", "" },
{ GP_LOCKAXIS_X, "GP_LOCKAXIS_X", ICON_NDOF_DOM, "X", "Project strokes to plane locked to X" },

View File

@@ -60,7 +60,7 @@ const EnumPropertyItem rna_enum_object_shaderfx_type_items[] = {
{0, NULL, 0, NULL, NULL}
};
const EnumPropertyItem rna_enum_shaderfx_rim_modes_items[] = {
static const EnumPropertyItem rna_enum_shaderfx_rim_modes_items[] = {
{eShaderFxRimMode_Normal, "NORMAL", 0, "Normal", "" },
{eShaderFxRimMode_Overlay, "OVERLAY", 0, "Overlay", "" },
{eShaderFxRimMode_Add, "ADD", 0, "Add", "" },
@@ -70,7 +70,7 @@ const EnumPropertyItem rna_enum_shaderfx_rim_modes_items[] = {
{0, NULL, 0, NULL, NULL }
};
const EnumPropertyItem rna_enum_shaderfx_colorize_modes_items[] = {
static const EnumPropertyItem rna_enum_shaderfx_colorize_modes_items[] = {
{eShaderFxColorizeMode_GrayScale, "GRAYSCALE", 0, "Gray Scale", "" },
{eShaderFxColorizeMode_Sepia, "SEPIA", 0, "Sepia", "" },
{eShaderFxColorizeMode_BiTone, "BITONE", 0, "Bi-Tone", "" },

View File

@@ -244,7 +244,7 @@ const EnumPropertyItem rna_enum_shading_type_items[] = {
{0, NULL, 0, NULL, NULL}
};
const EnumPropertyItem rna_enum_viewport_lighting_items[] = {
static const EnumPropertyItem rna_enum_viewport_lighting_items[] = {
{V3D_LIGHTING_FLAT, "FLAT", 0, "Flat", "Display using flat lighting"},
{V3D_LIGHTING_STUDIO, "STUDIO", 0, "Studio", "Display using studio lighting"},
{V3D_LIGHTING_MATCAP, "MATCAP", 0, "MatCap", "Display using matcap material and lighting"},

View File

@@ -296,8 +296,6 @@ static int gizmo_select_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
BLI_assert(0);
return (OPERATOR_CANCELLED | OPERATOR_PASS_THROUGH);
}
return OPERATOR_PASS_THROUGH;
}
void GIZMOGROUP_OT_gizmo_select(wmOperatorType *ot)