Cleanup: indentation, style

This commit is contained in:
2018-08-24 10:26:59 +10:00
parent 1c63a3a100
commit 0cf12dfc14
11 changed files with 165 additions and 91 deletions

View File

@@ -962,15 +962,15 @@ static void curvemapping_evaluateRGBF_filmlike(const CurveMapping *cumap, float
* \param black Use instead of cumap->black * \param black Use instead of cumap->black
* \param bwmul Use instead of cumap->bwmul * \param bwmul Use instead of cumap->bwmul
*/ */
void curvemapping_evaluate_premulRGBF_ex(const CurveMapping *cumap, float vecout[3], const float vecin[3], void curvemapping_evaluate_premulRGBF_ex(
const CurveMapping *cumap, float vecout[3], const float vecin[3],
const float black[3], const float bwmul[3]) const float black[3], const float bwmul[3])
{ {
const float r = (vecin[0] - black[0]) * bwmul[0]; const float r = (vecin[0] - black[0]) * bwmul[0];
const float g = (vecin[1] - black[1]) * bwmul[1]; const float g = (vecin[1] - black[1]) * bwmul[1];
const float b = (vecin[2] - black[2]) * bwmul[2]; const float b = (vecin[2] - black[2]) * bwmul[2];
switch (cumap->tone) switch (cumap->tone) {
{
default: default:
case CURVE_TONE_STANDARD: case CURVE_TONE_STANDARD:
{ {

View File

@@ -363,7 +363,8 @@ static Subdiv *multires_subdiv_for_reshape(struct Depsgraph *depsgraph,
return subdiv; return subdiv;
} }
static bool multires_reshape_from_vertcos(struct Depsgraph *depsgraph, static bool multires_reshape_from_vertcos(
struct Depsgraph *depsgraph,
Object *object, Object *object,
const MultiresModifierData *mmd, const MultiresModifierData *mmd,
const float (*deformed_verts)[3], const float (*deformed_verts)[3],
@@ -476,7 +477,8 @@ bool multiresModifier_reshapeFromDeformModifier(
Scene *scene_eval = DEG_get_evaluated_scene(depsgraph); Scene *scene_eval = DEG_get_evaluated_scene(depsgraph);
/* Perform sanity checks and early output. */ /* Perform sanity checks and early output. */
if (multires_get_level( if (multires_get_level(
scene_eval, object, &highest_mmd, false, true) == 0) { scene_eval, object, &highest_mmd, false, true) == 0)
{
return false; return false;
} }
/* Create mesh for the multires, ignoring any further modifiers (leading /* Create mesh for the multires, ignoring any further modifiers (leading

View File

@@ -746,8 +746,7 @@ static void subdiv_foreach_inner_vertices_special(
const int coarse_poly_index = coarse_poly - coarse_mesh->mpoly; const int coarse_poly_index = coarse_poly - coarse_mesh->mpoly;
int ptex_face_index = ctx->face_ptex_offset[coarse_poly_index]; int ptex_face_index = ctx->face_ptex_offset[coarse_poly_index];
const int start_vertex_index = ctx->subdiv_vertex_offset[coarse_poly_index]; const int start_vertex_index = ctx->subdiv_vertex_offset[coarse_poly_index];
int subdiv_vertex_index = int subdiv_vertex_index = ctx->vertices_inner_offset + start_vertex_index;
ctx->vertices_inner_offset + start_vertex_index;
ctx->foreach_context->vertex_inner( ctx->foreach_context->vertex_inner(
ctx->foreach_context, ctx->foreach_context,
tls, tls,
@@ -1135,9 +1134,9 @@ static void subdiv_foreach_edges_all_patches_special(
const bool flip = (coarse_edge->v2 == coarse_loop->v); const bool flip = (coarse_edge->v2 == coarse_loop->v);
int side_start_index = int side_start_index =
start_vertex_index + num_inner_vertices_per_ptex * corner; start_vertex_index + num_inner_vertices_per_ptex * corner;
for (int i = 0; i < ptex_face_resolution - 2; for (int i = 0;
i++, i < ptex_face_resolution - 2;
subdiv_edge_index++) i++, subdiv_edge_index++)
{ {
const int v1 = (flip) const int v1 = (flip)
? (start_edge_vertex + (resolution - i - 3)) ? (start_edge_vertex + (resolution - i - 3))

View File

@@ -685,7 +685,8 @@ static void subdiv_mesh_ensure_vertex_interpolation(
} }
/* Update it for a new corner if needed. */ /* Update it for a new corner if needed. */
if (!tls->vertex_interpolation_initialized || if (!tls->vertex_interpolation_initialized ||
tls->vertex_interpolation_coarse_corner != coarse_corner) { tls->vertex_interpolation_coarse_corner != coarse_corner)
{
vertex_interpolation_from_corner( vertex_interpolation_from_corner(
ctx, &tls->vertex_interpolation, coarse_poly, coarse_corner); ctx, &tls->vertex_interpolation, coarse_poly, coarse_corner);
} }
@@ -861,7 +862,8 @@ static void subdiv_mesh_ensure_loop_interpolation(
} }
/* Update it for a new corner if needed. */ /* Update it for a new corner if needed. */
if (!tls->loop_interpolation_initialized || if (!tls->loop_interpolation_initialized ||
tls->loop_interpolation_coarse_corner != coarse_corner) { tls->loop_interpolation_coarse_corner != coarse_corner)
{
loop_interpolation_from_corner( loop_interpolation_from_corner(
ctx, &tls->loop_interpolation, coarse_poly, coarse_corner); ctx, &tls->loop_interpolation, coarse_poly, coarse_corner);
} }

View File

@@ -228,6 +228,7 @@ TIMEIT_END(filter_pose_update);
TIMEIT_START(pose_path_calc); TIMEIT_START(pose_path_calc);
animviz_calc_motionpaths(depsgraph, bmain, scene, &targets); animviz_calc_motionpaths(depsgraph, bmain, scene, &targets);
TIMEIT_END(pose_path_calc); TIMEIT_END(pose_path_calc);
BLI_freelistN(&targets); BLI_freelistN(&targets);
/* tag armature object for copy on write - so paths will draw/redraw */ /* tag armature object for copy on write - so paths will draw/redraw */

View File

@@ -253,7 +253,8 @@ static void noise_vector(float x, float y, float z, int nb, float v[3])
} }
/* Returns a turbulence value for a given position (x, y, z) */ /* Returns a turbulence value for a given position (x, y, z) */
static float turb(float x, float y, float z, int oct, int hard, int nb, static float turb(
float x, float y, float z, int oct, int hard, int nb,
float ampscale, float freqscale) float ampscale, float freqscale)
{ {
float amp, out, t; float amp, out, t;
@@ -277,7 +278,8 @@ static float turb(float x, float y, float z, int oct, int hard, int nb,
/* Fills an array of length 3 with the turbulence vector for a given /* Fills an array of length 3 with the turbulence vector for a given
* position (x, y, z) */ * position (x, y, z) */
static void vTurb(float x, float y, float z, int oct, int hard, int nb, static void vTurb(
float x, float y, float z, int oct, int hard, int nb,
float ampscale, float freqscale, float v[3]) float ampscale, float freqscale, float v[3])
{ {
float amp, t[3]; float amp, t[3];
@@ -345,8 +347,12 @@ static PyObject *M_Noise_random_unit_vector(PyObject *UNUSED(self), PyObject *ar
float norm = 2.0f; float norm = 2.0f;
int size = 3; int size = 3;
if (!PyArg_ParseTupleAndKeywords(args, kw, "|$i:random_unit_vector", (char **)kwlist, &size)) if (!PyArg_ParseTupleAndKeywords(
args, kw, "|$i:random_unit_vector", (char **)kwlist,
&size))
{
return NULL; return NULL;
}
if (size > 4 || size < 2) { if (size > 4 || size < 2) {
PyErr_SetString(PyExc_ValueError, "Vector(): invalid size"); PyErr_SetString(PyExc_ValueError, "Vector(): invalid size");
@@ -377,8 +383,12 @@ static PyObject *M_Noise_random_vector(PyObject *UNUSED(self), PyObject *args, P
float *vec = NULL; float *vec = NULL;
int size = 3; int size = 3;
if (!PyArg_ParseTupleAndKeywords(args, kw, "|$i:random_vector", (char **)kwlist, &size)) if (!PyArg_ParseTupleAndKeywords(
args, kw, "|$i:random_vector", (char **)kwlist,
&size))
{
return NULL; return NULL;
}
if (size < 2) { if (size < 2) {
PyErr_SetString(PyExc_ValueError, "Vector(): invalid size"); PyErr_SetString(PyExc_ValueError, "Vector(): invalid size");
@@ -429,13 +439,19 @@ static PyObject *M_Noise_noise(PyObject *UNUSED(self), PyObject *args, PyObject
const char *noise_basis_str = NULL; const char *noise_basis_str = NULL;
int noise_basis_enum = DEFAULT_NOISE_TYPE; int noise_basis_enum = DEFAULT_NOISE_TYPE;
if (!PyArg_ParseTupleAndKeywords(args, kw, "O|$s:noise", (char **)kwlist, &value, &noise_basis_str)) if (!PyArg_ParseTupleAndKeywords(
args, kw, "O|$s:noise", (char **)kwlist,
&value, &noise_basis_str))
{
return NULL; return NULL;
}
if (!noise_basis_str) { if (!noise_basis_str) {
/* pass through */ /* pass through */
} }
else if (PyC_FlagSet_ValueFromID(bpy_noise_types, noise_basis_str, &noise_basis_enum, "noise") == -1) { else if (PyC_FlagSet_ValueFromID(
bpy_noise_types, noise_basis_str, &noise_basis_enum, "noise") == -1)
{
return NULL; return NULL;
} }
@@ -464,13 +480,19 @@ static PyObject *M_Noise_noise_vector(PyObject *UNUSED(self), PyObject *args, Py
const char *noise_basis_str = NULL; const char *noise_basis_str = NULL;
int noise_basis_enum = DEFAULT_NOISE_TYPE; int noise_basis_enum = DEFAULT_NOISE_TYPE;
if (!PyArg_ParseTupleAndKeywords(args, kw, "O|$s:noise_vector", (char **)kwlist, &value, &noise_basis_str)) if (!PyArg_ParseTupleAndKeywords(
args, kw, "O|$s:noise_vector", (char **)kwlist,
&value, &noise_basis_str))
{
return NULL; return NULL;
}
if (!noise_basis_str) { if (!noise_basis_str) {
/* pass through */ /* pass through */
} }
else if (PyC_FlagSet_ValueFromID(bpy_noise_types, noise_basis_str, &noise_basis_enum, "noise_vector") == -1) { else if (PyC_FlagSet_ValueFromID(
bpy_noise_types, noise_basis_str, &noise_basis_enum, "noise_vector") == -1)
{
return NULL; return NULL;
} }
@@ -510,14 +532,19 @@ static PyObject *M_Noise_turbulence(PyObject *UNUSED(self), PyObject *args, PyOb
int oct, hd, noise_basis_enum = DEFAULT_NOISE_TYPE; int oct, hd, noise_basis_enum = DEFAULT_NOISE_TYPE;
float as = 0.5f, fs = 2.0f; float as = 0.5f, fs = 2.0f;
if (!PyArg_ParseTupleAndKeywords(args, kw, "Oii|$sff:turbulence", (char **)kwlist, if (!PyArg_ParseTupleAndKeywords(
args, kw, "Oii|$sff:turbulence", (char **)kwlist,
&value, &oct, &hd, &noise_basis_str, &as, &fs)) &value, &oct, &hd, &noise_basis_str, &as, &fs))
{
return NULL; return NULL;
}
if (!noise_basis_str) { if (!noise_basis_str) {
/* pass through */ /* pass through */
} }
else if (PyC_FlagSet_ValueFromID(bpy_noise_types, noise_basis_str, &noise_basis_enum, "turbulence") == -1) { else if (PyC_FlagSet_ValueFromID(
bpy_noise_types, noise_basis_str, &noise_basis_enum, "turbulence") == -1)
{
return NULL; return NULL;
} }
@@ -555,14 +582,19 @@ static PyObject *M_Noise_turbulence_vector(PyObject *UNUSED(self), PyObject *arg
int oct, hd, noise_basis_enum = DEFAULT_NOISE_TYPE; int oct, hd, noise_basis_enum = DEFAULT_NOISE_TYPE;
float as = 0.5f, fs = 2.0f; float as = 0.5f, fs = 2.0f;
if (!PyArg_ParseTupleAndKeywords(args, kw, "Oii|$sff:turbulence_vector", (char **)kwlist, if (!PyArg_ParseTupleAndKeywords(
args, kw, "Oii|$sff:turbulence_vector", (char **)kwlist,
&value, &oct, &hd, &noise_basis_str, &as, &fs)) &value, &oct, &hd, &noise_basis_str, &as, &fs))
{
return NULL; return NULL;
}
if (!noise_basis_str) { if (!noise_basis_str) {
/* pass through */ /* pass through */
} }
else if (PyC_FlagSet_ValueFromID(bpy_noise_types, noise_basis_str, &noise_basis_enum, "turbulence_vector") == -1) { else if (PyC_FlagSet_ValueFromID(
bpy_noise_types, noise_basis_str, &noise_basis_enum, "turbulence_vector") == -1)
{
return NULL; return NULL;
} }
@@ -601,14 +633,19 @@ static PyObject *M_Noise_fractal(PyObject *UNUSED(self), PyObject *args, PyObjec
float H, lac, oct; float H, lac, oct;
int noise_basis_enum = DEFAULT_NOISE_TYPE; int noise_basis_enum = DEFAULT_NOISE_TYPE;
if (!PyArg_ParseTupleAndKeywords(args, kw, "Offf|$s:fractal", (char **)kwlist, if (!PyArg_ParseTupleAndKeywords(
args, kw, "Offf|$s:fractal", (char **)kwlist,
&value, &H, &lac, &oct, &noise_basis_str)) &value, &H, &lac, &oct, &noise_basis_str))
{
return NULL; return NULL;
}
if (!noise_basis_str) { if (!noise_basis_str) {
/* pass through */ /* pass through */
} }
else if (PyC_FlagSet_ValueFromID(bpy_noise_types, noise_basis_str, &noise_basis_enum, "fractal") == -1) { else if (PyC_FlagSet_ValueFromID(
bpy_noise_types, noise_basis_str, &noise_basis_enum, "fractal") == -1)
{
return NULL; return NULL;
} }
@@ -644,14 +681,19 @@ static PyObject *M_Noise_multi_fractal(PyObject *UNUSED(self), PyObject *args, P
float H, lac, oct; float H, lac, oct;
int noise_basis_enum = DEFAULT_NOISE_TYPE; int noise_basis_enum = DEFAULT_NOISE_TYPE;
if (!PyArg_ParseTupleAndKeywords(args, kw, "Offf|$s:multi_fractal", (char **)kwlist, if (!PyArg_ParseTupleAndKeywords(
args, kw, "Offf|$s:multi_fractal", (char **)kwlist,
&value, &H, &lac, &oct, &noise_basis_str)) &value, &H, &lac, &oct, &noise_basis_str))
{
return NULL; return NULL;
}
if (!noise_basis_str) { if (!noise_basis_str) {
/* pass through */ /* pass through */
} }
else if (PyC_FlagSet_ValueFromID(bpy_noise_types, noise_basis_str, &noise_basis_enum, "multi_fractal") == -1) { else if (PyC_FlagSet_ValueFromID(
bpy_noise_types, noise_basis_str, &noise_basis_enum, "multi_fractal") == -1)
{
return NULL; return NULL;
} }
@@ -690,21 +732,28 @@ static PyObject *M_Noise_variable_lacunarity(PyObject *UNUSED(self), PyObject *a
float d; float d;
int noise_type1_enum = DEFAULT_NOISE_TYPE, noise_type2_enum = DEFAULT_NOISE_TYPE; int noise_type1_enum = DEFAULT_NOISE_TYPE, noise_type2_enum = DEFAULT_NOISE_TYPE;
if (!PyArg_ParseTupleAndKeywords(args, kw, "Of|$ss:variable_lacunarity", (char **)kwlist, if (!PyArg_ParseTupleAndKeywords(
args, kw, "Of|$ss:variable_lacunarity", (char **)kwlist,
&value, &d, &noise_type1_str, &noise_type2_str)) &value, &d, &noise_type1_str, &noise_type2_str))
{
return NULL; return NULL;
}
if (!noise_type1_str) { if (!noise_type1_str) {
/* pass through */ /* pass through */
} }
else if (PyC_FlagSet_ValueFromID(bpy_noise_types, noise_type1_str, &noise_type1_enum, "variable_lacunarity") == -1) { else if (PyC_FlagSet_ValueFromID(
bpy_noise_types, noise_type1_str, &noise_type1_enum, "variable_lacunarity") == -1)
{
return NULL; return NULL;
} }
if (!noise_type2_str) { if (!noise_type2_str) {
/* pass through */ /* pass through */
} }
else if (PyC_FlagSet_ValueFromID(bpy_noise_types, noise_type2_str, &noise_type2_enum, "variable_lacunarity") == -1) { else if (PyC_FlagSet_ValueFromID(
bpy_noise_types, noise_type2_str, &noise_type2_enum, "variable_lacunarity") == -1)
{
return NULL; return NULL;
} }
@@ -742,14 +791,19 @@ static PyObject *M_Noise_hetero_terrain(PyObject *UNUSED(self), PyObject *args,
float H, lac, oct, ofs; float H, lac, oct, ofs;
int noise_basis_enum = DEFAULT_NOISE_TYPE; int noise_basis_enum = DEFAULT_NOISE_TYPE;
if (!PyArg_ParseTupleAndKeywords(args, kw, "Offff|$s:hetero_terrain", (char **)kwlist, if (!PyArg_ParseTupleAndKeywords(
args, kw, "Offff|$s:hetero_terrain", (char **)kwlist,
&value, &H, &lac, &oct, &ofs, &noise_basis_str)) &value, &H, &lac, &oct, &ofs, &noise_basis_str))
{
return NULL; return NULL;
}
if (!noise_basis_str) { if (!noise_basis_str) {
/* pass through */ /* pass through */
} }
else if (PyC_FlagSet_ValueFromID(bpy_noise_types, noise_basis_str, &noise_basis_enum, "hetero_terrain") == -1) { else if (PyC_FlagSet_ValueFromID(
bpy_noise_types, noise_basis_str, &noise_basis_enum, "hetero_terrain") == -1)
{
return NULL; return NULL;
} }
@@ -789,14 +843,19 @@ static PyObject *M_Noise_hybrid_multi_fractal(PyObject *UNUSED(self), PyObject *
float H, lac, oct, ofs, gn; float H, lac, oct, ofs, gn;
int noise_basis_enum = DEFAULT_NOISE_TYPE; int noise_basis_enum = DEFAULT_NOISE_TYPE;
if (!PyArg_ParseTupleAndKeywords(args, kw, "Offfff|$s:hybrid_multi_fractal", (char **)kwlist, if (!PyArg_ParseTupleAndKeywords(
args, kw, "Offfff|$s:hybrid_multi_fractal", (char **)kwlist,
&value, &H, &lac, &oct, &ofs, &gn, &noise_basis_str)) &value, &H, &lac, &oct, &ofs, &gn, &noise_basis_str))
{
return NULL; return NULL;
}
if (!noise_basis_str) { if (!noise_basis_str) {
/* pass through */ /* pass through */
} }
else if (PyC_FlagSet_ValueFromID(bpy_noise_types, noise_basis_str, &noise_basis_enum, "hybrid_multi_fractal") == -1) { else if (PyC_FlagSet_ValueFromID(
bpy_noise_types, noise_basis_str, &noise_basis_enum, "hybrid_multi_fractal") == -1)
{
return NULL; return NULL;
} }
@@ -836,14 +895,19 @@ static PyObject *M_Noise_ridged_multi_fractal(PyObject *UNUSED(self), PyObject *
float H, lac, oct, ofs, gn; float H, lac, oct, ofs, gn;
int noise_basis_enum = DEFAULT_NOISE_TYPE; int noise_basis_enum = DEFAULT_NOISE_TYPE;
if (!PyArg_ParseTupleAndKeywords(args, kw, "Offfff|$s:ridged_multi_fractal", (char **)kwlist, if (!PyArg_ParseTupleAndKeywords(
args, kw, "Offfff|$s:ridged_multi_fractal", (char **)kwlist,
&value, &H, &lac, &oct, &ofs, &gn, &noise_basis_str)) &value, &H, &lac, &oct, &ofs, &gn, &noise_basis_str))
{
return NULL; return NULL;
}
if (!noise_basis_str) { if (!noise_basis_str) {
/* pass through */ /* pass through */
} }
else if (PyC_FlagSet_ValueFromID(bpy_noise_types, noise_basis_str, &noise_basis_enum, "ridged_multi_fractal") == -1) { else if (PyC_FlagSet_ValueFromID(
bpy_noise_types, noise_basis_str, &noise_basis_enum, "ridged_multi_fractal") == -1)
{
return NULL; return NULL;
} }
@@ -880,13 +944,19 @@ static PyObject *M_Noise_voronoi(PyObject *UNUSED(self), PyObject *args, PyObjec
int i; int i;
if (!PyArg_ParseTupleAndKeywords(args, kw, "O|$sf:voronoi", (char **)kwlist, &value, &metric_str, &me)) if (!PyArg_ParseTupleAndKeywords(
args, kw, "O|$sf:voronoi", (char **)kwlist,
&value, &metric_str, &me))
{
return NULL; return NULL;
}
if (!metric_str) { if (!metric_str) {
/* pass through */ /* pass through */
} }
else if (PyC_FlagSet_ValueFromID(bpy_noise_metrics, metric_str, &metric_enum, "voronoi") == -1) { else if (PyC_FlagSet_ValueFromID(
bpy_noise_metrics, metric_str, &metric_enum, "voronoi") == -1)
{
return NULL; return NULL;
} }