Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-05-31 16:21:16 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-05-31 16:22:52 +0300
commitaba4e6810f8b4d0e459137b64e061a2cadc457d1 (patch)
tree2b6159c7ba0f23c020600b71276772fa4a882b5b /source/blender/freestyle/intern/stroke
parent72a563cdee8fef198a200ff65b57ddb847c01795 (diff)
Cleanup: style, use braces in source/ (include disabled blocks)
Diffstat (limited to 'source/blender/freestyle/intern/stroke')
-rw-r--r--source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp2
-rw-r--r--source/blender/freestyle/intern/stroke/Curve.cpp84
-rw-r--r--source/blender/freestyle/intern/stroke/Operators.cpp18
-rw-r--r--source/blender/freestyle/intern/stroke/Stroke.cpp21
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeRep.cpp50
5 files changed, 116 insertions, 59 deletions
diff --git a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
index befcaf7dc1d..843395c136c 100644
--- a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
+++ b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
@@ -544,7 +544,7 @@ class CurvePiece {
int ns1 = ns / 2;
int ns2 = ns - ns1;
for (int i = 0; i < ns1; ++it, ++i) {
- ;
+ /* pass */
}
CurvePiece *second = new CurvePiece(it, _last, ns2 + 1);
diff --git a/source/blender/freestyle/intern/stroke/Curve.cpp b/source/blender/freestyle/intern/stroke/Curve.cpp
index e1970c7196c..a5d87632ad3 100644
--- a/source/blender/freestyle/intern/stroke/Curve.cpp
+++ b/source/blender/freestyle/intern/stroke/Curve.cpp
@@ -311,15 +311,17 @@ Vec3r CurvePoint::normal() const
#if 0
Material CurvePoint::material() const
{
- if (__A == 0)
+ if (__A == 0) {
return __B->material();
+ }
return __A->material();
}
Id CurvePoint::shape_id() const
{
- if (__A == 0)
+ if (__A == 0) {
return __B->shape_id();
+ }
return __A->shape_id();
}
#endif
@@ -335,17 +337,20 @@ const SShape *CurvePoint::shape() const
#if 0
float CurvePoint::shape_importance() const
{
- if (__A == 0)
+ if (__A == 0) {
return __B->shape_importance();
+ }
return __A->shape_importance();
}
const unsigned CurvePoint::qi() const
{
- if (__A == 0)
+ if (__A == 0) {
return __B->qi();
- if (__B == 0)
+ }
+ if (__B == 0) {
return __A->qi();
+ }
return __A->getFEdge(*__B)->qi();
}
#endif
@@ -463,19 +468,23 @@ Vec3r shaded_color() const;
Vec3r CurvePoint::orientation2d() const
{
- if (__A == 0)
+ if (__A == 0) {
return __B->orientation2d();
- if (__B == 0)
+ }
+ if (__B == 0) {
return __A->orientation2d();
+ }
return __B->point2d() - __A->point2d();
}
Vec3r CurvePoint::orientation3d() const
{
- if (__A == 0)
+ if (__A == 0) {
return __B->orientation3d();
- if (__B == 0)
+ }
+ if (__B == 0) {
return __A->orientation3d();
+ }
return __B->point3d() - __A->point3d();
}
@@ -491,10 +500,12 @@ Vec3r CurvePoint::curvature2d_as_vector() const
Vec3r edgeB = (_FEdges[1])->orientation2d().normalize();
return edgeA + edgeB;
# endif
- if (__A == 0)
+ if (__A == 0) {
return __B->curvature2d_as_vector();
- if (__B == 0)
+ }
+ if (__B == 0) {
return __A->curvature2d_as_vector();
+ }
return ((1 - _t2d) * __A->curvature2d_as_vector() + _t2d * __B->curvature2d_as_vector());
}
@@ -509,28 +520,34 @@ real CurvePoint::curvature2d_as_angle() const
N2.normalize();
return acos((N1 * N2));
# endif
- if (__A == 0)
+ if (__A == 0) {
return __B->curvature2d_as_angle();
- if (__B == 0)
+ }
+ if (__B == 0) {
return __A->curvature2d_as_angle();
+ }
return ((1 - _t2d) * __A->curvature2d_as_angle() + _t2d * __B->curvature2d_as_angle());
}
real CurvePoint::curvatureFredo() const
{
- if (__A == 0)
+ if (__A == 0) {
return __B->curvatureFredo();
- if (__B == 0)
+ }
+ if (__B == 0) {
return __A->curvatureFredo();
+ }
return ((1 - _t2d) * __A->curvatureFredo() + _t2d * __B->curvatureFredo());
}
Vec2d CurvePoint::directionFredo() const
{
- if (__A == 0)
+ if (__A == 0) {
return __B->directionFredo();
- if (__B == 0)
+ }
+ if (__B == 0) {
return __A->directionFredo();
+ }
return ((1 - _t2d) * __A->directionFredo() + _t2d * __B->directionFredo());
}
#endif
@@ -745,8 +762,9 @@ Material Curve::material() const
const_vertex_iterator v = vertices_begin(), vend = vertices_end();
const Material &mat = (*v)->material();
for (; v != vend; ++v) {
- if ((*v)->material() != mat)
+ if ((*v)->material() != mat) {
Exception::raiseException();
+ }
}
return mat;
}
@@ -756,8 +774,9 @@ int Curve::qi() const
const_vertex_iterator v = vertices_begin(), vend = vertices_end();
int qi_ = (*v)->qi();
for (; v != vend; ++v) {
- if ((*v)->qi() != qi_)
+ if ((*v)->qi() != qi_) {
Exception::raiseException();
+ }
}
return qi_;
}
@@ -782,8 +801,9 @@ bool Curve::occluders_empty() const
const_vertex_iterator v = vertices_begin(), vend = vertices_end();
bool empty = (*v)->occluders_empty();
for (; v != vend; ++v) {
- if ((*v)->occluders_empty() != empty)
+ if ((*v)->occluders_empty() != empty) {
Exception::raiseException();
+ }
}
return empty;
}
@@ -798,8 +818,9 @@ const SShape *Curve::occluded_shape() const
const_vertex_iterator v = vertices_begin(), vend = vertices_end();
const SShape *sshape = (*v)->occluded_shape();
for (; v != vend; ++v) {
- if ((*v)->occluded_shape() != sshape)
+ if ((*v)->occluded_shape() != sshape) {
Exception::raiseException();
+ }
}
return sshape;
}
@@ -809,8 +830,9 @@ const bool Curve::occludee_empty() const
const_vertex_iterator v = vertices_begin(), vend = vertices_end();
bool empty = (*v)->occludee_empty();
for (; v != vend; ++v) {
- if ((*v)->occludee_empty() != empty)
+ if ((*v)->occludee_empty() != empty) {
Exception::raiseException();
+ }
}
return empty;
}
@@ -824,8 +846,9 @@ int Curve::shape_id() const
const_vertex_iterator v = vertices_begin(), vend = vertices_end();
Id id = (*v)->shape_id();
for (; v != vend; ++v) {
- if ((*v)->shape_id() != id)
+ if ((*v)->shape_id() != id) {
Exception::raiseException();
+ }
}
return id.first;
}
@@ -835,8 +858,9 @@ const SShape *Curve::shape() const
const_vertex_iterator v = vertices_begin(), vend = vertices_end();
const SShape *sshape = (*v)->shape();
for (; v != vend; ++v) {
- if ((*v)->shape() != sshape)
+ if ((*v)->shape() != sshape) {
Exception::raiseException();
+ }
}
return sshape;
}
@@ -915,8 +939,9 @@ void Curve::computeCurvatureAndOrientation()
for (; v ! = vend; ++v) {
v2 = v;
++v2;
- if (v2 == vend)
+ if (v2 == vend) {
break;
+ }
Vec3r p2 = (*v2)->point2d();
Vec2d BA = p0 - p1;
@@ -930,10 +955,12 @@ void Curve::computeCurvatureAndOrientation()
normal.normalizeSafe();
real curvature = normalCurvature * normal;
- if (lba + lbc > MY_EPSILON)
+ if (lba + lbc > MY_EPSILON) {
curvature /= (0.5 * lba + lbc);
- if (dir.norm() < MY_EPSILON)
+ }
+ if (dir.norm() < MY_EPSILON) {
dir = 0.1 * prevDir;
+ }
(*v)->setCurvatureFredo(curvature);
(*v)->setDirectionFredo(dir);
@@ -975,8 +1002,9 @@ void Curve::computeCurvatureAndOrientation()
for (; v != vend; ++v) {
v2 = v;
++v2;
- if (v2 == vend)
+ if (v2 == vend) {
break;
+ }
Vec3r p2 = (*v2)->point2d();
Vec2d BA = p0 - p1;
diff --git a/source/blender/freestyle/intern/stroke/Operators.cpp b/source/blender/freestyle/intern/stroke/Operators.cpp
index 329b5440fed..84d2d3315f1 100644
--- a/source/blender/freestyle/intern/stroke/Operators.cpp
+++ b/source/blender/freestyle/intern/stroke/Operators.cpp
@@ -226,8 +226,9 @@ void Operators::bidirectionalChain(ViewEdgeIterator &it,
UnaryPredicate1D &pred,
UnaryFunction1D_void &modifier)
{
- if (_current_view_edges_set.empty())
+ if (_current_view_edges_set.empty()) {
return;
+ }
unsigned id = 0;
ViewEdge *edge;
@@ -236,8 +237,9 @@ void Operators::bidirectionalChain(ViewEdgeIterator &it,
for (I1DContainer::iterator it_edge = _current_view_edges_set.begin();
it_edge != _current_view_edges_set.end();
++it_edge) {
- if (pred(**it_edge))
+ if (pred(**it_edge)) {
continue;
+ }
edge = dynamic_cast<ViewEdge *>(*it_edge);
it.setBegin(edge);
@@ -266,14 +268,16 @@ void Operators::bidirectionalChain(ViewEdgeIterator &it,
_current_chains_set.push_back(new_chain);
}
- if (!_current_chains_set.empty())
+ if (!_current_chains_set.empty()) {
_current_set = &_current_chains_set;
+ }
}
void Operators::bidirectionalChain(ViewEdgeIterator &it, UnaryPredicate1D &pred)
{
- if (_current_view_edges_set.empty())
+ if (_current_view_edges_set.empty()) {
return;
+ }
unsigned id = 0;
Functions1D::IncrementChainingTimeStampF1D ts;
@@ -285,8 +289,9 @@ void Operators::bidirectionalChain(ViewEdgeIterator &it, UnaryPredicate1D &pred)
for (I1DContainer::iterator it_edge = _current_view_edges_set.begin();
it_edge != _current_view_edges_set.end();
++it_edge) {
- if (pred(**it_edge) || pred_ts(**it_edge))
+ if (pred(**it_edge) || pred_ts(**it_edge)) {
continue;
+ }
edge = dynamic_cast<ViewEdge *>(*it_edge);
it.setBegin(edge);
@@ -315,8 +320,9 @@ void Operators::bidirectionalChain(ViewEdgeIterator &it, UnaryPredicate1D &pred)
_current_chains_set.push_back(new_chain);
}
- if (!_current_chains_set.empty())
+ if (!_current_chains_set.empty()) {
_current_set = &_current_chains_set;
+ }
}
#endif
diff --git a/source/blender/freestyle/intern/stroke/Stroke.cpp b/source/blender/freestyle/intern/stroke/Stroke.cpp
index 13f8080552b..d18de1a7073 100644
--- a/source/blender/freestyle/intern/stroke/Stroke.cpp
+++ b/source/blender/freestyle/intern/stroke/Stroke.cpp
@@ -869,8 +869,9 @@ Stroke::const_vertex_iterator Stroke::vertices_last() const
Stroke::vertex_container::reverse_iterator Stroke::vertices_last(float sampling)
{
// Resample if necessary
- if (sampling < _sampling)
+ if (sampling < _sampling) {
Resample(sampling);
+ }
return _Vertices.rbegin();
}
@@ -901,8 +902,9 @@ Material Stroke::material() const
const_vertex_iterator v = vertices_begin(), vend = strokeVerticesEnd();
Material mat = (*v)->material();
for (; v != vend; ++v) {
- if (mat != (*v)->material())
+ if (mat != (*v)->material()) {
Exception::raiseException();
+ }
}
return mat;
}
@@ -912,8 +914,9 @@ int Stroke::qi() const
const_vertex_iterator v = vertices_begin(), vend = vertices_end();
int qi_ = (*v)->qi();
for (; v != vend; ++v) {
- if ((*v)->qi() != qi_)
+ if ((*v)->qi() != qi_) {
Exception::raiseException();
+ }
}
return qi_;
}
@@ -938,8 +941,9 @@ bool Stroke::occluders_empty() const
const_vertex_iterator v = vertices_begin(), vend = vertices_end();
bool empty = (*v)->occluders_empty();
for (; v != vend; ++v) {
- if ((*v)->occluders_empty() != empty)
+ if ((*v)->occluders_empty() != empty) {
Exception::raiseException();
+ }
}
return empty;
}
@@ -956,8 +960,9 @@ const SShape *Stroke::occluded_shape() const
const_vertex_iterator v = vertices_begin(), vend = vertices_end();
const SShape *sshape = (*v)->occluded_shape();
for (; v != vend; ++v) {
- if ((*v)->occluded_shape() != sshape)
+ if ((*v)->occluded_shape() != sshape) {
Exception::raiseException();
+ }
}
return sshape;
}
@@ -967,8 +972,9 @@ const bool Stroke::occludee_empty() const
const_vertex_iterator v = vertices_begin(), vend = vertices_end();
bool empty = (*v)->occludee_empty();
for (; v != vend; ++v) {
- if ((*v)->occludee_empty() != empty)
+ if ((*v)->occludee_empty() != empty) {
Exception::raiseException();
+ }
}
return empty;
}
@@ -978,8 +984,9 @@ const SShape *Stroke::shape() const
const_vertex_iterator v = vertices_begin(), vend = vertices_end();
const SShape *sshape = (*v)->shape();
for (; v != vend; ++v) {
- if ((*v)->shape() != sshape)
+ if ((*v)->shape() != sshape) {
Exception::raiseException();
+ }
}
return sshape;
}
diff --git a/source/blender/freestyle/intern/stroke/StrokeRep.cpp b/source/blender/freestyle/intern/stroke/StrokeRep.cpp
index 3b309a9d249..aaf8a4b7ef5 100644
--- a/source/blender/freestyle/intern/stroke/StrokeRep.cpp
+++ b/source/blender/freestyle/intern/stroke/StrokeRep.cpp
@@ -174,17 +174,21 @@ void Strip::createStrip(const vector<StrokeVertex *> &iStrokeVertices)
real orientation = o1 * o2;
if (orientation > 0) {
// then the vertex to move is v0
- if (o1 > 0)
+ if (o1 > 0) {
_vertex[0] = _vertex[1] + userDir;
- else
+ }
+ else {
_vertex[0] = _vertex[1] - userDir;
+ }
}
if (orientation < 0) {
// then we must move v1
- if (o1 < 0)
+ if (o1 < 0) {
_vertex[1] = _vertex[0] + userDir;
- else
+ }
+ else {
_vertex[1] = _vertex[0] - userDir;
+ }
}
}
#endif
@@ -336,17 +340,21 @@ void Strip::createStrip(const vector<StrokeVertex *> &iStrokeVertices)
real orientation = o1 * o2;
if (orientation > 0) {
// then the vertex to move is vn
- if (o1 < 0)
+ if (o1 < 0) {
_vertex[n] = _vertex[n - 1] + userDir;
- else
+ }
+ else {
_vertex[n] = _vertex[n - 1] - userDir;
+ }
}
if (orientation < 0) {
// then we must move vn-1
- if (o1 > 0)
+ if (o1 > 0) {
_vertex[n - 1] = _vertex[n] + userDir;
- else
+ }
+ else {
_vertex[n - 1] = _vertex[n] - userDir;
+ }
}
}
#endif
@@ -715,18 +723,22 @@ void Strip::computeTexCoordWithTips(const vector<StrokeVertex *> &iStrokeVertice
#if 0
cerr << "u=" << u << " i=" << i << "/" << _sizeStrip << endl;
- for (i = 0; i < _sizeStrip; i++)
+ for (i = 0; i < _sizeStrip; i++) {
_alpha[i] = 1.0;
+ }
- for (i = 0; i < _sizeStrip; i++)
+ for (i = 0; i < _sizeStrip; i++) {
cerr << "(" << _texCoord[i][0] << ", " << _texCoord[i][1] << ") ";
+ }
cerr << endl;
Vec2r vec_tmp;
- for (i = 0; i < _sizeStrip / 2; i++)
+ for (i = 0; i < _sizeStrip / 2; i++) {
vec_tmp = _vertex[2 * i] - _vertex[2 * i + 1];
- if (vec_tmp.norm() > 4 * _averageThickness)
+ }
+ if (vec_tmp.norm() > 4 * _averageThickness) {
cerr << "Warning (from Fredo): There is a pb in the texture coordinates computation" << endl;
+ }
#endif
}
@@ -750,10 +762,12 @@ StrokeRep::StrokeRep()
}
#if 0
_averageTextureAlpha = 0.5; //default value
- if (_strokeType == OIL_STROKE)
+ if (_strokeType == OIL_STROKE) {
_averageTextureAlpha = 0.75;
- if (_strokeType >= NO_BLEND_STROKE)
- _averageTextureAlpha = 1.0
+ }
+ if (_strokeType >= NO_BLEND_STROKE) {
+ _averageTextureAlpha = 1.0;
+ }
#endif
}
@@ -782,10 +796,12 @@ StrokeRep::StrokeRep(Stroke *iStroke)
#if 0
_averageTextureAlpha = 0.5; //default value
- if (_strokeType == OIL_STROKE)
+ if (_strokeType == OIL_STROKE) {
_averageTextureAlpha = 0.75;
- if (_strokeType >= NO_BLEND_STROKE)
+ }
+ if (_strokeType >= NO_BLEND_STROKE) {
_averageTextureAlpha = 1.0;
+ }
#endif
create();
}