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 15:51:19 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-05-31 15:55:15 +0300
commitd8dbd49a2f23b7637f05fc058f39bdf6ab706624 (patch)
tree0805b9372c82ae6505d87e879824efe1d3e32f8e /source/blender/freestyle
parent8987f7987d8160e1f6e79e8c85d6ce65b885ab25 (diff)
Cleanup: style, use braces in source/
Automated using clang-tidy.
Diffstat (limited to 'source/blender/freestyle')
-rw-r--r--source/blender/freestyle/intern/application/AppCanvas.cpp21
-rw-r--r--source/blender/freestyle/intern/application/Controller.cpp39
-rw-r--r--source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp39
-rw-r--r--source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp27
-rw-r--r--source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp105
-rw-r--r--source/blender/freestyle/intern/geometry/BBox.h18
-rw-r--r--source/blender/freestyle/intern/geometry/Bezier.cpp15
-rw-r--r--source/blender/freestyle/intern/geometry/FastGrid.cpp6
-rw-r--r--source/blender/freestyle/intern/geometry/FitCurve.cpp6
-rw-r--r--source/blender/freestyle/intern/geometry/GeomCleaner.cpp9
-rw-r--r--source/blender/freestyle/intern/geometry/GeomUtils.cpp114
-rw-r--r--source/blender/freestyle/intern/geometry/GeomUtils.h6
-rw-r--r--source/blender/freestyle/intern/geometry/Grid.cpp36
-rw-r--r--source/blender/freestyle/intern/geometry/Grid.h15
-rw-r--r--source/blender/freestyle/intern/geometry/HashGrid.h3
-rw-r--r--source/blender/freestyle/intern/geometry/Noise.cpp12
-rw-r--r--source/blender/freestyle/intern/geometry/Polygon.h12
-rw-r--r--source/blender/freestyle/intern/geometry/VecMat.h120
-rw-r--r--source/blender/freestyle/intern/image/GaussianFilter.cpp3
-rw-r--r--source/blender/freestyle/intern/image/GaussianFilter.h6
-rw-r--r--source/blender/freestyle/intern/image/Image.h6
-rw-r--r--source/blender/freestyle/intern/image/ImagePyramid.cpp12
-rw-r--r--source/blender/freestyle/intern/python/BPy_BBox.cpp9
-rw-r--r--source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp12
-rw-r--r--source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp27
-rw-r--r--source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp22
-rw-r--r--source/blender/freestyle/intern/python/BPy_Convert.cpp111
-rw-r--r--source/blender/freestyle/intern/python/BPy_Freestyle.cpp66
-rw-r--r--source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp9
-rw-r--r--source/blender/freestyle/intern/python/BPy_FrsNoise.cpp30
-rw-r--r--source/blender/freestyle/intern/python/BPy_Id.cpp6
-rw-r--r--source/blender/freestyle/intern/python/BPy_IntegrationType.cpp9
-rw-r--r--source/blender/freestyle/intern/python/BPy_Interface0D.cpp61
-rw-r--r--source/blender/freestyle/intern/python/BPy_Interface1D.cpp48
-rw-r--r--source/blender/freestyle/intern/python/BPy_Iterator.cpp42
-rw-r--r--source/blender/freestyle/intern/python/BPy_MediumType.cpp6
-rw-r--r--source/blender/freestyle/intern/python/BPy_Nature.cpp12
-rw-r--r--source/blender/freestyle/intern/python/BPy_Operators.cpp54
-rw-r--r--source/blender/freestyle/intern/python/BPy_SShape.cpp24
-rw-r--r--source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp45
-rw-r--r--source/blender/freestyle/intern/python/BPy_StrokeShader.cpp69
-rw-r--r--source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp6
-rw-r--r--source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp6
-rw-r--r--source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp21
-rw-r--r--source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp46
-rw-r--r--source/blender/freestyle/intern/python/BPy_ViewMap.cpp24
-rw-r--r--source/blender/freestyle/intern/python/BPy_ViewShape.cpp21
-rw-r--r--source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/Director.cpp69
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp15
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp21
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp6
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp9
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp12
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp21
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp27
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp12
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp28
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp51
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp6
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp21
-rw-r--r--source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp15
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp6
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp3
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp3
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp15
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp6
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp6
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp9
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp9
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp12
-rw-r--r--source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp6
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp3
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp3
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp3
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp3
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp3
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp3
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp3
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp3
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp3
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp3
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp3
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp3
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp3
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp3
-rw-r--r--source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp45
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp18
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp33
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp18
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp18
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp18
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp21
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp18
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp18
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp21
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp60
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp21
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp18
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp21
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp24
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp21
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp24
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp27
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp3
-rw-r--r--source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp3
-rw-r--r--source/blender/freestyle/intern/scene_graph/FrsMaterial.h21
-rw-r--r--source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp30
-rw-r--r--source/blender/freestyle/intern/scene_graph/LineRep.cpp18
-rw-r--r--source/blender/freestyle/intern/scene_graph/Node.h9
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeCamera.cpp6
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.cpp3
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeGroup.cpp12
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeShape.cpp6
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeShape.h3
-rw-r--r--source/blender/freestyle/intern/scene_graph/NodeTransform.cpp24
-rw-r--r--source/blender/freestyle/intern/scene_graph/OrientedLineRep.cpp6
-rw-r--r--source/blender/freestyle/intern/scene_graph/Rep.h9
-rw-r--r--source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.h9
-rw-r--r--source/blender/freestyle/intern/scene_graph/TriangleRep.cpp18
-rw-r--r--source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp9
-rw-r--r--source/blender/freestyle/intern/stroke/AdvancedPredicates1D.h3
-rw-r--r--source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp39
-rw-r--r--source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp84
-rw-r--r--source/blender/freestyle/intern/stroke/Canvas.cpp51
-rw-r--r--source/blender/freestyle/intern/stroke/Chain.cpp27
-rw-r--r--source/blender/freestyle/intern/stroke/Chain.h3
-rw-r--r--source/blender/freestyle/intern/stroke/ChainingIterators.cpp42
-rw-r--r--source/blender/freestyle/intern/stroke/ChainingIterators.h3
-rw-r--r--source/blender/freestyle/intern/stroke/Curve.cpp108
-rw-r--r--source/blender/freestyle/intern/stroke/Curve.h36
-rw-r--r--source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h42
-rw-r--r--source/blender/freestyle/intern/stroke/CurveIterators.h21
-rw-r--r--source/blender/freestyle/intern/stroke/Operators.cpp183
-rw-r--r--source/blender/freestyle/intern/stroke/PSStrokeRenderer.cpp6
-rw-r--r--source/blender/freestyle/intern/stroke/Predicates1D.h15
-rw-r--r--source/blender/freestyle/intern/stroke/Stroke.cpp117
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeIterators.h6
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeLayer.cpp3
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeRenderer.cpp6
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeRenderer.h6
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeRep.cpp96
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeRep.h3
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeTesselator.cpp6
-rw-r--r--source/blender/freestyle/intern/stroke/StyleModule.h6
-rw-r--r--source/blender/freestyle/intern/stroke/TextStrokeRenderer.cpp6
-rw-r--r--source/blender/freestyle/intern/system/BaseObject.h3
-rw-r--r--source/blender/freestyle/intern/system/PseudoNoise.cpp9
-rw-r--r--source/blender/freestyle/intern/system/StringUtils.cpp6
-rw-r--r--source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp78
-rw-r--r--source/blender/freestyle/intern/view_map/FEdgeXDetector.h6
-rw-r--r--source/blender/freestyle/intern/view_map/Functions0D.cpp75
-rw-r--r--source/blender/freestyle/intern/view_map/Functions1D.cpp18
-rw-r--r--source/blender/freestyle/intern/view_map/Interface0D.h12
-rw-r--r--source/blender/freestyle/intern/view_map/Interface1D.h6
-rw-r--r--source/blender/freestyle/intern/view_map/Silhouette.cpp45
-rw-r--r--source/blender/freestyle/intern/view_map/Silhouette.h63
-rw-r--r--source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp39
-rw-r--r--source/blender/freestyle/intern/view_map/SteerableViewMap.cpp30
-rw-r--r--source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp174
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMap.cpp78
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMap.h51
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h29
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp163
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMapIO.cpp114
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMapIterators.h30
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMapTesselator.cpp3
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMapTesselator.h3
-rw-r--r--source/blender/freestyle/intern/winged_edge/Curvature.cpp51
-rw-r--r--source/blender/freestyle/intern/winged_edge/WEdge.cpp75
-rw-r--r--source/blender/freestyle/intern/winged_edge/WEdge.h39
-rw-r--r--source/blender/freestyle/intern/winged_edge/WFillGrid.cpp6
-rw-r--r--source/blender/freestyle/intern/winged_edge/WFillGrid.h6
-rw-r--r--source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp6
-rw-r--r--source/blender/freestyle/intern/winged_edge/WSFillGrid.h6
-rw-r--r--source/blender/freestyle/intern/winged_edge/WXEdge.cpp15
-rw-r--r--source/blender/freestyle/intern/winged_edge/WXEdge.h45
-rw-r--r--source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp3
-rw-r--r--source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp39
-rw-r--r--source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h3
246 files changed, 3286 insertions, 1641 deletions
diff --git a/source/blender/freestyle/intern/application/AppCanvas.cpp b/source/blender/freestyle/intern/application/AppCanvas.cpp
index ab1da79a77f..b9f1d915e34 100644
--- a/source/blender/freestyle/intern/application/AppCanvas.cpp
+++ b/source/blender/freestyle/intern/application/AppCanvas.cpp
@@ -104,8 +104,9 @@ void AppCanvas::init()
void AppCanvas::postDraw()
{
for (unsigned int i = 0; i < _StyleModules.size(); i++) {
- if (!_StyleModules[i]->getDisplayed() || !_Layers[i])
+ if (!_StyleModules[i]->getDisplayed() || !_Layers[i]) {
continue;
+ }
_Layers[i]->ScaleThickness(thickness());
}
Canvas::postDraw();
@@ -152,12 +153,14 @@ void AppCanvas::readColorPixels(int x, int y, int w, int h, RGBImage &oImage) co
int ii, jj;
for (int j = 0; j < h; j++) {
jj = (int)((y - ymin + j) * yfac);
- if (jj < 0 || jj >= recty)
+ if (jj < 0 || jj >= recty) {
continue;
+ }
for (int i = 0; i < w; i++) {
ii = (int)((x - xmin + i) * xfac);
- if (ii < 0 || ii >= rectx)
+ if (ii < 0 || ii >= rectx) {
continue;
+ }
memcpy(
rgb + (w * j + i) * 3, _pass_diffuse.buf + (rectx * jj + ii) * 3, sizeof(float) * 3);
}
@@ -200,12 +203,14 @@ void AppCanvas::readDepthPixels(int x, int y, int w, int h, GrayImage &oImage) c
int ii, jj;
for (int j = 0; j < h; j++) {
jj = (int)((y - ymin + j) * yfac);
- if (jj < 0 || jj >= recty)
+ if (jj < 0 || jj >= recty) {
continue;
+ }
for (int i = 0; i < w; i++) {
ii = (int)((x - xmin + i) * xfac);
- if (ii < 0 || ii >= rectx)
+ if (ii < 0 || ii >= rectx) {
continue;
+ }
z[w * j + i] = _pass_z.buf[rectx * jj + ii];
}
}
@@ -215,10 +220,12 @@ void AppCanvas::readDepthPixels(int x, int y, int w, int h, GrayImage &oImage) c
void AppCanvas::RenderStroke(Stroke *iStroke)
{
- if (_basic)
+ if (_basic) {
iStroke->RenderBasic(_Renderer);
- else
+ }
+ else {
iStroke->Render(_Renderer);
+ }
}
void AppCanvas::update()
diff --git a/source/blender/freestyle/intern/application/Controller.cpp b/source/blender/freestyle/intern/application/Controller.cpp
index 4d5ffda5f38..654c0cb30c8 100644
--- a/source/blender/freestyle/intern/application/Controller.cpp
+++ b/source/blender/freestyle/intern/application/Controller.cpp
@@ -136,8 +136,9 @@ Controller::~Controller()
{
if (NULL != _RootNode) {
int ref = _RootNode->destroy();
- if (0 == ref)
+ if (0 == ref) {
delete _RootNode;
+ }
}
#if 0
@@ -184,8 +185,9 @@ Controller::~Controller()
void Controller::setView(AppView *iView)
{
- if (NULL == iView)
+ if (NULL == iView) {
return;
+ }
_pView = iView;
_Canvas->setViewer(_pView);
@@ -279,16 +281,19 @@ int Controller::LoadMesh(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph
_pView->setModel(_RootNode);
//_pView->FitBBox();
- if (_pRenderMonitor->testBreak())
+ if (_pRenderMonitor->testBreak()) {
return 0;
+ }
if (_EnableViewMapCache) {
NodeCamera *cam;
- if (g_freestyle.proj[3][3] != 0.0)
+ if (g_freestyle.proj[3][3] != 0.0) {
cam = new NodeOrthographicCamera;
- else
+ }
+ else {
cam = new NodePerspectiveCamera;
+ }
double proj[16];
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
@@ -389,8 +394,9 @@ void Controller::ClearRootNode()
_pView->DetachModel();
if (NULL != _RootNode) {
int ref = _RootNode->destroy();
- if (0 == ref)
+ if (0 == ref) {
_RootNode->addRef();
+ }
_RootNode->clearBBox();
}
}
@@ -460,8 +466,9 @@ void Controller::DeleteViewMap(bool freeCache)
void Controller::ComputeViewMap()
{
- if (!_ListOfModels.size())
+ if (!_ListOfModels.size()) {
return;
+ }
DeleteViewMap(true);
@@ -520,8 +527,9 @@ void Controller::ComputeViewMap()
}
int viewport[4];
- for (int i = 0; i < 4; i++)
+ for (int i = 0; i < 4; i++) {
viewport[i] = g_freestyle.viewport[i];
+ }
#if 0
if (G.debug & G_DEBUG_FREESTYLE) {
@@ -554,8 +562,9 @@ void Controller::ComputeViewMap()
printf("Feature lines : %lf\n", duration);
}
- if (_pRenderMonitor->testBreak())
+ if (_pRenderMonitor->testBreak()) {
return;
+ }
// Builds the view map structure from the flagged WSEdge structure:
//----------------------------------------------------------
@@ -863,8 +872,9 @@ bool Controller::getComputeSteerableViewMapFlag() const
int Controller::DrawStrokes()
{
- if (_ViewMap == 0)
+ if (_ViewMap == 0) {
return 0;
+ }
if (G.debug & G_DEBUG_FREESTYLE) {
cout << "\n=== Stroke drawing ===" << endl;
@@ -1047,15 +1057,17 @@ string Controller::getModulesDir() const
void Controller::resetInterpreter()
{
- if (_inter)
+ if (_inter) {
_inter->reset();
+ }
}
void Controller::displayDensityCurves(int x, int y)
{
SteerableViewMap *svm = _Canvas->getSteerableViewMap();
- if (!svm)
+ if (!svm) {
return;
+ }
unsigned int i, j;
typedef vector<Vec3r> densityCurve;
@@ -1065,8 +1077,9 @@ void Controller::displayDensityCurves(int x, int y)
// collect the curves values
unsigned nbCurves = svm->getNumberOfOrientations() + 1;
unsigned nbPoints = svm->getNumberOfPyramidLevels();
- if (!nbPoints)
+ if (!nbPoints) {
return;
+ }
// build the density/nbLevels curves for each orientation
for (i = 0; i < nbCurves; ++i) {
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
index e9d81ef479b..a770251c1fe 100644
--- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
+++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
@@ -156,16 +156,20 @@ int BlenderFileLoader::countClippedFaces(float v1[3], float v2[3], float v3[3],
numTris = 2; // tetragon
break;
case 2:
- if (sum == 0)
+ if (sum == 0) {
numTris = 3; // pentagon
- else
+ }
+ else {
numTris = 1; // triangle
+ }
break;
case 3:
- if (sum == 3 || sum == -3)
+ if (sum == 3 || sum == -3) {
numTris = 0;
- else
+ }
+ else {
numTris = 2; // tetragon
+ }
break;
}
return numTris;
@@ -188,8 +192,9 @@ void BlenderFileLoader::clipLine(float v1[3], float v2[3], float c[3], float z)
q = v1;
}
double d[3];
- for (int i = 0; i < 3; i++)
+ for (int i = 0; i < 3; i++) {
d[i] = q[i] - p[i];
+ }
double t = (z - p[2]) / d[2];
c[0] = p[0] + t * d[0];
c[1] = p[1] + t * d[1];
@@ -303,11 +308,13 @@ void BlenderFileLoader::addTriangle(struct LoaderState *ls,
// update the bounding box
for (j = 0; j < 3; j++) {
- if (ls->minBBox[j] > ls->pv[j])
+ if (ls->minBBox[j] > ls->pv[j]) {
ls->minBBox[j] = ls->pv[j];
+ }
- if (ls->maxBBox[j] < ls->pv[j])
+ if (ls->maxBBox[j] < ls->pv[j]) {
ls->maxBBox[j] = ls->pv[j];
+ }
}
#if 0
@@ -329,14 +336,18 @@ void BlenderFileLoader::addTriangle(struct LoaderState *ls,
ls->pmi++;
}
- if (fm)
+ if (fm) {
marks |= IndexedFaceSet::FACE_MARK;
- if (em1)
+ }
+ if (em1) {
marks |= IndexedFaceSet::EDGE_MARK_V1V2;
- if (em2)
+ }
+ if (em2) {
marks |= IndexedFaceSet::EDGE_MARK_V2V3;
- if (em3)
+ }
+ if (em3) {
marks |= IndexedFaceSet::EDGE_MARK_V3V1;
+ }
*(ls->pm++) = marks;
}
@@ -543,8 +554,9 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id)
}
unsigned int numTris = countClippedFaces(v1, v2, v3, clip);
- if (numTris == 0)
+ if (numTris == 0) {
continue;
+ }
bool fm = (ffa) ? (ffa[lt->poly].flag & FREESTYLE_FACE_MARK) != 0 : false;
bool em1 = false, em2 = false, em3 = false;
@@ -688,8 +700,9 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id)
detri.v = zero;
detri.n = 0;
for (unsigned int j = 0; j < viSize; j += 3) {
- if (i == j)
+ if (i == j) {
continue;
+ }
vi0 = cleanVIndices[j];
vi1 = cleanVIndices[j + 1];
vi2 = cleanVIndices[j + 2];
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
index 8a3cdd575fe..72a5e1fa273 100644
--- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
+++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp
@@ -219,8 +219,9 @@ float BlenderStrokeRenderer::get_stroke_vertex_z(void) const
{
float z = _z;
BlenderStrokeRenderer *self = const_cast<BlenderStrokeRenderer *>(this);
- if (!(_z < _z_delta * 100000.0f))
+ if (!(_z < _z_delta * 100000.0f)) {
self->_z_delta *= 10.0f;
+ }
self->_z += _z_delta;
return -z;
}
@@ -472,8 +473,9 @@ void BlenderStrokeRenderer::RenderStrokeRepBasic(StrokeRep *iStrokeRep) const
// count visible faces and strip segments
test_strip_visibility(strip_vertices, &visible_faces, &visible_segments);
- if (visible_faces == 0)
+ if (visible_faces == 0) {
continue;
+ }
totvert += visible_faces + visible_segments * 2;
totedge += visible_faces * 2 + visible_segments;
@@ -509,14 +511,18 @@ bool BlenderStrokeRenderer::test_triangle_visibility(StrokeVertexRep *svRep[3])
xl = xu = yl = yu = 0;
for (int i = 0; i < 3; i++) {
p = svRep[i]->point2d();
- if (p[0] < 0.0)
+ if (p[0] < 0.0) {
xl++;
- else if (p[0] > _width)
+ }
+ else if (p[0] > _width) {
xu++;
- if (p[1] < 0.0)
+ }
+ if (p[1] < 0.0) {
yl++;
- else if (p[1] > _height)
+ }
+ else if (p[1] > _height) {
yu++;
+ }
}
return !(xl == 3 || xu == 3 || yl == 3 || yu == 3);
}
@@ -545,8 +551,9 @@ void BlenderStrokeRenderer::test_strip_visibility(Strip::vertex_container &strip
svRep[2] = *(v[2]);
if (test_triangle_visibility(svRep)) {
(*visible_faces)++;
- if (!visible)
+ if (!visible) {
(*visible_segments)++;
+ }
visible = true;
}
else {
@@ -671,8 +678,9 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex)
// count visible faces and strip segments
test_strip_visibility(strip_vertices, &visible_faces, &visible_segments);
- if (visible_faces == 0)
+ if (visible_faces == 0) {
continue;
+ }
v[0] = strip_vertices.begin();
v[1] = v[0] + 1;
@@ -869,8 +877,9 @@ Object *BlenderStrokeRenderer::NewMesh() const
Render *BlenderStrokeRenderer::RenderScene(Render * /*re*/, bool render)
{
Camera *camera = (Camera *)freestyle_scene->camera->data;
- if (camera->clip_end < _z)
+ if (camera->clip_end < _z) {
camera->clip_end = _z + _z_delta * 100.0f;
+ }
#if 0
if (G.debug & G_DEBUG_FREESTYLE) {
cout << "clip_start " << camera->clip_start << ", clip_end " << camera->clip_end << endl;
diff --git a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
index 7ef3e23d379..bcf87f81c71 100644
--- a/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
+++ b/source/blender/freestyle/intern/blender_interface/FRS_freestyle.cpp
@@ -99,8 +99,9 @@ static bCallbackFuncStore load_post_callback_funcstore = {
void FRS_initialize()
{
- if (freestyle_is_initialized)
+ if (freestyle_is_initialized) {
return;
+ }
pathconfig = new Config::Path;
controller = new Controller();
@@ -166,9 +167,10 @@ static void init_view(Render *re)
cout << "\n=== Dimensions of the 2D image coordinate system ===" << endl;
cout << "Width : " << width << endl;
cout << "Height : " << height << endl;
- if (re->r.mode & R_BORDER)
+ if (re->r.mode & R_BORDER) {
cout << "Border : (" << xmin << ", " << ymin << ") - (" << xmax << ", " << ymax << ")"
<< endl;
+ }
cout << "Unit line thickness : " << thickness << " pixel(s)" << endl;
}
}
@@ -196,8 +198,9 @@ static char *escape_quotes(char *name)
char *s = (char *)MEM_mallocN(strlen(name) * 2 + 1, "escape_quotes");
char *p = s;
while (*name) {
- if (*name == '\'')
+ if (*name == '\'') {
*(p++) = '\\';
+ }
*(p++) = *(name++);
}
*p = '\0';
@@ -231,54 +234,71 @@ static bool test_edge_type_conditions(struct edge_type_condition *conditions,
int num_non_target_negative_conditions = 0;
for (int i = 0; i < num_edge_types; i++) {
- if (conditions[i].edge_type == target)
+ if (conditions[i].edge_type == target) {
target_condition = conditions[i].value;
- else if (conditions[i].value > 0)
+ }
+ else if (conditions[i].value > 0) {
++num_non_target_positive_conditions;
- else if (conditions[i].value < 0)
+ }
+ else if (conditions[i].value < 0) {
++num_non_target_negative_conditions;
+ }
}
if (distinct) {
// In this case, the 'target' edge type is assumed to appear on distinct edge
// of its own and never together with other edge types.
if (logical_and) {
- if (num_non_target_positive_conditions > 0)
+ if (num_non_target_positive_conditions > 0) {
return false;
- if (target_condition > 0)
+ }
+ if (target_condition > 0) {
return true;
- if (target_condition < 0)
+ }
+ if (target_condition < 0) {
return false;
- if (num_non_target_negative_conditions > 0)
+ }
+ if (num_non_target_negative_conditions > 0) {
return true;
+ }
}
else {
- if (target_condition > 0)
+ if (target_condition > 0) {
return true;
- if (num_non_target_negative_conditions > 0)
+ }
+ if (num_non_target_negative_conditions > 0) {
return true;
- if (target_condition < 0)
+ }
+ if (target_condition < 0) {
return false;
- if (num_non_target_positive_conditions > 0)
+ }
+ if (num_non_target_positive_conditions > 0) {
return false;
+ }
}
}
else {
// In this case, the 'target' edge type may appear together with other edge types.
- if (target_condition > 0)
+ if (target_condition > 0) {
return true;
- if (target_condition < 0)
+ }
+ if (target_condition < 0) {
return true;
+ }
if (logical_and) {
- if (num_non_target_positive_conditions > 0)
+ if (num_non_target_positive_conditions > 0) {
return false;
- if (num_non_target_negative_conditions > 0)
+ }
+ if (num_non_target_negative_conditions > 0) {
return true;
+ }
}
else {
- if (num_non_target_negative_conditions > 0)
+ if (num_non_target_negative_conditions > 0) {
return true;
- if (num_non_target_positive_conditions > 0)
+ }
+ if (num_non_target_positive_conditions > 0) {
return false;
+ }
}
}
return true;
@@ -291,10 +311,12 @@ static void prepare(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph)
re->stats_draw(re->sdh, &re->i);
re->i.infostr = NULL;
if (controller->LoadMesh(
- re, view_layer, depsgraph)) // returns if scene cannot be loaded or if empty
+ re, view_layer, depsgraph)) { // returns if scene cannot be loaded or if empty
return;
- if (re->test_break(re->tbh))
+ }
+ if (re->test_break(re->tbh)) {
return;
+ }
// add style modules
FreestyleConfig *config = &view_layer->freestyle_config;
@@ -316,8 +338,9 @@ static void prepare(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph)
const char *id_name = module_conf->script->id.name + 2;
if (G.debug & G_DEBUG_FREESTYLE) {
cout << " " << layer_count + 1 << ": " << id_name;
- if (module_conf->script->name)
+ if (module_conf->script->name) {
cout << " (" << module_conf->script->name << ")";
+ }
cout << endl;
}
controller->InsertStyleModule(layer_count, id_name, module_conf->script);
@@ -373,12 +396,15 @@ static void prepare(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph)
else {
// conditions for feature edge selection by edge types
for (int i = 0; i < num_edge_types; i++) {
- if (!(lineset->edge_types & conditions[i].edge_type))
+ if (!(lineset->edge_types & conditions[i].edge_type)) {
conditions[i].value = 0; // no condition specified
- else if (!(lineset->exclude_edge_types & conditions[i].edge_type))
+ }
+ else if (!(lineset->exclude_edge_types & conditions[i].edge_type)) {
conditions[i].value = 1; // condition: X
- else
+ }
+ else {
conditions[i].value = -1; // condition: NOT X
+ }
}
// logical operator for the selection conditions
bool logical_and = ((lineset->flags & FREESTYLE_LINESET_FE_AND) != 0);
@@ -388,8 +414,9 @@ static void prepare(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph)
// Inclusive equivalent using De Morgan's laws:
// - NOT (X OR Y) --> (NOT X) AND (NOT Y)
// - NOT (X AND Y) --> (NOT X) OR (NOT Y)
- for (int i = 0; i < num_edge_types; i++)
+ for (int i = 0; i < num_edge_types; i++) {
conditions[i].value *= -1;
+ }
logical_and = !logical_and;
}
if (test_edge_type_conditions(
@@ -470,8 +497,9 @@ static void prepare(Render *re, ViewLayer *view_layer, Depsgraph *depsgraph)
cout << " Z = " << (z ? "enabled" : "disabled") << endl;
}
- if (controller->hitViewMapCache())
+ if (controller->hitViewMapCache()) {
return;
+ }
// compute view map
re->i.infostr = IFACE_("Freestyle: View map creation");
@@ -486,8 +514,9 @@ void FRS_composite_result(Render *re, ViewLayer *view_layer, Render *freestyle_r
float *src, *dest, *pixSrc, *pixDest;
int x, y, rectx, recty;
- if (freestyle_render == NULL || freestyle_render->result == NULL)
+ if (freestyle_render == NULL || freestyle_render->result == NULL) {
return;
+ }
rl = render_get_active_layer(freestyle_render, freestyle_render->result);
if (!rl) {
@@ -553,8 +582,9 @@ static int displayed_layer_count(ViewLayer *view_layer)
(FreestyleModuleConfig *)view_layer->freestyle_config.modules.first;
module;
module = module->next) {
- if (module->script && module->is_displayed)
+ if (module->script && module->is_displayed) {
count++;
+ }
}
break;
case FREESTYLE_CONTROL_EDITOR_MODE:
@@ -562,8 +592,9 @@ static int displayed_layer_count(ViewLayer *view_layer)
(FreestyleLineSet *)view_layer->freestyle_config.linesets.first;
lineset;
lineset = lineset->next) {
- if (lineset->flags & FREESTYLE_LINESET_ENABLED)
+ if (lineset->flags & FREESTYLE_LINESET_ENABLED) {
count++;
+ }
}
break;
}
@@ -599,8 +630,9 @@ Render *FRS_do_stroke_rendering(Render *re, ViewLayer *view_layer, int render)
{
Render *freestyle_render = NULL;
- if (!render)
+ if (!render) {
return controller->RenderStrokes(re, false);
+ }
RenderMonitor monitor(re);
controller->setRenderMonitor(&monitor);
@@ -704,17 +736,20 @@ void FRS_copy_active_lineset(FreestyleConfig *config)
void FRS_paste_active_lineset(FreestyleConfig *config)
{
- if (!lineset_copied)
+ if (!lineset_copied) {
return;
+ }
FreestyleLineSet *lineset = BKE_freestyle_lineset_get_active(config);
if (lineset) {
- if (lineset->linestyle)
+ if (lineset->linestyle) {
id_us_min(&lineset->linestyle->id);
+ }
lineset->linestyle = lineset_buffer.linestyle;
- if (lineset->linestyle)
+ if (lineset->linestyle) {
id_us_plus(&lineset->linestyle->id);
+ }
lineset->flags = lineset_buffer.flags;
lineset->selection = lineset_buffer.selection;
lineset->qi = lineset_buffer.qi;
diff --git a/source/blender/freestyle/intern/geometry/BBox.h b/source/blender/freestyle/intern/geometry/BBox.h
index 7350fabbc13..71384d33bc6 100644
--- a/source/blender/freestyle/intern/geometry/BBox.h
+++ b/source/blender/freestyle/intern/geometry/BBox.h
@@ -59,10 +59,12 @@ template<class Point> class BBox {
return;
}
for (unsigned int i = 0; i < Point::dim(); i++) {
- if (p[i] < _min[i])
+ if (p[i] < _min[i]) {
_min[i] = p[i];
- else if (p[i] > _max[i])
+ }
+ else if (p[i] > _max[i]) {
_max[i] = p[i];
+ }
}
_empty = false;
}
@@ -106,10 +108,12 @@ template<class Point> class BBox {
}
else {
for (unsigned int i = 0; i < Point::dim(); i++) {
- if (b.getMin()[i] < _min[i])
+ if (b.getMin()[i] < _min[i]) {
_min[i] = b.getMin()[i];
- if (b.getMax()[i] > _max[i])
+ }
+ if (b.getMax()[i] > _max[i]) {
_max[i] = b.getMax()[i];
+ }
}
}
return *this;
@@ -117,11 +121,13 @@ template<class Point> class BBox {
inline bool inside(const Point &p)
{
- if (empty())
+ if (empty()) {
return false;
+ }
for (unsigned int i = 0; i < Point::dim(); i++) {
- if ((_min[i] > p[i]) || (_max[i] < p[i]))
+ if ((_min[i] > p[i]) || (_max[i] < p[i])) {
return false;
+ }
}
return true;
}
diff --git a/source/blender/freestyle/intern/geometry/Bezier.cpp b/source/blender/freestyle/intern/geometry/Bezier.cpp
index 3f6b6b25f76..9a832c04699 100644
--- a/source/blender/freestyle/intern/geometry/Bezier.cpp
+++ b/source/blender/freestyle/intern/geometry/Bezier.cpp
@@ -37,14 +37,16 @@ BezierCurveSegment::~BezierCurveSegment()
void BezierCurveSegment::AddControlPoint(const Vec2d &iPoint)
{
_ControlPolygon.push_back(iPoint);
- if (_ControlPolygon.size() == 4)
+ if (_ControlPolygon.size() == 4) {
Build();
+ }
}
void BezierCurveSegment::Build()
{
- if (_ControlPolygon.size() != 4)
+ if (_ControlPolygon.size() != 4) {
return;
+ }
// Compute the rightmost part of the matrix:
vector<Vec2d>::const_iterator p0, p1, p2, p3;
@@ -92,8 +94,9 @@ BezierCurve::BezierCurve(vector<Vec2d> &iPoints, double error)
int i = 0;
vector<Vec2d>::iterator v, vend;
for (v = curve.begin(), vend = curve.end(); v != vend; ++v) {
- if ((i == 0) || (i % 4 != 0))
+ if ((i == 0) || (i % 4 != 0)) {
AddControlPoint(*v);
+ }
++i;
}
}
@@ -102,11 +105,13 @@ BezierCurve::~BezierCurve()
{
if (!_Segments.empty()) {
vector<BezierCurveSegment *>::iterator v, vend;
- for (v = _Segments.begin(), vend = _Segments.end(); v != vend; ++v)
+ for (v = _Segments.begin(), vend = _Segments.end(); v != vend; ++v) {
delete *v;
+ }
}
- if (_currentSegment)
+ if (_currentSegment) {
delete _currentSegment;
+ }
}
void BezierCurve::AddControlPoint(const Vec2d &iPoint)
diff --git a/source/blender/freestyle/intern/geometry/FastGrid.cpp b/source/blender/freestyle/intern/geometry/FastGrid.cpp
index e0d36bece6e..1e5707690a0 100644
--- a/source/blender/freestyle/intern/geometry/FastGrid.cpp
+++ b/source/blender/freestyle/intern/geometry/FastGrid.cpp
@@ -30,12 +30,14 @@ namespace Freestyle {
void FastGrid::clear()
{
- if (!_cells)
+ if (!_cells) {
return;
+ }
for (unsigned int i = 0; i < _cells_size; i++) {
- if (_cells[i])
+ if (_cells[i]) {
delete _cells[i];
+ }
}
delete[] _cells;
_cells = NULL;
diff --git a/source/blender/freestyle/intern/geometry/FitCurve.cpp b/source/blender/freestyle/intern/geometry/FitCurve.cpp
index 368c3d2f46c..e7d67756535 100644
--- a/source/blender/freestyle/intern/geometry/FitCurve.cpp
+++ b/source/blender/freestyle/intern/geometry/FitCurve.cpp
@@ -266,8 +266,9 @@ static double NewtonRaphsonRootFind(BezierCurve Q, Vector2 P, double u)
(Q_u[1] - P[1]) * (Q2_u[1]);
/* u = u - f(u)/f'(u) */
- if (denominator == 0) // FIXME
+ if (denominator == 0) { // FIXME
return u;
+ }
uPrime = u - (numerator / denominator);
return uPrime;
}
@@ -472,8 +473,9 @@ FitCurveWrapper::~FitCurveWrapper()
void FitCurveWrapper::DrawBezierCurve(int n, Vector2 *curve)
{
- for (int i = 0; i <= n; ++i)
+ for (int i = 0; i <= n; ++i) {
_vertices.push_back(curve[i]);
+ }
}
void FitCurveWrapper::FitCurve(vector<Vec2d> &data, vector<Vec2d> &oCurve, double error)
diff --git a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp
index 32d6fc62085..9fb830c056c 100644
--- a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp
+++ b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp
@@ -115,8 +115,9 @@ void GeomCleaner::CompressIndexedVertexArray(const float *iVertices,
i = 1;
for (; v != vertices.end(); v++) {
current = *v;
- if (current == previous)
+ if (current == previous) {
mapVertex[i] = compressedVertices.size() - 1;
+ }
else {
compressedVertices.push_back(current);
mapVertex[i] = compressedVertices.size() - 1;
@@ -205,8 +206,9 @@ void GeomCleaner::CleanIndexedVertexArray(const float *iVertices,
typedef map<Vec3f, unsigned> cleanHashTable;
vector<Vec3f> vertices;
unsigned i;
- for (i = 0; i < iVSize; i += 3)
+ for (i = 0; i < iVSize; i += 3) {
vertices.push_back(Vec3f(iVertices[i], iVertices[i + 1], iVertices[i + 2]));
+ }
cleanHashTable ht;
vector<unsigned> newIndices;
@@ -244,8 +246,9 @@ void GeomCleaner::CleanIndexedVertexArray(const float *iVertices,
// map new indices:
*oIndices = new unsigned[iISize];
- for (i = 0; i < iISize; i++)
+ for (i = 0; i < iISize; i++) {
(*oIndices)[i] = 3 * newIndices[iIndices[i] / 3];
+ }
}
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/geometry/GeomUtils.cpp b/source/blender/freestyle/intern/geometry/GeomUtils.cpp
index bec6ed27cc4..e6b1c947476 100644
--- a/source/blender/freestyle/intern/geometry/GeomUtils.cpp
+++ b/source/blender/freestyle/intern/geometry/GeomUtils.cpp
@@ -76,8 +76,9 @@ intersection_test intersect2dSeg2dSeg(
// Check signs of r3 and r4. If both point 3 and point 4 lie on same side of line 1,
// the line segments do not intersect.
- if (r3 != 0 && r4 != 0 && r3 * r4 > 0.0)
+ if (r3 != 0 && r4 != 0 && r3 * r4 > 0.0) {
return (DONT_INTERSECT);
+ }
// Compute a2, b2, c2
a2 = p4[1] - p3[1];
@@ -90,13 +91,15 @@ intersection_test intersect2dSeg2dSeg(
// Check signs of r1 and r2. If both point 1 and point 2 lie on same side of second line
// segment, the line segments do not intersect.
- if (r1 != 0 && r2 != 0 && r1 * r2 > 0.0)
+ if (r1 != 0 && r2 != 0 && r1 * r2 > 0.0) {
return (DONT_INTERSECT);
+ }
// Line segments intersect: compute intersection point.
denom = a1 * b2 - a2 * b1;
- if (fabs(denom) < M_EPSILON)
+ if (fabs(denom) < M_EPSILON) {
return (COLINEAR);
+ }
num = b1 * c2 - b2 * c1;
res[0] = num / denom;
@@ -125,8 +128,9 @@ intersection_test intersect2dLine2dLine(
// Line segments intersect: compute intersection point.
denom = a1 * b2 - a2 * b1;
- if (fabs(denom) < M_EPSILON)
+ if (fabs(denom) < M_EPSILON) {
return (COLINEAR);
+ }
num = b1 * c2 - b2 * c1;
res[0] = num / denom;
@@ -160,8 +164,9 @@ intersection_test intersect2dSeg2dSegParametric(const Vec2r &p1,
// Check signs of r3 and r4. If both point 3 and point 4 lie on same side of line 1,
// the line segments do not intersect.
- if (r3 != 0 && r4 != 0 && r3 * r4 > 0.0)
+ if (r3 != 0 && r4 != 0 && r3 * r4 > 0.0) {
return (DONT_INTERSECT);
+ }
// Compute a2, b2, c2
a2 = p4[1] - p3[1];
@@ -174,13 +179,15 @@ intersection_test intersect2dSeg2dSegParametric(const Vec2r &p1,
// Check signs of r1 and r2. If both point 1 and point 2 lie on same side of second line
// segment, the line segments do not intersect.
- if (r1 != 0 && r2 != 0 && r1 * r2 > 0.0)
+ if (r1 != 0 && r2 != 0 && r1 * r2 > 0.0) {
return (DONT_INTERSECT);
+ }
// Line segments intersect: compute intersection point.
denom = a1 * b2 - a2 * b1;
- if (fabs(denom) < epsilon)
+ if (fabs(denom) < epsilon) {
return (COLINEAR);
+ }
real d1, e1;
@@ -387,26 +394,30 @@ bool overlapTriangleBox(Vec3r &boxcenter, Vec3r &boxhalfsize, Vec3r triverts[3])
// test in X-direction
FINDMINMAX(v0[X], v1[X], v2[X], min, max);
- if (min > boxhalfsize[X] || max < -boxhalfsize[X])
+ if (min > boxhalfsize[X] || max < -boxhalfsize[X]) {
return false;
+ }
// test in Y-direction
FINDMINMAX(v0[Y], v1[Y], v2[Y], min, max);
- if (min > boxhalfsize[Y] || max < -boxhalfsize[Y])
+ if (min > boxhalfsize[Y] || max < -boxhalfsize[Y]) {
return false;
+ }
// test in Z-direction
FINDMINMAX(v0[Z], v1[Z], v2[Z], min, max);
- if (min > boxhalfsize[Z] || max < -boxhalfsize[Z])
+ if (min > boxhalfsize[Z] || max < -boxhalfsize[Z]) {
return false;
+ }
// Bullet 2:
// test if the box intersects the plane of the triangle
// compute plane equation of triangle: normal * x + d = 0
normal = e0 ^ e1;
d = -(normal * v0); // plane eq: normal.x + d = 0
- if (!overlapPlaneBox(normal, d, boxhalfsize))
+ if (!overlapPlaneBox(normal, d, boxhalfsize)) {
return false;
+ }
return true; // box and triangle overlaps
}
@@ -453,24 +464,28 @@ bool intersectRayTriangle(const Vec3r &orig,
if (det > epsilon) {
u = tvec * pvec;
- if (u < 0.0 || u > det)
+ if (u < 0.0 || u > det) {
return false;
+ }
// calculate V parameter and test bounds
v = dir * qvec;
- if (v < 0.0 || u + v > det)
+ if (v < 0.0 || u + v > det) {
return false;
+ }
}
else if (det < -epsilon) {
// calculate U parameter and test bounds
u = tvec * pvec;
- if (u > 0.0 || u < det)
+ if (u > 0.0 || u < det) {
return false;
+ }
// calculate V parameter and test bounds
v = dir * qvec;
- if (v > 0.0 || u + v < det)
+ if (v > 0.0 || u + v < det) {
return false;
+ }
}
else {
return false; // ray is parallell to the plane of the triangle
@@ -496,16 +511,19 @@ intersection_test intersectRayPlane(const Vec3r &orig,
real denom = norm * dir;
if (fabs(denom) <= epsilon) { // plane and ray are parallel
- if (fabs((norm * orig) + d) <= epsilon)
+ if (fabs((norm * orig) + d) <= epsilon) {
return COINCIDENT; // plane and ray are coincident
- else
+ }
+ else {
return COLINEAR;
+ }
}
t = -(d + (norm * orig)) / denom;
- if (t < 0.0f)
+ if (t < 0.0f) {
return DONT_INTERSECT;
+ }
return DO_INTERSECT;
}
@@ -535,20 +553,26 @@ bool intersectRayBBox(const Vec3r &orig,
tmax = (bounds[1 - sign[0]].x() - orig.x()) * inv_direction.x();
tymin = (bounds[sign[1]].y() - orig.y()) * inv_direction.y();
tymax = (bounds[1 - sign[1]].y() - orig.y()) * inv_direction.y();
- if ((tmin > tymax) || (tymin > tmax))
+ if ((tmin > tymax) || (tymin > tmax)) {
return false;
- if (tymin > tmin)
+ }
+ if (tymin > tmin) {
tmin = tymin;
- if (tymax < tmax)
+ }
+ if (tymax < tmax) {
tmax = tymax;
+ }
tzmin = (bounds[sign[2]].z() - orig.z()) * inv_direction.z();
tzmax = (bounds[1 - sign[2]].z() - orig.z()) * inv_direction.z();
- if ((tmin > tzmax) || (tzmin > tmax))
+ if ((tmin > tzmax) || (tzmin > tmax)) {
return false;
- if (tzmin > tmin)
+ }
+ if (tzmin > tmin) {
tmin = tzmin;
- if (tzmax < tmax)
+ }
+ if (tzmax < tmax) {
tmax = tzmax;
+ }
return ((tmin < t1) && (tmax > t0));
}
@@ -571,14 +595,17 @@ bool includePointTriangle(const Vec3r &P, const Vec3r &A, const Vec3r &B, const
K.normalize();
L.normalize();
- if (J * N < 0)
+ if (J * N < 0) {
return false; // on the right of AB
+ }
- if (K * N < 0)
+ if (K * N < 0) {
return false; // on the right of BC
+ }
- if (L * N < 0)
+ if (L * N < 0) {
return false; // on the right of CA
+ }
return true;
}
@@ -589,8 +616,9 @@ void transformVertex(const Vec3r &vert, const Matrix44r &matrix, Vec3r &res)
real scale;
for (unsigned int j = 0; j < 4; j++) {
scale = hvert[j];
- for (unsigned int i = 0; i < 4; i++)
+ for (unsigned int i = 0; i < 4; i++) {
res_tmp[i] += matrix(i, j) * scale;
+ }
}
res[0] = res_tmp.x();
@@ -612,8 +640,9 @@ Vec3r rotateVector(const Matrix44r &mat, const Vec3r &v)
Vec3r res;
for (unsigned int i = 0; i < 3; i++) {
res[i] = 0;
- for (unsigned int j = 0; j < 3; j++)
+ for (unsigned int j = 0; j < 3; j++) {
res[i] += mat(i, j) * v[j];
+ }
}
res.normalize();
return res;
@@ -698,8 +727,9 @@ void fromCameraToWorld(const Vec3r &p, Vec3r &q, const real model_view_matrix[4]
};
for (unsigned short i = 0; i < 3; i++) {
q[i] = 0.0;
- for (unsigned short j = 0; j < 3; j++)
+ for (unsigned short j = 0; j < 3; j++) {
q[i] += model_view_matrix[j][i] * (p[j] - translation[j]);
+ }
}
}
@@ -718,8 +748,9 @@ void fromCameraToWorld(const Vec3r &p, Vec3r &q, const real model_view_matrix[4]
inline bool intersect2dSegPoly(Vec2r *seg, Vec2r *poly, unsigned n)
{
- if (seg[0] == seg[1])
+ if (seg[0] == seg[1]) {
return false;
+ }
real tE = 0; // the maximum entering segment parameter
real tL = 1; // the minimum leaving segment parameter
@@ -732,25 +763,29 @@ inline bool intersect2dSegPoly(Vec2r *seg, Vec2r *poly, unsigned n)
N = PERP(e, seg[0] - poly[i]);
D = -PERP(e, dseg);
if (fabs(D) < M_EPSILON) {
- if (N < 0)
+ if (N < 0) {
return false;
- else
+ }
+ else {
continue;
+ }
}
t = N / D;
if (D < 0) { // segment seg is entering across this edge
if (t > tE) { // new max tE
tE = t;
- if (tE > tL) // seg enters after leaving polygon
+ if (tE > tL) { // seg enters after leaving polygon
return false;
+ }
}
}
else { // segment seg is leaving across this edge
if (t < tL) { // new min tL
tL = t;
- if (tL < tE) // seg leaves before entering polygon
+ if (tL < tE) { // seg leaves before entering polygon
return false;
+ }
}
}
}
@@ -773,10 +808,12 @@ inline bool overlapPlaneBox(Vec3r &normal, real d, Vec3r &maxbox)
vmax[q] = -maxbox[q];
}
}
- if ((normal * vmin) + d > 0.0f)
+ if ((normal * vmin) + d > 0.0f) {
return false;
- if ((normal * vmax) + d >= 0.0f)
+ }
+ if ((normal * vmax) + d >= 0.0f) {
return true;
+ }
return false;
}
@@ -796,8 +833,9 @@ inline void fromCoordAToCoordB(const Vec3r &p, Vec3r &q, const real transform[4]
return;
}
- for (unsigned int k = 0; k < 3; k++)
+ for (unsigned int k = 0; k < 3; k++) {
q[k] = hq[k] / hq[3];
+ }
}
} // end of namespace GeomUtils
diff --git a/source/blender/freestyle/intern/geometry/GeomUtils.h b/source/blender/freestyle/intern/geometry/GeomUtils.h
index c469f10cc49..635808aab4b 100644
--- a/source/blender/freestyle/intern/geometry/GeomUtils.h
+++ b/source/blender/freestyle/intern/geometry/GeomUtils.h
@@ -50,12 +50,14 @@ template<class T> real distPointSegment(const T &P, const T &A, const T &B)
BP = P - B;
real c1(AB * AP);
- if (c1 <= 0)
+ if (c1 <= 0) {
return AP.norm();
+ }
real c2(AB * AB);
- if (c2 <= c1)
+ if (c2 <= c1) {
return BP.norm();
+ }
real b = c1 / c2;
T Pb, PPb;
diff --git a/source/blender/freestyle/intern/geometry/Grid.cpp b/source/blender/freestyle/intern/geometry/Grid.cpp
index aeb82d56009..4076bfe03df 100644
--- a/source/blender/freestyle/intern/geometry/Grid.cpp
+++ b/source/blender/freestyle/intern/geometry/Grid.cpp
@@ -83,8 +83,9 @@ void firstIntersectionGridVisitor::examineOccluder(Polygon3r *occ)
bool firstIntersectionGridVisitor::stop()
{
- if (occluder_)
+ if (occluder_) {
return true;
+ }
return false;
}
@@ -139,20 +140,23 @@ void Grid::configure(const Vec3r &orig, const Vec3r &size, unsigned nb)
// We compute the number of cells par edge such as we cover at least the whole box.
unsigned i;
- for (i = 0; i < 3; i++)
+ for (i = 0; i < 3; i++) {
_cells_nb[i] = (unsigned)floor(tmpSize[i] / edge) + 1;
+ }
_size = tmpSize;
- for (i = 0; i < 3; i++)
+ for (i = 0; i < 3; i++) {
_cell_size[i] = _size[i] / _cells_nb[i];
+ }
}
void Grid::insertOccluder(Polygon3r *occluder)
{
const vector<Vec3r> vertices = occluder->getVertices();
- if (vertices.size() == 0)
+ if (vertices.size() == 0) {
return;
+ }
// add this occluder to the grid's occluders list
addOccluder(occluder);
@@ -244,12 +248,15 @@ bool Grid::nextRayCell(Vec3u &current_cell, Vec3u &next_cell)
// coresponding to the intersections with the plans:
// x = _cell_size[0], y = _cell_size[1], z = _cell_size[2]
for (i = 0; i < 3; i++) {
- if (_ray_dir[i] == 0)
+ if (_ray_dir[i] == 0) {
continue;
- if (_ray_dir[i] > 0)
+ }
+ if (_ray_dir[i] > 0) {
t = (_cell_size[i] - _pt[i]) / _ray_dir[i];
- else
+ }
+ else {
t = -_pt[i] / _ray_dir[i];
+ }
if (t < t_min) {
t_min = t;
coord = i;
@@ -266,20 +273,23 @@ bool Grid::nextRayCell(Vec3u &current_cell, Vec3u &next_cell)
next_cell[coord]++;
_pt[coord] -= _cell_size[coord];
// if we are out of the grid, we must stop
- if (next_cell[coord] >= _cells_nb[coord])
+ if (next_cell[coord] >= _cells_nb[coord]) {
return false;
+ }
}
else {
int tmp = next_cell[coord] - 1;
_pt[coord] = _cell_size[coord];
- if (tmp < 0)
+ if (tmp < 0) {
return false;
+ }
next_cell[coord]--;
}
_t += t_min;
- if (_t >= _t_end)
+ if (_t >= _t_end) {
return false;
+ }
return true;
}
@@ -301,8 +311,9 @@ void Grid::castInfiniteRay(const Vec3r &orig,
{
Vec3r end = Vec3r(orig + FLT_MAX * dir / dir.norm());
bool inter = initInfiniteRay(orig, dir, timestamp);
- if (!inter)
+ if (!inter) {
return;
+ }
allOccludersGridVisitor visitor(occluders);
castRayInternal(visitor);
}
@@ -371,8 +382,9 @@ bool Grid::initInfiniteRay(const Vec3r &orig, const Vec3r &dir, unsigned timesta
Vec3r newOrig = orig + tmin * _ray_dir;
for (unsigned int i = 0; i < 3; i++) {
_current_cell[i] = (unsigned)floor((newOrig[i] - _orig[i]) / _cell_size[i]);
- if (_current_cell[i] == _cells_nb[i])
+ if (_current_cell[i] == _cells_nb[i]) {
_current_cell[i] = _cells_nb[i] - 1;
+ }
// soc unused - unsigned u = _current_cell[i];
_pt[i] = newOrig[i] - _orig[i] - _current_cell[i] * _cell_size[i];
}
diff --git a/source/blender/freestyle/intern/geometry/Grid.h b/source/blender/freestyle/intern/geometry/Grid.h
index 67aae73a578..6090eeb122a 100644
--- a/source/blender/freestyle/intern/geometry/Grid.h
+++ b/source/blender/freestyle/intern/geometry/Grid.h
@@ -67,8 +67,9 @@ class Cell {
inline void addOccluder(Polygon3r *o)
{
- if (o)
+ if (o) {
_occluders.push_back(o);
+ }
}
inline const Vec3r &getOrigin()
@@ -227,12 +228,15 @@ class Grid {
int tmp;
for (int i = 0; i < 3; i++) {
tmp = (int)((p[i] - _orig[i]) / _cell_size[i]);
- if (tmp < 0)
+ if (tmp < 0) {
res[i] = 0;
- else if ((unsigned int)tmp >= _cells_nb[i])
+ }
+ else if ((unsigned int)tmp >= _cells_nb[i]) {
res[i] = _cells_nb[i] - 1;
- else
+ }
+ else {
res[i] = tmp;
+ }
}
}
@@ -263,8 +267,9 @@ class Grid {
*/
inline void getCellOrigin(const Vec3u &cell_coord, Vec3r &orig)
{
- for (unsigned int i = 0; i < 3; i++)
+ for (unsigned int i = 0; i < 3; i++) {
orig[i] = _orig[i] + cell_coord[i] * _cell_size[i];
+ }
}
/*! Retrieves the box corresponding to the cell whose coordinates are passed as argument:
diff --git a/source/blender/freestyle/intern/geometry/HashGrid.h b/source/blender/freestyle/intern/geometry/HashGrid.h
index b1fc4824b6f..73751d820ab 100644
--- a/source/blender/freestyle/intern/geometry/HashGrid.h
+++ b/source/blender/freestyle/intern/geometry/HashGrid.h
@@ -87,8 +87,9 @@ class HashGrid : public Grid {
Cell *found_cell = NULL;
GridHashTable::const_iterator found = _cells.find(p);
- if (found != _cells.end())
+ if (found != _cells.end()) {
found_cell = (*found).second;
+ }
return found_cell;
}
diff --git a/source/blender/freestyle/intern/geometry/Noise.cpp b/source/blender/freestyle/intern/geometry/Noise.cpp
index 8b81660fd58..7c42c332370 100644
--- a/source/blender/freestyle/intern/geometry/Noise.cpp
+++ b/source/blender/freestyle/intern/geometry/Noise.cpp
@@ -245,12 +245,14 @@ Noise::Noise(long seed)
p[i] = i;
g1[i] = (float)((BLI_rng_get_int(rng) % (_NOISE_B + _NOISE_B)) - _NOISE_B) / _NOISE_B;
- for (j = 0; j < 2; j++)
+ for (j = 0; j < 2; j++) {
g2[i][j] = (float)((BLI_rng_get_int(rng) % (_NOISE_B + _NOISE_B)) - _NOISE_B) / _NOISE_B;
+ }
normalize2(g2[i]);
- for (j = 0; j < 3; j++)
+ for (j = 0; j < 3; j++) {
g3[i][j] = (float)((BLI_rng_get_int(rng) % (_NOISE_B + _NOISE_B)) - _NOISE_B) / _NOISE_B;
+ }
normalize3(g3[i]);
}
@@ -264,11 +266,13 @@ Noise::Noise(long seed)
p[_NOISE_B + i] = p[i];
g1[_NOISE_B + i] = g1[i];
- for (j = 0; j < 2; j++)
+ for (j = 0; j < 2; j++) {
g2[_NOISE_B + i][j] = g2[i][j];
+ }
- for (j = 0; j < 3; j++)
+ for (j = 0; j < 3; j++) {
g3[_NOISE_B + i][j] = g3[i][j];
+ }
}
BLI_rng_free(rng);
diff --git a/source/blender/freestyle/intern/geometry/Polygon.h b/source/blender/freestyle/intern/geometry/Polygon.h
index 739f880443c..f0e1199d930 100644
--- a/source/blender/freestyle/intern/geometry/Polygon.h
+++ b/source/blender/freestyle/intern/geometry/Polygon.h
@@ -100,8 +100,9 @@ template<class Point> class Polygon {
inline Point getCenter()
{
Point result;
- for (typename vector<Point>::iterator it = _vertices.begin(); it != _vertices.end(); it++)
+ for (typename vector<Point>::iterator it = _vertices.begin(); it != _vertices.end(); it++) {
result += *it;
+ }
result /= _vertices.size();
return result;
}
@@ -138,18 +139,21 @@ template<class Point> class Polygon {
/////////////////////////////////////////////////////////////////////////////
inline void computeBBox()
{
- if (_vertices.empty())
+ if (_vertices.empty()) {
return;
+ }
_max = _vertices[0];
_min = _vertices[0];
for (typename vector<Point>::iterator it = _vertices.begin(); it != _vertices.end(); it++) {
for (unsigned int i = 0; i < Point::dim(); i++) {
- if ((*it)[i] > _max[i])
+ if ((*it)[i] > _max[i]) {
_max[i] = (*it)[i];
- if ((*it)[i] < _min[i])
+ }
+ if ((*it)[i] < _min[i]) {
_min[i] = (*it)[i];
+ }
}
}
}
diff --git a/source/blender/freestyle/intern/geometry/VecMat.h b/source/blender/freestyle/intern/geometry/VecMat.h
index b9cf604fed7..bb12e5b97f0 100644
--- a/source/blender/freestyle/intern/geometry/VecMat.h
+++ b/source/blender/freestyle/intern/geometry/VecMat.h
@@ -59,8 +59,9 @@ template<class T, unsigned N> class Vec {
// constructors
inline Vec()
{
- for (unsigned int i = 0; i < N; i++)
+ for (unsigned int i = 0; i < N; i++) {
this->_coord[i] = 0;
+ }
}
~Vec()
@@ -70,20 +71,23 @@ template<class T, unsigned N> class Vec {
template<class U> explicit inline Vec(const U tab[N])
{
- for (unsigned int i = 0; i < N; i++)
+ for (unsigned int i = 0; i < N; i++) {
this->_coord[i] = (T)tab[i];
+ }
}
template<class U> explicit inline Vec(const std::vector<U> &tab)
{
- for (unsigned int i = 0; i < N; i++)
+ for (unsigned int i = 0; i < N; i++) {
this->_coord[i] = (T)tab[i];
+ }
}
template<class U> explicit inline Vec(const Vec<U, N> &v)
{
- for (unsigned int i = 0; i < N; i++)
+ for (unsigned int i = 0; i < N; i++) {
this->_coord[i] = (T)v[i];
+ }
}
// accessors
@@ -116,8 +120,9 @@ template<class T, unsigned N> class Vec {
inline Vec<T, N> &normalize()
{
value_type n = norm();
- for (unsigned int i = 0; i < N; i++)
+ for (unsigned int i = 0; i < N; i++) {
this->_coord[i] /= n;
+ }
return *this;
}
@@ -125,8 +130,9 @@ template<class T, unsigned N> class Vec {
{
value_type n = norm();
if (n) {
- for (unsigned int i = 0; i < N; i++)
+ for (unsigned int i = 0; i < N; i++) {
this->_coord[i] /= n;
+ }
}
return *this;
}
@@ -156,8 +162,9 @@ template<class T, unsigned N> class Vec {
inline Vec<T, N> operator/(const typename Vec<T, N>::value_type r) const
{
Vec<T, N> res(*this);
- if (r)
+ if (r) {
res /= r;
+ }
return res;
}
@@ -165,46 +172,52 @@ template<class T, unsigned N> class Vec {
inline value_type operator*(const Vec<T, N> &v) const
{
value_type sum = 0;
- for (unsigned int i = 0; i < N; i++)
+ for (unsigned int i = 0; i < N; i++) {
sum += (*this)[i] * v[i];
+ }
return sum;
}
template<class U> inline Vec<T, N> &operator=(const Vec<U, N> &v)
{
if (this != &v) {
- for (unsigned int i = 0; i < N; i++)
+ for (unsigned int i = 0; i < N; i++) {
this->_coord[i] = (T)v[i];
+ }
}
return *this;
}
template<class U> inline Vec<T, N> &operator+=(const Vec<U, N> &v)
{
- for (unsigned int i = 0; i < N; i++)
+ for (unsigned int i = 0; i < N; i++) {
this->_coord[i] += (T)v[i];
+ }
return *this;
}
template<class U> inline Vec<T, N> &operator-=(const Vec<U, N> &v)
{
- for (unsigned int i = 0; i < N; i++)
+ for (unsigned int i = 0; i < N; i++) {
this->_coord[i] -= (T)v[i];
+ }
return *this;
}
template<class U> inline Vec<T, N> &operator*=(const U r)
{
- for (unsigned int i = 0; i < N; i++)
+ for (unsigned int i = 0; i < N; i++) {
this->_coord[i] *= r;
+ }
return *this;
}
template<class U> inline Vec<T, N> &operator/=(const U r)
{
if (r) {
- for (unsigned int i = 0; i < N; i++)
+ for (unsigned int i = 0; i < N; i++) {
this->_coord[i] /= r;
+ }
}
return *this;
}
@@ -212,8 +225,9 @@ template<class T, unsigned N> class Vec {
inline bool operator==(const Vec<T, N> &v) const
{
for (unsigned int i = 0; i < N; i++) {
- if (this->_coord[i] != v[i])
+ if (this->_coord[i] != v[i]) {
return false;
+ }
}
return true;
}
@@ -221,8 +235,9 @@ template<class T, unsigned N> class Vec {
inline bool operator!=(const Vec<T, N> &v) const
{
for (unsigned int i = 0; i < N; i++) {
- if (this->_coord[i] != v[i])
+ if (this->_coord[i] != v[i]) {
return true;
+ }
}
return false;
}
@@ -230,12 +245,15 @@ template<class T, unsigned N> class Vec {
inline bool operator<(const Vec<T, N> &v) const
{
for (unsigned int i = 0; i < N; i++) {
- if (this->_coord[i] < v[i])
+ if (this->_coord[i] < v[i]) {
return true;
- if (this->_coord[i] > v[i])
+ }
+ if (this->_coord[i] > v[i]) {
return false;
- if (this->_coord[i] == v[i])
+ }
+ if (this->_coord[i] == v[i]) {
continue;
+ }
}
return false;
}
@@ -243,12 +261,15 @@ template<class T, unsigned N> class Vec {
inline bool operator>(const Vec<T, N> &v) const
{
for (unsigned int i = 0; i < N; i++) {
- if (this->_coord[i] > v[i])
+ if (this->_coord[i] > v[i]) {
return true;
- if (this->_coord[i] < v[i])
+ }
+ if (this->_coord[i] < v[i]) {
return false;
- if (this->_coord[i] == v[i])
+ }
+ if (this->_coord[i] == v[i]) {
continue;
+ }
}
return false;
}
@@ -351,8 +372,9 @@ template<class T> class Vec2 : public Vec<T, 2> {
inline Vec2<T> operator/(const value_type r) const
{
Vec2<T> res(*this);
- if (r)
+ if (r) {
res /= r;
+ }
return res;
}
@@ -360,8 +382,9 @@ template<class T> class Vec2 : public Vec<T, 2> {
inline value_type operator*(const Vec2<T> &v) const
{
value_type sum = 0;
- for (unsigned int i = 0; i < 2; i++)
+ for (unsigned int i = 0; i < 2; i++) {
sum += (*this)[i] * v[i];
+ }
return sum;
}
};
@@ -578,8 +601,9 @@ template<class T> class Vec3 : public Vec<T, 3> {
inline Vec3<T> operator/(const value_type r) const
{
Vec3<T> res(*this);
- if (r)
+ if (r) {
res /= r;
+ }
return res;
}
@@ -587,8 +611,9 @@ template<class T> class Vec3 : public Vec<T, 3> {
inline value_type operator*(const Vec3<T> &v) const
{
value_type sum = 0;
- for (unsigned int i = 0; i < 3; i++)
+ for (unsigned int i = 0; i < 3; i++) {
sum += (*this)[i] * v[i];
+ }
return sum;
}
@@ -629,8 +654,9 @@ template<class T, unsigned M, unsigned N> class Matrix {
inline Matrix()
{
- for (unsigned int i = 0; i < _SIZE; i++)
+ for (unsigned int i = 0; i < _SIZE; i++) {
this->_coord[i] = 0;
+ }
}
~Matrix()
@@ -641,21 +667,24 @@ template<class T, unsigned M, unsigned N> class Matrix {
template<class U> explicit inline Matrix(const U tab[_SIZE])
{
- for (unsigned int i = 0; i < _SIZE; i++)
+ for (unsigned int i = 0; i < _SIZE; i++) {
this->_coord[i] = tab[i];
+ }
}
template<class U> explicit inline Matrix(const std::vector<U> &tab)
{
- for (unsigned int i = 0; i < _SIZE; i++)
+ for (unsigned int i = 0; i < _SIZE; i++) {
this->_coord[i] = tab[i];
+ }
}
template<class U> inline Matrix(const Matrix<U, M, N> &m)
{
for (unsigned int i = 0; i < M; i++) {
- for (unsigned int j = 0; j < N; j++)
+ for (unsigned int j = 0; j < N; j++) {
this->_coord[i * N + j] = (T)m(i, j);
+ }
}
}
@@ -683,8 +712,9 @@ template<class T, unsigned M, unsigned N> class Matrix {
{
Matrix<T, N, M> res;
for (unsigned int i = 0; i < M; i++) {
- for (unsigned int j = 0; j < N; j++)
+ for (unsigned int j = 0; j < N; j++) {
res(j, i) = this->_coord[i * N + j];
+ }
}
*this = res;
return *this;
@@ -694,8 +724,9 @@ template<class T, unsigned M, unsigned N> class Matrix {
{
if (this != &m) {
for (unsigned int i = 0; i < M; i++) {
- for (unsigned int j = 0; j < N; j++)
+ for (unsigned int j = 0; j < N; j++) {
this->_coord[i * N + j] = (T)m(i, j);
+ }
}
}
return *this;
@@ -704,8 +735,9 @@ template<class T, unsigned M, unsigned N> class Matrix {
template<class U> inline Matrix<T, M, N> &operator+=(const Matrix<U, M, N> &m)
{
for (unsigned int i = 0; i < M; i++) {
- for (unsigned int j = 0; j < N; j++)
+ for (unsigned int j = 0; j < N; j++) {
this->_coord[i * N + j] += (T)m(i, j);
+ }
}
return *this;
}
@@ -713,8 +745,9 @@ template<class T, unsigned M, unsigned N> class Matrix {
template<class U> inline Matrix<T, M, N> &operator-=(const Matrix<U, M, N> &m)
{
for (unsigned int i = 0; i < M; i++) {
- for (unsigned int j = 0; j < N; j++)
+ for (unsigned int j = 0; j < N; j++) {
this->_coord[i * N + j] -= (T)m(i, j);
+ }
}
return *this;
}
@@ -722,8 +755,9 @@ template<class T, unsigned M, unsigned N> class Matrix {
template<class U> inline Matrix<T, M, N> &operator*=(const U lambda)
{
for (unsigned int i = 0; i < M; i++) {
- for (unsigned int j = 0; j < N; j++)
+ for (unsigned int j = 0; j < N; j++) {
this->_coord[i * N + j] *= lambda;
+ }
}
return *this;
}
@@ -732,8 +766,9 @@ template<class T, unsigned M, unsigned N> class Matrix {
{
if (lambda) {
for (unsigned int i = 0; i < M; i++) {
- for (unsigned int j = 0; j < N; j++)
+ for (unsigned int j = 0; j < N; j++) {
this->_coord[i * N + j] /= lambda;
+ }
}
}
return *this;
@@ -782,8 +817,9 @@ template<class T, unsigned N> class SquareMatrix : public Matrix<T, N, N> {
static inline SquareMatrix<T, N> identity()
{
SquareMatrix<T, N> res;
- for (unsigned int i = 0; i < N; i++)
+ for (unsigned int i = 0; i < N; i++) {
res(i, i) = 1;
+ }
return res;
}
};
@@ -861,8 +897,9 @@ template<class T, unsigned N> inline std::ostream &operator<<(std::ostream &s, c
{
unsigned int i;
s << "[";
- for (i = 0; i < N - 1; i++)
+ for (i = 0; i < N - 1; i++) {
s << v[i] << ", ";
+ }
s << v[i] << "]";
return s;
}
@@ -925,8 +962,9 @@ inline Matrix<T, M, P> operator*(const Matrix<T, M, N> &m1, const Matrix<T, N, P
for (j = 0; j < P; j++) {
for (k = 0; k < N; k++) {
scale = m2(k, j);
- for (i = 0; i < N; i++)
+ for (i = 0; i < N; i++) {
res(i, j) += m1(i, k) * scale;
+ }
}
}
return res;
@@ -940,8 +978,9 @@ inline Vec<T, M> operator*(const Matrix<T, M, N> &m, const Vec<T, N> &v)
for (unsigned int j = 0; j < M; j++) {
scale = v[j];
- for (unsigned int i = 0; i < N; i++)
+ for (unsigned int i = 0; i < N; i++) {
res[i] += m(i, j) * scale;
+ }
}
return res;
}
@@ -953,8 +992,9 @@ inline std::ostream &operator<<(std::ostream &s, const Matrix<T, M, N> &m)
unsigned int i, j;
for (i = 0; i < M; i++) {
s << "[";
- for (j = 0; j < N - 1; j++)
+ for (j = 0; j < N - 1; j++) {
s << m(i, j) << ", ";
+ }
s << m(i, j) << "]" << std::endl;
}
return s;
diff --git a/source/blender/freestyle/intern/image/GaussianFilter.cpp b/source/blender/freestyle/intern/image/GaussianFilter.cpp
index 8a14fe4e6dd..87e2caee8a9 100644
--- a/source/blender/freestyle/intern/image/GaussianFilter.cpp
+++ b/source/blender/freestyle/intern/image/GaussianFilter.cpp
@@ -63,8 +63,9 @@ GaussianFilter::~GaussianFilter()
int GaussianFilter::computeMaskSize(float sigma)
{
int maskSize = (int)floor(4 * sigma) + 1;
- if (0 == (maskSize % 2))
+ if (0 == (maskSize % 2)) {
++maskSize;
+ }
return maskSize;
}
diff --git a/source/blender/freestyle/intern/image/GaussianFilter.h b/source/blender/freestyle/intern/image/GaussianFilter.h
index e6824fcb81e..f933e66dc94 100644
--- a/source/blender/freestyle/intern/image/GaussianFilter.h
+++ b/source/blender/freestyle/intern/image/GaussianFilter.h
@@ -134,11 +134,13 @@ template<class Map> float GaussianFilter::getSmoothedPixel(Map *map, int x, int
// Current pixel is x,y
// Sum surrounding pixels L value:
for (int i = -_bound; i <= _bound; ++i) {
- if ((y + i < 0) || (y + i >= h))
+ if ((y + i < 0) || (y + i >= h)) {
continue;
+ }
for (int j = -_bound; j <= _bound; ++j) {
- if ((x + j < 0) || (x + j >= w))
+ if ((x + j < 0) || (x + j >= w)) {
continue;
+ }
float tmpL = map->pixel(x + j, y + i);
float m = _mask[abs(i) * _storedMaskSize + abs(j)];
diff --git a/source/blender/freestyle/intern/image/Image.h b/source/blender/freestyle/intern/image/Image.h
index b854e411a83..c42e47a670b 100644
--- a/source/blender/freestyle/intern/image/Image.h
+++ b/source/blender/freestyle/intern/image/Image.h
@@ -238,8 +238,9 @@ class RGBImage : public FrsImage {
virtual ~RGBImage()
{
- if (_rgb)
+ if (_rgb) {
delete[] _rgb;
+ }
}
inline float getR(unsigned x, unsigned y) const
@@ -376,8 +377,9 @@ class GrayImage : public FrsImage {
virtual ~GrayImage()
{
- if (_lvl)
+ if (_lvl) {
delete[] _lvl;
+ }
}
inline void setPixel(unsigned x, unsigned y, float v)
diff --git a/source/blender/freestyle/intern/image/ImagePyramid.cpp b/source/blender/freestyle/intern/image/ImagePyramid.cpp
index e5b4053fbf4..2f12081eb76 100644
--- a/source/blender/freestyle/intern/image/ImagePyramid.cpp
+++ b/source/blender/freestyle/intern/image/ImagePyramid.cpp
@@ -71,10 +71,12 @@ float ImagePyramid::pixel(int x, int y, int level)
unsigned int i = 1 << level;
unsigned int sx = x >> level;
unsigned int sy = y >> level;
- if (sx >= img->width())
+ if (sx >= img->width()) {
sx = img->width() - 1;
- if (sy >= img->height())
+ }
+ if (sy >= img->height()) {
sy = img->height() - 1;
+ }
// bilinear interpolation
float A = i * (sx + 1) - x;
@@ -85,8 +87,9 @@ float ImagePyramid::pixel(int x, int y, int level)
float P1(0), P2(0);
P1 = A * img->pixel(sx, sy);
if (sx < img->width() - 1) {
- if (x % i != 0)
+ if (x % i != 0) {
P1 += B * img->pixel(sx + 1, sy);
+ }
}
else {
P1 += B * img->pixel(sx, sy);
@@ -95,8 +98,9 @@ float ImagePyramid::pixel(int x, int y, int level)
if (y % i != 0) {
P2 = A * img->pixel(sx, sy + 1);
if (sx < img->width() - 1) {
- if (x % i != 0)
+ if (x % i != 0) {
P2 += B * img->pixel(sx + 1, sy + 1);
+ }
}
else {
P2 += B * img->pixel(sx, sy + 1);
diff --git a/source/blender/freestyle/intern/python/BPy_BBox.cpp b/source/blender/freestyle/intern/python/BPy_BBox.cpp
index 1f26cb51e01..17a0e53876e 100644
--- a/source/blender/freestyle/intern/python/BPy_BBox.cpp
+++ b/source/blender/freestyle/intern/python/BPy_BBox.cpp
@@ -29,11 +29,13 @@ extern "C" {
//-------------------MODULE INITIALIZATION--------------------------------
int BBox_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&BBox_Type) < 0)
+ if (PyType_Ready(&BBox_Type) < 0) {
return -1;
+ }
Py_INCREF(&BBox_Type);
PyModule_AddObject(module, "BBox", (PyObject *)&BBox_Type);
@@ -53,8 +55,9 @@ static int BBox_init(BPy_BBox *self, PyObject *args, PyObject *kwds)
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->bb = new BBox<Vec3r>();
return 0;
}
diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp
index 6d3c91ed347..ee207e06b35 100644
--- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp
@@ -32,11 +32,13 @@ extern "C" {
//-------------------MODULE INITIALIZATION--------------------------------
int BinaryPredicate0D_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&BinaryPredicate0D_Type) < 0)
+ if (PyType_Ready(&BinaryPredicate0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&BinaryPredicate0D_Type);
PyModule_AddObject(module, "BinaryPredicate0D", (PyObject *)&BinaryPredicate0D_Type);
@@ -72,8 +74,9 @@ static int BinaryPredicate0D___init__(BPy_BinaryPredicate0D *self, PyObject *arg
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->bp0D = new BinaryPredicate0D();
self->bp0D->py_bp0D = (PyObject *)self;
return 0;
@@ -81,8 +84,9 @@ static int BinaryPredicate0D___init__(BPy_BinaryPredicate0D *self, PyObject *arg
static void BinaryPredicate0D___dealloc__(BPy_BinaryPredicate0D *self)
{
- if (self->bp0D)
+ if (self->bp0D) {
delete self->bp0D;
+ }
Py_TYPE(self)->tp_free((PyObject *)self);
}
diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp
index 5b3f3945549..647b5522d35 100644
--- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp
@@ -38,36 +38,43 @@ extern "C" {
//-------------------MODULE INITIALIZATION--------------------------------
int BinaryPredicate1D_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&BinaryPredicate1D_Type) < 0)
+ if (PyType_Ready(&BinaryPredicate1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&BinaryPredicate1D_Type);
PyModule_AddObject(module, "BinaryPredicate1D", (PyObject *)&BinaryPredicate1D_Type);
- if (PyType_Ready(&FalseBP1D_Type) < 0)
+ if (PyType_Ready(&FalseBP1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&FalseBP1D_Type);
PyModule_AddObject(module, "FalseBP1D", (PyObject *)&FalseBP1D_Type);
- if (PyType_Ready(&Length2DBP1D_Type) < 0)
+ if (PyType_Ready(&Length2DBP1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&Length2DBP1D_Type);
PyModule_AddObject(module, "Length2DBP1D", (PyObject *)&Length2DBP1D_Type);
- if (PyType_Ready(&SameShapeIdBP1D_Type) < 0)
+ if (PyType_Ready(&SameShapeIdBP1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&SameShapeIdBP1D_Type);
PyModule_AddObject(module, "SameShapeIdBP1D", (PyObject *)&SameShapeIdBP1D_Type);
- if (PyType_Ready(&TrueBP1D_Type) < 0)
+ if (PyType_Ready(&TrueBP1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&TrueBP1D_Type);
PyModule_AddObject(module, "TrueBP1D", (PyObject *)&TrueBP1D_Type);
- if (PyType_Ready(&ViewMapGradientNormBP1D_Type) < 0)
+ if (PyType_Ready(&ViewMapGradientNormBP1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&ViewMapGradientNormBP1D_Type);
PyModule_AddObject(module, "ViewMapGradientNormBP1D", (PyObject *)&ViewMapGradientNormBP1D_Type);
@@ -103,8 +110,9 @@ static int BinaryPredicate1D___init__(BPy_BinaryPredicate1D *self, PyObject *arg
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->bp1D = new BinaryPredicate1D();
self->bp1D->py_bp1D = (PyObject *)self;
return 0;
@@ -112,8 +120,9 @@ static int BinaryPredicate1D___init__(BPy_BinaryPredicate1D *self, PyObject *arg
static void BinaryPredicate1D___dealloc__(BPy_BinaryPredicate1D *self)
{
- if (self->bp1D)
+ if (self->bp1D) {
delete self->bp1D;
+ }
Py_TYPE(self)->tp_free((PyObject *)self);
}
diff --git a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp
index a2e483dec7e..e838bade64a 100644
--- a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp
+++ b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp
@@ -116,8 +116,9 @@ static PyObject *ContextFunctions_load_map(PyObject * /*self*/, PyObject *args,
float sigma = 1.0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "ss|If", (char **)kwlist, &fileName, &mapName, &nbLevels, &sigma))
+ args, kwds, "ss|If", (char **)kwlist, &fileName, &mapName, &nbLevels, &sigma)) {
return NULL;
+ }
ContextFunctions::LoadMapCF(fileName, mapName, nbLevels, sigma);
Py_RETURN_NONE;
}
@@ -150,8 +151,10 @@ static PyObject *ContextFunctions_read_map_pixel(PyObject * /*self*/,
int level;
unsigned x, y;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "siII", (char **)kwlist, &mapName, &level, &x, &y))
+ if (!PyArg_ParseTupleAndKeywords(
+ args, kwds, "siII", (char **)kwlist, &mapName, &level, &x, &y)) {
return NULL;
+ }
return PyFloat_FromDouble(ContextFunctions::ReadMapPixelCF(mapName, level, x, y));
}
@@ -180,8 +183,9 @@ static PyObject *ContextFunctions_read_complete_view_map_pixel(PyObject * /*self
int level;
unsigned x, y;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "iII", (char **)kwlist, &level, &x, &y))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "iII", (char **)kwlist, &level, &x, &y)) {
return NULL;
+ }
return PyFloat_FromDouble(ContextFunctions::ReadCompleteViewMapPixelCF(level, x, y));
}
@@ -214,8 +218,9 @@ static PyObject *ContextFunctions_read_directional_view_map_pixel(PyObject * /*s
unsigned x, y;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "iiII", (char **)kwlist, &orientation, &level, &x, &y))
+ args, kwds, "iiII", (char **)kwlist, &orientation, &level, &x, &y)) {
return NULL;
+ }
return PyFloat_FromDouble(
ContextFunctions::ReadDirectionalViewMapPixelCF(orientation, level, x, y));
}
@@ -231,8 +236,9 @@ static char ContextFunctions_get_selected_fedge___doc__[] =
static PyObject *ContextFunctions_get_selected_fedge(PyObject * /*self*/)
{
FEdge *fe = ContextFunctions::GetSelectedFEdgeCF();
- if (fe)
+ if (fe) {
return Any_BPy_FEdge_from_FEdge(*fe);
+ }
Py_RETURN_NONE;
}
@@ -298,12 +304,14 @@ int ContextFunctions_Init(PyObject *module)
{
PyObject *m;
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
m = PyModule_Create(&module_definition);
- if (m == NULL)
+ if (m == NULL) {
return -1;
+ }
Py_INCREF(m);
PyModule_AddObject(module, "ContextFunctions", m);
diff --git a/source/blender/freestyle/intern/python/BPy_Convert.cpp b/source/blender/freestyle/intern/python/BPy_Convert.cpp
index d22061d1610..ab8d77e8194 100644
--- a/source/blender/freestyle/intern/python/BPy_Convert.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Convert.cpp
@@ -527,47 +527,60 @@ Nature::EdgeNature EdgeNature_from_BPy_Nature(PyObject *obj)
bool Vec2f_ptr_from_PyObject(PyObject *obj, Vec2f &vec)
{
- if (Vec2f_ptr_from_Vector(obj, vec))
+ if (Vec2f_ptr_from_Vector(obj, vec)) {
return true;
- if (Vec2f_ptr_from_PyList(obj, vec))
+ }
+ if (Vec2f_ptr_from_PyList(obj, vec)) {
return true;
- if (Vec2f_ptr_from_PyTuple(obj, vec))
+ }
+ if (Vec2f_ptr_from_PyTuple(obj, vec)) {
return true;
+ }
return false;
}
bool Vec3f_ptr_from_PyObject(PyObject *obj, Vec3f &vec)
{
- if (Vec3f_ptr_from_Vector(obj, vec))
+ if (Vec3f_ptr_from_Vector(obj, vec)) {
return true;
- if (Vec3f_ptr_from_Color(obj, vec))
+ }
+ if (Vec3f_ptr_from_Color(obj, vec)) {
return true;
- if (Vec3f_ptr_from_PyList(obj, vec))
+ }
+ if (Vec3f_ptr_from_PyList(obj, vec)) {
return true;
- if (Vec3f_ptr_from_PyTuple(obj, vec))
+ }
+ if (Vec3f_ptr_from_PyTuple(obj, vec)) {
return true;
+ }
return false;
}
bool Vec3r_ptr_from_PyObject(PyObject *obj, Vec3r &vec)
{
- if (Vec3r_ptr_from_Vector(obj, vec))
+ if (Vec3r_ptr_from_Vector(obj, vec)) {
return true;
- if (Vec3r_ptr_from_Color(obj, vec))
+ }
+ if (Vec3r_ptr_from_Color(obj, vec)) {
return true;
- if (Vec3r_ptr_from_PyList(obj, vec))
+ }
+ if (Vec3r_ptr_from_PyList(obj, vec)) {
return true;
- if (Vec3r_ptr_from_PyTuple(obj, vec))
+ }
+ if (Vec3r_ptr_from_PyTuple(obj, vec)) {
return true;
+ }
return false;
}
bool Vec2f_ptr_from_Vector(PyObject *obj, Vec2f &vec)
{
- if (!VectorObject_Check(obj) || ((VectorObject *)obj)->size != 2)
+ if (!VectorObject_Check(obj) || ((VectorObject *)obj)->size != 2) {
return false;
- if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1)
+ }
+ if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1) {
return false;
+ }
vec[0] = ((VectorObject *)obj)->vec[0];
vec[1] = ((VectorObject *)obj)->vec[1];
return true;
@@ -575,10 +588,12 @@ bool Vec2f_ptr_from_Vector(PyObject *obj, Vec2f &vec)
bool Vec3f_ptr_from_Vector(PyObject *obj, Vec3f &vec)
{
- if (!VectorObject_Check(obj) || ((VectorObject *)obj)->size != 3)
+ if (!VectorObject_Check(obj) || ((VectorObject *)obj)->size != 3) {
return false;
- if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1)
+ }
+ if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1) {
return false;
+ }
vec[0] = ((VectorObject *)obj)->vec[0];
vec[1] = ((VectorObject *)obj)->vec[1];
vec[2] = ((VectorObject *)obj)->vec[2];
@@ -587,10 +602,12 @@ bool Vec3f_ptr_from_Vector(PyObject *obj, Vec3f &vec)
bool Vec3r_ptr_from_Vector(PyObject *obj, Vec3r &vec)
{
- if (!VectorObject_Check(obj) || ((VectorObject *)obj)->size != 3)
+ if (!VectorObject_Check(obj) || ((VectorObject *)obj)->size != 3) {
return false;
- if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1)
+ }
+ if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1) {
return false;
+ }
vec[0] = ((VectorObject *)obj)->vec[0];
vec[1] = ((VectorObject *)obj)->vec[1];
vec[2] = ((VectorObject *)obj)->vec[2];
@@ -599,10 +616,12 @@ bool Vec3r_ptr_from_Vector(PyObject *obj, Vec3r &vec)
bool Vec3f_ptr_from_Color(PyObject *obj, Vec3f &vec)
{
- if (!ColorObject_Check(obj))
+ if (!ColorObject_Check(obj)) {
return false;
- if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1)
+ }
+ if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1) {
return false;
+ }
vec[0] = ((ColorObject *)obj)->col[0];
vec[1] = ((ColorObject *)obj)->col[1];
vec[2] = ((ColorObject *)obj)->col[2];
@@ -611,10 +630,12 @@ bool Vec3f_ptr_from_Color(PyObject *obj, Vec3f &vec)
bool Vec3r_ptr_from_Color(PyObject *obj, Vec3r &vec)
{
- if (!ColorObject_Check(obj))
+ if (!ColorObject_Check(obj)) {
return false;
- if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1)
+ }
+ if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1) {
return false;
+ }
vec[0] = ((ColorObject *)obj)->col[0];
vec[1] = ((ColorObject *)obj)->col[1];
vec[2] = ((ColorObject *)obj)->col[2];
@@ -637,10 +658,12 @@ bool Vec2f_ptr_from_PyList(PyObject *obj, Vec2f &vec)
{
float v[2];
- if (!PyList_Check(obj) || PyList_GET_SIZE(obj) != 2)
+ if (!PyList_Check(obj) || PyList_GET_SIZE(obj) != 2) {
return false;
- if (!float_array_from_PyList(obj, v, 2))
+ }
+ if (!float_array_from_PyList(obj, v, 2)) {
return false;
+ }
vec[0] = v[0];
vec[1] = v[1];
return true;
@@ -650,10 +673,12 @@ bool Vec3f_ptr_from_PyList(PyObject *obj, Vec3f &vec)
{
float v[3];
- if (!PyList_Check(obj) || PyList_GET_SIZE(obj) != 3)
+ if (!PyList_Check(obj) || PyList_GET_SIZE(obj) != 3) {
return false;
- if (!float_array_from_PyList(obj, v, 3))
+ }
+ if (!float_array_from_PyList(obj, v, 3)) {
return false;
+ }
vec[0] = v[0];
vec[1] = v[1];
vec[2] = v[2];
@@ -664,10 +689,12 @@ bool Vec3r_ptr_from_PyList(PyObject *obj, Vec3r &vec)
{
float v[3];
- if (!PyList_Check(obj) || PyList_GET_SIZE(obj) != 3)
+ if (!PyList_Check(obj) || PyList_GET_SIZE(obj) != 3) {
return false;
- if (!float_array_from_PyList(obj, v, 3))
+ }
+ if (!float_array_from_PyList(obj, v, 3)) {
return false;
+ }
vec[0] = v[0];
vec[1] = v[1];
vec[2] = v[2];
@@ -690,10 +717,12 @@ bool Vec2f_ptr_from_PyTuple(PyObject *obj, Vec2f &vec)
{
float v[2];
- if (!PyTuple_Check(obj) || PyTuple_GET_SIZE(obj) != 2)
+ if (!PyTuple_Check(obj) || PyTuple_GET_SIZE(obj) != 2) {
return false;
- if (!float_array_from_PyTuple(obj, v, 2))
+ }
+ if (!float_array_from_PyTuple(obj, v, 2)) {
return false;
+ }
vec[0] = v[0];
vec[1] = v[1];
return true;
@@ -703,10 +732,12 @@ bool Vec3f_ptr_from_PyTuple(PyObject *obj, Vec3f &vec)
{
float v[3];
- if (!PyTuple_Check(obj) || PyTuple_GET_SIZE(obj) != 3)
+ if (!PyTuple_Check(obj) || PyTuple_GET_SIZE(obj) != 3) {
return false;
- if (!float_array_from_PyTuple(obj, v, 3))
+ }
+ if (!float_array_from_PyTuple(obj, v, 3)) {
return false;
+ }
vec[0] = v[0];
vec[1] = v[1];
vec[2] = v[2];
@@ -717,10 +748,12 @@ bool Vec3r_ptr_from_PyTuple(PyObject *obj, Vec3r &vec)
{
float v[3];
- if (!PyTuple_Check(obj) || PyTuple_GET_SIZE(obj) != 3)
+ if (!PyTuple_Check(obj) || PyTuple_GET_SIZE(obj) != 3) {
return false;
- if (!float_array_from_PyTuple(obj, v, 3))
+ }
+ if (!float_array_from_PyTuple(obj, v, 3)) {
return false;
+ }
vec[0] = v[0];
vec[1] = v[1];
vec[2] = v[2];
@@ -732,17 +765,21 @@ bool Vec3r_ptr_from_PyTuple(PyObject *obj, Vec3r &vec)
bool float_array_from_PyObject(PyObject *obj, float *v, int n)
{
if (VectorObject_Check(obj) && ((VectorObject *)obj)->size == n) {
- if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1)
+ if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1) {
return 0;
- for (int i = 0; i < n; i++)
+ }
+ for (int i = 0; i < n; i++) {
v[i] = ((VectorObject *)obj)->vec[i];
+ }
return 1;
}
else if (ColorObject_Check(obj) && n == 3) {
- if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1)
+ if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1) {
return 0;
- for (int i = 0; i < n; i++)
+ }
+ for (int i = 0; i < n; i++) {
v[i] = ((ColorObject *)obj)->col[i];
+ }
return 1;
}
else if (PyList_Check(obj) && PyList_GET_SIZE(obj) == n) {
diff --git a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp
index 0b543c06ba6..71cdbafba45 100644
--- a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp
@@ -83,42 +83,60 @@ static PyObject *Freestyle_getCurrentScene(PyObject * /*self*/)
static int ramp_blend_type(const char *type)
{
- if (STREQ(type, "MIX"))
+ if (STREQ(type, "MIX")) {
return MA_RAMP_BLEND;
- if (STREQ(type, "ADD"))
+ }
+ if (STREQ(type, "ADD")) {
return MA_RAMP_ADD;
- if (STREQ(type, "MULTIPLY"))
+ }
+ if (STREQ(type, "MULTIPLY")) {
return MA_RAMP_MULT;
- if (STREQ(type, "SUBTRACT"))
+ }
+ if (STREQ(type, "SUBTRACT")) {
return MA_RAMP_SUB;
- if (STREQ(type, "SCREEN"))
+ }
+ if (STREQ(type, "SCREEN")) {
return MA_RAMP_SCREEN;
- if (STREQ(type, "DIVIDE"))
+ }
+ if (STREQ(type, "DIVIDE")) {
return MA_RAMP_DIV;
- if (STREQ(type, "DIFFERENCE"))
+ }
+ if (STREQ(type, "DIFFERENCE")) {
return MA_RAMP_DIFF;
- if (STREQ(type, "DARKEN"))
+ }
+ if (STREQ(type, "DARKEN")) {
return MA_RAMP_DARK;
- if (STREQ(type, "LIGHTEN"))
+ }
+ if (STREQ(type, "LIGHTEN")) {
return MA_RAMP_LIGHT;
- if (STREQ(type, "OVERLAY"))
+ }
+ if (STREQ(type, "OVERLAY")) {
return MA_RAMP_OVERLAY;
- if (STREQ(type, "DODGE"))
+ }
+ if (STREQ(type, "DODGE")) {
return MA_RAMP_DODGE;
- if (STREQ(type, "BURN"))
+ }
+ if (STREQ(type, "BURN")) {
return MA_RAMP_BURN;
- if (STREQ(type, "HUE"))
+ }
+ if (STREQ(type, "HUE")) {
return MA_RAMP_HUE;
- if (STREQ(type, "SATURATION"))
+ }
+ if (STREQ(type, "SATURATION")) {
return MA_RAMP_SAT;
- if (STREQ(type, "VALUE"))
+ }
+ if (STREQ(type, "VALUE")) {
return MA_RAMP_VAL;
- if (STREQ(type, "COLOR"))
+ }
+ if (STREQ(type, "COLOR")) {
return MA_RAMP_COLOR;
- if (STREQ(type, "SOFT_LIGHT"))
+ }
+ if (STREQ(type, "SOFT_LIGHT")) {
return MA_RAMP_SOFT;
- if (STREQ(type, "LINEAR_LIGHT"))
+ }
+ if (STREQ(type, "LINEAR_LIGHT")) {
return MA_RAMP_LINEAR;
+ }
return -1;
}
@@ -147,8 +165,9 @@ static PyObject *Freestyle_blendRamp(PyObject * /*self*/, PyObject *args)
int type;
float a[3], fac, b[3];
- if (!PyArg_ParseTuple(args, "sOfO", &s, &obj1, &fac, &obj2))
+ if (!PyArg_ParseTuple(args, "sOfO", &s, &obj1, &fac, &obj2)) {
return NULL;
+ }
type = ramp_blend_type(s);
if (type < 0) {
PyErr_SetString(PyExc_TypeError, "argument 1 is an unknown ramp blend type");
@@ -194,8 +213,9 @@ static PyObject *Freestyle_evaluateColorRamp(PyObject * /*self*/, PyObject *args
ColorBand *coba;
float in, out[4];
- if (!(PyArg_ParseTuple(args, "O!f", &pyrna_struct_Type, &py_srna, &in)))
+ if (!(PyArg_ParseTuple(args, "O!f", &pyrna_struct_Type, &py_srna, &in))) {
return NULL;
+ }
if (!RNA_struct_is_a(py_srna->ptr.type, &RNA_ColorRamp)) {
PyErr_SetString(PyExc_TypeError, "1st argument is not a ColorRamp object");
return NULL;
@@ -232,8 +252,9 @@ static PyObject *Freestyle_evaluateCurveMappingF(PyObject * /*self*/, PyObject *
int cur;
float value;
- if (!(PyArg_ParseTuple(args, "O!if", &pyrna_struct_Type, &py_srna, &cur, &value)))
+ if (!(PyArg_ParseTuple(args, "O!if", &pyrna_struct_Type, &py_srna, &cur, &value))) {
return NULL;
+ }
if (!RNA_struct_is_a(py_srna->ptr.type, &RNA_CurveMapping)) {
PyErr_SetString(PyExc_TypeError, "1st argument is not a CurveMapping object");
return NULL;
@@ -514,8 +535,9 @@ PyObject *Freestyle_Init(void)
// initialize modules
module = PyModule_Create(&module_definition);
- if (!module)
+ if (!module) {
return NULL;
+ }
PyDict_SetItemString(PySys_GetObject("modules"), module_definition.m_name, module);
// update 'sys.path' for Freestyle Python API modules
diff --git a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp
index 3ede6823062..b1d44a55fd5 100644
--- a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp
+++ b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp
@@ -33,11 +33,13 @@ extern "C" {
//-------------------MODULE INITIALIZATION--------------------------------
int FrsMaterial_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&FrsMaterial_Type) < 0)
+ if (PyType_Ready(&FrsMaterial_Type) < 0) {
return -1;
+ }
Py_INCREF(&FrsMaterial_Type);
PyModule_AddObject(module, "Material", (PyObject *)&FrsMaterial_Type);
@@ -154,8 +156,9 @@ static PyObject *FrsMaterial_repr(BPy_FrsMaterial *self)
static int FrsMaterial_mathutils_check(BaseMathObject *bmo)
{
- if (!BPy_FrsMaterial_Check(bmo->cb_user))
+ if (!BPy_FrsMaterial_Check(bmo->cb_user)) {
return -1;
+ }
return 0;
}
diff --git a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp
index dc8a2ba6105..6bd4ae6b5fe 100644
--- a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp
+++ b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp
@@ -34,11 +34,13 @@ extern "C" {
//-------------------MODULE INITIALIZATION--------------------------------
int FrsNoise_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&FrsNoise_Type) < 0)
+ if (PyType_Ready(&FrsNoise_Type) < 0) {
return -1;
+ }
Py_INCREF(&FrsNoise_Type);
PyModule_AddObject(module, "Noise", (PyObject *)&FrsNoise_Type);
@@ -64,8 +66,9 @@ static int FrsNoise_init(BPy_FrsNoise *self, PyObject *args, PyObject *kwds)
static const char *kwlist[] = {"seed", NULL};
long seed = -1;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "|l", (char **)kwlist, &seed))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|l", (char **)kwlist, &seed)) {
return -1;
+ }
self->n = new Noise(seed);
self->pn = new PseudoNoise();
return 0;
@@ -120,8 +123,9 @@ static PyObject *FrsNoise_turbulence_smooth(BPy_FrsNoise *self, PyObject *args,
double x; // note: this has to be a double (not float)
unsigned nbOctaves = 8;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "d|I", (char **)kwlist, &x, &nbOctaves))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "d|I", (char **)kwlist, &x, &nbOctaves)) {
return NULL;
+ }
return PyFloat_FromDouble(self->pn->turbulenceSmooth(x, nbOctaves));
}
@@ -131,8 +135,9 @@ static PyObject *FrsNoise_turbulence1(BPy_FrsNoise *self, PyObject *args, PyObje
float f1, f2, f3;
unsigned int i = 4;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "fff|I", (char **)kwlist, &f1, &f2, &f3, &i))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "fff|I", (char **)kwlist, &f1, &f2, &f3, &i)) {
return NULL;
+ }
return PyFloat_FromDouble(self->n->turbulence1(f1, f2, f3, i));
}
@@ -160,8 +165,9 @@ static PyObject *FrsNoise_turbulence2(BPy_FrsNoise *self, PyObject *args, PyObje
unsigned int i = 4;
Vec2f vec;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "Off|I", (char **)kwlist, &obj1, &f2, &f3, &i))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "Off|I", (char **)kwlist, &obj1, &f2, &f3, &i)) {
return NULL;
+ }
if (!Vec2f_ptr_from_PyObject(obj1, vec)) {
PyErr_SetString(PyExc_TypeError,
"argument 1 must be a 2D vector (either a list of 2 elements or Vector)");
@@ -195,8 +201,9 @@ static PyObject *FrsNoise_turbulence3(BPy_FrsNoise *self, PyObject *args, PyObje
unsigned int i = 4;
Vec3f vec;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "Off|I", (char **)kwlist, &obj1, &f2, &f3, &i))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "Off|I", (char **)kwlist, &obj1, &f2, &f3, &i)) {
return NULL;
+ }
if (!Vec3f_ptr_from_PyObject(obj1, vec)) {
PyErr_SetString(PyExc_TypeError,
"argument 1 must be a 3D vector (either a list of 3 elements or Vector)");
@@ -221,8 +228,9 @@ static PyObject *FrsNoise_smoothNoise1(BPy_FrsNoise *self, PyObject *args, PyObj
static const char *kwlist[] = {"v", NULL};
float f;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f)) {
return NULL;
+ }
return PyFloat_FromDouble(self->n->smoothNoise1(f));
}
@@ -242,8 +250,9 @@ static PyObject *FrsNoise_smoothNoise2(BPy_FrsNoise *self, PyObject *args, PyObj
PyObject *obj;
Vec2f vec;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj)) {
return NULL;
+ }
if (!Vec2f_ptr_from_PyObject(obj, vec)) {
PyErr_SetString(PyExc_TypeError,
"argument 1 must be a 2D vector (either a list of 2 elements or Vector)");
@@ -269,8 +278,9 @@ static PyObject *FrsNoise_smoothNoise3(BPy_FrsNoise *self, PyObject *args, PyObj
PyObject *obj;
Vec3f vec;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj)) {
return NULL;
+ }
if (!Vec3f_ptr_from_PyObject(obj, vec)) {
PyErr_SetString(PyExc_TypeError,
"argument 1 must be a 3D vector (either a list of 3 elements or Vector)");
diff --git a/source/blender/freestyle/intern/python/BPy_Id.cpp b/source/blender/freestyle/intern/python/BPy_Id.cpp
index 4e2500a4b3d..2c50767c5aa 100644
--- a/source/blender/freestyle/intern/python/BPy_Id.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Id.cpp
@@ -31,11 +31,13 @@ extern "C" {
//-------------------MODULE INITIALIZATION--------------------------------
int Id_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&Id_Type) < 0)
+ if (PyType_Ready(&Id_Type) < 0) {
return -1;
+ }
Py_INCREF(&Id_Type);
PyModule_AddObject(module, "Id", (PyObject *)&Id_Type);
diff --git a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp
index bfd9e5e7898..0286932146c 100644
--- a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp
+++ b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp
@@ -211,11 +211,13 @@ int IntegrationType_Init(PyObject *module)
{
PyObject *m, *d, *f;
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&IntegrationType_Type) < 0)
+ if (PyType_Ready(&IntegrationType_Type) < 0) {
return -1;
+ }
Py_INCREF(&IntegrationType_Type);
PyModule_AddObject(module, "IntegrationType", (PyObject *)&IntegrationType_Type);
@@ -226,8 +228,9 @@ int IntegrationType_Init(PyObject *module)
PyDict_SetItemString(IntegrationType_Type.tp_dict, "LAST", BPy_IntegrationType_LAST);
m = PyModule_Create(&module_definition);
- if (m == NULL)
+ if (m == NULL) {
return -1;
+ }
Py_INCREF(m);
PyModule_AddObject(module, "Integrator", m);
diff --git a/source/blender/freestyle/intern/python/BPy_Interface0D.cpp b/source/blender/freestyle/intern/python/BPy_Interface0D.cpp
index 897f2f06c28..40e5267460b 100644
--- a/source/blender/freestyle/intern/python/BPy_Interface0D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Interface0D.cpp
@@ -39,41 +39,49 @@ extern "C" {
//-------------------MODULE INITIALIZATION--------------------------------
int Interface0D_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&Interface0D_Type) < 0)
+ if (PyType_Ready(&Interface0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&Interface0D_Type);
PyModule_AddObject(module, "Interface0D", (PyObject *)&Interface0D_Type);
- if (PyType_Ready(&CurvePoint_Type) < 0)
+ if (PyType_Ready(&CurvePoint_Type) < 0) {
return -1;
+ }
Py_INCREF(&CurvePoint_Type);
PyModule_AddObject(module, "CurvePoint", (PyObject *)&CurvePoint_Type);
- if (PyType_Ready(&SVertex_Type) < 0)
+ if (PyType_Ready(&SVertex_Type) < 0) {
return -1;
+ }
Py_INCREF(&SVertex_Type);
PyModule_AddObject(module, "SVertex", (PyObject *)&SVertex_Type);
- if (PyType_Ready(&ViewVertex_Type) < 0)
+ if (PyType_Ready(&ViewVertex_Type) < 0) {
return -1;
+ }
Py_INCREF(&ViewVertex_Type);
PyModule_AddObject(module, "ViewVertex", (PyObject *)&ViewVertex_Type);
- if (PyType_Ready(&StrokeVertex_Type) < 0)
+ if (PyType_Ready(&StrokeVertex_Type) < 0) {
return -1;
+ }
Py_INCREF(&StrokeVertex_Type);
PyModule_AddObject(module, "StrokeVertex", (PyObject *)&StrokeVertex_Type);
- if (PyType_Ready(&NonTVertex_Type) < 0)
+ if (PyType_Ready(&NonTVertex_Type) < 0) {
return -1;
+ }
Py_INCREF(&NonTVertex_Type);
PyModule_AddObject(module, "NonTVertex", (PyObject *)&NonTVertex_Type);
- if (PyType_Ready(&TVertex_Type) < 0)
+ if (PyType_Ready(&TVertex_Type) < 0) {
return -1;
+ }
Py_INCREF(&TVertex_Type);
PyModule_AddObject(module, "TVertex", (PyObject *)&TVertex_Type);
@@ -96,8 +104,9 @@ static int Interface0D_init(BPy_Interface0D *self, PyObject *args, PyObject *kwd
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->if0D = new Interface0D();
self->borrowed = false;
return 0;
@@ -105,8 +114,9 @@ static int Interface0D_init(BPy_Interface0D *self, PyObject *args, PyObject *kwd
static void Interface0D_dealloc(BPy_Interface0D *self)
{
- if (self->if0D && !self->borrowed)
+ if (self->if0D && !self->borrowed) {
delete self->if0D;
+ }
Py_TYPE(self)->tp_free((PyObject *)self);
}
@@ -132,13 +142,17 @@ static PyObject *Interface0D_get_fedge(BPy_Interface0D *self, PyObject *args, Py
static const char *kwlist[] = {"inter", NULL};
PyObject *py_if0D;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0D_Type, &py_if0D))
+ if (!PyArg_ParseTupleAndKeywords(
+ args, kwds, "O!", (char **)kwlist, &Interface0D_Type, &py_if0D)) {
return NULL;
+ }
FEdge *fe = self->if0D->getFEdge(*(((BPy_Interface0D *)py_if0D)->if0D));
- if (PyErr_Occurred())
+ if (PyErr_Occurred()) {
return NULL;
- if (fe)
+ }
+ if (fe) {
return Any_BPy_FEdge_from_FEdge(*fe);
+ }
Py_RETURN_NONE;
}
@@ -170,8 +184,9 @@ PyDoc_STRVAR(Interface0D_point_3d_doc,
static PyObject *Interface0D_point_3d_get(BPy_Interface0D *self, void *UNUSED(closure))
{
Vec3f p(self->if0D->getPoint3D());
- if (PyErr_Occurred())
+ if (PyErr_Occurred()) {
return NULL;
+ }
return Vector_from_Vec3f(p);
}
@@ -183,8 +198,9 @@ PyDoc_STRVAR(Interface0D_projected_x_doc,
static PyObject *Interface0D_projected_x_get(BPy_Interface0D *self, void *UNUSED(closure))
{
real x = self->if0D->getProjectedX();
- if (PyErr_Occurred())
+ if (PyErr_Occurred()) {
return NULL;
+ }
return PyFloat_FromDouble(x);
}
@@ -196,8 +212,9 @@ PyDoc_STRVAR(Interface0D_projected_y_doc,
static PyObject *Interface0D_projected_y_get(BPy_Interface0D *self, void *UNUSED(closure))
{
real y = self->if0D->getProjectedY();
- if (PyErr_Occurred())
+ if (PyErr_Occurred()) {
return NULL;
+ }
return PyFloat_FromDouble(y);
}
@@ -209,8 +226,9 @@ PyDoc_STRVAR(Interface0D_projected_z_doc,
static PyObject *Interface0D_projected_z_get(BPy_Interface0D *self, void *UNUSED(closure))
{
real z = self->if0D->getProjectedZ();
- if (PyErr_Occurred())
+ if (PyErr_Occurred()) {
return NULL;
+ }
return PyFloat_FromDouble(z);
}
@@ -222,8 +240,9 @@ PyDoc_STRVAR(Interface0D_point_2d_doc,
static PyObject *Interface0D_point_2d_get(BPy_Interface0D *self, void *UNUSED(closure))
{
Vec2f p(self->if0D->getPoint2D());
- if (PyErr_Occurred())
+ if (PyErr_Occurred()) {
return NULL;
+ }
return Vector_from_Vec2f(p);
}
@@ -235,8 +254,9 @@ PyDoc_STRVAR(Interface0D_id_doc,
static PyObject *Interface0D_id_get(BPy_Interface0D *self, void *UNUSED(closure))
{
Id id(self->if0D->getId());
- if (PyErr_Occurred())
+ if (PyErr_Occurred()) {
return NULL;
+ }
return BPy_Id_from_Id(id); // return a copy
}
@@ -248,8 +268,9 @@ PyDoc_STRVAR(Interface0D_nature_doc,
static PyObject *Interface0D_nature_get(BPy_Interface0D *self, void *UNUSED(closure))
{
Nature::VertexNature nature = self->if0D->getNature();
- if (PyErr_Occurred())
+ if (PyErr_Occurred()) {
return NULL;
+ }
return BPy_Nature_from_Nature(nature);
}
diff --git a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp
index 09e27da9eeb..ca14a473216 100644
--- a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp
@@ -40,41 +40,49 @@ extern "C" {
//-------------------MODULE INITIALIZATION--------------------------------
int Interface1D_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&Interface1D_Type) < 0)
+ if (PyType_Ready(&Interface1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&Interface1D_Type);
PyModule_AddObject(module, "Interface1D", (PyObject *)&Interface1D_Type);
- if (PyType_Ready(&FrsCurve_Type) < 0)
+ if (PyType_Ready(&FrsCurve_Type) < 0) {
return -1;
+ }
Py_INCREF(&FrsCurve_Type);
PyModule_AddObject(module, "Curve", (PyObject *)&FrsCurve_Type);
- if (PyType_Ready(&Chain_Type) < 0)
+ if (PyType_Ready(&Chain_Type) < 0) {
return -1;
+ }
Py_INCREF(&Chain_Type);
PyModule_AddObject(module, "Chain", (PyObject *)&Chain_Type);
- if (PyType_Ready(&FEdge_Type) < 0)
+ if (PyType_Ready(&FEdge_Type) < 0) {
return -1;
+ }
Py_INCREF(&FEdge_Type);
PyModule_AddObject(module, "FEdge", (PyObject *)&FEdge_Type);
- if (PyType_Ready(&FEdgeSharp_Type) < 0)
+ if (PyType_Ready(&FEdgeSharp_Type) < 0) {
return -1;
+ }
Py_INCREF(&FEdgeSharp_Type);
PyModule_AddObject(module, "FEdgeSharp", (PyObject *)&FEdgeSharp_Type);
- if (PyType_Ready(&FEdgeSmooth_Type) < 0)
+ if (PyType_Ready(&FEdgeSmooth_Type) < 0) {
return -1;
+ }
Py_INCREF(&FEdgeSmooth_Type);
PyModule_AddObject(module, "FEdgeSmooth", (PyObject *)&FEdgeSmooth_Type);
- if (PyType_Ready(&Stroke_Type) < 0)
+ if (PyType_Ready(&Stroke_Type) < 0) {
return -1;
+ }
Py_INCREF(&Stroke_Type);
PyModule_AddObject(module, "Stroke", (PyObject *)&Stroke_Type);
@@ -82,8 +90,9 @@ int Interface1D_Init(PyObject *module)
PyDict_SetItemString(Stroke_Type.tp_dict, "HUMID_MEDIUM", BPy_MediumType_HUMID_MEDIUM);
PyDict_SetItemString(Stroke_Type.tp_dict, "OPAQUE_MEDIUM", BPy_MediumType_OPAQUE_MEDIUM);
- if (PyType_Ready(&ViewEdge_Type) < 0)
+ if (PyType_Ready(&ViewEdge_Type) < 0) {
return -1;
+ }
Py_INCREF(&ViewEdge_Type);
PyModule_AddObject(module, "ViewEdge", (PyObject *)&ViewEdge_Type);
@@ -106,8 +115,9 @@ static int Interface1D_init(BPy_Interface1D *self, PyObject *args, PyObject *kwd
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->if1D = new Interface1D();
self->borrowed = false;
return 0;
@@ -115,8 +125,9 @@ static int Interface1D_init(BPy_Interface1D *self, PyObject *args, PyObject *kwd
static void Interface1D_dealloc(BPy_Interface1D *self)
{
- if (self->if1D && !self->borrowed)
+ if (self->if1D && !self->borrowed) {
delete self->if1D;
+ }
Py_TYPE(self)->tp_free((PyObject *)self);
}
@@ -175,8 +186,9 @@ static PyObject *Interface1D_points_begin(BPy_Interface1D *self, PyObject *args,
static const char *kwlist[] = {"t", NULL};
float f = 0.0f;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f)) {
return NULL;
+ }
Interface0DIterator if0D_it(self->if1D->pointsBegin(f));
return BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, false);
}
@@ -200,8 +212,9 @@ static PyObject *Interface1D_points_end(BPy_Interface1D *self, PyObject *args, P
static const char *kwlist[] = {"t", NULL};
float f = 0.0f;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f)) {
return NULL;
+ }
Interface0DIterator if0D_it(self->if1D->pointsEnd(f));
return BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, true);
}
@@ -246,8 +259,9 @@ PyDoc_STRVAR(Interface1D_id_doc,
static PyObject *Interface1D_id_get(BPy_Interface1D *self, void *UNUSED(closure))
{
Id id(self->if1D->getId());
- if (PyErr_Occurred())
+ if (PyErr_Occurred()) {
return NULL;
+ }
return BPy_Id_from_Id(id); // return a copy
}
@@ -259,8 +273,9 @@ PyDoc_STRVAR(Interface1D_nature_doc,
static PyObject *Interface1D_nature_get(BPy_Interface1D *self, void *UNUSED(closure))
{
Nature::VertexNature nature = self->if1D->getNature();
- if (PyErr_Occurred())
+ if (PyErr_Occurred()) {
return NULL;
+ }
return BPy_Nature_from_Nature(nature);
}
@@ -272,8 +287,9 @@ PyDoc_STRVAR(Interface1D_length_2d_doc,
static PyObject *Interface1D_length_2d_get(BPy_Interface1D *self, void *UNUSED(closure))
{
real length = self->if1D->getLength2D();
- if (PyErr_Occurred())
+ if (PyErr_Occurred()) {
return NULL;
+ }
return PyFloat_FromDouble((double)length);
}
diff --git a/source/blender/freestyle/intern/python/BPy_Iterator.cpp b/source/blender/freestyle/intern/python/BPy_Iterator.cpp
index dfeaf9ac328..10417c07f33 100644
--- a/source/blender/freestyle/intern/python/BPy_Iterator.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Iterator.cpp
@@ -41,62 +41,74 @@ extern "C" {
//-------------------MODULE INITIALIZATION--------------------------------
int Iterator_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&Iterator_Type) < 0)
+ if (PyType_Ready(&Iterator_Type) < 0) {
return -1;
+ }
Py_INCREF(&Iterator_Type);
PyModule_AddObject(module, "Iterator", (PyObject *)&Iterator_Type);
- if (PyType_Ready(&AdjacencyIterator_Type) < 0)
+ if (PyType_Ready(&AdjacencyIterator_Type) < 0) {
return -1;
+ }
Py_INCREF(&AdjacencyIterator_Type);
PyModule_AddObject(module, "AdjacencyIterator", (PyObject *)&AdjacencyIterator_Type);
- if (PyType_Ready(&Interface0DIterator_Type) < 0)
+ if (PyType_Ready(&Interface0DIterator_Type) < 0) {
return -1;
+ }
Py_INCREF(&Interface0DIterator_Type);
PyModule_AddObject(module, "Interface0DIterator", (PyObject *)&Interface0DIterator_Type);
- if (PyType_Ready(&CurvePointIterator_Type) < 0)
+ if (PyType_Ready(&CurvePointIterator_Type) < 0) {
return -1;
+ }
Py_INCREF(&CurvePointIterator_Type);
PyModule_AddObject(module, "CurvePointIterator", (PyObject *)&CurvePointIterator_Type);
- if (PyType_Ready(&StrokeVertexIterator_Type) < 0)
+ if (PyType_Ready(&StrokeVertexIterator_Type) < 0) {
return -1;
+ }
Py_INCREF(&StrokeVertexIterator_Type);
PyModule_AddObject(module, "StrokeVertexIterator", (PyObject *)&StrokeVertexIterator_Type);
- if (PyType_Ready(&SVertexIterator_Type) < 0)
+ if (PyType_Ready(&SVertexIterator_Type) < 0) {
return -1;
+ }
Py_INCREF(&SVertexIterator_Type);
PyModule_AddObject(module, "SVertexIterator", (PyObject *)&SVertexIterator_Type);
- if (PyType_Ready(&orientedViewEdgeIterator_Type) < 0)
+ if (PyType_Ready(&orientedViewEdgeIterator_Type) < 0) {
return -1;
+ }
Py_INCREF(&orientedViewEdgeIterator_Type);
PyModule_AddObject(
module, "orientedViewEdgeIterator", (PyObject *)&orientedViewEdgeIterator_Type);
- if (PyType_Ready(&ViewEdgeIterator_Type) < 0)
+ if (PyType_Ready(&ViewEdgeIterator_Type) < 0) {
return -1;
+ }
Py_INCREF(&ViewEdgeIterator_Type);
PyModule_AddObject(module, "ViewEdgeIterator", (PyObject *)&ViewEdgeIterator_Type);
- if (PyType_Ready(&ChainingIterator_Type) < 0)
+ if (PyType_Ready(&ChainingIterator_Type) < 0) {
return -1;
+ }
Py_INCREF(&ChainingIterator_Type);
PyModule_AddObject(module, "ChainingIterator", (PyObject *)&ChainingIterator_Type);
- if (PyType_Ready(&ChainPredicateIterator_Type) < 0)
+ if (PyType_Ready(&ChainPredicateIterator_Type) < 0) {
return -1;
+ }
Py_INCREF(&ChainPredicateIterator_Type);
PyModule_AddObject(module, "ChainPredicateIterator", (PyObject *)&ChainPredicateIterator_Type);
- if (PyType_Ready(&ChainSilhouetteIterator_Type) < 0)
+ if (PyType_Ready(&ChainSilhouetteIterator_Type) < 0) {
return -1;
+ }
Py_INCREF(&ChainSilhouetteIterator_Type);
PyModule_AddObject(module, "ChainSilhouetteIterator", (PyObject *)&ChainSilhouetteIterator_Type);
@@ -116,16 +128,18 @@ static int Iterator_init(BPy_Iterator *self, PyObject *args, PyObject *kwds)
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->it = new Iterator();
return 0;
}
static void Iterator_dealloc(BPy_Iterator *self)
{
- if (self->it)
+ if (self->it) {
delete self->it;
+ }
Py_TYPE(self)->tp_free((PyObject *)self);
}
diff --git a/source/blender/freestyle/intern/python/BPy_MediumType.cpp b/source/blender/freestyle/intern/python/BPy_MediumType.cpp
index b29c4e8057a..915f0c41a56 100644
--- a/source/blender/freestyle/intern/python/BPy_MediumType.cpp
+++ b/source/blender/freestyle/intern/python/BPy_MediumType.cpp
@@ -96,11 +96,13 @@ PyLongObject _BPy_MediumType_OPAQUE_MEDIUM = {
int MediumType_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&MediumType_Type) < 0)
+ if (PyType_Ready(&MediumType_Type) < 0) {
return -1;
+ }
Py_INCREF(&MediumType_Type);
PyModule_AddObject(module, "MediumType", (PyObject *)&MediumType_Type);
diff --git a/source/blender/freestyle/intern/python/BPy_Nature.cpp b/source/blender/freestyle/intern/python/BPy_Nature.cpp
index daefe796ff9..79fb154233e 100644
--- a/source/blender/freestyle/intern/python/BPy_Nature.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Nature.cpp
@@ -186,11 +186,13 @@ static PyLongObject _Nature_EDGE_MARK = {
//-------------------MODULE INITIALIZATION--------------------------------
int Nature_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&Nature_Type) < 0)
+ if (PyType_Ready(&Nature_Type) < 0) {
return -1;
+ }
Py_INCREF(&Nature_Type);
PyModule_AddObject(module, "Nature", (PyObject *)&Nature_Type);
@@ -248,12 +250,14 @@ static PyObject *BPy_Nature_bitwise(PyObject *a, int op, PyObject *b)
PyErr_BadArgument();
return NULL;
}
- if (v == 0)
+ if (v == 0) {
result = PyObject_NewVar(BPy_Nature, &Nature_Type, 0);
+ }
else {
result = PyObject_NewVar(BPy_Nature, &Nature_Type, 1);
- if (result)
+ if (result) {
result->i.ob_digit[0] = v;
+ }
}
return (PyObject *)result;
}
diff --git a/source/blender/freestyle/intern/python/BPy_Operators.cpp b/source/blender/freestyle/intern/python/BPy_Operators.cpp
index e2afda63e14..2892d1e9400 100644
--- a/source/blender/freestyle/intern/python/BPy_Operators.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Operators.cpp
@@ -41,11 +41,13 @@ extern "C" {
//-------------------MODULE INITIALIZATION--------------------------------
int Operators_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&Operators_Type) < 0)
+ if (PyType_Ready(&Operators_Type) < 0) {
return -1;
+ }
Py_INCREF(&Operators_Type);
PyModule_AddObject(module, "Operators", (PyObject *)&Operators_Type);
@@ -80,16 +82,18 @@ static PyObject *Operators_select(BPy_Operators * /*self*/, PyObject *args, PyOb
PyObject *obj = 0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "O!", (char **)kwlist, &UnaryPredicate1D_Type, &obj))
+ args, kwds, "O!", (char **)kwlist, &UnaryPredicate1D_Type, &obj)) {
return NULL;
+ }
if (!((BPy_UnaryPredicate1D *)obj)->up1D) {
PyErr_SetString(PyExc_TypeError,
"Operators.select(): 1st argument: invalid UnaryPredicate1D object");
return NULL;
}
if (Operators::select(*(((BPy_UnaryPredicate1D *)obj)->up1D)) < 0) {
- if (!PyErr_Occurred())
+ if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_RuntimeError, "Operators.select() failed");
+ }
return NULL;
}
Py_RETURN_NONE;
@@ -165,8 +169,9 @@ static PyObject *Operators_chain(BPy_Operators * /*self*/, PyObject *args, PyObj
if (!obj3) {
if (Operators::chain(*(((BPy_ChainingIterator *)obj1)->c_it),
*(((BPy_UnaryPredicate1D *)obj2)->up1D)) < 0) {
- if (!PyErr_Occurred())
+ if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_RuntimeError, "Operators.chain() failed");
+ }
return NULL;
}
}
@@ -179,8 +184,9 @@ static PyObject *Operators_chain(BPy_Operators * /*self*/, PyObject *args, PyObj
if (Operators::chain(*(((BPy_ChainingIterator *)obj1)->c_it),
*(((BPy_UnaryPredicate1D *)obj2)->up1D),
*(((BPy_UnaryFunction1DVoid *)obj3)->uf1D_void)) < 0) {
- if (!PyErr_Occurred())
+ if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_RuntimeError, "Operators.chain() failed");
+ }
return NULL;
}
}
@@ -255,8 +261,9 @@ static PyObject *Operators_bidirectional_chain(BPy_Operators * /*self*/,
}
if (!obj2) {
if (Operators::bidirectionalChain(*(((BPy_ChainingIterator *)obj1)->c_it)) < 0) {
- if (!PyErr_Occurred())
+ if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_RuntimeError, "Operators.bidirectional_chain() failed");
+ }
return NULL;
}
}
@@ -269,8 +276,9 @@ static PyObject *Operators_bidirectional_chain(BPy_Operators * /*self*/,
}
if (Operators::bidirectionalChain(*(((BPy_ChainingIterator *)obj1)->c_it),
*(((BPy_UnaryPredicate1D *)obj2)->up1D)) < 0) {
- if (!PyErr_Occurred())
+ if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_RuntimeError, "Operators.bidirectional_chain() failed");
+ }
return NULL;
}
}
@@ -351,8 +359,9 @@ static PyObject *Operators_sequential_split(BPy_Operators * /*self*/,
if (Operators::sequentialSplit(*(((BPy_UnaryPredicate0D *)obj1)->up0D),
*(((BPy_UnaryPredicate0D *)obj2)->up0D),
f) < 0) {
- if (!PyErr_Occurred())
+ if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_RuntimeError, "Operators.sequential_split() failed");
+ }
return NULL;
}
}
@@ -367,8 +376,9 @@ static PyObject *Operators_sequential_split(BPy_Operators * /*self*/,
return NULL;
}
if (Operators::sequentialSplit(*(((BPy_UnaryPredicate0D *)obj1)->up0D), f) < 0) {
- if (!PyErr_Occurred())
+ if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_RuntimeError, "Operators.sequential_split() failed");
+ }
return NULL;
}
}
@@ -468,8 +478,9 @@ static PyObject *Operators_recursive_split(BPy_Operators * /*self*/,
if (Operators::recursiveSplit(*(((BPy_UnaryFunction0DDouble *)obj1)->uf0D_double),
*(((BPy_UnaryPredicate1D *)obj2)->up1D),
f) < 0) {
- if (!PyErr_Occurred())
+ if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_RuntimeError, "Operators.recursive_split() failed");
+ }
return NULL;
}
}
@@ -508,8 +519,9 @@ static PyObject *Operators_recursive_split(BPy_Operators * /*self*/,
*(((BPy_UnaryPredicate0D *)obj2)->up0D),
*(((BPy_UnaryPredicate1D *)obj3)->up1D),
f) < 0) {
- if (!PyErr_Occurred())
+ if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_RuntimeError, "Operators.recursive_split() failed");
+ }
return NULL;
}
}
@@ -535,16 +547,18 @@ static PyObject *Operators_sort(BPy_Operators * /*self*/, PyObject *args, PyObje
PyObject *obj = 0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "O!", (char **)kwlist, &BinaryPredicate1D_Type, &obj))
+ args, kwds, "O!", (char **)kwlist, &BinaryPredicate1D_Type, &obj)) {
return NULL;
+ }
if (!((BPy_BinaryPredicate1D *)obj)->bp1D) {
PyErr_SetString(PyExc_TypeError,
"Operators.sort(): 1st argument: invalid BinaryPredicate1D object");
return NULL;
}
if (Operators::sort(*(((BPy_BinaryPredicate1D *)obj)->bp1D)) < 0) {
- if (!PyErr_Occurred())
+ if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_RuntimeError, "Operators.sort() failed");
+ }
return NULL;
}
Py_RETURN_NONE;
@@ -603,8 +617,9 @@ static PyObject *Operators_create(BPy_Operators * /*self*/, PyObject *args, PyOb
shaders.push_back(shader);
}
if (Operators::create(*(((BPy_UnaryPredicate1D *)obj1)->up1D), shaders) < 0) {
- if (!PyErr_Occurred())
+ if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_RuntimeError, "Operators.create() failed");
+ }
return NULL;
}
Py_RETURN_NONE;
@@ -651,8 +666,9 @@ static PyObject *Operators_get_viewedge_from_index(BPy_Operators * /*self*/,
static const char *kwlist[] = {"i", NULL};
unsigned int i;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &i))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &i)) {
return NULL;
+ }
if (i >= Operators::getViewEdgesSize()) {
PyErr_SetString(PyExc_IndexError, "index out of range");
return NULL;
@@ -677,8 +693,9 @@ static PyObject *Operators_get_chain_from_index(BPy_Operators * /*self*/,
static const char *kwlist[] = {"i", NULL};
unsigned int i;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &i))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &i)) {
return NULL;
+ }
if (i >= Operators::getChainsSize()) {
PyErr_SetString(PyExc_IndexError, "index out of range");
return NULL;
@@ -703,8 +720,9 @@ static PyObject *Operators_get_stroke_from_index(BPy_Operators * /*self*/,
static const char *kwlist[] = {"i", NULL};
unsigned int i;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &i))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &i)) {
return NULL;
+ }
if (i >= Operators::getStrokesSize()) {
PyErr_SetString(PyExc_IndexError, "index out of range");
return NULL;
diff --git a/source/blender/freestyle/intern/python/BPy_SShape.cpp b/source/blender/freestyle/intern/python/BPy_SShape.cpp
index f8930a89a38..d007fead345 100644
--- a/source/blender/freestyle/intern/python/BPy_SShape.cpp
+++ b/source/blender/freestyle/intern/python/BPy_SShape.cpp
@@ -35,11 +35,13 @@ extern "C" {
//-------------------MODULE INITIALIZATION--------------------------------
int SShape_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&SShape_Type) < 0)
+ if (PyType_Ready(&SShape_Type) < 0) {
return -1;
+ }
Py_INCREF(&SShape_Type);
PyModule_AddObject(module, "SShape", (PyObject *)&SShape_Type);
@@ -68,20 +70,24 @@ static int SShape_init(BPy_SShape *self, PyObject *args, PyObject *kwds)
static const char *kwlist[] = {"brother", NULL};
PyObject *brother = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &SShape_Type, &brother))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &SShape_Type, &brother)) {
return -1;
- if (!brother)
+ }
+ if (!brother) {
self->ss = new SShape();
- else
+ }
+ else {
self->ss = new SShape(*(((BPy_SShape *)brother)->ss));
+ }
self->borrowed = false;
return 0;
}
static void SShape_dealloc(BPy_SShape *self)
{
- if (self->ss && !self->borrowed)
+ if (self->ss && !self->borrowed) {
delete self->ss;
+ }
Py_TYPE(self)->tp_free((PyObject *)self);
}
@@ -103,8 +109,9 @@ static PyObject *SShape_add_edge(BPy_SShape *self, PyObject *args, PyObject *kwd
static const char *kwlist[] = {"edge", NULL};
PyObject *py_fe = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &FEdge_Type, &py_fe))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &FEdge_Type, &py_fe)) {
return NULL;
+ }
self->ss->AddEdge(((BPy_FEdge *)py_fe)->fe);
Py_RETURN_NONE;
}
@@ -123,8 +130,9 @@ static PyObject *SShape_add_vertex(BPy_SShape *self, PyObject *args, PyObject *k
static const char *kwlist[] = {"edge", NULL};
PyObject *py_sv = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &SVertex_Type, &py_sv))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &SVertex_Type, &py_sv)) {
return NULL;
+ }
self->ss->AddNewVertex(((BPy_SVertex *)py_sv)->sv);
Py_RETURN_NONE;
}
diff --git a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
index 03933fe1915..7d2716a3e71 100644
--- a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
+++ b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
@@ -31,11 +31,13 @@ extern "C" {
//-------------------MODULE INITIALIZATION--------------------------------
int StrokeAttribute_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&StrokeAttribute_Type) < 0)
+ if (PyType_Ready(&StrokeAttribute_Type) < 0) {
return -1;
+ }
Py_INCREF(&StrokeAttribute_Type);
PyModule_AddObject(module, "StrokeAttribute", (PyObject *)&StrokeAttribute_Type);
@@ -101,10 +103,12 @@ static int StrokeAttribute_init(BPy_StrokeAttribute *self, PyObject *args, PyObj
if (PyArg_ParseTupleAndKeywords(
args, kwds, "|O!", (char **)kwlist_1, &StrokeAttribute_Type, &obj1)) {
- if (!obj1)
+ if (!obj1) {
self->sa = new StrokeAttribute();
- else
+ }
+ else {
self->sa = new StrokeAttribute(*(((BPy_StrokeAttribute *)obj1)->sa));
+ }
}
else if (PyErr_Clear(),
PyArg_ParseTupleAndKeywords(args,
@@ -142,8 +146,9 @@ static int StrokeAttribute_init(BPy_StrokeAttribute *self, PyObject *args, PyObj
static void StrokeAttribute_dealloc(BPy_StrokeAttribute *self)
{
- if (self->sa && !self->borrowed)
+ if (self->sa && !self->borrowed) {
delete self->sa;
+ }
Py_TYPE(self)->tp_free((PyObject *)self);
}
@@ -174,8 +179,9 @@ static PyObject *StrokeAttribute_get_attribute_real(BPy_StrokeAttribute *self,
static const char *kwlist[] = {"name", NULL};
char *attr;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
return NULL;
+ }
double a = self->sa->getAttributeReal(attr);
return PyFloat_FromDouble(a);
}
@@ -197,8 +203,9 @@ static PyObject *StrokeAttribute_get_attribute_vec2(BPy_StrokeAttribute *self,
static const char *kwlist[] = {"name", NULL};
char *attr;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
return NULL;
+ }
Vec2f a = self->sa->getAttributeVec2f(attr);
return Vector_from_Vec2f(a);
}
@@ -220,8 +227,9 @@ static PyObject *StrokeAttribute_get_attribute_vec3(BPy_StrokeAttribute *self,
static const char *kwlist[] = {"name", NULL};
char *attr;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
return NULL;
+ }
Vec3f a = self->sa->getAttributeVec3f(attr);
return Vector_from_Vec3f(a);
}
@@ -243,8 +251,9 @@ static PyObject *StrokeAttribute_has_attribute_real(BPy_StrokeAttribute *self,
static const char *kwlist[] = {"name", NULL};
char *attr;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
return NULL;
+ }
return PyBool_from_bool(self->sa->isAttributeAvailableReal(attr));
}
@@ -266,8 +275,9 @@ static PyObject *StrokeAttribute_has_attribute_vec2(BPy_StrokeAttribute *self,
static const char *kwlist[] = {"name", NULL};
char *attr;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
return NULL;
+ }
return PyBool_from_bool(self->sa->isAttributeAvailableVec2f(attr));
}
@@ -289,8 +299,9 @@ static PyObject *StrokeAttribute_has_attribute_vec3(BPy_StrokeAttribute *self,
static const char *kwlist[] = {"name", NULL};
char *attr;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) {
return NULL;
+ }
return PyBool_from_bool(self->sa->isAttributeAvailableVec3f(attr));
}
@@ -314,8 +325,9 @@ static PyObject *StrokeAttribute_set_attribute_real(BPy_StrokeAttribute *self,
char *s = 0;
double d = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "sd", (char **)kwlist, &s, &d))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "sd", (char **)kwlist, &s, &d)) {
return NULL;
+ }
self->sa->setAttributeReal(s, d);
Py_RETURN_NONE;
}
@@ -341,8 +353,9 @@ static PyObject *StrokeAttribute_set_attribute_vec2(BPy_StrokeAttribute *self,
PyObject *obj = 0;
Vec2f vec;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO", (char **)kwlist, &s, &obj))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO", (char **)kwlist, &s, &obj)) {
return NULL;
+ }
if (!Vec2f_ptr_from_PyObject(obj, vec)) {
PyErr_SetString(PyExc_TypeError,
"argument 2 must be a 2D vector (either a list of 2 elements or Vector)");
@@ -373,8 +386,9 @@ static PyObject *StrokeAttribute_set_attribute_vec3(BPy_StrokeAttribute *self,
PyObject *obj = 0;
Vec3f vec;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO", (char **)kwlist, &s, &obj))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "sO", (char **)kwlist, &s, &obj)) {
return NULL;
+ }
if (!Vec3f_ptr_from_PyObject(obj, vec)) {
PyErr_SetString(PyExc_TypeError,
"argument 2 must be a 3D vector (either a list of 3 elements or Vector)");
@@ -432,8 +446,9 @@ static PyMethodDef BPy_StrokeAttribute_methods[] = {
static int StrokeAttribute_mathutils_check(BaseMathObject *bmo)
{
- if (!BPy_StrokeAttribute_Check(bmo->cb_user))
+ if (!BPy_StrokeAttribute_Check(bmo->cb_user)) {
return -1;
+ }
return 0;
}
diff --git a/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp b/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp
index 33028512b47..baeb8cc4994 100644
--- a/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp
+++ b/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp
@@ -51,104 +51,124 @@ extern "C" {
//-------------------MODULE INITIALIZATION--------------------------------
int StrokeShader_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&StrokeShader_Type) < 0)
+ if (PyType_Ready(&StrokeShader_Type) < 0) {
return -1;
+ }
Py_INCREF(&StrokeShader_Type);
PyModule_AddObject(module, "StrokeShader", (PyObject *)&StrokeShader_Type);
- if (PyType_Ready(&BackboneStretcherShader_Type) < 0)
+ if (PyType_Ready(&BackboneStretcherShader_Type) < 0) {
return -1;
+ }
Py_INCREF(&BackboneStretcherShader_Type);
PyModule_AddObject(module, "BackboneStretcherShader", (PyObject *)&BackboneStretcherShader_Type);
- if (PyType_Ready(&BezierCurveShader_Type) < 0)
+ if (PyType_Ready(&BezierCurveShader_Type) < 0) {
return -1;
+ }
Py_INCREF(&BezierCurveShader_Type);
PyModule_AddObject(module, "BezierCurveShader", (PyObject *)&BezierCurveShader_Type);
- if (PyType_Ready(&BlenderTextureShader_Type) < 0)
+ if (PyType_Ready(&BlenderTextureShader_Type) < 0) {
return -1;
+ }
Py_INCREF(&BlenderTextureShader_Type);
PyModule_AddObject(module, "BlenderTextureShader", (PyObject *)&BlenderTextureShader_Type);
- if (PyType_Ready(&CalligraphicShader_Type) < 0)
+ if (PyType_Ready(&CalligraphicShader_Type) < 0) {
return -1;
+ }
Py_INCREF(&CalligraphicShader_Type);
PyModule_AddObject(module, "CalligraphicShader", (PyObject *)&CalligraphicShader_Type);
- if (PyType_Ready(&ColorNoiseShader_Type) < 0)
+ if (PyType_Ready(&ColorNoiseShader_Type) < 0) {
return -1;
+ }
Py_INCREF(&ColorNoiseShader_Type);
PyModule_AddObject(module, "ColorNoiseShader", (PyObject *)&ColorNoiseShader_Type);
- if (PyType_Ready(&ConstantColorShader_Type) < 0)
+ if (PyType_Ready(&ConstantColorShader_Type) < 0) {
return -1;
+ }
Py_INCREF(&ConstantColorShader_Type);
PyModule_AddObject(module, "ConstantColorShader", (PyObject *)&ConstantColorShader_Type);
- if (PyType_Ready(&ConstantThicknessShader_Type) < 0)
+ if (PyType_Ready(&ConstantThicknessShader_Type) < 0) {
return -1;
+ }
Py_INCREF(&ConstantThicknessShader_Type);
PyModule_AddObject(module, "ConstantThicknessShader", (PyObject *)&ConstantThicknessShader_Type);
- if (PyType_Ready(&ConstrainedIncreasingThicknessShader_Type) < 0)
+ if (PyType_Ready(&ConstrainedIncreasingThicknessShader_Type) < 0) {
return -1;
+ }
Py_INCREF(&ConstrainedIncreasingThicknessShader_Type);
PyModule_AddObject(module,
"ConstrainedIncreasingThicknessShader",
(PyObject *)&ConstrainedIncreasingThicknessShader_Type);
- if (PyType_Ready(&GuidingLinesShader_Type) < 0)
+ if (PyType_Ready(&GuidingLinesShader_Type) < 0) {
return -1;
+ }
Py_INCREF(&GuidingLinesShader_Type);
PyModule_AddObject(module, "GuidingLinesShader", (PyObject *)&GuidingLinesShader_Type);
- if (PyType_Ready(&IncreasingColorShader_Type) < 0)
+ if (PyType_Ready(&IncreasingColorShader_Type) < 0) {
return -1;
+ }
Py_INCREF(&IncreasingColorShader_Type);
PyModule_AddObject(module, "IncreasingColorShader", (PyObject *)&IncreasingColorShader_Type);
- if (PyType_Ready(&IncreasingThicknessShader_Type) < 0)
+ if (PyType_Ready(&IncreasingThicknessShader_Type) < 0) {
return -1;
+ }
Py_INCREF(&IncreasingThicknessShader_Type);
PyModule_AddObject(
module, "IncreasingThicknessShader", (PyObject *)&IncreasingThicknessShader_Type);
- if (PyType_Ready(&PolygonalizationShader_Type) < 0)
+ if (PyType_Ready(&PolygonalizationShader_Type) < 0) {
return -1;
+ }
Py_INCREF(&PolygonalizationShader_Type);
PyModule_AddObject(module, "PolygonalizationShader", (PyObject *)&PolygonalizationShader_Type);
- if (PyType_Ready(&SamplingShader_Type) < 0)
+ if (PyType_Ready(&SamplingShader_Type) < 0) {
return -1;
+ }
Py_INCREF(&SamplingShader_Type);
PyModule_AddObject(module, "SamplingShader", (PyObject *)&SamplingShader_Type);
- if (PyType_Ready(&SmoothingShader_Type) < 0)
+ if (PyType_Ready(&SmoothingShader_Type) < 0) {
return -1;
+ }
Py_INCREF(&SmoothingShader_Type);
PyModule_AddObject(module, "SmoothingShader", (PyObject *)&SmoothingShader_Type);
- if (PyType_Ready(&SpatialNoiseShader_Type) < 0)
+ if (PyType_Ready(&SpatialNoiseShader_Type) < 0) {
return -1;
+ }
Py_INCREF(&SpatialNoiseShader_Type);
PyModule_AddObject(module, "SpatialNoiseShader", (PyObject *)&SpatialNoiseShader_Type);
- if (PyType_Ready(&StrokeTextureStepShader_Type) < 0)
+ if (PyType_Ready(&StrokeTextureStepShader_Type) < 0) {
return -1;
+ }
Py_INCREF(&StrokeTextureStepShader_Type);
PyModule_AddObject(module, "StrokeTextureStepShader", (PyObject *)&StrokeTextureStepShader_Type);
- if (PyType_Ready(&ThicknessNoiseShader_Type) < 0)
+ if (PyType_Ready(&ThicknessNoiseShader_Type) < 0) {
return -1;
+ }
Py_INCREF(&ThicknessNoiseShader_Type);
PyModule_AddObject(module, "ThicknessNoiseShader", (PyObject *)&ThicknessNoiseShader_Type);
- if (PyType_Ready(&TipRemoverShader_Type) < 0)
+ if (PyType_Ready(&TipRemoverShader_Type) < 0) {
return -1;
+ }
Py_INCREF(&TipRemoverShader_Type);
PyModule_AddObject(module, "TipRemoverShader", (PyObject *)&TipRemoverShader_Type);
@@ -180,8 +200,9 @@ static int StrokeShader___init__(BPy_StrokeShader *self, PyObject *args, PyObjec
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->ss = new StrokeShader();
self->ss->py_ss = (PyObject *)self;
return 0;
@@ -189,8 +210,9 @@ static int StrokeShader___init__(BPy_StrokeShader *self, PyObject *args, PyObjec
static void StrokeShader___dealloc__(BPy_StrokeShader *self)
{
- if (self->ss)
+ if (self->ss) {
delete self->ss;
+ }
Py_TYPE(self)->tp_free((PyObject *)self);
}
@@ -212,8 +234,9 @@ static PyObject *StrokeShader_shade(BPy_StrokeShader *self, PyObject *args, PyOb
static const char *kwlist[] = {"stroke", NULL};
PyObject *py_s = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Stroke_Type, &py_s))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Stroke_Type, &py_s)) {
return NULL;
+ }
if (typeid(*(self->ss)) == typeid(StrokeShader)) {
PyErr_SetString(PyExc_TypeError, "shade method not properly overridden");
diff --git a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp
index 90a9258d9e8..81e72c2c7f2 100644
--- a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp
@@ -40,11 +40,13 @@ extern "C" {
//-------------------MODULE INITIALIZATION--------------------------------
int UnaryFunction0D_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&UnaryFunction0D_Type) < 0)
+ if (PyType_Ready(&UnaryFunction0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&UnaryFunction0D_Type);
PyModule_AddObject(module, "UnaryFunction0D", (PyObject *)&UnaryFunction0D_Type);
diff --git a/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp
index 879f090275d..b2bd6e657fe 100644
--- a/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp
@@ -38,11 +38,13 @@ extern "C" {
//-------------------MODULE INITIALIZATION--------------------------------
int UnaryFunction1D_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&UnaryFunction1D_Type) < 0)
+ if (PyType_Ready(&UnaryFunction1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&UnaryFunction1D_Type);
PyModule_AddObject(module, "UnaryFunction1D", (PyObject *)&UnaryFunction1D_Type);
diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp
index 7d1a91f156d..f4f1205bb09 100644
--- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp
@@ -34,21 +34,25 @@ extern "C" {
//-------------------MODULE INITIALIZATION--------------------------------
int UnaryPredicate0D_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&UnaryPredicate0D_Type) < 0)
+ if (PyType_Ready(&UnaryPredicate0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&UnaryPredicate0D_Type);
PyModule_AddObject(module, "UnaryPredicate0D", (PyObject *)&UnaryPredicate0D_Type);
- if (PyType_Ready(&FalseUP0D_Type) < 0)
+ if (PyType_Ready(&FalseUP0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&FalseUP0D_Type);
PyModule_AddObject(module, "FalseUP0D", (PyObject *)&FalseUP0D_Type);
- if (PyType_Ready(&TrueUP0D_Type) < 0)
+ if (PyType_Ready(&TrueUP0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&TrueUP0D_Type);
PyModule_AddObject(module, "TrueUP0D", (PyObject *)&TrueUP0D_Type);
@@ -83,8 +87,9 @@ static int UnaryPredicate0D___init__(BPy_UnaryPredicate0D *self, PyObject *args,
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->up0D = new UnaryPredicate0D();
self->up0D->py_up0D = (PyObject *)self;
return 0;
@@ -92,8 +97,9 @@ static int UnaryPredicate0D___init__(BPy_UnaryPredicate0D *self, PyObject *args,
static void UnaryPredicate0D___dealloc__(BPy_UnaryPredicate0D *self)
{
- if (self->up0D)
+ if (self->up0D) {
delete self->up0D;
+ }
Py_TYPE(self)->tp_free((PyObject *)self);
}
@@ -110,8 +116,9 @@ static PyObject *UnaryPredicate0D___call__(BPy_UnaryPredicate0D *self,
PyObject *py_if0D_it;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &py_if0D_it))
+ args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &py_if0D_it)) {
return NULL;
+ }
Interface0DIterator *if0D_it = ((BPy_Interface0DIterator *)py_if0D_it)->if0D_it;
diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp
index 3c728d1a852..8bdd9823140 100644
--- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp
@@ -43,63 +43,75 @@ extern "C" {
//-------------------MODULE INITIALIZATION--------------------------------
int UnaryPredicate1D_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&UnaryPredicate1D_Type) < 0)
+ if (PyType_Ready(&UnaryPredicate1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&UnaryPredicate1D_Type);
PyModule_AddObject(module, "UnaryPredicate1D", (PyObject *)&UnaryPredicate1D_Type);
- if (PyType_Ready(&ContourUP1D_Type) < 0)
+ if (PyType_Ready(&ContourUP1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&ContourUP1D_Type);
PyModule_AddObject(module, "ContourUP1D", (PyObject *)&ContourUP1D_Type);
- if (PyType_Ready(&DensityLowerThanUP1D_Type) < 0)
+ if (PyType_Ready(&DensityLowerThanUP1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&DensityLowerThanUP1D_Type);
PyModule_AddObject(module, "DensityLowerThanUP1D", (PyObject *)&DensityLowerThanUP1D_Type);
- if (PyType_Ready(&EqualToChainingTimeStampUP1D_Type) < 0)
+ if (PyType_Ready(&EqualToChainingTimeStampUP1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&EqualToChainingTimeStampUP1D_Type);
PyModule_AddObject(
module, "EqualToChainingTimeStampUP1D", (PyObject *)&EqualToChainingTimeStampUP1D_Type);
- if (PyType_Ready(&EqualToTimeStampUP1D_Type) < 0)
+ if (PyType_Ready(&EqualToTimeStampUP1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&EqualToTimeStampUP1D_Type);
PyModule_AddObject(module, "EqualToTimeStampUP1D", (PyObject *)&EqualToTimeStampUP1D_Type);
- if (PyType_Ready(&ExternalContourUP1D_Type) < 0)
+ if (PyType_Ready(&ExternalContourUP1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&ExternalContourUP1D_Type);
PyModule_AddObject(module, "ExternalContourUP1D", (PyObject *)&ExternalContourUP1D_Type);
- if (PyType_Ready(&FalseUP1D_Type) < 0)
+ if (PyType_Ready(&FalseUP1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&FalseUP1D_Type);
PyModule_AddObject(module, "FalseUP1D", (PyObject *)&FalseUP1D_Type);
- if (PyType_Ready(&QuantitativeInvisibilityUP1D_Type) < 0)
+ if (PyType_Ready(&QuantitativeInvisibilityUP1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&QuantitativeInvisibilityUP1D_Type);
PyModule_AddObject(
module, "QuantitativeInvisibilityUP1D", (PyObject *)&QuantitativeInvisibilityUP1D_Type);
- if (PyType_Ready(&ShapeUP1D_Type) < 0)
+ if (PyType_Ready(&ShapeUP1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&ShapeUP1D_Type);
PyModule_AddObject(module, "ShapeUP1D", (PyObject *)&ShapeUP1D_Type);
- if (PyType_Ready(&TrueUP1D_Type) < 0)
+ if (PyType_Ready(&TrueUP1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&TrueUP1D_Type);
PyModule_AddObject(module, "TrueUP1D", (PyObject *)&TrueUP1D_Type);
- if (PyType_Ready(&WithinImageBoundaryUP1D_Type) < 0)
+ if (PyType_Ready(&WithinImageBoundaryUP1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&WithinImageBoundaryUP1D_Type);
PyModule_AddObject(module, "WithinImageBoundaryUP1D", (PyObject *)&WithinImageBoundaryUP1D_Type);
@@ -133,8 +145,9 @@ static int UnaryPredicate1D___init__(BPy_UnaryPredicate1D *self, PyObject *args,
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->up1D = new UnaryPredicate1D();
self->up1D->py_up1D = (PyObject *)self;
return 0;
@@ -142,8 +155,9 @@ static int UnaryPredicate1D___init__(BPy_UnaryPredicate1D *self, PyObject *args,
static void UnaryPredicate1D___dealloc__(BPy_UnaryPredicate1D *self)
{
- if (self->up1D)
+ if (self->up1D) {
delete self->up1D;
+ }
Py_TYPE(self)->tp_free((PyObject *)self);
}
@@ -159,8 +173,10 @@ static PyObject *UnaryPredicate1D___call__(BPy_UnaryPredicate1D *self,
static const char *kwlist[] = {"inter", NULL};
PyObject *py_if1D;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &py_if1D))
+ if (!PyArg_ParseTupleAndKeywords(
+ args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &py_if1D)) {
return NULL;
+ }
Interface1D *if1D = ((BPy_Interface1D *)py_if1D)->if1D;
diff --git a/source/blender/freestyle/intern/python/BPy_ViewMap.cpp b/source/blender/freestyle/intern/python/BPy_ViewMap.cpp
index a46a63da03a..b6ca377fb40 100644
--- a/source/blender/freestyle/intern/python/BPy_ViewMap.cpp
+++ b/source/blender/freestyle/intern/python/BPy_ViewMap.cpp
@@ -34,11 +34,13 @@ extern "C" {
//-------------------MODULE INITIALIZATION--------------------------------
int ViewMap_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&ViewMap_Type) < 0)
+ if (PyType_Ready(&ViewMap_Type) < 0) {
return -1;
+ }
Py_INCREF(&ViewMap_Type);
PyModule_AddObject(module, "ViewMap", (PyObject *)&ViewMap_Type);
@@ -58,16 +60,18 @@ static int ViewMap_init(BPy_ViewMap *self, PyObject *args, PyObject *kwds)
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->vm = new ViewMap();
return 0;
}
static void ViewMap_dealloc(BPy_ViewMap *self)
{
- if (self->vm)
+ if (self->vm) {
delete self->vm;
+ }
Py_TYPE(self)->tp_free((PyObject *)self);
}
@@ -93,11 +97,13 @@ static PyObject *ViewMap_get_closest_viewedge(BPy_ViewMap *self, PyObject *args,
static const char *kwlist[] = {"x", "y", NULL};
double x, y;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "dd", (char **)kwlist, &x, &y))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "dd", (char **)kwlist, &x, &y)) {
return NULL;
+ }
ViewEdge *ve = const_cast<ViewEdge *>(self->vm->getClosestViewEdge(x, y));
- if (ve)
+ if (ve) {
return BPy_ViewEdge_from_ViewEdge(*ve);
+ }
Py_RETURN_NONE;
}
@@ -118,11 +124,13 @@ static PyObject *ViewMap_get_closest_fedge(BPy_ViewMap *self, PyObject *args, Py
static const char *kwlist[] = {"x", "y", NULL};
double x, y;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "dd", (char **)kwlist, &x, &y))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "dd", (char **)kwlist, &x, &y)) {
return NULL;
+ }
FEdge *fe = const_cast<FEdge *>(self->vm->getClosestFEdge(x, y));
- if (fe)
+ if (fe) {
return Any_BPy_FEdge_from_FEdge(*fe);
+ }
Py_RETURN_NONE;
}
diff --git a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp
index 743a0ba79dc..79eeba17529 100644
--- a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp
+++ b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp
@@ -35,11 +35,13 @@ extern "C" {
int ViewShape_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&ViewShape_Type) < 0)
+ if (PyType_Ready(&ViewShape_Type) < 0) {
return -1;
+ }
Py_INCREF(&ViewShape_Type);
PyModule_AddObject(module, "ViewShape", (PyObject *)&ViewShape_Type);
@@ -107,8 +109,9 @@ static void ViewShape_dealloc(BPy_ViewShape *self)
self->vs->setSShape((SShape *)NULL);
Py_DECREF(self->py_ss);
}
- if (self->vs && !self->borrowed)
+ if (self->vs && !self->borrowed) {
delete self->vs;
+ }
Py_TYPE(self)->tp_free((PyObject *)self);
}
@@ -130,8 +133,9 @@ static PyObject *ViewShape_add_edge(BPy_ViewShape *self, PyObject *args, PyObjec
static const char *kwlist[] = {"edge", NULL};
PyObject *py_ve = 0;
- if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &ViewEdge_Type, &py_ve))
+ if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &ViewEdge_Type, &py_ve)) {
return NULL;
+ }
self->vs->AddEdge(((BPy_ViewEdge *)py_ve)->ve);
Py_RETURN_NONE;
}
@@ -149,8 +153,9 @@ static PyObject *ViewShape_add_vertex(BPy_ViewShape *self, PyObject *args, PyObj
static const char *kwlist[] = {"vertex", NULL};
PyObject *py_vv = 0;
- if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &ViewVertex_Type, &py_vv))
+ if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &ViewVertex_Type, &py_vv)) {
return NULL;
+ }
self->vs->AddVertex(((BPy_ViewVertex *)py_vv)->vv);
Py_RETURN_NONE;
}
@@ -179,8 +184,9 @@ PyDoc_STRVAR(ViewShape_sshape_doc,
static PyObject *ViewShape_sshape_get(BPy_ViewShape *self, void *UNUSED(closure))
{
SShape *ss = self->vs->sshape();
- if (!ss)
+ if (!ss) {
Py_RETURN_NONE;
+ }
return BPy_SShape_from_SShape(*ss);
}
@@ -192,8 +198,9 @@ static int ViewShape_sshape_set(BPy_ViewShape *self, PyObject *value, void *UNUS
}
BPy_SShape *py_ss = (BPy_SShape *)value;
self->vs->setSShape(py_ss->ss);
- if (self->py_ss)
+ if (self->py_ss) {
Py_DECREF(self->py_ss);
+ }
if (!py_ss->borrowed) {
self->py_ss = py_ss;
Py_INCREF(self->py_ss);
diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp
index f8b2d5a1ab5..65c7f063dcf 100644
--- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp
+++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp
@@ -46,8 +46,9 @@ static int FalseBP1D___init__(BPy_FalseBP1D *self, PyObject *args, PyObject *kwd
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_bp1D.bp1D = new Predicates1D::FalseBP1D();
return 0;
}
diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp
index 7387252bfd0..59c3283ed35 100644
--- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp
+++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp
@@ -47,8 +47,9 @@ static int Length2DBP1D___init__(BPy_Length2DBP1D *self, PyObject *args, PyObjec
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_bp1D.bp1D = new Predicates1D::Length2DBP1D();
return 0;
}
diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp
index 005bbded74f..62bfbbcfad0 100644
--- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp
+++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp
@@ -46,8 +46,9 @@ static int SameShapeIdBP1D___init__(BPy_SameShapeIdBP1D *self, PyObject *args, P
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_bp1D.bp1D = new Predicates1D::SameShapeIdBP1D();
return 0;
}
diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp
index 363c0386915..e169ffe7c75 100644
--- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp
+++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp
@@ -46,8 +46,9 @@ static int TrueBP1D___init__(BPy_TrueBP1D *self, PyObject *args, PyObject *kwds)
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_bp1D.bp1D = new Predicates1D::TrueBP1D();
return 0;
}
diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp
index 2169ee18166..ec660b7a7fe 100644
--- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp
+++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp
@@ -75,8 +75,9 @@ static int ViewMapGradientNormBP1D___init__(BPy_ViewMapGradientNormBP1D *self,
float f = 2.0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "i|O!f", (char **)kwlist, &i, &IntegrationType_Type, &obj, &f))
+ args, kwds, "i|O!f", (char **)kwlist, &i, &IntegrationType_Type, &obj, &f)) {
return -1;
+ }
IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN;
self->py_bp1D.bp1D = new Predicates1D::ViewMapGradientNormBP1D(i, t, f);
return 0;
diff --git a/source/blender/freestyle/intern/python/Director.cpp b/source/blender/freestyle/intern/python/Director.cpp
index c86602c78b1..c931a246961 100644
--- a/source/blender/freestyle/intern/python/Director.cpp
+++ b/source/blender/freestyle/intern/python/Director.cpp
@@ -75,12 +75,14 @@ int Director_BPy_BinaryPredicate0D___call__(BinaryPredicate0D *bp0D,
PyObject *result = PyObject_CallMethod((PyObject *)bp0D->py_bp0D, "__call__", "OO", arg1, arg2);
Py_DECREF(arg1);
Py_DECREF(arg2);
- if (!result)
+ if (!result) {
return -1;
+ }
int ret = PyObject_IsTrue(result);
Py_DECREF(result);
- if (ret < 0)
+ if (ret < 0) {
return -1;
+ }
bp0D->result = ret;
return 0;
}
@@ -104,12 +106,14 @@ int Director_BPy_BinaryPredicate1D___call__(BinaryPredicate1D *bp1D,
PyObject *result = PyObject_CallMethod((PyObject *)bp1D->py_bp1D, "__call__", "OO", arg1, arg2);
Py_DECREF(arg1);
Py_DECREF(arg2);
- if (!result)
+ if (!result) {
return -1;
+ }
int ret = PyObject_IsTrue(result);
Py_DECREF(result);
- if (ret < 0)
+ if (ret < 0) {
return -1;
+ }
bp1D->result = ret;
return 0;
}
@@ -122,16 +126,19 @@ int Director_BPy_UnaryPredicate0D___call__(UnaryPredicate0D *up0D, Interface0DIt
return -1;
}
PyObject *arg = BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, false);
- if (!arg)
+ if (!arg) {
return -1;
+ }
PyObject *result = PyObject_CallMethod((PyObject *)up0D->py_up0D, "__call__", "O", arg);
Py_DECREF(arg);
- if (!result)
+ if (!result) {
return -1;
+ }
int ret = PyObject_IsTrue(result);
Py_DECREF(result);
- if (ret < 0)
+ if (ret < 0) {
return -1;
+ }
up0D->result = ret;
return 0;
}
@@ -144,16 +151,19 @@ int Director_BPy_UnaryPredicate1D___call__(UnaryPredicate1D *up1D, Interface1D &
return -1;
}
PyObject *arg = Any_BPy_Interface1D_from_Interface1D(if1D);
- if (!arg)
+ if (!arg) {
return -1;
+ }
PyObject *result = PyObject_CallMethod((PyObject *)up1D->py_up1D, "__call__", "O", arg);
Py_DECREF(arg);
- if (!result)
+ if (!result) {
return -1;
+ }
int ret = PyObject_IsTrue(result);
Py_DECREF(result);
- if (ret < 0)
+ if (ret < 0) {
return -1;
+ }
up1D->result = ret;
return 0;
}
@@ -166,12 +176,14 @@ int Director_BPy_StrokeShader_shade(StrokeShader *ss, Stroke &s)
return -1;
}
PyObject *arg = BPy_Stroke_from_Stroke(s);
- if (!arg)
+ if (!arg) {
return -1;
+ }
PyObject *result = PyObject_CallMethod((PyObject *)ss->py_ss, "shade", "O", arg);
Py_DECREF(arg);
- if (!result)
+ if (!result) {
return -1;
+ }
Py_DECREF(result);
return 0;
}
@@ -184,8 +196,9 @@ int Director_BPy_ChainingIterator_init(ChainingIterator *c_it)
return -1;
}
PyObject *result = PyObject_CallMethod((PyObject *)c_it->py_c_it, "init", NULL);
- if (!result)
+ if (!result) {
return -1;
+ }
Py_DECREF(result);
return 0;
}
@@ -197,12 +210,14 @@ int Director_BPy_ChainingIterator_traverse(ChainingIterator *c_it, AdjacencyIter
return -1;
}
PyObject *arg = BPy_AdjacencyIterator_from_AdjacencyIterator(a_it);
- if (!arg)
+ if (!arg) {
return -1;
+ }
PyObject *result = PyObject_CallMethod((PyObject *)c_it->py_c_it, "traverse", "O", arg);
Py_DECREF(arg);
- if (!result)
+ if (!result) {
return -1;
+ }
if (BPy_ViewEdge_Check(result)) {
c_it->result = ((BPy_ViewEdge *)result)->ve;
}
@@ -227,12 +242,14 @@ int Director_BPy_UnaryFunction0D___call__(void *uf0D, void *py_uf0D, Interface0D
}
PyObject *obj = (PyObject *)py_uf0D;
PyObject *arg = BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, false);
- if (!arg)
+ if (!arg) {
return -1;
+ }
PyObject *result = PyObject_CallMethod(obj, "__call__", "O", arg);
Py_DECREF(arg);
- if (!result)
+ if (!result) {
return -1;
+ }
if (BPy_UnaryFunction0DDouble_Check(obj)) {
((UnaryFunction0D<double> *)uf0D)->result = PyFloat_AsDouble(result);
}
@@ -253,14 +270,16 @@ int Director_BPy_UnaryFunction0D___call__(void *uf0D, void *py_uf0D, Interface0D
}
else if (BPy_UnaryFunction0DVec2f_Check(obj)) {
Vec2f vec;
- if (!Vec2f_ptr_from_Vector(result, vec))
+ if (!Vec2f_ptr_from_Vector(result, vec)) {
return -1;
+ }
((UnaryFunction0D<Vec2f> *)uf0D)->result = vec;
}
else if (BPy_UnaryFunction0DVec3f_Check(obj)) {
Vec3f vec;
- if (!Vec3f_ptr_from_Vector(result, vec))
+ if (!Vec3f_ptr_from_Vector(result, vec)) {
return -1;
+ }
((UnaryFunction0D<Vec3f> *)uf0D)->result = vec;
}
else if (BPy_UnaryFunction0DVectorViewShape_Check(obj)) {
@@ -287,12 +306,14 @@ int Director_BPy_UnaryFunction1D___call__(void *uf1D, void *py_uf1D, Interface1D
}
PyObject *obj = (PyObject *)py_uf1D;
PyObject *arg = Any_BPy_Interface1D_from_Interface1D(if1D);
- if (!arg)
+ if (!arg) {
return -1;
+ }
PyObject *result = PyObject_CallMethod(obj, "__call__", "O", arg);
Py_DECREF(arg);
- if (!result)
+ if (!result) {
return -1;
+ }
if (BPy_UnaryFunction1DDouble_Check(obj)) {
((UnaryFunction1D<double> *)uf1D)->result = PyFloat_AsDouble(result);
}
@@ -307,14 +328,16 @@ int Director_BPy_UnaryFunction1D___call__(void *uf1D, void *py_uf1D, Interface1D
}
else if (BPy_UnaryFunction1DVec2f_Check(obj)) {
Vec2f vec;
- if (!Vec2f_ptr_from_Vector(result, vec))
+ if (!Vec2f_ptr_from_Vector(result, vec)) {
return -1;
+ }
((UnaryFunction1D<Vec2f> *)uf1D)->result = vec;
}
else if (BPy_UnaryFunction1DVec3f_Check(obj)) {
Vec3f vec;
- if (!Vec3f_ptr_from_Vector(result, vec))
+ if (!Vec3f_ptr_from_Vector(result, vec)) {
return -1;
+ }
((UnaryFunction1D<Vec3f> *)uf1D)->result = vec;
}
else if (BPy_UnaryFunction1DVectorViewShape_Check(obj)) {
diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp
index 8a5bb0b17ff..8e619ec95a4 100644
--- a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp
+++ b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp
@@ -88,10 +88,12 @@ static int CurvePoint_init(BPy_CurvePoint *self, PyObject *args, PyObject *kwds)
float t2d;
if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &CurvePoint_Type, &obj1)) {
- if (!obj1)
+ if (!obj1) {
self->cp = new CurvePoint();
- else
+ }
+ else {
self->cp = new CurvePoint(*(((BPy_CurvePoint *)obj1)->cp));
+ }
}
else if (PyErr_Clear(),
PyArg_ParseTupleAndKeywords(args,
@@ -148,8 +150,9 @@ PyDoc_STRVAR(CurvePoint_first_svertex_doc,
static PyObject *CurvePoint_first_svertex_get(BPy_CurvePoint *self, void *UNUSED(closure))
{
SVertex *A = self->cp->A();
- if (A)
+ if (A) {
return BPy_SVertex_from_SVertex(*A);
+ }
Py_RETURN_NONE;
}
@@ -173,8 +176,9 @@ PyDoc_STRVAR(CurvePoint_second_svertex_doc,
static PyObject *CurvePoint_second_svertex_get(BPy_CurvePoint *self, void *UNUSED(closure))
{
SVertex *B = self->cp->B();
- if (B)
+ if (B) {
return BPy_SVertex_from_SVertex(*B);
+ }
Py_RETURN_NONE;
}
@@ -201,8 +205,9 @@ static PyObject *CurvePoint_fedge_get(BPy_CurvePoint *self, void *UNUSED(closure
SVertex *A = self->cp->A();
Interface0D *B = (Interface0D *)self->cp->B();
// B can be NULL under certain circumstances
- if (B)
+ if (B) {
return Any_BPy_Interface1D_from_Interface1D(*(A->getFEdge(*B)));
+ }
Py_RETURN_NONE;
}
diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp
index f4b8ca07d3f..08ad378ab75 100644
--- a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp
+++ b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp
@@ -65,10 +65,12 @@ static int SVertex_init(BPy_SVertex *self, PyObject *args, PyObject *kwds)
float v[3];
if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &SVertex_Type, &obj)) {
- if (!obj)
+ if (!obj) {
self->sv = new SVertex();
- else
+ }
+ else {
self->sv = new SVertex(*(((BPy_SVertex *)obj)->sv));
+ }
}
else if (PyErr_Clear(),
PyArg_ParseTupleAndKeywords(
@@ -100,8 +102,9 @@ static PyObject *SVertex_add_normal(BPy_SVertex *self, PyObject *args, PyObject
PyObject *py_normal;
Vec3r n;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &py_normal))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &py_normal)) {
return NULL;
+ }
if (!Vec3r_ptr_from_PyObject(py_normal, n)) {
PyErr_SetString(PyExc_TypeError,
"argument 1 must be a 3D vector (either a list of 3 elements or Vector)");
@@ -124,8 +127,9 @@ static PyObject *SVertex_add_fedge(BPy_SVertex *self, PyObject *args, PyObject *
static const char *kwlist[] = {"fedge", NULL};
PyObject *py_fe;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &FEdge_Type, &py_fe))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &FEdge_Type, &py_fe)) {
return NULL;
+ }
self->sv->AddFEdge(((BPy_FEdge *)py_fe)->fe);
Py_RETURN_NONE;
}
@@ -152,8 +156,9 @@ static PyMethodDef BPy_SVertex_methods[] = {
static int SVertex_mathutils_check(BaseMathObject *bmo)
{
- if (!BPy_SVertex_Check(bmo->cb_user))
+ if (!BPy_SVertex_Check(bmo->cb_user)) {
return -1;
+ }
return 0;
}
@@ -378,8 +383,9 @@ PyDoc_STRVAR(SVertex_viewvertex_doc,
static PyObject *SVertex_viewvertex_get(BPy_SVertex *self, void *UNUSED(closure))
{
ViewVertex *vv = self->sv->viewvertex();
- if (vv)
+ if (vv) {
return Any_BPy_ViewVertex_from_ViewVertex(*vv);
+ }
Py_RETURN_NONE;
}
@@ -399,8 +405,9 @@ PyDoc_STRVAR(SVertex_curvatures_doc,
static PyObject *SVertex_curvatures_get(BPy_SVertex *self, void *UNUSED(closure))
{
const CurvatureInfo *info = self->sv->getCurvatureInfo();
- if (!info)
+ if (!info) {
Py_RETURN_NONE;
+ }
Vec3r e1(info->e1.x(), info->e1.y(), info->e1.z());
Vec3r e2(info->e2.x(), info->e2.y(), info->e2.z());
Vec3r er(info->er.x(), info->er.y(), info->er.z());
diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp
index 1ff46482911..29bba040316 100644
--- a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp
+++ b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp
@@ -105,8 +105,9 @@ static PyObject *ViewVertex_edges_iterator(BPy_ViewVertex *self, PyObject *args,
static const char *kwlist[] = {"edge", NULL};
PyObject *py_ve;
- if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &ViewEdge_Type, &py_ve))
+ if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &ViewEdge_Type, &py_ve)) {
return NULL;
+ }
ViewEdge *ve = ((BPy_ViewEdge *)py_ve)->ve;
ViewVertexInternal::orientedViewEdgeIterator ove_it(self->vv->edgesIterator(ve));
return BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator(ove_it, false);
@@ -132,8 +133,9 @@ PyDoc_STRVAR(ViewVertex_nature_doc,
static PyObject *ViewVertex_nature_get(BPy_ViewVertex *self, void *UNUSED(closure))
{
Nature::VertexNature nature = self->vv->getNature();
- if (PyErr_Occurred())
+ if (PyErr_Occurred()) {
return NULL;
+ }
return BPy_Nature_from_Nature(nature); // return a copy
}
diff --git a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp
index 3637899fbc2..503dd3bf044 100644
--- a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp
+++ b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp
@@ -149,10 +149,12 @@ static int StrokeVertex_init(BPy_StrokeVertex *self, PyObject *args, PyObject *k
&obj1,
&StrokeAttribute_Type,
&obj2)) {
- if (!obj2)
+ if (!obj2) {
self->sv = new StrokeVertex(((BPy_SVertex *)obj1)->sv);
- else
+ }
+ else {
self->sv = new StrokeVertex(((BPy_SVertex *)obj1)->sv, *(((BPy_StrokeAttribute *)obj2)->sa));
+ }
}
else {
PyErr_SetString(PyExc_TypeError, "invalid argument(s)");
@@ -171,8 +173,9 @@ static int StrokeVertex_init(BPy_StrokeVertex *self, PyObject *args, PyObject *k
static int StrokeVertex_mathutils_check(BaseMathObject *bmo)
{
- if (!BPy_StrokeVertex_Check(bmo->cb_user))
+ if (!BPy_StrokeVertex_Check(bmo->cb_user)) {
return -1;
+ }
return 0;
}
diff --git a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp
index 87873677189..315c0b16061 100644
--- a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp
+++ b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp
@@ -55,12 +55,15 @@ static int NonTVertex_init(BPy_NonTVertex *self, PyObject *args, PyObject *kwds)
static const char *kwlist[] = {"svertex", NULL};
PyObject *obj = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &SVertex_Type, &obj))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &SVertex_Type, &obj)) {
return -1;
- if (!obj)
+ }
+ if (!obj) {
self->ntv = new NonTVertex();
- else
+ }
+ else {
self->ntv = new NonTVertex(((BPy_SVertex *)obj)->sv);
+ }
self->py_vv.vv = self->ntv;
self->py_vv.py_if0D.if0D = self->ntv;
self->py_vv.py_if0D.borrowed = false;
@@ -77,8 +80,9 @@ PyDoc_STRVAR(NonTVertex_svertex_doc,
static PyObject *NonTVertex_svertex_get(BPy_NonTVertex *self, void *UNUSED(closure))
{
SVertex *v = self->ntv->svertex();
- if (v)
+ if (v) {
return BPy_SVertex_from_SVertex(*v);
+ }
Py_RETURN_NONE;
}
diff --git a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp
index 9a8592aaea5..7b23fdb04f1 100644
--- a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp
+++ b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp
@@ -53,8 +53,9 @@ static int TVertex_init(BPy_TVertex *self, PyObject *args, PyObject *kwds)
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->tv = new TVertex();
self->py_vv.vv = self->tv;
self->py_vv.py_if0D.if0D = self->tv;
@@ -77,11 +78,13 @@ static PyObject *TVertex_get_svertex(BPy_TVertex *self, PyObject *args, PyObject
static const char *kwlist[] = {"fedge", NULL};
PyObject *py_fe;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &FEdge_Type, &py_fe))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &FEdge_Type, &py_fe)) {
return NULL;
+ }
SVertex *sv = self->tv->getSVertex(((BPy_FEdge *)py_fe)->fe);
- if (sv)
+ if (sv) {
return BPy_SVertex_from_SVertex(*sv);
+ }
Py_RETURN_NONE;
}
@@ -102,11 +105,13 @@ static PyObject *TVertex_get_mate(BPy_TVertex *self, PyObject *args, PyObject *k
static const char *kwlist[] = {"viewedge", NULL};
PyObject *py_ve;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &ViewEdge_Type, &py_ve))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &ViewEdge_Type, &py_ve)) {
return NULL;
+ }
ViewEdge *ve = self->tv->mate(((BPy_ViewEdge *)py_ve)->ve);
- if (ve)
+ if (ve) {
return BPy_ViewEdge_from_ViewEdge(*ve);
+ }
Py_RETURN_NONE;
}
@@ -132,8 +137,9 @@ PyDoc_STRVAR(TVertex_front_svertex_doc,
static PyObject *TVertex_front_svertex_get(BPy_TVertex *self, void *UNUSED(closure))
{
SVertex *v = self->tv->frontSVertex();
- if (v)
+ if (v) {
return BPy_SVertex_from_SVertex(*v);
+ }
Py_RETURN_NONE;
}
@@ -155,8 +161,9 @@ PyDoc_STRVAR(TVertex_back_svertex_doc,
static PyObject *TVertex_back_svertex_get(BPy_TVertex *self, void *UNUSED(closure))
{
SVertex *v = self->tv->backSVertex();
- if (v)
+ if (v) {
return BPy_SVertex_from_SVertex(*v);
+ }
Py_RETURN_NONE;
}
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp
index 7ca783d9aa4..070e54c9305 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp
@@ -74,10 +74,12 @@ static int FEdge_init(BPy_FEdge *self, PyObject *args, PyObject *kwds)
PyObject *obj1 = 0, *obj2 = 0;
if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &FEdge_Type, &obj1)) {
- if (!obj1)
+ if (!obj1) {
self->fe = new FEdge();
- else
+ }
+ else {
self->fe = new FEdge(*(((BPy_FEdge *)obj1)->fe));
+ }
}
else if (PyErr_Clear(),
PyArg_ParseTupleAndKeywords(args,
@@ -108,12 +110,14 @@ static Py_ssize_t FEdge_sq_length(BPy_FEdge * /*self*/)
static PyObject *FEdge_sq_item(BPy_FEdge *self, int keynum)
{
- if (keynum < 0)
+ if (keynum < 0) {
keynum += FEdge_sq_length(self);
+ }
if (keynum == 0 || keynum == 1) {
SVertex *v = self->fe->operator[](keynum);
- if (v)
+ if (v) {
return BPy_SVertex_from_SVertex(*v);
+ }
Py_RETURN_NONE;
}
PyErr_Format(PyExc_IndexError, "FEdge[index]: index %d out of range", keynum);
@@ -143,8 +147,9 @@ PyDoc_STRVAR(FEdge_first_svertex_doc,
static PyObject *FEdge_first_svertex_get(BPy_FEdge *self, void *UNUSED(closure))
{
SVertex *A = self->fe->vertexA();
- if (A)
+ if (A) {
return BPy_SVertex_from_SVertex(*A);
+ }
Py_RETURN_NONE;
}
@@ -166,8 +171,9 @@ PyDoc_STRVAR(FEdge_second_svertex_doc,
static PyObject *FEdge_second_svertex_get(BPy_FEdge *self, void *UNUSED(closure))
{
SVertex *B = self->fe->vertexB();
- if (B)
+ if (B) {
return BPy_SVertex_from_SVertex(*B);
+ }
Py_RETURN_NONE;
}
@@ -190,8 +196,9 @@ PyDoc_STRVAR(FEdge_next_fedge_doc,
static PyObject *FEdge_next_fedge_get(BPy_FEdge *self, void *UNUSED(closure))
{
FEdge *fe = self->fe->nextEdge();
- if (fe)
+ if (fe) {
return Any_BPy_FEdge_from_FEdge(*fe);
+ }
Py_RETURN_NONE;
}
@@ -214,8 +221,9 @@ PyDoc_STRVAR(FEdge_previous_fedge_doc,
static PyObject *FEdge_previous_fedge_get(BPy_FEdge *self, void *UNUSED(closure))
{
FEdge *fe = self->fe->previousEdge();
- if (fe)
+ if (fe) {
return Any_BPy_FEdge_from_FEdge(*fe);
+ }
Py_RETURN_NONE;
}
@@ -237,8 +245,9 @@ PyDoc_STRVAR(FEdge_viewedge_doc,
static PyObject *FEdge_viewedge_get(BPy_FEdge *self, void *UNUSED(closure))
{
ViewEdge *ve = self->fe->viewedge();
- if (ve)
+ if (ve) {
return BPy_ViewEdge_from_ViewEdge(*ve);
+ }
Py_RETURN_NONE;
}
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp
index 1d2d4f51028..932911fb6e6 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp
@@ -65,10 +65,12 @@ static int FrsCurve_init(BPy_FrsCurve *self, PyObject *args, PyObject *kwds)
PyObject *obj = 0;
if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &FrsCurve_Type, &obj)) {
- if (!obj)
+ if (!obj) {
self->c = new Curve();
- else
+ }
+ else {
self->c = new Curve(*(((BPy_FrsCurve *)obj)->c));
+ }
}
else if (PyErr_Clear(),
PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist_2, &Id_Type, &obj)) {
@@ -96,8 +98,9 @@ static PyObject *FrsCurve_push_vertex_back(BPy_FrsCurve *self, PyObject *args, P
static const char *kwlist[] = {"vertex", NULL};
PyObject *obj = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj)) {
return NULL;
+ }
if (BPy_CurvePoint_Check(obj)) {
self->c->push_vertex_back(((BPy_CurvePoint *)obj)->cp);
@@ -125,8 +128,9 @@ static PyObject *FrsCurve_push_vertex_front(BPy_FrsCurve *self, PyObject *args,
static const char *kwlist[] = {"vertex", NULL};
PyObject *obj = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj)) {
return NULL;
+ }
if (BPy_CurvePoint_Check(obj)) {
self->c->push_vertex_front(((BPy_CurvePoint *)obj)->cp);
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
index 423a61c7f1d..8ba22b0617a 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
@@ -62,12 +62,15 @@ static int Stroke_init(BPy_Stroke *self, PyObject *args, PyObject *kwds)
static const char *kwlist[] = {"brother", NULL};
PyObject *brother = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &Stroke_Type, &brother))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &Stroke_Type, &brother)) {
return -1;
- if (!brother)
+ }
+ if (!brother) {
self->s = new Stroke();
- else
+ }
+ else {
self->s = new Stroke(*(((BPy_Stroke *)brother)->s));
+ }
self->py_if1D.if1D = self->s;
self->py_if1D.borrowed = false;
return 0;
@@ -86,8 +89,9 @@ static Py_ssize_t Stroke_sq_length(BPy_Stroke *self)
static PyObject *Stroke_sq_item(BPy_Stroke *self, int keynum)
{
- if (keynum < 0)
+ if (keynum < 0) {
keynum += Stroke_sq_length(self);
+ }
if (keynum < 0 || keynum >= Stroke_sq_length(self)) {
PyErr_Format(PyExc_IndexError, "Stroke[index]: index %d out of range", keynum);
return NULL;
@@ -115,8 +119,9 @@ static PyObject *Stroke_compute_sampling(BPy_Stroke *self, PyObject *args, PyObj
static const char *kwlist[] = {"n", NULL};
int i;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist, &i))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist, &i)) {
return NULL;
+ }
return PyFloat_FromDouble(self->s->ComputeSampling(i));
}
@@ -215,8 +220,10 @@ static PyObject *Stroke_remove_vertex(BPy_Stroke *self, PyObject *args, PyObject
static const char *kwlist[] = {"vertex", NULL};
PyObject *py_sv = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &StrokeVertex_Type, &py_sv))
+ if (!PyArg_ParseTupleAndKeywords(
+ args, kwds, "O!", (char **)kwlist, &StrokeVertex_Type, &py_sv)) {
return NULL;
+ }
if (((BPy_StrokeVertex *)py_sv)->sv) {
self->s->RemoveVertex(((BPy_StrokeVertex *)py_sv)->sv);
}
@@ -267,8 +274,9 @@ static PyObject *Stroke_stroke_vertices_begin(BPy_Stroke *self, PyObject *args,
static const char *kwlist[] = {"t", NULL};
float f = 0.0f;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f)) {
return NULL;
+ }
StrokeInternal::StrokeVertexIterator sv_it(self->s->strokeVerticesBegin(f));
return BPy_StrokeVertexIterator_from_StrokeVertexIterator(sv_it, false);
}
@@ -386,8 +394,9 @@ static PyObject *Stroke_texture_id_get(BPy_Stroke *self, void *UNUSED(closure))
static int Stroke_texture_id_set(BPy_Stroke *self, PyObject *value, void *UNUSED(closure))
{
unsigned int i = PyLong_AsUnsignedLong(value);
- if (PyErr_Occurred())
+ if (PyErr_Occurred()) {
return -1;
+ }
self->s->setTextureId(i);
return 0;
}
@@ -404,8 +413,9 @@ static PyObject *Stroke_tips_get(BPy_Stroke *self, void *UNUSED(closure))
static int Stroke_tips_set(BPy_Stroke *self, PyObject *value, void *UNUSED(closure))
{
- if (!PyBool_Check(value))
+ if (!PyBool_Check(value)) {
return -1;
+ }
self->s->setTips(bool_from_PyBool(value));
return 0;
}
diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp
index 6331145974a..208d6cbfd6d 100644
--- a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp
@@ -59,12 +59,15 @@ static int ViewEdge_init(BPy_ViewEdge *self, PyObject *args, PyObject *kwds)
static const char *kwlist[] = {"brother", NULL};
PyObject *brother = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &ViewEdge_Type, &brother))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &ViewEdge_Type, &brother)) {
return -1;
- if (!brother)
+ }
+ if (!brother) {
self->ve = new ViewEdge();
- else
+ }
+ else {
self->ve = new ViewEdge(*(((BPy_ViewEdge *)brother)->ve));
+ }
self->py_if1D.if1D = self->ve;
self->py_if1D.borrowed = false;
return 0;
@@ -99,8 +102,9 @@ PyDoc_STRVAR(ViewEdge_first_viewvertex_doc,
static PyObject *ViewEdge_first_viewvertex_get(BPy_ViewEdge *self, void *UNUSED(closure))
{
ViewVertex *v = self->ve->A();
- if (v)
+ if (v) {
return Any_BPy_ViewVertex_from_ViewVertex(*v);
+ }
Py_RETURN_NONE;
}
@@ -108,8 +112,9 @@ static int ViewEdge_first_viewvertex_set(BPy_ViewEdge *self,
PyObject *value,
void *UNUSED(closure))
{
- if (!BPy_ViewVertex_Check(value))
+ if (!BPy_ViewVertex_Check(value)) {
return -1;
+ }
self->ve->setA(((BPy_ViewVertex *)value)->vv);
return 0;
}
@@ -122,15 +127,17 @@ PyDoc_STRVAR(ViewEdge_last_viewvertex_doc,
static PyObject *ViewEdge_last_viewvertex_get(BPy_ViewEdge *self, void *UNUSED(closure))
{
ViewVertex *v = self->ve->B();
- if (v)
+ if (v) {
return Any_BPy_ViewVertex_from_ViewVertex(*v);
+ }
Py_RETURN_NONE;
}
static int ViewEdge_last_viewvertex_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure))
{
- if (!BPy_ViewVertex_Check(value))
+ if (!BPy_ViewVertex_Check(value)) {
return -1;
+ }
self->ve->setB(((BPy_ViewVertex *)value)->vv);
return 0;
}
@@ -143,15 +150,17 @@ PyDoc_STRVAR(ViewEdge_first_fedge_doc,
static PyObject *ViewEdge_first_fedge_get(BPy_ViewEdge *self, void *UNUSED(closure))
{
FEdge *fe = self->ve->fedgeA();
- if (fe)
+ if (fe) {
return Any_BPy_FEdge_from_FEdge(*fe);
+ }
Py_RETURN_NONE;
}
static int ViewEdge_first_fedge_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure))
{
- if (!BPy_FEdge_Check(value))
+ if (!BPy_FEdge_Check(value)) {
return -1;
+ }
self->ve->setFEdgeA(((BPy_FEdge *)value)->fe);
return 0;
}
@@ -164,15 +173,17 @@ PyDoc_STRVAR(ViewEdge_last_fedge_doc,
static PyObject *ViewEdge_last_fedge_get(BPy_ViewEdge *self, void *UNUSED(closure))
{
FEdge *fe = self->ve->fedgeB();
- if (fe)
+ if (fe) {
return Any_BPy_FEdge_from_FEdge(*fe);
+ }
Py_RETURN_NONE;
}
static int ViewEdge_last_fedge_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure))
{
- if (!BPy_FEdge_Check(value))
+ if (!BPy_FEdge_Check(value)) {
return -1;
+ }
self->ve->setFEdgeB(((BPy_FEdge *)value)->fe);
return 0;
}
@@ -185,15 +196,17 @@ PyDoc_STRVAR(ViewEdge_viewshape_doc,
static PyObject *ViewEdge_viewshape_get(BPy_ViewEdge *self, void *UNUSED(closure))
{
ViewShape *vs = self->ve->viewShape();
- if (vs)
+ if (vs) {
return BPy_ViewShape_from_ViewShape(*vs);
+ }
Py_RETURN_NONE;
}
static int ViewEdge_viewshape_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure))
{
- if (!BPy_ViewShape_Check(value))
+ if (!BPy_ViewShape_Check(value)) {
return -1;
+ }
self->ve->setShape(((BPy_ViewShape *)value)->vs);
return 0;
}
@@ -207,15 +220,17 @@ PyDoc_STRVAR(ViewEdge_occludee_doc,
static PyObject *ViewEdge_occludee_get(BPy_ViewEdge *self, void *UNUSED(closure))
{
ViewShape *vs = self->ve->aShape();
- if (vs)
+ if (vs) {
return BPy_ViewShape_from_ViewShape(*vs);
+ }
Py_RETURN_NONE;
}
static int ViewEdge_occludee_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure))
{
- if (!BPy_ViewShape_Check(value))
+ if (!BPy_ViewShape_Check(value)) {
return -1;
+ }
self->ve->setaShape(((BPy_ViewShape *)value)->vs);
return 0;
}
@@ -285,8 +300,9 @@ static int ViewEdge_qi_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(clo
{
int qi;
- if ((qi = PyLong_AsLong(value)) == -1 && PyErr_Occurred())
+ if ((qi = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) {
return -1;
+ }
self->ve->setQI(qi);
return 0;
}
@@ -307,8 +323,9 @@ static int ViewEdge_chaining_time_stamp_set(BPy_ViewEdge *self,
{
int timestamp;
- if ((timestamp = PyLong_AsLong(value)) == -1 && PyErr_Occurred())
+ if ((timestamp = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) {
return -1;
+ }
self->ve->setChainingTimeStamp(timestamp);
return 0;
}
diff --git a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp
index 7a6b2a01728..285100193d3 100644
--- a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp
@@ -64,10 +64,12 @@ static int Chain_init(BPy_Chain *self, PyObject *args, PyObject *kwds)
PyObject *obj = 0;
if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &Chain_Type, &obj)) {
- if (!obj)
+ if (!obj) {
self->c = new Chain();
- else
+ }
+ else {
self->c = new Chain(*(((BPy_Chain *)obj)->c));
+ }
}
else if (PyErr_Clear(),
PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist_2, &Id_Type, &obj)) {
diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp
index e91ae155929..018d0c77bb0 100644
--- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp
@@ -68,10 +68,12 @@ static int FEdgeSharp_init(BPy_FEdgeSharp *self, PyObject *args, PyObject *kwds)
PyObject *obj1 = 0, *obj2 = 0;
if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &FEdgeSharp_Type, &obj1)) {
- if (!obj1)
+ if (!obj1) {
self->fes = new FEdgeSharp();
- else
+ }
+ else {
self->fes = new FEdgeSharp(*(((BPy_FEdgeSharp *)obj1)->fes));
+ }
}
else if (PyErr_Clear(),
PyArg_ParseTupleAndKeywords(args,
@@ -102,8 +104,9 @@ static int FEdgeSharp_init(BPy_FEdgeSharp *self, PyObject *args, PyObject *kwds)
static int FEdgeSharp_mathutils_check(BaseMathObject *bmo)
{
- if (!BPy_FEdgeSharp_Check(bmo->cb_user))
+ if (!BPy_FEdgeSharp_Check(bmo->cb_user)) {
return -1;
+ }
return 0;
}
@@ -266,8 +269,9 @@ static int FEdgeSharp_material_index_right_set(BPy_FEdgeSharp *self,
void *UNUSED(closure))
{
unsigned int i = PyLong_AsUnsignedLong(value);
- if (PyErr_Occurred())
+ if (PyErr_Occurred()) {
return -1;
+ }
self->fes->setaFrsMaterialIndex(i);
return 0;
}
@@ -287,8 +291,9 @@ static int FEdgeSharp_material_index_left_set(BPy_FEdgeSharp *self,
void *UNUSED(closure))
{
unsigned int i = PyLong_AsUnsignedLong(value);
- if (PyErr_Occurred())
+ if (PyErr_Occurred()) {
return -1;
+ }
self->fes->setbFrsMaterialIndex(i);
return 0;
}
@@ -330,8 +335,9 @@ static int FEdgeSharp_face_mark_right_set(BPy_FEdgeSharp *self,
PyObject *value,
void *UNUSED(closure))
{
- if (!PyBool_Check(value))
+ if (!PyBool_Check(value)) {
return -1;
+ }
self->fes->setaFaceMark(bool_from_PyBool(value));
return 0;
}
@@ -350,8 +356,9 @@ static int FEdgeSharp_face_mark_left_set(BPy_FEdgeSharp *self,
PyObject *value,
void *UNUSED(closure))
{
- if (!PyBool_Check(value))
+ if (!PyBool_Check(value)) {
return -1;
+ }
self->fes->setbFaceMark(bool_from_PyBool(value));
return 0;
}
diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp
index 08d18123172..4c2785509f0 100644
--- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp
+++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp
@@ -66,10 +66,12 @@ static int FEdgeSmooth_init(BPy_FEdgeSmooth *self, PyObject *args, PyObject *kwd
if (PyArg_ParseTupleAndKeywords(
args, kwds, "|O!", (char **)kwlist_1, &FEdgeSmooth_Type, &obj1)) {
- if (!obj1)
+ if (!obj1) {
self->fes = new FEdgeSmooth();
- else
+ }
+ else {
self->fes = new FEdgeSmooth(*(((BPy_FEdgeSmooth *)obj1)->fes));
+ }
}
else if (PyErr_Clear(),
PyArg_ParseTupleAndKeywords(args,
@@ -96,8 +98,9 @@ static int FEdgeSmooth_init(BPy_FEdgeSmooth *self, PyObject *args, PyObject *kwd
static int FEdgeSmooth_mathutils_check(BaseMathObject *bmo)
{
- if (!BPy_FEdgeSmooth_Check(bmo->cb_user))
+ if (!BPy_FEdgeSmooth_Check(bmo->cb_user)) {
return -1;
+ }
return 0;
}
@@ -189,8 +192,9 @@ static int FEdgeSmooth_material_index_set(BPy_FEdgeSmooth *self,
void *UNUSED(closure))
{
unsigned int i = PyLong_AsUnsignedLong(value);
- if (PyErr_Occurred())
+ if (PyErr_Occurred()) {
return -1;
+ }
self->fes->setFrsMaterialIndex(i);
return 0;
}
@@ -217,8 +221,9 @@ static PyObject *FEdgeSmooth_face_mark_get(BPy_FEdgeSmooth *self, void *UNUSED(c
static int FEdgeSmooth_face_mark_set(BPy_FEdgeSmooth *self, PyObject *value, void *UNUSED(closure))
{
- if (!PyBool_Check(value))
+ if (!PyBool_Check(value)) {
return -1;
+ }
self->fes->setFaceMark(bool_from_PyBool(value));
return 0;
}
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp
index 6b23ffadffb..4264e96afc3 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp
@@ -121,8 +121,9 @@ static PyObject *AdjacencyIterator_iternext(BPy_AdjacencyIterator *self)
PyErr_SetNone(PyExc_StopIteration);
return NULL;
}
- if (self->at_start)
+ if (self->at_start) {
self->at_start = false;
+ }
else {
self->a_it->increment();
if (self->a_it->isEnd()) {
@@ -148,8 +149,9 @@ static PyObject *AdjacencyIterator_object_get(BPy_AdjacencyIterator *self, void
return NULL;
}
ViewEdge *ve = self->a_it->operator*();
- if (ve)
+ if (ve) {
return BPy_ViewEdge_from_ViewEdge(*ve);
+ }
Py_RETURN_NONE;
}
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp
index 189d41e78a3..28b8e9d7c0a 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp
@@ -85,8 +85,9 @@ PyDoc_STRVAR(ChainPredicateIterator_doc,
static int check_begin(PyObject *obj, void *v)
{
- if (obj != NULL && obj != Py_None && !BPy_ViewEdge_Check(obj))
+ if (obj != NULL && obj != Py_None && !BPy_ViewEdge_Check(obj)) {
return 0;
+ }
*((PyObject **)v) = obj;
return 1;
}
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp
index d72e830e293..401959be0c0 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp
@@ -72,8 +72,9 @@ PyDoc_STRVAR(ChainSilhouetteIterator_doc,
static int check_begin(PyObject *obj, void *v)
{
- if (obj != NULL && obj != Py_None && !BPy_ViewEdge_Check(obj))
+ if (obj != NULL && obj != Py_None && !BPy_ViewEdge_Check(obj)) {
return 0;
+ }
*((PyObject **)v) = obj;
return 1;
}
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp
index 370ef23d8ef..b2042107453 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp
@@ -73,8 +73,9 @@ PyDoc_STRVAR(
static int check_begin(PyObject *obj, void *v)
{
- if (obj != NULL && obj != Py_None && !BPy_ViewEdge_Check(obj))
+ if (obj != NULL && obj != Py_None && !BPy_ViewEdge_Check(obj)) {
return 0;
+ }
*((PyObject **)v) = obj;
return 1;
}
@@ -166,10 +167,12 @@ static PyObject *ChainingIterator_traverse(BPy_ChainingIterator *self,
return NULL;
}
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "O!", (char **)kwlist, &AdjacencyIterator_Type, &py_a_it))
+ args, kwds, "O!", (char **)kwlist, &AdjacencyIterator_Type, &py_a_it)) {
return NULL;
- if (((BPy_AdjacencyIterator *)py_a_it)->a_it)
+ }
+ if (((BPy_AdjacencyIterator *)py_a_it)->a_it) {
self->c_it->traverse(*(((BPy_AdjacencyIterator *)py_a_it)->a_it));
+ }
Py_RETURN_NONE;
}
@@ -196,8 +199,9 @@ static PyObject *ChainingIterator_object_get(BPy_ChainingIterator *self, void *U
return NULL;
}
ViewEdge *ve = self->c_it->operator*();
- if (ve)
+ if (ve) {
return BPy_ViewEdge_from_ViewEdge(*ve);
+ }
Py_RETURN_NONE;
}
@@ -211,8 +215,9 @@ static PyObject *ChainingIterator_next_vertex_get(BPy_ChainingIterator *self,
void *UNUSED(closure))
{
ViewVertex *v = self->c_it->getVertex();
- if (v)
+ if (v) {
return Any_BPy_ViewVertex_from_ViewVertex(*v);
+ }
Py_RETURN_NONE;
}
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp
index 5b287433c13..b33ebc0f4ef 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp
@@ -67,11 +67,13 @@ static int CurvePointIterator_init(BPy_CurvePointIterator *self, PyObject *args,
if (PyArg_ParseTupleAndKeywords(
args, kwds, "|O!", (char **)kwlist_1, &CurvePointIterator_Type, &brother)) {
- if (!brother)
+ if (!brother) {
self->cp_it = new CurveInternal::CurvePointIterator();
- else
+ }
+ else {
self->cp_it = new CurveInternal::CurvePointIterator(
*(((BPy_CurvePointIterator *)brother)->cp_it));
+ }
}
else if (PyErr_Clear(), PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist_2, &step)) {
self->cp_it = new CurveInternal::CurvePointIterator(step);
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp
index 6218541df9b..13a981920f3 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp
@@ -55,12 +55,14 @@ PyDoc_STRVAR(Interface0DIterator_doc,
static int convert_nested_it(PyObject *obj, void *v)
{
- if (!obj || !BPy_Iterator_Check(obj))
+ if (!obj || !BPy_Iterator_Check(obj)) {
return 0;
+ }
Interface0DIteratorNested *nested_it = dynamic_cast<Interface0DIteratorNested *>(
((BPy_Iterator *)obj)->it);
- if (!nested_it)
+ if (!nested_it) {
return 0;
+ }
*((Interface0DIteratorNested **)v) = nested_it;
return 1;
}
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp
index 2a860976d7f..260776e8965 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp
@@ -75,10 +75,12 @@ static int SVertexIterator_init(BPy_SVertexIterator *self, PyObject *args, PyObj
if (PyArg_ParseTupleAndKeywords(
args, kwds, "|O!", (char **)kwlist_1, &SVertexIterator_Type, &obj1)) {
- if (!obj1)
+ if (!obj1) {
self->sv_it = new ViewEdgeInternal::SVertexIterator();
- else
+ }
+ else {
self->sv_it = new ViewEdgeInternal::SVertexIterator(*(((BPy_SVertexIterator *)obj1)->sv_it));
+ }
}
else if (PyErr_Clear(),
PyArg_ParseTupleAndKeywords(args,
@@ -122,8 +124,9 @@ static PyObject *SVertexIterator_object_get(BPy_SVertexIterator *self, void *UNU
return NULL;
}
SVertex *sv = self->sv_it->operator->();
- if (sv)
+ if (sv) {
return BPy_SVertex_from_SVertex(*sv);
+ }
Py_RETURN_NONE;
}
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
index 5727ac2e461..70de25aaf84 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp
@@ -77,11 +77,13 @@ static int StrokeVertexIterator_init(BPy_StrokeVertexIterator *self,
else if (PyErr_Clear(),
PyArg_ParseTupleAndKeywords(
args, kwds, "|O!", (char **)kwlist_2, &Stroke_Type, &stroke)) {
- if (!stroke)
+ if (!stroke) {
self->sv_it = new StrokeInternal::StrokeVertexIterator();
- else
+ }
+ else {
self->sv_it = new StrokeInternal::StrokeVertexIterator(
((BPy_Stroke *)stroke)->s->strokeVerticesBegin());
+ }
self->reversed = false;
self->at_start = true;
}
@@ -225,8 +227,9 @@ static PyObject *StrokeVertexIterator_object_get(BPy_StrokeVertexIterator *self,
return NULL;
}
StrokeVertex *sv = self->sv_it->operator->();
- if (sv)
+ if (sv) {
return BPy_StrokeVertex_from_StrokeVertex(*sv);
+ }
Py_RETURN_NONE;
}
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp
index 525df5dd89b..df56cbe822e 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp
@@ -61,8 +61,9 @@ PyDoc_STRVAR(ViewEdgeIterator_doc,
static int check_begin(PyObject *obj, void *v)
{
- if (obj != NULL && obj != Py_None && !BPy_ViewEdge_Check(obj))
+ if (obj != NULL && obj != Py_None && !BPy_ViewEdge_Check(obj)) {
return 0;
+ }
*((PyObject **)v) = obj;
return 1;
}
@@ -126,8 +127,9 @@ static PyObject *ViewEdgeIterator_object_get(BPy_ViewEdgeIterator *self, void *U
return NULL;
}
ViewEdge *ve = self->ve_it->operator*();
- if (ve)
+ if (ve) {
return BPy_ViewEdge_from_ViewEdge(*ve);
+ }
Py_RETURN_NONE;
}
@@ -140,8 +142,9 @@ static PyObject *ViewEdgeIterator_current_edge_get(BPy_ViewEdgeIterator *self,
void *UNUSED(closure))
{
ViewEdge *ve = self->ve_it->getCurrentEdge();
- if (ve)
+ if (ve) {
return BPy_ViewEdge_from_ViewEdge(*ve);
+ }
Py_RETURN_NONE;
}
@@ -192,8 +195,9 @@ PyDoc_STRVAR(ViewEdgeIterator_begin_doc,
static PyObject *ViewEdgeIterator_begin_get(BPy_ViewEdgeIterator *self, void *UNUSED(closure))
{
ViewEdge *ve = self->ve_it->getBegin();
- if (ve)
+ if (ve) {
return BPy_ViewEdge_from_ViewEdge(*ve);
+ }
Py_RETURN_NONE;
}
diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp
index 21e3e821214..821a92184d1 100644
--- a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp
+++ b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp
@@ -57,8 +57,9 @@ static int orientedViewEdgeIterator_init(BPy_orientedViewEdgeIterator *self,
PyObject *brother = 0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "|O!", (char **)kwlist, &orientedViewEdgeIterator_Type, &brother))
+ args, kwds, "|O!", (char **)kwlist, &orientedViewEdgeIterator_Type, &brother)) {
return -1;
+ }
if (!brother) {
self->ove_it = new ViewVertexInternal::orientedViewEdgeIterator();
self->at_start = true;
@@ -95,8 +96,9 @@ static PyObject *orientedViewEdgeIterator_iternext(BPy_orientedViewEdgeIterator
PyErr_SetNone(PyExc_StopIteration);
return NULL;
}
- if (self->at_start)
+ if (self->at_start) {
self->at_start = false;
+ }
else {
self->ove_it->increment();
if (self->ove_it->isEnd()) {
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp
index 9a37acbd788..efe96b72061 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp
@@ -57,8 +57,9 @@ static int BackboneStretcherShader___init__(BPy_BackboneStretcherShader *self,
static const char *kwlist[] = {"amount", NULL};
float f = 2.0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f)) {
return -1;
+ }
self->py_ss.ss = new StrokeShaders::BackboneStretcherShader(f);
return 0;
}
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp
index ff5b98cf912..2336b1ce902 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp
@@ -57,8 +57,9 @@ static int BezierCurveShader___init__(BPy_BezierCurveShader *self, PyObject *arg
static const char *kwlist[] = {"error", NULL};
float f = 4.0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f)) {
return -1;
+ }
self->py_ss.ss = new StrokeShaders::BezierCurveShader(f);
return 0;
}
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp
index 2984f52203d..eaed138f61a 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp
@@ -63,8 +63,9 @@ static int BlenderTextureShader___init__(BPy_BlenderTextureShader *self,
MTex *_mtex;
bNodeTree *_nodetree;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O", (char **)kwlist, &obj)) {
return -1;
+ }
_mtex = (MTex *)PyC_RNA_AsPointer(obj, "LineStyleTextureSlot");
if (_mtex) {
self->py_ss.ss = new StrokeShaders::BlenderTextureShader(_mtex);
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp
index 8de33188639..81320e9b5a1 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp
@@ -56,8 +56,9 @@ static int ColorNoiseShader___init__(BPy_ColorNoiseShader *self, PyObject *args,
static const char *kwlist[] = {"amplitude", "period", NULL};
float f1, f2;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "ff", (char **)kwlist, &f1, &f2))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "ff", (char **)kwlist, &f1, &f2)) {
return -1;
+ }
self->py_ss.ss = new StrokeShaders::ColorNoiseShader(f1, f2);
return 0;
}
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp
index 6dbbd1396d9..c5d65734aa5 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp
@@ -62,8 +62,9 @@ static int ConstantColorShader___init__(BPy_ConstantColorShader *self,
static const char *kwlist[] = {"red", "green", "blue", "alpha", NULL};
float f1, f2, f3, f4 = 1.0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "fff|f", (char **)kwlist, &f1, &f2, &f3, &f4))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "fff|f", (char **)kwlist, &f1, &f2, &f3, &f4)) {
return -1;
+ }
self->py_ss.ss = new StrokeShaders::ConstantColorShader(f1, f2, f3, f4);
return 0;
}
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp
index 5177d275a10..00fbfe525c3 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp
@@ -56,8 +56,9 @@ static int ConstantThicknessShader___init__(BPy_ConstantThicknessShader *self,
static const char *kwlist[] = {"thickness", NULL};
float f;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f)) {
return -1;
+ }
self->py_ss.ss = new StrokeShaders::ConstantThicknessShader(f);
return 0;
}
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp
index 4afe148c066..ebafe84fee0 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp
@@ -62,8 +62,9 @@ static int ConstrainedIncreasingThicknessShader___init__(
static const char *kwlist[] = {"thickness_min", "thickness_max", "ratio", NULL};
float f1, f2, f3;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "fff", (char **)kwlist, &f1, &f2, &f3))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "fff", (char **)kwlist, &f1, &f2, &f3)) {
return -1;
+ }
self->py_ss.ss = new StrokeShaders::ConstrainedIncreasingThicknessShader(f1, f2, f3);
return 0;
}
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp
index a3cf272a1ab..ff875fa98d3 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp
@@ -64,8 +64,9 @@ static int GuidingLinesShader___init__(BPy_GuidingLinesShader *self,
static const char *kwlist[] = {"offset", NULL};
float f;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f)) {
return -1;
+ }
self->py_ss.ss = new StrokeShaders::GuidingLinesShader(f);
return 0;
}
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp
index 57d8f3201b1..3c7ba689b28 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp
@@ -84,8 +84,9 @@ static int IncreasingColorShader___init__(BPy_IncreasingColorShader *self,
float f1, f2, f3, f4, f5, f6, f7, f8;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "ffffffff", (char **)kwlist, &f1, &f2, &f3, &f4, &f5, &f6, &f7, &f8))
+ args, kwds, "ffffffff", (char **)kwlist, &f1, &f2, &f3, &f4, &f5, &f6, &f7, &f8)) {
return -1;
+ }
self->py_ss.ss = new StrokeShaders::IncreasingColorShader(f1, f2, f3, f4, f5, f6, f7, f8);
return 0;
}
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp
index b791fc598df..e04fa45be36 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp
@@ -62,8 +62,9 @@ static int IncreasingThicknessShader___init__(BPy_IncreasingThicknessShader *sel
static const char *kwlist[] = {"thickness_A", "thickness_B", NULL};
float f1, f2;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "ff", (char **)kwlist, &f1, &f2))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "ff", (char **)kwlist, &f1, &f2)) {
return -1;
+ }
self->py_ss.ss = new StrokeShaders::IncreasingThicknessShader(f1, f2);
return 0;
}
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp
index 7eb20d47539..8128a6dd8ad 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp
@@ -63,8 +63,9 @@ static int PolygonalizationShader___init__(BPy_PolygonalizationShader *self,
static const char *kwlist[] = {"error", NULL};
float f;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f)) {
return -1;
+ }
self->py_ss.ss = new StrokeShaders::PolygonalizationShader(f);
return 0;
}
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp
index 8769433123a..ad8b8ef786b 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp
@@ -54,8 +54,9 @@ static int SamplingShader___init__(BPy_SamplingShader *self, PyObject *args, PyO
static const char *kwlist[] = {"sampling", NULL};
float f;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f)) {
return -1;
+ }
self->py_ss.ss = new StrokeShaders::SamplingShader(f);
return 0;
}
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp
index e8183b41d05..93a14edd964 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp
@@ -56,8 +56,9 @@ static int StrokeTextureStepShader___init__(BPy_StrokeTextureStepShader *self,
static const char *kwlist[] = {"step", NULL};
float step = 0.1;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &step))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &step)) {
return -1;
+ }
self->py_ss.ss = new StrokeShaders::StrokeTextureStepShader(step);
return 0;
}
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp
index 56f04fb9c88..966dc050985 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp
@@ -58,8 +58,9 @@ static int ThicknessNoiseShader___init__(BPy_ThicknessNoiseShader *self,
static const char *kwlist[] = {"amplitude", "period", NULL};
float f1, f2;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "ff", (char **)kwlist, &f1, &f2))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "ff", (char **)kwlist, &f1, &f2)) {
return -1;
+ }
self->py_ss.ss = new StrokeShaders::ThicknessNoiseShader(f1, f2);
return 0;
}
diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp
index 3c3c31f4a70..001e6ce23ba 100644
--- a/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp
+++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp
@@ -55,8 +55,9 @@ static int TipRemoverShader___init__(BPy_TipRemoverShader *self, PyObject *args,
static const char *kwlist[] = {"tip_length", NULL};
double d;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "d", (char **)kwlist, &d))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "d", (char **)kwlist, &d)) {
return -1;
+ }
self->py_ss.ss = new StrokeShaders::TipRemoverShader(d);
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp
index 2b3aaf6f3cd..d1ea13c90a7 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp
@@ -44,61 +44,73 @@ extern "C" {
int UnaryFunction0DDouble_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&UnaryFunction0DDouble_Type) < 0)
+ if (PyType_Ready(&UnaryFunction0DDouble_Type) < 0) {
return -1;
+ }
Py_INCREF(&UnaryFunction0DDouble_Type);
PyModule_AddObject(module, "UnaryFunction0DDouble", (PyObject *)&UnaryFunction0DDouble_Type);
- if (PyType_Ready(&DensityF0D_Type) < 0)
+ if (PyType_Ready(&DensityF0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&DensityF0D_Type);
PyModule_AddObject(module, "DensityF0D", (PyObject *)&DensityF0D_Type);
- if (PyType_Ready(&LocalAverageDepthF0D_Type) < 0)
+ if (PyType_Ready(&LocalAverageDepthF0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&LocalAverageDepthF0D_Type);
PyModule_AddObject(module, "LocalAverageDepthF0D", (PyObject *)&LocalAverageDepthF0D_Type);
- if (PyType_Ready(&Curvature2DAngleF0D_Type) < 0)
+ if (PyType_Ready(&Curvature2DAngleF0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&Curvature2DAngleF0D_Type);
PyModule_AddObject(module, "Curvature2DAngleF0D", (PyObject *)&Curvature2DAngleF0D_Type);
- if (PyType_Ready(&GetProjectedXF0D_Type) < 0)
+ if (PyType_Ready(&GetProjectedXF0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&GetProjectedXF0D_Type);
PyModule_AddObject(module, "GetProjectedXF0D", (PyObject *)&GetProjectedXF0D_Type);
- if (PyType_Ready(&GetProjectedYF0D_Type) < 0)
+ if (PyType_Ready(&GetProjectedYF0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&GetProjectedYF0D_Type);
PyModule_AddObject(module, "GetProjectedYF0D", (PyObject *)&GetProjectedYF0D_Type);
- if (PyType_Ready(&GetProjectedZF0D_Type) < 0)
+ if (PyType_Ready(&GetProjectedZF0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&GetProjectedZF0D_Type);
PyModule_AddObject(module, "GetProjectedZF0D", (PyObject *)&GetProjectedZF0D_Type);
- if (PyType_Ready(&GetXF0D_Type) < 0)
+ if (PyType_Ready(&GetXF0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&GetXF0D_Type);
PyModule_AddObject(module, "GetXF0D", (PyObject *)&GetXF0D_Type);
- if (PyType_Ready(&GetYF0D_Type) < 0)
+ if (PyType_Ready(&GetYF0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&GetYF0D_Type);
PyModule_AddObject(module, "GetYF0D", (PyObject *)&GetYF0D_Type);
- if (PyType_Ready(&GetZF0D_Type) < 0)
+ if (PyType_Ready(&GetZF0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&GetZF0D_Type);
PyModule_AddObject(module, "GetZF0D", (PyObject *)&GetZF0D_Type);
- if (PyType_Ready(&ZDiscontinuityF0D_Type) < 0)
+ if (PyType_Ready(&ZDiscontinuityF0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&ZDiscontinuityF0D_Type);
PyModule_AddObject(module, "ZDiscontinuityF0D", (PyObject *)&ZDiscontinuityF0D_Type);
@@ -123,8 +135,9 @@ static int UnaryFunction0DDouble___init__(BPy_UnaryFunction0DDouble *self,
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->uf0D_double = new UnaryFunction0D<double>();
self->uf0D_double->py_uf0D = (PyObject *)self;
return 0;
@@ -132,8 +145,9 @@ static int UnaryFunction0DDouble___init__(BPy_UnaryFunction0DDouble *self,
static void UnaryFunction0DDouble___dealloc__(BPy_UnaryFunction0DDouble *self)
{
- if (self->uf0D_double)
+ if (self->uf0D_double) {
delete self->uf0D_double;
+ }
UnaryFunction0D_Type.tp_dealloc((PyObject *)self);
}
@@ -150,8 +164,9 @@ static PyObject *UnaryFunction0DDouble___call__(BPy_UnaryFunction0DDouble *self,
PyObject *obj;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj))
+ args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) {
return NULL;
+ }
if (typeid(*(self->uf0D_double)) == typeid(UnaryFunction0D<double>)) {
PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp
index f6292f0086a..00600c405ef 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp
@@ -35,17 +35,20 @@ extern "C" {
int UnaryFunction0DEdgeNature_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&UnaryFunction0DEdgeNature_Type) < 0)
+ if (PyType_Ready(&UnaryFunction0DEdgeNature_Type) < 0) {
return -1;
+ }
Py_INCREF(&UnaryFunction0DEdgeNature_Type);
PyModule_AddObject(
module, "UnaryFunction0DEdgeNature", (PyObject *)&UnaryFunction0DEdgeNature_Type);
- if (PyType_Ready(&CurveNatureF0D_Type) < 0)
+ if (PyType_Ready(&CurveNatureF0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&CurveNatureF0D_Type);
PyModule_AddObject(module, "CurveNatureF0D", (PyObject *)&CurveNatureF0D_Type);
@@ -70,8 +73,9 @@ static int UnaryFunction0DEdgeNature___init__(BPy_UnaryFunction0DEdgeNature *sel
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->uf0D_edgenature = new UnaryFunction0D<Nature::EdgeNature>();
self->uf0D_edgenature->py_uf0D = (PyObject *)self;
return 0;
@@ -79,8 +83,9 @@ static int UnaryFunction0DEdgeNature___init__(BPy_UnaryFunction0DEdgeNature *sel
static void UnaryFunction0DEdgeNature___dealloc__(BPy_UnaryFunction0DEdgeNature *self)
{
- if (self->uf0D_edgenature)
+ if (self->uf0D_edgenature) {
delete self->uf0D_edgenature;
+ }
UnaryFunction0D_Type.tp_dealloc((PyObject *)self);
}
@@ -98,8 +103,9 @@ static PyObject *UnaryFunction0DEdgeNature___call__(BPy_UnaryFunction0DEdgeNatur
PyObject *obj;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj))
+ args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) {
return NULL;
+ }
if (typeid(*(self->uf0D_edgenature)) == typeid(UnaryFunction0D<Nature::EdgeNature>)) {
PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp
index 150b8f4e553..3961bf58bc4 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp
@@ -40,44 +40,52 @@ extern "C" {
int UnaryFunction0DFloat_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&UnaryFunction0DFloat_Type) < 0)
+ if (PyType_Ready(&UnaryFunction0DFloat_Type) < 0) {
return -1;
+ }
Py_INCREF(&UnaryFunction0DFloat_Type);
PyModule_AddObject(module, "UnaryFunction0DFloat", (PyObject *)&UnaryFunction0DFloat_Type);
- if (PyType_Ready(&GetCurvilinearAbscissaF0D_Type) < 0)
+ if (PyType_Ready(&GetCurvilinearAbscissaF0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&GetCurvilinearAbscissaF0D_Type);
PyModule_AddObject(
module, "GetCurvilinearAbscissaF0D", (PyObject *)&GetCurvilinearAbscissaF0D_Type);
- if (PyType_Ready(&GetParameterF0D_Type) < 0)
+ if (PyType_Ready(&GetParameterF0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&GetParameterF0D_Type);
PyModule_AddObject(module, "GetParameterF0D", (PyObject *)&GetParameterF0D_Type);
- if (PyType_Ready(&GetViewMapGradientNormF0D_Type) < 0)
+ if (PyType_Ready(&GetViewMapGradientNormF0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&GetViewMapGradientNormF0D_Type);
PyModule_AddObject(
module, "GetViewMapGradientNormF0D", (PyObject *)&GetViewMapGradientNormF0D_Type);
- if (PyType_Ready(&ReadCompleteViewMapPixelF0D_Type) < 0)
+ if (PyType_Ready(&ReadCompleteViewMapPixelF0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&ReadCompleteViewMapPixelF0D_Type);
PyModule_AddObject(
module, "ReadCompleteViewMapPixelF0D", (PyObject *)&ReadCompleteViewMapPixelF0D_Type);
- if (PyType_Ready(&ReadMapPixelF0D_Type) < 0)
+ if (PyType_Ready(&ReadMapPixelF0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&ReadMapPixelF0D_Type);
PyModule_AddObject(module, "ReadMapPixelF0D", (PyObject *)&ReadMapPixelF0D_Type);
- if (PyType_Ready(&ReadSteerableViewMapPixelF0D_Type) < 0)
+ if (PyType_Ready(&ReadSteerableViewMapPixelF0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&ReadSteerableViewMapPixelF0D_Type);
PyModule_AddObject(
module, "ReadSteerableViewMapPixelF0D", (PyObject *)&ReadSteerableViewMapPixelF0D_Type);
@@ -103,8 +111,9 @@ static int UnaryFunction0DFloat___init__(BPy_UnaryFunction0DFloat *self,
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->uf0D_float = new UnaryFunction0D<float>();
self->uf0D_float->py_uf0D = (PyObject *)self;
return 0;
@@ -112,8 +121,9 @@ static int UnaryFunction0DFloat___init__(BPy_UnaryFunction0DFloat *self,
static void UnaryFunction0DFloat___dealloc__(BPy_UnaryFunction0DFloat *self)
{
- if (self->uf0D_float)
+ if (self->uf0D_float) {
delete self->uf0D_float;
+ }
UnaryFunction0D_Type.tp_dealloc((PyObject *)self);
}
@@ -130,8 +140,9 @@ static PyObject *UnaryFunction0DFloat___call__(BPy_UnaryFunction0DFloat *self,
PyObject *obj;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj))
+ args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) {
return NULL;
+ }
if (typeid(*(self->uf0D_float)) == typeid(UnaryFunction0D<float>)) {
PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp
index e9455f3dd39..86e902bafe4 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp
@@ -35,16 +35,19 @@ extern "C" {
int UnaryFunction0DId_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&UnaryFunction0DId_Type) < 0)
+ if (PyType_Ready(&UnaryFunction0DId_Type) < 0) {
return -1;
+ }
Py_INCREF(&UnaryFunction0DId_Type);
PyModule_AddObject(module, "UnaryFunction0DId", (PyObject *)&UnaryFunction0DId_Type);
- if (PyType_Ready(&ShapeIdF0D_Type) < 0)
+ if (PyType_Ready(&ShapeIdF0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&ShapeIdF0D_Type);
PyModule_AddObject(module, "ShapeIdF0D", (PyObject *)&ShapeIdF0D_Type);
@@ -67,8 +70,9 @@ static int UnaryFunction0DId___init__(BPy_UnaryFunction0DId *self, PyObject *arg
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->uf0D_id = new UnaryFunction0D<Id>();
self->uf0D_id->py_uf0D = (PyObject *)self;
return 0;
@@ -76,8 +80,9 @@ static int UnaryFunction0DId___init__(BPy_UnaryFunction0DId *self, PyObject *arg
static void UnaryFunction0DId___dealloc__(BPy_UnaryFunction0DId *self)
{
- if (self->uf0D_id)
+ if (self->uf0D_id) {
delete self->uf0D_id;
+ }
UnaryFunction0D_Type.tp_dealloc((PyObject *)self);
}
@@ -94,8 +99,9 @@ static PyObject *UnaryFunction0DId___call__(BPy_UnaryFunction0DId *self,
PyObject *obj;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj))
+ args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) {
return NULL;
+ }
if (typeid(*(self->uf0D_id)) == typeid(UnaryFunction0D<Id>)) {
PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp
index 63f9ff0deb8..551429add8b 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp
@@ -35,16 +35,19 @@ extern "C" {
int UnaryFunction0DMaterial_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&UnaryFunction0DMaterial_Type) < 0)
+ if (PyType_Ready(&UnaryFunction0DMaterial_Type) < 0) {
return -1;
+ }
Py_INCREF(&UnaryFunction0DMaterial_Type);
PyModule_AddObject(module, "UnaryFunction0DMaterial", (PyObject *)&UnaryFunction0DMaterial_Type);
- if (PyType_Ready(&MaterialF0D_Type) < 0)
+ if (PyType_Ready(&MaterialF0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&MaterialF0D_Type);
PyModule_AddObject(module, "MaterialF0D", (PyObject *)&MaterialF0D_Type);
@@ -69,8 +72,9 @@ static int UnaryFunction0DMaterial___init__(BPy_UnaryFunction0DMaterial *self,
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->uf0D_material = new UnaryFunction0D<FrsMaterial>();
self->uf0D_material->py_uf0D = (PyObject *)self;
return 0;
@@ -78,8 +82,9 @@ static int UnaryFunction0DMaterial___init__(BPy_UnaryFunction0DMaterial *self,
static void UnaryFunction0DMaterial___dealloc__(BPy_UnaryFunction0DMaterial *self)
{
- if (self->uf0D_material)
+ if (self->uf0D_material) {
delete self->uf0D_material;
+ }
UnaryFunction0D_Type.tp_dealloc((PyObject *)self);
}
@@ -97,8 +102,9 @@ static PyObject *UnaryFunction0DMaterial___call__(BPy_UnaryFunction0DMaterial *s
PyObject *obj;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj))
+ args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) {
return NULL;
+ }
if (typeid(*(self->uf0D_material)) == typeid(UnaryFunction0D<FrsMaterial>)) {
PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp
index 65d8d630fce..8721e820fee 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp
@@ -35,16 +35,19 @@ extern "C" {
int UnaryFunction0DUnsigned_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&UnaryFunction0DUnsigned_Type) < 0)
+ if (PyType_Ready(&UnaryFunction0DUnsigned_Type) < 0) {
return -1;
+ }
Py_INCREF(&UnaryFunction0DUnsigned_Type);
PyModule_AddObject(module, "UnaryFunction0DUnsigned", (PyObject *)&UnaryFunction0DUnsigned_Type);
- if (PyType_Ready(&QuantitativeInvisibilityF0D_Type) < 0)
+ if (PyType_Ready(&QuantitativeInvisibilityF0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&QuantitativeInvisibilityF0D_Type);
PyModule_AddObject(
module, "QuantitativeInvisibilityF0D", (PyObject *)&QuantitativeInvisibilityF0D_Type);
@@ -70,8 +73,9 @@ static int UnaryFunction0DUnsigned___init__(BPy_UnaryFunction0DUnsigned *self,
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->uf0D_unsigned = new UnaryFunction0D<unsigned int>();
self->uf0D_unsigned->py_uf0D = (PyObject *)self;
return 0;
@@ -79,8 +83,9 @@ static int UnaryFunction0DUnsigned___init__(BPy_UnaryFunction0DUnsigned *self,
static void UnaryFunction0DUnsigned___dealloc__(BPy_UnaryFunction0DUnsigned *self)
{
- if (self->uf0D_unsigned)
+ if (self->uf0D_unsigned) {
delete self->uf0D_unsigned;
+ }
UnaryFunction0D_Type.tp_dealloc((PyObject *)self);
}
@@ -98,8 +103,9 @@ static PyObject *UnaryFunction0DUnsigned___call__(BPy_UnaryFunction0DUnsigned *s
PyObject *obj;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj))
+ args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) {
return NULL;
+ }
if (typeid(*(self->uf0D_unsigned)) == typeid(UnaryFunction0D<unsigned int>)) {
PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp
index 48cb3453ea8..44a39af68dd 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp
@@ -36,21 +36,25 @@ extern "C" {
int UnaryFunction0DVec2f_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&UnaryFunction0DVec2f_Type) < 0)
+ if (PyType_Ready(&UnaryFunction0DVec2f_Type) < 0) {
return -1;
+ }
Py_INCREF(&UnaryFunction0DVec2f_Type);
PyModule_AddObject(module, "UnaryFunction0DVec2f", (PyObject *)&UnaryFunction0DVec2f_Type);
- if (PyType_Ready(&Normal2DF0D_Type) < 0)
+ if (PyType_Ready(&Normal2DF0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&Normal2DF0D_Type);
PyModule_AddObject(module, "Normal2DF0D", (PyObject *)&Normal2DF0D_Type);
- if (PyType_Ready(&VertexOrientation2DF0D_Type) < 0)
+ if (PyType_Ready(&VertexOrientation2DF0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&VertexOrientation2DF0D_Type);
PyModule_AddObject(module, "VertexOrientation2DF0D", (PyObject *)&VertexOrientation2DF0D_Type);
@@ -75,8 +79,9 @@ static int UnaryFunction0DVec2f___init__(BPy_UnaryFunction0DVec2f *self,
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->uf0D_vec2f = new UnaryFunction0D<Vec2f>();
self->uf0D_vec2f->py_uf0D = (PyObject *)self;
return 0;
@@ -84,8 +89,9 @@ static int UnaryFunction0DVec2f___init__(BPy_UnaryFunction0DVec2f *self,
static void UnaryFunction0DVec2f___dealloc__(BPy_UnaryFunction0DVec2f *self)
{
- if (self->uf0D_vec2f)
+ if (self->uf0D_vec2f) {
delete self->uf0D_vec2f;
+ }
UnaryFunction0D_Type.tp_dealloc((PyObject *)self);
}
@@ -102,8 +108,9 @@ static PyObject *UnaryFunction0DVec2f___call__(BPy_UnaryFunction0DVec2f *self,
PyObject *obj;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj))
+ args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) {
return NULL;
+ }
if (typeid(*(self->uf0D_vec2f)) == typeid(UnaryFunction0D<Vec2f>)) {
PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp
index 6b12136693f..6a27fc6e140 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp
@@ -35,16 +35,19 @@ extern "C" {
int UnaryFunction0DVec3f_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&UnaryFunction0DVec3f_Type) < 0)
+ if (PyType_Ready(&UnaryFunction0DVec3f_Type) < 0) {
return -1;
+ }
Py_INCREF(&UnaryFunction0DVec3f_Type);
PyModule_AddObject(module, "UnaryFunction0DVec3f", (PyObject *)&UnaryFunction0DVec3f_Type);
- if (PyType_Ready(&VertexOrientation3DF0D_Type) < 0)
+ if (PyType_Ready(&VertexOrientation3DF0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&VertexOrientation3DF0D_Type);
PyModule_AddObject(module, "VertexOrientation3DF0D", (PyObject *)&VertexOrientation3DF0D_Type);
@@ -69,8 +72,9 @@ static int UnaryFunction0DVec3f___init__(BPy_UnaryFunction0DVec3f *self,
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->uf0D_vec3f = new UnaryFunction0D<Vec3f>();
self->uf0D_vec3f->py_uf0D = (PyObject *)self;
return 0;
@@ -78,8 +82,9 @@ static int UnaryFunction0DVec3f___init__(BPy_UnaryFunction0DVec3f *self,
static void UnaryFunction0DVec3f___dealloc__(BPy_UnaryFunction0DVec3f *self)
{
- if (self->uf0D_vec3f)
+ if (self->uf0D_vec3f) {
delete self->uf0D_vec3f;
+ }
UnaryFunction0D_Type.tp_dealloc((PyObject *)self);
}
@@ -96,8 +101,9 @@ static PyObject *UnaryFunction0DVec3f___call__(BPy_UnaryFunction0DVec3f *self,
PyObject *obj;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj))
+ args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) {
return NULL;
+ }
if (typeid(*(self->uf0D_vec3f)) == typeid(UnaryFunction0D<Vec3f>)) {
PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp
index d908b3fa6ed..88c050e243e 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp
@@ -35,17 +35,20 @@ extern "C" {
int UnaryFunction0DVectorViewShape_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&UnaryFunction0DVectorViewShape_Type) < 0)
+ if (PyType_Ready(&UnaryFunction0DVectorViewShape_Type) < 0) {
return -1;
+ }
Py_INCREF(&UnaryFunction0DVectorViewShape_Type);
PyModule_AddObject(
module, "UnaryFunction0DVectorViewShape", (PyObject *)&UnaryFunction0DVectorViewShape_Type);
- if (PyType_Ready(&GetOccludersF0D_Type) < 0)
+ if (PyType_Ready(&GetOccludersF0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&GetOccludersF0D_Type);
PyModule_AddObject(module, "GetOccludersF0D", (PyObject *)&GetOccludersF0D_Type);
@@ -71,8 +74,9 @@ static int UnaryFunction0DVectorViewShape___init__(BPy_UnaryFunction0DVectorView
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->uf0D_vectorviewshape = new UnaryFunction0D<std::vector<ViewShape *>>();
self->uf0D_vectorviewshape->py_uf0D = (PyObject *)self;
return 0;
@@ -80,8 +84,9 @@ static int UnaryFunction0DVectorViewShape___init__(BPy_UnaryFunction0DVectorView
static void UnaryFunction0DVectorViewShape___dealloc__(BPy_UnaryFunction0DVectorViewShape *self)
{
- if (self->uf0D_vectorviewshape)
+ if (self->uf0D_vectorviewshape) {
delete self->uf0D_vectorviewshape;
+ }
UnaryFunction0D_Type.tp_dealloc((PyObject *)self);
}
@@ -99,8 +104,9 @@ static PyObject *UnaryFunction0DVectorViewShape___call__(BPy_UnaryFunction0DVect
PyObject *obj;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj))
+ args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) {
return NULL;
+ }
if (typeid(*(self->uf0D_vectorviewshape)) == typeid(UnaryFunction0D<std::vector<ViewShape *>>)) {
PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp
index 8c04d8eabaa..11f4e114342 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp
@@ -36,22 +36,26 @@ extern "C" {
int UnaryFunction0DViewShape_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&UnaryFunction0DViewShape_Type) < 0)
+ if (PyType_Ready(&UnaryFunction0DViewShape_Type) < 0) {
return -1;
+ }
Py_INCREF(&UnaryFunction0DViewShape_Type);
PyModule_AddObject(
module, "UnaryFunction0DViewShape", (PyObject *)&UnaryFunction0DViewShape_Type);
- if (PyType_Ready(&GetOccludeeF0D_Type) < 0)
+ if (PyType_Ready(&GetOccludeeF0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&GetOccludeeF0D_Type);
PyModule_AddObject(module, "GetOccludeeF0D", (PyObject *)&GetOccludeeF0D_Type);
- if (PyType_Ready(&GetShapeF0D_Type) < 0)
+ if (PyType_Ready(&GetShapeF0D_Type) < 0) {
return -1;
+ }
Py_INCREF(&GetShapeF0D_Type);
PyModule_AddObject(module, "GetShapeF0D", (PyObject *)&GetShapeF0D_Type);
@@ -76,8 +80,9 @@ static int UnaryFunction0DViewShape___init__(BPy_UnaryFunction0DViewShape *self,
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->uf0D_viewshape = new UnaryFunction0D<ViewShape *>();
self->uf0D_viewshape->py_uf0D = (PyObject *)self;
return 0;
@@ -85,8 +90,9 @@ static int UnaryFunction0DViewShape___init__(BPy_UnaryFunction0DViewShape *self,
static void UnaryFunction0DViewShape___dealloc__(BPy_UnaryFunction0DViewShape *self)
{
- if (self->uf0D_viewshape)
+ if (self->uf0D_viewshape) {
delete self->uf0D_viewshape;
+ }
UnaryFunction0D_Type.tp_dealloc((PyObject *)self);
}
@@ -104,8 +110,9 @@ static PyObject *UnaryFunction0DViewShape___call__(BPy_UnaryFunction0DViewShape
PyObject *obj;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj))
+ args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) {
return NULL;
+ }
if (typeid(*(self->uf0D_viewshape)) == typeid(UnaryFunction0D<ViewShape *>)) {
PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp
index 6529c4f435b..6d4406b17a7 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp
@@ -59,8 +59,9 @@ static int ShapeIdF0D___init__(BPy_ShapeIdF0D *self, PyObject *args, PyObject *k
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_uf0D_id.uf0D_id = new Functions0D::ShapeIdF0D();
self->py_uf0D_id.uf0D_id->py_uf0D = (PyObject *)self;
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp
index 6fb65b8f132..a9050c4594e 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp
@@ -62,8 +62,9 @@ static int MaterialF0D___init__(BPy_MaterialF0D *self, PyObject *args, PyObject
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_uf0D_material.uf0D_material = new Functions0D::MaterialF0D();
self->py_uf0D_material.uf0D_material->py_uf0D = (PyObject *)self;
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp
index a3e5871b20d..1173b2434d6 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp
@@ -53,8 +53,9 @@ static int CurveNatureF0D___init__(BPy_CurveNatureF0D *self, PyObject *args, PyO
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_uf0D_edgenature.uf0D_edgenature = new Functions0D::CurveNatureF0D();
self->py_uf0D_edgenature.uf0D_edgenature->py_uf0D = (PyObject *)self;
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp
index cd50e23f1d7..673522a055e 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp
@@ -55,8 +55,9 @@ static int Normal2DF0D___init__(BPy_Normal2DF0D *self, PyObject *args, PyObject
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_uf0D_vec2f.uf0D_vec2f = new Functions0D::Normal2DF0D();
self->py_uf0D_vec2f.uf0D_vec2f->py_uf0D = (PyObject *)self;
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp
index ec3755987d1..5ec616c90c1 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp
@@ -57,8 +57,9 @@ static int VertexOrientation2DF0D___init__(BPy_VertexOrientation2DF0D *self,
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_uf0D_vec2f.uf0D_vec2f = new Functions0D::VertexOrientation2DF0D();
self->py_uf0D_vec2f.uf0D_vec2f->py_uf0D = (PyObject *)self;
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp
index d5e073b5802..6db4c9317e2 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp
@@ -57,8 +57,9 @@ static int VertexOrientation3DF0D___init__(BPy_VertexOrientation3DF0D *self,
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_uf0D_vec3f.uf0D_vec3f = new Functions0D::VertexOrientation3DF0D();
self->py_uf0D_vec3f.uf0D_vec3f->py_uf0D = (PyObject *)self;
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp
index 88f4b9d32ec..827c089aa1a 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp
@@ -52,8 +52,9 @@ static int GetOccludeeF0D___init__(BPy_GetOccludeeF0D *self, PyObject *args, PyO
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_uf0D_viewshape.uf0D_viewshape = new Functions0D::GetOccludeeF0D();
self->py_uf0D_viewshape.uf0D_viewshape->py_uf0D = (PyObject *)self;
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp
index 558e403d09c..31b36dbf855 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp
@@ -52,8 +52,9 @@ static int GetShapeF0D___init__(BPy_GetShapeF0D *self, PyObject *args, PyObject
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_uf0D_viewshape.uf0D_viewshape = new Functions0D::GetShapeF0D();
self->py_uf0D_viewshape.uf0D_viewshape->py_uf0D = (PyObject *)self;
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp
index 0205adada46..5f1d123c8d3 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp
@@ -57,8 +57,9 @@ static int Curvature2DAngleF0D___init__(BPy_Curvature2DAngleF0D *self,
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_uf0D_double.uf0D_double = new Functions0D::Curvature2DAngleF0D();
self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self;
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp
index c18a4e1ab40..736afca7fae 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp
@@ -62,8 +62,9 @@ static int DensityF0D___init__(BPy_DensityF0D *self, PyObject *args, PyObject *k
static const char *kwlist[] = {"sigma", NULL};
double d = 2;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "|d", (char **)kwlist, &d))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|d", (char **)kwlist, &d)) {
return -1;
+ }
self->py_uf0D_double.uf0D_double = new Functions0D::DensityF0D(d);
self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self;
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp
index 6bf7fd3895c..d3cd14a1aba 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp
@@ -52,8 +52,9 @@ static int GetProjectedXF0D___init__(BPy_GetProjectedXF0D *self, PyObject *args,
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_uf0D_double.uf0D_double = new Functions0D::GetProjectedXF0D();
self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self;
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp
index af2b05bcc02..92d5a1e4216 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp
@@ -52,8 +52,9 @@ static int GetProjectedYF0D___init__(BPy_GetProjectedYF0D *self, PyObject *args,
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_uf0D_double.uf0D_double = new Functions0D::GetProjectedYF0D();
self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self;
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp
index db066f445f5..cb2a5e3a102 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp
@@ -52,8 +52,9 @@ static int GetProjectedZF0D___init__(BPy_GetProjectedZF0D *self, PyObject *args,
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_uf0D_double.uf0D_double = new Functions0D::GetProjectedZF0D();
self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self;
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp
index e95b9146248..dd75001f3bd 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp
@@ -52,8 +52,9 @@ static int GetXF0D___init__(BPy_GetXF0D *self, PyObject *args, PyObject *kwds)
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_uf0D_double.uf0D_double = new Functions0D::GetXF0D();
self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self;
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp
index c4ce2dc6140..09e2a84e29f 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp
@@ -52,8 +52,9 @@ static int GetYF0D___init__(BPy_GetYF0D *self, PyObject *args, PyObject *kwds)
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_uf0D_double.uf0D_double = new Functions0D::GetYF0D();
self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self;
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp
index 1b93a295f53..920432530ed 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp
@@ -52,8 +52,9 @@ static int GetZF0D___init__(BPy_GetZF0D *self, PyObject *args, PyObject *kwds)
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_uf0D_double.uf0D_double = new Functions0D::GetZF0D();
self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self;
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp
index dc304574c7f..58e5a1a498a 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp
@@ -60,8 +60,9 @@ static int LocalAverageDepthF0D___init__(BPy_LocalAverageDepthF0D *self,
static const char *kwlist[] = {"mask_size", NULL};
double d = 5.0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "|d", (char **)kwlist, &d))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|d", (char **)kwlist, &d)) {
return -1;
+ }
self->py_uf0D_double.uf0D_double = new Functions0D::LocalAverageDepthF0D(d);
self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self;
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp
index d2ae0f0fa31..0d1b55f0a00 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp
@@ -57,8 +57,9 @@ static int ZDiscontinuityF0D___init__(BPy_ZDiscontinuityF0D *self, PyObject *arg
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_uf0D_double.uf0D_double = new Functions0D::ZDiscontinuityF0D();
self->py_uf0D_double.uf0D_double->py_uf0D = (PyObject *)self;
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp
index 2db536d2a90..a00d4204d69 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp
@@ -55,8 +55,9 @@ static int GetCurvilinearAbscissaF0D___init__(BPy_GetCurvilinearAbscissaF0D *sel
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_uf0D_float.uf0D_float = new Functions0D::GetCurvilinearAbscissaF0D();
self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self;
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp
index bc67c4dd91d..b4310685969 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp
@@ -52,8 +52,9 @@ static int GetParameterF0D___init__(BPy_GetParameterF0D *self, PyObject *args, P
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_uf0D_float.uf0D_float = new Functions0D::GetParameterF0D();
self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self;
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp
index 21e05323b07..ad744918e00 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp
@@ -60,8 +60,9 @@ static int GetViewMapGradientNormF0D___init__(BPy_GetViewMapGradientNormF0D *sel
static const char *kwlist[] = {"level", NULL};
int i;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist, &i))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist, &i)) {
return -1;
+ }
self->py_uf0D_float.uf0D_float = new Functions0D::GetViewMapGradientNormF0D(i);
self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self;
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp
index 506aa15e245..685701152f4 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp
@@ -58,8 +58,9 @@ static int ReadCompleteViewMapPixelF0D___init__(BPy_ReadCompleteViewMapPixelF0D
static const char *kwlist[] = {"level", NULL};
int i;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist, &i))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist, &i)) {
return -1;
+ }
self->py_uf0D_float.uf0D_float = new Functions0D::ReadCompleteViewMapPixelF0D(i);
self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self;
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp
index dea8923777b..b74ee3b33c6 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp
@@ -59,8 +59,9 @@ static int ReadMapPixelF0D___init__(BPy_ReadMapPixelF0D *self, PyObject *args, P
const char *s;
int i;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "si", (char **)kwlist, &s, &i))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "si", (char **)kwlist, &s, &i)) {
return -1;
+ }
self->py_uf0D_float.uf0D_float = new Functions0D::ReadMapPixelF0D(s, i);
self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self;
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp
index 0eee141f15f..a878db99e06 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp
@@ -62,8 +62,9 @@ static int ReadSteerableViewMapPixelF0D___init__(BPy_ReadSteerableViewMapPixelF0
unsigned int u;
int i;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "Ii", (char **)kwlist, &u, &i))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "Ii", (char **)kwlist, &u, &i)) {
return -1;
+ }
self->py_uf0D_float.uf0D_float = new Functions0D::ReadSteerableViewMapPixelF0D(u, i);
self->py_uf0D_float.uf0D_float->py_uf0D = (PyObject *)self;
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp
index 0b6a116fa65..57605e42186 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp
@@ -60,8 +60,9 @@ static int QuantitativeInvisibilityF0D___init__(BPy_QuantitativeInvisibilityF0D
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_uf0D_unsigned.uf0D_unsigned = new Functions0D::QuantitativeInvisibilityF0D();
self->py_uf0D_unsigned.uf0D_unsigned->py_uf0D = (PyObject *)self;
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp
index 37f8f82978f..e56460601e5 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp
@@ -53,8 +53,9 @@ static int GetOccludersF0D___init__(BPy_GetOccludersF0D *self, PyObject *args, P
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_uf0D_vectorviewshape.uf0D_vectorviewshape = new Functions0D::GetOccludersF0D();
self->py_uf0D_vectorviewshape.uf0D_vectorviewshape->py_uf0D = (PyObject *)self;
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp
index 84aa10098ee..bed2d5d578a 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp
@@ -49,86 +49,102 @@ extern "C" {
int UnaryFunction1DDouble_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&UnaryFunction1DDouble_Type) < 0)
+ if (PyType_Ready(&UnaryFunction1DDouble_Type) < 0) {
return -1;
+ }
Py_INCREF(&UnaryFunction1DDouble_Type);
PyModule_AddObject(module, "UnaryFunction1DDouble", (PyObject *)&UnaryFunction1DDouble_Type);
- if (PyType_Ready(&DensityF1D_Type) < 0)
+ if (PyType_Ready(&DensityF1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&DensityF1D_Type);
PyModule_AddObject(module, "DensityF1D", (PyObject *)&DensityF1D_Type);
- if (PyType_Ready(&Curvature2DAngleF1D_Type) < 0)
+ if (PyType_Ready(&Curvature2DAngleF1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&Curvature2DAngleF1D_Type);
PyModule_AddObject(module, "Curvature2DAngleF1D", (PyObject *)&Curvature2DAngleF1D_Type);
- if (PyType_Ready(&GetCompleteViewMapDensityF1D_Type) < 0)
+ if (PyType_Ready(&GetCompleteViewMapDensityF1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&GetCompleteViewMapDensityF1D_Type);
PyModule_AddObject(
module, "GetCompleteViewMapDensityF1D", (PyObject *)&GetCompleteViewMapDensityF1D_Type);
- if (PyType_Ready(&GetDirectionalViewMapDensityF1D_Type) < 0)
+ if (PyType_Ready(&GetDirectionalViewMapDensityF1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&GetDirectionalViewMapDensityF1D_Type);
PyModule_AddObject(module,
"GetDirectionalViewMapDensityF1D",
(PyObject *)&GetDirectionalViewMapDensityF1D_Type);
- if (PyType_Ready(&GetProjectedXF1D_Type) < 0)
+ if (PyType_Ready(&GetProjectedXF1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&GetProjectedXF1D_Type);
PyModule_AddObject(module, "GetProjectedXF1D", (PyObject *)&GetProjectedXF1D_Type);
- if (PyType_Ready(&GetProjectedYF1D_Type) < 0)
+ if (PyType_Ready(&GetProjectedYF1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&GetProjectedYF1D_Type);
PyModule_AddObject(module, "GetProjectedYF1D", (PyObject *)&GetProjectedYF1D_Type);
- if (PyType_Ready(&GetProjectedZF1D_Type) < 0)
+ if (PyType_Ready(&GetProjectedZF1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&GetProjectedZF1D_Type);
PyModule_AddObject(module, "GetProjectedZF1D", (PyObject *)&GetProjectedZF1D_Type);
- if (PyType_Ready(&GetSteerableViewMapDensityF1D_Type) < 0)
+ if (PyType_Ready(&GetSteerableViewMapDensityF1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&GetSteerableViewMapDensityF1D_Type);
PyModule_AddObject(
module, "GetSteerableViewMapDensityF1D", (PyObject *)&GetSteerableViewMapDensityF1D_Type);
- if (PyType_Ready(&GetViewMapGradientNormF1D_Type) < 0)
+ if (PyType_Ready(&GetViewMapGradientNormF1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&GetViewMapGradientNormF1D_Type);
PyModule_AddObject(
module, "GetViewMapGradientNormF1D", (PyObject *)&GetViewMapGradientNormF1D_Type);
- if (PyType_Ready(&GetXF1D_Type) < 0)
+ if (PyType_Ready(&GetXF1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&GetXF1D_Type);
PyModule_AddObject(module, "GetXF1D", (PyObject *)&GetXF1D_Type);
- if (PyType_Ready(&GetYF1D_Type) < 0)
+ if (PyType_Ready(&GetYF1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&GetYF1D_Type);
PyModule_AddObject(module, "GetYF1D", (PyObject *)&GetYF1D_Type);
- if (PyType_Ready(&GetZF1D_Type) < 0)
+ if (PyType_Ready(&GetZF1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&GetZF1D_Type);
PyModule_AddObject(module, "GetZF1D", (PyObject *)&GetZF1D_Type);
- if (PyType_Ready(&LocalAverageDepthF1D_Type) < 0)
+ if (PyType_Ready(&LocalAverageDepthF1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&LocalAverageDepthF1D_Type);
PyModule_AddObject(module, "LocalAverageDepthF1D", (PyObject *)&LocalAverageDepthF1D_Type);
- if (PyType_Ready(&ZDiscontinuityF1D_Type) < 0)
+ if (PyType_Ready(&ZDiscontinuityF1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&ZDiscontinuityF1D_Type);
PyModule_AddObject(module, "ZDiscontinuityF1D", (PyObject *)&ZDiscontinuityF1D_Type);
@@ -163,11 +179,13 @@ static int UnaryFunction1DDouble___init__(BPy_UnaryFunction1DDouble *self,
PyObject *obj = 0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
+ args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) {
return -1;
+ }
- if (!obj)
+ if (!obj) {
self->uf1D_double = new UnaryFunction1D<double>();
+ }
else {
self->uf1D_double = new UnaryFunction1D<double>(IntegrationType_from_BPy_IntegrationType(obj));
}
@@ -179,8 +197,9 @@ static int UnaryFunction1DDouble___init__(BPy_UnaryFunction1DDouble *self,
static void UnaryFunction1DDouble___dealloc__(BPy_UnaryFunction1DDouble *self)
{
- if (self->uf1D_double)
+ if (self->uf1D_double) {
delete self->uf1D_double;
+ }
UnaryFunction1D_Type.tp_dealloc((PyObject *)self);
}
@@ -196,8 +215,9 @@ static PyObject *UnaryFunction1DDouble___call__(BPy_UnaryFunction1DDouble *self,
static const char *kwlist[] = {"inter", NULL};
PyObject *obj = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) {
return NULL;
+ }
if (typeid(*(self->uf1D_double)) == typeid(UnaryFunction1D<double>)) {
PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp
index 262fdbc68c6..e122454c00d 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp
@@ -36,17 +36,20 @@ extern "C" {
int UnaryFunction1DEdgeNature_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&UnaryFunction1DEdgeNature_Type) < 0)
+ if (PyType_Ready(&UnaryFunction1DEdgeNature_Type) < 0) {
return -1;
+ }
Py_INCREF(&UnaryFunction1DEdgeNature_Type);
PyModule_AddObject(
module, "UnaryFunction1DEdgeNature", (PyObject *)&UnaryFunction1DEdgeNature_Type);
- if (PyType_Ready(&CurveNatureF1D_Type) < 0)
+ if (PyType_Ready(&CurveNatureF1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&CurveNatureF1D_Type);
PyModule_AddObject(module, "CurveNatureF1D", (PyObject *)&CurveNatureF1D_Type);
@@ -81,11 +84,13 @@ static int UnaryFunction1DEdgeNature___init__(BPy_UnaryFunction1DEdgeNature *sel
PyObject *obj = 0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
+ args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) {
return -1;
+ }
- if (!obj)
+ if (!obj) {
self->uf1D_edgenature = new UnaryFunction1D<Nature::EdgeNature>();
+ }
else {
self->uf1D_edgenature = new UnaryFunction1D<Nature::EdgeNature>(
IntegrationType_from_BPy_IntegrationType(obj));
@@ -98,8 +103,9 @@ static int UnaryFunction1DEdgeNature___init__(BPy_UnaryFunction1DEdgeNature *sel
static void UnaryFunction1DEdgeNature___dealloc__(BPy_UnaryFunction1DEdgeNature *self)
{
- if (self->uf1D_edgenature)
+ if (self->uf1D_edgenature) {
delete self->uf1D_edgenature;
+ }
UnaryFunction1D_Type.tp_dealloc((PyObject *)self);
}
@@ -116,8 +122,9 @@ static PyObject *UnaryFunction1DEdgeNature___call__(BPy_UnaryFunction1DEdgeNatur
static const char *kwlist[] = {"inter", NULL};
PyObject *obj = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) {
return NULL;
+ }
if (typeid(*(self->uf1D_edgenature)) == typeid(UnaryFunction1D<Nature::EdgeNature>)) {
PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp
index fcd670ea1e7..95d49612672 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp
@@ -34,11 +34,13 @@ extern "C" {
int UnaryFunction1DFloat_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&UnaryFunction1DFloat_Type) < 0)
+ if (PyType_Ready(&UnaryFunction1DFloat_Type) < 0) {
return -1;
+ }
Py_INCREF(&UnaryFunction1DFloat_Type);
PyModule_AddObject(module, "UnaryFunction1DFloat", (PyObject *)&UnaryFunction1DFloat_Type);
@@ -73,11 +75,13 @@ static int UnaryFunction1DFloat___init__(BPy_UnaryFunction1DFloat *self,
PyObject *obj = 0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
+ args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) {
return -1;
+ }
- if (!obj)
+ if (!obj) {
self->uf1D_float = new UnaryFunction1D<float>();
+ }
else {
self->uf1D_float = new UnaryFunction1D<float>(IntegrationType_from_BPy_IntegrationType(obj));
}
@@ -89,8 +93,9 @@ static int UnaryFunction1DFloat___init__(BPy_UnaryFunction1DFloat *self,
static void UnaryFunction1DFloat___dealloc__(BPy_UnaryFunction1DFloat *self)
{
- if (self->uf1D_float)
+ if (self->uf1D_float) {
delete self->uf1D_float;
+ }
UnaryFunction1D_Type.tp_dealloc((PyObject *)self);
}
@@ -106,8 +111,9 @@ static PyObject *UnaryFunction1DFloat___call__(BPy_UnaryFunction1DFloat *self,
static const char *kwlist[] = {"inter", NULL};
PyObject *obj = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) {
return NULL;
+ }
if (typeid(*(self->uf1D_float)) == typeid(UnaryFunction1D<float>)) {
PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp
index 37d37db51e4..851fc45d583 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp
@@ -36,16 +36,19 @@ extern "C" {
int UnaryFunction1DUnsigned_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&UnaryFunction1DUnsigned_Type) < 0)
+ if (PyType_Ready(&UnaryFunction1DUnsigned_Type) < 0) {
return -1;
+ }
Py_INCREF(&UnaryFunction1DUnsigned_Type);
PyModule_AddObject(module, "UnaryFunction1DUnsigned", (PyObject *)&UnaryFunction1DUnsigned_Type);
- if (PyType_Ready(&QuantitativeInvisibilityF1D_Type) < 0)
+ if (PyType_Ready(&QuantitativeInvisibilityF1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&QuantitativeInvisibilityF1D_Type);
PyModule_AddObject(
module, "QuantitativeInvisibilityF1D", (PyObject *)&QuantitativeInvisibilityF1D_Type);
@@ -81,11 +84,13 @@ static int UnaryFunction1DUnsigned___init__(BPy_UnaryFunction1DUnsigned *self,
PyObject *obj = 0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
+ args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) {
return -1;
+ }
- if (!obj)
+ if (!obj) {
self->uf1D_unsigned = new UnaryFunction1D<unsigned int>();
+ }
else {
self->uf1D_unsigned = new UnaryFunction1D<unsigned int>(
IntegrationType_from_BPy_IntegrationType(obj));
@@ -98,8 +103,9 @@ static int UnaryFunction1DUnsigned___init__(BPy_UnaryFunction1DUnsigned *self,
static void UnaryFunction1DUnsigned___dealloc__(BPy_UnaryFunction1DUnsigned *self)
{
- if (self->uf1D_unsigned)
+ if (self->uf1D_unsigned) {
delete self->uf1D_unsigned;
+ }
UnaryFunction1D_Type.tp_dealloc((PyObject *)self);
}
@@ -116,8 +122,9 @@ static PyObject *UnaryFunction1DUnsigned___call__(BPy_UnaryFunction1DUnsigned *s
static const char *kwlist[] = {"inter", NULL};
PyObject *obj = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) {
return NULL;
+ }
if (typeid(*(self->uf1D_unsigned)) == typeid(UnaryFunction1D<unsigned int>)) {
PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp
index d41f035af3f..75225fd6381 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp
@@ -37,21 +37,25 @@ extern "C" {
int UnaryFunction1DVec2f_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&UnaryFunction1DVec2f_Type) < 0)
+ if (PyType_Ready(&UnaryFunction1DVec2f_Type) < 0) {
return -1;
+ }
Py_INCREF(&UnaryFunction1DVec2f_Type);
PyModule_AddObject(module, "UnaryFunction1DVec2f", (PyObject *)&UnaryFunction1DVec2f_Type);
- if (PyType_Ready(&Normal2DF1D_Type) < 0)
+ if (PyType_Ready(&Normal2DF1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&Normal2DF1D_Type);
PyModule_AddObject(module, "Normal2DF1D", (PyObject *)&Normal2DF1D_Type);
- if (PyType_Ready(&Orientation2DF1D_Type) < 0)
+ if (PyType_Ready(&Orientation2DF1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&Orientation2DF1D_Type);
PyModule_AddObject(module, "Orientation2DF1D", (PyObject *)&Orientation2DF1D_Type);
@@ -86,11 +90,13 @@ static int UnaryFunction1DVec2f___init__(BPy_UnaryFunction1DVec2f *self,
PyObject *obj = 0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
+ args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) {
return -1;
+ }
- if (!obj)
+ if (!obj) {
self->uf1D_vec2f = new UnaryFunction1D<Vec2f>();
+ }
else {
self->uf1D_vec2f = new UnaryFunction1D<Vec2f>(IntegrationType_from_BPy_IntegrationType(obj));
}
@@ -102,8 +108,9 @@ static int UnaryFunction1DVec2f___init__(BPy_UnaryFunction1DVec2f *self,
static void UnaryFunction1DVec2f___dealloc__(BPy_UnaryFunction1DVec2f *self)
{
- if (self->uf1D_vec2f)
+ if (self->uf1D_vec2f) {
delete self->uf1D_vec2f;
+ }
UnaryFunction1D_Type.tp_dealloc((PyObject *)self);
}
@@ -119,8 +126,9 @@ static PyObject *UnaryFunction1DVec2f___call__(BPy_UnaryFunction1DVec2f *self,
static const char *kwlist[] = {"inter", NULL};
PyObject *obj = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) {
return NULL;
+ }
if (typeid(*(self->uf1D_vec2f)) == typeid(UnaryFunction1D<Vec2f>)) {
PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp
index 61b393cd732..a2767e826ab 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp
@@ -36,16 +36,19 @@ extern "C" {
int UnaryFunction1DVec3f_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&UnaryFunction1DVec3f_Type) < 0)
+ if (PyType_Ready(&UnaryFunction1DVec3f_Type) < 0) {
return -1;
+ }
Py_INCREF(&UnaryFunction1DVec3f_Type);
PyModule_AddObject(module, "UnaryFunction1DVec3f", (PyObject *)&UnaryFunction1DVec3f_Type);
- if (PyType_Ready(&Orientation3DF1D_Type) < 0)
+ if (PyType_Ready(&Orientation3DF1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&Orientation3DF1D_Type);
PyModule_AddObject(module, "Orientation3DF1D", (PyObject *)&Orientation3DF1D_Type);
@@ -80,11 +83,13 @@ static int UnaryFunction1DVec3f___init__(BPy_UnaryFunction1DVec3f *self,
PyObject *obj = 0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
+ args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) {
return -1;
+ }
- if (!obj)
+ if (!obj) {
self->uf1D_vec3f = new UnaryFunction1D<Vec3f>();
+ }
else {
self->uf1D_vec3f = new UnaryFunction1D<Vec3f>(IntegrationType_from_BPy_IntegrationType(obj));
}
@@ -96,8 +101,9 @@ static int UnaryFunction1DVec3f___init__(BPy_UnaryFunction1DVec3f *self,
static void UnaryFunction1DVec3f___dealloc__(BPy_UnaryFunction1DVec3f *self)
{
- if (self->uf1D_vec3f)
+ if (self->uf1D_vec3f) {
delete self->uf1D_vec3f;
+ }
UnaryFunction1D_Type.tp_dealloc((PyObject *)self);
}
@@ -113,8 +119,9 @@ static PyObject *UnaryFunction1DVec3f___call__(BPy_UnaryFunction1DVec3f *self,
static const char *kwlist[] = {"inter", NULL};
PyObject *obj = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) {
return NULL;
+ }
if (typeid(*(self->uf1D_vec3f)) == typeid(UnaryFunction1D<Vec3f>)) {
PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp
index eb4974e64fe..0739f327f55 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp
@@ -38,27 +38,32 @@ extern "C" {
int UnaryFunction1DVectorViewShape_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&UnaryFunction1DVectorViewShape_Type) < 0)
+ if (PyType_Ready(&UnaryFunction1DVectorViewShape_Type) < 0) {
return -1;
+ }
Py_INCREF(&UnaryFunction1DVectorViewShape_Type);
PyModule_AddObject(
module, "UnaryFunction1DVectorViewShape", (PyObject *)&UnaryFunction1DVectorViewShape_Type);
- if (PyType_Ready(&GetOccludeeF1D_Type) < 0)
+ if (PyType_Ready(&GetOccludeeF1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&GetOccludeeF1D_Type);
PyModule_AddObject(module, "GetOccludeeF1D", (PyObject *)&GetOccludeeF1D_Type);
- if (PyType_Ready(&GetOccludersF1D_Type) < 0)
+ if (PyType_Ready(&GetOccludersF1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&GetOccludersF1D_Type);
PyModule_AddObject(module, "GetOccludersF1D", (PyObject *)&GetOccludersF1D_Type);
- if (PyType_Ready(&GetShapeF1D_Type) < 0)
+ if (PyType_Ready(&GetShapeF1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&GetShapeF1D_Type);
PyModule_AddObject(module, "GetShapeF1D", (PyObject *)&GetShapeF1D_Type);
@@ -94,8 +99,9 @@ static int UnaryFunction1DVectorViewShape___init__(BPy_UnaryFunction1DVectorView
PyObject *obj = 0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
+ args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) {
return -1;
+ }
if (!obj) {
self->uf1D_vectorviewshape = new UnaryFunction1D<std::vector<ViewShape *>>();
@@ -112,8 +118,9 @@ static int UnaryFunction1DVectorViewShape___init__(BPy_UnaryFunction1DVectorView
static void UnaryFunction1DVectorViewShape___dealloc__(BPy_UnaryFunction1DVectorViewShape *self)
{
- if (self->uf1D_vectorviewshape)
+ if (self->uf1D_vectorviewshape) {
delete self->uf1D_vectorviewshape;
+ }
UnaryFunction1D_Type.tp_dealloc((PyObject *)self);
}
@@ -130,8 +137,9 @@ static PyObject *UnaryFunction1DVectorViewShape___call__(BPy_UnaryFunction1DVect
static const char *kwlist[] = {"inter", NULL};
PyObject *obj = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) {
return NULL;
+ }
if (typeid(*(self->uf1D_vectorviewshape)) == typeid(UnaryFunction1D<std::vector<ViewShape *>>)) {
PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp
index c9009dc6889..ca1e35f66bd 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp
@@ -38,27 +38,32 @@ extern "C" {
int UnaryFunction1DVoid_Init(PyObject *module)
{
- if (module == NULL)
+ if (module == NULL) {
return -1;
+ }
- if (PyType_Ready(&UnaryFunction1DVoid_Type) < 0)
+ if (PyType_Ready(&UnaryFunction1DVoid_Type) < 0) {
return -1;
+ }
Py_INCREF(&UnaryFunction1DVoid_Type);
PyModule_AddObject(module, "UnaryFunction1DVoid", (PyObject *)&UnaryFunction1DVoid_Type);
- if (PyType_Ready(&ChainingTimeStampF1D_Type) < 0)
+ if (PyType_Ready(&ChainingTimeStampF1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&ChainingTimeStampF1D_Type);
PyModule_AddObject(module, "ChainingTimeStampF1D", (PyObject *)&ChainingTimeStampF1D_Type);
- if (PyType_Ready(&IncrementChainingTimeStampF1D_Type) < 0)
+ if (PyType_Ready(&IncrementChainingTimeStampF1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&IncrementChainingTimeStampF1D_Type);
PyModule_AddObject(
module, "IncrementChainingTimeStampF1D", (PyObject *)&IncrementChainingTimeStampF1D_Type);
- if (PyType_Ready(&TimeStampF1D_Type) < 0)
+ if (PyType_Ready(&TimeStampF1D_Type) < 0) {
return -1;
+ }
Py_INCREF(&TimeStampF1D_Type);
PyModule_AddObject(module, "TimeStampF1D", (PyObject *)&TimeStampF1D_Type);
@@ -93,11 +98,13 @@ static int UnaryFunction1DVoid___init__(BPy_UnaryFunction1DVoid *self,
PyObject *obj = 0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
+ args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) {
return -1;
+ }
- if (!obj)
+ if (!obj) {
self->uf1D_void = new UnaryFunction1D_void();
+ }
else {
self->uf1D_void = new UnaryFunction1D_void(IntegrationType_from_BPy_IntegrationType(obj));
}
@@ -109,8 +116,9 @@ static int UnaryFunction1DVoid___init__(BPy_UnaryFunction1DVoid *self,
static void UnaryFunction1DVoid___dealloc__(BPy_UnaryFunction1DVoid *self)
{
- if (self->uf1D_void)
+ if (self->uf1D_void) {
delete self->uf1D_void;
+ }
UnaryFunction1D_Type.tp_dealloc((PyObject *)self);
}
@@ -126,8 +134,9 @@ static PyObject *UnaryFunction1DVoid___call__(BPy_UnaryFunction1DVoid *self,
static const char *kwlist[] = {"inter", NULL};
PyObject *obj = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) {
return NULL;
+ }
if (typeid(*(self->uf1D_void)) == typeid(UnaryFunction1D_void)) {
PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden");
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp
index 248f1cc0ca1..2504a09016c 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp
@@ -65,8 +65,9 @@ static int CurveNatureF1D___init__(BPy_CurveNatureF1D *self, PyObject *args, PyO
PyObject *obj = 0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
+ args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) {
return -1;
+ }
IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN;
self->py_uf1D_edgenature.uf1D_edgenature = new Functions1D::CurveNatureF1D(t);
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp
index 530f76ee706..f1cdd6a0cb8 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp
@@ -59,8 +59,9 @@ static int Normal2DF1D___init__(BPy_Normal2DF1D *self, PyObject *args, PyObject
PyObject *obj = 0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
+ args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) {
return -1;
+ }
IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN;
self->py_uf1D_vec2f.uf1D_vec2f = new Functions1D::Normal2DF1D(t);
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp
index 6449ab95611..27d6c509348 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp
@@ -59,8 +59,9 @@ static int Orientation2DF1D___init__(BPy_Orientation2DF1D *self, PyObject *args,
PyObject *obj = 0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
+ args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) {
return -1;
+ }
IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN;
self->py_uf1D_vec2f.uf1D_vec2f = new Functions1D::Orientation2DF1D(t);
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp
index adfe7b0961b..1a2d9c5e745 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp
@@ -59,8 +59,9 @@ static int Orientation3DF1D___init__(BPy_Orientation3DF1D *self, PyObject *args,
PyObject *obj = 0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
+ args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) {
return -1;
+ }
IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN;
self->py_uf1D_vec3f.uf1D_vec3f = new Functions1D::Orientation3DF1D(t);
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp
index d1e893a1550..4d0e1a66f56 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp
@@ -61,8 +61,9 @@ static int Curvature2DAngleF1D___init__(BPy_Curvature2DAngleF1D *self,
PyObject *obj = 0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
+ args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) {
return -1;
+ }
IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN;
self->py_uf1D_double.uf1D_double = new Functions1D::Curvature2DAngleF1D(t);
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp
index 6218eed5b70..b96406de066 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp
@@ -73,8 +73,9 @@ static int DensityF1D___init__(BPy_DensityF1D *self, PyObject *args, PyObject *k
float f = 2.0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "|dO!f", (char **)kwlist, &d, &IntegrationType_Type, &obj, &f))
+ args, kwds, "|dO!f", (char **)kwlist, &d, &IntegrationType_Type, &obj, &f)) {
return -1;
+ }
IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN;
self->py_uf1D_double.uf1D_double = new Functions1D::DensityF1D(d, t, f);
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp
index 4b2f444f719..9f16f53e833 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp
@@ -77,8 +77,9 @@ static int GetCompleteViewMapDensityF1D___init__(BPy_GetCompleteViewMapDensityF1
float f = 2.0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "i|O!f", (char **)kwlist, &i, &IntegrationType_Type, &obj, &f))
+ args, kwds, "i|O!f", (char **)kwlist, &i, &IntegrationType_Type, &obj, &f)) {
return -1;
+ }
IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN;
self->py_uf1D_double.uf1D_double = new Functions1D::GetCompleteViewMapDensityF1D(i, t, f);
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp
index 8b31c31a4a4..8cea26338df 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp
@@ -83,8 +83,9 @@ static int GetDirectionalViewMapDensityF1D___init__(BPy_GetDirectionalViewMapDen
float f = 2.0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "II|O!f", (char **)kwlist, &u1, &u2, &IntegrationType_Type, &obj, &f))
+ args, kwds, "II|O!f", (char **)kwlist, &u1, &u2, &IntegrationType_Type, &obj, &f)) {
return -1;
+ }
IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN;
self->py_uf1D_double.uf1D_double = new Functions1D::GetDirectionalViewMapDensityF1D(
u1, u2, t, f);
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp
index bbd6dfd2701..5f47fb03f8b 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp
@@ -59,8 +59,9 @@ static int GetProjectedXF1D___init__(BPy_GetProjectedXF1D *self, PyObject *args,
PyObject *obj = 0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
+ args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) {
return -1;
+ }
IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN;
self->py_uf1D_double.uf1D_double = new Functions1D::GetProjectedXF1D(t);
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp
index 8cfd958ba29..b6e1c2d336e 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp
@@ -59,8 +59,9 @@ static int GetProjectedYF1D___init__(BPy_GetProjectedYF1D *self, PyObject *args,
PyObject *obj = 0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
+ args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) {
return -1;
+ }
IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN;
self->py_uf1D_double.uf1D_double = new Functions1D::GetProjectedYF1D(t);
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp
index e5bd864fcfd..dfe7cd82710 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp
@@ -59,8 +59,9 @@ static int GetProjectedZF1D___init__(BPy_GetProjectedZF1D *self, PyObject *args,
PyObject *obj = 0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
+ args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) {
return -1;
+ }
IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN;
self->py_uf1D_double.uf1D_double = new Functions1D::GetProjectedZF1D(t);
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp
index 615faed2282..a1ed9d15d5e 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp
@@ -74,8 +74,9 @@ static int GetSteerableViewMapDensityF1D___init__(BPy_GetSteerableViewMapDensity
float f = 2.0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "i|O!f", (char **)kwlist, &i, &IntegrationType_Type, &obj, &f))
+ args, kwds, "i|O!f", (char **)kwlist, &i, &IntegrationType_Type, &obj, &f)) {
return -1;
+ }
IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN;
self->py_uf1D_double.uf1D_double = new Functions1D::GetSteerableViewMapDensityF1D(i, t, f);
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp
index 7e77e79af63..268d140749d 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp
@@ -74,8 +74,9 @@ static int GetViewMapGradientNormF1D___init__(BPy_GetViewMapGradientNormF1D *sel
float f = 2.0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "i|O!f", (char **)kwlist, &i, &IntegrationType_Type, &obj, &f))
+ args, kwds, "i|O!f", (char **)kwlist, &i, &IntegrationType_Type, &obj, &f)) {
return -1;
+ }
IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN;
self->py_uf1D_double.uf1D_double = new Functions1D::GetViewMapGradientNormF1D(i, t, f);
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp
index 6a5e999ecf3..5a0b7d6aa55 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp
@@ -59,8 +59,9 @@ static int GetXF1D___init__(BPy_GetXF1D *self, PyObject *args, PyObject *kwds)
PyObject *obj = 0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
+ args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) {
return -1;
+ }
IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN;
self->py_uf1D_double.uf1D_double = new Functions1D::GetXF1D(t);
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp
index b7a1e2a3072..9b523126841 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp
@@ -59,8 +59,9 @@ static int GetYF1D___init__(BPy_GetYF1D *self, PyObject *args, PyObject *kwds)
PyObject *obj = 0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
+ args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) {
return -1;
+ }
IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN;
self->py_uf1D_double.uf1D_double = new Functions1D::GetYF1D(t);
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp
index db42bdcc3eb..73407affd8d 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp
@@ -59,8 +59,9 @@ static int GetZF1D___init__(BPy_GetZF1D *self, PyObject *args, PyObject *kwds)
PyObject *obj = 0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
+ args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) {
return -1;
+ }
IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN;
self->py_uf1D_double.uf1D_double = new Functions1D::GetZF1D(t);
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp
index 8e139f5a627..aef67aab928 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp
@@ -69,8 +69,9 @@ static int LocalAverageDepthF1D___init__(BPy_LocalAverageDepthF1D *self,
double d;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "d|O!", (char **)kwlist, &d, &IntegrationType_Type, &obj))
+ args, kwds, "d|O!", (char **)kwlist, &d, &IntegrationType_Type, &obj)) {
return -1;
+ }
IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN;
self->py_uf1D_double.uf1D_double = new Functions1D::LocalAverageDepthF1D(d, t);
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp
index 1f5b262f71a..cf2162c30ad 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp
@@ -63,8 +63,9 @@ static int ZDiscontinuityF1D___init__(BPy_ZDiscontinuityF1D *self, PyObject *arg
PyObject *obj = 0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
+ args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) {
return -1;
+ }
IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN;
self->py_uf1D_double.uf1D_double = new Functions1D::ZDiscontinuityF1D(t);
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp
index bce95e50048..f843ff52d06 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp
@@ -65,8 +65,9 @@ static int QuantitativeInvisibilityF1D___init__(BPy_QuantitativeInvisibilityF1D
PyObject *obj = 0;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj))
+ args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) {
return -1;
+ }
IntegrationType t = (obj) ? IntegrationType_from_BPy_IntegrationType(obj) : MEAN;
self->py_uf1D_unsigned.uf1D_unsigned = new Functions1D::QuantitativeInvisibilityF1D(t);
return 0;
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp
index 0d7944de788..f56d89c469a 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp
@@ -53,8 +53,9 @@ static int GetOccludeeF1D___init__(BPy_GetOccludeeF1D *self, PyObject *args, PyO
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_uf1D_vectorviewshape.uf1D_vectorviewshape = new Functions1D::GetOccludeeF1D();
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp
index 38651154ce7..3ff4d36bc19 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp
@@ -53,8 +53,9 @@ static int GetOccludersF1D___init__(BPy_GetOccludersF1D *self, PyObject *args, P
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_uf1D_vectorviewshape.uf1D_vectorviewshape = new Functions1D::GetOccludersF1D();
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp
index 537e57c7106..08122b76385 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp
@@ -53,8 +53,9 @@ static int GetShapeF1D___init__(BPy_GetShapeF1D *self, PyObject *args, PyObject
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_uf1D_vectorviewshape.uf1D_vectorviewshape = new Functions1D::GetShapeF1D();
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp
index da9d3301e5f..4be8f239fd6 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp
@@ -53,8 +53,9 @@ static int ChainingTimeStampF1D___init__(BPy_ChainingTimeStampF1D *self,
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_uf1D_void.uf1D_void = new Functions1D::ChainingTimeStampF1D();
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp
index 04d724b7862..bca4ebb4236 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp
@@ -53,8 +53,9 @@ static int IncrementChainingTimeStampF1D___init__(BPy_IncrementChainingTimeStamp
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_uf1D_void.uf1D_void = new Functions1D::IncrementChainingTimeStampF1D();
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp
index eb53bca5874..e2d0c7d1308 100644
--- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp
@@ -51,8 +51,9 @@ static int TimeStampF1D___init__(BPy_TimeStampF1D *self, PyObject *args, PyObjec
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_uf1D_void.uf1D_void = new Functions1D::TimeStampF1D();
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp
index 8289d4b6386..1e8aab3b086 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp
@@ -44,8 +44,9 @@ static int FalseUP0D___init__(BPy_FalseUP0D *self, PyObject *args, PyObject *kwd
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_up0D.up0D = new Predicates0D::FalseUP0D();
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp
index 697e9bc2c92..ca6c7a5b344 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp
@@ -44,8 +44,9 @@ static int TrueUP0D___init__(BPy_TrueUP0D *self, PyObject *args, PyObject *kwds)
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_up0D.up0D = new Predicates0D::TrueUP0D();
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp
index faf0c98641a..21bd371935a 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp
@@ -45,8 +45,9 @@ static int ContourUP1D___init__(BPy_ContourUP1D *self, PyObject *args, PyObject
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_up1D.up1D = new Predicates1D::ContourUP1D();
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp
index 065329847b3..2044d663e77 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp
@@ -61,8 +61,9 @@ static int DensityLowerThanUP1D___init__(BPy_DensityLowerThanUP1D *self,
static const char *kwlist[] = {"threshold", "sigma", NULL};
double d1, d2 = 2.0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "d|d", (char **)kwlist, &d1, &d2))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "d|d", (char **)kwlist, &d1, &d2)) {
return -1;
+ }
self->py_up1D.up1D = new Predicates1D::DensityLowerThanUP1D(d1, d2);
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp
index fb42b29f9ee..c5feec45844 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp
@@ -56,8 +56,9 @@ static int EqualToChainingTimeStampUP1D___init__(BPy_EqualToChainingTimeStampUP1
static const char *kwlist[] = {"ts", NULL};
unsigned u;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &u))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &u)) {
return -1;
+ }
self->py_up1D.up1D = new Predicates1D::EqualToChainingTimeStampUP1D(u);
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp
index 30b8e3fce95..fd68878dc45 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp
@@ -55,8 +55,9 @@ static int EqualToTimeStampUP1D___init__(BPy_EqualToTimeStampUP1D *self,
static const char *kwlist[] = {"ts", NULL};
unsigned u;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &u))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &u)) {
return -1;
+ }
self->py_up1D.up1D = new Predicates1D::EqualToTimeStampUP1D(u);
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp
index 8bd31209291..ea034dfad1e 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp
@@ -49,8 +49,9 @@ static int ExternalContourUP1D___init__(BPy_ExternalContourUP1D *self,
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_up1D.up1D = new Predicates1D::ExternalContourUP1D();
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp
index b4db7e65090..a93ce638f33 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp
@@ -44,8 +44,9 @@ static int FalseUP1D___init__(BPy_FalseUP1D *self, PyObject *args, PyObject *kwd
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_up1D.up1D = new Predicates1D::FalseUP1D();
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp
index 907a86477e3..153fbf56ba8 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp
@@ -60,8 +60,9 @@ static int QuantitativeInvisibilityUP1D___init__(BPy_QuantitativeInvisibilityUP1
static const char *kwlist[] = {"qi", NULL};
int i = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "|i", (char **)kwlist, &i))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|i", (char **)kwlist, &i)) {
return -1;
+ }
self->py_up1D.up1D = new Predicates1D::QuantitativeInvisibilityUP1D(i);
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp
index 54a6a70c3bf..8a57b3173e5 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp
@@ -56,8 +56,9 @@ static int ShapeUP1D___init__(BPy_ShapeUP1D *self, PyObject *args, PyObject *kwd
static const char *kwlist[] = {"first", "second", NULL};
unsigned u1, u2 = 0;
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "I|I", (char **)kwlist, &u1, &u2))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "I|I", (char **)kwlist, &u1, &u2)) {
return -1;
+ }
self->py_up1D.up1D = new Predicates1D::ShapeUP1D(u1, u2);
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp
index 55c8c1ee889..9c1bf4ecd18 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp
@@ -44,8 +44,9 @@ static int TrueUP1D___init__(BPy_TrueUP1D *self, PyObject *args, PyObject *kwds)
{
static const char *kwlist[] = {NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist))
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) {
return -1;
+ }
self->py_up1D.up1D = new Predicates1D::TrueUP1D();
return 0;
}
diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp
index 4fc163dbd01..4fb486f1366 100644
--- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp
+++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp
@@ -57,8 +57,9 @@ static int WithinImageBoundaryUP1D___init__(BPy_WithinImageBoundaryUP1D *self,
double xmin, ymin, xmax, ymax;
if (!PyArg_ParseTupleAndKeywords(
- args, kwds, "dddd", (char **)kwlist, &xmin, &ymin, &xmax, &ymax))
+ args, kwds, "dddd", (char **)kwlist, &xmin, &ymin, &xmax, &ymax)) {
return -1;
+ }
self->py_up1D.up1D = new Predicates1D::WithinImageBoundaryUP1D(xmin, ymin, xmax, ymax);
return 0;
}
diff --git a/source/blender/freestyle/intern/scene_graph/FrsMaterial.h b/source/blender/freestyle/intern/scene_graph/FrsMaterial.h
index 4176a558009..c5a87c3baaf 100644
--- a/source/blender/freestyle/intern/scene_graph/FrsMaterial.h
+++ b/source/blender/freestyle/intern/scene_graph/FrsMaterial.h
@@ -445,22 +445,29 @@ FrsMaterial &FrsMaterial::operator=(const FrsMaterial &m)
bool FrsMaterial::operator!=(const FrsMaterial &m) const
{
- if (Shininess != m.shininess())
+ if (Shininess != m.shininess()) {
return true;
- if (Priority != m.priority())
+ }
+ if (Priority != m.priority()) {
return true;
+ }
for (int i = 0; i < 4; i++) {
- if (Line[i] != m.line()[i])
+ if (Line[i] != m.line()[i]) {
return true;
- if (Diffuse[i] != m.diffuse()[i])
+ }
+ if (Diffuse[i] != m.diffuse()[i]) {
return true;
- if (Specular[i] != m.specular()[i])
+ }
+ if (Specular[i] != m.specular()[i]) {
return true;
- if (Ambient[i] != m.ambient()[i])
+ }
+ if (Ambient[i] != m.ambient()[i]) {
return true;
- if (Emission[i] != m.emission()[i])
+ }
+ if (Emission[i] != m.emission()[i]) {
return true;
+ }
}
return false;
diff --git a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp
index 7a6b276bc44..42e96df39ef 100644
--- a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp
+++ b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp
@@ -83,8 +83,9 @@ IndexedFaceSet::IndexedFaceSet(float *iVertices,
_FrsMaterials = 0;
if (iMaterials) {
_FrsMaterials = new FrsMaterial *[_MSize];
- for (unsigned int i = 0; i < _MSize; ++i)
+ for (unsigned int i = 0; i < _MSize; ++i) {
_FrsMaterials[i] = new FrsMaterial(*(iMaterials[i]));
+ }
}
_TSize = iTSize;
_TexCoords = 0;
@@ -133,8 +134,9 @@ IndexedFaceSet::IndexedFaceSet(float *iVertices,
_MSize = iMSize;
_FrsMaterials = 0;
- if (iMaterials)
+ if (iMaterials) {
_FrsMaterials = iMaterials;
+ }
_TSize = iTSize;
_TexCoords = iTexCoords;
@@ -152,8 +154,9 @@ IndexedFaceSet::IndexedFaceSet(float *iVertices,
_MISize = iMISize;
_MIndices = 0;
- if (iMISize)
+ if (iMISize) {
_MIndices = iMIndices;
+ }
_TISize = iTISize;
_TIndices = iTIndices;
@@ -236,8 +239,9 @@ IndexedFaceSet::~IndexedFaceSet()
}
if (NULL != _FrsMaterials) {
- for (unsigned int i = 0; i < _MSize; ++i)
+ for (unsigned int i = 0; i < _MSize; ++i) {
delete _FrsMaterials[i];
+ }
delete[] _FrsMaterials;
_FrsMaterials = NULL;
}
@@ -302,22 +306,28 @@ void IndexedFaceSet::ComputeBBox()
float *v = _Vertices;
for (unsigned int i = 0; i < (_VSize / 3); ++i) {
- if (*v > XMax)
+ if (*v > XMax) {
XMax = *v;
- if (*v < XMin)
+ }
+ if (*v < XMin) {
XMin = *v;
+ }
++v;
- if (*v > YMax)
+ if (*v > YMax) {
YMax = *v;
- if (*v < YMin)
+ }
+ if (*v < YMin) {
YMin = *v;
+ }
++v;
- if (*v > ZMax)
+ if (*v > ZMax) {
ZMax = *v;
- if (*v < ZMin)
+ }
+ if (*v < ZMin) {
ZMin = *v;
+ }
++v;
}
diff --git a/source/blender/freestyle/intern/scene_graph/LineRep.cpp b/source/blender/freestyle/intern/scene_graph/LineRep.cpp
index 39be998cb90..a9f0dc5cdd7 100644
--- a/source/blender/freestyle/intern/scene_graph/LineRep.cpp
+++ b/source/blender/freestyle/intern/scene_graph/LineRep.cpp
@@ -38,22 +38,28 @@ void LineRep::ComputeBBox()
vector<Vec3r>::iterator v;
for (v = _vertices.begin(); v != _vertices.end(); ++v) {
// X
- if ((*v)[0] > XMax)
+ if ((*v)[0] > XMax) {
XMax = (*v)[0];
- if ((*v)[0] < XMin)
+ }
+ if ((*v)[0] < XMin) {
XMin = (*v)[0];
+ }
// Y
- if ((*v)[1] > YMax)
+ if ((*v)[1] > YMax) {
YMax = (*v)[1];
- if ((*v)[1] < YMin)
+ }
+ if ((*v)[1] < YMin) {
YMin = (*v)[1];
+ }
// Z
- if ((*v)[2] > ZMax)
+ if ((*v)[2] > ZMax) {
ZMax = (*v)[2];
- if ((*v)[2] < ZMin)
+ }
+ if ((*v)[2] < ZMin) {
ZMin = (*v)[2];
+ }
}
setBBox(BBox<Vec3r>(Vec3r(XMin, YMin, ZMin), Vec3r(XMax, YMax, ZMax)));
diff --git a/source/blender/freestyle/intern/scene_graph/Node.h b/source/blender/freestyle/intern/scene_graph/Node.h
index 2e0e94ed5de..96072993590 100644
--- a/source/blender/freestyle/intern/scene_graph/Node.h
+++ b/source/blender/freestyle/intern/scene_graph/Node.h
@@ -79,13 +79,16 @@ class Node : public BaseObject {
/*! Makes the union of _BBox and iBox */
virtual void AddBBox(const BBox<Vec3r> &iBox)
{
- if (iBox.empty())
+ if (iBox.empty()) {
return;
+ }
- if (_BBox.empty())
+ if (_BBox.empty()) {
_BBox = iBox;
- else
+ }
+ else {
_BBox += iBox;
+ }
}
/*! Updates the BBox */
diff --git a/source/blender/freestyle/intern/scene_graph/NodeCamera.cpp b/source/blender/freestyle/intern/scene_graph/NodeCamera.cpp
index ae87b77aee7..ad2310d7875 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeCamera.cpp
+++ b/source/blender/freestyle/intern/scene_graph/NodeCamera.cpp
@@ -33,10 +33,12 @@ static void loadIdentity(double *matrix)
// Build Identity matrix
for (i = 0; i < 16; ++i) {
double value;
- if ((i % 5) == 0)
+ if ((i % 5) == 0) {
value = 1.0;
- else
+ }
+ else {
value = 0;
+ }
matrix[i] = value;
}
}
diff --git a/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.cpp b/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.cpp
index 75acccef666..323ec217c33 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.cpp
+++ b/source/blender/freestyle/intern/scene_graph/NodeDrawingStyle.cpp
@@ -31,8 +31,9 @@ void NodeDrawingStyle::accept(SceneVisitor &v)
v.visitNodeDrawingStyleBefore(*this);
v.visitDrawingStyle(_DrawingStyle);
for (vector<Node *>::iterator node = _Children.begin(), end = _Children.end(); node != end;
- ++node)
+ ++node) {
(*node)->accept(v);
+ }
v.visitNodeDrawingStyleAfter(*this);
}
diff --git a/source/blender/freestyle/intern/scene_graph/NodeGroup.cpp b/source/blender/freestyle/intern/scene_graph/NodeGroup.cpp
index 7ea495c4166..4bbb4a6c58a 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeGroup.cpp
+++ b/source/blender/freestyle/intern/scene_graph/NodeGroup.cpp
@@ -27,8 +27,9 @@ namespace Freestyle {
void NodeGroup::AddChild(Node *iChild)
{
- if (NULL == iChild)
+ if (NULL == iChild) {
return;
+ }
_Children.push_back(iChild);
iChild->addRef();
@@ -44,8 +45,9 @@ int NodeGroup::destroy()
int refThis = Node::destroy();
// if refThis != 0, we can't destroy the tree
- if (0 != refThis)
+ if (0 != refThis) {
return refThis;
+ }
// If we are here, that means that nobody else needs our NodeGroup and we can destroy it.
int refCount = 0;
@@ -53,8 +55,9 @@ int NodeGroup::destroy()
for (node = _Children.begin(); node != _Children.end(); ++node) {
refCount = (*node)->destroy();
- if (0 == refCount)
+ if (0 == refCount) {
delete (*node);
+ }
}
_Children.clear();
@@ -68,8 +71,9 @@ void NodeGroup::accept(SceneVisitor &v)
v.visitNodeGroupBefore(*this);
for (vector<Node *>::iterator node = _Children.begin(), end = _Children.end(); node != end;
- ++node)
+ ++node) {
(*node)->accept(v);
+ }
v.visitNodeGroupAfter(*this);
}
diff --git a/source/blender/freestyle/intern/scene_graph/NodeShape.cpp b/source/blender/freestyle/intern/scene_graph/NodeShape.cpp
index b16ca3eda33..e55b2fb625f 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeShape.cpp
+++ b/source/blender/freestyle/intern/scene_graph/NodeShape.cpp
@@ -30,8 +30,9 @@ NodeShape::~NodeShape()
if (0 != _Shapes.size()) {
for (rep = _Shapes.begin(); rep != _Shapes.end(); ++rep) {
int refCount = (*rep)->destroy();
- if (0 == refCount)
+ if (0 == refCount) {
delete (*rep);
+ }
}
_Shapes.clear();
@@ -46,8 +47,9 @@ void NodeShape::accept(SceneVisitor &v)
v.visitNodeShapeBefore(*this);
vector<Rep *>::iterator rep;
- for (rep = _Shapes.begin(); rep != _Shapes.end(); ++rep)
+ for (rep = _Shapes.begin(); rep != _Shapes.end(); ++rep) {
(*rep)->accept(v);
+ }
v.visitNodeShapeAfter(*this);
}
diff --git a/source/blender/freestyle/intern/scene_graph/NodeShape.h b/source/blender/freestyle/intern/scene_graph/NodeShape.h
index ec7e09d6c88..13ee265ec10 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeShape.h
+++ b/source/blender/freestyle/intern/scene_graph/NodeShape.h
@@ -53,8 +53,9 @@ class NodeShape : public Node {
*/
virtual void AddRep(Rep *iRep)
{
- if (NULL == iRep)
+ if (NULL == iRep) {
return;
+ }
_Shapes.push_back(iRep);
iRep->addRef();
diff --git a/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp b/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp
index 5452c233e2c..9bf0fc4f901 100644
--- a/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp
+++ b/source/blender/freestyle/intern/scene_graph/NodeTransform.cpp
@@ -37,8 +37,9 @@ void NodeTransform::Rotate(real iAngle, real x, real y, real z)
{
// Normalize the x,y,z vector;
real norm = (real)sqrt(x * x + y * y + z * z);
- if (0 == norm)
+ if (0 == norm) {
return;
+ }
x /= norm;
y /= norm;
@@ -72,8 +73,9 @@ void NodeTransform::Rotate(real iAngle, real x, real y, real z)
R4 = Matrix44r::identity();
for (int i = 0; i < 3; i++) {
- for (int j = 0; j < 3; j++)
+ for (int j = 0; j < 3; j++) {
R4(i, j) = R(i, j);
+ }
}
// Finally, we multiply our current matrix by R4:
@@ -99,8 +101,9 @@ void NodeTransform::MultiplyMatrix(const Matrix44r &iMatrix)
void NodeTransform::setMatrix(const Matrix44r &iMatrix)
{
_Matrix = iMatrix;
- if (isScaled(iMatrix))
+ if (isScaled(iMatrix)) {
_Scaled = true;
+ }
}
void NodeTransform::accept(SceneVisitor &v)
@@ -109,8 +112,9 @@ void NodeTransform::accept(SceneVisitor &v)
v.visitNodeTransformBefore(*this);
for (vector<Node *>::iterator node = _Children.begin(), end = _Children.end(); node != end;
- ++node)
+ ++node) {
(*node)->accept(v);
+ }
v.visitNodeTransformAfter(*this);
}
@@ -133,17 +137,20 @@ void NodeTransform::AddBBox(const BBox<Vec3r> &iBBox)
// Computes the transform iBBox
HVec3r tbox[8];
unsigned int i;
- for (i = 0; i < 8; i++)
+ for (i = 0; i < 8; i++) {
tbox[i] = _Matrix * box[i];
+ }
Vec3r newMin(tbox[0]);
Vec3r newMax(tbox[0]);
for (i = 0; i < 8; i++) {
for (unsigned int j = 0; j < 3; j++) {
- if (newMin[j] > tbox[i][j])
+ if (newMin[j] > tbox[i][j]) {
newMin[j] = tbox[i][j];
- if (newMax[j] < tbox[i][j])
+ }
+ if (newMax[j] < tbox[i][j]) {
newMax[j] = tbox[i][j];
+ }
}
}
@@ -159,8 +166,9 @@ bool NodeTransform::isScaled(const Matrix44r &M)
for (unsigned int i = 0; i < 3; i++) {
norm += M(i, j) * M(i, j);
}
- if ((norm > 1.01) || (norm < 0.99))
+ if ((norm > 1.01) || (norm < 0.99)) {
return true;
+ }
}
return false;
diff --git a/source/blender/freestyle/intern/scene_graph/OrientedLineRep.cpp b/source/blender/freestyle/intern/scene_graph/OrientedLineRep.cpp
index 60730528f1a..9e83527acad 100644
--- a/source/blender/freestyle/intern/scene_graph/OrientedLineRep.cpp
+++ b/source/blender/freestyle/intern/scene_graph/OrientedLineRep.cpp
@@ -28,10 +28,12 @@ namespace Freestyle {
void OrientedLineRep::accept(SceneVisitor &v)
{
Rep::accept(v);
- if (!frs_material())
+ if (!frs_material()) {
v.visitOrientedLineRep(*this);
- else
+ }
+ else {
v.visitLineRep(*this);
+ }
}
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/scene_graph/Rep.h b/source/blender/freestyle/intern/scene_graph/Rep.h
index 22078422af6..58553d257d9 100644
--- a/source/blender/freestyle/intern/scene_graph/Rep.h
+++ b/source/blender/freestyle/intern/scene_graph/Rep.h
@@ -54,10 +54,12 @@ class Rep : public BaseObject {
_Id = iBrother._Id;
_Name = iBrother._Name;
_LibraryPath = iBrother._LibraryPath;
- if (0 == iBrother._FrsMaterial)
+ if (0 == iBrother._FrsMaterial) {
_FrsMaterial = 0;
- else
+ }
+ else {
_FrsMaterial = new FrsMaterial(*(iBrother._FrsMaterial));
+ }
_BBox = iBrother.bbox();
}
@@ -106,8 +108,9 @@ class Rep : public BaseObject {
*/
virtual void accept(SceneVisitor &v)
{
- if (_FrsMaterial)
+ if (_FrsMaterial) {
v.visitFrsMaterial(*_FrsMaterial);
+ }
v.visitRep(*this);
}
diff --git a/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.h b/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.h
index 989e9e36faa..f19233bba3b 100644
--- a/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.h
+++ b/source/blender/freestyle/intern/scene_graph/ScenePrettyPrinter.h
@@ -36,17 +36,20 @@ class ScenePrettyPrinter : public SceneVisitor {
public:
ScenePrettyPrinter(const string filename = "SceneLog.txt") : SceneVisitor()
{
- if (!filename.empty())
+ if (!filename.empty()) {
_ofs.open(filename.c_str());
- if (!_ofs.is_open())
+ }
+ if (!_ofs.is_open()) {
cerr << "Warning, unable to open file \"" << filename << "\"" << endl;
+ }
_space = "";
}
virtual ~ScenePrettyPrinter()
{
- if (_ofs.is_open())
+ if (_ofs.is_open()) {
_ofs.close();
+ }
}
//
diff --git a/source/blender/freestyle/intern/scene_graph/TriangleRep.cpp b/source/blender/freestyle/intern/scene_graph/TriangleRep.cpp
index ab8ee9e9bb6..8e90ec4fb86 100644
--- a/source/blender/freestyle/intern/scene_graph/TriangleRep.cpp
+++ b/source/blender/freestyle/intern/scene_graph/TriangleRep.cpp
@@ -36,22 +36,28 @@ void TriangleRep::ComputeBBox()
// parse all the coordinates to find the XMax, YMax, ZMax
for (int i = 0; i < 3; ++i) {
// X
- if (_vertices[i][0] > XMax)
+ if (_vertices[i][0] > XMax) {
XMax = _vertices[i][0];
- if (_vertices[i][0] < XMin)
+ }
+ if (_vertices[i][0] < XMin) {
XMin = _vertices[i][0];
+ }
// Y
- if (_vertices[i][1] > YMax)
+ if (_vertices[i][1] > YMax) {
YMax = _vertices[i][1];
- if (_vertices[i][1] < YMin)
+ }
+ if (_vertices[i][1] < YMin) {
YMin = _vertices[i][1];
+ }
// Z
- if (_vertices[i][2] > ZMax)
+ if (_vertices[i][2] > ZMax) {
ZMax = _vertices[i][2];
- if (_vertices[i][2] < ZMin)
+ }
+ if (_vertices[i][2] < ZMin) {
ZMin = _vertices[i][2];
+ }
}
setBBox(BBox<Vec3r>(Vec3r(XMin, YMin, ZMin), Vec3r(XMax, YMax, ZMax)));
diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp
index fd97138c91b..ef151365fa0 100644
--- a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp
+++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp
@@ -69,8 +69,9 @@ int GetSteerableViewMapDensityF1D::operator()(Interface1D &inter)
++v;
for (; v != vend; ++v) {
res_tmp = *v;
- if (res_tmp < res)
+ if (res_tmp < res) {
res = res_tmp;
+ }
}
break;
case MAX:
@@ -78,8 +79,9 @@ int GetSteerableViewMapDensityF1D::operator()(Interface1D &inter)
++v;
for (; v != vend; ++v) {
res_tmp = *v;
- if (res_tmp > res)
+ if (res_tmp > res) {
res = res_tmp;
+ }
}
break;
case FIRST:
@@ -93,8 +95,9 @@ int GetSteerableViewMapDensityF1D::operator()(Interface1D &inter)
default:
res = *v;
++v;
- for (; v != vend; ++v, ++size)
+ for (; v != vend; ++v, ++size) {
res += *v;
+ }
res /= (size ? size : 1);
break;
}
diff --git a/source/blender/freestyle/intern/stroke/AdvancedPredicates1D.h b/source/blender/freestyle/intern/stroke/AdvancedPredicates1D.h
index df66f82b868..05fcf7f356f 100644
--- a/source/blender/freestyle/intern/stroke/AdvancedPredicates1D.h
+++ b/source/blender/freestyle/intern/stroke/AdvancedPredicates1D.h
@@ -67,8 +67,9 @@ class DensityLowerThanUP1D : public UnaryPredicate1D {
int operator()(Interface1D &inter)
{
Functions1D::DensityF1D fun(_sigma);
- if (fun(inter) < 0)
+ if (fun(inter) < 0) {
return -1;
+ }
result = (fun.result < _threshold);
return 0;
}
diff --git a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp
index 6a0d3b0b793..96375407256 100644
--- a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp
+++ b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp
@@ -53,8 +53,9 @@ int CalligraphicShader::shade(Stroke &ioStroke) const
StrokeVertex *sv;
for (v = ioStroke.verticesBegin(); !v.isEnd(); ++v) {
real thickness;
- if (fun(v) < 0)
+ if (fun(v) < 0) {
return -1;
+ }
Vec2f vertexOri(fun.result);
Vec2r ori2d(-vertexOri[1], vertexOri[0]);
@@ -70,8 +71,9 @@ int CalligraphicShader::shade(Stroke &ioStroke) const
sv->attribute().setColor(0, 0, 0);
}
thickness = _minThickness + scal * (_maxThickness - _minThickness);
- if (thickness < 0.0)
+ if (thickness < 0.0) {
thickness = 0.0;
+ }
sv->attribute().setThickness(thickness / 2.0, thickness / 2.0);
}
@@ -91,10 +93,12 @@ SpatialNoiseShader::SpatialNoiseShader(
: StrokeShader()
{
_amount = ioamount;
- if (ixScale == 0)
+ if (ixScale == 0) {
_xScale = 0;
- else
+ }
+ else {
_xScale = 1.0 / ixScale / real(NB_VALUE_NOISE);
+ }
_nbOctave = nbOctave;
_smooth = smooth;
_pureRandom = pureRandom;
@@ -112,15 +116,17 @@ int SpatialNoiseShader::shade(Stroke &ioStroke) const
StrokeVertex *sv;
sv = dynamic_cast<StrokeVertex *>(&(*v));
real initU = sv->strokeLength() * real(NB_VALUE_NOISE);
- if (_pureRandom)
+ if (_pureRandom) {
initU += RandGen::drand48() * real(NB_VALUE_NOISE);
+ }
Functions0D::VertexOrientation2DF0D fun;
while (!v.isEnd()) {
sv = dynamic_cast<StrokeVertex *>(&(*v));
Vec2r p(sv->getPoint());
- if (fun(v) < 0)
+ if (fun(v) < 0) {
return -1;
+ }
Vec2r vertexOri(fun.result);
Vec2r ori2d(vertexOri[0], vertexOri[1]);
ori2d = Vec2r(p - p0);
@@ -129,10 +135,12 @@ int SpatialNoiseShader::shade(Stroke &ioStroke) const
PseudoNoise mynoise;
real bruit;
- if (_smooth)
+ if (_smooth) {
bruit = mynoise.turbulenceSmooth(_xScale * sv->curvilinearAbscissa() + initU, _nbOctave);
- else
+ }
+ else {
bruit = mynoise.turbulenceLinear(_xScale * sv->curvilinearAbscissa() + initU, _nbOctave);
+ }
Vec2r noise(-ori2d[1] * _amount * bruit, ori2d[0] * _amount * bruit);
@@ -236,15 +244,17 @@ void Smoother::smooth(int nbIteration,
_factorPoint = iFactorPoint;
_anisoPoint = iAnisoPoint;
- for (int i = 0; i < nbIteration; ++i)
+ for (int i = 0; i < nbIteration; ++i) {
iteration();
+ }
copyVertices();
}
static real edgeStopping(real x, real sigma)
{
- if (sigma == 0.0)
+ if (sigma == 0.0) {
return 1.0;
+ }
return exp(-x * x / (sigma * sigma));
}
@@ -262,8 +272,9 @@ void Smoother::iteration()
diffC2; //_factorCurvatureDifference;
motionCurvature *= _factorCurvatureDifference;
// motionCurvature = _factorCurvatureDifference * (diffC1 + diffC2);
- if (_safeTest)
+ if (_safeTest) {
_vertex[i] = Vec2r(_vertex[i] + (motionNormal + motionCurvature) * _normal[i]);
+ }
Vec2r v1(_vertex[i - 1] - _vertex[i]);
Vec2r v2(_vertex[i + 1] - _vertex[i]);
real d1 = v1.norm();
@@ -305,8 +316,9 @@ void Smoother::computeCurvature()
_normal[i].normalizeSafe();
_curvature[i] = normalCurvature * _normal[i];
- if (lba + lbc > M_EPSILON)
+ if (lba + lbc > M_EPSILON) {
_curvature[i] /= (0.5 * lba + lbc);
+ }
}
_curvature[0] = _curvature[1];
_curvature[_nbVertices - 1] = _curvature[_nbVertices - 2];
@@ -329,8 +341,9 @@ void Smoother::computeCurvature()
_normal[i].normalizeSafe();
_curvature[i] = normalCurvature * _normal[i];
- if (lba + lbc > M_EPSILON)
+ if (lba + lbc > M_EPSILON) {
_curvature[i] /= (0.5 * lba + lbc);
+ }
_normal[_nbVertices - 1] = _normal[0];
_curvature[_nbVertices - 1] = _curvature[0];
diff --git a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
index 9bdad9f1b32..befcaf7dc1d 100644
--- a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
+++ b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
@@ -59,10 +59,12 @@ int ConstantThicknessShader::shade(Stroke &stroke) const
for (v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend; ++v) {
// XXX What's the use of i here? And is not the thickness always overriden by the last line of
// the loop?
- if ((1 == i) || (size - 2 == i))
+ if ((1 == i) || (size - 2 == i)) {
v->attribute().setThickness(_thickness / 4.0, _thickness / 4.0);
- if ((0 == i) || (size - 1 == i))
+ }
+ if ((0 == i) || (size - 1 == i)) {
v->attribute().setThickness(0, 0);
+ }
v->attribute().setThickness(_thickness / 2.0, _thickness / 2.0);
}
@@ -77,10 +79,12 @@ int ConstantExternThicknessShader::shade(Stroke &stroke) const
for (v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend; ++v) {
// XXX What's the use of i here? And is not the thickness always overriden by the last line of
// the loop?
- if ((1 == i) || (size - 2 == i))
+ if ((1 == i) || (size - 2 == i)) {
v->attribute().setThickness(_thickness / 2.0, 0);
- if ((0 == i) || (size - 1 == i))
+ }
+ if ((0 == i) || (size - 1 == i)) {
v->attribute().setThickness(0, 0);
+ }
v->attribute().setThickness(_thickness, 0);
}
@@ -94,10 +98,12 @@ int IncreasingThicknessShader::shade(Stroke &stroke) const
for (i = 0, v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend;
++v, ++i) {
float t;
- if (i < (float)n / 2.0f)
+ if (i < (float)n / 2.0f) {
t = (1.0 - (float)i / (float)n) * _ThicknessMin + (float)i / (float)n * _ThicknessMax;
- else
+ }
+ else {
t = (1.0 - (float)i / (float)n) * _ThicknessMax + (float)i / (float)n * _ThicknessMin;
+ }
v->attribute().setThickness(t / 2.0, t / 2.0);
}
return 0;
@@ -114,13 +120,16 @@ int ConstrainedIncreasingThicknessShader::shade(Stroke &stroke) const
// XXX Why not using an if/else here? Else, if last condition is true, everything else is
// computed for nothing!
float t;
- if (i < (float)n / 2.0f)
+ if (i < (float)n / 2.0f) {
t = (1.0 - (float)i / (float)n) * _ThicknessMin + (float)i / (float)n * maxT;
- else
+ }
+ else {
t = (1.0 - (float)i / (float)n) * maxT + (float)i / (float)n * _ThicknessMin;
+ }
v->attribute().setThickness(t / 2.0, t / 2.0);
- if (i == n - 1)
+ if (i == n - 1) {
v->attribute().setThickness(_ThicknessMin / 2.0, _ThicknessMin / 2.0);
+ }
}
return 0;
}
@@ -130,14 +139,18 @@ int LengthDependingThicknessShader::shade(Stroke &stroke) const
float step = (_maxThickness - _minThickness) / 3.0f;
float l = stroke.getLength2D();
float thickness = 0.0f;
- if (l > 300.0f)
+ if (l > 300.0f) {
thickness = _minThickness + 3.0f * step;
- else if ((l < 300.0f) && (l > 100.0f))
+ }
+ else if ((l < 300.0f) && (l > 100.0f)) {
thickness = _minThickness + 2.0f * step;
- else if ((l < 100.0f) && (l > 50.0f))
+ }
+ else if ((l < 100.0f) && (l > 50.0f)) {
thickness = _minThickness + 1.0f * step;
- else // else if (l < 50.0f), tsst...
+ }
+ else { // else if (l < 50.0f), tsst...
thickness = _minThickness;
+ }
StrokeInternal::StrokeVertexIterator v, vend;
int i = 0;
@@ -145,10 +158,12 @@ int LengthDependingThicknessShader::shade(Stroke &stroke) const
for (v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend; ++v) {
// XXX What's the use of i here? And is not the thickness always overriden by the last line of
// the loop?
- if ((1 == i) || (size - 2 == i))
+ if ((1 == i) || (size - 2 == i)) {
v->attribute().setThickness(thickness / 4.0, thickness / 4.0);
- if ((0 == i) || (size - 1 == i))
+ }
+ if ((0 == i) || (size - 1 == i)) {
v->attribute().setThickness(0, 0);
+ }
v->attribute().setThickness(thickness / 2.0, thickness / 2.0);
}
@@ -231,8 +246,9 @@ int MaterialColorShader::shade(Stroke &stroke) const
Functions0D::MaterialF0D fun;
StrokeVertex *sv;
for (v = stroke.verticesBegin(), vend = stroke.verticesEnd(); v != vend; ++v) {
- if (fun(v) < 0)
+ if (fun(v) < 0) {
return -1;
+ }
const float *diffuse = fun.result.diffuse();
sv = dynamic_cast<StrokeVertex *>(&(*v));
sv->attribute().setColor(
@@ -281,8 +297,9 @@ int ColorNoiseShader::shade(Stroke &stroke) const
int BlenderTextureShader::shade(Stroke &stroke) const
{
- if (_mtex)
+ if (_mtex) {
return stroke.setMTex(_mtex);
+ }
if (_nodeTree) {
stroke.setNodeTree(_nodeTree);
return 0;
@@ -304,8 +321,9 @@ int StrokeTextureStepShader::shade(Stroke &stroke) const
int BackboneStretcherShader::shade(Stroke &stroke) const
{
float l = stroke.getLength2D();
- if (l <= 1.0e-6)
+ if (l <= 1.0e-6) {
return 0;
+ }
StrokeInternal::StrokeVertexIterator v0 = stroke.strokeVerticesBegin();
StrokeInternal::StrokeVertexIterator v1 = v0;
@@ -346,8 +364,9 @@ int ExternalContourStretcherShader::shade(Stroke &stroke) const
Functions0D::Normal2DF0D fun;
StrokeVertex *sv;
for (it = stroke.verticesBegin(); !it.isEnd(); ++it) {
- if (fun(it) < 0)
+ if (fun(it) < 0) {
return -1;
+ }
Vec2f n(fun.result);
sv = dynamic_cast<StrokeVertex *>(&(*it));
Vec2d newPoint(sv->x() + _amount * n.x(), sv->y() + _amount * n.y());
@@ -360,8 +379,9 @@ int ExternalContourStretcherShader::shade(Stroke &stroke) const
//!! Bezier curve stroke shader
int BezierCurveShader::shade(Stroke &stroke) const
{
- if (stroke.strokeVerticesSize() < 4)
+ if (stroke.strokeVerticesSize() < 4) {
return 0;
+ }
// Build the Bezier curve from this set of data points:
vector<Vec2d> data;
@@ -371,8 +391,9 @@ int BezierCurveShader::shade(Stroke &stroke) const
++v;
for (vend = stroke.strokeVerticesEnd(); v != vend; ++v) {
if (!((fabs(v->x() - (previous)->x()) < M_EPSILON) &&
- ((fabs(v->y() - (previous)->y()) < M_EPSILON))))
+ ((fabs(v->y() - (previous)->y()) < M_EPSILON)))) {
data.push_back(Vec2d(v->x(), v->y()));
+ }
previous = v;
}
@@ -435,8 +456,9 @@ int BezierCurveShader::shade(Stroke &stroke) const
stroke.UpdateLength();
// Deal with extra vertices:
- if (nExtraVertex == 0)
+ if (nExtraVertex == 0) {
return 0;
+ }
// nExtraVertex should stay unassigned
vector<StrokeAttribute> attributes;
@@ -504,8 +526,9 @@ class CurvePiece {
for (StrokeInternal::StrokeVertexIterator it = _begin; it != _last; ++it) {
Vec2d P(it->x(), it->y());
float d = GeomUtils::distPointSegment(P, A, B);
- if (d > maxE)
+ if (d > maxE) {
maxE = d;
+ }
}
_error = maxE;
return maxE;
@@ -520,8 +543,9 @@ class CurvePiece {
int ns = size - 1; // number of segments (ns > 1)
int ns1 = ns / 2;
int ns2 = ns - ns1;
- for (int i = 0; i < ns1; ++it, ++i)
+ for (int i = 0; i < ns1; ++it, ++i) {
;
+ }
CurvePiece *second = new CurvePiece(it, _last, ns2 + 1);
size = ns1 + 1;
@@ -600,8 +624,9 @@ int GuidingLinesShader::shade(Stroke &stroke) const
Vec2d u = piece.B - piece.A;
Vec2f n(u[1], -u[0]);
n.normalize();
- if (norm_fun(stroke) < 0)
+ if (norm_fun(stroke) < 0) {
return -1;
+ }
Vec2f strokeN(norm_fun.result);
if (n * strokeN < 0) {
n[0] = -n[0];
@@ -632,8 +657,9 @@ int TipRemoverShader::shade(Stroke &stroke) const
{
int originalSize = stroke.strokeVerticesSize();
- if (originalSize < 4)
+ if (originalSize < 4) {
return 0;
+ }
StrokeInternal::StrokeVertexIterator v, vend;
vector<StrokeVertex *> verticesToRemove;
@@ -646,8 +672,9 @@ int TipRemoverShader::shade(Stroke &stroke) const
oldAttributes.push_back(v->attribute());
}
- if (originalSize - verticesToRemove.size() < 2)
+ if (originalSize - verticesToRemove.size() < 2) {
return 0;
+ }
vector<StrokeVertex *>::iterator sv, svend;
for (sv = verticesToRemove.begin(), svend = verticesToRemove.end(); sv != svend; ++sv) {
@@ -657,8 +684,9 @@ int TipRemoverShader::shade(Stroke &stroke) const
// Resample so that our new stroke have the same number of vertices than before
stroke.Resample(originalSize);
- if ((int)stroke.strokeVerticesSize() != originalSize) // soc
+ if ((int)stroke.strokeVerticesSize() != originalSize) { // soc
cerr << "Warning: resampling problem" << endl;
+ }
// assign old attributes to new stroke vertices:
vector<StrokeAttribute>::iterator a = oldAttributes.begin(), aend = oldAttributes.end();
diff --git a/source/blender/freestyle/intern/stroke/Canvas.cpp b/source/blender/freestyle/intern/stroke/Canvas.cpp
index 95bbafc0aa0..4cb00b18f60 100644
--- a/source/blender/freestyle/intern/stroke/Canvas.cpp
+++ b/source/blender/freestyle/intern/stroke/Canvas.cpp
@@ -92,8 +92,9 @@ Canvas::~Canvas()
}
_maps.clear();
}
- if (_steerableViewMap)
+ if (_steerableViewMap) {
delete _steerableViewMap;
+ }
}
void Canvas::preDraw()
@@ -102,20 +103,23 @@ void Canvas::preDraw()
void Canvas::Draw()
{
- if (_StyleModules.empty())
+ if (_StyleModules.empty()) {
return;
+ }
preDraw();
TimeStamp *timestamp = TimeStamp::instance();
for (unsigned int i = 0; i < _StyleModules.size(); ++i) {
_current_sm = _StyleModules[i];
- if (i < _Layers.size() && _Layers[i])
+ if (i < _Layers.size() && _Layers[i]) {
delete _Layers[i];
+ }
_Layers[i] = _StyleModules[i]->execute();
- if (!_Layers[i])
+ if (!_Layers[i]) {
continue;
+ }
stroke_count += _Layers[i]->strokes_size();
@@ -134,8 +138,9 @@ void Canvas::Clear()
if (!_Layers.empty()) {
for (deque<StrokeLayer *>::iterator sl = _Layers.begin(), slend = _Layers.end(); sl != slend;
++sl) {
- if (*sl)
+ if (*sl) {
delete (*sl);
+ }
}
_Layers.clear();
}
@@ -144,13 +149,15 @@ void Canvas::Clear()
for (deque<StyleModule *>::iterator s = _StyleModules.begin(), send = _StyleModules.end();
s != send;
++s) {
- if (*s)
+ if (*s) {
delete (*s);
+ }
}
_StyleModules.clear();
}
- if (_steerableViewMap)
+ if (_steerableViewMap) {
_steerableViewMap->Reset();
+ }
stroke_count = 0;
}
@@ -160,12 +167,14 @@ void Canvas::Erase()
if (!_Layers.empty()) {
for (deque<StrokeLayer *>::iterator sl = _Layers.begin(), slend = _Layers.end(); sl != slend;
++sl) {
- if (*sl)
+ if (*sl) {
(*sl)->clear();
+ }
}
}
- if (_steerableViewMap)
+ if (_steerableViewMap) {
_steerableViewMap->Reset();
+ }
update();
stroke_count = 0;
@@ -200,8 +209,9 @@ void Canvas::RemoveStyleModule(unsigned index)
++s, ++i) {
if (i == index) {
// remove shader
- if (*s)
+ if (*s) {
delete *s;
+ }
_StyleModules.erase(s);
break;
}
@@ -214,8 +224,9 @@ void Canvas::RemoveStyleModule(unsigned index)
++sl, ++i) {
if (i == index) {
// remove layer
- if (*sl)
+ if (*sl) {
delete *sl;
+ }
_Layers.erase(sl);
break;
}
@@ -243,8 +254,9 @@ void Canvas::ReplaceStyleModule(unsigned index, StyleModule *iStyleModule)
s != send;
++s, ++i) {
if (i == index) {
- if (*s)
+ if (*s) {
delete *s;
+ }
*s = iStyleModule;
break;
}
@@ -264,8 +276,9 @@ void Canvas::setModified(unsigned index, bool iMod)
void Canvas::resetModified(bool iMod /* = false */)
{
unsigned int size = _StyleModules.size();
- for (unsigned int i = 0; i < size; ++i)
+ for (unsigned int i = 0; i < size; ++i) {
setModified(i, iMod);
+ }
}
void Canvas::causalStyleModules(vector<unsigned> &vec, unsigned index)
@@ -273,16 +286,18 @@ void Canvas::causalStyleModules(vector<unsigned> &vec, unsigned index)
unsigned int size = _StyleModules.size();
for (unsigned int i = index; i < size; ++i) {
- if (_StyleModules[i]->getCausal())
+ if (_StyleModules[i]->getCausal()) {
vec.push_back(i);
+ }
}
}
void Canvas::Render(const StrokeRenderer *iRenderer)
{
for (unsigned int i = 0; i < _StyleModules.size(); ++i) {
- if (!_StyleModules[i]->getDisplayed() || !_Layers[i])
+ if (!_StyleModules[i]->getDisplayed() || !_Layers[i]) {
continue;
+ }
_Layers[i]->Render(iRenderer);
}
}
@@ -290,8 +305,9 @@ void Canvas::Render(const StrokeRenderer *iRenderer)
void Canvas::RenderBasic(const StrokeRenderer *iRenderer)
{
for (unsigned int i = 0; i < _StyleModules.size(); ++i) {
- if (!_StyleModules[i]->getDisplayed() || !_Layers[i])
+ if (!_StyleModules[i]->getDisplayed() || !_Layers[i]) {
continue;
+ }
_Layers[i]->RenderBasic(iRenderer);
}
}
@@ -462,8 +478,9 @@ float Canvas::readMapPixel(const char *iMapName, int level, int x, int y)
return -1;
}
ImagePyramid *pyramid = (*m).second;
- if ((x < 0) || (x >= pyramid->width()) || (y < 0) || (y >= pyramid->height()))
+ if ((x < 0) || (x >= pyramid->width()) || (y < 0) || (y >= pyramid->height())) {
return 0;
+ }
return pyramid->pixel(x, height() - 1 - y, level);
}
diff --git a/source/blender/freestyle/intern/stroke/Chain.cpp b/source/blender/freestyle/intern/stroke/Chain.cpp
index d4cc4fd68c3..79d174d8117 100644
--- a/source/blender/freestyle/intern/stroke/Chain.cpp
+++ b/source/blender/freestyle/intern/stroke/Chain.cpp
@@ -45,10 +45,12 @@ void Chain::push_viewedge_back(ViewEdge *iViewEdge, bool orientation)
if (!_Vertices.empty()) {
previous = _Vertices.back()->point2d();
- if (orientation)
+ if (orientation) {
++v;
- else
+ }
+ else {
--v;
+ }
// Ensure the continuity of underlying FEdges
CurvePoint *cp =
_Vertices.back(); // assumed to be instantiated as new CurvePoint(iSVertex, 0, 0.f);
@@ -69,10 +71,12 @@ void Chain::push_viewedge_back(ViewEdge *iViewEdge, bool orientation)
Curve::push_vertex_back(*v);
//_Length += (current - previous).norm();
previous = current;
- if (orientation)
+ if (orientation) {
++v;
- else
+ }
+ else {
--v;
+ }
} while ((v != vend) && (v != vfirst));
if (v == vfirst) {
@@ -105,10 +109,12 @@ void Chain::push_viewedge_front(ViewEdge *iViewEdge, bool orientation)
if (!_Vertices.empty()) {
previous = _Vertices.front()->point2d();
- if (orientation)
+ if (orientation) {
++v;
- else
+ }
+ else {
--v;
+ }
// Ensure the continuity of underlying FEdges
CurvePoint *cp =
_Vertices.front(); // assumed to be instantiated as new CurvePoint(iSVertex, 0, 0.f);
@@ -131,10 +137,12 @@ void Chain::push_viewedge_front(ViewEdge *iViewEdge, bool orientation)
Curve::push_vertex_front((*v));
//_Length += (current - previous).norm();
previous = current;
- if (orientation)
+ if (orientation) {
++v;
- else
+ }
+ else {
--v;
+ }
} while ((v != vend) && (v != vfirst));
if (v == vfirst) {
@@ -144,8 +152,9 @@ void Chain::push_viewedge_front(ViewEdge *iViewEdge, bool orientation)
//_Length += (current - previous).norm();
}
- if (!_fedgeB)
+ if (!_fedgeB) {
_fedgeB = (orientation) ? iViewEdge->fedgeB() : iViewEdge->fedgeA();
+ }
}
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/stroke/Chain.h b/source/blender/freestyle/intern/stroke/Chain.h
index 547fed70953..2c19748771e 100644
--- a/source/blender/freestyle/intern/stroke/Chain.h
+++ b/source/blender/freestyle/intern/stroke/Chain.h
@@ -65,8 +65,9 @@ class Chain : public Curve {
{
// only the last splitted deletes this id
if (_splittingId) {
- if (*_splittingId == _Id)
+ if (*_splittingId == _Id) {
delete _splittingId;
+ }
}
}
diff --git a/source/blender/freestyle/intern/stroke/ChainingIterators.cpp b/source/blender/freestyle/intern/stroke/ChainingIterators.cpp
index 551b9aa4043..271db48aabe 100644
--- a/source/blender/freestyle/intern/stroke/ChainingIterators.cpp
+++ b/source/blender/freestyle/intern/stroke/ChainingIterators.cpp
@@ -40,20 +40,23 @@ bool AdjacencyIterator::isIncoming() const
int AdjacencyIterator::increment()
{
++_internalIterator;
- while ((!_internalIterator.isEnd()) && (!isValid((*_internalIterator).first)))
+ while ((!_internalIterator.isEnd()) && (!isValid((*_internalIterator).first))) {
++_internalIterator;
+ }
return 0;
}
bool AdjacencyIterator::isValid(ViewEdge *edge)
{
if (_restrictToSelection) {
- if (edge->getTimeStamp() != TimeStamp::instance()->getTimeStamp())
+ if (edge->getTimeStamp() != TimeStamp::instance()->getTimeStamp()) {
return false;
+ }
}
if (_restrictToUnvisited) {
- if (edge->getChainingTimeStamp() > TimeStamp::instance()->getTimeStamp())
+ if (edge->getChainingTimeStamp() > TimeStamp::instance()->getTimeStamp()) {
return false;
+ }
}
return true;
}
@@ -81,15 +84,19 @@ int ChainingIterator::increment()
_edge = 0;
return 0;
}
- if (traverse(it) < 0)
+ if (traverse(it) < 0) {
return -1;
+ }
_edge = result;
- if (_edge == 0)
+ if (_edge == 0) {
return 0;
- if (_edge->A() == vertex)
+ }
+ if (_edge->A() == vertex) {
_orientation = true;
- else
+ }
+ else {
_orientation = false;
+ }
return 0;
}
@@ -106,15 +113,19 @@ int ChainingIterator::decrement()
_edge = 0;
return 0;
}
- if (traverse(it) < 0)
+ if (traverse(it) < 0) {
return -1;
+ }
_edge = result;
- if (_edge == 0)
+ if (_edge == 0) {
return 0;
- if (_edge->B() == vertex)
+ }
+ if (_edge->B() == vertex) {
_orientation = true;
- else
+ }
+ else {
_orientation = false;
+ }
return 0;
}
@@ -186,17 +197,20 @@ int ChainSilhouetteIterator::traverse(const AdjacencyIterator &ait)
int ChainPredicateIterator::traverse(const AdjacencyIterator &ait)
{
- if (!_unary_predicate || !_binary_predicate)
+ if (!_unary_predicate || !_binary_predicate) {
return -1;
+ }
AdjacencyIterator it(ait);
// Iterates over next edges to see if one of them respects the predicate:
while (!it.isEnd()) {
ViewEdge *ve = *it;
- if (_unary_predicate->operator()(*ve) < 0)
+ if (_unary_predicate->operator()(*ve) < 0) {
return -1;
+ }
if (_unary_predicate->result) {
- if (_binary_predicate->operator()(*(getCurrentEdge()), *(ve)) < 0)
+ if (_binary_predicate->operator()(*(getCurrentEdge()), *(ve)) < 0) {
return -1;
+ }
if (_binary_predicate->result) {
result = ve;
return 0;
diff --git a/source/blender/freestyle/intern/stroke/ChainingIterators.h b/source/blender/freestyle/intern/stroke/ChainingIterators.h
index 52da85ccc58..3cc322a2a4b 100644
--- a/source/blender/freestyle/intern/stroke/ChainingIterators.h
+++ b/source/blender/freestyle/intern/stroke/ChainingIterators.h
@@ -60,8 +60,9 @@ class AdjacencyIterator : public Iterator {
_restrictToSelection = iRestrictToSelection;
_restrictToUnvisited = iRestrictToUnvisited;
_internalIterator = iVertex->edgesBegin();
- while ((!_internalIterator.isEnd()) && (!isValid((*_internalIterator).first)))
+ while ((!_internalIterator.isEnd()) && (!isValid((*_internalIterator).first))) {
++_internalIterator;
+ }
}
AdjacencyIterator(const AdjacencyIterator &iBrother)
diff --git a/source/blender/freestyle/intern/stroke/Curve.cpp b/source/blender/freestyle/intern/stroke/Curve.cpp
index fe617646442..e1970c7196c 100644
--- a/source/blender/freestyle/intern/stroke/Curve.cpp
+++ b/source/blender/freestyle/intern/stroke/Curve.cpp
@@ -194,8 +194,9 @@ CurvePoint &CurvePoint::operator=(const CurvePoint &iBrother)
FEdge *CurvePoint::fedge()
{
- if (getNature() & Nature::T_VERTEX)
+ if (getNature() & Nature::T_VERTEX) {
return 0;
+ }
return __A->fedge();
}
@@ -212,42 +213,55 @@ FEdge *CurvePoint::getFEdge(Interface0D &inter)
return __A->getFEdge(*__B);
}
if (__B == 0) {
- if (iVertexB->__B == 0)
+ if (iVertexB->__B == 0) {
return __A->getFEdge(*(iVertexB->__A));
- else if (iVertexB->__A == __A)
+ }
+ else if (iVertexB->__A == __A) {
return __A->getFEdge(*(iVertexB->__B));
- else if (iVertexB->__B == __A)
+ }
+ else if (iVertexB->__B == __A) {
return __A->getFEdge(*(iVertexB->__A));
+ }
}
if (iVertexB->__B == 0) {
- if (iVertexB->__A == __A)
+ if (iVertexB->__A == __A) {
return __B->getFEdge(*(iVertexB->__A));
- else if (iVertexB->__A == __B)
+ }
+ else if (iVertexB->__A == __B) {
return __A->getFEdge(*(iVertexB->__A));
+ }
}
if (__B == iVertexB->__A) {
- if ((_t2d != 1) && (iVertexB->_t2d == 0))
+ if ((_t2d != 1) && (iVertexB->_t2d == 0)) {
return __A->getFEdge(*__B);
- if ((_t2d == 1) && (iVertexB->_t2d != 0))
+ }
+ if ((_t2d == 1) && (iVertexB->_t2d != 0)) {
return iVertexB->__A->getFEdge(*(iVertexB->__B));
+ }
}
if (__B == iVertexB->__B) {
- if ((_t2d != 1) && (iVertexB->_t2d == 1))
+ if ((_t2d != 1) && (iVertexB->_t2d == 1)) {
return __A->getFEdge(*__B);
- if ((_t2d == 1) && (iVertexB->_t2d != 1))
+ }
+ if ((_t2d == 1) && (iVertexB->_t2d != 1)) {
return iVertexB->__A->getFEdge(*(iVertexB->__B));
+ }
}
if (__A == iVertexB->__A) {
- if ((_t2d == 0) && (iVertexB->_t2d != 0))
+ if ((_t2d == 0) && (iVertexB->_t2d != 0)) {
return iVertexB->__A->getFEdge(*(iVertexB->__B));
- if ((_t2d != 0) && (iVertexB->_t2d == 0))
+ }
+ if ((_t2d != 0) && (iVertexB->_t2d == 0)) {
return __A->getFEdge(*__B);
+ }
}
if (__A == iVertexB->__B) {
- if ((_t2d == 0) && (iVertexB->_t2d != 1))
+ if ((_t2d == 0) && (iVertexB->_t2d != 1)) {
return iVertexB->__A->getFEdge(*(iVertexB->__B));
- if ((_t2d != 0) && (iVertexB->_t2d == 1))
+ }
+ if ((_t2d != 0) && (iVertexB->_t2d == 1)) {
return __A->getFEdge(*__B);
+ }
}
#if 0
if (G.debug & G_DEBUG_FREESTYLE) {
@@ -275,16 +289,20 @@ FEdge *CurvePoint::getFEdge(Interface0D &inter)
Vec3r CurvePoint::normal() const
{
- if (__B == 0)
+ if (__B == 0) {
return __A->normal();
- if (__A == 0)
+ }
+ if (__A == 0) {
return __B->normal();
+ }
Vec3r Na = __A->normal();
- if (Exception::getException())
+ if (Exception::getException()) {
Na = Vec3r(0, 0, 0);
+ }
Vec3r Nb = __B->normal();
- if (Exception::getException())
+ if (Exception::getException()) {
Nb = Vec3r(0, 0, 0);
+ }
// compute t3d:
real t3d = SilhouetteGeomEngine::ImageToWorldParameter(__A->getFEdge(*__B), _t2d);
return ((1 - t3d) * Na + t3d * Nb);
@@ -308,8 +326,9 @@ Id CurvePoint::shape_id() const
const SShape *CurvePoint::shape() const
{
- if (__A == 0)
+ if (__A == 0) {
return __B->shape();
+ }
return __A->shape();
}
@@ -333,75 +352,92 @@ const unsigned CurvePoint::qi() const
occluder_container::const_iterator CurvePoint::occluders_begin() const
{
- if (__A == 0)
+ if (__A == 0) {
return __B->occluders_begin();
- if (__B == 0)
+ }
+ if (__B == 0) {
return __A->occluders_begin();
+ }
return __A->getFEdge(*__B)->occluders_begin();
}
occluder_container::const_iterator CurvePoint::occluders_end() const
{
- if (__A == 0)
+ if (__A == 0) {
return __B->occluders_end();
- if (__B == 0)
+ }
+ if (__B == 0) {
return __A->occluders_end();
+ }
return __A->getFEdge(*__B)->occluders_end();
}
bool CurvePoint::occluders_empty() const
{
- if (__A == 0)
+ if (__A == 0) {
return __B->occluders_empty();
- if (__B == 0)
+ }
+ if (__B == 0) {
return __A->occluders_empty();
+ }
return __A->getFEdge(*__B)->occluders_empty();
}
int CurvePoint::occluders_size() const
{
- if (__A == 0)
+ if (__A == 0) {
return __B->occluders_size();
- if (__B == 0)
+ }
+ if (__B == 0) {
return __A->occluders_size();
+ }
return __A->getFEdge(*__B)->occluders_size();
}
const SShape *CurvePoint::occluded_shape() const
{
- if (__A == 0)
+ if (__A == 0) {
return __B->occluded_shape();
- if (__B == 0)
+ }
+ if (__B == 0) {
return __A->occluded_shape();
+ }
return __A->getFEdge(*__B)->occluded_shape();
}
const Polygon3r &CurvePoint::occludee() const
{
- if (__A == 0)
+ if (__A == 0) {
return __B->occludee();
- if (__B == 0)
+ }
+ if (__B == 0) {
return __A->occludee();
+ }
return __A->getFEdge(*__B)->occludee();
}
const bool CurvePoint::occludee_empty() const
{
- if (__A == 0)
+ if (__A == 0) {
return __B->occludee_empty();
- if (__B == 0)
+ }
+ if (__B == 0) {
return __A->occludee_empty();
+ }
return __A->getFEdge(*__B)->occludee_empty();
}
real CurvePoint::z_discontinuity() const
{
- if (__A == 0)
+ if (__A == 0) {
return __B->z_discontinuity();
- if (__B == 0)
+ }
+ if (__B == 0) {
return __A->z_discontinuity();
- if (__A->getFEdge(*__B) == 0)
+ }
+ if (__A->getFEdge(*__B) == 0) {
return 0.0;
+ }
return __A->getFEdge(*__B)->z_discontinuity();
}
diff --git a/source/blender/freestyle/intern/stroke/Curve.h b/source/blender/freestyle/intern/stroke/Curve.h
index b84ce45fb6d..3e079256161 100644
--- a/source/blender/freestyle/intern/stroke/Curve.h
+++ b/source/blender/freestyle/intern/stroke/Curve.h
@@ -123,10 +123,12 @@ class CurvePoint : public Interface0D {
virtual Id getId() const
{
Id id;
- if (_t2d == 0)
+ if (_t2d == 0) {
return __A->getId();
- else if (_t2d == 1)
+ }
+ else if (_t2d == 1) {
return __B->getId();
+ }
return id;
}
@@ -134,50 +136,60 @@ class CurvePoint : public Interface0D {
virtual Nature::VertexNature getNature() const
{
Nature::VertexNature nature = Nature::POINT;
- if (_t2d == 0)
+ if (_t2d == 0) {
nature |= __A->getNature();
- else if (_t2d == 1)
+ }
+ else if (_t2d == 1) {
nature |= __B->getNature();
+ }
return nature;
}
/*! Cast the Interface0D in SVertex if it can be. */
virtual SVertex *castToSVertex()
{
- if (_t2d == 0)
+ if (_t2d == 0) {
return __A;
- else if (_t2d == 1)
+ }
+ else if (_t2d == 1) {
return __B;
+ }
return Interface0D::castToSVertex();
}
/*! Cast the Interface0D in ViewVertex if it can be. */
virtual ViewVertex *castToViewVertex()
{
- if (_t2d == 0)
+ if (_t2d == 0) {
return __A->castToViewVertex();
- else if (_t2d == 1)
+ }
+ else if (_t2d == 1) {
return __B->castToViewVertex();
+ }
return Interface0D::castToViewVertex();
}
/*! Cast the Interface0D in NonTVertex if it can be. */
virtual NonTVertex *castToNonTVertex()
{
- if (_t2d == 0)
+ if (_t2d == 0) {
return __A->castToNonTVertex();
- else if (_t2d == 1)
+ }
+ else if (_t2d == 1) {
return __B->castToNonTVertex();
+ }
return Interface0D::castToNonTVertex();
}
/*! Cast the Interface0D in TVertex if it can be. */
virtual TVertex *castToTVertex()
{
- if (_t2d == 0)
+ if (_t2d == 0) {
return __A->castToTVertex();
- else if (_t2d == 1)
+ }
+ else if (_t2d == 1) {
return __B->castToTVertex();
+ }
return Interface0D::castToTVertex();
}
diff --git a/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h b/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h
index 5cbdd26be57..9999950e240 100644
--- a/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h
+++ b/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h
@@ -119,10 +119,12 @@ class __point_iterator : public IteratorBase<Traits, BidirectionalIteratorTag_Tr
_CurvilinearLength = iBrother._CurvilinearLength;
_step = iBrother._step;
_t = iBrother._t;
- if (iBrother._Point == 0)
+ if (iBrother._Point == 0) {
_Point = 0;
- else
+ }
+ else {
_Point = new Point(*(iBrother._Point));
+ }
_n = iBrother._n;
_currentn = iBrother._currentn;
}
@@ -136,10 +138,12 @@ class __point_iterator : public IteratorBase<Traits, BidirectionalIteratorTag_Tr
_CurvilinearLength = iBrother._CurvilinearLength;
_step = iBrother._step;
_t = iBrother._t;
- if (iBrother._Point == 0)
+ if (iBrother._Point == 0) {
_Point = 0;
- else
+ }
+ else {
_Point = new Point(*(iBrother._Point));
+ }
_n = iBrother._n;
_currentn = iBrother._currentn;
}
@@ -154,10 +158,12 @@ class __point_iterator : public IteratorBase<Traits, BidirectionalIteratorTag_Tr
_CurvilinearLength = iBrother._CurvilinearLength;
_step = iBrother._step;
_t = iBrother._t;
- if (iBrother._Point == 0)
+ if (iBrother._Point == 0) {
_Point = 0;
- else
+ }
+ else {
_Point = new Point(*(iBrother._Point));
+ }
_n = iBrother._n;
_currentn = iBrother._currentn;
return *this;
@@ -165,8 +171,9 @@ class __point_iterator : public IteratorBase<Traits, BidirectionalIteratorTag_Tr
virtual ~__point_iterator()
{
- if (_Point != 0)
+ if (_Point != 0) {
delete _Point;
+ }
}
// protected: //FIXME
@@ -243,8 +250,9 @@ class __point_iterator : public IteratorBase<Traits, BidirectionalIteratorTag_Tr
delete _Point;
_Point = 0;
}
- if ((_currentn < 0) || (_currentn >= _n))
+ if ((_currentn < 0) || (_currentn >= _n)) {
return _Point; // 0 in this case
+ }
return (_Point = new Point(*__A, *__B, _t));
}
@@ -255,15 +263,17 @@ class __point_iterator : public IteratorBase<Traits, BidirectionalIteratorTag_Tr
virtual bool begin() const
{
- if ((__A == _begin) && (_t < (float)M_EPSILON))
+ if ((__A == _begin) && (_t < (float)M_EPSILON)) {
return true;
+ }
return false;
}
virtual bool end() const
{
- if ((__B == _end))
+ if ((__B == _end)) {
return true;
+ }
return false;
}
@@ -334,8 +344,9 @@ class __point_iterator : public IteratorBase<Traits, BidirectionalIteratorTag_Tr
--_currentn;
--__A;
--__B;
- if (_currentn == _n - 1)
+ if (_currentn == _n - 1) {
return;
+ }
}
if (0 == _step) { // means we iterate over initial vertices
@@ -358,13 +369,16 @@ class __point_iterator : public IteratorBase<Traits, BidirectionalIteratorTag_Tr
}
// round value
- if (fabs(_t) < (float)M_EPSILON)
+ if (fabs(_t) < (float)M_EPSILON) {
_t = 0.0f;
+ }
if (_t < 0) {
- if (_currentn == 0)
+ if (_currentn == 0) {
_CurvilinearLength = 0.0f;
- else
+ }
+ else {
_CurvilinearLength += normAB * (-_t);
+ }
_t = 0.0f;
}
}
diff --git a/source/blender/freestyle/intern/stroke/CurveIterators.h b/source/blender/freestyle/intern/stroke/CurveIterators.h
index b05c9838a3b..0ebbd0509ca 100644
--- a/source/blender/freestyle/intern/stroke/CurveIterators.h
+++ b/source/blender/freestyle/intern/stroke/CurveIterators.h
@@ -157,8 +157,9 @@ class CurvePointIterator : public Interface0DIteratorNested {
virtual bool operator==(const Interface0DIteratorNested &b) const
{
const CurvePointIterator *it_exact = dynamic_cast<const CurvePointIterator *>(&b);
- if (!it_exact)
+ if (!it_exact) {
return false;
+ }
return ((__A == it_exact->__A) && (__B == it_exact->__B) && (_t == it_exact->_t));
}
@@ -175,15 +176,17 @@ class CurvePointIterator : public Interface0DIteratorNested {
virtual bool isBegin() const
{
- if ((__A == _begin) && (_t < (float)M_EPSILON))
+ if ((__A == _begin) && (_t < (float)M_EPSILON)) {
return true;
+ }
return false;
}
virtual bool isEnd() const
{
- if (__B == _end)
+ if (__B == _end) {
return true;
+ }
return false;
}
@@ -246,8 +249,9 @@ class CurvePointIterator : public Interface0DIteratorNested {
--_currentn;
--__A;
--__B;
- if (_currentn == _n - 1)
+ if (_currentn == _n - 1) {
return 0;
+ }
}
if (0 == _step) { // means we iterate over initial vertices
@@ -270,13 +274,16 @@ class CurvePointIterator : public Interface0DIteratorNested {
}
// round value
- if (fabs(_t) < (float)M_EPSILON)
+ if (fabs(_t) < (float)M_EPSILON) {
_t = 0.0f;
+ }
if (_t < 0) {
- if (_currentn == 0)
+ if (_currentn == 0) {
_CurvilinearLength = 0.0f;
- else
+ }
+ else {
_CurvilinearLength += normAB * (-_t);
+ }
_t = 0.0f;
}
return 0;
diff --git a/source/blender/freestyle/intern/stroke/Operators.cpp b/source/blender/freestyle/intern/stroke/Operators.cpp
index 0374e605ff2..329b5440fed 100644
--- a/source/blender/freestyle/intern/stroke/Operators.cpp
+++ b/source/blender/freestyle/intern/stroke/Operators.cpp
@@ -39,10 +39,12 @@ Operators::StrokesContainer Operators::_current_strokes_set;
int Operators::select(UnaryPredicate1D &pred)
{
- if (!_current_set)
+ if (!_current_set) {
return 0;
- if (_current_set->empty())
+ }
+ if (_current_set->empty()) {
return 0;
+ }
I1DContainer new_set;
I1DContainer rejected;
Functions1D::ChainingTimeStampF1D cts;
@@ -67,8 +69,9 @@ int Operators::select(UnaryPredicate1D &pred)
++it;
}
if ((*itbegin)->getExactTypeName() != "ViewEdge") {
- for (it = rejected.begin(); it != rejected.end(); ++it)
+ for (it = rejected.begin(); it != rejected.end(); ++it) {
delete *it;
+ }
}
rejected.clear();
_current_set->clear();
@@ -80,8 +83,9 @@ int Operators::chain(ViewEdgeInternal::ViewEdgeIterator &it,
UnaryPredicate1D &pred,
UnaryFunction1D_void &modifier)
{
- if (_current_view_edges_set.empty())
+ if (_current_view_edges_set.empty()) {
return 0;
+ }
unsigned id = 0;
ViewEdge *edge;
@@ -90,10 +94,12 @@ int Operators::chain(ViewEdgeInternal::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) < 0)
+ if (pred(**it_edge) < 0) {
goto error;
- if (pred.result)
+ }
+ if (pred.result) {
continue;
+ }
edge = dynamic_cast<ViewEdge *>(*it_edge);
it.setBegin(edge);
@@ -108,14 +114,16 @@ int Operators::chain(ViewEdgeInternal::ViewEdgeIterator &it,
goto error;
}
++it;
- if (it.isEnd())
+ if (it.isEnd()) {
break;
+ }
if (pred(**it) < 0) {
delete new_chain;
goto error;
}
- if (pred.result)
+ if (pred.result) {
break;
+ }
}
new_chains_set.push_back(new_chain);
}
@@ -139,8 +147,9 @@ error:
int Operators::chain(ViewEdgeInternal::ViewEdgeIterator &it, UnaryPredicate1D &pred)
{
- if (_current_view_edges_set.empty())
+ if (_current_view_edges_set.empty()) {
return 0;
+ }
unsigned id = 0;
Functions1D::IncrementChainingTimeStampF1D ts;
@@ -151,14 +160,18 @@ int Operators::chain(ViewEdgeInternal::ViewEdgeIterator &it, UnaryPredicate1D &p
for (I1DContainer::iterator it_edge = _current_view_edges_set.begin();
it_edge != _current_view_edges_set.end();
++it_edge) {
- if (pred(**it_edge) < 0)
+ if (pred(**it_edge) < 0) {
goto error;
- if (pred.result)
+ }
+ if (pred.result) {
continue;
- if (pred_ts(**it_edge) < 0)
+ }
+ if (pred_ts(**it_edge) < 0) {
goto error;
- if (pred_ts.result)
+ }
+ if (pred_ts.result) {
continue;
+ }
edge = dynamic_cast<ViewEdge *>(*it_edge);
it.setBegin(edge);
@@ -170,20 +183,23 @@ int Operators::chain(ViewEdgeInternal::ViewEdgeIterator &it, UnaryPredicate1D &p
new_chain->push_viewedge_back(*it, it.getOrientation());
ts(**it);
++it;
- if (it.isEnd())
+ if (it.isEnd()) {
break;
+ }
if (pred(**it) < 0) {
delete new_chain;
goto error;
}
- if (pred.result)
+ if (pred.result) {
break;
+ }
if (pred_ts(**it) < 0) {
delete new_chain;
goto error;
}
- if (pred_ts.result)
+ if (pred_ts.result) {
break;
+ }
}
new_chains_set.push_back(new_chain);
}
@@ -306,8 +322,9 @@ void Operators::bidirectionalChain(ViewEdgeIterator &it, UnaryPredicate1D &pred)
int Operators::bidirectionalChain(ChainingIterator &it, UnaryPredicate1D &pred)
{
- if (_current_view_edges_set.empty())
+ if (_current_view_edges_set.empty()) {
return 0;
+ }
unsigned id = 0;
Functions1D::IncrementChainingTimeStampF1D ts;
@@ -318,22 +335,27 @@ int Operators::bidirectionalChain(ChainingIterator &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) < 0)
+ if (pred(**it_edge) < 0) {
goto error;
- if (pred.result)
+ }
+ if (pred.result) {
continue;
- if (pred_ts(**it_edge) < 0)
+ }
+ if (pred_ts(**it_edge) < 0) {
goto error;
- if (pred_ts.result)
+ }
+ if (pred_ts.result) {
continue;
+ }
edge = dynamic_cast<ViewEdge *>(*it_edge);
// re-init iterator
it.setBegin(edge);
it.setCurrentEdge(edge);
it.setOrientation(true);
- if (it.init() < 0)
+ if (it.init() < 0) {
goto error;
+ }
Chain *new_chain = new Chain(id);
++id;
@@ -348,14 +370,16 @@ int Operators::bidirectionalChain(ChainingIterator &it, UnaryPredicate1D &pred)
delete new_chain;
goto error;
}
- if (it.isEnd())
+ if (it.isEnd()) {
break;
+ }
if (pred(**it) < 0) {
delete new_chain;
goto error;
}
- if (pred.result)
+ if (pred.result) {
break;
+ }
}
it.setBegin(edge);
it.setCurrentEdge(edge);
@@ -369,8 +393,9 @@ int Operators::bidirectionalChain(ChainingIterator &it, UnaryPredicate1D &pred)
delete new_chain;
goto error;
}
- if (pred.result)
+ if (pred.result) {
break;
+ }
new_chain->push_viewedge_front(*it, it.getOrientation());
ts(**it);
if (it.decrement() < 0) {
@@ -400,8 +425,9 @@ error:
int Operators::bidirectionalChain(ChainingIterator &it)
{
- if (_current_view_edges_set.empty())
+ if (_current_view_edges_set.empty()) {
return 0;
+ }
unsigned id = 0;
Functions1D::IncrementChainingTimeStampF1D ts;
@@ -412,18 +438,21 @@ int Operators::bidirectionalChain(ChainingIterator &it)
for (I1DContainer::iterator it_edge = _current_view_edges_set.begin();
it_edge != _current_view_edges_set.end();
++it_edge) {
- if (pred_ts(**it_edge) < 0)
+ if (pred_ts(**it_edge) < 0) {
goto error;
- if (pred_ts.result)
+ }
+ if (pred_ts.result) {
continue;
+ }
edge = dynamic_cast<ViewEdge *>(*it_edge);
// re-init iterator
it.setBegin(edge);
it.setCurrentEdge(edge);
it.setOrientation(true);
- if (it.init() < 0)
+ if (it.init() < 0) {
goto error;
+ }
Chain *new_chain = new Chain(id);
++id;
@@ -541,8 +570,9 @@ int Operators::sequentialSplit(UnaryPredicate0D &pred, float sampling)
#endif
splitted_chains.clear();
- if (!_current_chains_set.empty())
+ if (!_current_chains_set.empty()) {
_current_set = &_current_chains_set;
+ }
return 0;
error:
@@ -592,8 +622,9 @@ int Operators::sequentialSplit(UnaryPredicate0D &startingPred,
point = dynamic_cast<CurvePoint *>(&(*itStop));
new_curve->push_vertex_back(point);
++itStop;
- if (itStop == end)
+ if (itStop == end) {
break;
+ }
if (stoppingPred(itStop) < 0) {
delete new_curve;
goto error;
@@ -612,10 +643,12 @@ int Operators::sequentialSplit(UnaryPredicate0D &startingPred,
// find next start
do {
++itStart;
- if (itStart == end)
+ if (itStart == end) {
break;
- if (startingPred(itStart) < 0)
+ }
+ if (startingPred(itStart) < 0) {
goto error;
+ }
} while (!startingPred.result);
} while ((itStart != end) && (itStart != last));
}
@@ -639,8 +672,9 @@ int Operators::sequentialSplit(UnaryPredicate0D &startingPred,
#endif
splitted_chains.clear();
- if (!_current_chains_set.empty())
+ if (!_current_chains_set.empty()) {
_current_set = &_current_chains_set;
+ }
return 0;
error:
@@ -681,8 +715,9 @@ static int __recursiveSplit(Chain *_curve,
bool bsplit = false;
for (; ((it != end) && (next != end)); ++it, ++next) {
it0d = it.castToInterface0DIterator();
- if (func(it0d) < 0)
+ if (func(it0d) < 0) {
return -1;
+ }
if (func.result < _min) {
_min = func.result;
split = it;
@@ -734,8 +769,9 @@ static int __recursiveSplit(Chain *_curve,
new_curve_a->push_vertex_back(&(*split));
new_curve_b->push_vertex_back(&(*split));
- for (vit = vnext; vit != vitend; ++vit)
+ for (vit = vnext; vit != vitend; ++vit) {
new_curve_b->push_vertex_back(&(*vit));
+ }
// let's check whether one or two of the two new curves satisfy the stopping condition or not.
// (if one of them satisfies it, we don't split)
@@ -774,11 +810,13 @@ int Operators::recursiveSplit(UnaryFunction0D<double> &func,
I1DContainer::iterator cit = _current_chains_set.begin(), citend = _current_chains_set.end();
for (; cit != citend; ++cit) {
currentChain = dynamic_cast<Chain *>(*cit);
- if (!currentChain)
+ if (!currentChain) {
continue;
+ }
// let's check the first one:
- if (pred(*currentChain) < 0)
+ if (pred(*currentChain) < 0) {
return -1;
+ }
if (!pred.result) {
__recursiveSplit(currentChain, func, pred, sampling, newChains, splitted_chains);
}
@@ -808,8 +846,9 @@ int Operators::recursiveSplit(UnaryFunction0D<double> &func,
#endif
newChains.clear();
- if (!_current_chains_set.empty())
+ if (!_current_chains_set.empty()) {
_current_set = &_current_chains_set;
+ }
return 0;
}
@@ -850,12 +889,15 @@ static int __recursiveSplit(Chain *_curve,
for (; ((it != end) && (next != end)); ++it, ++next) {
++count;
it0d = it.castToInterface0DIterator();
- if (pred0d(it0d) < 0)
+ if (pred0d(it0d) < 0) {
return -1;
- if (!pred0d.result)
+ }
+ if (!pred0d.result) {
continue;
- if (func(it0d) < 0)
+ }
+ if (func(it0d) < 0) {
return -1;
+ }
mean += func.result;
if (func.result < _min) {
_min = func.result;
@@ -910,8 +952,9 @@ static int __recursiveSplit(Chain *_curve,
new_curve_a->push_vertex_back(&(*split));
new_curve_b->push_vertex_back(&(*split));
- for (vit = vnext; vit != vitend; ++vit)
+ for (vit = vnext; vit != vitend; ++vit) {
new_curve_b->push_vertex_back(&(*vit));
+ }
// let's check whether one or two of the two new curves satisfy the stopping condition or not.
// (if one of them satisfies it, we don't split)
@@ -951,11 +994,13 @@ int Operators::recursiveSplit(UnaryFunction0D<double> &func,
I1DContainer::iterator cit = _current_chains_set.begin(), citend = _current_chains_set.end();
for (; cit != citend; ++cit) {
currentChain = dynamic_cast<Chain *>(*cit);
- if (!currentChain)
+ if (!currentChain) {
continue;
+ }
// let's check the first one:
- if (pred(*currentChain) < 0)
+ if (pred(*currentChain) < 0) {
return -1;
+ }
if (!pred.result) {
__recursiveSplit(currentChain, func, pred0d, pred, sampling, newChains, splitted_chains);
}
@@ -985,8 +1030,9 @@ int Operators::recursiveSplit(UnaryFunction0D<double> &func,
#endif
newChains.clear();
- if (!_current_chains_set.empty())
+ if (!_current_chains_set.empty()) {
_current_set = &_current_chains_set;
+ }
return 0;
}
@@ -1000,10 +1046,12 @@ class PredicateWrapper {
inline bool operator()(Interface1D *i1, Interface1D *i2)
{
- if (i1 == i2)
+ if (i1 == i2) {
return false;
- if ((*_pred)(*i1, *i2) < 0)
+ }
+ if ((*_pred)(*i1, *i2) < 0) {
throw std::runtime_error("comparison failed");
+ }
return _pred->result;
}
@@ -1013,8 +1061,9 @@ class PredicateWrapper {
int Operators::sort(BinaryPredicate1D &pred)
{
- if (!_current_set)
+ if (!_current_set) {
return 0;
+ }
PredicateWrapper wrapper(pred);
try {
std::sort(_current_set->begin(), _current_set->end(), wrapper);
@@ -1059,8 +1108,9 @@ static Stroke *createStroke(Interface1D &inter)
current = stroke_vertex->getPoint2D();
Vec2r vec_tmp(current - previous);
real dist = vec_tmp.norm();
- if (dist < 1.0e-6)
+ if (dist < 1.0e-6) {
hasSingularity = true;
+ }
currentCurvilignAbscissa += dist;
stroke_vertex->setCurvilinearAbscissa(currentCurvilignAbscissa);
stroke->push_back(stroke_vertex);
@@ -1073,10 +1123,12 @@ static Stroke *createStroke(Interface1D &inter)
cp = dynamic_cast<CurvePoint *>(&(*it));
if (!cp) {
sv = dynamic_cast<SVertex *>(&(*it));
- if (!sv)
+ if (!sv) {
cerr << "Warning: unexpected Vertex type" << endl;
- else
+ }
+ else {
stroke_vertex = new StrokeVertex(sv);
+ }
}
else {
stroke_vertex = new StrokeVertex(cp);
@@ -1084,8 +1136,9 @@ static Stroke *createStroke(Interface1D &inter)
current = stroke_vertex->getPoint2D();
Vec2r vec_tmp(current - previous);
real dist = vec_tmp.norm();
- if (dist < 1.0e-6)
+ if (dist < 1.0e-6) {
hasSingularity = true;
+ }
currentCurvilignAbscissa += dist;
stroke_vertex->setCurvilinearAbscissa(currentCurvilignAbscissa);
stroke->push_back(stroke_vertex);
@@ -1108,8 +1161,9 @@ static Stroke *createStroke(Interface1D &inter)
next = (*vnext).getPoint();
if ((next - current).norm() < 1.0e-6) {
StrokeInternal::StrokeVertexIterator vprevious = v;
- if (!vprevious.isBegin())
+ if (!vprevious.isBegin()) {
--vprevious;
+ }
// collect a set of overlapping vertices
std::vector<StrokeVertex *> overlapping_vertices;
@@ -1119,8 +1173,9 @@ static Stroke *createStroke(Interface1D &inter)
current = next;
++v;
++vnext;
- if (vnext.isEnd())
+ if (vnext.isEnd()) {
break;
+ }
next = (*vnext).getPoint();
} while ((next - current).norm() < 1.0e-6);
@@ -1167,8 +1222,9 @@ static Stroke *createStroke(Interface1D &inter)
}
}
- if (vnext.isEnd())
+ if (vnext.isEnd()) {
break;
+ }
}
++v;
++vnext;
@@ -1218,10 +1274,12 @@ int Operators::create(UnaryPredicate1D &pred, vector<StrokeShader *> shaders)
StrokesContainer new_strokes_set;
for (Operators::I1DContainer::iterator it = _current_set->begin(); it != _current_set->end();
++it) {
- if (pred(**it) < 0)
+ if (pred(**it) < 0) {
goto error;
- if (!pred.result)
+ }
+ if (!pred.result) {
continue;
+ }
Stroke *stroke = createStroke(**it);
if (stroke) {
@@ -1259,20 +1317,23 @@ void Operators::reset(bool removeStrokes)
}
_current_view_edges_set.clear();
for (I1DContainer::iterator it = _current_chains_set.begin(); it != _current_chains_set.end();
- ++it)
+ ++it) {
delete *it;
+ }
_current_chains_set.clear();
ViewMap::viewedges_container &vedges = vm->ViewEdges();
ViewMap::viewedges_container::iterator ve = vedges.begin(), veend = vedges.end();
for (; ve != veend; ++ve) {
- if ((*ve)->getLength2D() < M_EPSILON)
+ if ((*ve)->getLength2D() < M_EPSILON) {
continue;
+ }
_current_view_edges_set.push_back(*ve);
}
_current_set = &_current_view_edges_set;
- if (removeStrokes)
+ if (removeStrokes) {
_current_strokes_set.clear();
+ }
}
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/stroke/PSStrokeRenderer.cpp b/source/blender/freestyle/intern/stroke/PSStrokeRenderer.cpp
index e7428c795fc..670388f5d52 100644
--- a/source/blender/freestyle/intern/stroke/PSStrokeRenderer.cpp
+++ b/source/blender/freestyle/intern/stroke/PSStrokeRenderer.cpp
@@ -26,8 +26,9 @@ namespace Freestyle {
PSStrokeRenderer::PSStrokeRenderer(const char *iFileName) : StrokeRenderer()
{
- if (!iFileName)
+ if (!iFileName) {
iFileName = "freestyle.ps";
+ }
// open the stream:
_ofstream.open(iFileName, ios::out);
if (!_ofstream.is_open()) {
@@ -91,8 +92,9 @@ void PSStrokeRenderer::RenderStrokeRepBasic(StrokeRep *iStrokeRep) const
void PSStrokeRenderer::Close()
{
- if (_ofstream.is_open())
+ if (_ofstream.is_open()) {
_ofstream.close();
+ }
}
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/stroke/Predicates1D.h b/source/blender/freestyle/intern/stroke/Predicates1D.h
index 3560f29ee36..fe3649111f5 100644
--- a/source/blender/freestyle/intern/stroke/Predicates1D.h
+++ b/source/blender/freestyle/intern/stroke/Predicates1D.h
@@ -206,8 +206,9 @@ class QuantitativeInvisibilityUP1D : public UnaryPredicate1D {
int operator()(Interface1D &inter)
{
Functions1D::QuantitativeInvisibilityF1D func;
- if (func(inter) < 0)
+ if (func(inter) < 0) {
return -1;
+ }
result = (func.result == _qi);
return 0;
}
@@ -234,8 +235,9 @@ class ContourUP1D : public UnaryPredicate1D {
/*! The () operator. */
int operator()(Interface1D &inter)
{
- if (_getNature(inter) < 0)
+ if (_getNature(inter) < 0) {
return -1;
+ }
if ((_getNature.result & Nature::SILHOUETTE) || (_getNature.result & Nature::BORDER)) {
Interface0DIterator it = inter.verticesBegin();
for (; !it.isEnd(); ++it) {
@@ -268,8 +270,9 @@ class ExternalContourUP1D : public UnaryPredicate1D {
/*! The () operator. */
int operator()(Interface1D &inter)
{
- if (_getNature(inter) < 0)
+ if (_getNature(inter) < 0) {
return -1;
+ }
if ((_getNature.result & Nature::SILHOUETTE) || (_getNature.result & Nature::BORDER)) {
set<ViewShape *> occluded;
Functions1D::getOccludeeF1D(inter, occluded);
@@ -561,11 +564,13 @@ class ViewMapGradientNormBP1D : public BinaryPredicate1D {
/*! The () operator. */
int operator()(Interface1D &i1, Interface1D &i2)
{
- if (_func(i1) < 0)
+ if (_func(i1) < 0) {
return -1;
+ }
real n1 = _func.result;
- if (_func(i2) < 0)
+ if (_func(i2) < 0) {
return -1;
+ }
real n2 = _func.result;
result = (n1 > n2);
return 0;
diff --git a/source/blender/freestyle/intern/stroke/Stroke.cpp b/source/blender/freestyle/intern/stroke/Stroke.cpp
index ff0cd64fdaa..13f8080552b 100644
--- a/source/blender/freestyle/intern/stroke/Stroke.cpp
+++ b/source/blender/freestyle/intern/stroke/Stroke.cpp
@@ -43,8 +43,9 @@ StrokeAttribute::StrokeAttribute()
_alpha = 1.0f;
_thickness[0] = 1.0f;
_thickness[1] = 1.0f;
- for (i = 0; i < 3; ++i)
+ for (i = 0; i < 3; ++i) {
_color[i] = 0.2f;
+ }
_color[0] = 0.8f;
_userAttributesReal = NULL;
_userAttributesVec2f = NULL;
@@ -57,21 +58,28 @@ StrokeAttribute::StrokeAttribute(const StrokeAttribute &iBrother)
_alpha = iBrother._alpha;
_thickness[0] = iBrother._thickness[0];
_thickness[1] = iBrother._thickness[1];
- for (int i = 0; i < 3; ++i)
+ for (int i = 0; i < 3; ++i) {
_color[i] = iBrother._color[i];
+ }
_visible = iBrother._visible;
- if (iBrother._userAttributesReal)
+ if (iBrother._userAttributesReal) {
_userAttributesReal = new realMap(*iBrother._userAttributesReal);
- else
+ }
+ else {
_userAttributesReal = NULL;
- if (iBrother._userAttributesVec2f)
+ }
+ if (iBrother._userAttributesVec2f) {
_userAttributesVec2f = new Vec2fMap(*iBrother._userAttributesVec2f);
- else
+ }
+ else {
_userAttributesVec2f = NULL;
- if (iBrother._userAttributesVec3f)
+ }
+ if (iBrother._userAttributesVec3f) {
_userAttributesVec3f = new Vec3fMap(*iBrother._userAttributesVec3f);
- else
+ }
+ else {
_userAttributesVec3f = NULL;
+ }
}
StrokeAttribute::StrokeAttribute(float iRColor,
@@ -102,8 +110,9 @@ StrokeAttribute::StrokeAttribute(const StrokeAttribute &a1, const StrokeAttribut
_alpha = (1 - t) * a1._alpha + t * a2._alpha;
_thickness[0] = (1 - t) * a1._thickness[0] + t * a2._thickness[0];
_thickness[1] = (1 - t) * a1._thickness[1] + t * a2._thickness[1];
- for (int i = 0; i < 3; ++i)
+ for (int i = 0; i < 3; ++i) {
_color[i] = (1 - t) * a1._color[i] + t * a2._color[i];
+ }
_visible = a1.isVisible();
@@ -174,28 +183,32 @@ StrokeAttribute &StrokeAttribute::operator=(const StrokeAttribute &iBrother)
_alpha = iBrother._alpha;
_thickness[0] = iBrother._thickness[0];
_thickness[1] = iBrother._thickness[1];
- for (i = 0; i < 3; ++i)
+ for (i = 0; i < 3; ++i) {
_color[i] = iBrother._color[i];
+ }
_visible = iBrother._visible;
if (iBrother._userAttributesReal) {
- if (!_userAttributesReal)
+ if (!_userAttributesReal) {
_userAttributesReal = new realMap;
+ }
_userAttributesReal = new realMap(*(iBrother._userAttributesReal));
}
else {
_userAttributesReal = NULL;
}
if (iBrother._userAttributesVec2f) {
- if (!_userAttributesVec2f)
+ if (!_userAttributesVec2f) {
_userAttributesVec2f = new Vec2fMap;
+ }
_userAttributesVec2f = new Vec2fMap(*(iBrother._userAttributesVec2f));
}
else {
_userAttributesVec2f = NULL;
}
if (iBrother._userAttributesVec3f) {
- if (!_userAttributesVec3f)
+ if (!_userAttributesVec3f) {
_userAttributesVec3f = new Vec3fMap;
+ }
_userAttributesVec3f = new Vec3fMap(*(iBrother._userAttributesVec3f));
}
else {
@@ -299,22 +312,25 @@ bool StrokeAttribute::isAttributeAvailableVec3f(const char *iName) const
void StrokeAttribute::setAttributeReal(const char *iName, float att)
{
- if (!_userAttributesReal)
+ if (!_userAttributesReal) {
_userAttributesReal = new realMap;
+ }
(*_userAttributesReal)[iName] = att;
}
void StrokeAttribute::setAttributeVec2f(const char *iName, const Vec2f &att)
{
- if (!_userAttributesVec2f)
+ if (!_userAttributesVec2f) {
_userAttributesVec2f = new Vec2fMap;
+ }
(*_userAttributesVec2f)[iName] = att;
}
void StrokeAttribute::setAttributeVec3f(const char *iName, const Vec3f &att)
{
- if (!_userAttributesVec3f)
+ if (!_userAttributesVec3f) {
_userAttributesVec3f = new Vec3fMap;
+ }
(*_userAttributesVec3f)[iName] = att;
}
@@ -427,10 +443,12 @@ Stroke::Stroke(const Stroke &iBrother)
}
_nodeTree = iBrother._nodeTree;
_tips = iBrother._tips;
- if (iBrother._rep)
+ if (iBrother._rep) {
_rep = new StrokeRep(*(iBrother._rep));
- else
+ }
+ else {
_rep = NULL;
+ }
}
Stroke::~Stroke()
@@ -452,8 +470,9 @@ Stroke::~Stroke()
Stroke &Stroke::operator=(const Stroke &iBrother)
{
- if (!_Vertices.empty())
+ if (!_Vertices.empty()) {
_Vertices.clear();
+ }
for (vertex_container::const_iterator v = iBrother._Vertices.begin(),
vend = iBrother._Vertices.end();
@@ -465,12 +484,15 @@ Stroke &Stroke::operator=(const Stroke &iBrother)
_id = iBrother._id;
_ViewEdges = iBrother._ViewEdges;
_sampling = iBrother._sampling;
- if (_rep)
+ if (_rep) {
delete _rep;
- if (iBrother._rep)
+ }
+ if (iBrother._rep) {
_rep = new StrokeRep(*(iBrother._rep));
- else
+ }
+ else {
_rep = NULL;
+ }
return *this;
}
@@ -484,8 +506,9 @@ void Stroke::setLength(float iLength)
float Stroke::ComputeSampling(int iNVertices)
{
- if (iNVertices <= (int)_Vertices.size()) // soc
+ if (iNVertices <= (int)_Vertices.size()) { // soc
return _sampling;
+ }
float sampling = _Length / (float)(iNVertices - _Vertices.size() + 1);
return sampling;
@@ -518,8 +541,9 @@ class StrokeSegment {
int Stroke::Resample(int iNPoints)
{
int NPointsToAdd = iNPoints - strokeVerticesSize();
- if (NPointsToAdd <= 0)
+ if (NPointsToAdd <= 0) {
return 0;
+ }
StrokeInternal::StrokeVertexIterator it = strokeVerticesBegin();
StrokeInternal::StrokeVertexIterator next = it;
@@ -557,23 +581,27 @@ int Stroke::Resample(int iNPoints)
for (vector<StrokeSegment>::iterator s = strokeSegments.begin(), send = strokeSegments.end();
s != send;
++s) {
- if (s->_sampling == 0.0f)
+ if (s->_sampling == 0.0f) {
continue;
+ }
if (s->_resampled == false) {
- if ((!checkEveryone) && (s->_length < meanlength))
+ if ((!checkEveryone) && (s->_length < meanlength)) {
continue;
+ }
// resample
s->_n = s->_n + 1;
s->_sampling = s->_length / (float)(s->_n + 1);
s->_resampled = resampled = true;
N++;
- if (N == NPointsToAdd)
+ if (N == NPointsToAdd) {
break;
+ }
}
}
- if (checkEveryone && !resampled)
+ if (checkEveryone && !resampled) {
break;
+ }
checkEveryone = true;
}
if (N < NPointsToAdd) {
@@ -586,8 +614,9 @@ int Stroke::Resample(int iNPoints)
s != send;
++s) {
newVertices.push_back(&(*(s->_begin)));
- if (s->_sampling < _sampling)
+ if (s->_sampling < _sampling) {
_sampling = s->_sampling;
+ }
t = s->_sampling / s->_length;
for (int i = 0; i < s->_n; ++i) {
@@ -602,12 +631,14 @@ int Stroke::Resample(int iNPoints)
// add last:
++it;
++next;
- if ((it != itend) && (next == itend) /* && (t == 0.0f)*/)
+ if ((it != itend) && (next == itend) /* && (t == 0.0f)*/) {
newVertices.push_back(&(*it));
+ }
int newsize = newVertices.size();
- if (newsize != iNPoints)
+ if (newsize != iNPoints) {
cerr << "Warning: incorrect points number" << endl;
+ }
_Vertices.clear();
_Vertices = newVertices;
@@ -619,10 +650,12 @@ int Stroke::Resample(int iNPoints)
int Stroke::Resample(float iSampling)
{
// cerr << "old size :" << strokeVerticesSize() << endl;
- if (iSampling == 0)
+ if (iSampling == 0) {
return 0;
- if (iSampling >= _sampling)
+ }
+ if (iSampling >= _sampling) {
return 0;
+ }
_sampling = iSampling;
// Resample...
@@ -660,8 +693,9 @@ int Stroke::Resample(float iSampling)
++next;
}
// add last:
- if ((it != itend) && (next == itend) /* && (t == 0.f)*/)
+ if ((it != itend) && (next == itend) /* && (t == 0.f)*/) {
newVertices.push_back(&(*it));
+ }
_Vertices.clear();
_Vertices = newVertices;
@@ -673,8 +707,9 @@ int Stroke::Resample(float iSampling)
void Stroke::RemoveAllVertices()
{
vertex_container::iterator it = _Vertices.begin(), itend = _Vertices.end();
- for (; it != itend; ++it)
+ for (; it != itend; ++it) {
delete (*it);
+ }
_Vertices.clear();
UpdateLength();
}
@@ -734,8 +769,9 @@ Stroke::vertex_iterator Stroke::vertices_end()
StrokeInternal::StrokeVertexIterator Stroke::strokeVerticesBegin(float t)
{
- if ((t != 0) && (t < _sampling))
+ if ((t != 0) && (t < _sampling)) {
Resample(t);
+ }
return StrokeInternal::StrokeVertexIterator(
this->_Vertices.begin(), this->_Vertices.begin(), this->_Vertices.end());
}
@@ -781,23 +817,26 @@ void Stroke::ScaleThickness(float iFactor)
void Stroke::Render(const StrokeRenderer *iRenderer)
{
- if (!_rep)
+ if (!_rep) {
_rep = new StrokeRep(this);
+ }
iRenderer->RenderStrokeRep(_rep);
}
void Stroke::RenderBasic(const StrokeRenderer *iRenderer)
{
- if (!_rep)
+ if (!_rep) {
_rep = new StrokeRep(this);
+ }
iRenderer->RenderStrokeRep(_rep);
}
Stroke::vertex_iterator Stroke::vertices_begin(float sampling)
{
// Resample if necessary
- if ((sampling != 0) && (sampling < _sampling))
+ if ((sampling != 0) && (sampling < _sampling)) {
Resample(sampling);
+ }
return vertex_iterator(_Vertices.begin(), _Vertices.begin(), _Vertices.end());
// return _Vertices.begin();
}
diff --git a/source/blender/freestyle/intern/stroke/StrokeIterators.h b/source/blender/freestyle/intern/stroke/StrokeIterators.h
index 624f2a03877..71932d8487a 100644
--- a/source/blender/freestyle/intern/stroke/StrokeIterators.h
+++ b/source/blender/freestyle/intern/stroke/StrokeIterators.h
@@ -170,8 +170,9 @@ class StrokeVertexIterator : public Interface0DIteratorNested {
/*! Returns true if the pointed StrokeVertex is the final valid StrokeVertex of the Stroke. */
bool atLast()
{
- if (_it == _end)
+ if (_it == _end) {
return false;
+ }
++_it;
bool result = (_it == _end);
@@ -189,8 +190,9 @@ class StrokeVertexIterator : public Interface0DIteratorNested {
virtual bool operator==(const Interface0DIteratorNested &it) const
{
const StrokeVertexIterator *it_exact = dynamic_cast<const StrokeVertexIterator *>(&it);
- if (!it_exact)
+ if (!it_exact) {
return false;
+ }
return (_it == it_exact->_it);
}
diff --git a/source/blender/freestyle/intern/stroke/StrokeLayer.cpp b/source/blender/freestyle/intern/stroke/StrokeLayer.cpp
index f1680279889..c89e7143c89 100644
--- a/source/blender/freestyle/intern/stroke/StrokeLayer.cpp
+++ b/source/blender/freestyle/intern/stroke/StrokeLayer.cpp
@@ -59,8 +59,9 @@ void StrokeLayer::RenderBasic(const StrokeRenderer *iRenderer)
void StrokeLayer::clear()
{
- for (stroke_container::iterator s = _strokes.begin(), send = _strokes.end(); s != send; ++s)
+ for (stroke_container::iterator s = _strokes.begin(), send = _strokes.end(); s != send; ++s) {
delete *s;
+ }
_strokes.clear();
}
diff --git a/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp b/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp
index 530a7644bfa..a76579c7c96 100644
--- a/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp
+++ b/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp
@@ -74,15 +74,17 @@ TextureManager::TextureManager()
TextureManager::~TextureManager()
{
- if (!_brushesMap.empty())
+ if (!_brushesMap.empty()) {
_brushesMap.clear();
+ }
_pInstance = 0;
}
void TextureManager::load()
{
- if (_hasLoadedTextures)
+ if (_hasLoadedTextures) {
return;
+ }
loadStandardBrushes();
_hasLoadedTextures = true;
}
diff --git a/source/blender/freestyle/intern/stroke/StrokeRenderer.h b/source/blender/freestyle/intern/stroke/StrokeRenderer.h
index 79767b48d83..e0eb0351a80 100644
--- a/source/blender/freestyle/intern/stroke/StrokeRenderer.h
+++ b/source/blender/freestyle/intern/stroke/StrokeRenderer.h
@@ -88,10 +88,12 @@ class TextureManager {
bool operator()(const BrushTexture &bt1, const BrushTexture &bt2) const
{
int r = strcmp(bt1.first.c_str(), bt2.first.c_str());
- if (r != 0)
+ if (r != 0) {
return (r < 0);
- else
+ }
+ else {
return (bt1.second < bt2.second);
+ }
}
};
typedef std::map<BrushTexture, unsigned, cmpBrushTexture> brushesMap;
diff --git a/source/blender/freestyle/intern/stroke/StrokeRep.cpp b/source/blender/freestyle/intern/stroke/StrokeRep.cpp
index a6c00f66056..3b309a9d249 100644
--- a/source/blender/freestyle/intern/stroke/StrokeRep.cpp
+++ b/source/blender/freestyle/intern/stroke/StrokeRep.cpp
@@ -142,8 +142,9 @@ void Strip::createStrip(const vector<StrokeVertex *> &iStrokeVertices)
sv2 = *v2;
Vec2r dir(sv2->getPoint() - sv->getPoint());
Vec2r orthDir(-dir[1], dir[0]);
- if (orthDir.norm() > ZERO)
+ if (orthDir.norm() > ZERO) {
orthDir.normalize();
+ }
Vec2r stripDir(orthDir);
// check whether the orientation was user defined
if (sv->attribute().isAttributeAvailableVec2f("orientation")) {
@@ -151,8 +152,9 @@ void Strip::createStrip(const vector<StrokeVertex *> &iStrokeVertices)
if (userDir.norm() > 1e-6) {
userDir.normalize();
real dp = userDir * orthDir;
- if (dp < 0)
+ if (dp < 0) {
userDir = userDir * (-1.0f);
+ }
stripDir = userDir;
}
else {
@@ -206,8 +208,9 @@ void Strip::createStrip(const vector<StrokeVertex *> &iStrokeVertices)
if (userDir.norm() > 1e-6) {
userDir.normalize();
real dp = userDir * orthDir;
- if (dp < 0)
+ if (dp < 0) {
userDir = userDir * (-1.0f);
+ }
stripDir = userDir;
}
else {
@@ -226,8 +229,9 @@ void Strip::createStrip(const vector<StrokeVertex *> &iStrokeVertices)
if (userDir.norm() > 1e-6) {
userDir.normalize();
real dp = userDir * orthDir;
- if (dp < 0)
+ if (dp < 0) {
userDir = userDir * (-1.0f);
+ }
stripDirPrev = userDir;
}
else {
@@ -245,10 +249,12 @@ void Strip::createStrip(const vector<StrokeVertex *> &iStrokeVertices)
Vec2r(p + thickness[1] * stripDir),
Vec2r(p2 + thickness[1] * stripDir),
pInter);
- if (interResult == GeomUtils::DO_INTERSECT)
+ if (interResult == GeomUtils::DO_INTERSECT) {
_vertices.push_back(new StrokeVertexRep(pInter));
- else
+ }
+ else {
_vertices.push_back(new StrokeVertexRep(p + thickness[1] * stripDir));
+ }
++i;
interResult = GeomUtils::intersect2dLine2dLine(Vec2r(pPrev - thickness[0] * stripDirPrev),
@@ -256,10 +262,12 @@ void Strip::createStrip(const vector<StrokeVertex *> &iStrokeVertices)
Vec2r(p - thickness[0] * stripDir),
Vec2r(p2 - thickness[0] * stripDir),
pInter);
- if (interResult == GeomUtils::DO_INTERSECT)
+ if (interResult == GeomUtils::DO_INTERSECT) {
_vertices.push_back(new StrokeVertexRep(pInter));
- else
+ }
+ else {
_vertices.push_back(new StrokeVertexRep(p - thickness[0] * stripDir));
+ }
++i;
// if the angle is obtuse, we simply average the directions to avoid the singularity
@@ -292,8 +300,9 @@ void Strip::createStrip(const vector<StrokeVertex *> &iStrokeVertices)
sv2 = *vPrev;
dir = Vec2r(sv->getPoint() - sv2->getPoint());
orthDir = Vec2r(-dir[1], dir[0]);
- if (orthDir.norm() > ZERO)
+ if (orthDir.norm() > ZERO) {
orthDir.normalize();
+ }
Vec2r stripDirLast(orthDir);
// check whether the orientation was user defined
if (sv->attribute().isAttributeAvailableVec2f("orientation")) {
@@ -301,8 +310,9 @@ void Strip::createStrip(const vector<StrokeVertex *> &iStrokeVertices)
if (userDir.norm() > 1e-6) {
userDir.normalize();
real dp = userDir * orthDir;
- if (dp < 0)
+ if (dp < 0) {
userDir = userDir * (-1.0f);
+ }
stripDirLast = userDir;
}
else {
@@ -343,8 +353,9 @@ void Strip::createStrip(const vector<StrokeVertex *> &iStrokeVertices)
_averageThickness /= float(iStrokeVertices.size() - 2);
// I did not use the first and last vertex for the average
- if (iStrokeVertices.size() < 3)
+ if (iStrokeVertices.size() < 3) {
_averageThickness = 0.5 * (thicknessLast[1] + thicknessLast[0] + thickness[0] + thickness[1]);
+ }
if (orientationErrors > 0) {
if (G.debug & G_DEBUG_FREESTYLE) {
@@ -380,8 +391,9 @@ void Strip::cleanUpSingularities(const vector<StrokeVertex *> &iStrokeVertices)
}
// return;
- if (iStrokeVertices.size() < 2)
+ if (iStrokeVertices.size() < 2) {
return;
+ }
int i = 0, j;
vector<StrokeVertex *>::const_iterator v, vend, v2;
StrokeVertex *sv, *sv2;
@@ -394,15 +406,17 @@ void Strip::cleanUpSingularities(const vector<StrokeVertex *> &iStrokeVertices)
for (vend = iStrokeVertices.end(); v != vend; v++) {
v2 = v;
++v2;
- if (v2 == vend)
+ if (v2 == vend) {
break;
+ }
sv = (*v);
sv2 = (*v2);
Vec2r p(sv->getPoint()), p2(sv2->getPoint());
Vec2r dir(p2 - p);
- if (dir.norm() > ZERO)
+ if (dir.norm() > ZERO) {
dir.normalize();
+ }
Vec2r dir1, dir2;
dir1 = _vertices[2 * i + 2]->point2d() - _vertices[2 * i]->point2d();
dir2 = _vertices[2 * i + 3]->point2d() - _vertices[2 * i + 1]->point2d();
@@ -414,15 +428,18 @@ void Strip::cleanUpSingularities(const vector<StrokeVertex *> &iStrokeVertices)
else {
if (singu1) {
int toto = i - timeSinceSingu1;
- if (toto < 0)
+ if (toto < 0) {
cerr << "Stephane dit \"Toto\"" << endl;
+ }
// traverse all the vertices of the singularity and average them
Vec2r avP(0.0, 0.0);
- for (j = i - timeSinceSingu1; j <= i; j++)
+ for (j = i - timeSinceSingu1; j <= i; j++) {
avP = Vec2r(avP + _vertices[2 * j]->point2d());
+ }
avP = Vec2r(1.0 / float(timeSinceSingu1 + 1) * avP);
- for (j = i - timeSinceSingu1; j <= i; j++)
+ for (j = i - timeSinceSingu1; j <= i; j++) {
_vertices[2 * j]->setPoint2d(avP);
+ }
//_vertex[2 * j] = _vertex[2 * i];
singu1 = false;
timeSinceSingu1 = 0;
@@ -435,15 +452,18 @@ void Strip::cleanUpSingularities(const vector<StrokeVertex *> &iStrokeVertices)
else {
if (singu2) {
int toto = i - timeSinceSingu2;
- if (toto < 0)
+ if (toto < 0) {
cerr << "Stephane dit \"Toto\"" << endl;
+ }
// traverse all the vertices of the singularity and average them
Vec2r avP(0.0, 0.0);
- for (j = i - timeSinceSingu2; j <= i; j++)
+ for (j = i - timeSinceSingu2; j <= i; j++) {
avP = Vec2r(avP + _vertices[2 * j + 1]->point2d());
+ }
avP = Vec2r(1.0 / float(timeSinceSingu2 + 1) * avP);
- for (j = i - timeSinceSingu2; j <= i; j++)
+ for (j = i - timeSinceSingu2; j <= i; j++) {
_vertices[2 * j + 1]->setPoint2d(avP);
+ }
//_vertex[2 * j + 1] = _vertex[2 * i + 1];
singu2 = false;
timeSinceSingu2 = 0;
@@ -455,20 +475,24 @@ void Strip::cleanUpSingularities(const vector<StrokeVertex *> &iStrokeVertices)
if (singu1) {
// traverse all the vertices of the singularity and average them
Vec2r avP(0.0, 0.0);
- for (j = i - timeSinceSingu1; j < i; j++)
+ for (j = i - timeSinceSingu1; j < i; j++) {
avP = Vec2r(avP + _vertices[2 * j]->point2d());
+ }
avP = Vec2r(1.0 / float(timeSinceSingu1) * avP);
- for (j = i - timeSinceSingu1; j < i; j++)
+ for (j = i - timeSinceSingu1; j < i; j++) {
_vertices[2 * j]->setPoint2d(avP);
+ }
}
if (singu2) {
// traverse all the vertices of the singularity and average them
Vec2r avP(0.0, 0.0);
- for (j = i - timeSinceSingu2; j < i; j++)
+ for (j = i - timeSinceSingu2; j < i; j++) {
avP = Vec2r(avP + _vertices[2 * j + 1]->point2d());
+ }
avP = Vec2r(1.0 / float(timeSinceSingu2) * avP);
- for (j = i - timeSinceSingu2; j < i; j++)
+ for (j = i - timeSinceSingu2; j < i; j++) {
_vertices[2 * j + 1]->setPoint2d(avP);
+ }
}
for (k = 0; k < sizeStrip; k++) {
@@ -556,8 +580,9 @@ void Strip::computeTexCoordWithTips(const vector<StrokeVertex *> &iStrokeVertice
sv = (*v);
svRep = *currentSV;
u = sv->curvilinearAbscissa() / spacedThickness * fact;
- if (u > 0.25)
+ if (u > 0.25) {
break;
+ }
svRep->setTexCoord(Vec2r((real)u, -0.5), true);
i++;
@@ -572,10 +597,12 @@ void Strip::computeTexCoordWithTips(const vector<StrokeVertex *> &iStrokeVertice
if (v != vend && i >= 2) {
// first transition vertex
- if (fabs(u - uPrev) > ZERO)
+ if (fabs(u - uPrev) > ZERO) {
t = (0.25 - uPrev) / (u - uPrev);
- else
+ }
+ else {
t = 0;
+ }
for (int k = 0; k < 2; k++) {
tvRep[k] = new StrokeVertexRep((1 - t) * _vertices[i - 2]->point2d() +
t * _vertices[i]->point2d());
@@ -613,8 +640,9 @@ void Strip::computeTexCoordWithTips(const vector<StrokeVertex *> &iStrokeVertice
sv = (*v);
svRep = *currentSV;
u = sv->curvilinearAbscissa() / spacedThickness * fact - 0.25;
- if (u > tiles)
+ if (u > tiles) {
break;
+ }
svRep->setTexCoord(Vec2r((real)u, 0), true);
i++;
@@ -631,10 +659,12 @@ void Strip::computeTexCoordWithTips(const vector<StrokeVertex *> &iStrokeVertice
if (tipEnd) {
if (v != vend && i >= 2) {
// second transition vertex
- if (fabs(u - uPrev) > ZERO)
+ if (fabs(u - uPrev) > ZERO) {
t = (float(tiles) - uPrev) / (u - uPrev);
- else
+ }
+ else {
t = 0;
+ }
for (int k = 0; k < 2; k++) {
tvRep[k] = new StrokeVertexRep((1 - t) * _vertices[i - 2]->point2d() +
t * _vertices[i]->point2d());
@@ -715,8 +745,9 @@ StrokeRep::StrokeRep()
_mtex[a] = NULL;
}
TextureManager *ptm = TextureManager::getInstance();
- if (ptm)
+ if (ptm) {
_textureId = ptm->getDefaultTextureId();
+ }
#if 0
_averageTextureAlpha = 0.5; //default value
if (_strokeType == OIL_STROKE)
@@ -744,8 +775,9 @@ StrokeRep::StrokeRep(Stroke *iStroke)
}
if (_textureId == 0) {
TextureManager *ptm = TextureManager::getInstance();
- if (ptm)
+ if (ptm) {
_textureId = ptm->getDefaultTextureId();
+ }
}
#if 0
diff --git a/source/blender/freestyle/intern/stroke/StrokeRep.h b/source/blender/freestyle/intern/stroke/StrokeRep.h
index a6d5c20624e..b2bfb805ee6 100644
--- a/source/blender/freestyle/intern/stroke/StrokeRep.h
+++ b/source/blender/freestyle/intern/stroke/StrokeRep.h
@@ -85,8 +85,9 @@ class StrokeVertexRep {
if (tips) {
return _texCoord_w_tips;
}
- else
+ else {
return _texCoord;
+ }
}
inline Vec3r &color()
diff --git a/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp b/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp
index 8d2e554a67b..d4d184e2ce1 100644
--- a/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp
+++ b/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp
@@ -30,8 +30,9 @@ namespace Freestyle {
LineRep *StrokeTesselator::Tesselate(Stroke *iStroke)
{
- if (0 == iStroke)
+ if (0 == iStroke) {
return 0;
+ }
LineRep *line;
line = new OrientedLineRep();
@@ -49,8 +50,9 @@ LineRep *StrokeTesselator::Tesselate(Stroke *iStroke)
line->AddVertex(B);
}
else {
- if (_overloadFrsMaterial)
+ if (_overloadFrsMaterial) {
line->setFrsMaterial(_FrsMaterial);
+ }
line->setStyle(LineRep::LINE_STRIP);
diff --git a/source/blender/freestyle/intern/stroke/StyleModule.h b/source/blender/freestyle/intern/stroke/StyleModule.h
index 64095e971d6..6f03d903045 100644
--- a/source/blender/freestyle/intern/stroke/StyleModule.h
+++ b/source/blender/freestyle/intern/stroke/StyleModule.h
@@ -85,8 +85,9 @@ class StyleModule {
StrokeLayer *sl = new StrokeLayer;
for (Operators::StrokesContainer::iterator it = strokes_set->begin(); it != strokes_set->end();
- ++it)
+ ++it) {
sl->AddStroke(*it);
+ }
Operators::reset();
return sl;
@@ -153,8 +154,9 @@ class StyleModule {
void setModified(bool b = true)
{
- if (_always_refresh)
+ if (_always_refresh) {
return;
+ }
_modified = b;
}
diff --git a/source/blender/freestyle/intern/stroke/TextStrokeRenderer.cpp b/source/blender/freestyle/intern/stroke/TextStrokeRenderer.cpp
index dc65871ef38..f579bd72038 100644
--- a/source/blender/freestyle/intern/stroke/TextStrokeRenderer.cpp
+++ b/source/blender/freestyle/intern/stroke/TextStrokeRenderer.cpp
@@ -22,8 +22,9 @@ namespace Freestyle {
TextStrokeRenderer::TextStrokeRenderer(const char *iFileName) : StrokeRenderer()
{
- if (!iFileName)
+ if (!iFileName) {
iFileName = "freestyle.txt";
+ }
// open the stream:
_ofstream.open(iFileName, ios::out);
if (!_ofstream.is_open()) {
@@ -69,8 +70,9 @@ void TextStrokeRenderer::RenderStrokeRepBasic(StrokeRep *iStrokeRep) const
void TextStrokeRenderer::Close()
{
- if (_ofstream.is_open())
+ if (_ofstream.is_open()) {
_ofstream.close();
+ }
}
} /* namespace Freestyle */
diff --git a/source/blender/freestyle/intern/system/BaseObject.h b/source/blender/freestyle/intern/system/BaseObject.h
index d64c47b2445..335221223dc 100644
--- a/source/blender/freestyle/intern/system/BaseObject.h
+++ b/source/blender/freestyle/intern/system/BaseObject.h
@@ -57,8 +57,9 @@ class BaseObject {
/*! Decrements the reference counter */
inline int release()
{
- if (_ref_counter)
+ if (_ref_counter) {
_ref_counter--;
+ }
return _ref_counter;
}
diff --git a/source/blender/freestyle/intern/system/PseudoNoise.cpp b/source/blender/freestyle/intern/system/PseudoNoise.cpp
index 877cdee0814..048be5d018c 100644
--- a/source/blender/freestyle/intern/system/PseudoNoise.cpp
+++ b/source/blender/freestyle/intern/system/PseudoNoise.cpp
@@ -49,8 +49,9 @@ PseudoNoise::PseudoNoise()
void PseudoNoise::init(long seed)
{
RandGen::srand48(seed);
- for (unsigned int i = 0; i < NB_VALUE_NOISE; i++)
+ for (unsigned int i = 0; i < NB_VALUE_NOISE; i++) {
_values[i] = -1.0 + 2.0 * RandGen::drand48();
+ }
}
real PseudoNoise::linearNoise(real x)
@@ -64,10 +65,12 @@ real PseudoNoise::linearNoise(real x)
static real LanczosWindowed(real t)
{
- if (fabs(t) > 2)
+ if (fabs(t) > 2) {
return 0;
- if (fabs(t) < M_EPSILON)
+ }
+ if (fabs(t) < M_EPSILON) {
return 1.0;
+ }
return sin(M_PI * t) / (M_PI * t) * sin(M_PI * t / 2.0) / (M_PI * t / 2.0);
}
diff --git a/source/blender/freestyle/intern/system/StringUtils.cpp b/source/blender/freestyle/intern/system/StringUtils.cpp
index 99ec9aed632..5e56dba17bf 100644
--- a/source/blender/freestyle/intern/system/StringUtils.cpp
+++ b/source/blender/freestyle/intern/system/StringUtils.cpp
@@ -39,8 +39,9 @@ void getPathName(const string &path, const string &base, vector<string> &pathnam
for (unsigned int pos = 0, sep = path.find(Config::PATH_SEP, pos); pos < size;
pos = sep + 1, sep = path.find(Config::PATH_SEP, pos)) {
- if (sep == (unsigned)string::npos)
+ if (sep == (unsigned)string::npos) {
sep = size;
+ }
dir = path.substr(pos, sep - pos);
@@ -48,8 +49,9 @@ void getPathName(const string &path, const string &base, vector<string> &pathnam
BLI_cleanup_file(NULL, cleaned);
res = string(cleaned);
- if (!base.empty())
+ if (!base.empty()) {
res += Config::DIR_SEP + base;
+ }
pathnames.push_back(res);
}
diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
index 6c144807e35..faa219beb9c 100644
--- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
+++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
@@ -48,8 +48,9 @@ void FEdgeXDetector::processShapes(WingedEdge &we)
}
for (vector<WShape *>::const_iterator it = wshapes.begin(); it != wshapes.end(); it++) {
- if (_pRenderMonitor && _pRenderMonitor->testBreak())
+ if (_pRenderMonitor && _pRenderMonitor->testBreak()) {
break;
+ }
wxs = dynamic_cast<WXShape *>(*it);
#if 0
wxs->bbox(Min, Max);
@@ -72,29 +73,36 @@ void FEdgeXDetector::processShapes(WingedEdge &we)
_computeViewIndependent = true;
}
preProcessShape(wxs);
- if (progressBarDisplay)
+ if (progressBarDisplay) {
_pProgressBar->setProgress(_pProgressBar->getProgress() + 1);
+ }
processBorderShape(wxs);
- if (_computeMaterialBoundaries)
+ if (_computeMaterialBoundaries) {
processMaterialBoundaryShape(wxs);
+ }
processCreaseShape(wxs);
- if (_computeRidgesAndValleys)
+ if (_computeRidgesAndValleys) {
processRidgesAndValleysShape(wxs);
- if (_computeSuggestiveContours)
+ }
+ if (_computeSuggestiveContours) {
processSuggestiveContourShape(wxs);
+ }
processSilhouetteShape(wxs);
processEdgeMarksShape(wxs);
- if (progressBarDisplay)
+ if (progressBarDisplay) {
_pProgressBar->setProgress(_pProgressBar->getProgress() + 1);
+ }
// build smooth edges:
buildSmoothEdges(wxs);
// Post processing for suggestive contours
- if (_computeSuggestiveContours)
+ if (_computeSuggestiveContours) {
postProcessSuggestiveContourShape(wxs);
- if (progressBarDisplay)
+ }
+ if (progressBarDisplay) {
_pProgressBar->setProgress(_pProgressBar->getProgress() + 1);
+ }
wxs->setComputeViewIndependentFlag(false);
_computeViewIndependent = false;
@@ -211,15 +219,18 @@ void FEdgeXDetector::computeCurvatures(WXVertex *vertex)
real absK1 = fabs(C->K1);
_meanK1 += absK1;
- if (absK1 > _maxK1)
+ if (absK1 > _maxK1) {
_maxK1 = absK1;
- if (absK1 < _minK1)
+ }
+ if (absK1 < _minK1) {
_minK1 = absK1;
+ }
}
// view dependant
C = vertex->curvatures();
- if (C == 0)
+ if (C == 0) {
return;
+ }
// compute radial curvature :
n = C->e1 ^ C->e2;
@@ -239,10 +250,12 @@ void FEdgeXDetector::computeCurvatures(WXVertex *vertex)
C->Kr = C->K1 * cos2theta + C->K2 * sin2theta;
real absKr = fabs(C->Kr);
_meanKr += absKr;
- if (absKr > _maxKr)
+ if (absKr > _maxKr) {
_maxKr = absKr;
- if (absKr < _minKr)
+ }
+ if (absKr < _minKr) {
_minKr = absKr;
+ }
++_nPoints;
}
@@ -311,8 +324,9 @@ void FEdgeXDetector::ProcessSilhouetteFace(WXFace *iFace)
void FEdgeXDetector::ProcessSilhouetteEdge(WXEdge *iEdge)
{
- if (iEdge->nature() & Nature::BORDER)
+ if (iEdge->nature() & Nature::BORDER) {
return;
+ }
// SILHOUETTE ?
//-------------
WXFace *fA = (WXFace *)iEdge->GetaOEdge()->GetaFace();
@@ -324,13 +338,16 @@ void FEdgeXDetector::ProcessSilhouetteEdge(WXEdge *iEdge)
// normals for 1 vertex for these two faces
//--------------------
// In reality we only test the normals for 1 of the 2 vertices.
- if (fA->GetVertexNormal(iEdge->GetaVertex()) == fB->GetVertexNormal(iEdge->GetaVertex()))
+ if (fA->GetVertexNormal(iEdge->GetaVertex()) == fB->GetVertexNormal(iEdge->GetaVertex())) {
return;
+ }
iEdge->AddNature(Nature::SILHOUETTE);
- if (fB->front())
+ if (fB->front()) {
iEdge->setOrder(1);
- else
+ }
+ else {
iEdge->setOrder(-1);
+ }
}
}
@@ -338,8 +355,9 @@ void FEdgeXDetector::ProcessSilhouetteEdge(WXEdge *iEdge)
/////////
void FEdgeXDetector::processBorderShape(WXShape *iWShape)
{
- if (!_computeViewIndependent)
+ if (!_computeViewIndependent) {
return;
+ }
// Make a pass on the edges to detect the BORDER
vector<WEdge *>::iterator we, weend;
vector<WEdge *> &wedges = iWShape->getEdgeList();
@@ -362,8 +380,9 @@ void FEdgeXDetector::ProcessBorderEdge(WXEdge *iEdge)
/////////
void FEdgeXDetector::processCreaseShape(WXShape *iWShape)
{
- if (!_computeViewIndependent)
+ if (!_computeViewIndependent) {
return;
+ }
// Make a pass on the edges to detect the CREASE
vector<WEdge *>::iterator we, weend;
@@ -377,14 +396,16 @@ void FEdgeXDetector::ProcessCreaseEdge(WXEdge *iEdge)
{
// CREASE ?
//---------
- if (iEdge->nature() & Nature::BORDER)
+ if (iEdge->nature() & Nature::BORDER) {
return;
+ }
WXFace *fA = (WXFace *)iEdge->GetaOEdge()->GetaFace();
WXFace *fB = (WXFace *)iEdge->GetaOEdge()->GetbFace();
WVertex *aVertex = iEdge->GetaVertex();
- if ((fA->GetVertexNormal(aVertex) * fB->GetVertexNormal(aVertex)) <= _creaseAngle)
+ if ((fA->GetVertexNormal(aVertex) * fB->GetVertexNormal(aVertex)) <= _creaseAngle) {
iEdge->AddNature(Nature::CREASE);
+ }
}
// RIDGES AND VALLEYS
@@ -394,8 +415,9 @@ void FEdgeXDetector::processRidgesAndValleysShape(WXShape *iWShape)
// Don't forget to add the built layer to the face at the end of the ProcessFace:
// iFace->AddSmoothLayer(faceLayer);
- if (!_computeViewIndependent)
+ if (!_computeViewIndependent) {
return;
+ }
// Here the curvatures must already have been computed
vector<WFace *> &wfaces = iWShape->GetFaceList();
@@ -595,8 +617,9 @@ void FEdgeXDetector::postProcessSuggestiveContourFace(WXFace *iFace)
// Find the suggestive contour layer of the face (zero or one edge).
vector<WXFaceLayer *> sc_layers;
iFace->retrieveSmoothEdgesLayers(Nature::SUGGESTIVE_CONTOUR, sc_layers);
- if (sc_layers.empty())
+ if (sc_layers.empty()) {
return;
+ }
WXFaceLayer *sc_layer;
sc_layer = sc_layers[0];
@@ -628,8 +651,9 @@ void FEdgeXDetector::postProcessSuggestiveContourFace(WXFace *iFace)
for (WVertex::face_iterator fit = v->faces_begin(), fitend = v->faces_end(); fit != fitend;
++fit) {
wxf = dynamic_cast<WXFace *>(*fit);
- if (!wxf->getOppositeEdge(v, opposite_edge))
+ if (!wxf->getOppositeEdge(v, opposite_edge)) {
continue;
+ }
opposite_vertex_a = (WXVertex *)opposite_edge->GetaVertex();
opposite_vertex_b = (WXVertex *)opposite_edge->GetbVertex();
@@ -695,8 +719,9 @@ void FEdgeXDetector::postProcessSuggestiveContourFace(WXFace *iFace)
////////////////////
void FEdgeXDetector::processMaterialBoundaryShape(WXShape *iWShape)
{
- if (!_computeViewIndependent)
+ if (!_computeViewIndependent) {
return;
+ }
// Make a pass on the edges to detect material boundaries
vector<WEdge *>::iterator we, weend;
vector<WEdge *> &wedges = iWShape->getEdgeList();
@@ -748,8 +773,9 @@ void FEdgeXDetector::buildSmoothEdges(WXShape *iShape)
for (vector<WXFaceLayer *>::iterator wxfl = faceLayers.begin(), wxflend = faceLayers.end();
wxfl != wxflend;
++wxfl) {
- if ((*wxfl)->BuildSmoothEdge())
+ if ((*wxfl)->BuildSmoothEdge()) {
hasSmoothEdges = true;
+ }
}
}
diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.h b/source/blender/freestyle/intern/view_map/FEdgeXDetector.h
index 9df0b4bb4bd..2bcf2d3bee8 100644
--- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.h
+++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.h
@@ -96,10 +96,12 @@ class FEdgeXDetector {
// XXX angle should be in radian...
inline void setCreaseAngle(float angle)
{
- if (angle < 0.0)
+ if (angle < 0.0) {
angle = 0.0;
- else if (angle > 180.0)
+ }
+ else if (angle > 180.0) {
angle = 180.0;
+ }
angle = cos(M_PI * (180.0 - angle) / 180.0);
if (angle != _creaseAngle) {
_creaseAngle = angle;
diff --git a/source/blender/freestyle/intern/view_map/Functions0D.cpp b/source/blender/freestyle/intern/view_map/Functions0D.cpp
index 2a9a654981a..892b9b33b4b 100644
--- a/source/blender/freestyle/intern/view_map/Functions0D.cpp
+++ b/source/blender/freestyle/intern/view_map/Functions0D.cpp
@@ -64,14 +64,17 @@ void getFEdges(Interface0DIterator &it, FEdge *&fe1, FEdge *&fe2)
// we have more than 2 vertices
bool begin = false, last = false;
Interface0DIterator previous = it;
- if (!previous.isBegin())
+ if (!previous.isBegin()) {
--previous;
- else
+ }
+ else {
begin = true;
+ }
Interface0DIterator next = it;
++next;
- if (next.isEnd())
+ if (next.isEnd()) {
last = true;
+ }
if (begin) {
fe1 = it->getFEdge(*next);
fe2 = NULL;
@@ -94,8 +97,9 @@ void getViewEdges(Interface0DIterator &it, ViewEdge *&ve1, ViewEdge *&ve2)
ve1 = fe1->viewedge();
if (fe2 != NULL) {
ve2 = fe2->viewedge();
- if (ve2 == ve1)
+ if (ve2 == ve1) {
ve2 = NULL;
+ }
}
else {
ve2 = NULL;
@@ -116,14 +120,16 @@ void getOccludersF0D(Interface0DIterator &it, set<ViewShape *> &oOccluders)
occluder_container::const_iterator oit = ve1->occluders_begin();
occluder_container::const_iterator oitend = ve1->occluders_end();
- for (; oit != oitend; ++oit)
+ for (; oit != oitend; ++oit) {
oOccluders.insert((*oit));
+ }
if (ve2 != NULL) {
oit = ve2->occluders_begin();
oitend = ve2->occluders_end();
- for (; oit != oitend; ++oit)
+ for (; oit != oitend; ++oit) {
oOccluders.insert((*oit));
+ }
}
}
@@ -150,20 +156,25 @@ int VertexOrientation2DF0D::operator()(Interface0DIterator &iter)
}
Interface0DIterator next = iter;
++next;
- if (next.isEnd())
+ if (next.isEnd()) {
C = Vec2f(iter->getProjectedX(), iter->getProjectedY());
- else
+ }
+ else {
C = Vec2f(next->getProjectedX(), next->getProjectedY());
+ }
Vec2f AB(B - A);
- if (AB.norm() != 0)
+ if (AB.norm() != 0) {
AB.normalize();
+ }
Vec2f BC(C - B);
- if (BC.norm() != 0)
+ if (BC.norm() != 0) {
BC.normalize();
+ }
result = AB + BC;
- if (result.norm() != 0)
+ if (result.norm() != 0) {
result.normalize();
+ }
return 0;
}
@@ -181,20 +192,25 @@ int VertexOrientation3DF0D::operator()(Interface0DIterator &iter)
}
Interface0DIterator next = iter;
++next;
- if (next.isEnd())
+ if (next.isEnd()) {
C = Vec3r(iter->getX(), iter->getY(), iter->getZ());
- else
+ }
+ else {
C = Vec3r(next->getX(), next->getY(), next->getZ());
+ }
Vec3r AB(B - A);
- if (AB.norm() != 0)
+ if (AB.norm() != 0) {
AB.normalize();
+ }
Vec3r BC(C - B);
- if (BC.norm() != 0)
+ if (BC.norm() != 0) {
BC.normalize();
+ }
result = AB + BC;
- if (result.norm() != 0)
+ if (result.norm() != 0) {
result.normalize();
+ }
return 0;
}
@@ -218,8 +234,9 @@ int Curvature2DAngleF0D::operator()(Interface0DIterator &iter)
}
Interface0DIterator v = iter;
- if (iter.isBegin())
+ if (iter.isBegin()) {
++v;
+ }
Interface0DIterator next = v;
++next;
if (next.isEnd()) {
@@ -235,21 +252,25 @@ int Curvature2DAngleF0D::operator()(Interface0DIterator &iter)
Vec2r AB(B - A);
Vec2r BC(C - B);
Vec2r N1(-AB[1], AB[0]);
- if (N1.norm() != 0)
+ if (N1.norm() != 0) {
N1.normalize();
+ }
Vec2r N2(-BC[1], BC[0]);
- if (N2.norm() != 0)
+ if (N2.norm() != 0) {
N2.normalize();
+ }
if ((N1.norm() == 0) && (N2.norm() == 0)) {
Exception::raiseException();
result = 0;
return -1;
}
double cosin = N1 * N2;
- if (cosin > 1)
+ if (cosin > 1) {
cosin = 1;
- if (cosin < -1)
+ }
+ if (cosin < -1) {
cosin = -1;
+ }
result = acos(cosin);
return 0;
}
@@ -287,12 +308,15 @@ int MaterialF0D::operator()(Interface0DIterator &iter)
{
FEdge *fe1, *fe2;
getFEdges(iter, fe1, fe2);
- if (fe1 == NULL)
+ if (fe1 == NULL) {
return -1;
- if (fe1->isSmooth())
+ }
+ if (fe1->isSmooth()) {
result = ((FEdgeSmooth *)fe1)->frs_material();
- else
+ }
+ else {
result = ((FEdgeSharp *)fe1)->bFrsMaterial();
+ }
#if 0
const SShape *sshape = getShapeF0D(iter);
return sshape->material();
@@ -332,8 +356,9 @@ int CurveNatureF0D::operator()(Interface0DIterator &iter)
ViewEdge *ve1, *ve2;
getViewEdges(iter, ve1, ve2);
nat |= ve1->getNature();
- if (ve2 != NULL)
+ if (ve2 != NULL) {
nat |= ve2->getNature();
+ }
result = nat;
return 0;
}
diff --git a/source/blender/freestyle/intern/view_map/Functions1D.cpp b/source/blender/freestyle/intern/view_map/Functions1D.cpp
index 0c0ab9fd631..a0a320a6e6d 100644
--- a/source/blender/freestyle/intern/view_map/Functions1D.cpp
+++ b/source/blender/freestyle/intern/view_map/Functions1D.cpp
@@ -134,16 +134,18 @@ int ChainingTimeStampF1D::operator()(Interface1D &inter)
{
TimeStamp *timestamp = TimeStamp::instance();
ViewEdge *ve = dynamic_cast<ViewEdge *>(&inter);
- if (ve)
+ if (ve) {
ve->setChainingTimeStamp(timestamp->getTimeStamp());
+ }
return 0;
}
int IncrementChainingTimeStampF1D::operator()(Interface1D &inter)
{
ViewEdge *ve = dynamic_cast<ViewEdge *>(&inter);
- if (ve)
+ if (ve) {
ve->setChainingTimeStamp(ve->getChainingTimeStamp() + 1);
+ }
return 0;
}
@@ -157,8 +159,9 @@ int GetShapeF1D::operator()(Interface1D &inter)
}
else {
Interface0DIterator it = inter.verticesBegin(), itend = inter.verticesEnd();
- for (; it != itend; ++it)
+ for (; it != itend; ++it) {
shapesSet.insert(Functions0D::getShapeF0D(it));
+ }
shapesVector.insert<set<ViewShape *>::iterator>(
shapesVector.begin(), shapesSet.begin(), shapesSet.end());
}
@@ -224,8 +227,9 @@ void getOccludeeF1D(Interface1D &inter, set<ViewShape *> &oShapes)
}
else {
Interface0DIterator it = inter.verticesBegin(), itend = inter.verticesEnd();
- for (; it != itend; ++it)
+ for (; it != itend; ++it) {
oShapes.insert(Functions0D::getOccludeeF0D(it));
+ }
}
}
@@ -241,8 +245,9 @@ void getOccludersF1D(Interface1D &inter, set<ViewShape *> &oShapes)
for (; it != itend; ++it) {
set<ViewShape *> shapes;
Functions0D::getOccludersF0D(it, shapes);
- for (set<ViewShape *>::iterator s = shapes.begin(), send = shapes.end(); s != send; ++s)
+ for (set<ViewShape *>::iterator s = shapes.begin(), send = shapes.end(); s != send; ++s) {
oShapes.insert(*s);
+ }
}
}
}
@@ -255,8 +260,9 @@ void getShapeF1D(Interface1D &inter, set<ViewShape *> &oShapes)
}
else {
Interface0DIterator it = inter.verticesBegin(), itend = inter.verticesEnd();
- for (; it != itend; ++it)
+ for (; it != itend; ++it) {
oShapes.insert(Functions0D::getShapeF0D(it));
+ }
}
}
diff --git a/source/blender/freestyle/intern/view_map/Interface0D.h b/source/blender/freestyle/intern/view_map/Interface0D.h
index 3d50e978147..724a98f047f 100644
--- a/source/blender/freestyle/intern/view_map/Interface0D.h
+++ b/source/blender/freestyle/intern/view_map/Interface0D.h
@@ -196,8 +196,9 @@ class Interface0DIterator : public Iterator {
/*! Destructor */
virtual ~Interface0DIterator()
{
- if (_iterator)
+ if (_iterator) {
delete _iterator;
+ }
}
/*! Operator =
@@ -207,8 +208,9 @@ class Interface0DIterator : public Iterator {
*/
Interface0DIterator &operator=(const Interface0DIterator &it)
{
- if (_iterator)
+ if (_iterator) {
delete _iterator;
+ }
_iterator = it._iterator->copy();
return *this;
}
@@ -216,8 +218,9 @@ class Interface0DIterator : public Iterator {
/*! Returns the string "Interface0DIterator". */
virtual string getExactTypeName() const
{
- if (!_iterator)
+ if (!_iterator) {
return "Interface0DIterator";
+ }
return _iterator->getExactTypeName() + "Proxy";
}
@@ -299,8 +302,9 @@ class Interface0DIterator : public Iterator {
/*! Returns true when the iterator is pointing to the final valid element. */
virtual bool atLast() const
{
- if (_iterator->isEnd())
+ if (_iterator->isEnd()) {
return false;
+ }
_iterator->increment();
bool result = _iterator->isEnd();
diff --git a/source/blender/freestyle/intern/view_map/Interface1D.h b/source/blender/freestyle/intern/view_map/Interface1D.h
index e47a5ad8f31..7a72a176902 100644
--- a/source/blender/freestyle/intern/view_map/Interface1D.h
+++ b/source/blender/freestyle/intern/view_map/Interface1D.h
@@ -84,8 +84,9 @@ T integrate(UnaryFunction0D<T> &fun,
++it;
for (; !it.isEnd(); ++it) {
fun(it);
- if (fun.result < res)
+ if (fun.result < res) {
res = fun.result;
+ }
}
break;
case MAX:
@@ -94,8 +95,9 @@ T integrate(UnaryFunction0D<T> &fun,
++it;
for (; !it.isEnd(); ++it) {
fun(it);
- if (fun.result > res)
+ if (fun.result > res) {
res = fun.result;
+ }
}
break;
case FIRST:
diff --git a/source/blender/freestyle/intern/view_map/Silhouette.cpp b/source/blender/freestyle/intern/view_map/Silhouette.cpp
index 15fe55874ca..49da675b932 100644
--- a/source/blender/freestyle/intern/view_map/Silhouette.cpp
+++ b/source/blender/freestyle/intern/view_map/Silhouette.cpp
@@ -35,8 +35,9 @@ namespace Freestyle {
Nature::VertexNature SVertex::getNature() const
{
Nature::VertexNature nature = Nature::S_VERTEX;
- if (_pViewVertex)
+ if (_pViewVertex) {
nature |= _pViewVertex->getNature();
+ }
return nature;
}
@@ -84,71 +85,81 @@ const SShape *SVertex::shape() const
const int SVertex::qi() const
{
- if (getNature() & Nature::T_VERTEX)
+ if (getNature() & Nature::T_VERTEX) {
Exception::raiseException();
+ }
return (_FEdges[0])->qi();
}
occluder_container::const_iterator SVertex::occluders_begin() const
{
- if (getNature() & Nature::T_VERTEX)
+ if (getNature() & Nature::T_VERTEX) {
Exception::raiseException();
+ }
return (_FEdges[0])->occluders_begin();
}
occluder_container::const_iterator SVertex::occluders_end() const
{
- if (getNature() & Nature::T_VERTEX)
+ if (getNature() & Nature::T_VERTEX) {
Exception::raiseException();
+ }
return (_FEdges[0])->occluders_end();
}
bool SVertex::occluders_empty() const
{
- if (getNature() & Nature::T_VERTEX)
+ if (getNature() & Nature::T_VERTEX) {
Exception::raiseException();
+ }
return (_FEdges[0])->occluders_empty();
}
int SVertex::occluders_size() const
{
- if (getNature() & Nature::T_VERTEX)
+ if (getNature() & Nature::T_VERTEX) {
Exception::raiseException();
+ }
return (_FEdges[0])->occluders_size();
}
const Polygon3r &SVertex::occludee() const
{
- if (getNature() & Nature::T_VERTEX)
+ if (getNature() & Nature::T_VERTEX) {
Exception::raiseException();
+ }
return (_FEdges[0])->occludee();
}
const SShape *SVertex::occluded_shape() const
{
- if (getNature() & Nature::T_VERTEX)
+ if (getNature() & Nature::T_VERTEX) {
Exception::raiseException();
+ }
return (_FEdges[0])->occluded_shape();
}
const bool SVertex::occludee_empty() const
{
- if (getNature() & Nature::T_VERTEX)
+ if (getNature() & Nature::T_VERTEX) {
Exception::raiseException();
+ }
return (_FEdges[0])->occludee_empty();
}
real SVertex::z_discontinuity() const
{
- if (getNature() & Nature::T_VERTEX)
+ if (getNature() & Nature::T_VERTEX) {
Exception::raiseException();
+ }
return (_FEdges[0])->z_discontinuity();
}
FEdge *SVertex::fedge()
{
- if (getNature() & Nature::T_VERTEX)
+ if (getNature() & Nature::T_VERTEX) {
return NULL;
+ }
return _FEdges[0];
}
@@ -156,8 +167,9 @@ FEdge *SVertex::getFEdge(Interface0D &inter)
{
FEdge *result = NULL;
SVertex *iVertexB = dynamic_cast<SVertex *>(&inter);
- if (!iVertexB)
+ if (!iVertexB) {
return result;
+ }
vector<FEdge *>::const_iterator fe = _FEdges.begin(), feend = _FEdges.end();
for (; fe != feend; ++fe) {
if ((((*fe)->vertexA() == this) && ((*fe)->vertexB() == iVertexB)) ||
@@ -171,8 +183,9 @@ FEdge *SVertex::getFEdge(Interface0D &inter)
TVertex *tvertex = dynamic_cast<TVertex *>(vvertex);
if (tvertex) {
brother = tvertex->frontSVertex();
- if (this == brother)
+ if (this == brother) {
brother = tvertex->backSVertex();
+ }
const vector<FEdge *> &fedges = brother->fedges();
for (fe = fedges.begin(), feend = fedges.end(); fe != feend; ++fe) {
if ((((*fe)->vertexA() == brother) && ((*fe)->vertexB() == iVertexB)) ||
@@ -188,8 +201,9 @@ FEdge *SVertex::getFEdge(Interface0D &inter)
TVertex *tvertex = dynamic_cast<TVertex *>(vvertex);
if (tvertex) {
brother = tvertex->frontSVertex();
- if (iVertexB == brother)
+ if (iVertexB == brother) {
brother = tvertex->backSVertex();
+ }
for (fe = _FEdges.begin(), feend = _FEdges.end(); fe != feend; ++fe) {
if ((((*fe)->vertexA() == this) && ((*fe)->vertexB() == brother)) ||
(((*fe)->vertexB() == this) && ((*fe)->vertexA() == brother))) {
@@ -225,8 +239,9 @@ float FEdge::viewedge_length() const
const SShape *FEdge::occluded_shape() const
{
ViewShape *aShape = _ViewEdge->aShape();
- if (aShape == 0)
+ if (aShape == 0) {
return 0;
+ }
return aShape->sshape();
}
diff --git a/source/blender/freestyle/intern/view_map/Silhouette.h b/source/blender/freestyle/intern/view_map/Silhouette.h
index b5bbe66e51e..e25048c0300 100644
--- a/source/blender/freestyle/intern/view_map/Silhouette.h
+++ b/source/blender/freestyle/intern/view_map/Silhouette.h
@@ -203,10 +203,12 @@ class SVertex : public Interface0D {
_FEdges = iBrother.fedges();
_Shape = iBrother.shape();
_pViewVertex = iBrother._pViewVertex;
- if (!(iBrother._curvature_info))
+ if (!(iBrother._curvature_info)) {
_curvature_info = 0;
- else
+ }
+ else {
_curvature_info = new CurvatureInfo(*(iBrother._curvature_info));
+ }
iBrother.userdata = this;
userdata = 0;
}
@@ -214,8 +216,9 @@ class SVertex : public Interface0D {
/*! Destructor. */
virtual ~SVertex()
{
- if (_curvature_info)
+ if (_curvature_info) {
delete _curvature_info;
+ }
}
/*! Cloning method. */
@@ -312,8 +315,9 @@ class SVertex : public Interface0D {
void setCurvatureInfo(CurvatureInfo *ci)
{
- if (_curvature_info) // Q. is this an error condition? (T.K. 02-May-2011)
+ if (_curvature_info) { // Q. is this an error condition? (T.K. 02-May-2011)
delete _curvature_info;
+ }
_curvature_info = ci;
}
@@ -415,8 +419,9 @@ class SVertex : public Interface0D {
inline Vec3r normal() const
{
- if (_Normals.size() == 1)
+ if (_Normals.size() == 1) {
return (*(_Normals.begin()));
+ }
Exception::raiseException();
return *(_Normals.begin());
}
@@ -483,8 +488,9 @@ class FEdge : public Interface1D {
/*! Returns the 2D length of the FEdge. */
virtual real getLength2D() const
{
- if (!_VertexA || !_VertexB)
+ if (!_VertexA || !_VertexB) {
return 0;
+ }
return (_VertexB->getPoint2D() - _VertexA->getPoint2D()).norm();
}
@@ -832,8 +838,9 @@ class FEdge : public Interface1D {
*/
static inline SVertex *CommonVertex(FEdge *iEdge1, FEdge *iEdge2)
{
- if ((NULL == iEdge1) || (NULL == iEdge2))
+ if ((NULL == iEdge1) || (NULL == iEdge2)) {
return NULL;
+ }
SVertex *sv1 = iEdge1->vertexA();
SVertex *sv2 = iEdge1->vertexB();
@@ -852,18 +859,22 @@ class FEdge : public Interface1D {
inline const SVertex *min2d() const
{
- if (_VertexA->point2D() < _VertexB->point2D())
+ if (_VertexA->point2D() < _VertexB->point2D()) {
return _VertexA;
- else
+ }
+ else {
return _VertexB;
+ }
}
inline const SVertex *max2d() const
{
- if (_VertexA->point2D() < _VertexB->point2D())
+ if (_VertexA->point2D() < _VertexB->point2D()) {
return _VertexB;
- else
+ }
+ else {
return _VertexA;
+ }
}
/* Information access interface */
@@ -1071,8 +1082,9 @@ class SVertexIterator : public Interface0DIteratorNested {
virtual bool operator==(const Interface0DIteratorNested &it) const
{
const SVertexIterator *it_exact = dynamic_cast<const SVertexIterator *>(&it);
- if (!it_exact)
+ if (!it_exact) {
return false;
+ }
return ((_vertex == it_exact->_vertex) && (_edge == it_exact->_edge));
}
@@ -1614,9 +1626,10 @@ class SShape {
T = (*p)[0];
t = (*p)[1];
- if ((t < 0) || (t > 1))
+ if ((t < 0) || (t > 1)) {
cerr << "Warning: Intersection out of range for edge " << ioA->getId() << " - "
<< ioB->getId() << endl;
+ }
// compute the 3D and 2D coordinates for the intersections points:
newpoint3d = Vec3r(A + T * (B - A));
@@ -1725,8 +1738,9 @@ class SShape {
}
newEdge->setNature(ioEdge->getNature());
- if (ioEdge->nextEdge() != 0)
+ if (ioEdge->nextEdge() != 0) {
ioEdge->nextEdge()->setPreviousEdge(newEdge);
+ }
// update edge A'B for the next pointing edge
newEdge->setNextEdge(ioEdge->nextEdge());
@@ -1769,8 +1783,9 @@ class SShape {
/*! Compute the bbox of the sshape */
inline void ComputeBBox()
{
- if (0 == _verticesList.size())
+ if (0 == _verticesList.size()) {
return;
+ }
Vec3r firstVertex = _verticesList[0]->point3D();
real XMax = firstVertex[0];
@@ -1787,24 +1802,30 @@ class SShape {
Vec3r vertex = (*v)->point3D();
// X
real x = vertex[0];
- if (x > XMax)
+ if (x > XMax) {
XMax = x;
- else if (x < XMin)
+ }
+ else if (x < XMin) {
XMin = x;
+ }
// Y
real y = vertex[1];
- if (y > YMax)
+ if (y > YMax) {
YMax = y;
- else if (y < YMin)
+ }
+ else if (y < YMin) {
YMin = y;
+ }
// Z
real z = vertex[2];
- if (z > ZMax)
+ if (z > ZMax) {
ZMax = z;
- else if (z < ZMin)
+ }
+ else if (z < ZMin) {
ZMin = z;
+ }
}
setBBox(BBox<Vec3r>(Vec3r(XMin, YMin, ZMin), Vec3r(XMax, YMax, ZMax)));
diff --git a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp
index 1d0ac8634dd..66af24507d7 100644
--- a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp
+++ b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp
@@ -102,8 +102,9 @@ void SilhouetteGeomEngine::setTransform(const real iModelViewMatrix[4][4],
for (i = 0; i < 4; i++) {
for (j = 0; j < 4; j++) {
_transform[i][j] = 0;
- for (unsigned int k = 0; k < 4; k++)
+ for (unsigned int k = 0; k < 4; k++) {
_transform[i][j] += _projectionMatrix[i][k] * _modelViewMatrix[k][j];
+ }
}
}
@@ -147,8 +148,9 @@ void SilhouetteGeomEngine::ProjectSilhouette(SVertex *ioVertex)
real SilhouetteGeomEngine::ImageToWorldParameter(FEdge *fe, real t)
{
- if (_isOrthographicProjection)
+ if (_isOrthographicProjection) {
return t;
+ }
// we need to compute for each parameter t the corresponding parameter T which gives the
// intersection in 3D.
@@ -184,8 +186,9 @@ real SilhouetteGeomEngine::ImageToWorldParameter(FEdge *fe, real t)
alpha = ABc[2] / ABc[0];
beta = Ac[2] - alpha * Ac[0];
denom = alpha * (Ir[0] + m13) + m11;
- if (fabs(denom) < 1.0e-6)
+ if (fabs(denom) < 1.0e-6) {
goto iter;
+ }
Ic[0] = -beta * (Ir[0] + m13) / denom;
#if 0
Ic[1] = -(Ir[1] + m23) * (alpha * Ic[0] + beta) / m22;
@@ -197,8 +200,9 @@ real SilhouetteGeomEngine::ImageToWorldParameter(FEdge *fe, real t)
alpha = ABc[2] / ABc[1];
beta = Ac[2] - alpha * Ac[1];
denom = alpha * (Ir[1] + m23) + m22;
- if (fabs(denom) < 1.0e-6)
+ if (fabs(denom) < 1.0e-6) {
goto iter;
+ }
Ic[1] = -beta * (Ir[1] + m23) / denom;
#if 0
Ic[0] = -(Ir[0] + m13) * (alpha * Ic[1] + beta) / m11;
@@ -230,34 +234,43 @@ real SilhouetteGeomEngine::ImageToWorldParameter(FEdge *fe, real t)
delta_x = Ii[0] - Pi[0];
delta_y = Ii[1] - Pi[1];
dist = sqrt(delta_x * delta_x + delta_y * delta_y);
- if (dist < dist_threshold)
+ if (dist < dist_threshold) {
break;
+ }
if (x_coords) {
if (less_than) {
- if (Pi[0] < Ii[0])
+ if (Pi[0] < Ii[0]) {
T_sta = T;
- else
+ }
+ else {
T_end = T;
+ }
}
else {
- if (Pi[0] > Ii[0])
+ if (Pi[0] > Ii[0]) {
T_sta = T;
- else
+ }
+ else {
T_end = T;
+ }
}
}
else {
if (less_than) {
- if (Pi[1] < Ii[1])
+ if (Pi[1] < Ii[1]) {
T_sta = T;
- else
+ }
+ else {
T_end = T;
+ }
}
else {
- if (Pi[1] > Ii[1])
+ if (Pi[1] > Ii[1]) {
T_sta = T;
- else
+ }
+ else {
T_end = T;
+ }
}
}
}
diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
index d1f9a5b41bd..862b4e479fa 100644
--- a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
+++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
@@ -69,9 +69,10 @@ SteerableViewMap::SteerableViewMap(const SteerableViewMap &iBrother)
_mapping = iBrother._mapping;
_imagesPyramids =
new ImagePyramid *[_nbOrientations + 1]; // one more map to store the complete visible VM
- for (i = 0; i <= _nbOrientations; ++i)
+ for (i = 0; i <= _nbOrientations; ++i) {
_imagesPyramids[i] = new GaussianPyramid(
*(dynamic_cast<GaussianPyramid *>(iBrother._imagesPyramids[i])));
+ }
}
SteerableViewMap::~SteerableViewMap()
@@ -84,8 +85,9 @@ void SteerableViewMap::Clear()
unsigned int i;
if (_imagesPyramids) {
for (i = 0; i <= _nbOrientations; ++i) {
- if (_imagesPyramids[i])
+ if (_imagesPyramids[i]) {
delete (_imagesPyramids)[i];
+ }
}
delete[] _imagesPyramids;
_imagesPyramids = 0;
@@ -109,10 +111,12 @@ void SteerableViewMap::Reset()
double SteerableViewMap::ComputeWeight(const Vec2d &dir, unsigned i)
{
double dotp = fabs(dir * _directions[i]);
- if (dotp < _bound)
+ if (dotp < _bound) {
return 0.0;
- if (dotp > 1.0)
+ }
+ if (dotp > 1.0) {
dotp = 1.0;
+ }
return cos((float)_nbOrientations / 2.0 * acos(dotp));
}
@@ -191,12 +195,15 @@ void SteerableViewMap::buildImagesPyramids(GrayImage **steerableBases,
{
for (unsigned int i = 0; i <= _nbOrientations; ++i) {
ImagePyramid *svm = (_imagesPyramids)[i];
- if (svm)
+ if (svm) {
delete svm;
- if (copy)
+ }
+ if (copy) {
svm = new GaussianPyramid(*(steerableBases[i]), iNbLevels, iSigma);
- else
+ }
+ else {
svm = new GaussianPyramid(steerableBases[i], iNbLevels, iSigma);
+ }
_imagesPyramids[i] = svm;
}
}
@@ -210,8 +217,9 @@ float SteerableViewMap::readSteerableViewMapPixel(unsigned iOrientation, int iLe
}
return 0.0f;
}
- if ((x < 0) || (x >= pyramid->width()) || (y < 0) || (y >= pyramid->height()))
+ if ((x < 0) || (x >= pyramid->width()) || (y < 0) || (y >= pyramid->height())) {
return 0;
+ }
// float v = pyramid->pixel(x, pyramid->height() - 1 - y, iLevel) * 255.0f;
// We encode both the directionality and the lines counting on 8 bits (because of frame buffer).
// Thus, we allow until 8 lines to pass through the same pixel, so that we can discretize the
@@ -228,8 +236,9 @@ float SteerableViewMap::readCompleteViewMapPixel(int iLevel, int x, int y)
unsigned int SteerableViewMap::getNumberOfPyramidLevels() const
{
- if (_imagesPyramids[0])
+ if (_imagesPyramids[0]) {
return _imagesPyramids[0]->getNumberOfLevels();
+ }
return 0;
}
@@ -258,8 +267,9 @@ void SteerableViewMap::saveSteerableViewMap() const
for (int y = 0; y < oh; ++y) { // soc
for (int x = 0; x < ow; ++x) { // soc
int c = (int)(coeff * _imagesPyramids[i]->pixel(x, y, j));
- if (c > 255)
+ if (c > 255) {
c = 255;
+ }
// int c = (int)(_imagesPyramids[i]->pixel(x, y, j));
// soc qtmp.setPixel(x, y, qRgb(c, c, c));
diff --git a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp
index 8715f4f52d9..fde4ee7e476 100644
--- a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp
+++ b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp
@@ -33,20 +33,23 @@ namespace Freestyle {
void ViewEdgeXBuilder::Init(ViewShape *oVShape)
{
- if (NULL == oVShape)
+ if (NULL == oVShape) {
return;
+ }
// for design conveniance, we store the current SShape.
_pCurrentSShape = oVShape->sshape();
- if (0 == _pCurrentSShape)
+ if (0 == _pCurrentSShape) {
return;
+ }
_pCurrentVShape = oVShape;
// Reset previous data
//--------------------
- if (!_SVertexMap.empty())
+ if (!_SVertexMap.empty()) {
_SVertexMap.clear();
+ }
}
void ViewEdgeXBuilder::BuildViewEdges(WXShape *iWShape,
@@ -68,17 +71,20 @@ void ViewEdgeXBuilder::BuildViewEdges(WXShape *iWShape,
WXFace *wxf;
for (wf = wfaces.begin(), wfend = wfaces.end(); wf != wfend; wf++) {
wxf = dynamic_cast<WXFace *>(*wf);
- if (false == ((wxf))->hasSmoothEdges()) // does it contain at least one smooth edge ?
+ if (false == ((wxf))->hasSmoothEdges()) { // does it contain at least one smooth edge ?
continue;
+ }
// parse all smooth layers:
vector<WXFaceLayer *> &smoothLayers = wxf->getSmoothLayers();
for (vector<WXFaceLayer *>::iterator sl = smoothLayers.begin(), slend = smoothLayers.end();
sl != slend;
++sl) {
- if (!(*sl)->hasSmoothEdge())
+ if (!(*sl)->hasSmoothEdge()) {
continue;
- if (stopSmoothViewEdge((*sl))) // has it been parsed already ?
+ }
+ if (stopSmoothViewEdge((*sl))) { // has it been parsed already ?
continue;
+ }
// here we know that we're dealing with a face layer that has not been processed yet and that
// contains a smooth edge.
/* vedge =*//* UNUSED */ BuildSmoothViewEdge(OWXFaceLayer(*sl, true));
@@ -96,13 +102,15 @@ void ViewEdgeXBuilder::BuildViewEdges(WXShape *iWShape,
//------------------------------
for (vector<WEdge *>::iterator we = wedges.begin(), weend = wedges.end(); we != weend; we++) {
wxe = dynamic_cast<WXEdge *>(*we);
- if (Nature::NO_FEATURE == wxe->nature())
+ if (Nature::NO_FEATURE == wxe->nature()) {
continue;
+ }
if (!stopSharpViewEdge(wxe)) {
bool b = true;
- if (wxe->order() == -1)
+ if (wxe->order() == -1) {
b = false;
+ }
BuildSharpViewEdge(OWXEdge(wxe, b));
}
}
@@ -174,11 +182,13 @@ ViewEdge *ViewEdgeXBuilder::BuildSmoothViewEdge(const OWXFaceLayer &iFaceLayer)
for (list<OWXFaceLayer>::iterator fl = facesChain.begin(), flend = facesChain.end(); fl != flend;
++fl) {
fe = BuildSmoothFEdge(feprevious, (*fl));
- if (feprevious && fe == feprevious)
+ if (feprevious && fe == feprevious) {
continue;
+ }
fe->setViewEdge(newVEdge);
- if (!fefirst)
+ if (!fefirst) {
fefirst = fe;
+ }
feprevious = fe;
}
// Store the chain starting edge:
@@ -259,8 +269,9 @@ ViewEdge *ViewEdgeXBuilder::BuildSharpViewEdge(const OWXEdge &iWEdge)
++we) {
fe = BuildSharpFEdge(feprevious, (*we));
fe->setViewEdge(newVEdge);
- if (!fefirst)
+ if (!fefirst) {
fefirst = fe;
+ }
feprevious = fe;
}
// Store the chain starting edge:
@@ -306,12 +317,15 @@ OWXFaceLayer ViewEdgeXBuilder::FindNextFaceLayer(const OWXFaceLayer &iFaceLayer)
// special case of EDGE_VERTEX config:
if ((tend == 0.0) || (tend == 1.0)) {
WVertex *nextVertex;
- if (tend == 0.0)
+ if (tend == 0.0) {
nextVertex = woeend->GetaVertex();
- else
+ }
+ else {
nextVertex = woeend->GetbVertex();
- if (nextVertex->isBoundary()) // if it's a non-manifold vertex -> ignore
+ }
+ if (nextVertex->isBoundary()) { // if it's a non-manifold vertex -> ignore
return OWXFaceLayer(0, true);
+ }
bool found = false;
WVertex::face_iterator f = nextVertex->faces_begin();
WVertex::face_iterator fend = nextVertex->faces_end();
@@ -324,12 +338,15 @@ OWXFaceLayer ViewEdgeXBuilder::FindNextFaceLayer(const OWXFaceLayer &iFaceLayer)
if (sameNatureLayers.size() == 1) {
WXFaceLayer *winner = sameNatureLayers[0];
// check face mark continuity
- if (winner->getFace()->GetMark() != iFaceLayer.fl->getFace()->GetMark())
+ if (winner->getFace()->GetMark() != iFaceLayer.fl->getFace()->GetMark()) {
return OWXFaceLayer(NULL, true);
- if (woeend == winner->getSmoothEdge()->woea()->twin())
+ }
+ if (woeend == winner->getSmoothEdge()->woea()->twin()) {
return OWXFaceLayer(winner, true);
- else
+ }
+ else {
return OWXFaceLayer(winner, false);
+ }
}
}
++f;
@@ -337,12 +354,14 @@ OWXFaceLayer ViewEdgeXBuilder::FindNextFaceLayer(const OWXFaceLayer &iFaceLayer)
}
else {
nextFace = dynamic_cast<WXFace *>(iFaceLayer.fl->getFace()->GetBordingFace(woeend));
- if (!nextFace)
+ if (!nextFace) {
return OWXFaceLayer(NULL, true);
+ }
// if the next face layer has either no smooth edge or no smooth edge of same nature, no next
// face
- if (!nextFace->hasSmoothEdges())
+ if (!nextFace->hasSmoothEdges()) {
return OWXFaceLayer(NULL, true);
+ }
vector<WXFaceLayer *> sameNatureLayers;
nextFace->retrieveSmoothEdgesLayers(iFaceLayer.fl->nature(), sameNatureLayers);
// don't know how to deal with several edges of same nature on a single face
@@ -352,12 +371,15 @@ OWXFaceLayer ViewEdgeXBuilder::FindNextFaceLayer(const OWXFaceLayer &iFaceLayer)
else {
WXFaceLayer *winner = sameNatureLayers[0];
// check face mark continuity
- if (winner->getFace()->GetMark() != iFaceLayer.fl->getFace()->GetMark())
+ if (winner->getFace()->GetMark() != iFaceLayer.fl->getFace()->GetMark()) {
return OWXFaceLayer(NULL, true);
- if (woeend == winner->getSmoothEdge()->woea()->twin())
+ }
+ if (woeend == winner->getSmoothEdge()->woea()->twin()) {
return OWXFaceLayer(winner, true);
- else
+ }
+ else {
return OWXFaceLayer(winner, false);
+ }
}
}
return OWXFaceLayer(NULL, true);
@@ -380,12 +402,15 @@ OWXFaceLayer ViewEdgeXBuilder::FindPreviousFaceLayer(const OWXFaceLayer &iFaceLa
// special case of EDGE_VERTEX config:
if ((tend == 0.0) || (tend == 1.0)) {
WVertex *previousVertex;
- if (tend == 0.0)
+ if (tend == 0.0) {
previousVertex = woebegin->GetaVertex();
- else
+ }
+ else {
previousVertex = woebegin->GetbVertex();
- if (previousVertex->isBoundary()) // if it's a non-manifold vertex -> ignore
+ }
+ if (previousVertex->isBoundary()) { // if it's a non-manifold vertex -> ignore
return OWXFaceLayer(NULL, true);
+ }
bool found = false;
WVertex::face_iterator f = previousVertex->faces_begin();
WVertex::face_iterator fend = previousVertex->faces_end();
@@ -398,24 +423,29 @@ OWXFaceLayer ViewEdgeXBuilder::FindPreviousFaceLayer(const OWXFaceLayer &iFaceLa
if (sameNatureLayers.size() == 1) {
WXFaceLayer *winner = sameNatureLayers[0];
// check face mark continuity
- if (winner->getFace()->GetMark() != iFaceLayer.fl->getFace()->GetMark())
+ if (winner->getFace()->GetMark() != iFaceLayer.fl->getFace()->GetMark()) {
return OWXFaceLayer(NULL, true);
- if (woebegin == winner->getSmoothEdge()->woeb()->twin())
+ }
+ if (woebegin == winner->getSmoothEdge()->woeb()->twin()) {
return OWXFaceLayer(winner, true);
- else
+ }
+ else {
return OWXFaceLayer(winner, false);
+ }
}
}
}
}
else {
previousFace = dynamic_cast<WXFace *>(iFaceLayer.fl->getFace()->GetBordingFace(woebegin));
- if (0 == previousFace)
+ if (0 == previousFace) {
return OWXFaceLayer(NULL, true);
+ }
// if the next face layer has either no smooth edge or no smooth edge of same nature, no next
// face
- if (!previousFace->hasSmoothEdges())
+ if (!previousFace->hasSmoothEdges()) {
return OWXFaceLayer(NULL, true);
+ }
vector<WXFaceLayer *> sameNatureLayers;
previousFace->retrieveSmoothEdgesLayers(iFaceLayer.fl->nature(), sameNatureLayers);
// don't know how to deal with several edges of same nature on a single face
@@ -425,12 +455,15 @@ OWXFaceLayer ViewEdgeXBuilder::FindPreviousFaceLayer(const OWXFaceLayer &iFaceLa
else {
WXFaceLayer *winner = sameNatureLayers[0];
// check face mark continuity
- if (winner->getFace()->GetMark() != iFaceLayer.fl->getFace()->GetMark())
+ if (winner->getFace()->GetMark() != iFaceLayer.fl->getFace()->GetMark()) {
return OWXFaceLayer(NULL, true);
- if (woebegin == winner->getSmoothEdge()->woeb()->twin())
+ }
+ if (woebegin == winner->getSmoothEdge()->woeb()->twin()) {
return OWXFaceLayer(winner, true);
- else
+ }
+ else {
return OWXFaceLayer(winner, false);
+ }
}
}
return OWXFaceLayer(NULL, true);
@@ -489,8 +522,9 @@ FEdge *ViewEdgeXBuilder::BuildSmoothFEdge(FEdge *feprevious, const OWXFaceLayer
Vec3r B2(woeb->GetbVertex()->GetVertex());
Vec3r B(B1 + tb * (B2 - B1));
- if (feprevious && (B - va->point3D()).norm() < 1.0e-6)
+ if (feprevious && (B - va->point3D()).norm() < 1.0e-6) {
return feprevious;
+ }
vb = MakeSVertex(B, false);
// Set normal:
@@ -515,12 +549,14 @@ FEdge *ViewEdgeXBuilder::BuildSmoothFEdge(FEdge *feprevious, const OWXFaceLayer
fe->setFrsMaterialIndex(ifl.fl->getFace()->frs_materialIndex());
fe->setFace(ifl.fl->getFace());
fe->setFaceMark(ifl.fl->getFace()->GetMark());
- if (feprevious == 0)
+ if (feprevious == 0) {
normal.normalize();
+ }
fe->setNormal(normal);
fe->setPreviousEdge(feprevious);
- if (feprevious)
+ if (feprevious) {
feprevious->setNextEdge(fe);
+ }
_pCurrentSShape->AddEdge(fe);
va->AddFEdge(fe);
vb->AddFEdge(fe);
@@ -532,10 +568,12 @@ FEdge *ViewEdgeXBuilder::BuildSmoothFEdge(FEdge *feprevious, const OWXFaceLayer
bool ViewEdgeXBuilder::stopSmoothViewEdge(WXFaceLayer *iFaceLayer)
{
- if (NULL == iFaceLayer)
+ if (NULL == iFaceLayer) {
return true;
- if (iFaceLayer->userdata == 0)
+ }
+ if (iFaceLayer->userdata == 0) {
return false;
+ }
return true;
}
@@ -544,40 +582,49 @@ int ViewEdgeXBuilder::retrieveFaceMarks(WXEdge *iEdge)
WFace *aFace = iEdge->GetaFace();
WFace *bFace = iEdge->GetbFace();
int result = 0;
- if (aFace && aFace->GetMark())
+ if (aFace && aFace->GetMark()) {
result += 1;
- if (bFace && bFace->GetMark())
+ }
+ if (bFace && bFace->GetMark()) {
result += 2;
+ }
return result;
}
OWXEdge ViewEdgeXBuilder::FindNextWEdge(const OWXEdge &iEdge)
{
- if (Nature::NO_FEATURE == iEdge.e->nature())
+ if (Nature::NO_FEATURE == iEdge.e->nature()) {
return OWXEdge(NULL, true);
+ }
WVertex *v;
- if (true == iEdge.order)
+ if (true == iEdge.order) {
v = iEdge.e->GetbVertex();
- else
+ }
+ else {
v = iEdge.e->GetaVertex();
+ }
- if (((WXVertex *)v)->isFeature())
+ if (((WXVertex *)v)->isFeature()) {
return 0; /* XXX eeek? NULL? OWXEdge(NULL, true/false)?*/
+ }
int faceMarks = retrieveFaceMarks(iEdge.e);
vector<WEdge *> &vEdges = (v)->GetEdges();
for (vector<WEdge *>::iterator ve = vEdges.begin(), veend = vEdges.end(); ve != veend; ve++) {
WXEdge *wxe = dynamic_cast<WXEdge *>(*ve);
- if (wxe == iEdge.e)
+ if (wxe == iEdge.e) {
continue; // same edge as the one processed
+ }
- if (wxe->nature() != iEdge.e->nature())
+ if (wxe->nature() != iEdge.e->nature()) {
continue;
+ }
// check face mark continuity
- if (retrieveFaceMarks(wxe) != faceMarks)
+ if (retrieveFaceMarks(wxe) != faceMarks) {
continue;
+ }
if (wxe->GetaVertex() == v) {
// That means that the face necesarily lies on the edge left.
@@ -596,31 +643,38 @@ OWXEdge ViewEdgeXBuilder::FindNextWEdge(const OWXEdge &iEdge)
OWXEdge ViewEdgeXBuilder::FindPreviousWEdge(const OWXEdge &iEdge)
{
- if (Nature::NO_FEATURE == iEdge.e->nature())
+ if (Nature::NO_FEATURE == iEdge.e->nature()) {
return OWXEdge(NULL, true);
+ }
WVertex *v;
- if (true == iEdge.order)
+ if (true == iEdge.order) {
v = iEdge.e->GetaVertex();
- else
+ }
+ else {
v = iEdge.e->GetbVertex();
+ }
- if (((WXVertex *)v)->isFeature())
+ if (((WXVertex *)v)->isFeature()) {
return 0;
+ }
int faceMarks = retrieveFaceMarks(iEdge.e);
vector<WEdge *> &vEdges = (v)->GetEdges();
for (vector<WEdge *>::iterator ve = vEdges.begin(), veend = vEdges.end(); ve != veend; ve++) {
WXEdge *wxe = dynamic_cast<WXEdge *>(*ve);
- if (wxe == iEdge.e)
+ if (wxe == iEdge.e) {
continue; // same edge as the one processed
+ }
- if (wxe->nature() != iEdge.e->nature())
+ if (wxe->nature() != iEdge.e->nature()) {
continue;
+ }
// check face mark continuity
- if (retrieveFaceMarks(wxe) != faceMarks)
+ if (retrieveFaceMarks(wxe) != faceMarks) {
continue;
+ }
if (wxe->GetbVertex() == v) {
return OWXEdge(wxe, true);
@@ -685,8 +739,9 @@ FEdge *ViewEdgeXBuilder::BuildSharpFEdge(FEdge *feprevious, const OWXEdge &iwe)
fe->setNormalA(normalA);
fe->setNormalB(normalB);
fe->setPreviousEdge(feprevious);
- if (feprevious)
+ if (feprevious) {
feprevious->setNextEdge(fe);
+ }
_pCurrentSShape->AddEdge(fe);
va->AddFEdge(fe);
vb->AddFEdge(fe);
@@ -703,10 +758,12 @@ FEdge *ViewEdgeXBuilder::BuildSharpFEdge(FEdge *feprevious, const OWXEdge &iwe)
bool ViewEdgeXBuilder::stopSharpViewEdge(WXEdge *iEdge)
{
- if (NULL == iEdge)
+ if (NULL == iEdge) {
return true;
- if (iEdge->userdata == 0)
+ }
+ if (iEdge->userdata == 0) {
return false;
+ }
return true;
}
@@ -744,8 +801,9 @@ SVertex *ViewEdgeXBuilder::MakeSVertex(Vec3r &iPoint, bool shared)
ViewVertex *ViewEdgeXBuilder::MakeViewVertex(SVertex *iSVertex)
{
ViewVertex *vva = iSVertex->viewvertex();
- if (vva)
+ if (vva) {
return vva;
+ }
vva = new NonTVertex(iSVertex);
// Add the view vertex to the ViewShape svertex list:
_pCurrentVShape->AddVertex(vva);
diff --git a/source/blender/freestyle/intern/view_map/ViewMap.cpp b/source/blender/freestyle/intern/view_map/ViewMap.cpp
index 0b352be1a89..0d52b88118b 100644
--- a/source/blender/freestyle/intern/view_map/ViewMap.cpp
+++ b/source/blender/freestyle/intern/view_map/ViewMap.cpp
@@ -133,8 +133,9 @@ const ViewEdge *ViewMap::getClosestViewEdge(real x, real y) const
winner = (*fe);
}
}
- if (!winner)
+ if (!winner) {
return NULL;
+ }
return winner->viewedge();
}
@@ -161,10 +162,12 @@ TVertex *ViewMap::CreateTVertex(const Vec3r &iA3D,
real distb = Ib->point2D()[2];
TVertex *tvertex;
- if (dista < distb)
+ if (dista < distb) {
tvertex = new TVertex(Ia, Ib);
- else
+ }
+ else {
tvertex = new TVertex(Ib, Ia);
+ }
tvertex->setId(id);
@@ -183,8 +186,9 @@ TVertex *ViewMap::CreateTVertex(const Vec3r &iA3D,
ViewVertex *ViewMap::InsertViewVertex(SVertex *iVertex, vector<ViewEdge *> &newViewEdges)
{
NonTVertex *vva = dynamic_cast<NonTVertex *>(iVertex->viewvertex());
- if (vva)
+ if (vva) {
return vva;
+ }
// because it is not already a ViewVertex, this SVertex must have only 2 FEdges. The incoming one
// still belongs to ioEdge, the outgoing one now belongs to newVEdge
const vector<FEdge *> &fedges = iVertex->fedges();
@@ -201,8 +205,9 @@ ViewVertex *ViewMap::InsertViewVertex(SVertex *iVertex, vector<ViewEdge *> &newV
if ((*fe)->vertexA() == iVertex) {
fbegin = (*fe);
}
- if ((fbegin != NULL) && (fend != NULL))
+ if ((fbegin != NULL) && (fend != NULL)) {
break;
+ }
}
ViewEdge *ioEdge = fbegin->viewedge();
ViewShape *vshape = ioEdge->viewShape();
@@ -249,8 +254,9 @@ ViewVertex *ViewMap::InsertViewVertex(SVertex *iVertex, vector<ViewEdge *> &newV
vva->AddIncomingViewEdge(ioEdge);
NonTVertex *vvb = dynamic_cast<NonTVertex *>(newVEdge->B());
- if (vvb)
+ if (vvb) {
vvb->Replace(ioEdge, newVEdge);
+ }
// update ViewShape
// vshape->AddEdge(newVEdge);
@@ -293,15 +299,19 @@ FEdge *ViewMap::Connect(FEdge *ioEdge, SVertex *ioVertex, vector<ViewEdge *> &oN
static bool ViewEdgeComp(ViewVertex::directedViewEdge &dve1, ViewVertex::directedViewEdge &dve2)
{
FEdge *fe1;
- if (dve1.second)
+ if (dve1.second) {
fe1 = dve1.first->fedgeB();
- else
+ }
+ else {
fe1 = dve1.first->fedgeA();
+ }
FEdge *fe2;
- if (dve2.second)
+ if (dve2.second) {
fe2 = dve2.first->fedgeB();
- else
+ }
+ else {
fe2 = dve2.first->fedgeA();
+ }
Vec3r V1 = fe1->orientation2d();
Vec2r v1(V1.x(), V1.y());
@@ -310,16 +320,20 @@ static bool ViewEdgeComp(ViewVertex::directedViewEdge &dve1, ViewVertex::directe
Vec2r v2(V2.x(), V2.y());
v2.normalize();
if (v1.y() > 0) {
- if (v2.y() < 0)
+ if (v2.y() < 0) {
return true;
- else
+ }
+ else {
return (v1.x() > v2.x());
+ }
}
else {
- if (v2.y() > 0)
+ if (v2.y() > 0) {
return false;
- else
+ }
+ else {
return (v1.x() < v2.x());
+ }
}
return false;
}
@@ -333,8 +347,9 @@ void TVertex::setFrontEdgeA(ViewEdge *iFrontEdgeA, bool incoming)
_FrontEdgeA = directedViewEdge(iFrontEdgeA, incoming);
if (!_sortedEdges.empty()) {
edge_pointers_container::iterator dve = _sortedEdges.begin(), dveend = _sortedEdges.end();
- for (; (dve != dveend) && ViewEdgeComp(**dve, _FrontEdgeA); ++dve)
+ for (; (dve != dveend) && ViewEdgeComp(**dve, _FrontEdgeA); ++dve) {
;
+ }
_sortedEdges.insert(dve, &_FrontEdgeA);
}
else {
@@ -351,8 +366,9 @@ void TVertex::setFrontEdgeB(ViewEdge *iFrontEdgeB, bool incoming)
_FrontEdgeB = directedViewEdge(iFrontEdgeB, incoming);
if (!_sortedEdges.empty()) {
edge_pointers_container::iterator dve = _sortedEdges.begin(), dveend = _sortedEdges.end();
- for (; (dve != dveend) && ViewEdgeComp(**dve, _FrontEdgeB); ++dve)
+ for (; (dve != dveend) && ViewEdgeComp(**dve, _FrontEdgeB); ++dve) {
;
+ }
_sortedEdges.insert(dve, &_FrontEdgeB);
}
else {
@@ -369,8 +385,9 @@ void TVertex::setBackEdgeA(ViewEdge *iBackEdgeA, bool incoming)
_BackEdgeA = directedViewEdge(iBackEdgeA, incoming);
if (!_sortedEdges.empty()) {
edge_pointers_container::iterator dve = _sortedEdges.begin(), dveend = _sortedEdges.end();
- for (; (dve != dveend) && ViewEdgeComp(**dve, _BackEdgeA); ++dve)
+ for (; (dve != dveend) && ViewEdgeComp(**dve, _BackEdgeA); ++dve) {
;
+ }
_sortedEdges.insert(dve, &_BackEdgeA);
}
else {
@@ -387,8 +404,9 @@ void TVertex::setBackEdgeB(ViewEdge *iBackEdgeB, bool incoming)
_BackEdgeB = directedViewEdge(iBackEdgeB, incoming);
if (!_sortedEdges.empty()) {
edge_pointers_container::iterator dve = _sortedEdges.begin(), dveend = _sortedEdges.end();
- for (; (dve != dveend) && ViewEdgeComp(**dve, _BackEdgeB); ++dve)
+ for (; (dve != dveend) && ViewEdgeComp(**dve, _BackEdgeB); ++dve) {
;
+ }
_sortedEdges.insert(dve, &_BackEdgeB);
}
else {
@@ -450,8 +468,9 @@ ViewVertex::edge_iterator TVertex::edges_iterator(ViewEdge *iEdge)
for (edge_pointers_container::iterator it = _sortedEdges.begin(), itend = _sortedEdges.end();
it != itend;
it++) {
- if ((*it)->first == iEdge)
+ if ((*it)->first == iEdge) {
return edge_iterator(_sortedEdges.begin(), _sortedEdges.end(), it);
+ }
}
return edge_iterator(_sortedEdges.begin(), _sortedEdges.end(), _sortedEdges.begin());
@@ -475,8 +494,9 @@ ViewVertex::const_edge_iterator TVertex::edges_iterator(ViewEdge *iEdge) const
itend = _sortedEdges.end();
it != itend;
it++) {
- if ((*it)->first == iEdge)
+ if ((*it)->first == iEdge) {
return const_edge_iterator(_sortedEdges.begin(), _sortedEdges.end(), it);
+ }
}
return const_edge_iterator(_sortedEdges.begin(), _sortedEdges.end(), _sortedEdges.begin());
@@ -511,9 +531,10 @@ ViewVertexInternal::orientedViewEdgeIterator TVertex::edgesIterator(ViewEdge *iE
for (edge_pointers_container::iterator it = _sortedEdges.begin(), itend = _sortedEdges.end();
it != itend;
it++) {
- if ((*it)->first == iEdge)
+ if ((*it)->first == iEdge) {
return ViewVertexInternal::orientedViewEdgeIterator(
_sortedEdges.begin(), _sortedEdges.end(), it);
+ }
}
return ViewVertexInternal::orientedViewEdgeIterator(
_sortedEdges.begin(), _sortedEdges.end(), _sortedEdges.begin());
@@ -533,8 +554,9 @@ void NonTVertex::AddOutgoingViewEdge(ViewEdge *iVEdge)
directedViewEdge idve(iVEdge, false);
if (!_ViewEdges.empty()) {
edges_container::iterator dve = _ViewEdges.begin(), dveend = _ViewEdges.end();
- for (; (dve != dveend) && ViewEdgeComp(*dve, idve); ++dve)
+ for (; (dve != dveend) && ViewEdgeComp(*dve, idve); ++dve) {
;
+ }
_ViewEdges.insert(dve, idve);
}
else {
@@ -548,8 +570,9 @@ void NonTVertex::AddIncomingViewEdge(ViewEdge *iVEdge)
directedViewEdge idve(iVEdge, true);
if (!_ViewEdges.empty()) {
edges_container::iterator dve = _ViewEdges.begin(), dveend = _ViewEdges.end();
- for (; (dve != dveend) && ViewEdgeComp(*dve, idve); ++dve)
+ for (; (dve != dveend) && ViewEdgeComp(*dve, idve); ++dve) {
;
+ }
_ViewEdges.insert(dve, idve);
}
else {
@@ -582,8 +605,9 @@ ViewVertex::edge_iterator NonTVertex::edges_iterator(ViewEdge *iEdge)
{
for (edges_container::iterator it = _ViewEdges.begin(), itend = _ViewEdges.end(); it != itend;
it++) {
- if ((it)->first == iEdge)
+ if ((it)->first == iEdge) {
return edge_iterator(_ViewEdges.begin(), _ViewEdges.end(), it);
+ }
}
return edge_iterator(_ViewEdges.begin(), _ViewEdges.end(), _ViewEdges.begin());
}
@@ -593,8 +617,9 @@ ViewVertex::const_edge_iterator NonTVertex::edges_iterator(ViewEdge *iEdge) cons
for (edges_container::const_iterator it = _ViewEdges.begin(), itend = _ViewEdges.end();
it != itend;
it++) {
- if ((it)->first == iEdge)
+ if ((it)->first == iEdge) {
return const_edge_iterator(_ViewEdges.begin(), _ViewEdges.end(), it);
+ }
}
return const_edge_iterator(_ViewEdges.begin(), _ViewEdges.end(), _ViewEdges.begin());
}
@@ -615,9 +640,10 @@ ViewVertexInternal::orientedViewEdgeIterator NonTVertex::edgesIterator(ViewEdge
{
for (edges_container::iterator it = _ViewEdges.begin(), itend = _ViewEdges.end(); it != itend;
it++) {
- if ((it)->first == iEdge)
+ if ((it)->first == iEdge) {
return ViewVertexInternal::orientedViewEdgeIterator(
_ViewEdges.begin(), _ViewEdges.end(), it);
+ }
}
return ViewVertexInternal::orientedViewEdgeIterator(
_ViewEdges.begin(), _ViewEdges.end(), _ViewEdges.begin());
diff --git a/source/blender/freestyle/intern/view_map/ViewMap.h b/source/blender/freestyle/intern/view_map/ViewMap.h
index 9b1eab0d905..a6ca4e3c072 100644
--- a/source/blender/freestyle/intern/view_map/ViewMap.h
+++ b/source/blender/freestyle/intern/view_map/ViewMap.h
@@ -593,14 +593,16 @@ class TVertex : public ViewVertex {
const vector<FEdge *> &vfEdges = _FrontSVertex->fedges();
vector<FEdge *>::const_iterator fe, fend;
for (fe = vfEdges.begin(), fend = vfEdges.end(); fe != fend; fe++) {
- if ((*fe) == iFEdge)
+ if ((*fe) == iFEdge) {
return _FrontSVertex;
+ }
}
const vector<FEdge *> &vbEdges = _BackSVertex->fedges();
for (fe = vbEdges.begin(), fend = vbEdges.end(); fe != fend; fe++) {
- if ((*fe) == iFEdge)
+ if ((*fe) == iFEdge) {
return _BackSVertex;
+ }
}
return NULL;
}
@@ -613,14 +615,18 @@ class TVertex : public ViewVertex {
*/
virtual ViewEdge *mate(ViewEdge *iEdgeA)
{
- if (iEdgeA == _FrontEdgeA.first)
+ if (iEdgeA == _FrontEdgeA.first) {
return _FrontEdgeB.first;
- if (iEdgeA == _FrontEdgeB.first)
+ }
+ if (iEdgeA == _FrontEdgeB.first) {
return _FrontEdgeA.first;
- if (iEdgeA == _BackEdgeA.first)
+ }
+ if (iEdgeA == _BackEdgeA.first) {
return _BackEdgeB.first;
- if (iEdgeA == _BackEdgeB.first)
+ }
+ if (iEdgeA == _BackEdgeB.first) {
return _BackEdgeA.first;
+ }
return NULL;
}
@@ -818,10 +824,12 @@ class NonTVertex : public ViewVertex {
inline void AddViewEdge(ViewEdge *iVEdge, bool incoming = true)
{
- if (incoming)
+ if (incoming) {
AddIncomingViewEdge(iVEdge);
- else
+ }
+ else {
AddOutgoingViewEdge(iVEdge);
+ }
}
/* Replaces old edge by new edge */
@@ -1059,8 +1067,9 @@ class ViewEdge : public Interface1D {
#endif
// only the last splitted deletes this id
if (_splittingId) {
- if (*_splittingId == _Id)
+ if (*_splittingId == _Id) {
delete _splittingId;
+ }
}
}
@@ -1106,8 +1115,9 @@ class ViewEdge : public Interface1D {
/*! Tells whether this ViewEdge forms a closed loop or not. */
inline bool isClosed()
{
- if (!__B)
+ if (!__B) {
return true;
+ }
return false;
}
@@ -1314,8 +1324,9 @@ class ViewEdge : public Interface1D {
inline const bool occludee_empty() const
{
- if (_aShape == 0)
+ if (_aShape == 0) {
return true;
+ }
return false;
}
@@ -1658,13 +1669,15 @@ void ViewShape::SplitEdge(FEdge *fe,
sv2 = (*vv)->backSVertex();
if (sv->shape() != sv2->shape()) {
- if (sv->shape() != _SShape)
+ if (sv->shape() != _SShape) {
sv = sv2;
+ }
}
else {
// if the shape is the same we can safely differ the two vertices using their ids:
- if (sv->getId() != fe->vertexA()->getId())
+ if (sv->getId() != fe->vertexA()->getId()) {
sv = sv2;
+ }
}
vva = vEdge->A();
@@ -1705,10 +1718,12 @@ void ViewShape::SplitEdge(FEdge *fe,
newVEdge->setFEdgeA(newEdge);
// newVEdge->setFEdgeB(fe);
// If our original viewedge is made of one FEdge, then
- if ((vEdge->fedgeA() == vEdge->fedgeB()) || (fe == vEdge->fedgeB()))
+ if ((vEdge->fedgeA() == vEdge->fedgeB()) || (fe == vEdge->fedgeB())) {
newVEdge->setFEdgeB(newEdge);
- else
+ }
+ else {
newVEdge->setFEdgeB(vEdge->fedgeB()); // MODIF
+ }
Id *newId = vEdge->splittingId();
if (newId == 0) {
@@ -1729,8 +1744,9 @@ void ViewShape::SplitEdge(FEdge *fe,
// add new edge to the list of new edges passed as argument:
ioNewViewEdges.push_back(newVEdge);
- if (0 != vvb)
+ if (0 != vvb) {
vvb->Replace((vEdge), newVEdge);
+ }
// we split the view edge:
vEdge->setB((*vv));
@@ -1795,8 +1811,9 @@ inline real ViewEdge::local_average_density(float sigma, int iCombination) const
inline const SShape *ViewEdge::occluded_shape() const
{
- if (0 == _aShape)
+ if (0 == _aShape) {
return 0;
+ }
return _aShape->sshape();
}
diff --git a/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h b/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h
index 63343c33c4f..0ccf0d382a2 100644
--- a/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h
+++ b/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h
@@ -206,20 +206,24 @@ class edge_iterator_base : public IteratorBase<Traits, InputIteratorTag_Traits>
public:
virtual bool begin() const
{
- if (_Nature & Nature::T_VERTEX)
+ if (_Nature & Nature::T_VERTEX) {
return (_tvertex_iter == _tbegin);
- // return (_tvertex_iter == _feA);
- else
+ // return (_tvertex_iter == _feA);
+ }
+ else {
return (_nontvertex_iter == _begin);
+ }
}
virtual bool end() const
{
- if (_Nature & Nature::T_VERTEX)
+ if (_Nature & Nature::T_VERTEX) {
// return (_tvertex_iter.first == 0);
return (_tvertex_iter == _tend);
- else
+ }
+ else {
return (_nontvertex_iter == _end);
+ }
}
// operators
@@ -242,10 +246,12 @@ class edge_iterator_base : public IteratorBase<Traits, InputIteratorTag_Traits>
// comparibility
virtual bool operator!=(const Self &b) const
{
- if (_Nature & Nature::T_VERTEX)
+ if (_Nature & Nature::T_VERTEX) {
return (_tvertex_iter != b._tvertex_iter);
- else
+ }
+ else {
return (_nontvertex_iter != b._nontvertex_iter);
+ }
}
virtual bool operator==(const Self &b) const
@@ -256,11 +262,13 @@ class edge_iterator_base : public IteratorBase<Traits, InputIteratorTag_Traits>
// dereferencing
virtual reference operator*() const
{
- if (_Nature & Nature::T_VERTEX)
+ if (_Nature & Nature::T_VERTEX) {
// return _tvertex_iter;
return **_tvertex_iter;
- else
+ }
+ else {
return (*_nontvertex_iter);
+ }
}
virtual pointer operator->() const
@@ -275,8 +283,9 @@ class edge_iterator_base : public IteratorBase<Traits, InputIteratorTag_Traits>
value_type tmp = (**_tvertex_iter);
++_tvertex_iter;
value_type tmp2 = (**_tvertex_iter);
- if (tmp2.first == tmp.first)
+ if (tmp2.first == tmp.first) {
++_tvertex_iter;
+ }
#if 0
// Hack to deal with cusp. the result of a cusp is a TVertex having two identical viewedges.
// In order to iterate properly, we chose to skip these last ones.
diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
index f990b7bd63a..fb237a9c2ca 100644
--- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
+++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
@@ -93,22 +93,26 @@ static void findOccludee(FEdge *fe,
if (0 != face) {
skipFace = false;
- if (face == oface)
+ if (face == oface) {
continue;
+ }
- if (faceVertices.empty())
+ if (faceVertices.empty()) {
continue;
+ }
for (vector<WVertex *>::iterator fv = faceVertices.begin(), fvend = faceVertices.end();
fv != fvend;
++fv) {
- if ((*fv)->isBoundary())
+ if ((*fv)->isBoundary()) {
continue;
+ }
WVertex::incoming_edge_iterator iebegin = (*fv)->incoming_edges_begin();
WVertex::incoming_edge_iterator ieend = (*fv)->incoming_edges_end();
for (ie = iebegin; ie != ieend; ++ie) {
- if ((*ie) == 0)
+ if ((*ie) == 0) {
continue;
+ }
WFace *sface = (*ie)->GetbFace();
if (sface == oface) {
@@ -116,11 +120,13 @@ static void findOccludee(FEdge *fe,
break;
}
}
- if (skipFace)
+ if (skipFace) {
break;
+ }
}
- if (skipFace)
+ if (skipFace) {
continue;
+ }
}
else {
// check whether the edge and the polygon plane are coincident:
@@ -165,8 +171,9 @@ static void findOccludee(FEdge *fe,
}
}
- if (noIntersection)
+ if (noIntersection) {
*oaWFace = NULL;
+ }
}
}
@@ -249,8 +256,9 @@ static int computeVisibility(ViewMap *viewMap,
WFace *oface;
bool skipFace;
- if (face)
+ if (face) {
face->RetrieveVertexList(faceVertices);
+ }
I occluders(grid, center, epsilon);
@@ -315,14 +323,16 @@ static int computeVisibility(ViewMap *viewMap,
for (vector<WVertex *>::iterator fv = faceVertices.begin(), fvend = faceVertices.end();
fv != fvend;
++fv) {
- if ((*fv)->isBoundary())
+ if ((*fv)->isBoundary()) {
continue;
+ }
WVertex::incoming_edge_iterator iebegin = (*fv)->incoming_edges_begin();
WVertex::incoming_edge_iterator ieend = (*fv)->incoming_edges_end();
for (ie = iebegin; ie != ieend; ++ie) {
- if ((*ie) == 0)
+ if ((*ie) == 0) {
continue;
+ }
WFace *sface = (*ie)->GetbFace();
// WFace *sfacea = (*ie)->GetaFace();
@@ -332,8 +342,9 @@ static int computeVisibility(ViewMap *viewMap,
break;
}
}
- if (skipFace)
+ if (skipFace) {
break;
+ }
}
if (skipFace) {
#if LOGGING
@@ -395,8 +406,9 @@ static int computeVisibility(ViewMap *viewMap,
}
++qi;
- if (!grid.enableQI())
+ if (!grid.enableQI()) {
break;
+ }
}
occluders.reportDepth(center, u, t);
@@ -440,8 +452,9 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap,
unsigned qiMajority;
for (vector<ViewEdge *>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) {
if (iRenderMonitor) {
- if (iRenderMonitor->testBreak())
+ if (iRenderMonitor->testBreak()) {
break;
+ }
if (cnt % cntStep == 0) {
stringstream ss;
ss << "Freestyle: Visibility computations " << (100 * cnt / vedges.size()) << "%";
@@ -645,8 +658,9 @@ static void computeDetailedVisibility(ViewMap *ioViewMap,
unsigned maxIndex, maxCard;
unsigned qiMajority;
for (vector<ViewEdge *>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) {
- if (iRenderMonitor && iRenderMonitor->testBreak())
+ if (iRenderMonitor && iRenderMonitor->testBreak()) {
break;
+ }
#if LOGGING
if (_global.debug & G_DEBUG_FREESTYLE) {
cout << "Processing ViewEdge " << (*ve)->getId() << endl;
@@ -1243,8 +1257,9 @@ void ViewMapBuilder::computeInitialViewEdges(WingedEdge &we)
SShape *psShape;
for (vector<WShape *>::const_iterator it = wshapes.begin(); it != wshapes.end(); it++) {
- if (_pRenderMonitor && _pRenderMonitor->testBreak())
+ if (_pRenderMonitor && _pRenderMonitor->testBreak()) {
break;
+ }
// create the embedding
psShape = new SShape;
@@ -1286,10 +1301,12 @@ void ViewMapBuilder::computeCusps(ViewMap *ioViewMap)
ViewMap::viewedges_container &vedges = ioViewMap->ViewEdges();
ViewMap::viewedges_container::iterator ve = vedges.begin(), veend = vedges.end();
for (; ve != veend; ++ve) {
- if (_pRenderMonitor && _pRenderMonitor->testBreak())
+ if (_pRenderMonitor && _pRenderMonitor->testBreak()) {
break;
- if ((!((*ve)->getNature() & Nature::SILHOUETTE)) || (!((*ve)->fedgeA()->isSmooth())))
+ }
+ if ((!((*ve)->getNature() & Nature::SILHOUETTE)) || (!((*ve)->fedgeA()->isSmooth()))) {
continue;
+ }
FEdge *fe = (*ve)->fedgeA();
FEdge *fefirst = fe;
bool first = true;
@@ -1312,10 +1329,12 @@ void ViewMapBuilder::computeCusps(ViewMap *ioViewMap)
}
viewvector.normalize();
if (first) {
- if (((crossP) * (viewvector)) > 0)
+ if (((crossP) * (viewvector)) > 0) {
positive = true;
- else
+ }
+ else {
positive = false;
+ }
first = false;
}
// If we're in a positive part, we need a stronger negative value to change
@@ -1327,8 +1346,9 @@ void ViewMapBuilder::computeCusps(ViewMap *ioViewMap)
// creates and insert cusp
cusp = dynamic_cast<NonTVertex *>(
ioViewMap->InsertViewVertex(fes->vertexA(), newVEdges));
- if (cusp)
+ if (cusp) {
cusp->setNature(cusp->getNature() | Nature::CUSP);
+ }
}
}
else {
@@ -1337,8 +1357,9 @@ void ViewMapBuilder::computeCusps(ViewMap *ioViewMap)
positive = true;
cusp = dynamic_cast<NonTVertex *>(
ioViewMap->InsertViewVertex(fes->vertexA(), newVEdges));
- if (cusp)
+ if (cusp) {
cusp->setNature(cusp->getNature() | Nature::CUSP);
+ }
}
}
fe = fe->nextEdge();
@@ -1557,8 +1578,9 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo
unsigned qiMajority;
static unsigned timestamp = 1;
for (vector<ViewEdge *>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) {
- if (_pRenderMonitor && _pRenderMonitor->testBreak())
+ if (_pRenderMonitor && _pRenderMonitor->testBreak()) {
break;
+ }
#if LOGGING
if (_global.debug & G_DEBUG_FREESTYLE) {
cout << "Processing ViewEdge " << (*ve)->getId() << endl;
@@ -1649,8 +1671,10 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo
// qi --
(*ve)->setQI(maxIndex);
// occluders --
- for (set<ViewShape *>::iterator o = occluders.begin(), oend = occluders.end(); o != oend; ++o)
+ for (set<ViewShape *>::iterator o = occluders.begin(), oend = occluders.end(); o != oend;
+ ++o) {
(*ve)->AddOccluder((*o));
+ }
#if LOGGING
if (_global.debug & G_DEBUG_FREESTYLE) {
cout << "\tConclusion: QI = " << maxIndex << ", " << (*ve)->occluders_size() << " occluders."
@@ -1712,8 +1736,9 @@ void ViewMapBuilder::ComputeFastRayCastingVisibility(ViewMap *ioViewMap, real ep
static unsigned timestamp = 1;
bool even_test;
for (vector<ViewEdge *>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) {
- if (_pRenderMonitor && _pRenderMonitor->testBreak())
+ if (_pRenderMonitor && _pRenderMonitor->testBreak()) {
break;
+ }
festart = (*ve)->fedgeA();
fe = (*ve)->fedgeA();
@@ -1722,10 +1747,12 @@ void ViewMapBuilder::ComputeFastRayCastingVisibility(ViewMap *ioViewMap, real ep
qiMajority++;
fe = fe->nextEdge();
} while (fe && fe != festart);
- if (qiMajority >= 4)
+ if (qiMajority >= 4) {
qiMajority >>= 2;
- else
+ }
+ else {
qiMajority = 1;
+ }
set<ViewShape *> occluders;
@@ -1834,8 +1861,9 @@ void ViewMapBuilder::ComputeVeryFastRayCastingVisibility(ViewMap *ioViewMap, rea
Polygon3r *aFace = NULL;
static unsigned timestamp = 1;
for (vector<ViewEdge *>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) {
- if (_pRenderMonitor && _pRenderMonitor->testBreak())
+ if (_pRenderMonitor && _pRenderMonitor->testBreak()) {
break;
+ }
set<ViewShape *> occluders;
@@ -1909,22 +1937,26 @@ void ViewMapBuilder::FindOccludee(FEdge *fe,
if (face) {
skipFace = false;
- if (face == oface)
+ if (face == oface) {
continue;
+ }
- if (faceVertices.empty())
+ if (faceVertices.empty()) {
continue;
+ }
for (vector<WVertex *>::iterator fv = faceVertices.begin(), fvend = faceVertices.end();
fv != fvend;
++fv) {
- if ((*fv)->isBoundary())
+ if ((*fv)->isBoundary()) {
continue;
+ }
WVertex::incoming_edge_iterator iebegin = (*fv)->incoming_edges_begin();
WVertex::incoming_edge_iterator ieend = (*fv)->incoming_edges_end();
for (ie = iebegin; ie != ieend; ++ie) {
- if ((*ie) == 0)
+ if ((*ie) == 0) {
continue;
+ }
WFace *sface = (*ie)->GetbFace();
if (sface == oface) {
@@ -1932,16 +1964,19 @@ void ViewMapBuilder::FindOccludee(FEdge *fe,
break;
}
}
- if (skipFace)
+ if (skipFace) {
break;
+ }
}
- if (skipFace)
+ if (skipFace) {
continue;
+ }
}
else {
if (GeomUtils::COINCIDENT ==
- GeomUtils::intersectRayPlane(origin, edgeDir, normal, d, t, epsilon))
+ GeomUtils::intersectRayPlane(origin, edgeDir, normal, d, t, epsilon)) {
continue;
+ }
}
if ((*p)->rayIntersect(A, v, t, t_u, t_v)) {
if (fabs(v * normal) > 0.0001) {
@@ -1957,8 +1992,9 @@ void ViewMapBuilder::FindOccludee(FEdge *fe,
}
}
- if (noIntersection)
+ if (noIntersection) {
*oaPolygon = NULL;
+ }
}
}
@@ -1982,9 +2018,10 @@ void ViewMapBuilder::FindOccludee(
u = Vec3r(_viewpoint - A);
}
u.normalize();
- if (A < iGrid->getOrigin())
+ if (A < iGrid->getOrigin()) {
cerr << "Warning: point is out of the grid for fedge " << fe->getId().getFirst() << "-"
<< fe->getId().getSecond() << endl;
+ }
vector<WVertex *> faceVertices;
@@ -1993,8 +2030,9 @@ void ViewMapBuilder::FindOccludee(
FEdgeSmooth *fes = dynamic_cast<FEdgeSmooth *>(fe);
face = (WFace *)fes->face();
}
- if (face)
+ if (face) {
face->RetrieveVertexList(faceVertices);
+ }
return FindOccludee(
fe, iGrid, epsilon, oaPolygon, timestamp, u, A, origin, edgeDir, faceVertices);
@@ -2073,8 +2111,9 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe,
WFace *oface;
bool skipFace;
OccludersSet::iterator p, pend;
- if (face)
+ if (face) {
face->RetrieveVertexList(faceVertices);
+ }
for (p = occluders.begin(), pend = occluders.end(); p != pend; p++) {
// If we're dealing with an exact silhouette, check whether we must take care of this occluder
@@ -2121,14 +2160,16 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe,
for (vector<WVertex *>::iterator fv = faceVertices.begin(), fvend = faceVertices.end();
fv != fvend;
++fv) {
- if ((*fv)->isBoundary())
+ if ((*fv)->isBoundary()) {
continue;
+ }
WVertex::incoming_edge_iterator iebegin = (*fv)->incoming_edges_begin();
WVertex::incoming_edge_iterator ieend = (*fv)->incoming_edges_end();
for (ie = iebegin; ie != ieend; ++ie) {
- if ((*ie) == 0)
+ if ((*ie) == 0) {
continue;
+ }
WFace *sface = (*ie)->GetbFace();
// WFace *sfacea = (*ie)->GetaFace();
@@ -2138,8 +2179,9 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe,
break;
}
}
- if (skipFace)
+ if (skipFace) {
break;
+ }
}
if (skipFace) {
#if LOGGING
@@ -2185,8 +2227,9 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe,
ViewShape *vshape = _ViewMap->viewShape(f->GetVertex(0)->shape()->GetId());
oOccluders.insert(vshape);
++qi;
- if (!_EnableQI)
+ if (!_EnableQI) {
break;
+ }
}
}
}
@@ -2241,12 +2284,15 @@ struct less_SVertex2D : public binary_function<SVertex *, SVertex *, bool> {
Vec3r A = x->point2D();
Vec3r B = y->point2D();
for (unsigned int i = 0; i < 3; i++) {
- if ((fabs(A[i] - B[i])) < epsilon)
+ if ((fabs(A[i] - B[i])) < epsilon) {
continue;
- if (A[i] < B[i])
+ }
+ if (A[i] < B[i]) {
return true;
- if (A[i] > B[i])
+ }
+ if (A[i] > B[i]) {
return false;
+ }
}
return false;
}
@@ -2267,8 +2313,9 @@ struct less_Intersection : public binary_function<intersection *, intersection *
{
real tx = x->getParameter(edge);
real ty = y->getParameter(edge);
- if (tx > ty)
+ if (tx > ty) {
return true;
+ }
return false;
}
};
@@ -2341,8 +2388,9 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi
vector<segment *> vsegments;
for (vector<SVertex *>::iterator sv = svertices.begin(), svend = svertices.end(); sv != svend;
sv++) {
- if (_pRenderMonitor && _pRenderMonitor->testBreak())
+ if (_pRenderMonitor && _pRenderMonitor->testBreak()) {
break;
+ }
const vector<FEdge *> &vedges = (*sv)->fedges();
@@ -2378,8 +2426,9 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi
}
// reset userdata:
- for (fe = ioEdges.begin(), fend = ioEdges.end(); fe != fend; fe++)
+ for (fe = ioEdges.begin(), fend = ioEdges.end(); fe != fend; fe++) {
(*fe)->userdata = NULL;
+ }
// list containing the new edges resulting from splitting operations.
vector<FEdge *> newEdges;
@@ -2409,24 +2458,28 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi
real ta = (*i)->tA;
real tb = (*i)->tB;
- if ((ta < -epsilon) || (ta > 1 + epsilon))
+ if ((ta < -epsilon) || (ta > 1 + epsilon)) {
cerr << "Warning: 2D intersection out of range for edge " << fA->vertexA()->getId() << " - "
<< fA->vertexB()->getId() << endl;
+ }
- if ((tb < -epsilon) || (tb > 1 + epsilon))
+ if ((tb < -epsilon) || (tb > 1 + epsilon)) {
cerr << "Warning: 2D intersection out of range for edge " << fB->vertexA()->getId() << " - "
<< fB->vertexB()->getId() << endl;
+ }
real Ta = SilhouetteGeomEngine::ImageToWorldParameter(fA, ta);
real Tb = SilhouetteGeomEngine::ImageToWorldParameter(fB, tb);
- if ((Ta < -epsilon) || (Ta > 1 + epsilon))
+ if ((Ta < -epsilon) || (Ta > 1 + epsilon)) {
cerr << "Warning: 3D intersection out of range for edge " << fA->vertexA()->getId() << " - "
<< fA->vertexB()->getId() << endl;
+ }
- if ((Tb < -epsilon) || (Tb > 1 + epsilon))
+ if ((Tb < -epsilon) || (Tb > 1 + epsilon)) {
cerr << "Warning: 3D intersection out of range for edge " << fB->vertexA()->getId() << " - "
<< fB->vertexB()->getId() << endl;
+ }
#if 0
if (_global.debug & G_DEBUG_FREESTYLE) {
@@ -2488,8 +2541,9 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi
vector<intersection *> &eIntersections = (*s)->intersections();
// we first need to sort these intersections from farther to closer to A
sort(eIntersections.begin(), eIntersections.end(), less_Intersection(*s));
- for (i = eIntersections.begin(), iend = eIntersections.end(); i != iend; i++)
+ for (i = eIntersections.begin(), iend = eIntersections.end(); i != iend; i++) {
edgeVVertices.push_back((TVertex *)(*i)->userdata);
+ }
shape->SplitEdge(fedge, edgeVVertices, ioViewMap->FEdges(), ioViewMap->ViewEdges());
@@ -2503,8 +2557,9 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi
}
// reset userdata:
- for (fe = ioEdges.begin(), fend = ioEdges.end(); fe != fend; fe++)
+ for (fe = ioEdges.begin(), fend = ioEdges.end(); fe != fend; fe++) {
(*fe)->userdata = NULL;
+ }
// delete segments
if (!segments.empty()) {
diff --git a/source/blender/freestyle/intern/view_map/ViewMapIO.cpp b/source/blender/freestyle/intern/view_map/ViewMapIO.cpp
index 24ed798709a..f844a227ec5 100644
--- a/source/blender/freestyle/intern/view_map/ViewMapIO.cpp
+++ b/source/blender/freestyle/intern/view_map/ViewMapIO.cpp
@@ -113,23 +113,27 @@ inline int load(istream &in, FrsMaterial &m)
int i;
// Diffuse
- for (i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++) {
READ(tmp_array[i]);
+ }
m.setDiffuse(tmp_array[0], tmp_array[1], tmp_array[2], tmp_array[3]);
// Specular
- for (i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++) {
READ(tmp_array[i]);
+ }
m.setSpecular(tmp_array[0], tmp_array[1], tmp_array[2], tmp_array[3]);
// Ambient
- for (i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++) {
READ(tmp_array[i]);
+ }
m.setAmbient(tmp_array[0], tmp_array[1], tmp_array[2], tmp_array[3]);
// Emission
- for (i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++) {
READ(tmp_array[i]);
+ }
m.setEmission(tmp_array[0], tmp_array[1], tmp_array[2], tmp_array[3]);
// Shininess
@@ -141,8 +145,9 @@ inline int load(istream &in, FrsMaterial &m)
static int load(istream &in, ViewShape *vs)
{
- if (!vs || !vs->sshape())
+ if (!vs || !vs->sshape()) {
return 1;
+ }
// SShape
@@ -217,8 +222,9 @@ static int load(istream &in, ViewShape *vs)
static int load(istream &in, FEdge *fe)
{
- if (!fe)
+ if (!fe) {
return 1;
+ }
bool b;
@@ -335,8 +341,9 @@ static int load(istream &in, FEdge *fe)
static int load(istream &in, SVertex *sv)
{
- if (!sv)
+ if (!sv) {
return 1;
+ }
// Id
Id::id_type id1, id2;
@@ -388,8 +395,9 @@ static int load(istream &in, SVertex *sv)
static int load(istream &in, ViewEdge *ve)
{
- if (!ve)
+ if (!ve) {
return 1;
+ }
unsigned tmp;
@@ -454,8 +462,9 @@ static int load(istream &in, ViewEdge *ve)
static int load(istream &in, ViewVertex *vv)
{
- if (!vv)
+ if (!vv) {
return 1;
+ }
unsigned tmp;
bool b;
@@ -584,20 +593,24 @@ inline int save(ostream &out, const FrsMaterial &m)
unsigned i;
// Diffuse
- for (i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++) {
WRITE(m.diffuse()[i]);
+ }
// Specular
- for (i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++) {
WRITE(m.specular()[i]);
+ }
// Ambient
- for (i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++) {
WRITE(m.ambient()[i]);
+ }
// Emission
- for (i = 0; i < 4; i++)
+ for (i = 0; i < 4; i++) {
WRITE(m.emission()[i]);
+ }
// Shininess
float shininess = m.shininess();
@@ -633,8 +646,9 @@ static int save(ostream &out, ViewShape *vs)
// -> Material
unsigned int size = vs->sshape()->frs_materials().size();
WRITE(size);
- for (unsigned int i = 0; i < size; ++i)
+ for (unsigned int i = 0; i < size; ++i) {
save(out, vs->sshape()->frs_material(i));
+ }
// -> VerticesList (List)
tmp = vs->sshape()->getVertexList().size();
@@ -804,11 +818,13 @@ static int save(ostream &out, SVertex *sv)
// Note: the 'size()' method of a set doesn't seem to return the actual size of the given set, so
// we have to hack it...
set<Vec3r>::const_iterator i;
- for (i = sv->normals().begin(), tmp = 0; i != sv->normals().end(); i++, tmp++)
+ for (i = sv->normals().begin(), tmp = 0; i != sv->normals().end(); i++, tmp++) {
;
+ }
WRITE(tmp);
- for (i = sv->normals().begin(); i != sv->normals().end(); i++)
+ for (i = sv->normals().begin(); i != sv->normals().end(); i++) {
save(out, *i);
+ }
// FEdges (List)
tmp = sv->fedges().size();
@@ -952,8 +968,9 @@ static int save(ostream &out, ViewVertex *vv)
int load(istream &in, ViewMap *vm, ProgressBar *pb)
{
- if (!vm)
+ if (!vm) {
return 1;
+ }
// soc unused - unsigned tmp;
int err = 0;
@@ -1050,25 +1067,30 @@ int load(istream &in, ViewMap *vm, ProgressBar *pb)
SET_PROGRESS(1);
for (vector<ViewShape *>::const_iterator i4 = vm->ViewShapes().begin();
i4 != vm->ViewShapes().end();
- i4++)
+ i4++) {
err += Internal::load(in, *i4);
+ }
SET_PROGRESS(2);
- for (vector<FEdge *>::const_iterator i5 = vm->FEdges().begin(); i5 != vm->FEdges().end(); i5++)
+ for (vector<FEdge *>::const_iterator i5 = vm->FEdges().begin(); i5 != vm->FEdges().end(); i5++) {
err += Internal::load(in, *i5);
+ }
SET_PROGRESS(3);
for (vector<SVertex *>::const_iterator i6 = vm->SVertices().begin(); i6 != vm->SVertices().end();
- i6++)
+ i6++) {
err += Internal::load(in, *i6);
+ }
SET_PROGRESS(4);
for (vector<ViewEdge *>::const_iterator i7 = vm->ViewEdges().begin();
i7 != vm->ViewEdges().end();
- i7++)
+ i7++) {
err += Internal::load(in, *i7);
+ }
SET_PROGRESS(5);
for (vector<ViewVertex *>::const_iterator i8 = vm->ViewVertices().begin();
i8 != vm->ViewVertices().end();
- i8++)
+ i8++) {
err += Internal::load(in, *i8);
+ }
SET_PROGRESS(6);
// Read the shape id to index mapping
@@ -1086,8 +1108,9 @@ int load(istream &in, ViewMap *vm, ProgressBar *pb)
int save(ostream &out, ViewMap *vm, ProgressBar *pb)
{
- if (!vm)
+ if (!vm) {
return 1;
+ }
int err = 0;
@@ -1104,14 +1127,18 @@ int save(ostream &out, ViewMap *vm, ProgressBar *pb)
vm->ViewShapes()[i0]->userdata = POINTER_FROM_UINT(i0);
vm->ViewShapes()[i0]->sshape()->userdata = POINTER_FROM_UINT(i0);
}
- for (unsigned int i1 = 0; i1 < vm->FEdges().size(); i1++)
+ for (unsigned int i1 = 0; i1 < vm->FEdges().size(); i1++) {
vm->FEdges()[i1]->userdata = POINTER_FROM_UINT(i1);
- for (unsigned int i2 = 0; i2 < vm->SVertices().size(); i2++)
+ }
+ for (unsigned int i2 = 0; i2 < vm->SVertices().size(); i2++) {
vm->SVertices()[i2]->userdata = POINTER_FROM_UINT(i2);
- for (unsigned int i3 = 0; i3 < vm->ViewEdges().size(); i3++)
+ }
+ for (unsigned int i3 = 0; i3 < vm->ViewEdges().size(); i3++) {
vm->ViewEdges()[i3]->userdata = POINTER_FROM_UINT(i3);
- for (unsigned int i4 = 0; i4 < vm->ViewVertices().size(); i4++)
+ }
+ for (unsigned int i4 = 0; i4 < vm->ViewVertices().size(); i4++) {
vm->ViewVertices()[i4]->userdata = POINTER_FROM_UINT(i4);
+ }
// Write the current options
unsigned char flags = Options::getFlags();
@@ -1127,8 +1154,9 @@ int save(ostream &out, ViewMap *vm, ProgressBar *pb)
bool b = vm->FEdges()[0]->isSmooth();
WRITE(b);
for (unsigned int i = 0; i < size; i++) {
- while (i < size && (vm->FEdges()[i]->isSmooth() == b))
+ while (i < size && (vm->FEdges()[i]->isSmooth() == b)) {
i++;
+ }
if (i < size) {
WRITE(i);
b = !b;
@@ -1149,8 +1177,9 @@ int save(ostream &out, ViewMap *vm, ProgressBar *pb)
WRITE(nature);
nature &= ~Nature::VIEW_VERTEX;
for (unsigned int i = 0; i < size; i++) {
- while (i < size && (vm->ViewVertices()[i]->getNature() & nature))
+ while (i < size && (vm->ViewVertices()[i]->getNature() & nature)) {
i++;
+ }
if (i < size) {
WRITE(i);
nature = vm->ViewVertices()[i]->getNature() & ~Nature::VIEW_VERTEX;
@@ -1165,25 +1194,30 @@ int save(ostream &out, ViewMap *vm, ProgressBar *pb)
SET_PROGRESS(1);
for (vector<ViewShape *>::const_iterator i5 = vm->ViewShapes().begin();
i5 != vm->ViewShapes().end();
- i5++)
+ i5++) {
err += Internal::save(out, *i5);
+ }
SET_PROGRESS(2);
- for (vector<FEdge *>::const_iterator i6 = vm->FEdges().begin(); i6 != vm->FEdges().end(); i6++)
+ for (vector<FEdge *>::const_iterator i6 = vm->FEdges().begin(); i6 != vm->FEdges().end(); i6++) {
err += Internal::save(out, *i6);
+ }
SET_PROGRESS(3);
for (vector<SVertex *>::const_iterator i7 = vm->SVertices().begin(); i7 != vm->SVertices().end();
- i7++)
+ i7++) {
err += Internal::save(out, *i7);
+ }
SET_PROGRESS(4);
for (vector<ViewEdge *>::const_iterator i8 = vm->ViewEdges().begin();
i8 != vm->ViewEdges().end();
- i8++)
+ i8++) {
err += Internal::save(out, *i8);
+ }
SET_PROGRESS(5);
for (vector<ViewVertex *>::const_iterator i9 = vm->ViewVertices().begin();
i9 != vm->ViewVertices().end();
- i9++)
+ i9++) {
err += Internal::save(out, *i9);
+ }
// Write the shape id to index mapping
size = vm->shapeIdToIndexMap().size();
@@ -1206,19 +1240,23 @@ int save(ostream &out, ViewMap *vm, ProgressBar *pb)
(*j0)->userdata = NULL;
(*j0)->sshape()->userdata = NULL;
}
- for (vector<FEdge *>::const_iterator j1 = vm->FEdges().begin(); j1 != vm->FEdges().end(); j1++)
+ for (vector<FEdge *>::const_iterator j1 = vm->FEdges().begin(); j1 != vm->FEdges().end(); j1++) {
(*j1)->userdata = NULL;
+ }
for (vector<SVertex *>::const_iterator j2 = vm->SVertices().begin(); j2 != vm->SVertices().end();
- j2++)
+ j2++) {
(*j2)->userdata = NULL;
+ }
for (vector<ViewEdge *>::const_iterator j3 = vm->ViewEdges().begin();
j3 != vm->ViewEdges().end();
- j3++)
+ j3++) {
(*j3)->userdata = NULL;
+ }
for (vector<ViewVertex *>::const_iterator j4 = vm->ViewVertices().begin();
j4 != vm->ViewVertices().end();
- j4++)
+ j4++) {
(*j4)->userdata = NULL;
+ }
SET_PROGRESS(6);
return err;
diff --git a/source/blender/freestyle/intern/view_map/ViewMapIterators.h b/source/blender/freestyle/intern/view_map/ViewMapIterators.h
index 0fb5438a153..174e25896cc 100644
--- a/source/blender/freestyle/intern/view_map/ViewMapIterators.h
+++ b/source/blender/freestyle/intern/view_map/ViewMapIterators.h
@@ -130,20 +130,24 @@ class orientedViewEdgeIterator : public Iterator {
* not. */
virtual bool isBegin() const
{
- if (_Nature & Nature::T_VERTEX)
+ if (_Nature & Nature::T_VERTEX) {
return (_tvertex_iter == _tbegin);
- else
+ }
+ else {
return (_nontvertex_iter == _begin);
+ }
}
/*! Tells whether the ViewEdge pointed by this iterator is after the last one of the iteration
* list or not. */
virtual bool isEnd() const
{
- if (_Nature & Nature::T_VERTEX)
+ if (_Nature & Nature::T_VERTEX) {
return (_tvertex_iter == _tend);
- else
+ }
+ else {
return (_nontvertex_iter == _end);
+ }
}
// operators
@@ -168,10 +172,12 @@ class orientedViewEdgeIterator : public Iterator {
/*! operator != */
virtual bool operator!=(const orientedViewEdgeIterator &b) const
{
- if (_Nature & Nature::T_VERTEX)
+ if (_Nature & Nature::T_VERTEX) {
return (_tvertex_iter != b._tvertex_iter);
- else
+ }
+ else {
return (_nontvertex_iter != b._nontvertex_iter);
+ }
}
/*! operator == */
@@ -186,11 +192,13 @@ class orientedViewEdgeIterator : public Iterator {
*/
virtual ViewVertex::directedViewEdge &operator*() const
{
- if (_Nature & Nature::T_VERTEX)
+ if (_Nature & Nature::T_VERTEX) {
// return _tvertex_iter;
return **_tvertex_iter;
- else
+ }
+ else {
return (*_nontvertex_iter);
+ }
}
/*! Returns a pointer to the pointed orientedViewEdge.
* Can't be called in the scripting language.
@@ -210,8 +218,9 @@ class orientedViewEdgeIterator : public Iterator {
if (_tvertex_iter != _tend) {
// FIXME : pquoi deja ?
ViewVertex::directedViewEdge tmp2 = (**_tvertex_iter);
- if (tmp2.first == tmp.first)
+ if (tmp2.first == tmp.first) {
++_tvertex_iter;
+ }
}
}
else {
@@ -379,8 +388,9 @@ class SVertexIterator : public Interface0DIteratorNested {
virtual bool operator==(const Interface0DIteratorNested &it) const
{
const SVertexIterator *it_exact = dynamic_cast<const SVertexIterator *>(&it);
- if (!it_exact)
+ if (!it_exact) {
return false;
+ }
return (_vertex == it_exact->_vertex);
}
diff --git a/source/blender/freestyle/intern/view_map/ViewMapTesselator.cpp b/source/blender/freestyle/intern/view_map/ViewMapTesselator.cpp
index 8abd464b0cf..8357231a73d 100644
--- a/source/blender/freestyle/intern/view_map/ViewMapTesselator.cpp
+++ b/source/blender/freestyle/intern/view_map/ViewMapTesselator.cpp
@@ -25,8 +25,9 @@ namespace Freestyle {
NodeGroup *ViewMapTesselator::Tesselate(ViewMap *iViewMap)
{
- if (0 == iViewMap->ViewEdges().size())
+ if (0 == iViewMap->ViewEdges().size()) {
return NULL;
+ }
const vector<ViewEdge *> &viewedges = iViewMap->ViewEdges();
return Tesselate(viewedges.begin(), viewedges.end());
diff --git a/source/blender/freestyle/intern/view_map/ViewMapTesselator.h b/source/blender/freestyle/intern/view_map/ViewMapTesselator.h
index f8ae885f5d7..7bb9d649e5d 100644
--- a/source/blender/freestyle/intern/view_map/ViewMapTesselator.h
+++ b/source/blender/freestyle/intern/view_map/ViewMapTesselator.h
@@ -185,8 +185,9 @@ NodeGroup *ViewMapTesselator::Tesselate(ViewEdgesIterator begin, ViewEdgesIterat
#endif
line = new OrientedLineRep();
- if (_overloadFrsMaterial)
+ if (_overloadFrsMaterial) {
line->setFrsMaterial(_FrsMaterial);
+ }
// there might be chains containing a single element
if (0 == (firstEdge)->nextEdge()) {
diff --git a/source/blender/freestyle/intern/winged_edge/Curvature.cpp b/source/blender/freestyle/intern/winged_edge/Curvature.cpp
index 4fb92e35b40..4f2f2dae9af 100644
--- a/source/blender/freestyle/intern/winged_edge/Curvature.cpp
+++ b/source/blender/freestyle/intern/winged_edge/Curvature.cpp
@@ -62,8 +62,9 @@ static bool angle_obtuse(WVertex *v, WFace *f)
static bool triangle_obtuse(WVertex *, WFace *f)
{
bool b = false;
- for (int i = 0; i < 3; i++)
+ for (int i = 0; i < 3; i++) {
b = b || ((f->getEdgeList()[i]->GetVec() * f->getEdgeList()[(i + 1) % 3]->GetVec()) < 0);
+ }
return b;
}
@@ -80,8 +81,9 @@ static real cotan(WVertex *vo, WVertex *v1, WVertex *v2)
/* denom can be zero if u==v. Returning 0 is acceptable, based on the callers of this function
* below. */
- if (denom == 0.0)
+ if (denom == 0.0) {
return 0.0;
+ }
return (udotv / denom);
}
@@ -127,17 +129,20 @@ bool gts_vertex_mean_curvature_normal(WVertex *v, Vec3r &Kh)
{
real area = 0.0;
- if (!v)
+ if (!v) {
return false;
+ }
/* this operator is not defined for boundary edges */
- if (v->isBoundary())
+ if (v->isBoundary()) {
return false;
+ }
WVertex::incoming_edge_iterator itE;
- for (itE = v->incoming_edges_begin(); itE != v->incoming_edges_end(); itE++)
+ for (itE = v->incoming_edges_begin(); itE != v->incoming_edges_end(); itE++) {
area += (*itE)->GetaFace()->getArea();
+ }
Kh = Vec3r(0.0, 0.0, 0.0);
@@ -190,10 +195,12 @@ bool gts_vertex_gaussian_curvature(WVertex *v, real *Kg)
real area = 0.0;
real angle_sum = 0.0;
- if (!v)
+ if (!v) {
return false;
- if (!Kg)
+ }
+ if (!Kg) {
return false;
+ }
/* this operator is not defined for boundary edges */
if (v->isBoundary()) {
@@ -236,11 +243,13 @@ void gts_vertex_principal_curvatures(real Kh, real Kg, real *K1, real *K2)
{
real temp = Kh * Kh - Kg;
- if (!K1 || !K2)
+ if (!K1 || !K2) {
return;
+ }
- if (temp < 0.0)
+ if (temp < 0.0) {
temp = 0.0;
+ }
temp = sqrt(temp);
*K1 = Kh + temp;
*K2 = Kh - temp;
@@ -313,21 +322,25 @@ void gts_vertex_principal_directions(WVertex *v, Vec3r Kh, real Kg, Vec3r &e1, V
*/
N[0] = N[1] = N[2] = 0.0;
- for (itE = v->incoming_edges_begin(); itE != v->incoming_edges_end(); itE++)
+ for (itE = v->incoming_edges_begin(); itE != v->incoming_edges_end(); itE++) {
N = Vec3r(N + (*itE)->GetaFace()->GetNormal());
+ }
real normN = N.norm();
- if (normN <= 0.0)
+ if (normN <= 0.0) {
return;
+ }
N.normalize();
}
/* construct a basis from N: */
/* set basis1 to any component not the largest of N */
basis1[0] = basis1[1] = basis1[2] = 0.0;
- if (fabs(N[0]) > fabs(N[1]))
+ if (fabs(N[0]) > fabs(N[1])) {
basis1[1] = 1.0;
- else
+ }
+ else {
basis1[0] = 1.0;
+ }
/* make basis2 orthogonal to N */
basis2 = (N ^ basis1);
@@ -352,8 +365,9 @@ void gts_vertex_principal_directions(WVertex *v, Vec3r Kh, real Kg, Vec3r &e1, V
WFace *f1, *f2;
real weight, kappa, d1, d2;
Vec3r vec_edge;
- if (!*itE)
+ if (!*itE) {
continue;
+ }
e = *itE;
/* since this vertex passed the tests in gts_vertex_mean_curvature_normal(), this should be
@@ -590,8 +604,9 @@ static bool sphere_clip_vector(const Vec3r &O, real r, const Vec3r &P, Vec3r &V)
void compute_curvature_tensor(WVertex *start, real radius, NormalCycle &nc)
{
// in case we have a non-manifold vertex, skip it...
- if (start->isBoundary())
+ if (start->isBoundary()) {
return;
+ }
std::set<WVertex *> vertices;
const Vec3r &O = start->GetVertex();
@@ -601,8 +616,9 @@ void compute_curvature_tensor(WVertex *start, real radius, NormalCycle &nc)
while (!S.empty()) {
WVertex *v = S.top();
S.pop();
- if (v->isBoundary())
+ if (v->isBoundary()) {
continue;
+ }
const Vec3r &P = v->GetVertex();
WVertex::incoming_edge_iterator woeit = v->incoming_edges_begin();
WVertex::incoming_edge_iterator woeitend = v->incoming_edges_end();
@@ -630,8 +646,9 @@ void compute_curvature_tensor(WVertex *start, real radius, NormalCycle &nc)
void compute_curvature_tensor_one_ring(WVertex *start, NormalCycle &nc)
{
// in case we have a non-manifold vertex, skip it...
- if (start->isBoundary())
+ if (start->isBoundary()) {
return;
+ }
WVertex::incoming_edge_iterator woeit = start->incoming_edges_begin();
WVertex::incoming_edge_iterator woeitend = start->incoming_edges_end();
diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.cpp b/source/blender/freestyle/intern/winged_edge/WEdge.cpp
index 3dc574515c1..d88f7cf5582 100644
--- a/source/blender/freestyle/intern/winged_edge/WEdge.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WEdge.cpp
@@ -97,8 +97,9 @@ void WVertex::incoming_edge_iterator::increment()
WFace *WVertex::face_iterator::operator*()
{
WOEdge *woedge = *_edge_it;
- if (!woedge)
+ if (!woedge) {
return NULL;
+ }
return (woedge)->GetbFace();
}
@@ -110,10 +111,12 @@ bool WVertex::isBoundary() const
#endif
bool WVertex::isBoundary()
{
- if (_Border == 1)
+ if (_Border == 1) {
return true;
- else if (_Border == 0)
+ }
+ else if (_Border == 0) {
return false;
+ }
vector<WEdge *>::const_iterator it;
for (it = _EdgeList.begin(); it != _EdgeList.end(); it++) {
@@ -140,10 +143,12 @@ WVertex::incoming_edge_iterator WVertex::incoming_edges_begin()
WOEdge *begin;
WEdge *wedge = _EdgeList.front();
WOEdge *aOEdge = wedge->GetaOEdge();
- if (aOEdge->GetbVertex() == this)
+ if (aOEdge->GetbVertex() == this) {
begin = aOEdge;
- else
+ }
+ else {
begin = _EdgeList.front()->GetbOEdge();
+ }
return incoming_edge_iterator(this, begin, begin);
}
@@ -151,10 +156,12 @@ WVertex::incoming_edge_iterator WVertex::incoming_edges_end()
{
WOEdge *begin;
WOEdge *aOEdge = _EdgeList.front()->GetaOEdge();
- if (aOEdge->GetbVertex() == this)
+ if (aOEdge->GetbVertex() == this) {
begin = aOEdge;
- else
+ }
+ else {
begin = _EdgeList.front()->GetbOEdge();
+ }
return incoming_edge_iterator(this, begin, 0);
}
#if 0
@@ -226,12 +233,14 @@ WEdge::WEdge(WEdge &iBrother)
WOEdge *boedge = iBrother.GetbOEdge();
userdata = NULL;
- if (aoedge)
+ if (aoedge) {
//_paOEdge = new WOEdge(*aoedge);
_paOEdge = aoedge->duplicate();
- if (boedge)
+ }
+ if (boedge) {
//_pbOEdge = new WOEdge(*boedge);
_pbOEdge = boedge->duplicate();
+ }
_nOEdges = iBrother.GetNumberOfOEdges();
_Id = iBrother.GetId();
@@ -361,8 +370,9 @@ WOEdge *WFace::MakeEdge(WVertex *v1, WVertex *v2)
pOEdge->setbVertex(v2);
// Debug:
- if (v1->GetId() == v2->GetId())
+ if (v1->GetId() == v2->GetId()) {
cerr << "Warning: edge " << this << " null with vertex " << v1->GetId() << endl;
+ }
edge->AddOEdge(pOEdge);
// edge->setNumberOfOEdges(edge->GetNumberOfOEdges() + 1);
@@ -378,26 +388,32 @@ WOEdge *WFace::MakeEdge(WVertex *v1, WVertex *v2)
bool WFace::getOppositeEdge(const WVertex *v, WOEdge *&e)
{
- if (_OEdgeList.size() != 3)
+ if (_OEdgeList.size() != 3) {
return false;
+ }
vector<WOEdge *>::iterator it;
e = NULL;
for (it = _OEdgeList.begin(); it != _OEdgeList.end(); it++) {
- if ((*it)->GetaVertex() == v)
+ if ((*it)->GetaVertex() == v) {
e = *it;
+ }
}
- if (!e)
+ if (!e) {
return false;
+ }
e = NULL;
for (it = _OEdgeList.begin(); it != _OEdgeList.end(); it++) {
- if (((*it)->GetaVertex() != v) && ((*it)->GetbVertex() != v))
+ if (((*it)->GetaVertex() != v) && ((*it)->GetbVertex() != v)) {
e = *it;
+ }
}
- if (!e)
+ if (!e) {
return false;
- else
+ }
+ else {
return true;
+ }
}
float WFace::getArea()
@@ -423,13 +439,15 @@ WOEdge *WFace::GetPrevOEdge(WOEdge *iOEdge)
woe = woefirst;
++woe;
for (; woe != woend; woe++) {
- if ((*woe) == iOEdge)
+ if ((*woe) == iOEdge) {
return prev;
+ }
prev = *woe;
}
// We left the loop. That means that the first OEdge was the good one:
- if ((*woefirst) == iOEdge)
+ if ((*woefirst) == iOEdge) {
return prev;
+ }
return NULL;
}
@@ -511,8 +529,9 @@ WShape::WShape(WShape &iBrother)
WOEdge *aoEdge = (*e)->GetaOEdge();
aoEdge->setaVertex(((vertexdata *)(aoEdge->GetaVertex()->userdata))->_copy);
aoEdge->setbVertex(((vertexdata *)(aoEdge->GetbVertex()->userdata))->_copy);
- if (aoEdge->GetaFace())
+ if (aoEdge->GetaFace()) {
aoEdge->setaFace(((facedata *)(aoEdge->GetaFace()->userdata))->_copy);
+ }
aoEdge->setbFace(((facedata *)(aoEdge->GetbFace()->userdata))->_copy);
aoEdge->setOwner(((edgedata *)(aoEdge->GetOwner()->userdata))->_copy);
@@ -521,8 +540,9 @@ WShape::WShape(WShape &iBrother)
if (boEdge) {
boEdge->setaVertex(((vertexdata *)(boEdge->GetaVertex()->userdata))->_copy);
boEdge->setbVertex(((vertexdata *)(boEdge->GetbVertex()->userdata))->_copy);
- if (boEdge->GetaFace())
+ if (boEdge->GetaFace()) {
boEdge->setaFace(((facedata *)(boEdge->GetaFace()->userdata))->_copy);
+ }
boEdge->setbFace(((facedata *)(boEdge->GetbFace()->userdata))->_copy);
boEdge->setOwner(((edgedata *)(boEdge->GetOwner()->userdata))->_copy);
}
@@ -585,8 +605,9 @@ WFace *WShape::MakeFace(vector<WVertex *> &iVertexList,
WFace *face = instanciateFace();
WFace *result = MakeFace(iVertexList, iFaceEdgeMarksList, iMaterial, face);
- if (!result)
+ if (!result) {
delete face;
+ }
return result;
}
@@ -599,8 +620,9 @@ WFace *WShape::MakeFace(vector<WVertex *> &iVertexList,
// allocate the new face
WFace *face = MakeFace(iVertexList, iFaceEdgeMarksList, iMaterial);
- if (!face)
+ if (!face) {
return NULL;
+ }
// set the list of per-vertex normals
face->setNormalList(iNormalsList);
@@ -665,13 +687,16 @@ WFace *WShape::MakeFace(vector<WVertex *> &iVertexList,
// face->AddVertex(*va);
WOEdge *oedge;
- if (*va == iVertexList.back())
+ if (*va == iVertexList.back()) {
oedge = face->MakeEdge(*va, iVertexList.front()); // for the last (closing) edge
- else
+ }
+ else {
oedge = face->MakeEdge(*va, *vb);
+ }
- if (!oedge)
+ if (!oedge) {
return NULL;
+ }
WEdge *edge = oedge->GetOwner();
if (1 == edge->GetNumberOfOEdges()) {
diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.h b/source/blender/freestyle/intern/winged_edge/WEdge.h
index 1a141629c6d..037e21ab4e3 100644
--- a/source/blender/freestyle/intern/winged_edge/WEdge.h
+++ b/source/blender/freestyle/intern/winged_edge/WEdge.h
@@ -140,10 +140,12 @@ class WVertex {
inline void setBorder(bool b)
{
- if (b)
+ if (b) {
_Border = 1;
- else
+ }
+ else {
_Border = 0;
+ }
}
/*! Adds an edge to the edges list */
@@ -600,8 +602,9 @@ class WEdge {
*/
static inline WVertex *CommonVertex(WEdge *iEdge1, WEdge *iEdge2)
{
- if (!iEdge1 || !iEdge2)
+ if (!iEdge1 || !iEdge2) {
return NULL;
+ }
WVertex *wv1 = iEdge1->GetaOEdge()->GetaVertex();
WVertex *wv2 = iEdge1->GetaOEdge()->GetbVertex();
@@ -665,10 +668,12 @@ class WEdge {
inline WOEdge *GetOtherOEdge(WOEdge *iOEdge)
{
- if (iOEdge == _paOEdge)
+ if (iOEdge == _paOEdge) {
return _pbOEdge;
- else
+ }
+ else {
return _paOEdge;
+ }
}
/*! modifiers */
@@ -809,8 +814,9 @@ class WFace {
for (vector<WOEdge *>::iterator woe = _OEdgeList.begin(), woend = _OEdgeList.end();
woe != woend;
woe++) {
- if ((*woe)->GetaVertex() == iVertex)
+ if ((*woe)->GetaVertex() == iVertex) {
return index;
+ }
++index;
}
return -1;
@@ -831,8 +837,9 @@ class WFace {
woe != woend;
woe++) {
WFace *af;
- if ((af = (*woe)->GetaFace()))
+ if ((af = (*woe)->GetaFace())) {
oWFaces.push_back(af);
+ }
}
}
@@ -896,8 +903,9 @@ class WFace {
vector<WOEdge *>::iterator woe, woend, woefirst;
woefirst = _OEdgeList.begin();
for (woe = woefirst, woend = _OEdgeList.end(); woe != woend; ++woe) {
- if (found)
+ if (found) {
return (*woe);
+ }
if ((*woe) == iOEdge) {
found = true;
@@ -905,8 +913,9 @@ class WFace {
}
// We left the loop. That means that the first OEdge was the good one:
- if (found)
+ if (found) {
return (*woefirst);
+ }
return NULL;
}
@@ -929,8 +938,9 @@ class WFace {
for (vector<WOEdge *>::const_iterator woe = _OEdgeList.begin(), woeend = _OEdgeList.end();
woe != woeend;
++woe) {
- if ((*woe)->GetOwner()->GetbOEdge() == 0)
+ if ((*woe)->GetOwner()->GetbOEdge() == 0) {
return true;
+ }
}
return false;
}
@@ -1250,11 +1260,13 @@ class WShape {
(*e)->ResetUserData();
// manages WOEdge:
WOEdge *oe = (*e)->GetaOEdge();
- if (oe)
+ if (oe) {
oe->ResetUserData();
+ }
oe = (*e)->GetbOEdge();
- if (oe)
+ if (oe) {
oe->ResetUserData();
+ }
}
for (vector<WFace *>::iterator f = _FaceList.begin(), fend = _FaceList.end(); f != fend; f++) {
@@ -1338,8 +1350,9 @@ class WingedEdge {
void clear()
{
- for (vector<WShape *>::iterator it = _wshapes.begin(); it != _wshapes.end(); it++)
+ for (vector<WShape *>::iterator it = _wshapes.begin(); it != _wshapes.end(); it++) {
delete *it;
+ }
_wshapes.clear();
_numFaces = 0;
}
diff --git a/source/blender/freestyle/intern/winged_edge/WFillGrid.cpp b/source/blender/freestyle/intern/winged_edge/WFillGrid.cpp
index 8106bcedd0c..c6b32e0a89c 100644
--- a/source/blender/freestyle/intern/winged_edge/WFillGrid.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WFillGrid.cpp
@@ -26,8 +26,9 @@ namespace Freestyle {
void WFillGrid::fillGrid()
{
- if (!_winged_edge || !_grid)
+ if (!_winged_edge || !_grid) {
return;
+ }
vector<WShape *> wshapes = _winged_edge->getWShapes();
vector<WVertex *> fvertices;
@@ -40,8 +41,9 @@ void WFillGrid::fillGrid()
for (vector<WFace *>::const_iterator f = faces.begin(); f != faces.end(); ++f) {
(*f)->RetrieveVertexList(fvertices);
- for (vector<WVertex *>::const_iterator wv = fvertices.begin(); wv != fvertices.end(); ++wv)
+ for (vector<WVertex *>::const_iterator wv = fvertices.begin(); wv != fvertices.end(); ++wv) {
vectors.push_back(Vec3r((*wv)->GetVertex()));
+ }
// occluder will be deleted by the grid
Polygon3r *occluder = new Polygon3r(vectors, (*f)->GetNormal());
diff --git a/source/blender/freestyle/intern/winged_edge/WFillGrid.h b/source/blender/freestyle/intern/winged_edge/WFillGrid.h
index f9e63464e30..918c1f154f3 100644
--- a/source/blender/freestyle/intern/winged_edge/WFillGrid.h
+++ b/source/blender/freestyle/intern/winged_edge/WFillGrid.h
@@ -62,14 +62,16 @@ class WFillGrid {
/*! Modifiers */
void setWingedEdge(WingedEdge *winged_edge)
{
- if (winged_edge)
+ if (winged_edge) {
_winged_edge = winged_edge;
+ }
}
void setGrid(Grid *grid)
{
- if (grid)
+ if (grid) {
_grid = grid;
+ }
}
private:
diff --git a/source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp b/source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp
index cd13775239b..404a1ae6181 100644
--- a/source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WSFillGrid.cpp
@@ -26,8 +26,9 @@ namespace Freestyle {
void WSFillGrid::fillGrid()
{
- if (!_winged_edge || !_grid)
+ if (!_winged_edge || !_grid) {
return;
+ }
vector<WShape *> wshapes = _winged_edge->getWShapes();
vector<WVertex *> fvertices;
@@ -40,8 +41,9 @@ void WSFillGrid::fillGrid()
for (vector<WFace *>::const_iterator f = faces.begin(); f != faces.end(); ++f) {
(*f)->RetrieveVertexList(fvertices);
- for (vector<WVertex *>::const_iterator wv = fvertices.begin(); wv != fvertices.end(); ++wv)
+ for (vector<WVertex *>::const_iterator wv = fvertices.begin(); wv != fvertices.end(); ++wv) {
vectors.push_back(Vec3r((*wv)->GetVertex()));
+ }
// occluder will be deleted by the grid
Polygon3r *occluder = new Polygon3r(vectors, (*f)->GetNormal());
diff --git a/source/blender/freestyle/intern/winged_edge/WSFillGrid.h b/source/blender/freestyle/intern/winged_edge/WSFillGrid.h
index 2d8ac77a15d..e3deebcd6c2 100644
--- a/source/blender/freestyle/intern/winged_edge/WSFillGrid.h
+++ b/source/blender/freestyle/intern/winged_edge/WSFillGrid.h
@@ -58,14 +58,16 @@ class WSFillGrid {
/*! Modifiers */
void setWingedEdge(WingedEdge *winged_edge)
{
- if (winged_edge)
+ if (winged_edge) {
_winged_edge = winged_edge;
+ }
}
void setGrid(Grid *grid)
{
- if (grid)
+ if (grid) {
_grid = grid;
+ }
}
private:
diff --git a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp
index 2e36790563e..566b046bb2c 100644
--- a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp
@@ -70,8 +70,9 @@ void WXFaceLayer::RetrieveCuspEdgesIndices(vector<int> &oCuspEdges)
WXSmoothEdge *WXFaceLayer::BuildSmoothEdge()
{
// if the smooth edge has already been built: exit
- if (_pSmoothEdge)
+ if (_pSmoothEdge) {
return _pSmoothEdge;
+ }
float ta, tb;
WOEdge *woea(0), *woeb(0);
bool ok = false;
@@ -87,8 +88,9 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge()
//-----------------------------
// We retrieve the 2 edges for which we have opposite signs for each extremity
RetrieveCuspEdgesIndices(cuspEdgesIndices);
- if (cuspEdgesIndices.size() != 2) // we necessarly have 2 cusp edges
+ if (cuspEdgesIndices.size() != 2) { // we necessarly have 2 cusp edges
return 0;
+ }
// let us determine which cusp edge corresponds to the starting:
// We can do that because we defined that a silhouette edge had the back facing part on its
@@ -179,10 +181,12 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge()
_pSmoothEdge->setTb(tb);
if (_Nature & Nature::SILHOUETTE) {
if (_nNullDotP != 2) {
- if (_DotP[_ClosestPointIndex] + 0.01f > 0.0f)
+ if (_DotP[_ClosestPointIndex] + 0.01f > 0.0f) {
_pSmoothEdge->setFront(true);
- else
+ }
+ else {
_pSmoothEdge->setFront(false);
+ }
}
}
}
@@ -266,8 +270,9 @@ WFace *WXShape::MakeFace(vector<WVertex *> &iVertexList,
unsigned iMaterialIndex)
{
WFace *face = WShape::MakeFace(iVertexList, iFaceEdgeMarksList, iMaterialIndex);
- if (!face)
+ if (!face) {
return NULL;
+ }
Vec3f center;
for (vector<WVertex *>::iterator wv = iVertexList.begin(), wvend = iVertexList.end();
diff --git a/source/blender/freestyle/intern/winged_edge/WXEdge.h b/source/blender/freestyle/intern/winged_edge/WXEdge.h
index 0f1b8d77c59..0e8ca62fba3 100644
--- a/source/blender/freestyle/intern/winged_edge/WXEdge.h
+++ b/source/blender/freestyle/intern/winged_edge/WXEdge.h
@@ -67,14 +67,16 @@ class WXVertex : public WVertex {
virtual ~WXVertex()
{
- if (_curvatures)
+ if (_curvatures) {
delete _curvatures;
+ }
}
virtual void Reset()
{
- if (_curvatures)
+ if (_curvatures) {
_curvatures->Kr = 0.0;
+ }
}
inline void setCurvatures(CurvatureInfo *ci)
@@ -365,8 +367,9 @@ class WXFaceLayer {
virtual ~WXFaceLayer()
{
- if (!_DotP.empty())
+ if (!_DotP.empty()) {
_DotP.clear();
+ }
if (_pSmoothEdge) {
delete _pSmoothEdge;
_pSmoothEdge = NULL;
@@ -400,8 +403,9 @@ class WXFaceLayer {
inline bool hasSmoothEdge() const
{
- if (_pSmoothEdge)
+ if (_pSmoothEdge) {
return true;
+ }
return false;
}
@@ -427,8 +431,9 @@ class WXFaceLayer {
inline void removeSmoothEdge()
{
- if (!_DotP.empty())
+ if (!_DotP.empty()) {
_DotP.clear();
+ }
if (_pSmoothEdge) {
delete _pSmoothEdge;
_pSmoothEdge = NULL;
@@ -458,10 +463,12 @@ class WXFaceLayer {
inline void PushDotP(float iDotP)
{
_DotP.push_back(iDotP);
- if (iDotP > 0.0f)
+ if (iDotP > 0.0f) {
++_nPosDotP;
- if (iDotP == 0.0f) // TODO this comparison is weak, check if it actually works
+ }
+ if (iDotP == 0.0f) { // TODO this comparison is weak, check if it actually works
++_nNullDotP;
+ }
}
inline void ReplaceDotP(unsigned int index, float newDotP)
@@ -475,10 +482,12 @@ class WXFaceLayer {
_nPosDotP = 0;
_nNullDotP = 0;
for (vector<float>::iterator d = _DotP.begin(), dend = _DotP.end(); d != dend; ++d) {
- if ((*d) > 0.0f)
+ if ((*d) > 0.0f) {
++_nPosDotP;
- if ((*d) == 0.0f) // TODO ditto
+ }
+ if ((*d) == 0.0f) { // TODO ditto
++_nNullDotP;
+ }
}
}
@@ -637,10 +646,12 @@ class WXFace : public WFace {
inline void setDotP(float iDotP)
{
_dotp = iDotP;
- if (_dotp > 0.0f)
+ if (_dotp > 0.0f) {
_front = true;
- else
+ }
+ else {
_front = false;
+ }
}
inline void AddSmoothLayer(WXFaceLayer *iLayer)
@@ -654,10 +665,12 @@ class WXFace : public WFace {
for (vector<WXFaceLayer *>::iterator wxf = _SmoothLayers.begin(), wxfend = _SmoothLayers.end();
wxf != wxfend;
++wxf) {
- if ((*wxf)->isViewDependant())
+ if ((*wxf)->isViewDependant()) {
delete (*wxf);
- else
+ }
+ else {
layersToKeep.push_back(*wxf);
+ }
}
_SmoothLayers = layersToKeep;
}
@@ -820,12 +833,14 @@ bool WXVertex::isFeature()
int counter = 0;
vector<WEdge *> &vedges = GetEdges();
for (vector<WEdge *>::iterator ve = vedges.begin(), vend = vedges.end(); ve != vend; ++ve) {
- if (((WXEdge *)(*ve))->nature() != Nature::NO_FEATURE)
+ if (((WXEdge *)(*ve))->nature() != Nature::NO_FEATURE) {
counter++;
+ }
}
- if ((counter == 1) || (counter > 2))
+ if ((counter == 1) || (counter > 2)) {
return true;
+ }
return false;
}
diff --git a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp
index a34f2272200..db3719b8d2c 100644
--- a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp
@@ -27,8 +27,9 @@ namespace Freestyle {
void WXEdgeBuilder::visitIndexedFaceSet(IndexedFaceSet &ifs)
{
- if (_pRenderMonitor && _pRenderMonitor->testBreak())
+ if (_pRenderMonitor && _pRenderMonitor->testBreak()) {
return;
+ }
WXShape *shape = new WXShape;
if (!buildWShape(*shape, ifs)) {
delete shape;
diff --git a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp
index f190d78014d..97e9ec2bfd2 100644
--- a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp
@@ -34,8 +34,9 @@ namespace Freestyle {
void WingedEdgeBuilder::visitIndexedFaceSet(IndexedFaceSet &ifs)
{
- if (_pRenderMonitor && _pRenderMonitor->testBreak())
+ if (_pRenderMonitor && _pRenderMonitor->testBreak()) {
return;
+ }
WShape *shape = new WShape;
if (!buildWShape(*shape, ifs)) {
delete shape;
@@ -65,8 +66,9 @@ void WingedEdgeBuilder::visitNodeTransform(NodeTransform &tn)
void WingedEdgeBuilder::visitNodeTransformAfter(NodeTransform &)
{
- if (_current_matrix)
+ if (_current_matrix) {
delete _current_matrix;
+ }
if (_matrices_stack.empty()) {
_current_matrix = NULL;
@@ -108,8 +110,9 @@ bool WingedEdgeBuilder::buildWShape(WShape &shape, IndexedFaceSet &ifs)
vector<FrsMaterial> frs_materials;
if (ifs.msize()) {
const FrsMaterial *const *mats = ifs.frs_materials();
- for (unsigned i = 0; i < ifs.msize(); ++i)
+ for (unsigned i = 0; i < ifs.msize(); ++i) {
frs_materials.push_back(*(mats[i]));
+ }
shape.setFrsMaterials(frs_materials);
}
@@ -136,8 +139,9 @@ bool WingedEdgeBuilder::buildWShape(WShape &shape, IndexedFaceSet &ifs)
}
const unsigned int *mindices = NULL;
- if (ifs.msize())
+ if (ifs.msize()) {
mindices = ifs.mindices();
+ }
const unsigned int *numVertexPerFace = ifs.numVertexPerFaces();
const unsigned int numfaces = ifs.numFaces();
@@ -182,18 +186,21 @@ bool WingedEdgeBuilder::buildWShape(WShape &shape, IndexedFaceSet &ifs)
}
vindices += numVertexPerFace[index];
nindices += numVertexPerFace[index];
- if (mindices)
+ if (mindices) {
mindices += numVertexPerFace[index];
- if (tindices)
+ }
+ if (tindices) {
tindices += numVertexPerFace[index];
+ }
faceEdgeMarks++;
}
delete[] new_vertices;
delete[] new_normals;
- if (shape.GetFaceList().size() == 0) // this may happen due to degenerate triangles
+ if (shape.GetFaceList().size() == 0) { // this may happen due to degenerate triangles
return false;
+ }
#if 0
// compute bbox
@@ -207,11 +214,13 @@ bool WingedEdgeBuilder::buildWShape(WShape &shape, IndexedFaceSet &ifs)
vector<WVertex *> &wvertices = shape.getVertexList();
for (vector<WVertex *>::iterator wv = wvertices.begin(), wvend = wvertices.end(); wv != wvend;
++wv) {
- if ((*wv)->isBoundary())
+ if ((*wv)->isBoundary()) {
continue;
+ }
if ((*wv)->GetEdges().size() ==
- 0) // This means that the WVertex has no incoming edges... (12-Sep-2011 T.K.)
+ 0) { // This means that the WVertex has no incoming edges... (12-Sep-2011 T.K.)
continue;
+ }
normalsSet.clear();
WVertex::face_iterator fit = (*wv)->faces_begin();
WVertex::face_iterator fitend = (*wv)->faces_end();
@@ -400,12 +409,14 @@ void WingedEdgeBuilder::buildTriangles(const float * /*vertices*/,
triangleFaceEdgeMarks.push_back((iFaceEdgeMarks[i] & IndexedFaceSet::EDGE_MARK_V2V3) != 0);
triangleFaceEdgeMarks.push_back((iFaceEdgeMarks[i] & IndexedFaceSet::EDGE_MARK_V3V1) != 0);
}
- if (mindices)
+ if (mindices) {
currentShape->MakeFace(
triangleVertices, triangleNormals, triangleTexCoords, triangleFaceEdgeMarks, mindices[0]);
- else
+ }
+ else {
currentShape->MakeFace(
triangleVertices, triangleNormals, triangleTexCoords, triangleFaceEdgeMarks, 0);
+ }
}
void WingedEdgeBuilder::transformVertices(const float *vertices,
@@ -419,8 +430,9 @@ void WingedEdgeBuilder::transformVertices(const float *vertices,
for (unsigned int i = 0; i < vsize / 3; i++) {
HVec3r hv_tmp(v[0], v[1], v[2]);
HVec3r hv(transform * hv_tmp);
- for (unsigned int j = 0; j < 3; j++)
+ for (unsigned int j = 0; j < 3; j++) {
pv[j] = hv[j] / hv[3];
+ }
v += 3;
pv += 3;
}
@@ -437,8 +449,9 @@ void WingedEdgeBuilder::transformNormals(const float *normals,
for (unsigned int i = 0; i < nsize / 3; i++) {
Vec3r hn(n[0], n[1], n[2]);
hn = GeomUtils::rotateVector(transform, hn);
- for (unsigned int j = 0; j < 3; j++)
+ for (unsigned int j = 0; j < 3; j++) {
pn[j] = hn[j];
+ }
n += 3;
pn += 3;
}
diff --git a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h
index a4aa08d50b6..78b1bcf645f 100644
--- a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h
+++ b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.h
@@ -48,8 +48,9 @@ class WingedEdgeBuilder : public SceneVisitor {
virtual ~WingedEdgeBuilder()
{
for (vector<Matrix44r *>::iterator it = _matrices_stack.begin(); it != _matrices_stack.end();
- ++it)
+ ++it) {
delete *it;
+ }
_matrices_stack.clear();
}