From e12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 17 Apr 2019 06:17:24 +0200 Subject: ClangFormat: apply to source, most of intern Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat --- .../blender/freestyle/intern/python/BPy_BBox.cpp | 115 +- source/blender/freestyle/intern/python/BPy_BBox.h | 5 +- .../intern/python/BPy_BinaryPredicate0D.cpp | 216 ++-- .../intern/python/BPy_BinaryPredicate0D.h | 8 +- .../intern/python/BPy_BinaryPredicate1D.cpp | 270 ++-- .../intern/python/BPy_BinaryPredicate1D.h | 7 +- .../intern/python/BPy_ContextFunctions.cpp | 408 +++--- .../freestyle/intern/python/BPy_Convert.cpp | 990 +++++++------- .../blender/freestyle/intern/python/BPy_Convert.h | 88 +- .../freestyle/intern/python/BPy_Freestyle.cpp | 860 +++++++------ .../freestyle/intern/python/BPy_FrsMaterial.cpp | 797 ++++++------ .../freestyle/intern/python/BPy_FrsMaterial.h | 7 +- .../freestyle/intern/python/BPy_FrsNoise.cpp | 466 +++---- .../blender/freestyle/intern/python/BPy_FrsNoise.h | 7 +- source/blender/freestyle/intern/python/BPy_Id.cpp | 245 ++-- source/blender/freestyle/intern/python/BPy_Id.h | 3 +- .../intern/python/BPy_IntegrationType.cpp | 328 +++-- .../freestyle/intern/python/BPy_IntegrationType.h | 3 +- .../freestyle/intern/python/BPy_Interface0D.cpp | 392 +++--- .../freestyle/intern/python/BPy_Interface0D.h | 8 +- .../freestyle/intern/python/BPy_Interface1D.cpp | 445 ++++--- .../freestyle/intern/python/BPy_Interface1D.h | 9 +- .../freestyle/intern/python/BPy_Iterator.cpp | 304 ++--- .../blender/freestyle/intern/python/BPy_Iterator.h | 4 +- .../freestyle/intern/python/BPy_MediumType.cpp | 114 +- .../freestyle/intern/python/BPy_MediumType.h | 8 +- .../blender/freestyle/intern/python/BPy_Nature.cpp | 417 +++--- .../blender/freestyle/intern/python/BPy_Nature.h | 2 +- .../freestyle/intern/python/BPy_Operators.cpp | 1347 +++++++++++--------- .../freestyle/intern/python/BPy_Operators.h | 3 +- .../blender/freestyle/intern/python/BPy_SShape.cpp | 356 +++--- .../blender/freestyle/intern/python/BPy_SShape.h | 5 +- .../intern/python/BPy_StrokeAttribute.cpp | 985 +++++++------- .../freestyle/intern/python/BPy_StrokeAttribute.h | 8 +- .../freestyle/intern/python/BPy_StrokeShader.cpp | 402 +++--- .../freestyle/intern/python/BPy_StrokeShader.h | 8 +- .../intern/python/BPy_UnaryFunction0D.cpp | 171 +-- .../freestyle/intern/python/BPy_UnaryFunction0D.h | 6 +- .../intern/python/BPy_UnaryFunction1D.cpp | 163 +-- .../freestyle/intern/python/BPy_UnaryFunction1D.h | 6 +- .../intern/python/BPy_UnaryPredicate0D.cpp | 236 ++-- .../freestyle/intern/python/BPy_UnaryPredicate0D.h | 6 +- .../intern/python/BPy_UnaryPredicate1D.cpp | 323 ++--- .../freestyle/intern/python/BPy_UnaryPredicate1D.h | 6 +- .../freestyle/intern/python/BPy_ViewMap.cpp | 236 ++-- .../blender/freestyle/intern/python/BPy_ViewMap.h | 3 +- .../freestyle/intern/python/BPy_ViewShape.cpp | 489 +++---- .../freestyle/intern/python/BPy_ViewShape.h | 7 +- .../python/BinaryPredicate1D/BPy_FalseBP1D.cpp | 109 +- .../python/BinaryPredicate1D/BPy_FalseBP1D.h | 2 +- .../python/BinaryPredicate1D/BPy_Length2DBP1D.cpp | 111 +- .../python/BinaryPredicate1D/BPy_Length2DBP1D.h | 5 +- .../BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp | 109 +- .../python/BinaryPredicate1D/BPy_SameShapeIdBP1D.h | 5 +- .../python/BinaryPredicate1D/BPy_TrueBP1D.cpp | 109 +- .../intern/python/BinaryPredicate1D/BPy_TrueBP1D.h | 2 +- .../BPy_ViewMapGradientNormBP1D.cpp | 157 +-- .../BPy_ViewMapGradientNormBP1D.h | 4 +- .../blender/freestyle/intern/python/Director.cpp | 474 +++---- source/blender/freestyle/intern/python/Director.h | 24 +- .../intern/python/Interface0D/BPy_CurvePoint.cpp | 388 +++--- .../intern/python/Interface0D/BPy_CurvePoint.h | 4 +- .../intern/python/Interface0D/BPy_SVertex.cpp | 652 +++++----- .../intern/python/Interface0D/BPy_SVertex.h | 4 +- .../intern/python/Interface0D/BPy_ViewVertex.cpp | 228 ++-- .../intern/python/Interface0D/BPy_ViewVertex.h | 4 +- .../Interface0D/CurvePoint/BPy_StrokeVertex.cpp | 539 ++++---- .../Interface0D/CurvePoint/BPy_StrokeVertex.h | 7 +- .../Interface0D/ViewVertex/BPy_NonTVertex.cpp | 166 +-- .../python/Interface0D/ViewVertex/BPy_NonTVertex.h | 4 +- .../python/Interface0D/ViewVertex/BPy_TVertex.cpp | 299 ++--- .../python/Interface0D/ViewVertex/BPy_TVertex.h | 4 +- .../intern/python/Interface1D/BPy_FEdge.cpp | 476 +++---- .../intern/python/Interface1D/BPy_FEdge.h | 4 +- .../intern/python/Interface1D/BPy_FrsCurve.cpp | 301 ++--- .../intern/python/Interface1D/BPy_FrsCurve.h | 4 +- .../intern/python/Interface1D/BPy_Stroke.cpp | 658 +++++----- .../intern/python/Interface1D/BPy_Stroke.h | 6 +- .../intern/python/Interface1D/BPy_ViewEdge.cpp | 451 ++++--- .../intern/python/Interface1D/BPy_ViewEdge.h | 4 +- .../intern/python/Interface1D/Curve/BPy_Chain.cpp | 262 ++-- .../intern/python/Interface1D/Curve/BPy_Chain.h | 4 +- .../python/Interface1D/FEdge/BPy_FEdgeSharp.cpp | 572 +++++---- .../python/Interface1D/FEdge/BPy_FEdgeSharp.h | 4 +- .../python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp | 334 ++--- .../python/Interface1D/FEdge/BPy_FEdgeSmooth.h | 7 +- .../python/Iterator/BPy_AdjacencyIterator.cpp | 301 +++-- .../intern/python/Iterator/BPy_AdjacencyIterator.h | 9 +- .../python/Iterator/BPy_ChainPredicateIterator.cpp | 282 ++-- .../python/Iterator/BPy_ChainPredicateIterator.h | 10 +- .../Iterator/BPy_ChainSilhouetteIterator.cpp | 210 +-- .../python/Iterator/BPy_ChainSilhouetteIterator.h | 6 +- .../python/Iterator/BPy_ChainingIterator.cpp | 383 +++--- .../intern/python/Iterator/BPy_ChainingIterator.h | 7 +- .../python/Iterator/BPy_CurvePointIterator.cpp | 222 ++-- .../python/Iterator/BPy_CurvePointIterator.h | 7 +- .../python/Iterator/BPy_Interface0DIterator.cpp | 333 ++--- .../python/Iterator/BPy_Interface0DIterator.h | 11 +- .../intern/python/Iterator/BPy_SVertexIterator.cpp | 267 ++-- .../intern/python/Iterator/BPy_SVertexIterator.h | 7 +- .../python/Iterator/BPy_StrokeVertexIterator.cpp | 427 ++++--- .../python/Iterator/BPy_StrokeVertexIterator.h | 13 +- .../python/Iterator/BPy_ViewEdgeIterator.cpp | 343 ++--- .../intern/python/Iterator/BPy_ViewEdgeIterator.h | 7 +- .../Iterator/BPy_orientedViewEdgeIterator.cpp | 239 ++-- .../python/Iterator/BPy_orientedViewEdgeIterator.h | 10 +- .../StrokeShader/BPy_BackboneStretcherShader.cpp | 127 +- .../StrokeShader/BPy_BackboneStretcherShader.h | 6 +- .../python/StrokeShader/BPy_BezierCurveShader.cpp | 127 +- .../python/StrokeShader/BPy_BezierCurveShader.h | 7 +- .../StrokeShader/BPy_BlenderTextureShader.cpp | 162 +-- .../python/StrokeShader/BPy_BlenderTextureShader.h | 8 +- .../python/StrokeShader/BPy_CalligraphicShader.cpp | 162 +-- .../python/StrokeShader/BPy_CalligraphicShader.h | 4 +- .../python/StrokeShader/BPy_ColorNoiseShader.cpp | 125 +- .../python/StrokeShader/BPy_ColorNoiseShader.h | 7 +- .../StrokeShader/BPy_ConstantColorShader.cpp | 137 +- .../python/StrokeShader/BPy_ConstantColorShader.h | 7 +- .../StrokeShader/BPy_ConstantThicknessShader.cpp | 125 +- .../StrokeShader/BPy_ConstantThicknessShader.h | 6 +- .../BPy_ConstrainedIncreasingThicknessShader.cpp | 138 +- .../BPy_ConstrainedIncreasingThicknessShader.h | 6 +- .../python/StrokeShader/BPy_GuidingLinesShader.cpp | 141 +- .../python/StrokeShader/BPy_GuidingLinesShader.h | 7 +- .../StrokeShader/BPy_IncreasingColorShader.cpp | 168 +-- .../StrokeShader/BPy_IncreasingColorShader.h | 7 +- .../StrokeShader/BPy_IncreasingThicknessShader.cpp | 137 +- .../StrokeShader/BPy_IncreasingThicknessShader.h | 6 +- .../StrokeShader/BPy_PolygonalizationShader.cpp | 139 +- .../StrokeShader/BPy_PolygonalizationShader.h | 6 +- .../python/StrokeShader/BPy_SamplingShader.cpp | 121 +- .../python/StrokeShader/BPy_SamplingShader.h | 7 +- .../python/StrokeShader/BPy_SmoothingShader.cpp | 178 +-- .../python/StrokeShader/BPy_SmoothingShader.h | 7 +- .../python/StrokeShader/BPy_SpatialNoiseShader.cpp | 162 +-- .../python/StrokeShader/BPy_SpatialNoiseShader.h | 7 +- .../StrokeShader/BPy_StrokeTextureStepShader.cpp | 125 +- .../StrokeShader/BPy_StrokeTextureStepShader.h | 7 +- .../StrokeShader/BPy_ThicknessNoiseShader.cpp | 129 +- .../python/StrokeShader/BPy_ThicknessNoiseShader.h | 7 +- .../python/StrokeShader/BPy_TipRemoverShader.cpp | 123 +- .../python/StrokeShader/BPy_TipRemoverShader.h | 7 +- .../UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp | 276 ++-- .../UnaryFunction0D/BPy_UnaryFunction0DDouble.h | 8 +- .../BPy_UnaryFunction0DEdgeNature.cpp | 181 +-- .../BPy_UnaryFunction0DEdgeNature.h | 7 +- .../UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp | 240 ++-- .../UnaryFunction0D/BPy_UnaryFunction0DFloat.h | 8 +- .../UnaryFunction0D/BPy_UnaryFunction0DId.cpp | 174 +-- .../python/UnaryFunction0D/BPy_UnaryFunction0DId.h | 8 +- .../BPy_UnaryFunction0DMaterial.cpp | 181 +-- .../UnaryFunction0D/BPy_UnaryFunction0DMaterial.h | 7 +- .../BPy_UnaryFunction0DUnsigned.cpp | 182 +-- .../UnaryFunction0D/BPy_UnaryFunction0DUnsigned.h | 7 +- .../UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp | 188 +-- .../UnaryFunction0D/BPy_UnaryFunction0DVec2f.h | 8 +- .../UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp | 180 +-- .../UnaryFunction0D/BPy_UnaryFunction0DVec3f.h | 8 +- .../BPy_UnaryFunction0DVectorViewShape.cpp | 196 +-- .../BPy_UnaryFunction0DVectorViewShape.h | 7 +- .../BPy_UnaryFunction0DViewShape.cpp | 198 +-- .../UnaryFunction0D/BPy_UnaryFunction0DViewShape.h | 7 +- .../UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp | 132 +- .../UnaryFunction0D_Id/BPy_ShapeIdF0D.h | 3 +- .../UnaryFunction0D_Material/BPy_MaterialF0D.cpp | 138 +- .../UnaryFunction0D_Material/BPy_MaterialF0D.h | 6 +- .../BPy_CurveNatureF0D.cpp | 120 +- .../BPy_CurveNatureF0D.h | 6 +- .../UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp | 124 +- .../UnaryFunction0D_Vec2f/BPy_Normal2DF0D.h | 6 +- .../BPy_VertexOrientation2DF0D.cpp | 128 +- .../BPy_VertexOrientation2DF0D.h | 5 +- .../BPy_VertexOrientation3DF0D.cpp | 128 +- .../BPy_VertexOrientation3DF0D.h | 5 +- .../BPy_GetOccludeeF0D.cpp | 118 +- .../UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.h | 6 +- .../UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp | 118 +- .../UnaryFunction0D_ViewShape/BPy_GetShapeF0D.h | 6 +- .../BPy_Curvature2DAngleF0D.cpp | 128 +- .../BPy_Curvature2DAngleF0D.h | 6 +- .../UnaryFunction0D_double/BPy_DensityF0D.cpp | 138 +- .../UnaryFunction0D_double/BPy_DensityF0D.h | 3 +- .../BPy_GetProjectedXF0D.cpp | 118 +- .../UnaryFunction0D_double/BPy_GetProjectedXF0D.h | 6 +- .../BPy_GetProjectedYF0D.cpp | 118 +- .../UnaryFunction0D_double/BPy_GetProjectedYF0D.h | 6 +- .../BPy_GetProjectedZF0D.cpp | 118 +- .../UnaryFunction0D_double/BPy_GetProjectedZF0D.h | 6 +- .../UnaryFunction0D_double/BPy_GetXF0D.cpp | 118 +- .../UnaryFunction0D_double/BPy_GetXF0D.h | 3 +- .../UnaryFunction0D_double/BPy_GetYF0D.cpp | 118 +- .../UnaryFunction0D_double/BPy_GetYF0D.h | 3 +- .../UnaryFunction0D_double/BPy_GetZF0D.cpp | 118 +- .../UnaryFunction0D_double/BPy_GetZF0D.h | 3 +- .../BPy_LocalAverageDepthF0D.cpp | 134 +- .../BPy_LocalAverageDepthF0D.h | 6 +- .../BPy_ZDiscontinuityF0D.cpp | 128 +- .../UnaryFunction0D_double/BPy_ZDiscontinuityF0D.h | 6 +- .../BPy_GetCurvilinearAbscissaF0D.cpp | 124 +- .../BPy_GetCurvilinearAbscissaF0D.h | 5 +- .../UnaryFunction0D_float/BPy_GetParameterF0D.cpp | 118 +- .../UnaryFunction0D_float/BPy_GetParameterF0D.h | 6 +- .../BPy_GetViewMapGradientNormF0D.cpp | 134 +- .../BPy_GetViewMapGradientNormF0D.h | 5 +- .../BPy_ReadCompleteViewMapPixelF0D.cpp | 130 +- .../BPy_ReadCompleteViewMapPixelF0D.h | 5 +- .../UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp | 132 +- .../UnaryFunction0D_float/BPy_ReadMapPixelF0D.h | 6 +- .../BPy_ReadSteerableViewMapPixelF0D.cpp | 138 +- .../BPy_ReadSteerableViewMapPixelF0D.h | 5 +- .../BPy_QuantitativeInvisibilityF0D.cpp | 134 +- .../BPy_QuantitativeInvisibilityF0D.h | 5 +- .../BPy_GetOccludersF0D.cpp | 120 +- .../BPy_GetOccludersF0D.h | 6 +- .../UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp | 380 +++--- .../UnaryFunction1D/BPy_UnaryFunction1DDouble.h | 8 +- .../BPy_UnaryFunction1DEdgeNature.cpp | 241 ++-- .../BPy_UnaryFunction1DEdgeNature.h | 7 +- .../UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp | 231 ++-- .../UnaryFunction1D/BPy_UnaryFunction1DFloat.h | 8 +- .../BPy_UnaryFunction1DUnsigned.cpp | 242 ++-- .../UnaryFunction1D/BPy_UnaryFunction1DUnsigned.h | 7 +- .../UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp | 247 ++-- .../UnaryFunction1D/BPy_UnaryFunction1DVec2f.h | 8 +- .../UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp | 239 ++-- .../UnaryFunction1D/BPy_UnaryFunction1DVec3f.h | 8 +- .../BPy_UnaryFunction1DVectorViewShape.cpp | 288 +++-- .../BPy_UnaryFunction1DVectorViewShape.h | 7 +- .../UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp | 267 ++-- .../UnaryFunction1D/BPy_UnaryFunction1DVoid.h | 8 +- .../BPy_CurveNatureF1D.cpp | 139 +- .../BPy_CurveNatureF1D.h | 6 +- .../UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp | 127 +- .../UnaryFunction1D_Vec2f/BPy_Normal2DF1D.h | 6 +- .../UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp | 127 +- .../UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.h | 6 +- .../UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp | 127 +- .../UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.h | 6 +- .../BPy_Curvature2DAngleF1D.cpp | 132 +- .../BPy_Curvature2DAngleF1D.h | 6 +- .../UnaryFunction1D_double/BPy_DensityF1D.cpp | 155 +-- .../UnaryFunction1D_double/BPy_DensityF1D.h | 3 +- .../BPy_GetCompleteViewMapDensityF1D.cpp | 163 +-- .../BPy_GetCompleteViewMapDensityF1D.h | 5 +- .../BPy_GetDirectionalViewMapDensityF1D.cpp | 174 +-- .../BPy_GetDirectionalViewMapDensityF1D.h | 5 +- .../BPy_GetProjectedXF1D.cpp | 127 +- .../UnaryFunction1D_double/BPy_GetProjectedXF1D.h | 6 +- .../BPy_GetProjectedYF1D.cpp | 127 +- .../UnaryFunction1D_double/BPy_GetProjectedYF1D.h | 6 +- .../BPy_GetProjectedZF1D.cpp | 127 +- .../UnaryFunction1D_double/BPy_GetProjectedZF1D.h | 6 +- .../BPy_GetSteerableViewMapDensityF1D.cpp | 156 +-- .../BPy_GetSteerableViewMapDensityF1D.h | 5 +- .../BPy_GetViewMapGradientNormF1D.cpp | 157 +-- .../BPy_GetViewMapGradientNormF1D.h | 7 +- .../UnaryFunction1D_double/BPy_GetXF1D.cpp | 127 +- .../UnaryFunction1D_double/BPy_GetXF1D.h | 3 +- .../UnaryFunction1D_double/BPy_GetYF1D.cpp | 127 +- .../UnaryFunction1D_double/BPy_GetYF1D.h | 3 +- .../UnaryFunction1D_double/BPy_GetZF1D.cpp | 127 +- .../UnaryFunction1D_double/BPy_GetZF1D.h | 3 +- .../BPy_LocalAverageDepthF1D.cpp | 147 +-- .../BPy_LocalAverageDepthF1D.h | 6 +- .../BPy_ZDiscontinuityF1D.cpp | 135 +- .../UnaryFunction1D_double/BPy_ZDiscontinuityF1D.h | 6 +- .../BPy_QuantitativeInvisibilityF1D.cpp | 139 +- .../BPy_QuantitativeInvisibilityF1D.h | 5 +- .../BPy_GetOccludeeF1D.cpp | 114 +- .../BPy_GetOccludeeF1D.h | 6 +- .../BPy_GetOccludersF1D.cpp | 114 +- .../BPy_GetOccludersF1D.h | 6 +- .../BPy_GetShapeF1D.cpp | 114 +- .../BPy_GetShapeF1D.h | 6 +- .../BPy_ChainingTimeStampF1D.cpp | 114 +- .../BPy_ChainingTimeStampF1D.h | 6 +- .../BPy_IncrementChainingTimeStampF1D.cpp | 113 +- .../BPy_IncrementChainingTimeStampF1D.h | 5 +- .../UnaryFunction1D_void/BPy_TimeStampF1D.cpp | 110 +- .../UnaryFunction1D_void/BPy_TimeStampF1D.h | 6 +- .../python/UnaryPredicate0D/BPy_FalseUP0D.cpp | 105 +- .../intern/python/UnaryPredicate0D/BPy_FalseUP0D.h | 2 +- .../python/UnaryPredicate0D/BPy_TrueUP0D.cpp | 105 +- .../intern/python/UnaryPredicate0D/BPy_TrueUP0D.h | 2 +- .../python/UnaryPredicate1D/BPy_ContourUP1D.cpp | 107 +- .../python/UnaryPredicate1D/BPy_ContourUP1D.h | 5 +- .../UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp | 135 +- .../UnaryPredicate1D/BPy_DensityLowerThanUP1D.h | 5 +- .../BPy_EqualToChainingTimeStampUP1D.cpp | 128 +- .../BPy_EqualToChainingTimeStampUP1D.h | 4 +- .../UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp | 127 +- .../UnaryPredicate1D/BPy_EqualToTimeStampUP1D.h | 5 +- .../UnaryPredicate1D/BPy_ExternalContourUP1D.cpp | 115 +- .../UnaryPredicate1D/BPy_ExternalContourUP1D.h | 5 +- .../python/UnaryPredicate1D/BPy_FalseUP1D.cpp | 105 +- .../intern/python/UnaryPredicate1D/BPy_FalseUP1D.h | 2 +- .../BPy_QuantitativeInvisibilityUP1D.cpp | 136 +- .../BPy_QuantitativeInvisibilityUP1D.h | 4 +- .../python/UnaryPredicate1D/BPy_ShapeUP1D.cpp | 129 +- .../intern/python/UnaryPredicate1D/BPy_ShapeUP1D.h | 2 +- .../python/UnaryPredicate1D/BPy_TrueUP1D.cpp | 105 +- .../intern/python/UnaryPredicate1D/BPy_TrueUP1D.h | 2 +- .../BPy_WithinImageBoundaryUP1D.cpp | 129 +- .../UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.h | 4 +- 304 files changed, 18551 insertions(+), 17571 deletions(-) (limited to 'source/blender/freestyle/intern/python') diff --git a/source/blender/freestyle/intern/python/BPy_BBox.cpp b/source/blender/freestyle/intern/python/BPy_BBox.cpp index 0916666e4cc..1f26cb51e01 100644 --- a/source/blender/freestyle/intern/python/BPy_BBox.cpp +++ b/source/blender/freestyle/intern/python/BPy_BBox.cpp @@ -29,88 +29,87 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int BBox_Init(PyObject *module) { - if (module == NULL) - return -1; + if (module == NULL) + return -1; - if (PyType_Ready(&BBox_Type) < 0) - return -1; - Py_INCREF(&BBox_Type); - PyModule_AddObject(module, "BBox", (PyObject *)&BBox_Type); + if (PyType_Ready(&BBox_Type) < 0) + return -1; + Py_INCREF(&BBox_Type); + PyModule_AddObject(module, "BBox", (PyObject *)&BBox_Type); - return 0; + return 0; } //------------------------INSTANCE METHODS ---------------------------------- PyDoc_STRVAR(BBox_doc, -"Class for representing a bounding box.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor."); + "Class for representing a bounding box.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor."); static int BBox_init(BPy_BBox *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->bb = new BBox< Vec3r>(); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->bb = new BBox(); + return 0; } static void BBox_dealloc(BPy_BBox *self) { - delete self->bb; - Py_TYPE(self)->tp_free((PyObject *)self); + delete self->bb; + Py_TYPE(self)->tp_free((PyObject *)self); } static PyObject *BBox_repr(BPy_BBox *self) { - return PyUnicode_FromFormat("BBox - address: %p", self->bb); + return PyUnicode_FromFormat("BBox - address: %p", self->bb); } /*-----------------------BPy_BBox type definition ------------------------------*/ PyTypeObject BBox_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "BBox", /* tp_name */ - sizeof(BPy_BBox), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)BBox_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)BBox_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - BBox_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)BBox_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "BBox", /* tp_name */ + sizeof(BPy_BBox), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)BBox_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)BBox_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + BBox_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)BBox_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_BBox.h b/source/blender/freestyle/intern/python/BPy_BBox.h index 09978308781..84542dc6d1c 100644 --- a/source/blender/freestyle/intern/python/BPy_BBox.h +++ b/source/blender/freestyle/intern/python/BPy_BBox.h @@ -43,20 +43,17 @@ extern PyTypeObject BBox_Type; /*---------------------------Python BPy_BBox structure definition----------*/ typedef struct { - PyObject_HEAD - BBox *bb; + PyObject_HEAD BBox *bb; } BPy_BBox; /*---------------------------Python BPy_BBox visible prototypes-----------*/ int BBox_Init(PyObject *module); - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus } #endif - #endif /* __FREESTYLE_PYTHON_BBOX_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp index 60a85a4594e..6d3c91ed347 100644 --- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.cpp @@ -32,147 +32,157 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int BinaryPredicate0D_Init(PyObject *module) { - if (module == NULL) - return -1; + if (module == NULL) + return -1; - if (PyType_Ready(&BinaryPredicate0D_Type) < 0) - return -1; - Py_INCREF(&BinaryPredicate0D_Type); - PyModule_AddObject(module, "BinaryPredicate0D", (PyObject *)&BinaryPredicate0D_Type); + if (PyType_Ready(&BinaryPredicate0D_Type) < 0) + return -1; + Py_INCREF(&BinaryPredicate0D_Type); + PyModule_AddObject(module, "BinaryPredicate0D", (PyObject *)&BinaryPredicate0D_Type); - return 0; + return 0; } //------------------------INSTANCE METHODS ---------------------------------- static char BinaryPredicate0D___doc__[] = -"Base class for binary predicates working on :class:`Interface0D`\n" -"objects. A BinaryPredicate0D is typically an ordering relation\n" -"between two Interface0D objects. The predicate evaluates a relation\n" -"between the two Interface0D instances and returns a boolean value (true\n" -"or false). It is used by invoking the __call__() method.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __call__(inter1, inter2)\n" -"\n" -" Must be overload by inherited classes. It evaluates a relation\n" -" between two Interface0D objects.\n" -"\n" -" :arg inter1: The first Interface0D object.\n" -" :type inter1: :class:`Interface0D`\n" -" :arg inter2: The second Interface0D object.\n" -" :type inter2: :class:`Interface0D`\n" -" :return: True or false.\n" -" :rtype: bool\n"; + "Base class for binary predicates working on :class:`Interface0D`\n" + "objects. A BinaryPredicate0D is typically an ordering relation\n" + "between two Interface0D objects. The predicate evaluates a relation\n" + "between the two Interface0D instances and returns a boolean value (true\n" + "or false). It is used by invoking the __call__() method.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __call__(inter1, inter2)\n" + "\n" + " Must be overload by inherited classes. It evaluates a relation\n" + " between two Interface0D objects.\n" + "\n" + " :arg inter1: The first Interface0D object.\n" + " :type inter1: :class:`Interface0D`\n" + " :arg inter2: The second Interface0D object.\n" + " :type inter2: :class:`Interface0D`\n" + " :return: True or false.\n" + " :rtype: bool\n"; static int BinaryPredicate0D___init__(BPy_BinaryPredicate0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->bp0D = new BinaryPredicate0D(); - self->bp0D->py_bp0D = (PyObject *)self; - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->bp0D = new BinaryPredicate0D(); + self->bp0D->py_bp0D = (PyObject *)self; + return 0; } static void BinaryPredicate0D___dealloc__(BPy_BinaryPredicate0D *self) { - if (self->bp0D) - delete self->bp0D; - Py_TYPE(self)->tp_free((PyObject *)self); + if (self->bp0D) + delete self->bp0D; + Py_TYPE(self)->tp_free((PyObject *)self); } static PyObject *BinaryPredicate0D___repr__(BPy_BinaryPredicate0D *self) { - return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->bp0D); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->bp0D); } -static PyObject *BinaryPredicate0D___call__(BPy_BinaryPredicate0D *self, PyObject *args, PyObject *kwds) +static PyObject *BinaryPredicate0D___call__(BPy_BinaryPredicate0D *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"inter1", "inter2", NULL}; - BPy_Interface0D *obj1, *obj2; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O!", (char **)kwlist, - &Interface0D_Type, &obj1, &Interface0D_Type, &obj2)) - { - return NULL; - } - if (typeid(*(self->bp0D)) == typeid(BinaryPredicate0D)) { - PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; - } - if (self->bp0D->operator()(*(obj1->if0D), *(obj2->if0D)) < 0) { - if (!PyErr_Occurred()) { - string class_name(Py_TYPE(self)->tp_name); - PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); - } - return NULL; - } - return PyBool_from_bool(self->bp0D->result); + static const char *kwlist[] = {"inter1", "inter2", NULL}; + BPy_Interface0D *obj1, *obj2; + + if (!PyArg_ParseTupleAndKeywords(args, + kwds, + "O!O!", + (char **)kwlist, + &Interface0D_Type, + &obj1, + &Interface0D_Type, + &obj2)) { + return NULL; + } + if (typeid(*(self->bp0D)) == typeid(BinaryPredicate0D)) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->bp0D->operator()(*(obj1->if0D), *(obj2->if0D)) < 0) { + if (!PyErr_Occurred()) { + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); + } + return NULL; + } + return PyBool_from_bool(self->bp0D->result); } /*----------------------BinaryPredicate0D get/setters ----------------------------*/ PyDoc_STRVAR(BinaryPredicate0D_name_doc, -"The name of the binary 0D predicate.\n" -"\n" -":type: str"); + "The name of the binary 0D predicate.\n" + "\n" + ":type: str"); static PyObject *BinaryPredicate0D_name_get(BPy_BinaryPredicate0D *self, void *UNUSED(closure)) { - return PyUnicode_FromString(Py_TYPE(self)->tp_name); + return PyUnicode_FromString(Py_TYPE(self)->tp_name); } static PyGetSetDef BPy_BinaryPredicate0D_getseters[] = { - {(char *)"name", (getter)BinaryPredicate0D_name_get, (setter)NULL, (char *)BinaryPredicate0D_name_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"name", + (getter)BinaryPredicate0D_name_get, + (setter)NULL, + (char *)BinaryPredicate0D_name_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_BinaryPredicate0D type definition ------------------------------*/ PyTypeObject BinaryPredicate0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "BinaryPredicate0D", /* tp_name */ - sizeof(BPy_BinaryPredicate0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)BinaryPredicate0D___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)BinaryPredicate0D___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)BinaryPredicate0D___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - BinaryPredicate0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_BinaryPredicate0D_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)BinaryPredicate0D___init__, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "BinaryPredicate0D", /* tp_name */ + sizeof(BPy_BinaryPredicate0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)BinaryPredicate0D___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)BinaryPredicate0D___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)BinaryPredicate0D___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + BinaryPredicate0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + BPy_BinaryPredicate0D_getseters, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)BinaryPredicate0D___init__, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.h b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.h index 6e27872d48a..3d0575a676c 100644 --- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.h +++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate0D.h @@ -37,24 +37,22 @@ extern "C" { extern PyTypeObject BinaryPredicate0D_Type; -#define BPy_BinaryPredicate0D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&BinaryPredicate0D_Type)) +#define BPy_BinaryPredicate0D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&BinaryPredicate0D_Type)) /*---------------------------Python BPy_BinaryPredicate0D structure definition----------*/ typedef struct { - PyObject_HEAD - BinaryPredicate0D *bp0D; + PyObject_HEAD BinaryPredicate0D *bp0D; } BPy_BinaryPredicate0D; /*---------------------------Python BPy_BinaryPredicate0D visible prototypes-----------*/ int BinaryPredicate0D_Init(PyObject *module); - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus } #endif - #endif /* __FREESTYLE_PYTHON_BINARYPREDICATE0D_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp index b745d0ed628..5b3f3945549 100644 --- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.cpp @@ -38,171 +38,181 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int BinaryPredicate1D_Init(PyObject *module) { - if (module == NULL) - return -1; - - 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) - return -1; - Py_INCREF(&FalseBP1D_Type); - PyModule_AddObject(module, "FalseBP1D", (PyObject *)&FalseBP1D_Type); - - 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) - return -1; - Py_INCREF(&SameShapeIdBP1D_Type); - PyModule_AddObject(module, "SameShapeIdBP1D", (PyObject *)&SameShapeIdBP1D_Type); - - 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) - return -1; - Py_INCREF(&ViewMapGradientNormBP1D_Type); - PyModule_AddObject(module, "ViewMapGradientNormBP1D", (PyObject *)&ViewMapGradientNormBP1D_Type); - - return 0; + if (module == NULL) + return -1; + + 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) + return -1; + Py_INCREF(&FalseBP1D_Type); + PyModule_AddObject(module, "FalseBP1D", (PyObject *)&FalseBP1D_Type); + + 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) + return -1; + Py_INCREF(&SameShapeIdBP1D_Type); + PyModule_AddObject(module, "SameShapeIdBP1D", (PyObject *)&SameShapeIdBP1D_Type); + + 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) + return -1; + Py_INCREF(&ViewMapGradientNormBP1D_Type); + PyModule_AddObject(module, "ViewMapGradientNormBP1D", (PyObject *)&ViewMapGradientNormBP1D_Type); + + return 0; } //------------------------INSTANCE METHODS ---------------------------------- static char BinaryPredicate1D___doc__[] = -"Base class for binary predicates working on :class:`Interface1D`\n" -"objects. A BinaryPredicate1D is typically an ordering relation\n" -"between two Interface1D objects. The predicate evaluates a relation\n" -"between the two Interface1D instances and returns a boolean value (true\n" -"or false). It is used by invoking the __call__() method.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __call__(inter1, inter2)\n" -"\n" -" Must be overload by inherited classes. It evaluates a relation\n" -" between two Interface1D objects.\n" -"\n" -" :arg inter1: The first Interface1D object.\n" -" :type inter1: :class:`Interface1D`\n" -" :arg inter2: The second Interface1D object.\n" -" :type inter2: :class:`Interface1D`\n" -" :return: True or false.\n" -" :rtype: bool\n"; + "Base class for binary predicates working on :class:`Interface1D`\n" + "objects. A BinaryPredicate1D is typically an ordering relation\n" + "between two Interface1D objects. The predicate evaluates a relation\n" + "between the two Interface1D instances and returns a boolean value (true\n" + "or false). It is used by invoking the __call__() method.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __call__(inter1, inter2)\n" + "\n" + " Must be overload by inherited classes. It evaluates a relation\n" + " between two Interface1D objects.\n" + "\n" + " :arg inter1: The first Interface1D object.\n" + " :type inter1: :class:`Interface1D`\n" + " :arg inter2: The second Interface1D object.\n" + " :type inter2: :class:`Interface1D`\n" + " :return: True or false.\n" + " :rtype: bool\n"; static int BinaryPredicate1D___init__(BPy_BinaryPredicate1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->bp1D = new BinaryPredicate1D(); - self->bp1D->py_bp1D = (PyObject *)self; - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->bp1D = new BinaryPredicate1D(); + self->bp1D->py_bp1D = (PyObject *)self; + return 0; } static void BinaryPredicate1D___dealloc__(BPy_BinaryPredicate1D *self) { - if (self->bp1D) - delete self->bp1D; - Py_TYPE(self)->tp_free((PyObject *)self); + if (self->bp1D) + delete self->bp1D; + Py_TYPE(self)->tp_free((PyObject *)self); } static PyObject *BinaryPredicate1D___repr__(BPy_BinaryPredicate1D *self) { - return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->bp1D); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->bp1D); } -static PyObject *BinaryPredicate1D___call__(BPy_BinaryPredicate1D *self, PyObject *args, PyObject *kwds) +static PyObject *BinaryPredicate1D___call__(BPy_BinaryPredicate1D *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"inter1", "inter2", NULL}; - BPy_Interface1D *obj1, *obj2; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O!", (char **)kwlist, - &Interface1D_Type, &obj1, &Interface1D_Type, &obj2)) - { - return NULL; - } - if (typeid(*(self->bp1D)) == typeid(BinaryPredicate1D)) { - PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; - } - if (self->bp1D->operator()(*(obj1->if1D), *(obj2->if1D)) < 0) { - if (!PyErr_Occurred()) { - string class_name(Py_TYPE(self)->tp_name); - PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); - } - return NULL; - } - return PyBool_from_bool(self->bp1D->result); + static const char *kwlist[] = {"inter1", "inter2", NULL}; + BPy_Interface1D *obj1, *obj2; + + if (!PyArg_ParseTupleAndKeywords(args, + kwds, + "O!O!", + (char **)kwlist, + &Interface1D_Type, + &obj1, + &Interface1D_Type, + &obj2)) { + return NULL; + } + if (typeid(*(self->bp1D)) == typeid(BinaryPredicate1D)) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->bp1D->operator()(*(obj1->if1D), *(obj2->if1D)) < 0) { + if (!PyErr_Occurred()) { + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); + } + return NULL; + } + return PyBool_from_bool(self->bp1D->result); } /*----------------------BinaryPredicate0D get/setters ----------------------------*/ PyDoc_STRVAR(BinaryPredicate1D_name_doc, -"The name of the binary 1D predicate.\n" -"\n" -":type: str"); + "The name of the binary 1D predicate.\n" + "\n" + ":type: str"); static PyObject *BinaryPredicate1D_name_get(BPy_BinaryPredicate1D *self, void *UNUSED(closure)) { - return PyUnicode_FromString(Py_TYPE(self)->tp_name); + return PyUnicode_FromString(Py_TYPE(self)->tp_name); } static PyGetSetDef BPy_BinaryPredicate1D_getseters[] = { - {(char *)"name", (getter)BinaryPredicate1D_name_get, (setter)NULL, (char *)BinaryPredicate1D_name_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"name", + (getter)BinaryPredicate1D_name_get, + (setter)NULL, + (char *)BinaryPredicate1D_name_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_BinaryPredicate1D type definition ------------------------------*/ PyTypeObject BinaryPredicate1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "BinaryPredicate1D", /* tp_name */ - sizeof(BPy_BinaryPredicate1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)BinaryPredicate1D___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)BinaryPredicate1D___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)BinaryPredicate1D___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - BinaryPredicate1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_BinaryPredicate1D_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)BinaryPredicate1D___init__, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "BinaryPredicate1D", /* tp_name */ + sizeof(BPy_BinaryPredicate1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)BinaryPredicate1D___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)BinaryPredicate1D___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)BinaryPredicate1D___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + BinaryPredicate1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + BPy_BinaryPredicate1D_getseters, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)BinaryPredicate1D___init__, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.h b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.h index 20a660e3a3f..b258f293694 100644 --- a/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.h +++ b/source/blender/freestyle/intern/python/BPy_BinaryPredicate1D.h @@ -37,12 +37,12 @@ extern "C" { extern PyTypeObject BinaryPredicate1D_Type; -#define BPy_BinaryPredicate1D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&BinaryPredicate1D_Type)) +#define BPy_BinaryPredicate1D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&BinaryPredicate1D_Type)) /*---------------------------Python BPy_BinaryPredicate1D structure definition----------*/ typedef struct { - PyObject_HEAD - BinaryPredicate1D *bp1D; + PyObject_HEAD BinaryPredicate1D *bp1D; } BPy_BinaryPredicate1D; /*---------------------------Python BPy_BinaryPredicate1D visible prototypes-----------*/ @@ -55,5 +55,4 @@ int BinaryPredicate1D_Init(PyObject *module); } #endif - #endif /* __FREESTYLE_PYTHON_BINARYPREDICATE1D_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp index 371a549e0e3..a2e483dec7e 100644 --- a/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp +++ b/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp @@ -34,206 +34,206 @@ extern "C" { //------------------------ MODULE FUNCTIONS ---------------------------------- static char ContextFunctions_get_time_stamp___doc__[] = -".. function:: get_time_stamp()\n" -"\n" -" Returns the system time stamp.\n" -"\n" -" :return: The system time stamp.\n" -" :rtype: int\n"; - -static PyObject * -ContextFunctions_get_time_stamp(PyObject * /*self*/) + ".. function:: get_time_stamp()\n" + "\n" + " Returns the system time stamp.\n" + "\n" + " :return: The system time stamp.\n" + " :rtype: int\n"; + +static PyObject *ContextFunctions_get_time_stamp(PyObject * /*self*/) { - return PyLong_FromLong(ContextFunctions::GetTimeStampCF()); + return PyLong_FromLong(ContextFunctions::GetTimeStampCF()); } static char ContextFunctions_get_canvas_width___doc__[] = -".. method:: get_canvas_width()\n" -"\n" -" Returns the canvas width.\n" -"\n" -" :return: The canvas width.\n" -" :rtype: int\n"; - -static PyObject * -ContextFunctions_get_canvas_width(PyObject * /*self*/) + ".. method:: get_canvas_width()\n" + "\n" + " Returns the canvas width.\n" + "\n" + " :return: The canvas width.\n" + " :rtype: int\n"; + +static PyObject *ContextFunctions_get_canvas_width(PyObject * /*self*/) { - return PyLong_FromLong(ContextFunctions::GetCanvasWidthCF()); + return PyLong_FromLong(ContextFunctions::GetCanvasWidthCF()); } static char ContextFunctions_get_canvas_height___doc__[] = -".. method:: get_canvas_height()\n" -"\n" -" Returns the canvas height.\n" -"\n" -" :return: The canvas height.\n" -" :rtype: int\n"; - -static PyObject * -ContextFunctions_get_canvas_height(PyObject * /*self*/) + ".. method:: get_canvas_height()\n" + "\n" + " Returns the canvas height.\n" + "\n" + " :return: The canvas height.\n" + " :rtype: int\n"; + +static PyObject *ContextFunctions_get_canvas_height(PyObject * /*self*/) { - return PyLong_FromLong(ContextFunctions::GetCanvasHeightCF()); + return PyLong_FromLong(ContextFunctions::GetCanvasHeightCF()); } static char ContextFunctions_get_border___doc__[] = -".. method:: get_border()\n" -"\n" -" Returns the border.\n" -"\n" -" :return: A tuple of 4 numbers (xmin, ymin, xmax, ymax).\n" -" :rtype: tuple\n"; - -static PyObject * -ContextFunctions_get_border(PyObject * /*self*/) + ".. method:: get_border()\n" + "\n" + " Returns the border.\n" + "\n" + " :return: A tuple of 4 numbers (xmin, ymin, xmax, ymax).\n" + " :rtype: tuple\n"; + +static PyObject *ContextFunctions_get_border(PyObject * /*self*/) { - BBox border(ContextFunctions::GetBorderCF()); - PyObject *v = PyTuple_New(4); - PyTuple_SET_ITEMS(v, - PyLong_FromLong(border.getMin().x()), - PyLong_FromLong(border.getMin().y()), - PyLong_FromLong(border.getMax().x()), - PyLong_FromLong(border.getMax().y())); - return v; + BBox border(ContextFunctions::GetBorderCF()); + PyObject *v = PyTuple_New(4); + PyTuple_SET_ITEMS(v, + PyLong_FromLong(border.getMin().x()), + PyLong_FromLong(border.getMin().y()), + PyLong_FromLong(border.getMax().x()), + PyLong_FromLong(border.getMax().y())); + return v; } static char ContextFunctions_load_map___doc__[] = -".. function:: load_map(file_name, map_name, num_levels=4, sigma=1.0)\n" -"\n" -" Loads an image map for further reading.\n" -"\n" -" :arg file_name: The name of the image file.\n" -" :type file_name: str\n" -" :arg map_name: The name that will be used to access this image.\n" -" :type map_name: str\n" -" :arg num_levels: The number of levels in the map pyramid\n" -" (default = 4). If num_levels == 0, the complete pyramid is\n" -" built.\n" -" :type num_levels: int\n" -" :arg sigma: The sigma value of the gaussian function.\n" -" :type sigma: float\n"; - -static PyObject * -ContextFunctions_load_map(PyObject * /*self*/, PyObject *args, PyObject *kwds) + ".. function:: load_map(file_name, map_name, num_levels=4, sigma=1.0)\n" + "\n" + " Loads an image map for further reading.\n" + "\n" + " :arg file_name: The name of the image file.\n" + " :type file_name: str\n" + " :arg map_name: The name that will be used to access this image.\n" + " :type map_name: str\n" + " :arg num_levels: The number of levels in the map pyramid\n" + " (default = 4). If num_levels == 0, the complete pyramid is\n" + " built.\n" + " :type num_levels: int\n" + " :arg sigma: The sigma value of the gaussian function.\n" + " :type sigma: float\n"; + +static PyObject *ContextFunctions_load_map(PyObject * /*self*/, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"file_name", "map_name", "num_levels", "sigma", NULL}; - char *fileName, *mapName; - unsigned nbLevels = 4; - float sigma = 1.0; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "ss|If", (char **)kwlist, &fileName, &mapName, &nbLevels, &sigma)) - return NULL; - ContextFunctions::LoadMapCF(fileName, mapName, nbLevels, sigma); - Py_RETURN_NONE; + static const char *kwlist[] = {"file_name", "map_name", "num_levels", "sigma", NULL}; + char *fileName, *mapName; + unsigned nbLevels = 4; + float sigma = 1.0; + + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "ss|If", (char **)kwlist, &fileName, &mapName, &nbLevels, &sigma)) + return NULL; + ContextFunctions::LoadMapCF(fileName, mapName, nbLevels, sigma); + Py_RETURN_NONE; } static char ContextFunctions_read_map_pixel___doc__[] = -".. function:: read_map_pixel(map_name, level, x, y)\n" -"\n" -" Reads a pixel in a user-defined map.\n" -"\n" -" :arg map_name: The name of the map.\n" -" :type map_name: str\n" -" :arg level: The level of the pyramid in which we wish to read the\n" -" pixel.\n" -" :type level: int\n" -" :arg x: The x coordinate of the pixel we wish to read. The origin\n" -" is in the lower-left corner.\n" -" :type x: int\n" -" :arg y: The y coordinate of the pixel we wish to read. The origin\n" -" is in the lower-left corner.\n" -" :type y: int\n" -" :return: The floating-point value stored for that pixel.\n" -" :rtype: float\n"; - -static PyObject * -ContextFunctions_read_map_pixel(PyObject * /*self*/, PyObject *args, PyObject *kwds) + ".. function:: read_map_pixel(map_name, level, x, y)\n" + "\n" + " Reads a pixel in a user-defined map.\n" + "\n" + " :arg map_name: The name of the map.\n" + " :type map_name: str\n" + " :arg level: The level of the pyramid in which we wish to read the\n" + " pixel.\n" + " :type level: int\n" + " :arg x: The x coordinate of the pixel we wish to read. The origin\n" + " is in the lower-left corner.\n" + " :type x: int\n" + " :arg y: The y coordinate of the pixel we wish to read. The origin\n" + " is in the lower-left corner.\n" + " :type y: int\n" + " :return: The floating-point value stored for that pixel.\n" + " :rtype: float\n"; + +static PyObject *ContextFunctions_read_map_pixel(PyObject * /*self*/, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"map_name", "level", "x", "y", NULL}; - char *mapName; - int level; - unsigned 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)); + static const char *kwlist[] = {"map_name", "level", "x", "y", NULL}; + char *mapName; + int level; + unsigned 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)); } static char ContextFunctions_read_complete_view_map_pixel___doc__[] = -".. function:: read_complete_view_map_pixel(level, x, y)\n" -"\n" -" Reads a pixel in the complete view map.\n" -"\n" -" :arg level: The level of the pyramid in which we wish to read the\n" -" pixel.\n" -" :type level: int\n" -" :arg x: The x coordinate of the pixel we wish to read. The origin\n" -" is in the lower-left corner.\n" -" :type x: int\n" -" :arg y: The y coordinate of the pixel we wish to read. The origin\n" -" is in the lower-left corner.\n" -" :type y: int\n" -" :return: The floating-point value stored for that pixel.\n" -" :rtype: float\n"; - -static PyObject * -ContextFunctions_read_complete_view_map_pixel(PyObject * /*self*/, PyObject *args, PyObject *kwds) + ".. function:: read_complete_view_map_pixel(level, x, y)\n" + "\n" + " Reads a pixel in the complete view map.\n" + "\n" + " :arg level: The level of the pyramid in which we wish to read the\n" + " pixel.\n" + " :type level: int\n" + " :arg x: The x coordinate of the pixel we wish to read. The origin\n" + " is in the lower-left corner.\n" + " :type x: int\n" + " :arg y: The y coordinate of the pixel we wish to read. The origin\n" + " is in the lower-left corner.\n" + " :type y: int\n" + " :return: The floating-point value stored for that pixel.\n" + " :rtype: float\n"; + +static PyObject *ContextFunctions_read_complete_view_map_pixel(PyObject * /*self*/, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"level", "x", "y", NULL}; - int level; - unsigned x, y; + static const char *kwlist[] = {"level", "x", "y", NULL}; + int level; + unsigned x, y; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "iII", (char **)kwlist, &level, &x, &y)) - return NULL; - return PyFloat_FromDouble(ContextFunctions::ReadCompleteViewMapPixelCF(level, x, y)); + if (!PyArg_ParseTupleAndKeywords(args, kwds, "iII", (char **)kwlist, &level, &x, &y)) + return NULL; + return PyFloat_FromDouble(ContextFunctions::ReadCompleteViewMapPixelCF(level, x, y)); } static char ContextFunctions_read_directional_view_map_pixel___doc__[] = -".. function:: read_directional_view_map_pixel(orientation, level, x, y)\n" -"\n" -" Reads a pixel in one of the oriented view map images.\n" -"\n" -" :arg orientation: The number telling which orientation we want to\n" -" check.\n" -" :type orientation: int\n" -" :arg level: The level of the pyramid in which we wish to read the\n" -" pixel.\n" -" :type level: int\n" -" :arg x: The x coordinate of the pixel we wish to read. The origin\n" -" is in the lower-left corner.\n" -" :type x: int\n" -" :arg y: The y coordinate of the pixel we wish to read. The origin\n" -" is in the lower-left corner.\n" -" :type y: int\n" -" :return: The floating-point value stored for that pixel.\n" -" :rtype: float\n"; - -static PyObject * -ContextFunctions_read_directional_view_map_pixel(PyObject * /*self*/, PyObject *args, PyObject *kwds) + ".. function:: read_directional_view_map_pixel(orientation, level, x, y)\n" + "\n" + " Reads a pixel in one of the oriented view map images.\n" + "\n" + " :arg orientation: The number telling which orientation we want to\n" + " check.\n" + " :type orientation: int\n" + " :arg level: The level of the pyramid in which we wish to read the\n" + " pixel.\n" + " :type level: int\n" + " :arg x: The x coordinate of the pixel we wish to read. The origin\n" + " is in the lower-left corner.\n" + " :type x: int\n" + " :arg y: The y coordinate of the pixel we wish to read. The origin\n" + " is in the lower-left corner.\n" + " :type y: int\n" + " :return: The floating-point value stored for that pixel.\n" + " :rtype: float\n"; + +static PyObject *ContextFunctions_read_directional_view_map_pixel(PyObject * /*self*/, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"orientation", "level", "x", "y", NULL}; - int orientation, level; - unsigned x, y; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "iiII", (char **)kwlist, &orientation, &level, &x, &y)) - return NULL; - return PyFloat_FromDouble(ContextFunctions::ReadDirectionalViewMapPixelCF(orientation, level, x, y)); + static const char *kwlist[] = {"orientation", "level", "x", "y", NULL}; + int orientation, level; + unsigned x, y; + + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "iiII", (char **)kwlist, &orientation, &level, &x, &y)) + return NULL; + return PyFloat_FromDouble( + ContextFunctions::ReadDirectionalViewMapPixelCF(orientation, level, x, y)); } static char ContextFunctions_get_selected_fedge___doc__[] = -".. function:: get_selected_fedge()\n" -"\n" -" Returns the selected FEdge.\n" -"\n" -" :return: The selected FEdge.\n" -" :rtype: :class:`FEdge`\n"; - -static PyObject * -ContextFunctions_get_selected_fedge(PyObject * /*self*/) + ".. function:: get_selected_fedge()\n" + "\n" + " Returns the selected FEdge.\n" + "\n" + " :return: The selected FEdge.\n" + " :rtype: :class:`FEdge`\n"; + +static PyObject *ContextFunctions_get_selected_fedge(PyObject * /*self*/) { - FEdge *fe = ContextFunctions::GetSelectedFEdgeCF(); - if (fe) - return Any_BPy_FEdge_from_FEdge(*fe); - Py_RETURN_NONE; + FEdge *fe = ContextFunctions::GetSelectedFEdgeCF(); + if (fe) + return Any_BPy_FEdge_from_FEdge(*fe); + Py_RETURN_NONE; } /*-----------------------ContextFunctions module docstring-------------------------------*/ @@ -243,27 +243,43 @@ static char module_docstring[] = "The Blender Freestyle.ContextFunctions submodu /*-----------------------ContextFunctions module functions definitions-------------------*/ static PyMethodDef module_functions[] = { - {"get_time_stamp", (PyCFunction)ContextFunctions_get_time_stamp, METH_NOARGS, - ContextFunctions_get_time_stamp___doc__}, - {"get_canvas_width", (PyCFunction)ContextFunctions_get_canvas_width, METH_NOARGS, - ContextFunctions_get_canvas_width___doc__}, - {"get_canvas_height", (PyCFunction)ContextFunctions_get_canvas_height, METH_NOARGS, - ContextFunctions_get_canvas_height___doc__}, - {"get_border", (PyCFunction)ContextFunctions_get_border, METH_NOARGS, - ContextFunctions_get_border___doc__}, - {"load_map", (PyCFunction)ContextFunctions_load_map, METH_VARARGS | METH_KEYWORDS, - ContextFunctions_load_map___doc__}, - {"read_map_pixel", (PyCFunction)ContextFunctions_read_map_pixel, METH_VARARGS | METH_KEYWORDS, - ContextFunctions_read_map_pixel___doc__}, - {"read_complete_view_map_pixel", (PyCFunction)ContextFunctions_read_complete_view_map_pixel, - METH_VARARGS | METH_KEYWORDS, - ContextFunctions_read_complete_view_map_pixel___doc__}, - {"read_directional_view_map_pixel", (PyCFunction)ContextFunctions_read_directional_view_map_pixel, - METH_VARARGS | METH_KEYWORDS, - ContextFunctions_read_directional_view_map_pixel___doc__}, - {"get_selected_fedge", (PyCFunction)ContextFunctions_get_selected_fedge, METH_NOARGS, - ContextFunctions_get_selected_fedge___doc__}, - {NULL, NULL, 0, NULL}, + {"get_time_stamp", + (PyCFunction)ContextFunctions_get_time_stamp, + METH_NOARGS, + ContextFunctions_get_time_stamp___doc__}, + {"get_canvas_width", + (PyCFunction)ContextFunctions_get_canvas_width, + METH_NOARGS, + ContextFunctions_get_canvas_width___doc__}, + {"get_canvas_height", + (PyCFunction)ContextFunctions_get_canvas_height, + METH_NOARGS, + ContextFunctions_get_canvas_height___doc__}, + {"get_border", + (PyCFunction)ContextFunctions_get_border, + METH_NOARGS, + ContextFunctions_get_border___doc__}, + {"load_map", + (PyCFunction)ContextFunctions_load_map, + METH_VARARGS | METH_KEYWORDS, + ContextFunctions_load_map___doc__}, + {"read_map_pixel", + (PyCFunction)ContextFunctions_read_map_pixel, + METH_VARARGS | METH_KEYWORDS, + ContextFunctions_read_map_pixel___doc__}, + {"read_complete_view_map_pixel", + (PyCFunction)ContextFunctions_read_complete_view_map_pixel, + METH_VARARGS | METH_KEYWORDS, + ContextFunctions_read_complete_view_map_pixel___doc__}, + {"read_directional_view_map_pixel", + (PyCFunction)ContextFunctions_read_directional_view_map_pixel, + METH_VARARGS | METH_KEYWORDS, + ContextFunctions_read_directional_view_map_pixel___doc__}, + {"get_selected_fedge", + (PyCFunction)ContextFunctions_get_selected_fedge, + METH_NOARGS, + ContextFunctions_get_selected_fedge___doc__}, + {NULL, NULL, 0, NULL}, }; /*-----------------------ContextFunctions module definition--------------------------------*/ @@ -280,18 +296,18 @@ static PyModuleDef module_definition = { int ContextFunctions_Init(PyObject *module) { - PyObject *m; + PyObject *m; - if (module == NULL) - return -1; + if (module == NULL) + return -1; - m = PyModule_Create(&module_definition); - if (m == NULL) - return -1; - Py_INCREF(m); - PyModule_AddObject(module, "ContextFunctions", m); + m = PyModule_Create(&module_definition); + if (m == NULL) + return -1; + Py_INCREF(m); + PyModule_AddObject(module, "ContextFunctions", m); - return 0; + return 0; } /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_Convert.cpp b/source/blender/freestyle/intern/python/BPy_Convert.cpp index e3e1d7e3301..d22061d1610 100644 --- a/source/blender/freestyle/intern/python/BPy_Convert.cpp +++ b/source/blender/freestyle/intern/python/BPy_Convert.cpp @@ -69,429 +69,436 @@ extern "C" { PyObject *PyBool_from_bool(bool b) { - return PyBool_FromLong(b ? 1 : 0); -} - -PyObject *Vector_from_Vec2f(Vec2f& vec) -{ - float vec_data[2]; // because vec->_coord is protected - vec_data[0] = vec.x(); - vec_data[1] = vec.y(); - return Vector_CreatePyObject(vec_data, 2, NULL); -} - -PyObject *Vector_from_Vec3f(Vec3f& vec) -{ - float vec_data[3]; // because vec->_coord is protected - vec_data[0] = vec.x(); - vec_data[1] = vec.y(); - vec_data[2] = vec.z(); - return Vector_CreatePyObject(vec_data, 3, NULL); -} - -PyObject *Vector_from_Vec3r(Vec3r& vec) -{ - float vec_data[3]; // because vec->_coord is protected - vec_data[0] = vec.x(); - vec_data[1] = vec.y(); - vec_data[2] = vec.z(); - return Vector_CreatePyObject(vec_data, 3, NULL); -} - -PyObject *BPy_Id_from_Id(Id& id) -{ - PyObject *py_id = Id_Type.tp_new(&Id_Type, 0, 0); - ((BPy_Id *)py_id)->id = new Id(id.getFirst(), id.getSecond()); - return py_id; -} - -PyObject *Any_BPy_Interface0D_from_Interface0D(Interface0D& if0D) -{ - if (typeid(if0D) == typeid(CurvePoint)) { - return BPy_CurvePoint_from_CurvePoint(dynamic_cast(if0D)); - } - else if (typeid(if0D) == typeid(StrokeVertex)) { - return BPy_StrokeVertex_from_StrokeVertex(dynamic_cast(if0D)); - } - else if (typeid(if0D) == typeid(SVertex)) { - return BPy_SVertex_from_SVertex(dynamic_cast(if0D)); - } - else if (typeid(if0D) == typeid(ViewVertex)) { - return BPy_ViewVertex_from_ViewVertex(dynamic_cast(if0D)); - } - else if (typeid(if0D) == typeid(NonTVertex)) { - return BPy_NonTVertex_from_NonTVertex(dynamic_cast(if0D)); - } - else if (typeid(if0D) == typeid(TVertex)) { - return BPy_TVertex_from_TVertex(dynamic_cast(if0D)); - } - else if (typeid(if0D) == typeid(Interface0D)) { - return BPy_Interface0D_from_Interface0D(if0D); - } - string msg("unexpected type: " + if0D.getExactTypeName()); - PyErr_SetString(PyExc_TypeError, msg.c_str()); - return NULL; -} - -PyObject *Any_BPy_Interface1D_from_Interface1D(Interface1D& if1D) -{ - if (typeid(if1D) == typeid(ViewEdge)) { - return BPy_ViewEdge_from_ViewEdge(dynamic_cast(if1D)); - } - else if (typeid(if1D) == typeid(Chain)) { - return BPy_Chain_from_Chain(dynamic_cast(if1D)); - } - else if (typeid(if1D) == typeid(Stroke)) { - return BPy_Stroke_from_Stroke(dynamic_cast(if1D)); - } - else if (typeid(if1D) == typeid(FEdgeSharp)) { - return BPy_FEdgeSharp_from_FEdgeSharp(dynamic_cast(if1D)); - } - else if (typeid(if1D) == typeid(FEdgeSmooth)) { - return BPy_FEdgeSmooth_from_FEdgeSmooth(dynamic_cast(if1D)); - } - else if (typeid(if1D) == typeid(FEdge)) { - return BPy_FEdge_from_FEdge(dynamic_cast(if1D)); - } - else if (typeid(if1D) == typeid(Interface1D)) { - return BPy_Interface1D_from_Interface1D(if1D); - } - string msg("unexpected type: " + if1D.getExactTypeName()); - PyErr_SetString(PyExc_TypeError, msg.c_str()); - return NULL; + return PyBool_FromLong(b ? 1 : 0); +} + +PyObject *Vector_from_Vec2f(Vec2f &vec) +{ + float vec_data[2]; // because vec->_coord is protected + vec_data[0] = vec.x(); + vec_data[1] = vec.y(); + return Vector_CreatePyObject(vec_data, 2, NULL); +} + +PyObject *Vector_from_Vec3f(Vec3f &vec) +{ + float vec_data[3]; // because vec->_coord is protected + vec_data[0] = vec.x(); + vec_data[1] = vec.y(); + vec_data[2] = vec.z(); + return Vector_CreatePyObject(vec_data, 3, NULL); +} + +PyObject *Vector_from_Vec3r(Vec3r &vec) +{ + float vec_data[3]; // because vec->_coord is protected + vec_data[0] = vec.x(); + vec_data[1] = vec.y(); + vec_data[2] = vec.z(); + return Vector_CreatePyObject(vec_data, 3, NULL); +} + +PyObject *BPy_Id_from_Id(Id &id) +{ + PyObject *py_id = Id_Type.tp_new(&Id_Type, 0, 0); + ((BPy_Id *)py_id)->id = new Id(id.getFirst(), id.getSecond()); + return py_id; +} + +PyObject *Any_BPy_Interface0D_from_Interface0D(Interface0D &if0D) +{ + if (typeid(if0D) == typeid(CurvePoint)) { + return BPy_CurvePoint_from_CurvePoint(dynamic_cast(if0D)); + } + else if (typeid(if0D) == typeid(StrokeVertex)) { + return BPy_StrokeVertex_from_StrokeVertex(dynamic_cast(if0D)); + } + else if (typeid(if0D) == typeid(SVertex)) { + return BPy_SVertex_from_SVertex(dynamic_cast(if0D)); + } + else if (typeid(if0D) == typeid(ViewVertex)) { + return BPy_ViewVertex_from_ViewVertex(dynamic_cast(if0D)); + } + else if (typeid(if0D) == typeid(NonTVertex)) { + return BPy_NonTVertex_from_NonTVertex(dynamic_cast(if0D)); + } + else if (typeid(if0D) == typeid(TVertex)) { + return BPy_TVertex_from_TVertex(dynamic_cast(if0D)); + } + else if (typeid(if0D) == typeid(Interface0D)) { + return BPy_Interface0D_from_Interface0D(if0D); + } + string msg("unexpected type: " + if0D.getExactTypeName()); + PyErr_SetString(PyExc_TypeError, msg.c_str()); + return NULL; +} + +PyObject *Any_BPy_Interface1D_from_Interface1D(Interface1D &if1D) +{ + if (typeid(if1D) == typeid(ViewEdge)) { + return BPy_ViewEdge_from_ViewEdge(dynamic_cast(if1D)); + } + else if (typeid(if1D) == typeid(Chain)) { + return BPy_Chain_from_Chain(dynamic_cast(if1D)); + } + else if (typeid(if1D) == typeid(Stroke)) { + return BPy_Stroke_from_Stroke(dynamic_cast(if1D)); + } + else if (typeid(if1D) == typeid(FEdgeSharp)) { + return BPy_FEdgeSharp_from_FEdgeSharp(dynamic_cast(if1D)); + } + else if (typeid(if1D) == typeid(FEdgeSmooth)) { + return BPy_FEdgeSmooth_from_FEdgeSmooth(dynamic_cast(if1D)); + } + else if (typeid(if1D) == typeid(FEdge)) { + return BPy_FEdge_from_FEdge(dynamic_cast(if1D)); + } + else if (typeid(if1D) == typeid(Interface1D)) { + return BPy_Interface1D_from_Interface1D(if1D); + } + string msg("unexpected type: " + if1D.getExactTypeName()); + PyErr_SetString(PyExc_TypeError, msg.c_str()); + return NULL; } -PyObject *Any_BPy_FEdge_from_FEdge(FEdge& fe) +PyObject *Any_BPy_FEdge_from_FEdge(FEdge &fe) { - if (typeid(fe) == typeid(FEdgeSharp)) { - return BPy_FEdgeSharp_from_FEdgeSharp(dynamic_cast(fe)); - } - else if (typeid(fe) == typeid(FEdgeSmooth)) { - return BPy_FEdgeSmooth_from_FEdgeSmooth(dynamic_cast(fe)); - } - else if (typeid(fe) == typeid(FEdge)) { - return BPy_FEdge_from_FEdge(fe); - } - string msg("unexpected type: " + fe.getExactTypeName()); - PyErr_SetString(PyExc_TypeError, msg.c_str()); - return NULL; -} - -PyObject *Any_BPy_ViewVertex_from_ViewVertex(ViewVertex& vv) -{ - if (typeid(vv) == typeid(NonTVertex)) { - return BPy_NonTVertex_from_NonTVertex(dynamic_cast(vv)); - } - else if (typeid(vv) == typeid(TVertex)) { - return BPy_TVertex_from_TVertex(dynamic_cast(vv)); - } - else if (typeid(vv) == typeid(ViewVertex)) { - return BPy_ViewVertex_from_ViewVertex(vv); - } - string msg("unexpected type: " + vv.getExactTypeName()); - PyErr_SetString(PyExc_TypeError, msg.c_str()); - return NULL; -} - -PyObject *BPy_Interface0D_from_Interface0D(Interface0D& if0D) -{ - PyObject *py_if0D = Interface0D_Type.tp_new(&Interface0D_Type, 0, 0); - ((BPy_Interface0D *)py_if0D)->if0D = &if0D; - ((BPy_Interface0D *)py_if0D)->borrowed = true; - return py_if0D; -} - -PyObject *BPy_Interface1D_from_Interface1D(Interface1D& if1D) -{ - PyObject *py_if1D = Interface1D_Type.tp_new(&Interface1D_Type, 0, 0); - ((BPy_Interface1D *)py_if1D)->if1D = &if1D; - ((BPy_Interface1D *)py_if1D)->borrowed = true; - return py_if1D; -} - -PyObject *BPy_SVertex_from_SVertex(SVertex& sv) -{ - PyObject *py_sv = SVertex_Type.tp_new(&SVertex_Type, 0, 0); - ((BPy_SVertex *)py_sv)->sv = &sv; - ((BPy_SVertex *)py_sv)->py_if0D.if0D = ((BPy_SVertex *)py_sv)->sv; - ((BPy_SVertex *)py_sv)->py_if0D.borrowed = true; - return py_sv; -} - -PyObject *BPy_FEdgeSharp_from_FEdgeSharp(FEdgeSharp& fes) -{ - PyObject *py_fe = FEdgeSharp_Type.tp_new(&FEdgeSharp_Type, 0, 0); - ((BPy_FEdgeSharp *)py_fe)->fes = &fes; - ((BPy_FEdgeSharp *)py_fe)->py_fe.fe = ((BPy_FEdgeSharp *)py_fe)->fes; - ((BPy_FEdgeSharp *)py_fe)->py_fe.py_if1D.if1D = ((BPy_FEdgeSharp *)py_fe)->fes; - ((BPy_FEdgeSharp *)py_fe)->py_fe.py_if1D.borrowed = true; - return py_fe; -} - -PyObject *BPy_FEdgeSmooth_from_FEdgeSmooth(FEdgeSmooth& fes) + if (typeid(fe) == typeid(FEdgeSharp)) { + return BPy_FEdgeSharp_from_FEdgeSharp(dynamic_cast(fe)); + } + else if (typeid(fe) == typeid(FEdgeSmooth)) { + return BPy_FEdgeSmooth_from_FEdgeSmooth(dynamic_cast(fe)); + } + else if (typeid(fe) == typeid(FEdge)) { + return BPy_FEdge_from_FEdge(fe); + } + string msg("unexpected type: " + fe.getExactTypeName()); + PyErr_SetString(PyExc_TypeError, msg.c_str()); + return NULL; +} + +PyObject *Any_BPy_ViewVertex_from_ViewVertex(ViewVertex &vv) +{ + if (typeid(vv) == typeid(NonTVertex)) { + return BPy_NonTVertex_from_NonTVertex(dynamic_cast(vv)); + } + else if (typeid(vv) == typeid(TVertex)) { + return BPy_TVertex_from_TVertex(dynamic_cast(vv)); + } + else if (typeid(vv) == typeid(ViewVertex)) { + return BPy_ViewVertex_from_ViewVertex(vv); + } + string msg("unexpected type: " + vv.getExactTypeName()); + PyErr_SetString(PyExc_TypeError, msg.c_str()); + return NULL; +} + +PyObject *BPy_Interface0D_from_Interface0D(Interface0D &if0D) +{ + PyObject *py_if0D = Interface0D_Type.tp_new(&Interface0D_Type, 0, 0); + ((BPy_Interface0D *)py_if0D)->if0D = &if0D; + ((BPy_Interface0D *)py_if0D)->borrowed = true; + return py_if0D; +} + +PyObject *BPy_Interface1D_from_Interface1D(Interface1D &if1D) +{ + PyObject *py_if1D = Interface1D_Type.tp_new(&Interface1D_Type, 0, 0); + ((BPy_Interface1D *)py_if1D)->if1D = &if1D; + ((BPy_Interface1D *)py_if1D)->borrowed = true; + return py_if1D; +} + +PyObject *BPy_SVertex_from_SVertex(SVertex &sv) +{ + PyObject *py_sv = SVertex_Type.tp_new(&SVertex_Type, 0, 0); + ((BPy_SVertex *)py_sv)->sv = &sv; + ((BPy_SVertex *)py_sv)->py_if0D.if0D = ((BPy_SVertex *)py_sv)->sv; + ((BPy_SVertex *)py_sv)->py_if0D.borrowed = true; + return py_sv; +} + +PyObject *BPy_FEdgeSharp_from_FEdgeSharp(FEdgeSharp &fes) +{ + PyObject *py_fe = FEdgeSharp_Type.tp_new(&FEdgeSharp_Type, 0, 0); + ((BPy_FEdgeSharp *)py_fe)->fes = &fes; + ((BPy_FEdgeSharp *)py_fe)->py_fe.fe = ((BPy_FEdgeSharp *)py_fe)->fes; + ((BPy_FEdgeSharp *)py_fe)->py_fe.py_if1D.if1D = ((BPy_FEdgeSharp *)py_fe)->fes; + ((BPy_FEdgeSharp *)py_fe)->py_fe.py_if1D.borrowed = true; + return py_fe; +} + +PyObject *BPy_FEdgeSmooth_from_FEdgeSmooth(FEdgeSmooth &fes) { - PyObject *py_fe = FEdgeSmooth_Type.tp_new(&FEdgeSmooth_Type, 0, 0); - ((BPy_FEdgeSmooth *)py_fe)->fes = &fes; - ((BPy_FEdgeSmooth *)py_fe)->py_fe.fe = ((BPy_FEdgeSmooth *)py_fe)->fes; - ((BPy_FEdgeSmooth *)py_fe)->py_fe.py_if1D.if1D = ((BPy_FEdgeSmooth *)py_fe)->fes; - ((BPy_FEdgeSmooth *)py_fe)->py_fe.py_if1D.borrowed = true; - return py_fe; -} - -PyObject *BPy_FEdge_from_FEdge(FEdge& fe) -{ - PyObject *py_fe = FEdge_Type.tp_new(&FEdge_Type, 0, 0); - ((BPy_FEdge *)py_fe)->fe = &fe; - ((BPy_FEdge *)py_fe)->py_if1D.if1D = ((BPy_FEdge *)py_fe)->fe; - ((BPy_FEdge *)py_fe)->py_if1D.borrowed = true; - return py_fe; + PyObject *py_fe = FEdgeSmooth_Type.tp_new(&FEdgeSmooth_Type, 0, 0); + ((BPy_FEdgeSmooth *)py_fe)->fes = &fes; + ((BPy_FEdgeSmooth *)py_fe)->py_fe.fe = ((BPy_FEdgeSmooth *)py_fe)->fes; + ((BPy_FEdgeSmooth *)py_fe)->py_fe.py_if1D.if1D = ((BPy_FEdgeSmooth *)py_fe)->fes; + ((BPy_FEdgeSmooth *)py_fe)->py_fe.py_if1D.borrowed = true; + return py_fe; +} + +PyObject *BPy_FEdge_from_FEdge(FEdge &fe) +{ + PyObject *py_fe = FEdge_Type.tp_new(&FEdge_Type, 0, 0); + ((BPy_FEdge *)py_fe)->fe = &fe; + ((BPy_FEdge *)py_fe)->py_if1D.if1D = ((BPy_FEdge *)py_fe)->fe; + ((BPy_FEdge *)py_fe)->py_if1D.borrowed = true; + return py_fe; } PyObject *BPy_Nature_from_Nature(unsigned short n) { - PyObject *args = PyTuple_New(1); - PyTuple_SET_ITEM(args, 0, PyLong_FromLong(n)); - PyObject *py_n = Nature_Type.tp_new(&Nature_Type, args, NULL); - Py_DECREF(args); - return py_n; + PyObject *args = PyTuple_New(1); + PyTuple_SET_ITEM(args, 0, PyLong_FromLong(n)); + PyObject *py_n = Nature_Type.tp_new(&Nature_Type, args, NULL); + Py_DECREF(args); + return py_n; } -PyObject *BPy_Stroke_from_Stroke(Stroke& s) +PyObject *BPy_Stroke_from_Stroke(Stroke &s) { - PyObject *py_s = Stroke_Type.tp_new(&Stroke_Type, 0, 0); - ((BPy_Stroke *)py_s)->s = &s; - ((BPy_Stroke *)py_s)->py_if1D.if1D = ((BPy_Stroke *)py_s)->s; - ((BPy_Stroke *)py_s)->py_if1D.borrowed = true; - return py_s; + PyObject *py_s = Stroke_Type.tp_new(&Stroke_Type, 0, 0); + ((BPy_Stroke *)py_s)->s = &s; + ((BPy_Stroke *)py_s)->py_if1D.if1D = ((BPy_Stroke *)py_s)->s; + ((BPy_Stroke *)py_s)->py_if1D.borrowed = true; + return py_s; } -PyObject *BPy_StrokeAttribute_from_StrokeAttribute(StrokeAttribute& sa) +PyObject *BPy_StrokeAttribute_from_StrokeAttribute(StrokeAttribute &sa) { - PyObject *py_sa = StrokeAttribute_Type.tp_new(&StrokeAttribute_Type, 0, 0); - ((BPy_StrokeAttribute *)py_sa)->sa = &sa; - ((BPy_StrokeAttribute *)py_sa)->borrowed = true; - return py_sa; + PyObject *py_sa = StrokeAttribute_Type.tp_new(&StrokeAttribute_Type, 0, 0); + ((BPy_StrokeAttribute *)py_sa)->sa = &sa; + ((BPy_StrokeAttribute *)py_sa)->borrowed = true; + return py_sa; } PyObject *BPy_MediumType_from_MediumType(Stroke::MediumType n) { - PyObject *args = PyTuple_New(1); - PyTuple_SET_ITEM(args, 0, PyLong_FromLong(n)); - PyObject *py_mt = MediumType_Type.tp_new(&MediumType_Type, args, NULL); - Py_DECREF(args); - return py_mt; + PyObject *args = PyTuple_New(1); + PyTuple_SET_ITEM(args, 0, PyLong_FromLong(n)); + PyObject *py_mt = MediumType_Type.tp_new(&MediumType_Type, args, NULL); + Py_DECREF(args); + return py_mt; } -PyObject *BPy_StrokeVertex_from_StrokeVertex(StrokeVertex& sv) +PyObject *BPy_StrokeVertex_from_StrokeVertex(StrokeVertex &sv) { - PyObject *py_sv = StrokeVertex_Type.tp_new(&StrokeVertex_Type, 0, 0); - ((BPy_StrokeVertex *)py_sv)->sv = &sv; - ((BPy_StrokeVertex *)py_sv)->py_cp.cp = ((BPy_StrokeVertex *)py_sv)->sv; - ((BPy_StrokeVertex *)py_sv)->py_cp.py_if0D.if0D = ((BPy_StrokeVertex *)py_sv)->sv; - ((BPy_StrokeVertex *)py_sv)->py_cp.py_if0D.borrowed = true; - return py_sv; + PyObject *py_sv = StrokeVertex_Type.tp_new(&StrokeVertex_Type, 0, 0); + ((BPy_StrokeVertex *)py_sv)->sv = &sv; + ((BPy_StrokeVertex *)py_sv)->py_cp.cp = ((BPy_StrokeVertex *)py_sv)->sv; + ((BPy_StrokeVertex *)py_sv)->py_cp.py_if0D.if0D = ((BPy_StrokeVertex *)py_sv)->sv; + ((BPy_StrokeVertex *)py_sv)->py_cp.py_if0D.borrowed = true; + return py_sv; } -PyObject *BPy_ViewVertex_from_ViewVertex(ViewVertex& vv) +PyObject *BPy_ViewVertex_from_ViewVertex(ViewVertex &vv) { - PyObject *py_vv = ViewVertex_Type.tp_new(&ViewVertex_Type, 0, 0); - ((BPy_ViewVertex *)py_vv)->vv = &vv; - ((BPy_ViewVertex *)py_vv)->py_if0D.if0D = ((BPy_ViewVertex *)py_vv)->vv; - ((BPy_ViewVertex *)py_vv)->py_if0D.borrowed = true; - return py_vv; + PyObject *py_vv = ViewVertex_Type.tp_new(&ViewVertex_Type, 0, 0); + ((BPy_ViewVertex *)py_vv)->vv = &vv; + ((BPy_ViewVertex *)py_vv)->py_if0D.if0D = ((BPy_ViewVertex *)py_vv)->vv; + ((BPy_ViewVertex *)py_vv)->py_if0D.borrowed = true; + return py_vv; } -PyObject *BPy_NonTVertex_from_NonTVertex(NonTVertex& ntv) +PyObject *BPy_NonTVertex_from_NonTVertex(NonTVertex &ntv) { - PyObject *py_ntv = NonTVertex_Type.tp_new(&NonTVertex_Type, 0, 0); - ((BPy_NonTVertex *)py_ntv)->ntv = &ntv; - ((BPy_NonTVertex *)py_ntv)->py_vv.vv = ((BPy_NonTVertex *)py_ntv)->ntv; - ((BPy_NonTVertex *)py_ntv)->py_vv.py_if0D.if0D = ((BPy_NonTVertex *)py_ntv)->ntv; - ((BPy_NonTVertex *)py_ntv)->py_vv.py_if0D.borrowed = true; - return py_ntv; + PyObject *py_ntv = NonTVertex_Type.tp_new(&NonTVertex_Type, 0, 0); + ((BPy_NonTVertex *)py_ntv)->ntv = &ntv; + ((BPy_NonTVertex *)py_ntv)->py_vv.vv = ((BPy_NonTVertex *)py_ntv)->ntv; + ((BPy_NonTVertex *)py_ntv)->py_vv.py_if0D.if0D = ((BPy_NonTVertex *)py_ntv)->ntv; + ((BPy_NonTVertex *)py_ntv)->py_vv.py_if0D.borrowed = true; + return py_ntv; } -PyObject *BPy_TVertex_from_TVertex(TVertex& tv) +PyObject *BPy_TVertex_from_TVertex(TVertex &tv) { - PyObject *py_tv = TVertex_Type.tp_new(&TVertex_Type, 0, 0); - ((BPy_TVertex *)py_tv)->tv = &tv; - ((BPy_TVertex *)py_tv)->py_vv.vv = ((BPy_TVertex *)py_tv)->tv; - ((BPy_TVertex *)py_tv)->py_vv.py_if0D.if0D = ((BPy_TVertex *)py_tv)->tv; - ((BPy_TVertex *)py_tv)->py_vv.py_if0D.borrowed = true; - return py_tv; + PyObject *py_tv = TVertex_Type.tp_new(&TVertex_Type, 0, 0); + ((BPy_TVertex *)py_tv)->tv = &tv; + ((BPy_TVertex *)py_tv)->py_vv.vv = ((BPy_TVertex *)py_tv)->tv; + ((BPy_TVertex *)py_tv)->py_vv.py_if0D.if0D = ((BPy_TVertex *)py_tv)->tv; + ((BPy_TVertex *)py_tv)->py_vv.py_if0D.borrowed = true; + return py_tv; } -PyObject *BPy_BBox_from_BBox(const BBox< Vec3r > &bb) +PyObject *BPy_BBox_from_BBox(const BBox &bb) { - PyObject *py_bb = BBox_Type.tp_new(&BBox_Type, 0, 0); - ((BPy_BBox *)py_bb)->bb = new BBox< Vec3r >(bb); - return py_bb; + PyObject *py_bb = BBox_Type.tp_new(&BBox_Type, 0, 0); + ((BPy_BBox *)py_bb)->bb = new BBox(bb); + return py_bb; } -PyObject *BPy_ViewEdge_from_ViewEdge(ViewEdge& ve) +PyObject *BPy_ViewEdge_from_ViewEdge(ViewEdge &ve) { - PyObject *py_ve = ViewEdge_Type.tp_new(&ViewEdge_Type, 0, 0); - ((BPy_ViewEdge *)py_ve)->ve = &ve; - ((BPy_ViewEdge *)py_ve)->py_if1D.if1D = ((BPy_ViewEdge *)py_ve)->ve; - ((BPy_ViewEdge *)py_ve)->py_if1D.borrowed = true; - return py_ve; + PyObject *py_ve = ViewEdge_Type.tp_new(&ViewEdge_Type, 0, 0); + ((BPy_ViewEdge *)py_ve)->ve = &ve; + ((BPy_ViewEdge *)py_ve)->py_if1D.if1D = ((BPy_ViewEdge *)py_ve)->ve; + ((BPy_ViewEdge *)py_ve)->py_if1D.borrowed = true; + return py_ve; } -PyObject *BPy_Chain_from_Chain(Chain& c) +PyObject *BPy_Chain_from_Chain(Chain &c) { - PyObject *py_c = Chain_Type.tp_new(&Chain_Type, 0, 0); - ((BPy_Chain *)py_c)->c = &c; - ((BPy_Chain *)py_c)->py_c.c = ((BPy_Chain *)py_c)->c; - ((BPy_Chain *)py_c)->py_c.py_if1D.if1D = ((BPy_Chain *)py_c)->c; - ((BPy_Chain *)py_c)->py_c.py_if1D.borrowed = true; - return py_c; + PyObject *py_c = Chain_Type.tp_new(&Chain_Type, 0, 0); + ((BPy_Chain *)py_c)->c = &c; + ((BPy_Chain *)py_c)->py_c.c = ((BPy_Chain *)py_c)->c; + ((BPy_Chain *)py_c)->py_c.py_if1D.if1D = ((BPy_Chain *)py_c)->c; + ((BPy_Chain *)py_c)->py_c.py_if1D.borrowed = true; + return py_c; } -PyObject *BPy_SShape_from_SShape(SShape& ss) +PyObject *BPy_SShape_from_SShape(SShape &ss) { - PyObject *py_ss = SShape_Type.tp_new(&SShape_Type, 0, 0); - ((BPy_SShape *)py_ss)->ss = &ss; - ((BPy_SShape *)py_ss)->borrowed = true; - return py_ss; + PyObject *py_ss = SShape_Type.tp_new(&SShape_Type, 0, 0); + ((BPy_SShape *)py_ss)->ss = &ss; + ((BPy_SShape *)py_ss)->borrowed = true; + return py_ss; } -PyObject *BPy_ViewShape_from_ViewShape(ViewShape& vs) +PyObject *BPy_ViewShape_from_ViewShape(ViewShape &vs) { - PyObject *py_vs = ViewShape_Type.tp_new(&ViewShape_Type, 0, 0); - ((BPy_ViewShape *)py_vs)->vs = &vs; - ((BPy_ViewShape *)py_vs)->borrowed = true; - ((BPy_ViewShape *)py_vs)->py_ss = NULL; - return py_vs; + PyObject *py_vs = ViewShape_Type.tp_new(&ViewShape_Type, 0, 0); + ((BPy_ViewShape *)py_vs)->vs = &vs; + ((BPy_ViewShape *)py_vs)->borrowed = true; + ((BPy_ViewShape *)py_vs)->py_ss = NULL; + return py_vs; } -PyObject *BPy_FrsMaterial_from_FrsMaterial(const FrsMaterial& m) +PyObject *BPy_FrsMaterial_from_FrsMaterial(const FrsMaterial &m) { - PyObject *py_m = FrsMaterial_Type.tp_new(&FrsMaterial_Type, 0, 0); - ((BPy_FrsMaterial *) py_m)->m = new FrsMaterial(m); - return py_m; + PyObject *py_m = FrsMaterial_Type.tp_new(&FrsMaterial_Type, 0, 0); + ((BPy_FrsMaterial *)py_m)->m = new FrsMaterial(m); + return py_m; } PyObject *BPy_IntegrationType_from_IntegrationType(IntegrationType i) { - PyObject *args = PyTuple_New(1); - PyTuple_SET_ITEM(args, 0, PyLong_FromLong(i)); - PyObject *py_it = IntegrationType_Type.tp_new(&IntegrationType_Type, args, NULL); - Py_DECREF(args); - return py_it; + PyObject *args = PyTuple_New(1); + PyTuple_SET_ITEM(args, 0, PyLong_FromLong(i)); + PyObject *py_it = IntegrationType_Type.tp_new(&IntegrationType_Type, args, NULL); + Py_DECREF(args); + return py_it; } -PyObject *BPy_CurvePoint_from_CurvePoint(CurvePoint& cp) +PyObject *BPy_CurvePoint_from_CurvePoint(CurvePoint &cp) { - PyObject *py_cp = CurvePoint_Type.tp_new(&CurvePoint_Type, 0, 0); - // CurvePointIterator::operator*() returns a reference of a class data - // member whose value is mutable upon iteration over different CurvePoints. - // It is likely that such a mutable reference is passed to this function, - // so that a new allocated CurvePoint instance is created here to avoid - // nasty bugs (cf. T41464). - ((BPy_CurvePoint *) py_cp)->cp = new CurvePoint(cp); - ((BPy_CurvePoint *) py_cp)->py_if0D.if0D = ((BPy_CurvePoint *)py_cp)->cp; - ((BPy_CurvePoint *) py_cp)->py_if0D.borrowed = false; - return py_cp; + PyObject *py_cp = CurvePoint_Type.tp_new(&CurvePoint_Type, 0, 0); + // CurvePointIterator::operator*() returns a reference of a class data + // member whose value is mutable upon iteration over different CurvePoints. + // It is likely that such a mutable reference is passed to this function, + // so that a new allocated CurvePoint instance is created here to avoid + // nasty bugs (cf. T41464). + ((BPy_CurvePoint *)py_cp)->cp = new CurvePoint(cp); + ((BPy_CurvePoint *)py_cp)->py_if0D.if0D = ((BPy_CurvePoint *)py_cp)->cp; + ((BPy_CurvePoint *)py_cp)->py_if0D.borrowed = false; + return py_cp; } -PyObject *BPy_directedViewEdge_from_directedViewEdge(ViewVertex::directedViewEdge& dve) +PyObject *BPy_directedViewEdge_from_directedViewEdge(ViewVertex::directedViewEdge &dve) { - PyObject *py_dve = PyTuple_New(2); - PyTuple_SET_ITEMS(py_dve, - BPy_ViewEdge_from_ViewEdge(*(dve.first)), - PyBool_from_bool(dve.second)); - return py_dve; + PyObject *py_dve = PyTuple_New(2); + PyTuple_SET_ITEMS( + py_dve, BPy_ViewEdge_from_ViewEdge(*(dve.first)), PyBool_from_bool(dve.second)); + return py_dve; } //============================== // Iterators //============================== -PyObject *BPy_AdjacencyIterator_from_AdjacencyIterator(AdjacencyIterator& a_it) +PyObject *BPy_AdjacencyIterator_from_AdjacencyIterator(AdjacencyIterator &a_it) { - PyObject *py_a_it = AdjacencyIterator_Type.tp_new(&AdjacencyIterator_Type, 0, 0); - ((BPy_AdjacencyIterator *)py_a_it)->a_it = new AdjacencyIterator(a_it); - ((BPy_AdjacencyIterator *)py_a_it)->py_it.it = ((BPy_AdjacencyIterator *)py_a_it)->a_it; - ((BPy_AdjacencyIterator *)py_a_it)->at_start = true; - return py_a_it; + PyObject *py_a_it = AdjacencyIterator_Type.tp_new(&AdjacencyIterator_Type, 0, 0); + ((BPy_AdjacencyIterator *)py_a_it)->a_it = new AdjacencyIterator(a_it); + ((BPy_AdjacencyIterator *)py_a_it)->py_it.it = ((BPy_AdjacencyIterator *)py_a_it)->a_it; + ((BPy_AdjacencyIterator *)py_a_it)->at_start = true; + return py_a_it; } -PyObject *BPy_Interface0DIterator_from_Interface0DIterator(Interface0DIterator& if0D_it, bool reversed) +PyObject *BPy_Interface0DIterator_from_Interface0DIterator(Interface0DIterator &if0D_it, + bool reversed) { - PyObject *py_if0D_it = Interface0DIterator_Type.tp_new(&Interface0DIterator_Type, 0, 0); - ((BPy_Interface0DIterator *)py_if0D_it)->if0D_it = new Interface0DIterator(if0D_it); - ((BPy_Interface0DIterator *)py_if0D_it)->py_it.it = ((BPy_Interface0DIterator *)py_if0D_it)->if0D_it; - ((BPy_Interface0DIterator *)py_if0D_it)->at_start = true; - ((BPy_Interface0DIterator *)py_if0D_it)->reversed = reversed; - return py_if0D_it; + PyObject *py_if0D_it = Interface0DIterator_Type.tp_new(&Interface0DIterator_Type, 0, 0); + ((BPy_Interface0DIterator *)py_if0D_it)->if0D_it = new Interface0DIterator(if0D_it); + ((BPy_Interface0DIterator *)py_if0D_it)->py_it.it = + ((BPy_Interface0DIterator *)py_if0D_it)->if0D_it; + ((BPy_Interface0DIterator *)py_if0D_it)->at_start = true; + ((BPy_Interface0DIterator *)py_if0D_it)->reversed = reversed; + return py_if0D_it; } -PyObject *BPy_CurvePointIterator_from_CurvePointIterator(CurveInternal::CurvePointIterator& cp_it) +PyObject *BPy_CurvePointIterator_from_CurvePointIterator(CurveInternal::CurvePointIterator &cp_it) { - PyObject *py_cp_it = CurvePointIterator_Type.tp_new(&CurvePointIterator_Type, 0, 0); - ((BPy_CurvePointIterator *)py_cp_it)->cp_it = new CurveInternal::CurvePointIterator(cp_it); - ((BPy_CurvePointIterator *)py_cp_it)->py_it.it = ((BPy_CurvePointIterator *)py_cp_it)->cp_it; - return py_cp_it; + PyObject *py_cp_it = CurvePointIterator_Type.tp_new(&CurvePointIterator_Type, 0, 0); + ((BPy_CurvePointIterator *)py_cp_it)->cp_it = new CurveInternal::CurvePointIterator(cp_it); + ((BPy_CurvePointIterator *)py_cp_it)->py_it.it = ((BPy_CurvePointIterator *)py_cp_it)->cp_it; + return py_cp_it; } -PyObject *BPy_StrokeVertexIterator_from_StrokeVertexIterator(StrokeInternal::StrokeVertexIterator& sv_it, bool reversed) +PyObject *BPy_StrokeVertexIterator_from_StrokeVertexIterator( + StrokeInternal::StrokeVertexIterator &sv_it, bool reversed) { - PyObject *py_sv_it = StrokeVertexIterator_Type.tp_new(&StrokeVertexIterator_Type, 0, 0); - ((BPy_StrokeVertexIterator *)py_sv_it)->sv_it = new StrokeInternal::StrokeVertexIterator(sv_it); - ((BPy_StrokeVertexIterator *)py_sv_it)->py_it.it = ((BPy_StrokeVertexIterator *)py_sv_it)->sv_it; - ((BPy_StrokeVertexIterator *)py_sv_it)->at_start = true; - ((BPy_StrokeVertexIterator *)py_sv_it)->reversed = reversed; - return py_sv_it; + PyObject *py_sv_it = StrokeVertexIterator_Type.tp_new(&StrokeVertexIterator_Type, 0, 0); + ((BPy_StrokeVertexIterator *)py_sv_it)->sv_it = new StrokeInternal::StrokeVertexIterator(sv_it); + ((BPy_StrokeVertexIterator *)py_sv_it)->py_it.it = ((BPy_StrokeVertexIterator *)py_sv_it)->sv_it; + ((BPy_StrokeVertexIterator *)py_sv_it)->at_start = true; + ((BPy_StrokeVertexIterator *)py_sv_it)->reversed = reversed; + return py_sv_it; } -PyObject *BPy_SVertexIterator_from_SVertexIterator(ViewEdgeInternal::SVertexIterator& sv_it) +PyObject *BPy_SVertexIterator_from_SVertexIterator(ViewEdgeInternal::SVertexIterator &sv_it) { - PyObject *py_sv_it = SVertexIterator_Type.tp_new(&SVertexIterator_Type, 0, 0); - ((BPy_SVertexIterator *)py_sv_it)->sv_it = new ViewEdgeInternal::SVertexIterator(sv_it); - ((BPy_SVertexIterator *)py_sv_it)->py_it.it = ((BPy_SVertexIterator *)py_sv_it)->sv_it; - return py_sv_it; + PyObject *py_sv_it = SVertexIterator_Type.tp_new(&SVertexIterator_Type, 0, 0); + ((BPy_SVertexIterator *)py_sv_it)->sv_it = new ViewEdgeInternal::SVertexIterator(sv_it); + ((BPy_SVertexIterator *)py_sv_it)->py_it.it = ((BPy_SVertexIterator *)py_sv_it)->sv_it; + return py_sv_it; } -PyObject *BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator(ViewVertexInternal::orientedViewEdgeIterator& ove_it, bool reversed) +PyObject *BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator( + ViewVertexInternal::orientedViewEdgeIterator &ove_it, bool reversed) { - PyObject *py_ove_it = orientedViewEdgeIterator_Type.tp_new(&orientedViewEdgeIterator_Type, 0, 0); - ((BPy_orientedViewEdgeIterator *)py_ove_it)->ove_it = new ViewVertexInternal::orientedViewEdgeIterator(ove_it); - ((BPy_orientedViewEdgeIterator *)py_ove_it)->py_it.it = ((BPy_orientedViewEdgeIterator *)py_ove_it)->ove_it; - ((BPy_orientedViewEdgeIterator *)py_ove_it)->at_start = true; - ((BPy_orientedViewEdgeIterator *)py_ove_it)->reversed = reversed; - return py_ove_it; + PyObject *py_ove_it = orientedViewEdgeIterator_Type.tp_new(&orientedViewEdgeIterator_Type, 0, 0); + ((BPy_orientedViewEdgeIterator *)py_ove_it)->ove_it = + new ViewVertexInternal::orientedViewEdgeIterator(ove_it); + ((BPy_orientedViewEdgeIterator *)py_ove_it)->py_it.it = + ((BPy_orientedViewEdgeIterator *)py_ove_it)->ove_it; + ((BPy_orientedViewEdgeIterator *)py_ove_it)->at_start = true; + ((BPy_orientedViewEdgeIterator *)py_ove_it)->reversed = reversed; + return py_ove_it; } -PyObject *BPy_ViewEdgeIterator_from_ViewEdgeIterator(ViewEdgeInternal::ViewEdgeIterator& ve_it) +PyObject *BPy_ViewEdgeIterator_from_ViewEdgeIterator(ViewEdgeInternal::ViewEdgeIterator &ve_it) { - PyObject *py_ve_it = ViewEdgeIterator_Type.tp_new(&ViewEdgeIterator_Type, 0, 0); - ((BPy_ViewEdgeIterator *)py_ve_it)->ve_it = new ViewEdgeInternal::ViewEdgeIterator(ve_it); - ((BPy_ViewEdgeIterator *)py_ve_it)->py_it.it = ((BPy_ViewEdgeIterator *)py_ve_it)->ve_it; - return py_ve_it; + PyObject *py_ve_it = ViewEdgeIterator_Type.tp_new(&ViewEdgeIterator_Type, 0, 0); + ((BPy_ViewEdgeIterator *)py_ve_it)->ve_it = new ViewEdgeInternal::ViewEdgeIterator(ve_it); + ((BPy_ViewEdgeIterator *)py_ve_it)->py_it.it = ((BPy_ViewEdgeIterator *)py_ve_it)->ve_it; + return py_ve_it; } -PyObject *BPy_ChainingIterator_from_ChainingIterator(ChainingIterator& c_it) +PyObject *BPy_ChainingIterator_from_ChainingIterator(ChainingIterator &c_it) { - PyObject *py_c_it = ChainingIterator_Type.tp_new(&ChainingIterator_Type, 0, 0); - ((BPy_ChainingIterator *)py_c_it)->c_it = new ChainingIterator(c_it); - ((BPy_ChainingIterator *)py_c_it)->py_ve_it.py_it.it = ((BPy_ChainingIterator *)py_c_it)->c_it; - return py_c_it; + PyObject *py_c_it = ChainingIterator_Type.tp_new(&ChainingIterator_Type, 0, 0); + ((BPy_ChainingIterator *)py_c_it)->c_it = new ChainingIterator(c_it); + ((BPy_ChainingIterator *)py_c_it)->py_ve_it.py_it.it = ((BPy_ChainingIterator *)py_c_it)->c_it; + return py_c_it; } -PyObject *BPy_ChainPredicateIterator_from_ChainPredicateIterator(ChainPredicateIterator& cp_it) +PyObject *BPy_ChainPredicateIterator_from_ChainPredicateIterator(ChainPredicateIterator &cp_it) { - PyObject *py_cp_it = ChainPredicateIterator_Type.tp_new(&ChainPredicateIterator_Type, 0, 0); - ((BPy_ChainPredicateIterator *)py_cp_it)->cp_it = new ChainPredicateIterator(cp_it); - ((BPy_ChainPredicateIterator *)py_cp_it)->py_c_it.py_ve_it.py_it.it = ((BPy_ChainPredicateIterator *)py_cp_it)->cp_it; - return py_cp_it; + PyObject *py_cp_it = ChainPredicateIterator_Type.tp_new(&ChainPredicateIterator_Type, 0, 0); + ((BPy_ChainPredicateIterator *)py_cp_it)->cp_it = new ChainPredicateIterator(cp_it); + ((BPy_ChainPredicateIterator *)py_cp_it)->py_c_it.py_ve_it.py_it.it = + ((BPy_ChainPredicateIterator *)py_cp_it)->cp_it; + return py_cp_it; } -PyObject *BPy_ChainSilhouetteIterator_from_ChainSilhouetteIterator(ChainSilhouetteIterator& cs_it) +PyObject *BPy_ChainSilhouetteIterator_from_ChainSilhouetteIterator(ChainSilhouetteIterator &cs_it) { - PyObject *py_cs_it = ChainSilhouetteIterator_Type.tp_new(&ChainSilhouetteIterator_Type, 0, 0); - ((BPy_ChainSilhouetteIterator *)py_cs_it)->cs_it = new ChainSilhouetteIterator(cs_it); - ((BPy_ChainSilhouetteIterator *)py_cs_it)->py_c_it.py_ve_it.py_it.it = ((BPy_ChainSilhouetteIterator *)py_cs_it)->cs_it; - return py_cs_it; + PyObject *py_cs_it = ChainSilhouetteIterator_Type.tp_new(&ChainSilhouetteIterator_Type, 0, 0); + ((BPy_ChainSilhouetteIterator *)py_cs_it)->cs_it = new ChainSilhouetteIterator(cs_it); + ((BPy_ChainSilhouetteIterator *)py_cs_it)->py_c_it.py_ve_it.py_it.it = + ((BPy_ChainSilhouetteIterator *)py_cs_it)->cs_it; + return py_cs_it; } //============================== @@ -500,269 +507,268 @@ PyObject *BPy_ChainSilhouetteIterator_from_ChainSilhouetteIterator(ChainSilhouet bool bool_from_PyBool(PyObject *b) { - return PyObject_IsTrue(b) != 0; + return PyObject_IsTrue(b) != 0; } IntegrationType IntegrationType_from_BPy_IntegrationType(PyObject *obj) { - return static_cast(PyLong_AsLong(obj)); + return static_cast(PyLong_AsLong(obj)); } Stroke::MediumType MediumType_from_BPy_MediumType(PyObject *obj) { - return static_cast(PyLong_AsLong(obj)); + return static_cast(PyLong_AsLong(obj)); } Nature::EdgeNature EdgeNature_from_BPy_Nature(PyObject *obj) { - return static_cast(PyLong_AsLong(obj)); + return static_cast(PyLong_AsLong(obj)); } bool Vec2f_ptr_from_PyObject(PyObject *obj, Vec2f &vec) { - if (Vec2f_ptr_from_Vector(obj, vec)) - return true; - if (Vec2f_ptr_from_PyList(obj, vec)) - return true; - if (Vec2f_ptr_from_PyTuple(obj, vec)) - return true; - return false; + if (Vec2f_ptr_from_Vector(obj, vec)) + return true; + if (Vec2f_ptr_from_PyList(obj, vec)) + return true; + 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)) - return true; - if (Vec3f_ptr_from_Color(obj, vec)) - return true; - if (Vec3f_ptr_from_PyList(obj, vec)) - return true; - if (Vec3f_ptr_from_PyTuple(obj, vec)) - return true; - return false; + if (Vec3f_ptr_from_Vector(obj, vec)) + return true; + if (Vec3f_ptr_from_Color(obj, vec)) + return true; + if (Vec3f_ptr_from_PyList(obj, vec)) + return true; + 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)) - return true; - if (Vec3r_ptr_from_Color(obj, vec)) - return true; - if (Vec3r_ptr_from_PyList(obj, vec)) - return true; - if (Vec3r_ptr_from_PyTuple(obj, vec)) - return true; - return false; + if (Vec3r_ptr_from_Vector(obj, vec)) + return true; + if (Vec3r_ptr_from_Color(obj, vec)) + return true; + if (Vec3r_ptr_from_PyList(obj, vec)) + return true; + 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) - return false; - if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1) - return false; - vec[0] = ((VectorObject *)obj)->vec[0]; - vec[1] = ((VectorObject *)obj)->vec[1]; - return true; + if (!VectorObject_Check(obj) || ((VectorObject *)obj)->size != 2) + return false; + if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1) + return false; + vec[0] = ((VectorObject *)obj)->vec[0]; + vec[1] = ((VectorObject *)obj)->vec[1]; + return true; } bool Vec3f_ptr_from_Vector(PyObject *obj, Vec3f &vec) { - if (!VectorObject_Check(obj) || ((VectorObject *)obj)->size != 3) - return false; - 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]; - return true; + if (!VectorObject_Check(obj) || ((VectorObject *)obj)->size != 3) + return false; + 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]; + return true; } bool Vec3r_ptr_from_Vector(PyObject *obj, Vec3r &vec) { - if (!VectorObject_Check(obj) || ((VectorObject *)obj)->size != 3) - return false; - 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]; - return true; + if (!VectorObject_Check(obj) || ((VectorObject *)obj)->size != 3) + return false; + 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]; + return true; } bool Vec3f_ptr_from_Color(PyObject *obj, Vec3f &vec) { - if (!ColorObject_Check(obj)) - return false; - 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]; - return true; + if (!ColorObject_Check(obj)) + return false; + 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]; + return true; } bool Vec3r_ptr_from_Color(PyObject *obj, Vec3r &vec) { - if (!ColorObject_Check(obj)) - return false; - 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]; - return true; + if (!ColorObject_Check(obj)) + return false; + 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]; + return true; } static bool float_array_from_PyList(PyObject *obj, float *v, int n) { - for (int i = 0; i < n; i++) { - v[i] = PyFloat_AsDouble(PyList_GET_ITEM(obj, i)); - if (v[i] == -1.0f && PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, "list elements must be a number"); - return 0; - } - } - return 1; + for (int i = 0; i < n; i++) { + v[i] = PyFloat_AsDouble(PyList_GET_ITEM(obj, i)); + if (v[i] == -1.0f && PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, "list elements must be a number"); + return 0; + } + } + return 1; } bool Vec2f_ptr_from_PyList(PyObject *obj, Vec2f &vec) { - float v[2]; + float v[2]; - if (!PyList_Check(obj) || PyList_GET_SIZE(obj) != 2) - return false; - if (!float_array_from_PyList(obj, v, 2)) - return false; - vec[0] = v[0]; - vec[1] = v[1]; - return true; + if (!PyList_Check(obj) || PyList_GET_SIZE(obj) != 2) + return false; + if (!float_array_from_PyList(obj, v, 2)) + return false; + vec[0] = v[0]; + vec[1] = v[1]; + return true; } bool Vec3f_ptr_from_PyList(PyObject *obj, Vec3f &vec) { - float v[3]; + float v[3]; - if (!PyList_Check(obj) || PyList_GET_SIZE(obj) != 3) - return false; - if (!float_array_from_PyList(obj, v, 3)) - return false; - vec[0] = v[0]; - vec[1] = v[1]; - vec[2] = v[2]; - return true; + if (!PyList_Check(obj) || PyList_GET_SIZE(obj) != 3) + return false; + if (!float_array_from_PyList(obj, v, 3)) + return false; + vec[0] = v[0]; + vec[1] = v[1]; + vec[2] = v[2]; + return true; } bool Vec3r_ptr_from_PyList(PyObject *obj, Vec3r &vec) { - float v[3]; + float v[3]; - if (!PyList_Check(obj) || PyList_GET_SIZE(obj) != 3) - return false; - if (!float_array_from_PyList(obj, v, 3)) - return false; - vec[0] = v[0]; - vec[1] = v[1]; - vec[2] = v[2]; - return true; + if (!PyList_Check(obj) || PyList_GET_SIZE(obj) != 3) + return false; + if (!float_array_from_PyList(obj, v, 3)) + return false; + vec[0] = v[0]; + vec[1] = v[1]; + vec[2] = v[2]; + return true; } static bool float_array_from_PyTuple(PyObject *obj, float *v, int n) { - for (int i = 0; i < n; i++) { - v[i] = PyFloat_AsDouble(PyTuple_GET_ITEM(obj, i)); - if (v[i] == -1.0f && PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, "tuple elements must be a number"); - return 0; - } - } - return 1; + for (int i = 0; i < n; i++) { + v[i] = PyFloat_AsDouble(PyTuple_GET_ITEM(obj, i)); + if (v[i] == -1.0f && PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, "tuple elements must be a number"); + return 0; + } + } + return 1; } bool Vec2f_ptr_from_PyTuple(PyObject *obj, Vec2f &vec) { - float v[2]; + float v[2]; - if (!PyTuple_Check(obj) || PyTuple_GET_SIZE(obj) != 2) - return false; - if (!float_array_from_PyTuple(obj, v, 2)) - return false; - vec[0] = v[0]; - vec[1] = v[1]; - return true; + if (!PyTuple_Check(obj) || PyTuple_GET_SIZE(obj) != 2) + return false; + if (!float_array_from_PyTuple(obj, v, 2)) + return false; + vec[0] = v[0]; + vec[1] = v[1]; + return true; } bool Vec3f_ptr_from_PyTuple(PyObject *obj, Vec3f &vec) { - float v[3]; + float v[3]; - if (!PyTuple_Check(obj) || PyTuple_GET_SIZE(obj) != 3) - return false; - if (!float_array_from_PyTuple(obj, v, 3)) - return false; - vec[0] = v[0]; - vec[1] = v[1]; - vec[2] = v[2]; - return true; + if (!PyTuple_Check(obj) || PyTuple_GET_SIZE(obj) != 3) + return false; + if (!float_array_from_PyTuple(obj, v, 3)) + return false; + vec[0] = v[0]; + vec[1] = v[1]; + vec[2] = v[2]; + return true; } bool Vec3r_ptr_from_PyTuple(PyObject *obj, Vec3r &vec) { - float v[3]; + float v[3]; - if (!PyTuple_Check(obj) || PyTuple_GET_SIZE(obj) != 3) - return false; - if (!float_array_from_PyTuple(obj, v, 3)) - return false; - vec[0] = v[0]; - vec[1] = v[1]; - vec[2] = v[2]; - return true; + if (!PyTuple_Check(obj) || PyTuple_GET_SIZE(obj) != 3) + return false; + if (!float_array_from_PyTuple(obj, v, 3)) + return false; + vec[0] = v[0]; + vec[1] = v[1]; + vec[2] = v[2]; + return true; } // helpers for argument parsing 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) - return 0; - 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) - return 0; - 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) { - return float_array_from_PyList(obj, v, n); - } - else if (PyTuple_Check(obj) && PyTuple_GET_SIZE(obj) == n) { - return float_array_from_PyTuple(obj, v, n); - } - return 0; + if (VectorObject_Check(obj) && ((VectorObject *)obj)->size == n) { + if (BaseMath_ReadCallback((BaseMathObject *)obj) == -1) + return 0; + 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) + return 0; + 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) { + return float_array_from_PyList(obj, v, n); + } + else if (PyTuple_Check(obj) && PyTuple_GET_SIZE(obj) == n) { + return float_array_from_PyTuple(obj, v, n); + } + return 0; } int convert_v4(PyObject *obj, void *v) { - return mathutils_array_parse((float *)v, 4, 4, obj, "Error parsing 4D vector"); + return mathutils_array_parse((float *)v, 4, 4, obj, "Error parsing 4D vector"); } int convert_v3(PyObject *obj, void *v) { - return mathutils_array_parse((float *)v, 3, 3, obj, "Error parsing 3D vector"); + return mathutils_array_parse((float *)v, 3, 3, obj, "Error parsing 3D vector"); } int convert_v2(PyObject *obj, void *v) { - return mathutils_array_parse((float *)v, 2, 2, obj, "Error parsing 2D vector"); + return mathutils_array_parse((float *)v, 2, 2, obj, "Error parsing 2D vector"); } - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/BPy_Convert.h b/source/blender/freestyle/intern/python/BPy_Convert.h index 1b0ce43640b..fffe25fde60 100644 --- a/source/blender/freestyle/intern/python/BPy_Convert.h +++ b/source/blender/freestyle/intern/python/BPy_Convert.h @@ -95,52 +95,53 @@ extern "C" { //============================== PyObject *PyBool_from_bool(bool b); -PyObject *Vector_from_Vec2f(Vec2f& v); -PyObject *Vector_from_Vec3f(Vec3f& v); -PyObject *Vector_from_Vec3r(Vec3r& v); - -PyObject *Any_BPy_Interface0D_from_Interface0D(Interface0D& if0D); -PyObject *Any_BPy_Interface1D_from_Interface1D(Interface1D& if1D); -PyObject *Any_BPy_FEdge_from_FEdge(FEdge& fe); -PyObject *Any_BPy_ViewVertex_from_ViewVertex(ViewVertex& vv); - -PyObject *BPy_BBox_from_BBox(const BBox< Vec3r > &bb); -PyObject *BPy_CurvePoint_from_CurvePoint(CurvePoint& cp); -PyObject *BPy_directedViewEdge_from_directedViewEdge(ViewVertex::directedViewEdge& dve); -PyObject *BPy_FEdge_from_FEdge(FEdge& fe); -PyObject *BPy_FEdgeSharp_from_FEdgeSharp(FEdgeSharp& fes); -PyObject *BPy_FEdgeSmooth_from_FEdgeSmooth(FEdgeSmooth& fes); -PyObject *BPy_Id_from_Id(Id& id); -PyObject *BPy_Interface0D_from_Interface0D(Interface0D& if0D); -PyObject *BPy_Interface1D_from_Interface1D(Interface1D& if1D); +PyObject *Vector_from_Vec2f(Vec2f &v); +PyObject *Vector_from_Vec3f(Vec3f &v); +PyObject *Vector_from_Vec3r(Vec3r &v); + +PyObject *Any_BPy_Interface0D_from_Interface0D(Interface0D &if0D); +PyObject *Any_BPy_Interface1D_from_Interface1D(Interface1D &if1D); +PyObject *Any_BPy_FEdge_from_FEdge(FEdge &fe); +PyObject *Any_BPy_ViewVertex_from_ViewVertex(ViewVertex &vv); + +PyObject *BPy_BBox_from_BBox(const BBox &bb); +PyObject *BPy_CurvePoint_from_CurvePoint(CurvePoint &cp); +PyObject *BPy_directedViewEdge_from_directedViewEdge(ViewVertex::directedViewEdge &dve); +PyObject *BPy_FEdge_from_FEdge(FEdge &fe); +PyObject *BPy_FEdgeSharp_from_FEdgeSharp(FEdgeSharp &fes); +PyObject *BPy_FEdgeSmooth_from_FEdgeSmooth(FEdgeSmooth &fes); +PyObject *BPy_Id_from_Id(Id &id); +PyObject *BPy_Interface0D_from_Interface0D(Interface0D &if0D); +PyObject *BPy_Interface1D_from_Interface1D(Interface1D &if1D); PyObject *BPy_IntegrationType_from_IntegrationType(IntegrationType i); -PyObject *BPy_FrsMaterial_from_FrsMaterial(const FrsMaterial& m); +PyObject *BPy_FrsMaterial_from_FrsMaterial(const FrsMaterial &m); PyObject *BPy_Nature_from_Nature(unsigned short n); PyObject *BPy_MediumType_from_MediumType(Stroke::MediumType n); -PyObject *BPy_SShape_from_SShape(SShape& ss); -PyObject *BPy_Stroke_from_Stroke(Stroke& s); -PyObject *BPy_StrokeAttribute_from_StrokeAttribute(StrokeAttribute& sa); -PyObject *BPy_StrokeVertex_from_StrokeVertex(StrokeVertex& sv); -PyObject *BPy_SVertex_from_SVertex(SVertex& sv); -PyObject *BPy_ViewVertex_from_ViewVertex(ViewVertex& vv); -PyObject *BPy_NonTVertex_from_NonTVertex(NonTVertex& ntv); -PyObject *BPy_TVertex_from_TVertex(TVertex& tv); -PyObject *BPy_ViewEdge_from_ViewEdge(ViewEdge& ve); -PyObject *BPy_Chain_from_Chain(Chain& c); -PyObject *BPy_ViewShape_from_ViewShape(ViewShape& vs); - -PyObject *BPy_AdjacencyIterator_from_AdjacencyIterator(AdjacencyIterator& a_it); -PyObject *BPy_Interface0DIterator_from_Interface0DIterator(Interface0DIterator& if0D_it, bool reversed); -PyObject *BPy_CurvePointIterator_from_CurvePointIterator(CurveInternal::CurvePointIterator& cp_it); -PyObject *BPy_StrokeVertexIterator_from_StrokeVertexIterator(StrokeInternal::StrokeVertexIterator& sv_it, - bool reversed); -PyObject *BPy_SVertexIterator_from_SVertexIterator(ViewEdgeInternal::SVertexIterator& sv_it); -PyObject *BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator(ViewVertexInternal::orientedViewEdgeIterator& ove_it, - bool reversed); -PyObject *BPy_ViewEdgeIterator_from_ViewEdgeIterator(ViewEdgeInternal::ViewEdgeIterator& ve_it); -PyObject *BPy_ChainingIterator_from_ChainingIterator(ChainingIterator& c_it); -PyObject *BPy_ChainPredicateIterator_from_ChainPredicateIterator(ChainPredicateIterator& cp_it); -PyObject *BPy_ChainSilhouetteIterator_from_ChainSilhouetteIterator(ChainSilhouetteIterator& cs_it); +PyObject *BPy_SShape_from_SShape(SShape &ss); +PyObject *BPy_Stroke_from_Stroke(Stroke &s); +PyObject *BPy_StrokeAttribute_from_StrokeAttribute(StrokeAttribute &sa); +PyObject *BPy_StrokeVertex_from_StrokeVertex(StrokeVertex &sv); +PyObject *BPy_SVertex_from_SVertex(SVertex &sv); +PyObject *BPy_ViewVertex_from_ViewVertex(ViewVertex &vv); +PyObject *BPy_NonTVertex_from_NonTVertex(NonTVertex &ntv); +PyObject *BPy_TVertex_from_TVertex(TVertex &tv); +PyObject *BPy_ViewEdge_from_ViewEdge(ViewEdge &ve); +PyObject *BPy_Chain_from_Chain(Chain &c); +PyObject *BPy_ViewShape_from_ViewShape(ViewShape &vs); + +PyObject *BPy_AdjacencyIterator_from_AdjacencyIterator(AdjacencyIterator &a_it); +PyObject *BPy_Interface0DIterator_from_Interface0DIterator(Interface0DIterator &if0D_it, + bool reversed); +PyObject *BPy_CurvePointIterator_from_CurvePointIterator(CurveInternal::CurvePointIterator &cp_it); +PyObject *BPy_StrokeVertexIterator_from_StrokeVertexIterator( + StrokeInternal::StrokeVertexIterator &sv_it, bool reversed); +PyObject *BPy_SVertexIterator_from_SVertexIterator(ViewEdgeInternal::SVertexIterator &sv_it); +PyObject *BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator( + ViewVertexInternal::orientedViewEdgeIterator &ove_it, bool reversed); +PyObject *BPy_ViewEdgeIterator_from_ViewEdgeIterator(ViewEdgeInternal::ViewEdgeIterator &ve_it); +PyObject *BPy_ChainingIterator_from_ChainingIterator(ChainingIterator &c_it); +PyObject *BPy_ChainPredicateIterator_from_ChainPredicateIterator(ChainPredicateIterator &cp_it); +PyObject *BPy_ChainSilhouetteIterator_from_ChainSilhouetteIterator(ChainSilhouetteIterator &cs_it); //============================== // Python => C++ @@ -177,5 +178,4 @@ int convert_v2(PyObject *obj, void *v); } #endif - #endif /* __FREESTYLE_PYTHON_CONVERT_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp index e3c7a972867..0b543c06ba6 100644 --- a/source/blender/freestyle/intern/python/BPy_Freestyle.cpp +++ b/source/blender/freestyle/intern/python/BPy_Freestyle.cpp @@ -45,7 +45,6 @@ #include "BPy_ViewMap.h" #include "BPy_ViewShape.h" - #ifdef __cplusplus extern "C" { #endif @@ -61,411 +60,441 @@ extern "C" { #include "bpy_rna.h" /* pyrna_struct_CreatePyObject() */ static char Freestyle_getCurrentScene___doc__[] = -".. function:: getCurrentScene()\n" -"\n" -" Returns the current scene.\n" -"\n" -" :return: The current scene.\n" -" :rtype: :class:`bpy.types.Scene`\n"; + ".. function:: getCurrentScene()\n" + "\n" + " Returns the current scene.\n" + "\n" + " :return: The current scene.\n" + " :rtype: :class:`bpy.types.Scene`\n"; static PyObject *Freestyle_getCurrentScene(PyObject * /*self*/) { - Scene *scene = g_freestyle.scene; - if (!scene) { - PyErr_SetString(PyExc_TypeError, "current scene not available"); - return NULL; - } - PointerRNA ptr_scene; - RNA_pointer_create(&scene->id, &RNA_Scene, scene, &ptr_scene); - return pyrna_struct_CreatePyObject(&ptr_scene); + Scene *scene = g_freestyle.scene; + if (!scene) { + PyErr_SetString(PyExc_TypeError, "current scene not available"); + return NULL; + } + PointerRNA ptr_scene; + RNA_pointer_create(&scene->id, &RNA_Scene, scene, &ptr_scene); + return pyrna_struct_CreatePyObject(&ptr_scene); } #include "DNA_material_types.h" static int ramp_blend_type(const char *type) { - if (STREQ(type, "MIX")) return MA_RAMP_BLEND; - if (STREQ(type, "ADD")) return MA_RAMP_ADD; - if (STREQ(type, "MULTIPLY")) return MA_RAMP_MULT; - if (STREQ(type, "SUBTRACT")) return MA_RAMP_SUB; - if (STREQ(type, "SCREEN")) return MA_RAMP_SCREEN; - if (STREQ(type, "DIVIDE")) return MA_RAMP_DIV; - if (STREQ(type, "DIFFERENCE")) return MA_RAMP_DIFF; - if (STREQ(type, "DARKEN")) return MA_RAMP_DARK; - if (STREQ(type, "LIGHTEN")) return MA_RAMP_LIGHT; - if (STREQ(type, "OVERLAY")) return MA_RAMP_OVERLAY; - if (STREQ(type, "DODGE")) return MA_RAMP_DODGE; - if (STREQ(type, "BURN")) return MA_RAMP_BURN; - if (STREQ(type, "HUE")) return MA_RAMP_HUE; - if (STREQ(type, "SATURATION")) return MA_RAMP_SAT; - if (STREQ(type, "VALUE")) return MA_RAMP_VAL; - if (STREQ(type, "COLOR")) return MA_RAMP_COLOR; - if (STREQ(type, "SOFT_LIGHT")) return MA_RAMP_SOFT; - if (STREQ(type, "LINEAR_LIGHT")) return MA_RAMP_LINEAR; - return -1; + if (STREQ(type, "MIX")) + return MA_RAMP_BLEND; + if (STREQ(type, "ADD")) + return MA_RAMP_ADD; + if (STREQ(type, "MULTIPLY")) + return MA_RAMP_MULT; + if (STREQ(type, "SUBTRACT")) + return MA_RAMP_SUB; + if (STREQ(type, "SCREEN")) + return MA_RAMP_SCREEN; + if (STREQ(type, "DIVIDE")) + return MA_RAMP_DIV; + if (STREQ(type, "DIFFERENCE")) + return MA_RAMP_DIFF; + if (STREQ(type, "DARKEN")) + return MA_RAMP_DARK; + if (STREQ(type, "LIGHTEN")) + return MA_RAMP_LIGHT; + if (STREQ(type, "OVERLAY")) + return MA_RAMP_OVERLAY; + if (STREQ(type, "DODGE")) + return MA_RAMP_DODGE; + if (STREQ(type, "BURN")) + return MA_RAMP_BURN; + if (STREQ(type, "HUE")) + return MA_RAMP_HUE; + if (STREQ(type, "SATURATION")) + return MA_RAMP_SAT; + if (STREQ(type, "VALUE")) + return MA_RAMP_VAL; + if (STREQ(type, "COLOR")) + return MA_RAMP_COLOR; + if (STREQ(type, "SOFT_LIGHT")) + return MA_RAMP_SOFT; + if (STREQ(type, "LINEAR_LIGHT")) + return MA_RAMP_LINEAR; + return -1; } #include "BKE_material.h" /* ramp_blend() */ static char Freestyle_blendRamp___doc__[] = -".. function:: blendRamp(type, color1, fac, color2)\n" -"\n" -" Blend two colors according to a ramp blend type.\n" -"\n" -" :arg type: Ramp blend type.\n" -" :type type: int\n" -" :arg color1: 1st color.\n" -" :type color1: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n" -" :arg fac: Blend factor.\n" -" :type fac: float\n" -" :arg color2: 1st color.\n" -" :type color2: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n" -" :return: Blended color in RGB format.\n" -" :rtype: :class:`mathutils.Vector`\n"; + ".. function:: blendRamp(type, color1, fac, color2)\n" + "\n" + " Blend two colors according to a ramp blend type.\n" + "\n" + " :arg type: Ramp blend type.\n" + " :type type: int\n" + " :arg color1: 1st color.\n" + " :type color1: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n" + " :arg fac: Blend factor.\n" + " :type fac: float\n" + " :arg color2: 1st color.\n" + " :type color2: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n" + " :return: Blended color in RGB format.\n" + " :rtype: :class:`mathutils.Vector`\n"; static PyObject *Freestyle_blendRamp(PyObject * /*self*/, PyObject *args) { - PyObject *obj1, *obj2; - char *s; - int type; - float a[3], fac, b[3]; - - 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"); - return NULL; - } - if (mathutils_array_parse(a, 3, 3, obj1, - "argument 2 must be a 3D vector " - "(either a tuple/list of 3 elements or Vector)") == -1) - { - return NULL; - } - if (mathutils_array_parse(b, 3, 3, obj2, - "argument 4 must be a 3D vector " - "(either a tuple/list of 3 elements or Vector)") == -1) - { - return NULL; - } - ramp_blend(type, a, fac, b); - return Vector_CreatePyObject(a, 3, NULL); + PyObject *obj1, *obj2; + char *s; + int type; + float a[3], fac, b[3]; + + 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"); + return NULL; + } + if (mathutils_array_parse(a, + 3, + 3, + obj1, + "argument 2 must be a 3D vector " + "(either a tuple/list of 3 elements or Vector)") == -1) { + return NULL; + } + if (mathutils_array_parse(b, + 3, + 3, + obj2, + "argument 4 must be a 3D vector " + "(either a tuple/list of 3 elements or Vector)") == -1) { + return NULL; + } + ramp_blend(type, a, fac, b); + return Vector_CreatePyObject(a, 3, NULL); } #include "BKE_colorband.h" /* BKE_colorband_evaluate() */ static char Freestyle_evaluateColorRamp___doc__[] = -".. function:: evaluateColorRamp(ramp, in)\n" -"\n" -" Evaluate a color ramp at a point in the interval 0 to 1.\n" -"\n" -" :arg ramp: Color ramp object.\n" -" :type ramp: :class:`bpy.types.ColorRamp`\n" -" :arg in: Value in the interval 0 to 1.\n" -" :type in: float\n" -" :return: color in RGBA format.\n" -" :rtype: :class:`mathutils.Vector`\n"; + ".. function:: evaluateColorRamp(ramp, in)\n" + "\n" + " Evaluate a color ramp at a point in the interval 0 to 1.\n" + "\n" + " :arg ramp: Color ramp object.\n" + " :type ramp: :class:`bpy.types.ColorRamp`\n" + " :arg in: Value in the interval 0 to 1.\n" + " :type in: float\n" + " :return: color in RGBA format.\n" + " :rtype: :class:`mathutils.Vector`\n"; static PyObject *Freestyle_evaluateColorRamp(PyObject * /*self*/, PyObject *args) { - BPy_StructRNA *py_srna; - ColorBand *coba; - float in, out[4]; - - 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; - } - coba = (ColorBand *)py_srna->ptr.data; - if (!BKE_colorband_evaluate(coba, in, out)) { - PyErr_SetString(PyExc_ValueError, "failed to evaluate the color ramp"); - return NULL; - } - return Vector_CreatePyObject(out, 4, NULL); + BPy_StructRNA *py_srna; + ColorBand *coba; + float in, out[4]; + + 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; + } + coba = (ColorBand *)py_srna->ptr.data; + if (!BKE_colorband_evaluate(coba, in, out)) { + PyErr_SetString(PyExc_ValueError, "failed to evaluate the color ramp"); + return NULL; + } + return Vector_CreatePyObject(out, 4, NULL); } #include "DNA_color_types.h" #include "BKE_colortools.h" /* curvemapping_evaluateF() */ static char Freestyle_evaluateCurveMappingF___doc__[] = -".. function:: evaluateCurveMappingF(cumap, cur, value)\n" -"\n" -" Evaluate a curve mapping at a point in the interval 0 to 1.\n" -"\n" -" :arg cumap: Curve mapping object.\n" -" :type cumap: :class:`bpy.types.CurveMapping`\n" -" :arg cur: Index of the curve to be used (0 <= cur <= 3).\n" -" :type cur: int\n" -" :arg value: Input value in the interval 0 to 1.\n" -" :type value: float\n" -" :return: Mapped output value.\n" -" :rtype: float\n"; + ".. function:: evaluateCurveMappingF(cumap, cur, value)\n" + "\n" + " Evaluate a curve mapping at a point in the interval 0 to 1.\n" + "\n" + " :arg cumap: Curve mapping object.\n" + " :type cumap: :class:`bpy.types.CurveMapping`\n" + " :arg cur: Index of the curve to be used (0 <= cur <= 3).\n" + " :type cur: int\n" + " :arg value: Input value in the interval 0 to 1.\n" + " :type value: float\n" + " :return: Mapped output value.\n" + " :rtype: float\n"; static PyObject *Freestyle_evaluateCurveMappingF(PyObject * /*self*/, PyObject *args) { - BPy_StructRNA *py_srna; - CurveMapping *cumap; - int cur; - float 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; - } - if (cur < 0 || cur > 3) { - PyErr_SetString(PyExc_ValueError, "2nd argument is out of range"); - return NULL; - } - cumap = (CurveMapping *)py_srna->ptr.data; - curvemapping_initialize(cumap); - /* disable extrapolation if enabled */ - if ((cumap->cm[cur].flag & CUMA_EXTEND_EXTRAPOLATE)) { - cumap->cm[cur].flag &= ~(CUMA_EXTEND_EXTRAPOLATE); - curvemapping_changed(cumap, 0); - } - return PyFloat_FromDouble(curvemapping_evaluateF(cumap, cur, value)); + BPy_StructRNA *py_srna; + CurveMapping *cumap; + int cur; + float 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; + } + if (cur < 0 || cur > 3) { + PyErr_SetString(PyExc_ValueError, "2nd argument is out of range"); + return NULL; + } + cumap = (CurveMapping *)py_srna->ptr.data; + curvemapping_initialize(cumap); + /* disable extrapolation if enabled */ + if ((cumap->cm[cur].flag & CUMA_EXTEND_EXTRAPOLATE)) { + cumap->cm[cur].flag &= ~(CUMA_EXTEND_EXTRAPOLATE); + curvemapping_changed(cumap, 0); + } + return PyFloat_FromDouble(curvemapping_evaluateF(cumap, cur, value)); } /*-----------------------Freestyle module docstring----------------------------*/ static char module_docstring[] = -"This module provides classes for defining line drawing rules (such as\n" -"predicates, functions, chaining iterators, and stroke shaders), as well\n" -"as helper functions for style module writing.\n" -"\n" -"Class hierarchy:\n" -"\n" -"- :class:`BBox`\n" -"- :class:`BinaryPredicate0D`\n" -"- :class:`BinaryPredicate1D`\n" -"\n" -" - :class:`FalseBP1D`\n" -" - :class:`Length2DBP1D`\n" -" - :class:`SameShapeIdBP1D`\n" -" - :class:`TrueBP1D`\n" -" - :class:`ViewMapGradientNormBP1D`\n" -"\n" -"- :class:`Id`\n" -"- :class:`Interface0D`\n" -"\n" -" - :class:`CurvePoint`\n" -"\n" -" - :class:`StrokeVertex`\n" -"\n" -" - :class:`SVertex`\n" -" - :class:`ViewVertex`\n" -"\n" -" - :class:`NonTVertex`\n" -" - :class:`TVertex`\n" -"\n" -"- :class:`Interface1D`\n" -"\n" -" - :class:`Curve`\n" -"\n" -" - :class:`Chain`\n" -"\n" -" - :class:`FEdge`\n" -"\n" -" - :class:`FEdgeSharp`\n" -" - :class:`FEdgeSmooth`\n" -"\n" -" - :class:`Stroke`\n" -" - :class:`ViewEdge`\n" -"\n" -"- :class:`Iterator`\n" -"\n" -" - :class:`AdjacencyIterator`\n" -" - :class:`CurvePointIterator`\n" -" - :class:`Interface0DIterator`\n" -" - :class:`SVertexIterator`\n" -" - :class:`StrokeVertexIterator`\n" -" - :class:`ViewEdgeIterator`\n" -"\n" -" - :class:`ChainingIterator`\n" -"\n" -" - :class:`ChainPredicateIterator`\n" -" - :class:`ChainSilhouetteIterator`\n" -"\n" -" - :class:`orientedViewEdgeIterator`\n" -"\n" -"- :class:`Material`\n" -"- :class:`Noise`\n" -"- :class:`Operators`\n" -"- :class:`SShape`\n" -"- :class:`StrokeAttribute`\n" -"- :class:`StrokeShader`\n" -"\n" -" - :class:`BackboneStretcherShader`\n" -" - :class:`BezierCurveShader`\n" -" - :class:`BlenderTextureShader`\n" -" - :class:`CalligraphicShader`\n" -" - :class:`ColorNoiseShader`\n" -" - :class:`ColorVariationPatternShader`\n" -" - :class:`ConstantColorShader`\n" -" - :class:`ConstantThicknessShader`\n" -" - :class:`ConstrainedIncreasingThicknessShader`\n" -" - :class:`GuidingLinesShader`\n" -" - :class:`IncreasingColorShader`\n" -" - :class:`IncreasingThicknessShader`\n" -" - :class:`PolygonalizationShader`\n" -" - :class:`SamplingShader`\n" -" - :class:`SmoothingShader`\n" -" - :class:`SpatialNoiseShader`\n" -" - :class:`StrokeTextureShader`\n" -" - :class:`StrokeTextureStepShader`\n" -" - :class:`TextureAssignerShader`\n" -" - :class:`ThicknessNoiseShader`\n" -" - :class:`ThicknessVariationPatternShader`\n" -" - :class:`TipRemoverShader`\n" -" - :class:`fstreamShader`\n" -" - :class:`streamShader`\n" -"\n" -"- :class:`UnaryFunction0D`\n" -"\n" -" - :class:`UnaryFunction0DDouble`\n" -"\n" -" - :class:`Curvature2DAngleF0D`\n" -" - :class:`DensityF0D`\n" -" - :class:`GetProjectedXF0D`\n" -" - :class:`GetProjectedYF0D`\n" -" - :class:`GetProjectedZF0D`\n" -" - :class:`GetXF0D`\n" -" - :class:`GetYF0D`\n" -" - :class:`GetZF0D`\n" -" - :class:`LocalAverageDepthF0D`\n" -" - :class:`ZDiscontinuityF0D`\n" -"\n" -" - :class:`UnaryFunction0DEdgeNature`\n" -"\n" -" - :class:`CurveNatureF0D`\n" -"\n" -" - :class:`UnaryFunction0DFloat`\n" -"\n" -" - :class:`GetCurvilinearAbscissaF0D`\n" -" - :class:`GetParameterF0D`\n" -" - :class:`GetViewMapGradientNormF0D`\n" -" - :class:`ReadCompleteViewMapPixelF0D`\n" -" - :class:`ReadMapPixelF0D`\n" -" - :class:`ReadSteerableViewMapPixelF0D`\n" -"\n" -" - :class:`UnaryFunction0DId`\n" -"\n" -" - :class:`ShapeIdF0D`\n" -"\n" -" - :class:`UnaryFunction0DMaterial`\n" -"\n" -" - :class:`MaterialF0D`\n" -"\n" -" - :class:`UnaryFunction0DUnsigned`\n" -"\n" -" - :class:`QuantitativeInvisibilityF0D`\n" -"\n" -" - :class:`UnaryFunction0DVec2f`\n" -"\n" -" - :class:`Normal2DF0D`\n" -" - :class:`VertexOrientation2DF0D`\n" -"\n" -" - :class:`UnaryFunction0DVec3f`\n" -"\n" -" - :class:`VertexOrientation3DF0D`\n" -"\n" -" - :class:`UnaryFunction0DVectorViewShape`\n" -"\n" -" - :class:`GetOccludersF0D`\n" -"\n" -" - :class:`UnaryFunction0DViewShape`\n" -"\n" -" - :class:`GetOccludeeF0D`\n" -" - :class:`GetShapeF0D`\n" -"\n" -"- :class:`UnaryFunction1D`\n" -"\n" -" - :class:`UnaryFunction1DDouble`\n" -"\n" -" - :class:`Curvature2DAngleF1D`\n" -" - :class:`DensityF1D`\n" -" - :class:`GetCompleteViewMapDensityF1D`\n" -" - :class:`GetDirectionalViewMapDensityF1D`\n" -" - :class:`GetProjectedXF1D`\n" -" - :class:`GetProjectedYF1D`\n" -" - :class:`GetProjectedZF1D`\n" -" - :class:`GetSteerableViewMapDensityF1D`\n" -" - :class:`GetViewMapGradientNormF1D`\n" -" - :class:`GetXF1D`\n" -" - :class:`GetYF1D`\n" -" - :class:`GetZF1D`\n" -" - :class:`LocalAverageDepthF1D`\n" -" - :class:`ZDiscontinuityF1D`\n" -"\n" -" - :class:`UnaryFunction1DEdgeNature`\n" -"\n" -" - :class:`CurveNatureF1D`\n" -"\n" -" - :class:`UnaryFunction1DFloat`\n" -" - :class:`UnaryFunction1DUnsigned`\n" -"\n" -" - :class:`QuantitativeInvisibilityF1D`\n" -"\n" -" - :class:`UnaryFunction1DVec2f`\n" -"\n" -" - :class:`Normal2DF1D`\n" -" - :class:`Orientation2DF1D`\n" -"\n" -" - :class:`UnaryFunction1DVec3f`\n" -"\n" -" - :class:`Orientation3DF1D`\n" -"\n" -" - :class:`UnaryFunction1DVectorViewShape`\n" -"\n" -" - :class:`GetOccludeeF1D`\n" -" - :class:`GetOccludersF1D`\n" -" - :class:`GetShapeF1D`\n" -"\n" -" - :class:`UnaryFunction1DVoid`\n" -"\n" -" - :class:`ChainingTimeStampF1D`\n" -" - :class:`IncrementChainingTimeStampF1D`\n" -" - :class:`TimeStampF1D`\n" -"\n" -"- :class:`UnaryPredicate0D`\n" -"\n" -" - :class:`FalseUP0D`\n" -" - :class:`TrueUP0D`\n" -"\n" -"- :class:`UnaryPredicate1D`\n" -"\n" -" - :class:`ContourUP1D`\n" -" - :class:`DensityLowerThanUP1D`\n" -" - :class:`EqualToChainingTimeStampUP1D`\n" -" - :class:`EqualToTimeStampUP1D`\n" -" - :class:`ExternalContourUP1D`\n" -" - :class:`FalseUP1D`\n" -" - :class:`QuantitativeInvisibilityUP1D`\n" -" - :class:`ShapeUP1D`\n" -" - :class:`TrueUP1D`\n" -" - :class:`WithinImageBoundaryUP1D`\n" -"\n" -"- :class:`ViewMap`\n" -"- :class:`ViewShape`\n" -"- :class:`IntegrationType`\n" -"- :class:`MediumType`\n" -"- :class:`Nature`\n" -"\n"; + "This module provides classes for defining line drawing rules (such as\n" + "predicates, functions, chaining iterators, and stroke shaders), as well\n" + "as helper functions for style module writing.\n" + "\n" + "Class hierarchy:\n" + "\n" + "- :class:`BBox`\n" + "- :class:`BinaryPredicate0D`\n" + "- :class:`BinaryPredicate1D`\n" + "\n" + " - :class:`FalseBP1D`\n" + " - :class:`Length2DBP1D`\n" + " - :class:`SameShapeIdBP1D`\n" + " - :class:`TrueBP1D`\n" + " - :class:`ViewMapGradientNormBP1D`\n" + "\n" + "- :class:`Id`\n" + "- :class:`Interface0D`\n" + "\n" + " - :class:`CurvePoint`\n" + "\n" + " - :class:`StrokeVertex`\n" + "\n" + " - :class:`SVertex`\n" + " - :class:`ViewVertex`\n" + "\n" + " - :class:`NonTVertex`\n" + " - :class:`TVertex`\n" + "\n" + "- :class:`Interface1D`\n" + "\n" + " - :class:`Curve`\n" + "\n" + " - :class:`Chain`\n" + "\n" + " - :class:`FEdge`\n" + "\n" + " - :class:`FEdgeSharp`\n" + " - :class:`FEdgeSmooth`\n" + "\n" + " - :class:`Stroke`\n" + " - :class:`ViewEdge`\n" + "\n" + "- :class:`Iterator`\n" + "\n" + " - :class:`AdjacencyIterator`\n" + " - :class:`CurvePointIterator`\n" + " - :class:`Interface0DIterator`\n" + " - :class:`SVertexIterator`\n" + " - :class:`StrokeVertexIterator`\n" + " - :class:`ViewEdgeIterator`\n" + "\n" + " - :class:`ChainingIterator`\n" + "\n" + " - :class:`ChainPredicateIterator`\n" + " - :class:`ChainSilhouetteIterator`\n" + "\n" + " - :class:`orientedViewEdgeIterator`\n" + "\n" + "- :class:`Material`\n" + "- :class:`Noise`\n" + "- :class:`Operators`\n" + "- :class:`SShape`\n" + "- :class:`StrokeAttribute`\n" + "- :class:`StrokeShader`\n" + "\n" + " - :class:`BackboneStretcherShader`\n" + " - :class:`BezierCurveShader`\n" + " - :class:`BlenderTextureShader`\n" + " - :class:`CalligraphicShader`\n" + " - :class:`ColorNoiseShader`\n" + " - :class:`ColorVariationPatternShader`\n" + " - :class:`ConstantColorShader`\n" + " - :class:`ConstantThicknessShader`\n" + " - :class:`ConstrainedIncreasingThicknessShader`\n" + " - :class:`GuidingLinesShader`\n" + " - :class:`IncreasingColorShader`\n" + " - :class:`IncreasingThicknessShader`\n" + " - :class:`PolygonalizationShader`\n" + " - :class:`SamplingShader`\n" + " - :class:`SmoothingShader`\n" + " - :class:`SpatialNoiseShader`\n" + " - :class:`StrokeTextureShader`\n" + " - :class:`StrokeTextureStepShader`\n" + " - :class:`TextureAssignerShader`\n" + " - :class:`ThicknessNoiseShader`\n" + " - :class:`ThicknessVariationPatternShader`\n" + " - :class:`TipRemoverShader`\n" + " - :class:`fstreamShader`\n" + " - :class:`streamShader`\n" + "\n" + "- :class:`UnaryFunction0D`\n" + "\n" + " - :class:`UnaryFunction0DDouble`\n" + "\n" + " - :class:`Curvature2DAngleF0D`\n" + " - :class:`DensityF0D`\n" + " - :class:`GetProjectedXF0D`\n" + " - :class:`GetProjectedYF0D`\n" + " - :class:`GetProjectedZF0D`\n" + " - :class:`GetXF0D`\n" + " - :class:`GetYF0D`\n" + " - :class:`GetZF0D`\n" + " - :class:`LocalAverageDepthF0D`\n" + " - :class:`ZDiscontinuityF0D`\n" + "\n" + " - :class:`UnaryFunction0DEdgeNature`\n" + "\n" + " - :class:`CurveNatureF0D`\n" + "\n" + " - :class:`UnaryFunction0DFloat`\n" + "\n" + " - :class:`GetCurvilinearAbscissaF0D`\n" + " - :class:`GetParameterF0D`\n" + " - :class:`GetViewMapGradientNormF0D`\n" + " - :class:`ReadCompleteViewMapPixelF0D`\n" + " - :class:`ReadMapPixelF0D`\n" + " - :class:`ReadSteerableViewMapPixelF0D`\n" + "\n" + " - :class:`UnaryFunction0DId`\n" + "\n" + " - :class:`ShapeIdF0D`\n" + "\n" + " - :class:`UnaryFunction0DMaterial`\n" + "\n" + " - :class:`MaterialF0D`\n" + "\n" + " - :class:`UnaryFunction0DUnsigned`\n" + "\n" + " - :class:`QuantitativeInvisibilityF0D`\n" + "\n" + " - :class:`UnaryFunction0DVec2f`\n" + "\n" + " - :class:`Normal2DF0D`\n" + " - :class:`VertexOrientation2DF0D`\n" + "\n" + " - :class:`UnaryFunction0DVec3f`\n" + "\n" + " - :class:`VertexOrientation3DF0D`\n" + "\n" + " - :class:`UnaryFunction0DVectorViewShape`\n" + "\n" + " - :class:`GetOccludersF0D`\n" + "\n" + " - :class:`UnaryFunction0DViewShape`\n" + "\n" + " - :class:`GetOccludeeF0D`\n" + " - :class:`GetShapeF0D`\n" + "\n" + "- :class:`UnaryFunction1D`\n" + "\n" + " - :class:`UnaryFunction1DDouble`\n" + "\n" + " - :class:`Curvature2DAngleF1D`\n" + " - :class:`DensityF1D`\n" + " - :class:`GetCompleteViewMapDensityF1D`\n" + " - :class:`GetDirectionalViewMapDensityF1D`\n" + " - :class:`GetProjectedXF1D`\n" + " - :class:`GetProjectedYF1D`\n" + " - :class:`GetProjectedZF1D`\n" + " - :class:`GetSteerableViewMapDensityF1D`\n" + " - :class:`GetViewMapGradientNormF1D`\n" + " - :class:`GetXF1D`\n" + " - :class:`GetYF1D`\n" + " - :class:`GetZF1D`\n" + " - :class:`LocalAverageDepthF1D`\n" + " - :class:`ZDiscontinuityF1D`\n" + "\n" + " - :class:`UnaryFunction1DEdgeNature`\n" + "\n" + " - :class:`CurveNatureF1D`\n" + "\n" + " - :class:`UnaryFunction1DFloat`\n" + " - :class:`UnaryFunction1DUnsigned`\n" + "\n" + " - :class:`QuantitativeInvisibilityF1D`\n" + "\n" + " - :class:`UnaryFunction1DVec2f`\n" + "\n" + " - :class:`Normal2DF1D`\n" + " - :class:`Orientation2DF1D`\n" + "\n" + " - :class:`UnaryFunction1DVec3f`\n" + "\n" + " - :class:`Orientation3DF1D`\n" + "\n" + " - :class:`UnaryFunction1DVectorViewShape`\n" + "\n" + " - :class:`GetOccludeeF1D`\n" + " - :class:`GetOccludersF1D`\n" + " - :class:`GetShapeF1D`\n" + "\n" + " - :class:`UnaryFunction1DVoid`\n" + "\n" + " - :class:`ChainingTimeStampF1D`\n" + " - :class:`IncrementChainingTimeStampF1D`\n" + " - :class:`TimeStampF1D`\n" + "\n" + "- :class:`UnaryPredicate0D`\n" + "\n" + " - :class:`FalseUP0D`\n" + " - :class:`TrueUP0D`\n" + "\n" + "- :class:`UnaryPredicate1D`\n" + "\n" + " - :class:`ContourUP1D`\n" + " - :class:`DensityLowerThanUP1D`\n" + " - :class:`EqualToChainingTimeStampUP1D`\n" + " - :class:`EqualToTimeStampUP1D`\n" + " - :class:`ExternalContourUP1D`\n" + " - :class:`FalseUP1D`\n" + " - :class:`QuantitativeInvisibilityUP1D`\n" + " - :class:`ShapeUP1D`\n" + " - :class:`TrueUP1D`\n" + " - :class:`WithinImageBoundaryUP1D`\n" + "\n" + "- :class:`ViewMap`\n" + "- :class:`ViewShape`\n" + "- :class:`IntegrationType`\n" + "- :class:`MediumType`\n" + "- :class:`Nature`\n" + "\n"; /*-----------------------Freestyle module method def---------------------------*/ static PyMethodDef module_functions[] = { - {"getCurrentScene", (PyCFunction) Freestyle_getCurrentScene, METH_NOARGS, Freestyle_getCurrentScene___doc__}, - {"blendRamp", (PyCFunction) Freestyle_blendRamp, METH_VARARGS, Freestyle_blendRamp___doc__}, - {"evaluateColorRamp", (PyCFunction) Freestyle_evaluateColorRamp, METH_VARARGS, Freestyle_evaluateColorRamp___doc__}, - {"evaluateCurveMappingF", (PyCFunction) Freestyle_evaluateCurveMappingF, METH_VARARGS, - Freestyle_evaluateCurveMappingF___doc__}, - {NULL, NULL, 0, NULL}, + {"getCurrentScene", + (PyCFunction)Freestyle_getCurrentScene, + METH_NOARGS, + Freestyle_getCurrentScene___doc__}, + {"blendRamp", (PyCFunction)Freestyle_blendRamp, METH_VARARGS, Freestyle_blendRamp___doc__}, + {"evaluateColorRamp", + (PyCFunction)Freestyle_evaluateColorRamp, + METH_VARARGS, + Freestyle_evaluateColorRamp___doc__}, + {"evaluateCurveMappingF", + (PyCFunction)Freestyle_evaluateCurveMappingF, + METH_VARARGS, + Freestyle_evaluateCurveMappingF___doc__}, + {NULL, NULL, 0, NULL}, }; /*-----------------------Freestyle module definition---------------------------*/ @@ -481,60 +510,61 @@ static PyModuleDef module_definition = { //-------------------MODULE INITIALIZATION-------------------------------- PyObject *Freestyle_Init(void) { - PyObject *module; - - // initialize modules - module = PyModule_Create(&module_definition); - if (!module) - return NULL; - PyDict_SetItemString(PySys_GetObject("modules"), module_definition.m_name, module); - - // update 'sys.path' for Freestyle Python API modules - const char * const path = BKE_appdir_folder_id(BLENDER_SYSTEM_SCRIPTS, "freestyle"); - if (path) { - char modpath[FILE_MAX]; - BLI_join_dirfile(modpath, sizeof(modpath), path, "modules"); - PyObject *sys_path = PySys_GetObject("path"); /* borrow */ - PyObject *py_modpath = PyUnicode_FromString(modpath); - PyList_Append(sys_path, py_modpath); - Py_DECREF(py_modpath); + PyObject *module; + + // initialize modules + module = PyModule_Create(&module_definition); + if (!module) + return NULL; + PyDict_SetItemString(PySys_GetObject("modules"), module_definition.m_name, module); + + // update 'sys.path' for Freestyle Python API modules + const char *const path = BKE_appdir_folder_id(BLENDER_SYSTEM_SCRIPTS, "freestyle"); + if (path) { + char modpath[FILE_MAX]; + BLI_join_dirfile(modpath, sizeof(modpath), path, "modules"); + PyObject *sys_path = PySys_GetObject("path"); /* borrow */ + PyObject *py_modpath = PyUnicode_FromString(modpath); + PyList_Append(sys_path, py_modpath); + Py_DECREF(py_modpath); #if 0 - printf("Adding Python path: %s\n", modpath); + printf("Adding Python path: %s\n", modpath); #endif - } - else { - printf("Freestyle: couldn't find 'scripts/freestyle/modules', Freestyle won't work properly.\n"); - } - - // attach its classes (adding the object types to the module) - - // those classes have to be initialized before the others - MediumType_Init(module); - Nature_Init(module); - - BBox_Init(module); - BinaryPredicate0D_Init(module); - BinaryPredicate1D_Init(module); - ContextFunctions_Init(module); - FrsMaterial_Init(module); - FrsNoise_Init(module); - Id_Init(module); - IntegrationType_Init(module); - Interface0D_Init(module); - Interface1D_Init(module); - Iterator_Init(module); - Operators_Init(module); - SShape_Init(module); - StrokeAttribute_Init(module); - StrokeShader_Init(module); - UnaryFunction0D_Init(module); - UnaryFunction1D_Init(module); - UnaryPredicate0D_Init(module); - UnaryPredicate1D_Init(module); - ViewMap_Init(module); - ViewShape_Init(module); - - return module; + } + else { + printf( + "Freestyle: couldn't find 'scripts/freestyle/modules', Freestyle won't work properly.\n"); + } + + // attach its classes (adding the object types to the module) + + // those classes have to be initialized before the others + MediumType_Init(module); + Nature_Init(module); + + BBox_Init(module); + BinaryPredicate0D_Init(module); + BinaryPredicate1D_Init(module); + ContextFunctions_Init(module); + FrsMaterial_Init(module); + FrsNoise_Init(module); + Id_Init(module); + IntegrationType_Init(module); + Interface0D_Init(module); + Interface1D_Init(module); + Iterator_Init(module); + Operators_Init(module); + SShape_Init(module); + StrokeAttribute_Init(module); + StrokeShader_Init(module); + UnaryFunction0D_Init(module); + UnaryFunction1D_Init(module); + UnaryPredicate0D_Init(module); + UnaryPredicate1D_Init(module); + ViewMap_Init(module); + ViewShape_Init(module); + + return module; } /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp index fe1f23e2665..3ede6823062 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp +++ b/source/blender/freestyle/intern/python/BPy_FrsMaterial.cpp @@ -28,538 +28,555 @@ extern "C" { #include "BLI_hash_mm2a.h" - /////////////////////////////////////////////////////////////////////////////////////////// //-------------------MODULE INITIALIZATION-------------------------------- int FrsMaterial_Init(PyObject *module) { - if (module == NULL) - return -1; + if (module == NULL) + return -1; - if (PyType_Ready(&FrsMaterial_Type) < 0) - return -1; - Py_INCREF(&FrsMaterial_Type); - PyModule_AddObject(module, "Material", (PyObject *)&FrsMaterial_Type); + if (PyType_Ready(&FrsMaterial_Type) < 0) + return -1; + Py_INCREF(&FrsMaterial_Type); + PyModule_AddObject(module, "Material", (PyObject *)&FrsMaterial_Type); - FrsMaterial_mathutils_register_callback(); + FrsMaterial_mathutils_register_callback(); - return 0; + return 0; } //------------------------INSTANCE METHODS ---------------------------------- -PyDoc_STRVAR(FrsMaterial_doc, -"Class defining a material.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __init__(brother)\n" -"\n" -" Copy constructor.\n" -"\n" -" :arg brother: A Material object.\n" -" :type brother: :class:`Material`\n" -"\n" -".. method:: __init__(line, diffuse, ambient, specular, emission, shininess, priority)\n" -"\n" -" Builds a Material from its line, diffuse, ambient, specular, emissive\n" -" colors, a shininess coefficient and line color priority.\n" -"\n" -" :arg line: The line color.\n" -" :type line: :class:`mathutils.Vector`, list or tuple of 4 float values\n" -" :arg diffuse: The diffuse color.\n" -" :type diffuse: :class:`mathutils.Vector`, list or tuple of 4 float values\n" -" :arg ambient: The ambient color.\n" -" :type ambient: :class:`mathutils.Vector`, list or tuple of 4 float values\n" -" :arg specular: The specular color.\n" -" :type specular: :class:`mathutils.Vector`, list or tuple of 4 float values\n" -" :arg emission: The emissive color.\n" -" :type emission: :class:`mathutils.Vector`, list or tuple of 4 float values\n" -" :arg shininess: The shininess coefficient.\n" -" :type shininess: float\n" -" :arg priority: The line color priority.\n" -" :type priority: int"); +PyDoc_STRVAR( + FrsMaterial_doc, + "Class defining a material.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __init__(brother)\n" + "\n" + " Copy constructor.\n" + "\n" + " :arg brother: A Material object.\n" + " :type brother: :class:`Material`\n" + "\n" + ".. method:: __init__(line, diffuse, ambient, specular, emission, shininess, priority)\n" + "\n" + " Builds a Material from its line, diffuse, ambient, specular, emissive\n" + " colors, a shininess coefficient and line color priority.\n" + "\n" + " :arg line: The line color.\n" + " :type line: :class:`mathutils.Vector`, list or tuple of 4 float values\n" + " :arg diffuse: The diffuse color.\n" + " :type diffuse: :class:`mathutils.Vector`, list or tuple of 4 float values\n" + " :arg ambient: The ambient color.\n" + " :type ambient: :class:`mathutils.Vector`, list or tuple of 4 float values\n" + " :arg specular: The specular color.\n" + " :type specular: :class:`mathutils.Vector`, list or tuple of 4 float values\n" + " :arg emission: The emissive color.\n" + " :type emission: :class:`mathutils.Vector`, list or tuple of 4 float values\n" + " :arg shininess: The shininess coefficient.\n" + " :type shininess: float\n" + " :arg priority: The line color priority.\n" + " :type priority: int"); static int FrsMaterial_init(BPy_FrsMaterial *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"line", "diffuse", "ambient", "specular", "emission", "shininess", "priority", NULL}; - PyObject *brother = 0; - float line[4], diffuse[4], ambient[4], specular[4], emission[4], shininess; - int priority; - - if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &FrsMaterial_Type, &brother)) { - if (!brother) { - self->m = new FrsMaterial(); - } - else { - FrsMaterial *m = ((BPy_FrsMaterial *)brother)->m; - if (!m) { - PyErr_SetString(PyExc_RuntimeError, "invalid Material object"); - return -1; - } - self->m = new FrsMaterial(*m); - } - } - else if (PyErr_Clear(), - PyArg_ParseTupleAndKeywords(args, kwds, "O&O&O&O&O&fi", (char **)kwlist_2, - convert_v4, line, - convert_v4, diffuse, - convert_v4, ambient, - convert_v4, specular, - convert_v4, emission, - &shininess, &priority)) - { - self->m = new FrsMaterial(line, diffuse, ambient, specular, emission, shininess, priority); - } - else { - PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); - return -1; - } - return 0; + static const char *kwlist_1[] = {"brother", NULL}; + static const char *kwlist_2[] = { + "line", "diffuse", "ambient", "specular", "emission", "shininess", "priority", NULL}; + PyObject *brother = 0; + float line[4], diffuse[4], ambient[4], specular[4], emission[4], shininess; + int priority; + + if (PyArg_ParseTupleAndKeywords( + args, kwds, "|O!", (char **)kwlist_1, &FrsMaterial_Type, &brother)) { + if (!brother) { + self->m = new FrsMaterial(); + } + else { + FrsMaterial *m = ((BPy_FrsMaterial *)brother)->m; + if (!m) { + PyErr_SetString(PyExc_RuntimeError, "invalid Material object"); + return -1; + } + self->m = new FrsMaterial(*m); + } + } + else if (PyErr_Clear(), + PyArg_ParseTupleAndKeywords(args, + kwds, + "O&O&O&O&O&fi", + (char **)kwlist_2, + convert_v4, + line, + convert_v4, + diffuse, + convert_v4, + ambient, + convert_v4, + specular, + convert_v4, + emission, + &shininess, + &priority)) { + self->m = new FrsMaterial(line, diffuse, ambient, specular, emission, shininess, priority); + } + else { + PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); + return -1; + } + return 0; } static void FrsMaterial_dealloc(BPy_FrsMaterial *self) { - delete self->m; - Py_TYPE(self)->tp_free((PyObject *)self); + delete self->m; + Py_TYPE(self)->tp_free((PyObject *)self); } static PyObject *FrsMaterial_repr(BPy_FrsMaterial *self) { - return PyUnicode_FromFormat("Material - address: %p", self->m); + return PyUnicode_FromFormat("Material - address: %p", self->m); } /*----------------------mathutils callbacks ----------------------------*/ /* subtype */ -#define MATHUTILS_SUBTYPE_DIFFUSE 1 -#define MATHUTILS_SUBTYPE_SPECULAR 2 -#define MATHUTILS_SUBTYPE_AMBIENT 3 -#define MATHUTILS_SUBTYPE_EMISSION 4 -#define MATHUTILS_SUBTYPE_LINE 5 +#define MATHUTILS_SUBTYPE_DIFFUSE 1 +#define MATHUTILS_SUBTYPE_SPECULAR 2 +#define MATHUTILS_SUBTYPE_AMBIENT 3 +#define MATHUTILS_SUBTYPE_EMISSION 4 +#define MATHUTILS_SUBTYPE_LINE 5 static int FrsMaterial_mathutils_check(BaseMathObject *bmo) { - if (!BPy_FrsMaterial_Check(bmo->cb_user)) - return -1; - return 0; + if (!BPy_FrsMaterial_Check(bmo->cb_user)) + return -1; + return 0; } static int FrsMaterial_mathutils_get(BaseMathObject *bmo, int subtype) { - BPy_FrsMaterial *self = (BPy_FrsMaterial *)bmo->cb_user; - switch (subtype) { - case MATHUTILS_SUBTYPE_LINE: - bmo->data[0] = self->m->lineR(); - bmo->data[1] = self->m->lineG(); - bmo->data[2] = self->m->lineB(); - bmo->data[3] = self->m->lineA(); - break; - case MATHUTILS_SUBTYPE_DIFFUSE: - bmo->data[0] = self->m->diffuseR(); - bmo->data[1] = self->m->diffuseG(); - bmo->data[2] = self->m->diffuseB(); - bmo->data[3] = self->m->diffuseA(); - break; - case MATHUTILS_SUBTYPE_SPECULAR: - bmo->data[0] = self->m->specularR(); - bmo->data[1] = self->m->specularG(); - bmo->data[2] = self->m->specularB(); - bmo->data[3] = self->m->specularA(); - break; - case MATHUTILS_SUBTYPE_AMBIENT: - bmo->data[0] = self->m->ambientR(); - bmo->data[1] = self->m->ambientG(); - bmo->data[2] = self->m->ambientB(); - bmo->data[3] = self->m->ambientA(); - break; - case MATHUTILS_SUBTYPE_EMISSION: - bmo->data[0] = self->m->emissionR(); - bmo->data[1] = self->m->emissionG(); - bmo->data[2] = self->m->emissionB(); - bmo->data[3] = self->m->emissionA(); - break; - default: - return -1; - } - return 0; + BPy_FrsMaterial *self = (BPy_FrsMaterial *)bmo->cb_user; + switch (subtype) { + case MATHUTILS_SUBTYPE_LINE: + bmo->data[0] = self->m->lineR(); + bmo->data[1] = self->m->lineG(); + bmo->data[2] = self->m->lineB(); + bmo->data[3] = self->m->lineA(); + break; + case MATHUTILS_SUBTYPE_DIFFUSE: + bmo->data[0] = self->m->diffuseR(); + bmo->data[1] = self->m->diffuseG(); + bmo->data[2] = self->m->diffuseB(); + bmo->data[3] = self->m->diffuseA(); + break; + case MATHUTILS_SUBTYPE_SPECULAR: + bmo->data[0] = self->m->specularR(); + bmo->data[1] = self->m->specularG(); + bmo->data[2] = self->m->specularB(); + bmo->data[3] = self->m->specularA(); + break; + case MATHUTILS_SUBTYPE_AMBIENT: + bmo->data[0] = self->m->ambientR(); + bmo->data[1] = self->m->ambientG(); + bmo->data[2] = self->m->ambientB(); + bmo->data[3] = self->m->ambientA(); + break; + case MATHUTILS_SUBTYPE_EMISSION: + bmo->data[0] = self->m->emissionR(); + bmo->data[1] = self->m->emissionG(); + bmo->data[2] = self->m->emissionB(); + bmo->data[3] = self->m->emissionA(); + break; + default: + return -1; + } + return 0; } static int FrsMaterial_mathutils_set(BaseMathObject *bmo, int subtype) { - BPy_FrsMaterial *self = (BPy_FrsMaterial *)bmo->cb_user; - switch (subtype) { - case MATHUTILS_SUBTYPE_LINE: - self->m->setLine(bmo->data[0], bmo->data[1], bmo->data[2], bmo->data[3]); - break; - case MATHUTILS_SUBTYPE_DIFFUSE: - self->m->setDiffuse(bmo->data[0], bmo->data[1], bmo->data[2], bmo->data[3]); - break; - case MATHUTILS_SUBTYPE_SPECULAR: - self->m->setSpecular(bmo->data[0], bmo->data[1], bmo->data[2], bmo->data[3]); - break; - case MATHUTILS_SUBTYPE_AMBIENT: - self->m->setAmbient(bmo->data[0], bmo->data[1], bmo->data[2], bmo->data[3]); - break; - case MATHUTILS_SUBTYPE_EMISSION: - self->m->setEmission(bmo->data[0], bmo->data[1], bmo->data[2], bmo->data[3]); - break; - default: - return -1; - } - return 0; + BPy_FrsMaterial *self = (BPy_FrsMaterial *)bmo->cb_user; + switch (subtype) { + case MATHUTILS_SUBTYPE_LINE: + self->m->setLine(bmo->data[0], bmo->data[1], bmo->data[2], bmo->data[3]); + break; + case MATHUTILS_SUBTYPE_DIFFUSE: + self->m->setDiffuse(bmo->data[0], bmo->data[1], bmo->data[2], bmo->data[3]); + break; + case MATHUTILS_SUBTYPE_SPECULAR: + self->m->setSpecular(bmo->data[0], bmo->data[1], bmo->data[2], bmo->data[3]); + break; + case MATHUTILS_SUBTYPE_AMBIENT: + self->m->setAmbient(bmo->data[0], bmo->data[1], bmo->data[2], bmo->data[3]); + break; + case MATHUTILS_SUBTYPE_EMISSION: + self->m->setEmission(bmo->data[0], bmo->data[1], bmo->data[2], bmo->data[3]); + break; + default: + return -1; + } + return 0; } static int FrsMaterial_mathutils_get_index(BaseMathObject *bmo, int subtype, int index) { - BPy_FrsMaterial *self = (BPy_FrsMaterial *)bmo->cb_user; - switch (subtype) { - case MATHUTILS_SUBTYPE_LINE: - { - const float *color = self->m->line(); - bmo->data[index] = color[index]; - } - break; - case MATHUTILS_SUBTYPE_DIFFUSE: - { - const float *color = self->m->diffuse(); - bmo->data[index] = color[index]; - } - break; - case MATHUTILS_SUBTYPE_SPECULAR: - { - const float *color = self->m->specular(); - bmo->data[index] = color[index]; - } - break; - case MATHUTILS_SUBTYPE_AMBIENT: - { - const float *color = self->m->ambient(); - bmo->data[index] = color[index]; - } - break; - case MATHUTILS_SUBTYPE_EMISSION: - { - const float *color = self->m->emission(); - bmo->data[index] = color[index]; - } - break; - default: - return -1; - } - return 0; + BPy_FrsMaterial *self = (BPy_FrsMaterial *)bmo->cb_user; + switch (subtype) { + case MATHUTILS_SUBTYPE_LINE: { + const float *color = self->m->line(); + bmo->data[index] = color[index]; + } break; + case MATHUTILS_SUBTYPE_DIFFUSE: { + const float *color = self->m->diffuse(); + bmo->data[index] = color[index]; + } break; + case MATHUTILS_SUBTYPE_SPECULAR: { + const float *color = self->m->specular(); + bmo->data[index] = color[index]; + } break; + case MATHUTILS_SUBTYPE_AMBIENT: { + const float *color = self->m->ambient(); + bmo->data[index] = color[index]; + } break; + case MATHUTILS_SUBTYPE_EMISSION: { + const float *color = self->m->emission(); + bmo->data[index] = color[index]; + } break; + default: + return -1; + } + return 0; } static int FrsMaterial_mathutils_set_index(BaseMathObject *bmo, int subtype, int index) { - BPy_FrsMaterial *self = (BPy_FrsMaterial *)bmo->cb_user; - float color[4]; - switch (subtype) { - case MATHUTILS_SUBTYPE_LINE: - copy_v4_v4(color, self->m->line()); - color[index] = bmo->data[index]; - self->m->setLine(color[0], color[1], color[2], color[3]); - break; - case MATHUTILS_SUBTYPE_DIFFUSE: - copy_v4_v4(color, self->m->diffuse()); - color[index] = bmo->data[index]; - self->m->setDiffuse(color[0], color[1], color[2], color[3]); - break; - case MATHUTILS_SUBTYPE_SPECULAR: - copy_v4_v4(color, self->m->specular()); - color[index] = bmo->data[index]; - self->m->setSpecular(color[0], color[1], color[2], color[3]); - break; - case MATHUTILS_SUBTYPE_AMBIENT: - copy_v4_v4(color, self->m->ambient()); - color[index] = bmo->data[index]; - self->m->setAmbient(color[0], color[1], color[2], color[3]); - break; - case MATHUTILS_SUBTYPE_EMISSION: - copy_v4_v4(color, self->m->emission()); - color[index] = bmo->data[index]; - self->m->setEmission(color[0], color[1], color[2], color[3]); - break; - default: - return -1; - } - return 0; + BPy_FrsMaterial *self = (BPy_FrsMaterial *)bmo->cb_user; + float color[4]; + switch (subtype) { + case MATHUTILS_SUBTYPE_LINE: + copy_v4_v4(color, self->m->line()); + color[index] = bmo->data[index]; + self->m->setLine(color[0], color[1], color[2], color[3]); + break; + case MATHUTILS_SUBTYPE_DIFFUSE: + copy_v4_v4(color, self->m->diffuse()); + color[index] = bmo->data[index]; + self->m->setDiffuse(color[0], color[1], color[2], color[3]); + break; + case MATHUTILS_SUBTYPE_SPECULAR: + copy_v4_v4(color, self->m->specular()); + color[index] = bmo->data[index]; + self->m->setSpecular(color[0], color[1], color[2], color[3]); + break; + case MATHUTILS_SUBTYPE_AMBIENT: + copy_v4_v4(color, self->m->ambient()); + color[index] = bmo->data[index]; + self->m->setAmbient(color[0], color[1], color[2], color[3]); + break; + case MATHUTILS_SUBTYPE_EMISSION: + copy_v4_v4(color, self->m->emission()); + color[index] = bmo->data[index]; + self->m->setEmission(color[0], color[1], color[2], color[3]); + break; + default: + return -1; + } + return 0; } static Mathutils_Callback FrsMaterial_mathutils_cb = { - FrsMaterial_mathutils_check, - FrsMaterial_mathutils_get, - FrsMaterial_mathutils_set, - FrsMaterial_mathutils_get_index, - FrsMaterial_mathutils_set_index, + FrsMaterial_mathutils_check, + FrsMaterial_mathutils_get, + FrsMaterial_mathutils_set, + FrsMaterial_mathutils_get_index, + FrsMaterial_mathutils_set_index, }; static unsigned char FrsMaterial_mathutils_cb_index = -1; void FrsMaterial_mathutils_register_callback() { - FrsMaterial_mathutils_cb_index = Mathutils_RegisterCallback(&FrsMaterial_mathutils_cb); + FrsMaterial_mathutils_cb_index = Mathutils_RegisterCallback(&FrsMaterial_mathutils_cb); } /*----------------------FrsMaterial get/setters ----------------------------*/ PyDoc_STRVAR(FrsMaterial_line_doc, -"RGBA components of the line color of the material.\n" -"\n" -":type: :class:`mathutils.Vector`"); + "RGBA components of the line color of the material.\n" + "\n" + ":type: :class:`mathutils.Vector`"); static PyObject *FrsMaterial_line_get(BPy_FrsMaterial *self, void *UNUSED(closure)) { - return Vector_CreatePyObject_cb((PyObject *)self, 4, FrsMaterial_mathutils_cb_index, MATHUTILS_SUBTYPE_LINE); + return Vector_CreatePyObject_cb( + (PyObject *)self, 4, FrsMaterial_mathutils_cb_index, MATHUTILS_SUBTYPE_LINE); } static int FrsMaterial_line_set(BPy_FrsMaterial *self, PyObject *value, void *UNUSED(closure)) { - float color[4]; - if (mathutils_array_parse(color, 4, 4, value, - "value must be a 4-dimensional vector") == -1) - { - return -1; - } - self->m->setLine(color[0], color[1], color[2], color[3]); - return 0; + float color[4]; + if (mathutils_array_parse(color, 4, 4, value, "value must be a 4-dimensional vector") == -1) { + return -1; + } + self->m->setLine(color[0], color[1], color[2], color[3]); + return 0; } PyDoc_STRVAR(FrsMaterial_diffuse_doc, -"RGBA components of the diffuse color of the material.\n" -"\n" -":type: :class:`mathutils.Vector`"); + "RGBA components of the diffuse color of the material.\n" + "\n" + ":type: :class:`mathutils.Vector`"); static PyObject *FrsMaterial_diffuse_get(BPy_FrsMaterial *self, void *UNUSED(closure)) { - return Vector_CreatePyObject_cb((PyObject *)self, 4, FrsMaterial_mathutils_cb_index, MATHUTILS_SUBTYPE_DIFFUSE); + return Vector_CreatePyObject_cb( + (PyObject *)self, 4, FrsMaterial_mathutils_cb_index, MATHUTILS_SUBTYPE_DIFFUSE); } static int FrsMaterial_diffuse_set(BPy_FrsMaterial *self, PyObject *value, void *UNUSED(closure)) { - float color[4]; - if (mathutils_array_parse(color, 4, 4, value, - "value must be a 4-dimensional vector") == -1) - { - return -1; - } - self->m->setDiffuse(color[0], color[1], color[2], color[3]); - return 0; + float color[4]; + if (mathutils_array_parse(color, 4, 4, value, "value must be a 4-dimensional vector") == -1) { + return -1; + } + self->m->setDiffuse(color[0], color[1], color[2], color[3]); + return 0; } PyDoc_STRVAR(FrsMaterial_specular_doc, -"RGBA components of the specular color of the material.\n" -"\n" -":type: :class:`mathutils.Vector`"); + "RGBA components of the specular color of the material.\n" + "\n" + ":type: :class:`mathutils.Vector`"); static PyObject *FrsMaterial_specular_get(BPy_FrsMaterial *self, void *UNUSED(closure)) { - return Vector_CreatePyObject_cb((PyObject *)self, 4, FrsMaterial_mathutils_cb_index, MATHUTILS_SUBTYPE_SPECULAR); + return Vector_CreatePyObject_cb( + (PyObject *)self, 4, FrsMaterial_mathutils_cb_index, MATHUTILS_SUBTYPE_SPECULAR); } static int FrsMaterial_specular_set(BPy_FrsMaterial *self, PyObject *value, void *UNUSED(closure)) { - float color[4]; - if (mathutils_array_parse(color, 4, 4, value, - "value must be a 4-dimensional vector") == -1) - { - return -1; - } - self->m->setSpecular(color[0], color[1], color[2], color[3]); - return 0; + float color[4]; + if (mathutils_array_parse(color, 4, 4, value, "value must be a 4-dimensional vector") == -1) { + return -1; + } + self->m->setSpecular(color[0], color[1], color[2], color[3]); + return 0; } PyDoc_STRVAR(FrsMaterial_ambient_doc, -"RGBA components of the ambient color of the material.\n" -"\n" -":type: :class:`mathutils.Color`"); + "RGBA components of the ambient color of the material.\n" + "\n" + ":type: :class:`mathutils.Color`"); static PyObject *FrsMaterial_ambient_get(BPy_FrsMaterial *self, void *UNUSED(closure)) { - return Vector_CreatePyObject_cb((PyObject *)self, 4, FrsMaterial_mathutils_cb_index, MATHUTILS_SUBTYPE_AMBIENT); + return Vector_CreatePyObject_cb( + (PyObject *)self, 4, FrsMaterial_mathutils_cb_index, MATHUTILS_SUBTYPE_AMBIENT); } static int FrsMaterial_ambient_set(BPy_FrsMaterial *self, PyObject *value, void *UNUSED(closure)) { - float color[4]; - if (mathutils_array_parse(color, 4, 4, value, - "value must be a 4-dimensional vector") == -1) - { - return -1; - } - self->m->setAmbient(color[0], color[1], color[2], color[3]); - return 0; + float color[4]; + if (mathutils_array_parse(color, 4, 4, value, "value must be a 4-dimensional vector") == -1) { + return -1; + } + self->m->setAmbient(color[0], color[1], color[2], color[3]); + return 0; } PyDoc_STRVAR(FrsMaterial_emission_doc, -"RGBA components of the emissive color of the material.\n" -"\n" -":type: :class:`mathutils.Color`"); + "RGBA components of the emissive color of the material.\n" + "\n" + ":type: :class:`mathutils.Color`"); static PyObject *FrsMaterial_emission_get(BPy_FrsMaterial *self, void *UNUSED(closure)) { - return Vector_CreatePyObject_cb((PyObject *)self, 4, FrsMaterial_mathutils_cb_index, MATHUTILS_SUBTYPE_EMISSION); + return Vector_CreatePyObject_cb( + (PyObject *)self, 4, FrsMaterial_mathutils_cb_index, MATHUTILS_SUBTYPE_EMISSION); } static int FrsMaterial_emission_set(BPy_FrsMaterial *self, PyObject *value, void *UNUSED(closure)) { - float color[4]; - if (mathutils_array_parse(color, 4, 4, value, - "value must be a 4-dimensional vector") == -1) - { - return -1; - } - self->m->setEmission(color[0], color[1], color[2], color[3]); - return 0; + float color[4]; + if (mathutils_array_parse(color, 4, 4, value, "value must be a 4-dimensional vector") == -1) { + return -1; + } + self->m->setEmission(color[0], color[1], color[2], color[3]); + return 0; } PyDoc_STRVAR(FrsMaterial_shininess_doc, -"Shininess coefficient of the material.\n" -"\n" -":type: float"); + "Shininess coefficient of the material.\n" + "\n" + ":type: float"); static PyObject *FrsMaterial_shininess_get(BPy_FrsMaterial *self, void *UNUSED(closure)) { - return PyFloat_FromDouble(self->m->shininess()); + return PyFloat_FromDouble(self->m->shininess()); } static int FrsMaterial_shininess_set(BPy_FrsMaterial *self, PyObject *value, void *UNUSED(closure)) { - float scalar; - if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) { /* parsed item not a number */ - PyErr_SetString(PyExc_TypeError, "value must be a number"); - return -1; - } - self->m->setShininess(scalar); - return 0; + float scalar; + if ((scalar = PyFloat_AsDouble(value)) == -1.0f && + PyErr_Occurred()) { /* parsed item not a number */ + PyErr_SetString(PyExc_TypeError, "value must be a number"); + return -1; + } + self->m->setShininess(scalar); + return 0; } PyDoc_STRVAR(FrsMaterial_priority_doc, -"Line color priority of the material.\n" -"\n" -":type: int"); + "Line color priority of the material.\n" + "\n" + ":type: int"); static PyObject *FrsMaterial_priority_get(BPy_FrsMaterial *self, void *UNUSED(closure)) { - return PyLong_FromLong(self->m->priority()); + return PyLong_FromLong(self->m->priority()); } static int FrsMaterial_priority_set(BPy_FrsMaterial *self, PyObject *value, void *UNUSED(closure)) { - int scalar; - if ((scalar = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, "value must be an integer"); - return -1; - } - self->m->setPriority(scalar); - return 0; + int scalar; + if ((scalar = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, "value must be an integer"); + return -1; + } + self->m->setPriority(scalar); + return 0; } static PyGetSetDef BPy_FrsMaterial_getseters[] = { - {(char *)"line", (getter)FrsMaterial_line_get, (setter)FrsMaterial_line_set, - (char *)FrsMaterial_line_doc, NULL}, - {(char *)"diffuse", (getter)FrsMaterial_diffuse_get, (setter)FrsMaterial_diffuse_set, - (char *)FrsMaterial_diffuse_doc, NULL}, - {(char *)"specular", (getter)FrsMaterial_specular_get, (setter)FrsMaterial_specular_set, - (char *)FrsMaterial_specular_doc, NULL}, - {(char *)"ambient", (getter)FrsMaterial_ambient_get, (setter)FrsMaterial_ambient_set, - (char *)FrsMaterial_ambient_doc, NULL}, - {(char *)"emission", (getter)FrsMaterial_emission_get, (setter)FrsMaterial_emission_set, - (char *)FrsMaterial_emission_doc, NULL}, - {(char *)"shininess", (getter)FrsMaterial_shininess_get, (setter)FrsMaterial_shininess_set, - (char *)FrsMaterial_shininess_doc, NULL}, - {(char *)"priority", (getter)FrsMaterial_priority_get, (setter)FrsMaterial_priority_set, - (char *)FrsMaterial_priority_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"line", + (getter)FrsMaterial_line_get, + (setter)FrsMaterial_line_set, + (char *)FrsMaterial_line_doc, + NULL}, + {(char *)"diffuse", + (getter)FrsMaterial_diffuse_get, + (setter)FrsMaterial_diffuse_set, + (char *)FrsMaterial_diffuse_doc, + NULL}, + {(char *)"specular", + (getter)FrsMaterial_specular_get, + (setter)FrsMaterial_specular_set, + (char *)FrsMaterial_specular_doc, + NULL}, + {(char *)"ambient", + (getter)FrsMaterial_ambient_get, + (setter)FrsMaterial_ambient_set, + (char *)FrsMaterial_ambient_doc, + NULL}, + {(char *)"emission", + (getter)FrsMaterial_emission_get, + (setter)FrsMaterial_emission_set, + (char *)FrsMaterial_emission_doc, + NULL}, + {(char *)"shininess", + (getter)FrsMaterial_shininess_get, + (setter)FrsMaterial_shininess_set, + (char *)FrsMaterial_shininess_doc, + NULL}, + {(char *)"priority", + (getter)FrsMaterial_priority_get, + (setter)FrsMaterial_priority_set, + (char *)FrsMaterial_priority_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; -static PyObject *BPy_FrsMaterial_richcmpr(PyObject *objectA, PyObject *objectB, int comparison_type) +static PyObject *BPy_FrsMaterial_richcmpr(PyObject *objectA, + PyObject *objectB, + int comparison_type) { - const BPy_FrsMaterial *matA = NULL, *matB = NULL; - bool result = 0; - - if (!BPy_FrsMaterial_Check(objectA) || !BPy_FrsMaterial_Check(objectB)) { - if (comparison_type == Py_NE) { - Py_RETURN_TRUE; - } - else { - Py_RETURN_FALSE; - } - } - - matA = (BPy_FrsMaterial *)objectA; - matB = (BPy_FrsMaterial *)objectB; - - switch (comparison_type) { - case Py_NE: - result = (*matA->m) != (*matB->m); - break; - case Py_EQ: - result = (*matA->m) == (*matB->m); - break; - default: - PyErr_SetString(PyExc_TypeError, "Material does not support this comparison type"); - return NULL; - } - - if (result == true) { - Py_RETURN_TRUE; - } - else { - Py_RETURN_FALSE; - } + const BPy_FrsMaterial *matA = NULL, *matB = NULL; + bool result = 0; + + if (!BPy_FrsMaterial_Check(objectA) || !BPy_FrsMaterial_Check(objectB)) { + if (comparison_type == Py_NE) { + Py_RETURN_TRUE; + } + else { + Py_RETURN_FALSE; + } + } + + matA = (BPy_FrsMaterial *)objectA; + matB = (BPy_FrsMaterial *)objectB; + + switch (comparison_type) { + case Py_NE: + result = (*matA->m) != (*matB->m); + break; + case Py_EQ: + result = (*matA->m) == (*matB->m); + break; + default: + PyErr_SetString(PyExc_TypeError, "Material does not support this comparison type"); + return NULL; + } + + if (result == true) { + Py_RETURN_TRUE; + } + else { + Py_RETURN_FALSE; + } } - static Py_hash_t FrsMaterial_hash(PyObject *self) { - return (Py_uhash_t)BLI_hash_mm2((const unsigned char *)self, sizeof(*self), 0); + return (Py_uhash_t)BLI_hash_mm2((const unsigned char *)self, sizeof(*self), 0); } /*-----------------------BPy_FrsMaterial type definition ------------------------------*/ PyTypeObject FrsMaterial_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "Material", /* tp_name */ - sizeof(BPy_FrsMaterial), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)FrsMaterial_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)FrsMaterial_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)FrsMaterial_hash, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - FrsMaterial_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - (richcmpfunc)BPy_FrsMaterial_richcmpr, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_FrsMaterial_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)FrsMaterial_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "Material", /* tp_name */ + sizeof(BPy_FrsMaterial), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)FrsMaterial_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)FrsMaterial_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + (hashfunc)FrsMaterial_hash, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + FrsMaterial_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + (richcmpfunc)BPy_FrsMaterial_richcmpr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + BPy_FrsMaterial_getseters, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)FrsMaterial_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_FrsMaterial.h b/source/blender/freestyle/intern/python/BPy_FrsMaterial.h index 39e564ce97e..84a3ac2463f 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsMaterial.h +++ b/source/blender/freestyle/intern/python/BPy_FrsMaterial.h @@ -37,12 +37,12 @@ extern "C" { extern PyTypeObject FrsMaterial_Type; -#define BPy_FrsMaterial_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&FrsMaterial_Type)) +#define BPy_FrsMaterial_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&FrsMaterial_Type)) /*---------------------------Python BPy_FrsMaterial structure definition----------*/ typedef struct { - PyObject_HEAD - FrsMaterial *m; + PyObject_HEAD FrsMaterial *m; } BPy_FrsMaterial; /*---------------------------Python BPy_FrsMaterial visible prototypes-----------*/ @@ -56,5 +56,4 @@ void FrsMaterial_mathutils_register_callback(); } #endif - #endif /* __FREESTYLE_PYTHON_FRSMATERIAL_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp index 871fe517bed..dc8a2ba6105 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp +++ b/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp @@ -34,301 +34,325 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int FrsNoise_Init(PyObject *module) { - if (module == NULL) - return -1; + if (module == NULL) + return -1; - if (PyType_Ready(&FrsNoise_Type) < 0) - return -1; - Py_INCREF(&FrsNoise_Type); - PyModule_AddObject(module, "Noise", (PyObject *)&FrsNoise_Type); + if (PyType_Ready(&FrsNoise_Type) < 0) + return -1; + Py_INCREF(&FrsNoise_Type); + PyModule_AddObject(module, "Noise", (PyObject *)&FrsNoise_Type); - return 0; + return 0; } //------------------------INSTANCE METHODS ---------------------------------- PyDoc_STRVAR(FrsNoise_doc, -"Class to provide Perlin noise functionalities.\n" -"\n" -".. method:: __init__(seed = -1)\n" -"\n" -" Builds a Noise object. Seed is an optional argument. The seed value is used\n" -" as a seed for random number generation if it is equal to or greater than zero;\n" -" otherwise, time is used as a seed.\n" -"\n" -" :arg seed: Seed for random number generation.\n" -" :type seed: int"); + "Class to provide Perlin noise functionalities.\n" + "\n" + ".. method:: __init__(seed = -1)\n" + "\n" + " Builds a Noise object. Seed is an optional argument. The seed value is used\n" + " as a seed for random number generation if it is equal to or greater than zero;\n" + " otherwise, time is used as a seed.\n" + "\n" + " :arg seed: Seed for random number generation.\n" + " :type seed: int"); 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)) - return -1; - self->n = new Noise(seed); - self->pn = new PseudoNoise(); - return 0; + static const char *kwlist[] = {"seed", NULL}; + long seed = -1; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|l", (char **)kwlist, &seed)) + return -1; + self->n = new Noise(seed); + self->pn = new PseudoNoise(); + return 0; } static void FrsNoise_dealloc(BPy_FrsNoise *self) { - delete self->n; - delete self->pn; - Py_TYPE(self)->tp_free((PyObject *)self); + delete self->n; + delete self->pn; + Py_TYPE(self)->tp_free((PyObject *)self); } static PyObject *FrsNoise_repr(BPy_FrsNoise *self) { - return PyUnicode_FromFormat("Noise - address: %p", self->n); + return PyUnicode_FromFormat("Noise - address: %p", self->n); } PyDoc_STRVAR(FrsNoise_turbulence1_doc, -".. method:: turbulence1(v, freq, amp, oct=4)\n" -"\n" -" Returns a noise value for a 1D element.\n" -"\n" -" :arg v: One-dimensional sample point.\n" -" :type v: float\n" -" :arg freq: Noise frequency.\n" -" :type freq: float\n" -" :arg amp: Amplitude.\n" -" :type amp: float\n" -" :arg oct: Number of octaves.\n" -" :type oct: int\n" -" :return: A noise value.\n" -" :rtype: float"); + ".. method:: turbulence1(v, freq, amp, oct=4)\n" + "\n" + " Returns a noise value for a 1D element.\n" + "\n" + " :arg v: One-dimensional sample point.\n" + " :type v: float\n" + " :arg freq: Noise frequency.\n" + " :type freq: float\n" + " :arg amp: Amplitude.\n" + " :type amp: float\n" + " :arg oct: Number of octaves.\n" + " :type oct: int\n" + " :return: A noise value.\n" + " :rtype: float"); static PyObject *FrsNoise_drand(BPy_FrsNoise * /*self*/, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"seed", NULL}; - long seed = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|I", (char **)kwlist, &seed)) { - PyErr_SetString(PyExc_TypeError, "optional argument 1 must be of type int"); - return NULL; - } - if (seed) { - RandGen::srand48(seed); - } - return PyFloat_FromDouble(RandGen::drand48()); + static const char *kwlist[] = {"seed", NULL}; + long seed = 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|I", (char **)kwlist, &seed)) { + PyErr_SetString(PyExc_TypeError, "optional argument 1 must be of type int"); + return NULL; + } + if (seed) { + RandGen::srand48(seed); + } + return PyFloat_FromDouble(RandGen::drand48()); } static PyObject *FrsNoise_turbulence_smooth(BPy_FrsNoise *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"v", "oct", NULL}; + static const char *kwlist[] = {"v", "oct", NULL}; - double x; // note: this has to be a double (not float) - unsigned nbOctaves = 8; + 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)) - return NULL; - return PyFloat_FromDouble(self->pn->turbulenceSmooth(x, nbOctaves)); + if (!PyArg_ParseTupleAndKeywords(args, kwds, "d|I", (char **)kwlist, &x, &nbOctaves)) + return NULL; + return PyFloat_FromDouble(self->pn->turbulenceSmooth(x, nbOctaves)); } static PyObject *FrsNoise_turbulence1(BPy_FrsNoise *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"v", "freq", "amp", "oct", NULL}; - float f1, f2, f3; - unsigned int i = 4; + static const char *kwlist[] = {"v", "freq", "amp", "oct", NULL}; + float f1, f2, f3; + unsigned int i = 4; - 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)); + 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)); } PyDoc_STRVAR(FrsNoise_turbulence2_doc, -".. method:: turbulence2(v, freq, amp, oct=4)\n" -"\n" -" Returns a noise value for a 2D element.\n" -"\n" -" :arg v: Two-dimensional sample point.\n" -" :type v: :class:`mathutils.Vector`, list or tuple of 2 real numbers\n" -" :arg freq: Noise frequency.\n" -" :type freq: float\n" -" :arg amp: Amplitude.\n" -" :type amp: float\n" -" :arg oct: Number of octaves.\n" -" :type oct: int\n" -" :return: A noise value.\n" -" :rtype: float"); + ".. method:: turbulence2(v, freq, amp, oct=4)\n" + "\n" + " Returns a noise value for a 2D element.\n" + "\n" + " :arg v: Two-dimensional sample point.\n" + " :type v: :class:`mathutils.Vector`, list or tuple of 2 real numbers\n" + " :arg freq: Noise frequency.\n" + " :type freq: float\n" + " :arg amp: Amplitude.\n" + " :type amp: float\n" + " :arg oct: Number of octaves.\n" + " :type oct: int\n" + " :return: A noise value.\n" + " :rtype: float"); static PyObject *FrsNoise_turbulence2(BPy_FrsNoise *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"v", "freq", "amp", "oct", NULL}; - PyObject *obj1; - float f2, f3; - unsigned int i = 4; - Vec2f vec; - - 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)"); - return NULL; - } - float t = self->n->turbulence2(vec, f2, f3, i); - return PyFloat_FromDouble(t); + static const char *kwlist[] = {"v", "freq", "amp", "oct", NULL}; + PyObject *obj1; + float f2, f3; + unsigned int i = 4; + Vec2f vec; + + 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)"); + return NULL; + } + float t = self->n->turbulence2(vec, f2, f3, i); + return PyFloat_FromDouble(t); } PyDoc_STRVAR(FrsNoise_turbulence3_doc, -".. method:: turbulence3(v, freq, amp, oct=4)\n" -"\n" -" Returns a noise value for a 3D element.\n" -"\n" -" :arg v: Three-dimensional sample point.\n" -" :type v: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n" -" :arg freq: Noise frequency.\n" -" :type freq: float\n" -" :arg amp: Amplitude.\n" -" :type amp: float\n" -" :arg oct: Number of octaves.\n" -" :type oct: int\n" -" :return: A noise value.\n" -" :rtype: float"); + ".. method:: turbulence3(v, freq, amp, oct=4)\n" + "\n" + " Returns a noise value for a 3D element.\n" + "\n" + " :arg v: Three-dimensional sample point.\n" + " :type v: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n" + " :arg freq: Noise frequency.\n" + " :type freq: float\n" + " :arg amp: Amplitude.\n" + " :type amp: float\n" + " :arg oct: Number of octaves.\n" + " :type oct: int\n" + " :return: A noise value.\n" + " :rtype: float"); static PyObject *FrsNoise_turbulence3(BPy_FrsNoise *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"v", "freq", "amp", "oct", NULL}; - PyObject *obj1; - float f2, f3; - unsigned int i = 4; - Vec3f vec; - - 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)"); - return NULL; - } - float t = self->n->turbulence3(vec, f2, f3, i); - return PyFloat_FromDouble(t); + static const char *kwlist[] = {"v", "freq", "amp", "oct", NULL}; + PyObject *obj1; + float f2, f3; + unsigned int i = 4; + Vec3f vec; + + 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)"); + return NULL; + } + float t = self->n->turbulence3(vec, f2, f3, i); + return PyFloat_FromDouble(t); } PyDoc_STRVAR(FrsNoise_smoothNoise1_doc, -".. method:: smoothNoise1(v)\n" -"\n" -" Returns a smooth noise value for a 1D element.\n" -"\n" -" :arg v: One-dimensional sample point.\n" -" :type v: float\n" -" :return: A smooth noise value.\n" -" :rtype: float"); + ".. method:: smoothNoise1(v)\n" + "\n" + " Returns a smooth noise value for a 1D element.\n" + "\n" + " :arg v: One-dimensional sample point.\n" + " :type v: float\n" + " :return: A smooth noise value.\n" + " :rtype: float"); static PyObject *FrsNoise_smoothNoise1(BPy_FrsNoise *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"v", NULL}; - float f; + static const char *kwlist[] = {"v", NULL}; + float f; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f)) - return NULL; - return PyFloat_FromDouble(self->n->smoothNoise1(f)); + if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f)) + return NULL; + return PyFloat_FromDouble(self->n->smoothNoise1(f)); } PyDoc_STRVAR(FrsNoise_smoothNoise2_doc, -".. method:: smoothNoise2(v)\n" -"\n" -" Returns a smooth noise value for a 2D element.\n" -"\n" -" :arg v: Two-dimensional sample point.\n" -" :type v: :class:`mathutils.Vector`, list or tuple of 2 real numbers\n" -" :return: A smooth noise value.\n" -" :rtype: float"); + ".. method:: smoothNoise2(v)\n" + "\n" + " Returns a smooth noise value for a 2D element.\n" + "\n" + " :arg v: Two-dimensional sample point.\n" + " :type v: :class:`mathutils.Vector`, list or tuple of 2 real numbers\n" + " :return: A smooth noise value.\n" + " :rtype: float"); static PyObject *FrsNoise_smoothNoise2(BPy_FrsNoise *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"v", NULL}; - PyObject *obj; - Vec2f vec; - - 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)"); - return NULL; - } - float t = self->n->smoothNoise2(vec); - return PyFloat_FromDouble(t); + static const char *kwlist[] = {"v", NULL}; + PyObject *obj; + Vec2f vec; + + 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)"); + return NULL; + } + float t = self->n->smoothNoise2(vec); + return PyFloat_FromDouble(t); } PyDoc_STRVAR(FrsNoise_smoothNoise3_doc, -".. method:: smoothNoise3(v)\n" -"\n" -" Returns a smooth noise value for a 3D element.\n" -"\n" -" :arg v: Three-dimensional sample point.\n" -" :type v: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n" -" :return: A smooth noise value.\n" -" :rtype: float"); + ".. method:: smoothNoise3(v)\n" + "\n" + " Returns a smooth noise value for a 3D element.\n" + "\n" + " :arg v: Three-dimensional sample point.\n" + " :type v: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n" + " :return: A smooth noise value.\n" + " :rtype: float"); static PyObject *FrsNoise_smoothNoise3(BPy_FrsNoise *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"v", NULL}; - PyObject *obj; - Vec3f vec; - - 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)"); - return NULL; - } - float t = self->n->smoothNoise3(vec); - return PyFloat_FromDouble(t); + static const char *kwlist[] = {"v", NULL}; + PyObject *obj; + Vec3f vec; + + 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)"); + return NULL; + } + float t = self->n->smoothNoise3(vec); + return PyFloat_FromDouble(t); } static PyMethodDef BPy_FrsNoise_methods[] = { - {"turbulence1", (PyCFunction)FrsNoise_turbulence1, METH_VARARGS | METH_KEYWORDS, FrsNoise_turbulence1_doc}, - {"turbulence2", (PyCFunction)FrsNoise_turbulence2, METH_VARARGS | METH_KEYWORDS, FrsNoise_turbulence2_doc}, - {"turbulence3", (PyCFunction)FrsNoise_turbulence3, METH_VARARGS | METH_KEYWORDS, FrsNoise_turbulence3_doc}, - {"smoothNoise1", (PyCFunction)FrsNoise_smoothNoise1, METH_VARARGS | METH_KEYWORDS, FrsNoise_smoothNoise1_doc}, - {"smoothNoise2", (PyCFunction)FrsNoise_smoothNoise2, METH_VARARGS | METH_KEYWORDS, FrsNoise_smoothNoise2_doc}, - {"smoothNoise3", (PyCFunction)FrsNoise_smoothNoise3, METH_VARARGS | METH_KEYWORDS, FrsNoise_smoothNoise3_doc}, - {"rand", (PyCFunction)FrsNoise_drand, METH_VARARGS | METH_KEYWORDS, NULL}, - {"turbulence_smooth", (PyCFunction)FrsNoise_turbulence_smooth, METH_VARARGS | METH_KEYWORDS, NULL}, - {NULL, NULL, 0, NULL}, + {"turbulence1", + (PyCFunction)FrsNoise_turbulence1, + METH_VARARGS | METH_KEYWORDS, + FrsNoise_turbulence1_doc}, + {"turbulence2", + (PyCFunction)FrsNoise_turbulence2, + METH_VARARGS | METH_KEYWORDS, + FrsNoise_turbulence2_doc}, + {"turbulence3", + (PyCFunction)FrsNoise_turbulence3, + METH_VARARGS | METH_KEYWORDS, + FrsNoise_turbulence3_doc}, + {"smoothNoise1", + (PyCFunction)FrsNoise_smoothNoise1, + METH_VARARGS | METH_KEYWORDS, + FrsNoise_smoothNoise1_doc}, + {"smoothNoise2", + (PyCFunction)FrsNoise_smoothNoise2, + METH_VARARGS | METH_KEYWORDS, + FrsNoise_smoothNoise2_doc}, + {"smoothNoise3", + (PyCFunction)FrsNoise_smoothNoise3, + METH_VARARGS | METH_KEYWORDS, + FrsNoise_smoothNoise3_doc}, + {"rand", (PyCFunction)FrsNoise_drand, METH_VARARGS | METH_KEYWORDS, NULL}, + {"turbulence_smooth", + (PyCFunction)FrsNoise_turbulence_smooth, + METH_VARARGS | METH_KEYWORDS, + NULL}, + {NULL, NULL, 0, NULL}, }; /*-----------------------BPy_FrsNoise type definition ------------------------------*/ PyTypeObject FrsNoise_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "Noise", /* tp_name */ - sizeof(BPy_FrsNoise), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)FrsNoise_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)FrsNoise_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - FrsNoise_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_FrsNoise_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)FrsNoise_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "Noise", /* tp_name */ + sizeof(BPy_FrsNoise), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)FrsNoise_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)FrsNoise_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + FrsNoise_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_FrsNoise_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)FrsNoise_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_FrsNoise.h b/source/blender/freestyle/intern/python/BPy_FrsNoise.h index 109d4aba6b1..9dcf59779cf 100644 --- a/source/blender/freestyle/intern/python/BPy_FrsNoise.h +++ b/source/blender/freestyle/intern/python/BPy_FrsNoise.h @@ -42,21 +42,18 @@ extern PyTypeObject FrsNoise_Type; /*---------------------------Python BPy_FrsNoise structure definition----------*/ typedef struct { - PyObject_HEAD - Noise *n; - PseudoNoise *pn; + PyObject_HEAD Noise *n; + PseudoNoise *pn; } BPy_FrsNoise; /*---------------------------Python BPy_FrsNoise visible prototypes-----------*/ int FrsNoise_Init(PyObject *module); - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus } #endif - #endif /* __FREESTYLE_PYTHON_FRSNOISE_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_Id.cpp b/source/blender/freestyle/intern/python/BPy_Id.cpp index fb47874cd97..4e2500a4b3d 100644 --- a/source/blender/freestyle/intern/python/BPy_Id.cpp +++ b/source/blender/freestyle/intern/python/BPy_Id.cpp @@ -31,181 +31,180 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int Id_Init(PyObject *module) { - if (module == NULL) - return -1; + if (module == NULL) + return -1; - if (PyType_Ready(&Id_Type) < 0) - return -1; + if (PyType_Ready(&Id_Type) < 0) + return -1; - Py_INCREF(&Id_Type); - PyModule_AddObject(module, "Id", (PyObject *)&Id_Type); - return 0; + Py_INCREF(&Id_Type); + PyModule_AddObject(module, "Id", (PyObject *)&Id_Type); + return 0; } //------------------------INSTANCE METHODS ---------------------------------- PyDoc_STRVAR(Id_doc, -"Class for representing an object Id.\n" -"\n" -".. method:: __init__(first=0, second=0)\n" -"\n" -" Build the Id from two numbers.\n" -"\n" -" :arg first: The first number.\n" -" :type first: int\n" -" :arg second: The second number.\n" -" :type second: int\n" -"\n" -".. method:: __init__(brother)\n" -"\n" -" Copy constructor.\n" -"\n" -" :arg brother: An Id object.\n" -" :type brother: :class:`Id`"); + "Class for representing an object Id.\n" + "\n" + ".. method:: __init__(first=0, second=0)\n" + "\n" + " Build the Id from two numbers.\n" + "\n" + " :arg first: The first number.\n" + " :type first: int\n" + " :arg second: The second number.\n" + " :type second: int\n" + "\n" + ".. method:: __init__(brother)\n" + "\n" + " Copy constructor.\n" + "\n" + " :arg brother: An Id object.\n" + " :type brother: :class:`Id`"); static int Id_init(BPy_Id *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"first", "second", NULL}; - PyObject *brother; - int first = 0, second = 0; - - if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist_1, &Id_Type, &brother)) { - self->id = new Id(*(((BPy_Id *)brother)->id)); - } - else if (PyErr_Clear(), - PyArg_ParseTupleAndKeywords(args, kwds, "|ii", (char **)kwlist_2, &first, &second)) - { - self->id = new Id(first, second); - } - else { - PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); - return -1; - } - return 0; + static const char *kwlist_1[] = {"brother", NULL}; + static const char *kwlist_2[] = {"first", "second", NULL}; + PyObject *brother; + int first = 0, second = 0; + + if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist_1, &Id_Type, &brother)) { + self->id = new Id(*(((BPy_Id *)brother)->id)); + } + else if (PyErr_Clear(), + PyArg_ParseTupleAndKeywords(args, kwds, "|ii", (char **)kwlist_2, &first, &second)) { + self->id = new Id(first, second); + } + else { + PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); + return -1; + } + return 0; } static void Id_dealloc(BPy_Id *self) { - delete self->id; - Py_TYPE(self)->tp_free((PyObject *)self); + delete self->id; + Py_TYPE(self)->tp_free((PyObject *)self); } static PyObject *Id_repr(BPy_Id *self) { - return PyUnicode_FromFormat("[ first: %i, second: %i ](BPy_Id)", self->id->getFirst(), self->id->getSecond()); + return PyUnicode_FromFormat( + "[ first: %i, second: %i ](BPy_Id)", self->id->getFirst(), self->id->getSecond()); } static PyObject *Id_RichCompare(BPy_Id *o1, BPy_Id *o2, int opid) { - switch (opid) { - case Py_LT: - return PyBool_from_bool(o1->id->operator<(*(o2->id))); - case Py_LE: - return PyBool_from_bool(o1->id->operator<(*(o2->id)) || o1->id->operator==(*(o2->id))); - case Py_EQ: - return PyBool_from_bool(o1->id->operator==(*(o2->id))); - case Py_NE: - return PyBool_from_bool(o1->id->operator!=(*(o2->id))); - case Py_GT: - return PyBool_from_bool(!(o1->id->operator<(*(o2->id)) || o1->id->operator==(*(o2->id)))); - case Py_GE: - return PyBool_from_bool(!(o1->id->operator<(*(o2->id)))); - } - Py_RETURN_NONE; + switch (opid) { + case Py_LT: + return PyBool_from_bool(o1->id->operator<(*(o2->id))); + case Py_LE: + return PyBool_from_bool(o1->id->operator<(*(o2->id)) || o1->id->operator==(*(o2->id))); + case Py_EQ: + return PyBool_from_bool(o1->id->operator==(*(o2->id))); + case Py_NE: + return PyBool_from_bool(o1->id->operator!=(*(o2->id))); + case Py_GT: + return PyBool_from_bool(!(o1->id->operator<(*(o2->id)) || o1->id->operator==(*(o2->id)))); + case Py_GE: + return PyBool_from_bool(!(o1->id->operator<(*(o2->id)))); + } + Py_RETURN_NONE; } /*----------------------Id get/setters ----------------------------*/ PyDoc_STRVAR(Id_first_doc, -"The first number constituting the Id.\n" -"\n" -":type: int"); + "The first number constituting the Id.\n" + "\n" + ":type: int"); static PyObject *Id_first_get(BPy_Id *self, void *UNUSED(closure)) { - return PyLong_FromLong(self->id->getFirst()); + return PyLong_FromLong(self->id->getFirst()); } static int Id_first_set(BPy_Id *self, PyObject *value, void *UNUSED(closure)) { - int scalar; - if ((scalar = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, "value must be an integer"); - return -1; - } - self->id->setFirst(scalar); - return 0; + int scalar; + if ((scalar = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, "value must be an integer"); + return -1; + } + self->id->setFirst(scalar); + return 0; } PyDoc_STRVAR(Id_second_doc, -"The second number constituting the Id.\n" -"\n" -":type: int"); + "The second number constituting the Id.\n" + "\n" + ":type: int"); static PyObject *Id_second_get(BPy_Id *self, void *UNUSED(closure)) { - return PyLong_FromLong(self->id->getSecond()); + return PyLong_FromLong(self->id->getSecond()); } static int Id_second_set(BPy_Id *self, PyObject *value, void *UNUSED(closure)) { - int scalar; - if ((scalar = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, "value must be an integer"); - return -1; - } - self->id->setSecond(scalar); - return 0; + int scalar; + if ((scalar = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, "value must be an integer"); + return -1; + } + self->id->setSecond(scalar); + return 0; } static PyGetSetDef BPy_Id_getseters[] = { - {(char *)"first", (getter)Id_first_get, (setter)Id_first_set, (char *)Id_first_doc, NULL}, - {(char *)"second", (getter)Id_second_get, (setter)Id_second_set, (char *)Id_second_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"first", (getter)Id_first_get, (setter)Id_first_set, (char *)Id_first_doc, NULL}, + {(char *)"second", (getter)Id_second_get, (setter)Id_second_set, (char *)Id_second_doc, NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_Id type definition ------------------------------*/ PyTypeObject Id_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "Id", /* tp_name */ - sizeof(BPy_Id), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)Id_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)Id_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Id_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - (richcmpfunc)Id_RichCompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_Id_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Id_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "Id", /* tp_name */ + sizeof(BPy_Id), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)Id_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)Id_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Id_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + (richcmpfunc)Id_RichCompare, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + BPy_Id_getseters, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Id_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_Id.h b/source/blender/freestyle/intern/python/BPy_Id.h index bb58da25942..3544f751453 100644 --- a/source/blender/freestyle/intern/python/BPy_Id.h +++ b/source/blender/freestyle/intern/python/BPy_Id.h @@ -45,8 +45,7 @@ extern PyTypeObject Id_Type; /*---------------------------Python BPy_Id structure definition----------*/ typedef struct { - PyObject_HEAD - Id *id; + PyObject_HEAD Id *id; } BPy_Id; /*---------------------------Python BPy_Id visible prototypes-----------*/ diff --git a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp index 10b1165ba83..bfd9e5e7898 100644 --- a/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp +++ b/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp @@ -35,66 +35,74 @@ extern "C" { //------------------------ MODULE FUNCTIONS ---------------------------------- PyDoc_STRVAR(Integrator_integrate_doc, -".. function:: integrate(func, it, it_end, integration_type)\n" -"\n" -" Returns a single value from a set of values evaluated at each 0D\n" -" element of this 1D element.\n" -"\n" -" :arg func: The UnaryFunction0D used to compute a value at each\n" -" Interface0D.\n" -" :type func: :class:`UnaryFunction0D`\n" -" :arg it: The Interface0DIterator used to iterate over the 0D\n" -" elements of this 1D element. The integration will occur over\n" -" the 0D elements starting from the one pointed by it.\n" -" :type it: :class:`Interface0DIterator`\n" -" :arg it_end: The Interface0DIterator pointing the end of the 0D\n" -" elements of the 1D element.\n" -" :type it_end: :class:`Interface0DIterator`\n" -" :arg integration_type: The integration method used to compute a\n" -" single value from a set of values.\n" -" :type integration_type: :class:`IntegrationType`\n" -" :return: The single value obtained for the 1D element. The return\n" -" value type is float if func is of the :class:`UnaryFunction0DDouble`\n" -" or :class:`UnaryFunction0DFloat` type, and int if func is of the\n" -" :class:`UnaryFunction0DUnsigned` type.\n" -" :rtype: int or float"); + ".. function:: integrate(func, it, it_end, integration_type)\n" + "\n" + " Returns a single value from a set of values evaluated at each 0D\n" + " element of this 1D element.\n" + "\n" + " :arg func: The UnaryFunction0D used to compute a value at each\n" + " Interface0D.\n" + " :type func: :class:`UnaryFunction0D`\n" + " :arg it: The Interface0DIterator used to iterate over the 0D\n" + " elements of this 1D element. The integration will occur over\n" + " the 0D elements starting from the one pointed by it.\n" + " :type it: :class:`Interface0DIterator`\n" + " :arg it_end: The Interface0DIterator pointing the end of the 0D\n" + " elements of the 1D element.\n" + " :type it_end: :class:`Interface0DIterator`\n" + " :arg integration_type: The integration method used to compute a\n" + " single value from a set of values.\n" + " :type integration_type: :class:`IntegrationType`\n" + " :return: The single value obtained for the 1D element. The return\n" + " value type is float if func is of the :class:`UnaryFunction0DDouble`\n" + " or :class:`UnaryFunction0DFloat` type, and int if func is of the\n" + " :class:`UnaryFunction0DUnsigned` type.\n" + " :rtype: int or float"); static PyObject *Integrator_integrate(PyObject * /*self*/, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"func", "it", "it_end", "integration_type", NULL}; - PyObject *obj1, *obj4 = 0; - BPy_Interface0DIterator *obj2, *obj3; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O!O!|O!", (char **)kwlist, - &UnaryFunction0D_Type, &obj1, &Interface0DIterator_Type, &obj2, - &Interface0DIterator_Type, &obj3, &IntegrationType_Type, &obj4)) - { - return NULL; - } - - Interface0DIterator it(*(obj2->if0D_it)), it_end(*(obj3->if0D_it)); - IntegrationType t = (obj4) ? IntegrationType_from_BPy_IntegrationType(obj4) : MEAN; - - if (BPy_UnaryFunction0DDouble_Check(obj1)) { - UnaryFunction0D *fun = ((BPy_UnaryFunction0DDouble *)obj1)->uf0D_double; - double res = integrate(*fun, it, it_end, t); - return PyFloat_FromDouble(res); - } - else if (BPy_UnaryFunction0DFloat_Check(obj1)) { - UnaryFunction0D *fun = ((BPy_UnaryFunction0DFloat *)obj1)->uf0D_float; - float res = integrate(*fun, it, it_end, t); - return PyFloat_FromDouble(res); - } - else if (BPy_UnaryFunction0DUnsigned_Check(obj1)) { - UnaryFunction0D *fun = ((BPy_UnaryFunction0DUnsigned *)obj1)->uf0D_unsigned; - unsigned int res = integrate(*fun, it, it_end, t); - return PyLong_FromLong(res); - } - else { - string class_name(Py_TYPE(obj1)->tp_name); - PyErr_SetString(PyExc_TypeError, ("unsupported function type: " + class_name).c_str()); - return NULL; - } + static const char *kwlist[] = {"func", "it", "it_end", "integration_type", NULL}; + PyObject *obj1, *obj4 = 0; + BPy_Interface0DIterator *obj2, *obj3; + + if (!PyArg_ParseTupleAndKeywords(args, + kwds, + "O!O!O!|O!", + (char **)kwlist, + &UnaryFunction0D_Type, + &obj1, + &Interface0DIterator_Type, + &obj2, + &Interface0DIterator_Type, + &obj3, + &IntegrationType_Type, + &obj4)) { + return NULL; + } + + Interface0DIterator it(*(obj2->if0D_it)), it_end(*(obj3->if0D_it)); + IntegrationType t = (obj4) ? IntegrationType_from_BPy_IntegrationType(obj4) : MEAN; + + if (BPy_UnaryFunction0DDouble_Check(obj1)) { + UnaryFunction0D *fun = ((BPy_UnaryFunction0DDouble *)obj1)->uf0D_double; + double res = integrate(*fun, it, it_end, t); + return PyFloat_FromDouble(res); + } + else if (BPy_UnaryFunction0DFloat_Check(obj1)) { + UnaryFunction0D *fun = ((BPy_UnaryFunction0DFloat *)obj1)->uf0D_float; + float res = integrate(*fun, it, it_end, t); + return PyFloat_FromDouble(res); + } + else if (BPy_UnaryFunction0DUnsigned_Check(obj1)) { + UnaryFunction0D *fun = ((BPy_UnaryFunction0DUnsigned *)obj1)->uf0D_unsigned; + unsigned int res = integrate(*fun, it, it_end, t); + return PyLong_FromLong(res); + } + else { + string class_name(Py_TYPE(obj1)->tp_name); + PyErr_SetString(PyExc_TypeError, ("unsupported function type: " + class_name).c_str()); + return NULL; + } } /*-----------------------Integrator module docstring---------------------------------------*/ @@ -104,8 +112,11 @@ PyDoc_STRVAR(module_docstring, "The Blender Freestyle.Integrator submodule\n\n") /*-----------------------Integrator module functions definitions---------------------------*/ static PyMethodDef module_functions[] = { - {"integrate", (PyCFunction) Integrator_integrate, METH_VARARGS | METH_KEYWORDS, Integrator_integrate_doc}, - {NULL, NULL, 0, NULL}, + {"integrate", + (PyCFunction)Integrator_integrate, + METH_VARARGS | METH_KEYWORDS, + Integrator_integrate_doc}, + {NULL, NULL, 0, NULL}, }; /*-----------------------Integrator module definition--------------------------------------*/ @@ -121,127 +132,114 @@ static PyModuleDef module_definition = { /*-----------------------BPy_IntegrationType type definition ------------------------------*/ PyDoc_STRVAR(IntegrationType_doc, -"Class hierarchy: int > :class:`IntegrationType`\n" -"\n" -"Different integration methods that can be invoked to integrate into a\n" -"single value the set of values obtained from each 0D element of an 1D\n" -"element:\n" -"\n" -"* IntegrationType.MEAN: The value computed for the 1D element is the\n" -" mean of the values obtained for the 0D elements.\n" -"* IntegrationType.MIN: The value computed for the 1D element is the\n" -" minimum of the values obtained for the 0D elements.\n" -"* IntegrationType.MAX: The value computed for the 1D element is the\n" -" maximum of the values obtained for the 0D elements.\n" -"* IntegrationType.FIRST: The value computed for the 1D element is the\n" -" first of the values obtained for the 0D elements.\n" -"* IntegrationType.LAST: The value computed for the 1D element is the\n" -" last of the values obtained for the 0D elements."); + "Class hierarchy: int > :class:`IntegrationType`\n" + "\n" + "Different integration methods that can be invoked to integrate into a\n" + "single value the set of values obtained from each 0D element of an 1D\n" + "element:\n" + "\n" + "* IntegrationType.MEAN: The value computed for the 1D element is the\n" + " mean of the values obtained for the 0D elements.\n" + "* IntegrationType.MIN: The value computed for the 1D element is the\n" + " minimum of the values obtained for the 0D elements.\n" + "* IntegrationType.MAX: The value computed for the 1D element is the\n" + " maximum of the values obtained for the 0D elements.\n" + "* IntegrationType.FIRST: The value computed for the 1D element is the\n" + " first of the values obtained for the 0D elements.\n" + "* IntegrationType.LAST: The value computed for the 1D element is the\n" + " last of the values obtained for the 0D elements."); PyTypeObject IntegrationType_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "IntegrationType", /* tp_name */ - sizeof(PyLongObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - IntegrationType_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &PyLong_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "IntegrationType", /* tp_name */ + sizeof(PyLongObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + IntegrationType_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &PyLong_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /*-----------------------BPy_IntegrationType instance definitions -------------------------*/ static PyLongObject _IntegrationType_MEAN = { - PyVarObject_HEAD_INIT(&IntegrationType_Type, 1) - { MEAN } -}; -static PyLongObject _IntegrationType_MIN = { - PyVarObject_HEAD_INIT(&IntegrationType_Type, 1) - { MIN } -}; -static PyLongObject _IntegrationType_MAX = { - PyVarObject_HEAD_INIT(&IntegrationType_Type, 1) - { MAX } -}; + PyVarObject_HEAD_INIT(&IntegrationType_Type, 1){MEAN}}; +static PyLongObject _IntegrationType_MIN = {PyVarObject_HEAD_INIT(&IntegrationType_Type, 1){MIN}}; +static PyLongObject _IntegrationType_MAX = {PyVarObject_HEAD_INIT(&IntegrationType_Type, 1){MAX}}; static PyLongObject _IntegrationType_FIRST = { - PyVarObject_HEAD_INIT(&IntegrationType_Type, 1) - { FIRST } -}; + PyVarObject_HEAD_INIT(&IntegrationType_Type, 1){FIRST}}; static PyLongObject _IntegrationType_LAST = { - PyVarObject_HEAD_INIT(&IntegrationType_Type, 1) - { LAST } -}; + PyVarObject_HEAD_INIT(&IntegrationType_Type, 1){LAST}}; -#define BPy_IntegrationType_MEAN ((PyObject *)&_IntegrationType_MEAN) -#define BPy_IntegrationType_MIN ((PyObject *)&_IntegrationType_MIN) -#define BPy_IntegrationType_MAX ((PyObject *)&_IntegrationType_MAX) +#define BPy_IntegrationType_MEAN ((PyObject *)&_IntegrationType_MEAN) +#define BPy_IntegrationType_MIN ((PyObject *)&_IntegrationType_MIN) +#define BPy_IntegrationType_MAX ((PyObject *)&_IntegrationType_MAX) #define BPy_IntegrationType_FIRST ((PyObject *)&_IntegrationType_FIRST) -#define BPy_IntegrationType_LAST ((PyObject *)&_IntegrationType_LAST) +#define BPy_IntegrationType_LAST ((PyObject *)&_IntegrationType_LAST) //-------------------MODULE INITIALIZATION-------------------------------- int IntegrationType_Init(PyObject *module) { - PyObject *m, *d, *f; - - if (module == NULL) - return -1; - - if (PyType_Ready(&IntegrationType_Type) < 0) - return -1; - Py_INCREF(&IntegrationType_Type); - PyModule_AddObject(module, "IntegrationType", (PyObject *)&IntegrationType_Type); - - PyDict_SetItemString(IntegrationType_Type.tp_dict, "MEAN", BPy_IntegrationType_MEAN); - PyDict_SetItemString(IntegrationType_Type.tp_dict, "MIN", BPy_IntegrationType_MIN); - PyDict_SetItemString(IntegrationType_Type.tp_dict, "MAX", BPy_IntegrationType_MAX); - PyDict_SetItemString(IntegrationType_Type.tp_dict, "FIRST", BPy_IntegrationType_FIRST); - PyDict_SetItemString(IntegrationType_Type.tp_dict, "LAST", BPy_IntegrationType_LAST); - - m = PyModule_Create(&module_definition); - if (m == NULL) - return -1; - Py_INCREF(m); - PyModule_AddObject(module, "Integrator", m); - - // from Integrator import * - d = PyModule_GetDict(m); - for (PyMethodDef *p = module_functions; p->ml_name; p++) { - f = PyDict_GetItemString(d, p->ml_name); - Py_INCREF(f); - PyModule_AddObject(module, p->ml_name, f); - } - - return 0; + PyObject *m, *d, *f; + + if (module == NULL) + return -1; + + if (PyType_Ready(&IntegrationType_Type) < 0) + return -1; + Py_INCREF(&IntegrationType_Type); + PyModule_AddObject(module, "IntegrationType", (PyObject *)&IntegrationType_Type); + + PyDict_SetItemString(IntegrationType_Type.tp_dict, "MEAN", BPy_IntegrationType_MEAN); + PyDict_SetItemString(IntegrationType_Type.tp_dict, "MIN", BPy_IntegrationType_MIN); + PyDict_SetItemString(IntegrationType_Type.tp_dict, "MAX", BPy_IntegrationType_MAX); + PyDict_SetItemString(IntegrationType_Type.tp_dict, "FIRST", BPy_IntegrationType_FIRST); + PyDict_SetItemString(IntegrationType_Type.tp_dict, "LAST", BPy_IntegrationType_LAST); + + m = PyModule_Create(&module_definition); + if (m == NULL) + return -1; + Py_INCREF(m); + PyModule_AddObject(module, "Integrator", m); + + // from Integrator import * + d = PyModule_GetDict(m); + for (PyMethodDef *p = module_functions; p->ml_name; p++) { + f = PyDict_GetItemString(d, p->ml_name); + Py_INCREF(f); + PyModule_AddObject(module, p->ml_name, f); + } + + return 0; } /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_IntegrationType.h b/source/blender/freestyle/intern/python/BPy_IntegrationType.h index 73cb1b26d59..525feb002e4 100644 --- a/source/blender/freestyle/intern/python/BPy_IntegrationType.h +++ b/source/blender/freestyle/intern/python/BPy_IntegrationType.h @@ -37,7 +37,8 @@ extern "C" { extern PyTypeObject IntegrationType_Type; -#define BPy_IntegrationType_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&IntegrationType_Type)) +#define BPy_IntegrationType_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&IntegrationType_Type)) /*---------------------------Python BPy_IntegrationType visible prototypes-----------*/ diff --git a/source/blender/freestyle/intern/python/BPy_Interface0D.cpp b/source/blender/freestyle/intern/python/BPy_Interface0D.cpp index a08946660b5..897f2f06c28 100644 --- a/source/blender/freestyle/intern/python/BPy_Interface0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_Interface0D.cpp @@ -39,272 +39,300 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int Interface0D_Init(PyObject *module) { - if (module == NULL) - return -1; - - 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) - return -1; - Py_INCREF(&CurvePoint_Type); - PyModule_AddObject(module, "CurvePoint", (PyObject *)&CurvePoint_Type); - - 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) - return -1; - Py_INCREF(&ViewVertex_Type); - PyModule_AddObject(module, "ViewVertex", (PyObject *)&ViewVertex_Type); - - 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) - return -1; - Py_INCREF(&NonTVertex_Type); - PyModule_AddObject(module, "NonTVertex", (PyObject *)&NonTVertex_Type); - - if (PyType_Ready(&TVertex_Type) < 0) - return -1; - Py_INCREF(&TVertex_Type); - PyModule_AddObject(module, "TVertex", (PyObject *)&TVertex_Type); - - SVertex_mathutils_register_callback(); - StrokeVertex_mathutils_register_callback(); - - return 0; + if (module == NULL) + return -1; + + 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) + return -1; + Py_INCREF(&CurvePoint_Type); + PyModule_AddObject(module, "CurvePoint", (PyObject *)&CurvePoint_Type); + + 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) + return -1; + Py_INCREF(&ViewVertex_Type); + PyModule_AddObject(module, "ViewVertex", (PyObject *)&ViewVertex_Type); + + 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) + return -1; + Py_INCREF(&NonTVertex_Type); + PyModule_AddObject(module, "NonTVertex", (PyObject *)&NonTVertex_Type); + + if (PyType_Ready(&TVertex_Type) < 0) + return -1; + Py_INCREF(&TVertex_Type); + PyModule_AddObject(module, "TVertex", (PyObject *)&TVertex_Type); + + SVertex_mathutils_register_callback(); + StrokeVertex_mathutils_register_callback(); + + return 0; } /*----------------------Interface1D methods ----------------------------*/ PyDoc_STRVAR(Interface0D_doc, -"Base class for any 0D element.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor."); + "Base class for any 0D element.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor."); static int Interface0D_init(BPy_Interface0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->if0D = new Interface0D(); - self->borrowed = false; - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->if0D = new Interface0D(); + self->borrowed = false; + return 0; } static void Interface0D_dealloc(BPy_Interface0D *self) { - if (self->if0D && !self->borrowed) - delete self->if0D; - Py_TYPE(self)->tp_free((PyObject *)self); + if (self->if0D && !self->borrowed) + delete self->if0D; + Py_TYPE(self)->tp_free((PyObject *)self); } static PyObject *Interface0D_repr(BPy_Interface0D *self) { - return PyUnicode_FromFormat("type: %s - address: %p", self->if0D->getExactTypeName().c_str(), self->if0D); + return PyUnicode_FromFormat( + "type: %s - address: %p", self->if0D->getExactTypeName().c_str(), self->if0D); } PyDoc_STRVAR(Interface0D_get_fedge_doc, -".. method:: get_fedge(inter)\n" -"\n" -" Returns the FEdge that lies between this 0D element and the 0D\n" -" element given as the argument.\n" -"\n" -" :arg inter: A 0D element.\n" -" :type inter: :class:`Interface0D`\n" -" :return: The FEdge lying between the two 0D elements.\n" -" :rtype: :class:`FEdge`"); + ".. method:: get_fedge(inter)\n" + "\n" + " Returns the FEdge that lies between this 0D element and the 0D\n" + " element given as the argument.\n" + "\n" + " :arg inter: A 0D element.\n" + " :type inter: :class:`Interface0D`\n" + " :return: The FEdge lying between the two 0D elements.\n" + " :rtype: :class:`FEdge`"); static PyObject *Interface0D_get_fedge(BPy_Interface0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"inter", NULL}; - PyObject *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()) - return NULL; - if (fe) - return Any_BPy_FEdge_from_FEdge(*fe); - Py_RETURN_NONE; + static const char *kwlist[] = {"inter", NULL}; + PyObject *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()) + return NULL; + if (fe) + return Any_BPy_FEdge_from_FEdge(*fe); + Py_RETURN_NONE; } static PyMethodDef BPy_Interface0D_methods[] = { - {"get_fedge", (PyCFunction)Interface0D_get_fedge, METH_VARARGS | METH_KEYWORDS, Interface0D_get_fedge_doc}, - {NULL, NULL, 0, NULL}, + {"get_fedge", + (PyCFunction)Interface0D_get_fedge, + METH_VARARGS | METH_KEYWORDS, + Interface0D_get_fedge_doc}, + {NULL, NULL, 0, NULL}, }; /*----------------------Interface1D get/setters ----------------------------*/ PyDoc_STRVAR(Interface0D_name_doc, -"The string of the name of this 0D element.\n" -"\n" -":type: str"); + "The string of the name of this 0D element.\n" + "\n" + ":type: str"); static PyObject *Interface0D_name_get(BPy_Interface0D *self, void *UNUSED(closure)) { - return PyUnicode_FromString(Py_TYPE(self)->tp_name); + return PyUnicode_FromString(Py_TYPE(self)->tp_name); } PyDoc_STRVAR(Interface0D_point_3d_doc, -"The 3D point of this 0D element.\n" -"\n" -":type: :class:`mathutils.Vector`"); + "The 3D point of this 0D element.\n" + "\n" + ":type: :class:`mathutils.Vector`"); static PyObject *Interface0D_point_3d_get(BPy_Interface0D *self, void *UNUSED(closure)) { - Vec3f p(self->if0D->getPoint3D()); - if (PyErr_Occurred()) - return NULL; - return Vector_from_Vec3f(p); + Vec3f p(self->if0D->getPoint3D()); + if (PyErr_Occurred()) + return NULL; + return Vector_from_Vec3f(p); } PyDoc_STRVAR(Interface0D_projected_x_doc, -"The X coordinate of the projected 3D point of this 0D element.\n" -"\n" -":type: float"); + "The X coordinate of the projected 3D point of this 0D element.\n" + "\n" + ":type: float"); static PyObject *Interface0D_projected_x_get(BPy_Interface0D *self, void *UNUSED(closure)) { - real x = self->if0D->getProjectedX(); - if (PyErr_Occurred()) - return NULL; - return PyFloat_FromDouble(x); + real x = self->if0D->getProjectedX(); + if (PyErr_Occurred()) + return NULL; + return PyFloat_FromDouble(x); } PyDoc_STRVAR(Interface0D_projected_y_doc, -"The Y coordinate of the projected 3D point of this 0D element.\n" -"\n" -":type: float"); + "The Y coordinate of the projected 3D point of this 0D element.\n" + "\n" + ":type: float"); static PyObject *Interface0D_projected_y_get(BPy_Interface0D *self, void *UNUSED(closure)) { - real y = self->if0D->getProjectedY(); - if (PyErr_Occurred()) - return NULL; - return PyFloat_FromDouble(y); + real y = self->if0D->getProjectedY(); + if (PyErr_Occurred()) + return NULL; + return PyFloat_FromDouble(y); } PyDoc_STRVAR(Interface0D_projected_z_doc, -"The Z coordinate of the projected 3D point of this 0D element.\n" -"\n" -":type: float"); + "The Z coordinate of the projected 3D point of this 0D element.\n" + "\n" + ":type: float"); static PyObject *Interface0D_projected_z_get(BPy_Interface0D *self, void *UNUSED(closure)) { - real z = self->if0D->getProjectedZ(); - if (PyErr_Occurred()) - return NULL; - return PyFloat_FromDouble(z); + real z = self->if0D->getProjectedZ(); + if (PyErr_Occurred()) + return NULL; + return PyFloat_FromDouble(z); } PyDoc_STRVAR(Interface0D_point_2d_doc, -"The 2D point of this 0D element.\n" -"\n" -":type: :class:`mathutils.Vector`"); + "The 2D point of this 0D element.\n" + "\n" + ":type: :class:`mathutils.Vector`"); static PyObject *Interface0D_point_2d_get(BPy_Interface0D *self, void *UNUSED(closure)) { - Vec2f p(self->if0D->getPoint2D()); - if (PyErr_Occurred()) - return NULL; - return Vector_from_Vec2f(p); + Vec2f p(self->if0D->getPoint2D()); + if (PyErr_Occurred()) + return NULL; + return Vector_from_Vec2f(p); } PyDoc_STRVAR(Interface0D_id_doc, -"The Id of this 0D element.\n" -"\n" -":type: :class:`Id`"); + "The Id of this 0D element.\n" + "\n" + ":type: :class:`Id`"); static PyObject *Interface0D_id_get(BPy_Interface0D *self, void *UNUSED(closure)) { - Id id(self->if0D->getId()); - if (PyErr_Occurred()) - return NULL; - return BPy_Id_from_Id(id); // return a copy + Id id(self->if0D->getId()); + if (PyErr_Occurred()) + return NULL; + return BPy_Id_from_Id(id); // return a copy } PyDoc_STRVAR(Interface0D_nature_doc, -"The nature of this 0D element.\n" -"\n" -":type: :class:`Nature`"); + "The nature of this 0D element.\n" + "\n" + ":type: :class:`Nature`"); static PyObject *Interface0D_nature_get(BPy_Interface0D *self, void *UNUSED(closure)) { - Nature::VertexNature nature = self->if0D->getNature(); - if (PyErr_Occurred()) - return NULL; - return BPy_Nature_from_Nature(nature); + Nature::VertexNature nature = self->if0D->getNature(); + if (PyErr_Occurred()) + return NULL; + return BPy_Nature_from_Nature(nature); } static PyGetSetDef BPy_Interface0D_getseters[] = { - {(char *)"name", (getter)Interface0D_name_get, (setter)NULL, (char *)Interface0D_name_doc, NULL}, - {(char *)"point_3d", (getter)Interface0D_point_3d_get, (setter)NULL, (char *)Interface0D_point_3d_doc, NULL}, - {(char *)"projected_x", (getter)Interface0D_projected_x_get, (setter)NULL, - (char *)Interface0D_projected_x_doc, NULL}, - {(char *)"projected_y", (getter)Interface0D_projected_y_get, (setter)NULL, - (char *)Interface0D_projected_y_doc, NULL}, - {(char *)"projected_z", (getter)Interface0D_projected_z_get, (setter)NULL, - (char *)Interface0D_projected_z_doc, NULL}, - {(char *)"point_2d", (getter)Interface0D_point_2d_get, (setter)NULL, (char *)Interface0D_point_2d_doc, NULL}, - {(char *)"id", (getter)Interface0D_id_get, (setter)NULL, (char *)Interface0D_id_doc, NULL}, - {(char *)"nature", (getter)Interface0D_nature_get, (setter)NULL, (char *)Interface0D_nature_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"name", + (getter)Interface0D_name_get, + (setter)NULL, + (char *)Interface0D_name_doc, + NULL}, + {(char *)"point_3d", + (getter)Interface0D_point_3d_get, + (setter)NULL, + (char *)Interface0D_point_3d_doc, + NULL}, + {(char *)"projected_x", + (getter)Interface0D_projected_x_get, + (setter)NULL, + (char *)Interface0D_projected_x_doc, + NULL}, + {(char *)"projected_y", + (getter)Interface0D_projected_y_get, + (setter)NULL, + (char *)Interface0D_projected_y_doc, + NULL}, + {(char *)"projected_z", + (getter)Interface0D_projected_z_get, + (setter)NULL, + (char *)Interface0D_projected_z_doc, + NULL}, + {(char *)"point_2d", + (getter)Interface0D_point_2d_get, + (setter)NULL, + (char *)Interface0D_point_2d_doc, + NULL}, + {(char *)"id", (getter)Interface0D_id_get, (setter)NULL, (char *)Interface0D_id_doc, NULL}, + {(char *)"nature", + (getter)Interface0D_nature_get, + (setter)NULL, + (char *)Interface0D_nature_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_Interface0D type definition ------------------------------*/ PyTypeObject Interface0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "Interface0D", /* tp_name */ - sizeof(BPy_Interface0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)Interface0D_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)Interface0D_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Interface0D_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_Interface0D_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_Interface0D_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Interface0D_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "Interface0D", /* tp_name */ + sizeof(BPy_Interface0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)Interface0D_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)Interface0D_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Interface0D_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_Interface0D_methods, /* tp_methods */ + 0, /* tp_members */ + BPy_Interface0D_getseters, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Interface0D_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_Interface0D.h b/source/blender/freestyle/intern/python/BPy_Interface0D.h index 2a52394e137..81fdd40ff04 100644 --- a/source/blender/freestyle/intern/python/BPy_Interface0D.h +++ b/source/blender/freestyle/intern/python/BPy_Interface0D.h @@ -37,13 +37,13 @@ extern "C" { extern PyTypeObject Interface0D_Type; -#define BPy_Interface0D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&Interface0D_Type)) +#define BPy_Interface0D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&Interface0D_Type)) /*---------------------------Python BPy_Interface0D structure definition----------*/ typedef struct { - PyObject_HEAD - Interface0D *if0D; - bool borrowed; /* true if *if0D is a borrowed object */ + PyObject_HEAD Interface0D *if0D; + bool borrowed; /* true if *if0D is a borrowed object */ } BPy_Interface0D; /*---------------------------Python BPy_Interface0D visible prototypes-----------*/ diff --git a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp index 6c6965a4975..09e27da9eeb 100644 --- a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp @@ -40,303 +40,332 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int Interface1D_Init(PyObject *module) { - if (module == NULL) - return -1; - - 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) - return -1; - Py_INCREF(&FrsCurve_Type); - PyModule_AddObject(module, "Curve", (PyObject *)&FrsCurve_Type); - - 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) - return -1; - Py_INCREF(&FEdge_Type); - PyModule_AddObject(module, "FEdge", (PyObject *)&FEdge_Type); - - 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) - return -1; - Py_INCREF(&FEdgeSmooth_Type); - PyModule_AddObject(module, "FEdgeSmooth", (PyObject *)&FEdgeSmooth_Type); - - if (PyType_Ready(&Stroke_Type) < 0) - return -1; - Py_INCREF(&Stroke_Type); - PyModule_AddObject(module, "Stroke", (PyObject *)&Stroke_Type); - - PyDict_SetItemString(Stroke_Type.tp_dict, "DRY_MEDIUM", BPy_MediumType_DRY_MEDIUM); - 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) - return -1; - Py_INCREF(&ViewEdge_Type); - PyModule_AddObject(module, "ViewEdge", (PyObject *)&ViewEdge_Type); - - FEdgeSharp_mathutils_register_callback(); - FEdgeSmooth_mathutils_register_callback(); - - return 0; + if (module == NULL) + return -1; + + 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) + return -1; + Py_INCREF(&FrsCurve_Type); + PyModule_AddObject(module, "Curve", (PyObject *)&FrsCurve_Type); + + 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) + return -1; + Py_INCREF(&FEdge_Type); + PyModule_AddObject(module, "FEdge", (PyObject *)&FEdge_Type); + + 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) + return -1; + Py_INCREF(&FEdgeSmooth_Type); + PyModule_AddObject(module, "FEdgeSmooth", (PyObject *)&FEdgeSmooth_Type); + + if (PyType_Ready(&Stroke_Type) < 0) + return -1; + Py_INCREF(&Stroke_Type); + PyModule_AddObject(module, "Stroke", (PyObject *)&Stroke_Type); + + PyDict_SetItemString(Stroke_Type.tp_dict, "DRY_MEDIUM", BPy_MediumType_DRY_MEDIUM); + 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) + return -1; + Py_INCREF(&ViewEdge_Type); + PyModule_AddObject(module, "ViewEdge", (PyObject *)&ViewEdge_Type); + + FEdgeSharp_mathutils_register_callback(); + FEdgeSmooth_mathutils_register_callback(); + + return 0; } /*----------------------Interface1D methods ----------------------------*/ PyDoc_STRVAR(Interface1D_doc, -"Base class for any 1D element.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor."); + "Base class for any 1D element.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor."); static int Interface1D_init(BPy_Interface1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->if1D = new Interface1D(); - self->borrowed = false; - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->if1D = new Interface1D(); + self->borrowed = false; + return 0; } static void Interface1D_dealloc(BPy_Interface1D *self) { - if (self->if1D && !self->borrowed) - delete self->if1D; - Py_TYPE(self)->tp_free((PyObject *)self); + if (self->if1D && !self->borrowed) + delete self->if1D; + Py_TYPE(self)->tp_free((PyObject *)self); } static PyObject *Interface1D_repr(BPy_Interface1D *self) { - return PyUnicode_FromFormat("type: %s - address: %p", self->if1D->getExactTypeName().c_str(), self->if1D); + return PyUnicode_FromFormat( + "type: %s - address: %p", self->if1D->getExactTypeName().c_str(), self->if1D); } PyDoc_STRVAR(Interface1D_vertices_begin_doc, -".. method:: vertices_begin()\n" -"\n" -" Returns an iterator over the Interface1D vertices, pointing to the\n" -" first vertex.\n" -"\n" -" :return: An Interface0DIterator pointing to the first vertex.\n" -" :rtype: :class:`Interface0DIterator`"); + ".. method:: vertices_begin()\n" + "\n" + " Returns an iterator over the Interface1D vertices, pointing to the\n" + " first vertex.\n" + "\n" + " :return: An Interface0DIterator pointing to the first vertex.\n" + " :rtype: :class:`Interface0DIterator`"); static PyObject *Interface1D_vertices_begin(BPy_Interface1D *self) { - Interface0DIterator if0D_it(self->if1D->verticesBegin()); - return BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, false); + Interface0DIterator if0D_it(self->if1D->verticesBegin()); + return BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, false); } PyDoc_STRVAR(Interface1D_vertices_end_doc, -".. method:: vertices_end()\n" -"\n" -" Returns an iterator over the Interface1D vertices, pointing after\n" -" the last vertex.\n" -"\n" -" :return: An Interface0DIterator pointing after the last vertex.\n" -" :rtype: :class:`Interface0DIterator`"); + ".. method:: vertices_end()\n" + "\n" + " Returns an iterator over the Interface1D vertices, pointing after\n" + " the last vertex.\n" + "\n" + " :return: An Interface0DIterator pointing after the last vertex.\n" + " :rtype: :class:`Interface0DIterator`"); static PyObject *Interface1D_vertices_end(BPy_Interface1D *self) { - Interface0DIterator if0D_it(self->if1D->verticesEnd()); - return BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, true); + Interface0DIterator if0D_it(self->if1D->verticesEnd()); + return BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, true); } PyDoc_STRVAR(Interface1D_points_begin_doc, -".. method:: points_begin(t=0.0)\n" -"\n" -" Returns an iterator over the Interface1D points, pointing to the\n" -" first point. The difference with vertices_begin() is that here we can\n" -" iterate over points of the 1D element at a any given sampling.\n" -" Indeed, for each iteration, a virtual point is created.\n" -"\n" -" :arg t: A sampling with which we want to iterate over points of\n" -" this 1D element.\n" -" :type t: float\n" -" :return: An Interface0DIterator pointing to the first point.\n" -" :rtype: :class:`Interface0DIterator`"); + ".. method:: points_begin(t=0.0)\n" + "\n" + " Returns an iterator over the Interface1D points, pointing to the\n" + " first point. The difference with vertices_begin() is that here we can\n" + " iterate over points of the 1D element at a any given sampling.\n" + " Indeed, for each iteration, a virtual point is created.\n" + "\n" + " :arg t: A sampling with which we want to iterate over points of\n" + " this 1D element.\n" + " :type t: float\n" + " :return: An Interface0DIterator pointing to the first point.\n" + " :rtype: :class:`Interface0DIterator`"); static PyObject *Interface1D_points_begin(BPy_Interface1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"t", NULL}; - float f = 0.0f; + static const char *kwlist[] = {"t", NULL}; + float f = 0.0f; - 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); + 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); } PyDoc_STRVAR(Interface1D_points_end_doc, -".. method:: points_end(t=0.0)\n" -"\n" -" Returns an iterator over the Interface1D points, pointing after the\n" -" last point. The difference with vertices_end() is that here we can\n" -" iterate over points of the 1D element at a given sampling. Indeed,\n" -" for each iteration, a virtual point is created.\n" -"\n" -" :arg t: A sampling with which we want to iterate over points of\n" -" this 1D element.\n" -" :type t: float\n" -" :return: An Interface0DIterator pointing after the last point.\n" -" :rtype: :class:`Interface0DIterator`"); + ".. method:: points_end(t=0.0)\n" + "\n" + " Returns an iterator over the Interface1D points, pointing after the\n" + " last point. The difference with vertices_end() is that here we can\n" + " iterate over points of the 1D element at a given sampling. Indeed,\n" + " for each iteration, a virtual point is created.\n" + "\n" + " :arg t: A sampling with which we want to iterate over points of\n" + " this 1D element.\n" + " :type t: float\n" + " :return: An Interface0DIterator pointing after the last point.\n" + " :rtype: :class:`Interface0DIterator`"); static PyObject *Interface1D_points_end(BPy_Interface1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"t", NULL}; - float f = 0.0f; + static const char *kwlist[] = {"t", NULL}; + float f = 0.0f; - 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); + 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); } static PyMethodDef BPy_Interface1D_methods[] = { - {"vertices_begin", (PyCFunction)Interface1D_vertices_begin, METH_NOARGS, Interface1D_vertices_begin_doc}, - {"vertices_end", (PyCFunction)Interface1D_vertices_end, METH_NOARGS, Interface1D_vertices_end_doc}, - {"points_begin", (PyCFunction)Interface1D_points_begin, METH_VARARGS | METH_KEYWORDS, Interface1D_points_begin_doc}, - {"points_end", (PyCFunction)Interface1D_points_end, METH_VARARGS | METH_KEYWORDS, Interface1D_points_end_doc}, - {NULL, NULL, 0, NULL}, + {"vertices_begin", + (PyCFunction)Interface1D_vertices_begin, + METH_NOARGS, + Interface1D_vertices_begin_doc}, + {"vertices_end", + (PyCFunction)Interface1D_vertices_end, + METH_NOARGS, + Interface1D_vertices_end_doc}, + {"points_begin", + (PyCFunction)Interface1D_points_begin, + METH_VARARGS | METH_KEYWORDS, + Interface1D_points_begin_doc}, + {"points_end", + (PyCFunction)Interface1D_points_end, + METH_VARARGS | METH_KEYWORDS, + Interface1D_points_end_doc}, + {NULL, NULL, 0, NULL}, }; /*----------------------Interface1D get/setters ----------------------------*/ PyDoc_STRVAR(Interface1D_name_doc, -"The string of the name of the 1D element.\n" -"\n" -":type: str"); + "The string of the name of the 1D element.\n" + "\n" + ":type: str"); static PyObject *Interface1D_name_get(BPy_Interface1D *self, void *UNUSED(closure)) { - return PyUnicode_FromString(Py_TYPE(self)->tp_name); + return PyUnicode_FromString(Py_TYPE(self)->tp_name); } PyDoc_STRVAR(Interface1D_id_doc, -"The Id of this Interface1D.\n" -"\n" -":type: :class:`Id`"); + "The Id of this Interface1D.\n" + "\n" + ":type: :class:`Id`"); static PyObject *Interface1D_id_get(BPy_Interface1D *self, void *UNUSED(closure)) { - Id id(self->if1D->getId()); - if (PyErr_Occurred()) - return NULL; - return BPy_Id_from_Id(id); // return a copy + Id id(self->if1D->getId()); + if (PyErr_Occurred()) + return NULL; + return BPy_Id_from_Id(id); // return a copy } PyDoc_STRVAR(Interface1D_nature_doc, -"The nature of this Interface1D.\n" -"\n" -":type: :class:`Nature`"); + "The nature of this Interface1D.\n" + "\n" + ":type: :class:`Nature`"); static PyObject *Interface1D_nature_get(BPy_Interface1D *self, void *UNUSED(closure)) { - Nature::VertexNature nature = self->if1D->getNature(); - if (PyErr_Occurred()) - return NULL; - return BPy_Nature_from_Nature(nature); + Nature::VertexNature nature = self->if1D->getNature(); + if (PyErr_Occurred()) + return NULL; + return BPy_Nature_from_Nature(nature); } PyDoc_STRVAR(Interface1D_length_2d_doc, -"The 2D length of this Interface1D.\n" -"\n" -":type: float"); + "The 2D length of this Interface1D.\n" + "\n" + ":type: float"); static PyObject *Interface1D_length_2d_get(BPy_Interface1D *self, void *UNUSED(closure)) { - real length = self->if1D->getLength2D(); - if (PyErr_Occurred()) - return NULL; - return PyFloat_FromDouble((double)length); + real length = self->if1D->getLength2D(); + if (PyErr_Occurred()) + return NULL; + return PyFloat_FromDouble((double)length); } PyDoc_STRVAR(Interface1D_time_stamp_doc, -"The time stamp of the 1D element, mainly used for selection.\n" -"\n" -":type: int"); + "The time stamp of the 1D element, mainly used for selection.\n" + "\n" + ":type: int"); static PyObject *Interface1D_time_stamp_get(BPy_Interface1D *self, void *UNUSED(closure)) { - return PyLong_FromLong(self->if1D->getTimeStamp()); + return PyLong_FromLong(self->if1D->getTimeStamp()); } -static int Interface1D_time_stamp_set(BPy_Interface1D *self, PyObject *value, void *UNUSED(closure)) +static int Interface1D_time_stamp_set(BPy_Interface1D *self, + PyObject *value, + void *UNUSED(closure)) { - int timestamp; - - if ((timestamp = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, "value must be a number"); - return -1; - } - self->if1D->setTimeStamp(timestamp); - return 0; + int timestamp; + + if ((timestamp = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, "value must be a number"); + return -1; + } + self->if1D->setTimeStamp(timestamp); + return 0; } static PyGetSetDef BPy_Interface1D_getseters[] = { - {(char *)"name", (getter)Interface1D_name_get, (setter)NULL, (char *)Interface1D_name_doc, NULL}, - {(char *)"id", (getter)Interface1D_id_get, (setter)NULL, (char *)Interface1D_id_doc, NULL}, - {(char *)"nature", (getter)Interface1D_nature_get, (setter)NULL, (char *)Interface1D_nature_doc, NULL}, - {(char *)"length_2d", (getter)Interface1D_length_2d_get, (setter)NULL, (char *)Interface1D_length_2d_doc, NULL}, - {(char *)"time_stamp", (getter)Interface1D_time_stamp_get, (setter)Interface1D_time_stamp_set, - (char *)Interface1D_time_stamp_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"name", + (getter)Interface1D_name_get, + (setter)NULL, + (char *)Interface1D_name_doc, + NULL}, + {(char *)"id", (getter)Interface1D_id_get, (setter)NULL, (char *)Interface1D_id_doc, NULL}, + {(char *)"nature", + (getter)Interface1D_nature_get, + (setter)NULL, + (char *)Interface1D_nature_doc, + NULL}, + {(char *)"length_2d", + (getter)Interface1D_length_2d_get, + (setter)NULL, + (char *)Interface1D_length_2d_doc, + NULL}, + {(char *)"time_stamp", + (getter)Interface1D_time_stamp_get, + (setter)Interface1D_time_stamp_set, + (char *)Interface1D_time_stamp_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_Interface1D type definition ------------------------------*/ PyTypeObject Interface1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "Interface1D", /* tp_name */ - sizeof(BPy_Interface1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)Interface1D_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)Interface1D_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Interface1D_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_Interface1D_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_Interface1D_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Interface1D_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "Interface1D", /* tp_name */ + sizeof(BPy_Interface1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)Interface1D_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)Interface1D_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Interface1D_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_Interface1D_methods, /* tp_methods */ + 0, /* tp_members */ + BPy_Interface1D_getseters, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Interface1D_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_Interface1D.h b/source/blender/freestyle/intern/python/BPy_Interface1D.h index 204eb84d87b..db9bfa7f79c 100644 --- a/source/blender/freestyle/intern/python/BPy_Interface1D.h +++ b/source/blender/freestyle/intern/python/BPy_Interface1D.h @@ -37,20 +37,19 @@ extern "C" { extern PyTypeObject Interface1D_Type; -#define BPy_Interface1D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&Interface1D_Type)) +#define BPy_Interface1D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&Interface1D_Type)) /*---------------------------Python BPy_Interface1D structure definition----------*/ typedef struct { - PyObject_HEAD - Interface1D *if1D; - bool borrowed; /* true if *if1D is a borrowed object */ + PyObject_HEAD Interface1D *if1D; + bool borrowed; /* true if *if1D is a borrowed object */ } BPy_Interface1D; /*---------------------------Python BPy_Interface1D visible prototypes-----------*/ int Interface1D_Init(PyObject *module); - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/BPy_Iterator.cpp b/source/blender/freestyle/intern/python/BPy_Iterator.cpp index b8ad6ef82f8..dfeaf9ac328 100644 --- a/source/blender/freestyle/intern/python/BPy_Iterator.cpp +++ b/source/blender/freestyle/intern/python/BPy_Iterator.cpp @@ -41,214 +41,222 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int Iterator_Init(PyObject *module) { - if (module == NULL) - return -1; - - 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) - return -1; - Py_INCREF(&AdjacencyIterator_Type); - PyModule_AddObject(module, "AdjacencyIterator", (PyObject *)&AdjacencyIterator_Type); - - 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) - return -1; - Py_INCREF(&CurvePointIterator_Type); - PyModule_AddObject(module, "CurvePointIterator", (PyObject *)&CurvePointIterator_Type); - - 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) - return -1; - Py_INCREF(&SVertexIterator_Type); - PyModule_AddObject(module, "SVertexIterator", (PyObject *)&SVertexIterator_Type); - - 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) - return -1; - Py_INCREF(&ViewEdgeIterator_Type); - PyModule_AddObject(module, "ViewEdgeIterator", (PyObject *)&ViewEdgeIterator_Type); - - 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) - return -1; - Py_INCREF(&ChainPredicateIterator_Type); - PyModule_AddObject(module, "ChainPredicateIterator", (PyObject *)&ChainPredicateIterator_Type); - - if (PyType_Ready(&ChainSilhouetteIterator_Type) < 0) - return -1; - Py_INCREF(&ChainSilhouetteIterator_Type); - PyModule_AddObject(module, "ChainSilhouetteIterator", (PyObject *)&ChainSilhouetteIterator_Type); - - return 0; + if (module == NULL) + return -1; + + 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) + return -1; + Py_INCREF(&AdjacencyIterator_Type); + PyModule_AddObject(module, "AdjacencyIterator", (PyObject *)&AdjacencyIterator_Type); + + 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) + return -1; + Py_INCREF(&CurvePointIterator_Type); + PyModule_AddObject(module, "CurvePointIterator", (PyObject *)&CurvePointIterator_Type); + + 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) + return -1; + Py_INCREF(&SVertexIterator_Type); + PyModule_AddObject(module, "SVertexIterator", (PyObject *)&SVertexIterator_Type); + + 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) + return -1; + Py_INCREF(&ViewEdgeIterator_Type); + PyModule_AddObject(module, "ViewEdgeIterator", (PyObject *)&ViewEdgeIterator_Type); + + 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) + return -1; + Py_INCREF(&ChainPredicateIterator_Type); + PyModule_AddObject(module, "ChainPredicateIterator", (PyObject *)&ChainPredicateIterator_Type); + + if (PyType_Ready(&ChainSilhouetteIterator_Type) < 0) + return -1; + Py_INCREF(&ChainSilhouetteIterator_Type); + PyModule_AddObject(module, "ChainSilhouetteIterator", (PyObject *)&ChainSilhouetteIterator_Type); + + return 0; } //------------------------INSTANCE METHODS ---------------------------------- PyDoc_STRVAR(Iterator_doc, -"Base class to define iterators.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor."); + "Base class to define iterators.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor."); static int Iterator_init(BPy_Iterator *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->it = new Iterator(); - return 0; + 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) - delete self->it; - Py_TYPE(self)->tp_free((PyObject *)self); + if (self->it) + delete self->it; + Py_TYPE(self)->tp_free((PyObject *)self); } static PyObject *Iterator_repr(BPy_Iterator *self) { - return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->it); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->it); } PyDoc_STRVAR(Iterator_increment_doc, -".. method:: increment()\n" -"\n" -" Makes the iterator point the next element."); + ".. method:: increment()\n" + "\n" + " Makes the iterator point the next element."); static PyObject *Iterator_increment(BPy_Iterator *self) { - if (self->it->isEnd()) { - PyErr_SetString(PyExc_RuntimeError, "cannot increment any more"); - return NULL; - } - self->it->increment(); - Py_RETURN_NONE; + if (self->it->isEnd()) { + PyErr_SetString(PyExc_RuntimeError, "cannot increment any more"); + return NULL; + } + self->it->increment(); + Py_RETURN_NONE; } PyDoc_STRVAR(Iterator_decrement_doc, -".. method:: decrement()\n" -"\n" -" Makes the iterator point the previous element."); + ".. method:: decrement()\n" + "\n" + " Makes the iterator point the previous element."); static PyObject *Iterator_decrement(BPy_Iterator *self) { - if (self->it->isBegin()) { - PyErr_SetString(PyExc_RuntimeError, "cannot decrement any more"); - return NULL; - } - self->it->decrement(); - Py_RETURN_NONE; + if (self->it->isBegin()) { + PyErr_SetString(PyExc_RuntimeError, "cannot decrement any more"); + return NULL; + } + self->it->decrement(); + Py_RETURN_NONE; } static PyMethodDef BPy_Iterator_methods[] = { - {"increment", (PyCFunction) Iterator_increment, METH_NOARGS, Iterator_increment_doc}, - {"decrement", (PyCFunction) Iterator_decrement, METH_NOARGS, Iterator_decrement_doc}, - {NULL, NULL, 0, NULL}, + {"increment", (PyCFunction)Iterator_increment, METH_NOARGS, Iterator_increment_doc}, + {"decrement", (PyCFunction)Iterator_decrement, METH_NOARGS, Iterator_decrement_doc}, + {NULL, NULL, 0, NULL}, }; /*----------------------Iterator get/setters ----------------------------*/ PyDoc_STRVAR(Iterator_name_doc, -"The string of the name of this iterator.\n" -"\n" -":type: str"); + "The string of the name of this iterator.\n" + "\n" + ":type: str"); static PyObject *Iterator_name_get(BPy_Iterator *self, void *UNUSED(closure)) { - return PyUnicode_FromString(Py_TYPE(self)->tp_name); + return PyUnicode_FromString(Py_TYPE(self)->tp_name); } PyDoc_STRVAR(Iterator_is_begin_doc, -"True if the interator points the first element.\n" -"\n" -":type: bool"); + "True if the interator points the first element.\n" + "\n" + ":type: bool"); static PyObject *Iterator_is_begin_get(BPy_Iterator *self, void *UNUSED(closure)) { - return PyBool_from_bool(self->it->isBegin()); + return PyBool_from_bool(self->it->isBegin()); } PyDoc_STRVAR(Iterator_is_end_doc, -"True if the interator points the last element.\n" -"\n" -":type: bool"); + "True if the interator points the last element.\n" + "\n" + ":type: bool"); static PyObject *Iterator_is_end_get(BPy_Iterator *self, void *UNUSED(closure)) { - return PyBool_from_bool(self->it->isEnd()); + return PyBool_from_bool(self->it->isEnd()); } static PyGetSetDef BPy_Iterator_getseters[] = { - {(char *)"name", (getter)Iterator_name_get, (setter)NULL, (char *)Iterator_name_doc, NULL}, - {(char *)"is_begin", (getter)Iterator_is_begin_get, (setter)NULL, (char *)Iterator_is_begin_doc, NULL}, - {(char *)"is_end", (getter)Iterator_is_end_get, (setter)NULL, (char *)Iterator_is_end_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"name", (getter)Iterator_name_get, (setter)NULL, (char *)Iterator_name_doc, NULL}, + {(char *)"is_begin", + (getter)Iterator_is_begin_get, + (setter)NULL, + (char *)Iterator_is_begin_doc, + NULL}, + {(char *)"is_end", + (getter)Iterator_is_end_get, + (setter)NULL, + (char *)Iterator_is_end_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_Iterator type definition ------------------------------*/ PyTypeObject Iterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "Iterator", /* tp_name */ - sizeof(BPy_Iterator), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)Iterator_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)Iterator_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Iterator_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_Iterator_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_Iterator_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Iterator_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "Iterator", /* tp_name */ + sizeof(BPy_Iterator), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)Iterator_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)Iterator_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Iterator_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_Iterator_methods, /* tp_methods */ + 0, /* tp_members */ + BPy_Iterator_getseters, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Iterator_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_Iterator.h b/source/blender/freestyle/intern/python/BPy_Iterator.h index 2648bfa4f13..f9f80c5f1db 100644 --- a/source/blender/freestyle/intern/python/BPy_Iterator.h +++ b/source/blender/freestyle/intern/python/BPy_Iterator.h @@ -41,15 +41,13 @@ extern PyTypeObject Iterator_Type; /*---------------------------Python BPy_Iterator structure definition----------*/ typedef struct { - PyObject_HEAD - Iterator *it; + PyObject_HEAD Iterator *it; } BPy_Iterator; /*---------------------------Python BPy_Iterator visible prototypes-----------*/ int Iterator_Init(PyObject *module); - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/BPy_MediumType.cpp b/source/blender/freestyle/intern/python/BPy_MediumType.cpp index 4d73bdede67..b29c4e8057a 100644 --- a/source/blender/freestyle/intern/python/BPy_MediumType.cpp +++ b/source/blender/freestyle/intern/python/BPy_MediumType.cpp @@ -31,84 +31,80 @@ extern "C" { /*-----------------------BPy_MediumType type definition ------------------------------*/ PyDoc_STRVAR(MediumType_doc, -"Class hierarchy: int > :class:`MediumType`\n" -"\n" -"The different blending modes available to similate the interaction\n" -"media-medium:\n" -"\n" -"* Stroke.DRY_MEDIUM: To simulate a dry medium such as Pencil or Charcoal.\n" -"* Stroke.HUMID_MEDIUM: To simulate ink painting (color subtraction blending).\n" -"* Stroke.OPAQUE_MEDIUM: To simulate an opaque medium (oil, spray...)."); + "Class hierarchy: int > :class:`MediumType`\n" + "\n" + "The different blending modes available to similate the interaction\n" + "media-medium:\n" + "\n" + "* Stroke.DRY_MEDIUM: To simulate a dry medium such as Pencil or Charcoal.\n" + "* Stroke.HUMID_MEDIUM: To simulate ink painting (color subtraction blending).\n" + "* Stroke.OPAQUE_MEDIUM: To simulate an opaque medium (oil, spray...)."); PyTypeObject MediumType_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "MediumType", /* tp_name */ - sizeof(PyLongObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - MediumType_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &PyLong_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "MediumType", /* tp_name */ + sizeof(PyLongObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + MediumType_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &PyLong_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /*-----------------------BPy_IntegrationType instance definitions -------------------------*/ PyLongObject _BPy_MediumType_DRY_MEDIUM = { - PyVarObject_HEAD_INIT(&MediumType_Type, 1) - { Stroke::DRY_MEDIUM }, + PyVarObject_HEAD_INIT(&MediumType_Type, 1){Stroke::DRY_MEDIUM}, }; PyLongObject _BPy_MediumType_HUMID_MEDIUM = { - PyVarObject_HEAD_INIT(&MediumType_Type, 1) - { Stroke::HUMID_MEDIUM }, + PyVarObject_HEAD_INIT(&MediumType_Type, 1){Stroke::HUMID_MEDIUM}, }; PyLongObject _BPy_MediumType_OPAQUE_MEDIUM = { - PyVarObject_HEAD_INIT(&MediumType_Type, 1) - { Stroke::OPAQUE_MEDIUM }, + PyVarObject_HEAD_INIT(&MediumType_Type, 1){Stroke::OPAQUE_MEDIUM}, }; //-------------------MODULE INITIALIZATION-------------------------------- int MediumType_Init(PyObject *module) { - if (module == NULL) - return -1; + if (module == NULL) + return -1; - if (PyType_Ready(&MediumType_Type) < 0) - return -1; - Py_INCREF(&MediumType_Type); - PyModule_AddObject(module, "MediumType", (PyObject *)&MediumType_Type); + if (PyType_Ready(&MediumType_Type) < 0) + return -1; + Py_INCREF(&MediumType_Type); + PyModule_AddObject(module, "MediumType", (PyObject *)&MediumType_Type); - return 0; + return 0; } /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_MediumType.h b/source/blender/freestyle/intern/python/BPy_MediumType.h index 062c56f2887..5c91890c249 100644 --- a/source/blender/freestyle/intern/python/BPy_MediumType.h +++ b/source/blender/freestyle/intern/python/BPy_MediumType.h @@ -41,7 +41,7 @@ extern PyTypeObject MediumType_Type; /*---------------------------Python BPy_MediumType structure definition----------*/ typedef struct { - PyLongObject i; + PyLongObject i; } BPy_MediumType; /*---------------------------Python BPy_MediumType visible prototypes-----------*/ @@ -53,9 +53,9 @@ extern PyLongObject _BPy_MediumType_DRY_MEDIUM; extern PyLongObject _BPy_MediumType_HUMID_MEDIUM; extern PyLongObject _BPy_MediumType_OPAQUE_MEDIUM; // public constants -#define BPy_MediumType_DRY_MEDIUM ((PyObject *)&_BPy_MediumType_DRY_MEDIUM) -#define BPy_MediumType_HUMID_MEDIUM ((PyObject *)&_BPy_MediumType_HUMID_MEDIUM) -#define BPy_MediumType_OPAQUE_MEDIUM ((PyObject *)&_BPy_MediumType_OPAQUE_MEDIUM) +#define BPy_MediumType_DRY_MEDIUM ((PyObject *)&_BPy_MediumType_DRY_MEDIUM) +#define BPy_MediumType_HUMID_MEDIUM ((PyObject *)&_BPy_MediumType_HUMID_MEDIUM) +#define BPy_MediumType_OPAQUE_MEDIUM ((PyObject *)&_BPy_MediumType_OPAQUE_MEDIUM) /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_Nature.cpp b/source/blender/freestyle/intern/python/BPy_Nature.cpp index 2bfec05cbe5..daefe796ff9 100644 --- a/source/blender/freestyle/intern/python/BPy_Nature.cpp +++ b/source/blender/freestyle/intern/python/BPy_Nature.cpp @@ -35,281 +35,242 @@ static PyObject *BPy_Nature_or(PyObject *a, PyObject *b); /*-----------------------BPy_Nature number method definitions --------------------*/ static PyNumberMethods nature_as_number = { - 0, /* binaryfunc nb_add */ - 0, /* binaryfunc nb_subtract */ - 0, /* binaryfunc nb_multiply */ - 0, /* binaryfunc nb_remainder */ - 0, /* binaryfunc nb_divmod */ - 0, /* ternaryfunc nb_power */ - 0, /* unaryfunc nb_negative */ - 0, /* unaryfunc nb_positive */ - 0, /* unaryfunc nb_absolute */ - 0, /* inquiry nb_bool */ - 0, /* unaryfunc nb_invert */ - 0, /* binaryfunc nb_lshift */ - 0, /* binaryfunc nb_rshift */ - (binaryfunc)BPy_Nature_and, /* binaryfunc nb_and */ - (binaryfunc)BPy_Nature_xor, /* binaryfunc nb_xor */ - (binaryfunc)BPy_Nature_or, /* binaryfunc nb_or */ - 0, /* unaryfunc nb_int */ - 0, /* void *nb_reserved */ - 0, /* unaryfunc nb_float */ - 0, /* binaryfunc nb_inplace_add */ - 0, /* binaryfunc nb_inplace_subtract */ - 0, /* binaryfunc nb_inplace_multiply */ - 0, /* binaryfunc nb_inplace_remainder */ - 0, /* ternaryfunc nb_inplace_power */ - 0, /* binaryfunc nb_inplace_lshift */ - 0, /* binaryfunc nb_inplace_rshift */ - 0, /* binaryfunc nb_inplace_and */ - 0, /* binaryfunc nb_inplace_xor */ - 0, /* binaryfunc nb_inplace_or */ - 0, /* binaryfunc nb_floor_divide */ - 0, /* binaryfunc nb_true_divide */ - 0, /* binaryfunc nb_inplace_floor_divide */ - 0, /* binaryfunc nb_inplace_true_divide */ - 0, /* unaryfunc nb_index */ + 0, /* binaryfunc nb_add */ + 0, /* binaryfunc nb_subtract */ + 0, /* binaryfunc nb_multiply */ + 0, /* binaryfunc nb_remainder */ + 0, /* binaryfunc nb_divmod */ + 0, /* ternaryfunc nb_power */ + 0, /* unaryfunc nb_negative */ + 0, /* unaryfunc nb_positive */ + 0, /* unaryfunc nb_absolute */ + 0, /* inquiry nb_bool */ + 0, /* unaryfunc nb_invert */ + 0, /* binaryfunc nb_lshift */ + 0, /* binaryfunc nb_rshift */ + (binaryfunc)BPy_Nature_and, /* binaryfunc nb_and */ + (binaryfunc)BPy_Nature_xor, /* binaryfunc nb_xor */ + (binaryfunc)BPy_Nature_or, /* binaryfunc nb_or */ + 0, /* unaryfunc nb_int */ + 0, /* void *nb_reserved */ + 0, /* unaryfunc nb_float */ + 0, /* binaryfunc nb_inplace_add */ + 0, /* binaryfunc nb_inplace_subtract */ + 0, /* binaryfunc nb_inplace_multiply */ + 0, /* binaryfunc nb_inplace_remainder */ + 0, /* ternaryfunc nb_inplace_power */ + 0, /* binaryfunc nb_inplace_lshift */ + 0, /* binaryfunc nb_inplace_rshift */ + 0, /* binaryfunc nb_inplace_and */ + 0, /* binaryfunc nb_inplace_xor */ + 0, /* binaryfunc nb_inplace_or */ + 0, /* binaryfunc nb_floor_divide */ + 0, /* binaryfunc nb_true_divide */ + 0, /* binaryfunc nb_inplace_floor_divide */ + 0, /* binaryfunc nb_inplace_true_divide */ + 0, /* unaryfunc nb_index */ }; /*-----------------------BPy_Nature docstring ------------------------------------*/ PyDoc_STRVAR(Nature_doc, -"Class hierarchy: int > :class:`Nature`\n" -"\n" -"Different possible natures of 0D and 1D elements of the ViewMap.\n" -"\n" -"Vertex natures:\n" -"\n" -"* Nature.POINT: True for any 0D element.\n" -"* Nature.S_VERTEX: True for SVertex.\n" -"* Nature.VIEW_VERTEX: True for ViewVertex.\n" -"* Nature.NON_T_VERTEX: True for NonTVertex.\n" -"* Nature.T_VERTEX: True for TVertex.\n" -"* Nature.CUSP: True for CUSP.\n" -"\n" -"Edge natures:\n" -"\n" -"* Nature.NO_FEATURE: True for non feature edges (always false for 1D\n" -" elements of the ViewMap).\n" -"* Nature.SILHOUETTE: True for silhouettes.\n" -"* Nature.BORDER: True for borders.\n" -"* Nature.CREASE: True for creases.\n" -"* Nature.RIDGE: True for ridges.\n" -"* Nature.VALLEY: True for valleys.\n" -"* Nature.SUGGESTIVE_CONTOUR: True for suggestive contours.\n" -"* Nature.MATERIAL_BOUNDARY: True for edges at material boundaries.\n" -"* Nature.EDGE_MARK: True for edges having user-defined edge marks."); + "Class hierarchy: int > :class:`Nature`\n" + "\n" + "Different possible natures of 0D and 1D elements of the ViewMap.\n" + "\n" + "Vertex natures:\n" + "\n" + "* Nature.POINT: True for any 0D element.\n" + "* Nature.S_VERTEX: True for SVertex.\n" + "* Nature.VIEW_VERTEX: True for ViewVertex.\n" + "* Nature.NON_T_VERTEX: True for NonTVertex.\n" + "* Nature.T_VERTEX: True for TVertex.\n" + "* Nature.CUSP: True for CUSP.\n" + "\n" + "Edge natures:\n" + "\n" + "* Nature.NO_FEATURE: True for non feature edges (always false for 1D\n" + " elements of the ViewMap).\n" + "* Nature.SILHOUETTE: True for silhouettes.\n" + "* Nature.BORDER: True for borders.\n" + "* Nature.CREASE: True for creases.\n" + "* Nature.RIDGE: True for ridges.\n" + "* Nature.VALLEY: True for valleys.\n" + "* Nature.SUGGESTIVE_CONTOUR: True for suggestive contours.\n" + "* Nature.MATERIAL_BOUNDARY: True for edges at material boundaries.\n" + "* Nature.EDGE_MARK: True for edges having user-defined edge marks."); /*-----------------------BPy_Nature type definition ------------------------------*/ PyTypeObject Nature_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "Nature", /* tp_name */ - sizeof(PyLongObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - &nature_as_number, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - Nature_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &PyLong_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "Nature", /* tp_name */ + sizeof(PyLongObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + &nature_as_number, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + Nature_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &PyLong_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /*-----------------------BPy_Nature instance definitions ----------------------------------*/ -static PyLongObject _Nature_POINT = { - PyVarObject_HEAD_INIT(&Nature_Type, 0) - { Nature::POINT } -}; -static PyLongObject _Nature_S_VERTEX = { - PyVarObject_HEAD_INIT(&Nature_Type, 1) - { Nature::S_VERTEX } -}; +static PyLongObject _Nature_POINT = {PyVarObject_HEAD_INIT(&Nature_Type, 0){Nature::POINT}}; +static PyLongObject _Nature_S_VERTEX = {PyVarObject_HEAD_INIT(&Nature_Type, 1){Nature::S_VERTEX}}; static PyLongObject _Nature_VIEW_VERTEX = { - PyVarObject_HEAD_INIT(&Nature_Type, 1) - { Nature::VIEW_VERTEX } -}; + PyVarObject_HEAD_INIT(&Nature_Type, 1){Nature::VIEW_VERTEX}}; static PyLongObject _Nature_NON_T_VERTEX = { - PyVarObject_HEAD_INIT(&Nature_Type, 1) - { Nature::NON_T_VERTEX } -}; -static PyLongObject _Nature_T_VERTEX = { - PyVarObject_HEAD_INIT(&Nature_Type, 1) - { Nature::T_VERTEX } -}; -static PyLongObject _Nature_CUSP = { - PyVarObject_HEAD_INIT(&Nature_Type, 1) - { Nature::CUSP } -}; + PyVarObject_HEAD_INIT(&Nature_Type, 1){Nature::NON_T_VERTEX}}; +static PyLongObject _Nature_T_VERTEX = {PyVarObject_HEAD_INIT(&Nature_Type, 1){Nature::T_VERTEX}}; +static PyLongObject _Nature_CUSP = {PyVarObject_HEAD_INIT(&Nature_Type, 1){Nature::CUSP}}; static PyLongObject _Nature_NO_FEATURE = { - PyVarObject_HEAD_INIT(&Nature_Type, 0) - { Nature::NO_FEATURE } -}; + PyVarObject_HEAD_INIT(&Nature_Type, 0){Nature::NO_FEATURE}}; static PyLongObject _Nature_SILHOUETTE = { - PyVarObject_HEAD_INIT(&Nature_Type, 1) - { Nature::SILHOUETTE } -}; -static PyLongObject _Nature_BORDER = { - PyVarObject_HEAD_INIT(&Nature_Type, 1) - { Nature::BORDER } -}; -static PyLongObject _Nature_CREASE = { - PyVarObject_HEAD_INIT(&Nature_Type, 1) - { Nature::CREASE } -}; -static PyLongObject _Nature_RIDGE = { - PyVarObject_HEAD_INIT(&Nature_Type, 1) - { Nature::RIDGE } -}; -static PyLongObject _Nature_VALLEY = { - PyVarObject_HEAD_INIT(&Nature_Type, 1) - { Nature::VALLEY } -}; + PyVarObject_HEAD_INIT(&Nature_Type, 1){Nature::SILHOUETTE}}; +static PyLongObject _Nature_BORDER = {PyVarObject_HEAD_INIT(&Nature_Type, 1){Nature::BORDER}}; +static PyLongObject _Nature_CREASE = {PyVarObject_HEAD_INIT(&Nature_Type, 1){Nature::CREASE}}; +static PyLongObject _Nature_RIDGE = {PyVarObject_HEAD_INIT(&Nature_Type, 1){Nature::RIDGE}}; +static PyLongObject _Nature_VALLEY = {PyVarObject_HEAD_INIT(&Nature_Type, 1){Nature::VALLEY}}; static PyLongObject _Nature_SUGGESTIVE_CONTOUR = { - PyVarObject_HEAD_INIT(&Nature_Type, 1) - { Nature::SUGGESTIVE_CONTOUR } -}; + PyVarObject_HEAD_INIT(&Nature_Type, 1){Nature::SUGGESTIVE_CONTOUR}}; static PyLongObject _Nature_MATERIAL_BOUNDARY = { - PyVarObject_HEAD_INIT(&Nature_Type, 1) - { Nature::MATERIAL_BOUNDARY } -}; + PyVarObject_HEAD_INIT(&Nature_Type, 1){Nature::MATERIAL_BOUNDARY}}; static PyLongObject _Nature_EDGE_MARK = { - PyVarObject_HEAD_INIT(&Nature_Type, 1) - { Nature::EDGE_MARK } -}; + PyVarObject_HEAD_INIT(&Nature_Type, 1){Nature::EDGE_MARK}}; -#define BPy_Nature_POINT ((PyObject *)&_Nature_POINT) -#define BPy_Nature_S_VERTEX ((PyObject *)&_Nature_S_VERTEX) -#define BPy_Nature_VIEW_VERTEX ((PyObject *)&_Nature_VIEW_VERTEX) -#define BPy_Nature_NON_T_VERTEX ((PyObject *)&_Nature_NON_T_VERTEX) -#define BPy_Nature_T_VERTEX ((PyObject *)&_Nature_T_VERTEX) -#define BPy_Nature_CUSP ((PyObject *)&_Nature_CUSP) -#define BPy_Nature_NO_FEATURE ((PyObject *)&_Nature_NO_FEATURE) -#define BPy_Nature_SILHOUETTE ((PyObject *)&_Nature_SILHOUETTE) -#define BPy_Nature_BORDER ((PyObject *)&_Nature_BORDER) -#define BPy_Nature_CREASE ((PyObject *)&_Nature_CREASE) -#define BPy_Nature_RIDGE ((PyObject *)&_Nature_RIDGE) -#define BPy_Nature_VALLEY ((PyObject *)&_Nature_VALLEY) -#define BPy_Nature_SUGGESTIVE_CONTOUR ((PyObject *)&_Nature_SUGGESTIVE_CONTOUR) -#define BPy_Nature_MATERIAL_BOUNDARY ((PyObject *)&_Nature_MATERIAL_BOUNDARY) -#define BPy_Nature_EDGE_MARK ((PyObject *)&_Nature_EDGE_MARK) +#define BPy_Nature_POINT ((PyObject *)&_Nature_POINT) +#define BPy_Nature_S_VERTEX ((PyObject *)&_Nature_S_VERTEX) +#define BPy_Nature_VIEW_VERTEX ((PyObject *)&_Nature_VIEW_VERTEX) +#define BPy_Nature_NON_T_VERTEX ((PyObject *)&_Nature_NON_T_VERTEX) +#define BPy_Nature_T_VERTEX ((PyObject *)&_Nature_T_VERTEX) +#define BPy_Nature_CUSP ((PyObject *)&_Nature_CUSP) +#define BPy_Nature_NO_FEATURE ((PyObject *)&_Nature_NO_FEATURE) +#define BPy_Nature_SILHOUETTE ((PyObject *)&_Nature_SILHOUETTE) +#define BPy_Nature_BORDER ((PyObject *)&_Nature_BORDER) +#define BPy_Nature_CREASE ((PyObject *)&_Nature_CREASE) +#define BPy_Nature_RIDGE ((PyObject *)&_Nature_RIDGE) +#define BPy_Nature_VALLEY ((PyObject *)&_Nature_VALLEY) +#define BPy_Nature_SUGGESTIVE_CONTOUR ((PyObject *)&_Nature_SUGGESTIVE_CONTOUR) +#define BPy_Nature_MATERIAL_BOUNDARY ((PyObject *)&_Nature_MATERIAL_BOUNDARY) +#define BPy_Nature_EDGE_MARK ((PyObject *)&_Nature_EDGE_MARK) //-------------------MODULE INITIALIZATION-------------------------------- int Nature_Init(PyObject *module) { - if (module == NULL) - return -1; + if (module == NULL) + return -1; - if (PyType_Ready(&Nature_Type) < 0) - return -1; - Py_INCREF(&Nature_Type); - PyModule_AddObject(module, "Nature", (PyObject *)&Nature_Type); + if (PyType_Ready(&Nature_Type) < 0) + return -1; + Py_INCREF(&Nature_Type); + PyModule_AddObject(module, "Nature", (PyObject *)&Nature_Type); - // VertexNature - PyDict_SetItemString(Nature_Type.tp_dict, "POINT", BPy_Nature_POINT); - PyDict_SetItemString(Nature_Type.tp_dict, "S_VERTEX", BPy_Nature_S_VERTEX); - PyDict_SetItemString(Nature_Type.tp_dict, "VIEW_VERTEX", BPy_Nature_VIEW_VERTEX); - PyDict_SetItemString(Nature_Type.tp_dict, "NON_T_VERTEX", BPy_Nature_NON_T_VERTEX); - PyDict_SetItemString(Nature_Type.tp_dict, "T_VERTEX", BPy_Nature_T_VERTEX); - PyDict_SetItemString(Nature_Type.tp_dict, "CUSP", BPy_Nature_CUSP); + // VertexNature + PyDict_SetItemString(Nature_Type.tp_dict, "POINT", BPy_Nature_POINT); + PyDict_SetItemString(Nature_Type.tp_dict, "S_VERTEX", BPy_Nature_S_VERTEX); + PyDict_SetItemString(Nature_Type.tp_dict, "VIEW_VERTEX", BPy_Nature_VIEW_VERTEX); + PyDict_SetItemString(Nature_Type.tp_dict, "NON_T_VERTEX", BPy_Nature_NON_T_VERTEX); + PyDict_SetItemString(Nature_Type.tp_dict, "T_VERTEX", BPy_Nature_T_VERTEX); + PyDict_SetItemString(Nature_Type.tp_dict, "CUSP", BPy_Nature_CUSP); - // EdgeNature - PyDict_SetItemString(Nature_Type.tp_dict, "NO_FEATURE", BPy_Nature_NO_FEATURE); - PyDict_SetItemString(Nature_Type.tp_dict, "SILHOUETTE", BPy_Nature_SILHOUETTE); - PyDict_SetItemString(Nature_Type.tp_dict, "BORDER", BPy_Nature_BORDER); - PyDict_SetItemString(Nature_Type.tp_dict, "CREASE", BPy_Nature_CREASE); - PyDict_SetItemString(Nature_Type.tp_dict, "RIDGE", BPy_Nature_RIDGE); - PyDict_SetItemString(Nature_Type.tp_dict, "VALLEY", BPy_Nature_VALLEY); - PyDict_SetItemString(Nature_Type.tp_dict, "SUGGESTIVE_CONTOUR", BPy_Nature_SUGGESTIVE_CONTOUR); - PyDict_SetItemString(Nature_Type.tp_dict, "MATERIAL_BOUNDARY", BPy_Nature_MATERIAL_BOUNDARY); - PyDict_SetItemString(Nature_Type.tp_dict, "EDGE_MARK", BPy_Nature_EDGE_MARK); + // EdgeNature + PyDict_SetItemString(Nature_Type.tp_dict, "NO_FEATURE", BPy_Nature_NO_FEATURE); + PyDict_SetItemString(Nature_Type.tp_dict, "SILHOUETTE", BPy_Nature_SILHOUETTE); + PyDict_SetItemString(Nature_Type.tp_dict, "BORDER", BPy_Nature_BORDER); + PyDict_SetItemString(Nature_Type.tp_dict, "CREASE", BPy_Nature_CREASE); + PyDict_SetItemString(Nature_Type.tp_dict, "RIDGE", BPy_Nature_RIDGE); + PyDict_SetItemString(Nature_Type.tp_dict, "VALLEY", BPy_Nature_VALLEY); + PyDict_SetItemString(Nature_Type.tp_dict, "SUGGESTIVE_CONTOUR", BPy_Nature_SUGGESTIVE_CONTOUR); + PyDict_SetItemString(Nature_Type.tp_dict, "MATERIAL_BOUNDARY", BPy_Nature_MATERIAL_BOUNDARY); + PyDict_SetItemString(Nature_Type.tp_dict, "EDGE_MARK", BPy_Nature_EDGE_MARK); - return 0; + return 0; } static PyObject *BPy_Nature_bitwise(PyObject *a, int op, PyObject *b) { - BPy_Nature *result; - long op1, op2, v; + BPy_Nature *result; + long op1, op2, v; - if (!BPy_Nature_Check(a) || !BPy_Nature_Check(b)) { - PyErr_SetString(PyExc_TypeError, "operands must be a Nature object"); - return NULL; - } + if (!BPy_Nature_Check(a) || !BPy_Nature_Check(b)) { + PyErr_SetString(PyExc_TypeError, "operands must be a Nature object"); + return NULL; + } - if ((op1 = PyLong_AsLong(a)) == -1 && PyErr_Occurred()) { - PyErr_SetString(PyExc_ValueError, "operand 1: unexpected Nature value"); - return NULL; - } - if ((op2 = PyLong_AsLong(b)) == -1 && PyErr_Occurred()) { - PyErr_SetString(PyExc_ValueError, "operand 2: unexpected Nature value"); - return NULL; - } - switch (op) { - case '&': - v = op1 & op2; - break; - case '^': - v = op1 ^ op2; - break; - case '|': - v = op1 | op2; - break; - default: - PyErr_BadArgument(); - return NULL; - } - if (v == 0) - result = PyObject_NewVar(BPy_Nature, &Nature_Type, 0); - else { - result = PyObject_NewVar(BPy_Nature, &Nature_Type, 1); - if (result) - result->i.ob_digit[0] = v; - } - return (PyObject *)result; + if ((op1 = PyLong_AsLong(a)) == -1 && PyErr_Occurred()) { + PyErr_SetString(PyExc_ValueError, "operand 1: unexpected Nature value"); + return NULL; + } + if ((op2 = PyLong_AsLong(b)) == -1 && PyErr_Occurred()) { + PyErr_SetString(PyExc_ValueError, "operand 2: unexpected Nature value"); + return NULL; + } + switch (op) { + case '&': + v = op1 & op2; + break; + case '^': + v = op1 ^ op2; + break; + case '|': + v = op1 | op2; + break; + default: + PyErr_BadArgument(); + return NULL; + } + if (v == 0) + result = PyObject_NewVar(BPy_Nature, &Nature_Type, 0); + else { + result = PyObject_NewVar(BPy_Nature, &Nature_Type, 1); + if (result) + result->i.ob_digit[0] = v; + } + return (PyObject *)result; } static PyObject *BPy_Nature_and(PyObject *a, PyObject *b) { - return BPy_Nature_bitwise(a, '&', b); + return BPy_Nature_bitwise(a, '&', b); } static PyObject *BPy_Nature_xor(PyObject *a, PyObject *b) { - return BPy_Nature_bitwise(a, '^', b); + return BPy_Nature_bitwise(a, '^', b); } static PyObject *BPy_Nature_or(PyObject *a, PyObject *b) { - return BPy_Nature_bitwise(a, '|', b); + return BPy_Nature_bitwise(a, '|', b); } /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_Nature.h b/source/blender/freestyle/intern/python/BPy_Nature.h index 1cdc1a82ca5..8eb33f02488 100644 --- a/source/blender/freestyle/intern/python/BPy_Nature.h +++ b/source/blender/freestyle/intern/python/BPy_Nature.h @@ -41,7 +41,7 @@ extern PyTypeObject Nature_Type; /*---------------------------Python BPy_Nature structure definition----------*/ typedef struct { - PyLongObject i; + PyLongObject i; } BPy_Nature; /*---------------------------Python BPy_Nature visible prototypes-----------*/ diff --git a/source/blender/freestyle/intern/python/BPy_Operators.cpp b/source/blender/freestyle/intern/python/BPy_Operators.cpp index 6bbdcd72052..e2afda63e14 100644 --- a/source/blender/freestyle/intern/python/BPy_Operators.cpp +++ b/source/blender/freestyle/intern/python/BPy_Operators.cpp @@ -41,724 +41,817 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int Operators_Init(PyObject *module) { - if (module == NULL) - return -1; + if (module == NULL) + return -1; - if (PyType_Ready(&Operators_Type) < 0) - return -1; - Py_INCREF(&Operators_Type); - PyModule_AddObject(module, "Operators", (PyObject *)&Operators_Type); + if (PyType_Ready(&Operators_Type) < 0) + return -1; + Py_INCREF(&Operators_Type); + PyModule_AddObject(module, "Operators", (PyObject *)&Operators_Type); - return 0; + return 0; } //------------------------INSTANCE METHODS ---------------------------------- PyDoc_STRVAR(Operators_doc, -"Class defining the operators used in a style module. There are five\n" -"types of operators: Selection, chaining, splitting, sorting and\n" -"creation. All these operators are user controlled through functors,\n" -"predicates and shaders that are taken as arguments."); + "Class defining the operators used in a style module. There are five\n" + "types of operators: Selection, chaining, splitting, sorting and\n" + "creation. All these operators are user controlled through functors,\n" + "predicates and shaders that are taken as arguments."); static void Operators_dealloc(BPy_Operators *self) { - Py_TYPE(self)->tp_free((PyObject *)self); + Py_TYPE(self)->tp_free((PyObject *)self); } PyDoc_STRVAR(Operators_select_doc, -".. staticmethod:: select(pred)\n" -"\n" -" Selects the ViewEdges of the ViewMap verifying a specified\n" -" condition.\n" -"\n" -" :arg pred: The predicate expressing this condition.\n" -" :type pred: :class:`UnaryPredicate1D`"); + ".. staticmethod:: select(pred)\n" + "\n" + " Selects the ViewEdges of the ViewMap verifying a specified\n" + " condition.\n" + "\n" + " :arg pred: The predicate expressing this condition.\n" + " :type pred: :class:`UnaryPredicate1D`"); static PyObject *Operators_select(BPy_Operators * /*self*/, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"pred", NULL}; - PyObject *obj = 0; - - if (!PyArg_ParseTupleAndKeywords(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()) - PyErr_SetString(PyExc_RuntimeError, "Operators.select() failed"); - return NULL; - } - Py_RETURN_NONE; + static const char *kwlist[] = {"pred", NULL}; + PyObject *obj = 0; + + if (!PyArg_ParseTupleAndKeywords( + 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()) + PyErr_SetString(PyExc_RuntimeError, "Operators.select() failed"); + return NULL; + } + Py_RETURN_NONE; } PyDoc_STRVAR(Operators_chain_doc, -".. staticmethod:: chain(it, pred, modifier)\n" -"\n" -" Builds a set of chains from the current set of ViewEdges. Each\n" -" ViewEdge of the current list starts a new chain. The chaining\n" -" operator then iterates over the ViewEdges of the ViewMap using the\n" -" user specified iterator. This operator only iterates using the\n" -" increment operator and is therefore unidirectional.\n" -"\n" -" :arg it: The iterator on the ViewEdges of the ViewMap. It contains\n" -" the chaining rule.\n" -" :type it: :class:`ViewEdgeIterator`\n" -" :arg pred: The predicate on the ViewEdge that expresses the\n" -" stopping condition.\n" -" :type pred: :class:`UnaryPredicate1D`\n" -" :arg modifier: A function that takes a ViewEdge as argument and\n" -" that is used to modify the processed ViewEdge state (the\n" -" timestamp incrementation is a typical illustration of such a\n" -" modifier).\n" -" :type modifier: :class:`UnaryFunction1DVoid`\n" -"\n" -".. staticmethod:: chain(it, pred)\n" -"\n" -" Builds a set of chains from the current set of ViewEdges. Each\n" -" ViewEdge of the current list starts a new chain. The chaining\n" -" operator then iterates over the ViewEdges of the ViewMap using the\n" -" user specified iterator. This operator only iterates using the\n" -" increment operator and is therefore unidirectional. This chaining\n" -" operator is different from the previous one because it doesn't take\n" -" any modifier as argument. Indeed, the time stamp (insuring that a\n" -" ViewEdge is processed one time) is automatically managed in this\n" -" case.\n" -"\n" -" :arg it: The iterator on the ViewEdges of the ViewMap. It contains\n" -" the chaining rule. \n" -" :type it: :class:`ViewEdgeIterator`\n" -" :arg pred: The predicate on the ViewEdge that expresses the\n" -" stopping condition.\n" -" :type pred: :class:`UnaryPredicate1D`"); + ".. staticmethod:: chain(it, pred, modifier)\n" + "\n" + " Builds a set of chains from the current set of ViewEdges. Each\n" + " ViewEdge of the current list starts a new chain. The chaining\n" + " operator then iterates over the ViewEdges of the ViewMap using the\n" + " user specified iterator. This operator only iterates using the\n" + " increment operator and is therefore unidirectional.\n" + "\n" + " :arg it: The iterator on the ViewEdges of the ViewMap. It contains\n" + " the chaining rule.\n" + " :type it: :class:`ViewEdgeIterator`\n" + " :arg pred: The predicate on the ViewEdge that expresses the\n" + " stopping condition.\n" + " :type pred: :class:`UnaryPredicate1D`\n" + " :arg modifier: A function that takes a ViewEdge as argument and\n" + " that is used to modify the processed ViewEdge state (the\n" + " timestamp incrementation is a typical illustration of such a\n" + " modifier).\n" + " :type modifier: :class:`UnaryFunction1DVoid`\n" + "\n" + ".. staticmethod:: chain(it, pred)\n" + "\n" + " Builds a set of chains from the current set of ViewEdges. Each\n" + " ViewEdge of the current list starts a new chain. The chaining\n" + " operator then iterates over the ViewEdges of the ViewMap using the\n" + " user specified iterator. This operator only iterates using the\n" + " increment operator and is therefore unidirectional. This chaining\n" + " operator is different from the previous one because it doesn't take\n" + " any modifier as argument. Indeed, the time stamp (insuring that a\n" + " ViewEdge is processed one time) is automatically managed in this\n" + " case.\n" + "\n" + " :arg it: The iterator on the ViewEdges of the ViewMap. It contains\n" + " the chaining rule. \n" + " :type it: :class:`ViewEdgeIterator`\n" + " :arg pred: The predicate on the ViewEdge that expresses the\n" + " stopping condition.\n" + " :type pred: :class:`UnaryPredicate1D`"); static PyObject *Operators_chain(BPy_Operators * /*self*/, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"it", "pred", "modifier", NULL}; - PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O!|O!", (char **)kwlist, - &ChainingIterator_Type, &obj1, - &UnaryPredicate1D_Type, &obj2, - &UnaryFunction1DVoid_Type, &obj3)) - { - return NULL; - } - if (!((BPy_ChainingIterator *)obj1)->c_it) { - PyErr_SetString(PyExc_TypeError, "Operators.chain(): 1st argument: invalid ChainingIterator object"); - return NULL; - } - if (!((BPy_UnaryPredicate1D *)obj2)->up1D) { - PyErr_SetString(PyExc_TypeError, "Operators.chain(): 2nd argument: invalid UnaryPredicate1D object"); - return NULL; - } - if (!obj3) { - if (Operators::chain(*(((BPy_ChainingIterator *)obj1)->c_it), - *(((BPy_UnaryPredicate1D *)obj2)->up1D)) < 0) - { - if (!PyErr_Occurred()) - PyErr_SetString(PyExc_RuntimeError, "Operators.chain() failed"); - return NULL; - } - } - else { - if (!((BPy_UnaryFunction1DVoid *)obj3)->uf1D_void) { - PyErr_SetString(PyExc_TypeError, "Operators.chain(): 3rd argument: invalid UnaryFunction1DVoid object"); - return NULL; - } - if (Operators::chain(*(((BPy_ChainingIterator *)obj1)->c_it), - *(((BPy_UnaryPredicate1D *)obj2)->up1D), - *(((BPy_UnaryFunction1DVoid *)obj3)->uf1D_void)) < 0) - { - if (!PyErr_Occurred()) - PyErr_SetString(PyExc_RuntimeError, "Operators.chain() failed"); - return NULL; - } - } - Py_RETURN_NONE; + static const char *kwlist[] = {"it", "pred", "modifier", NULL}; + PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0; + + if (!PyArg_ParseTupleAndKeywords(args, + kwds, + "O!O!|O!", + (char **)kwlist, + &ChainingIterator_Type, + &obj1, + &UnaryPredicate1D_Type, + &obj2, + &UnaryFunction1DVoid_Type, + &obj3)) { + return NULL; + } + if (!((BPy_ChainingIterator *)obj1)->c_it) { + PyErr_SetString(PyExc_TypeError, + "Operators.chain(): 1st argument: invalid ChainingIterator object"); + return NULL; + } + if (!((BPy_UnaryPredicate1D *)obj2)->up1D) { + PyErr_SetString(PyExc_TypeError, + "Operators.chain(): 2nd argument: invalid UnaryPredicate1D object"); + return NULL; + } + if (!obj3) { + if (Operators::chain(*(((BPy_ChainingIterator *)obj1)->c_it), + *(((BPy_UnaryPredicate1D *)obj2)->up1D)) < 0) { + if (!PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "Operators.chain() failed"); + return NULL; + } + } + else { + if (!((BPy_UnaryFunction1DVoid *)obj3)->uf1D_void) { + PyErr_SetString(PyExc_TypeError, + "Operators.chain(): 3rd argument: invalid UnaryFunction1DVoid object"); + return NULL; + } + if (Operators::chain(*(((BPy_ChainingIterator *)obj1)->c_it), + *(((BPy_UnaryPredicate1D *)obj2)->up1D), + *(((BPy_UnaryFunction1DVoid *)obj3)->uf1D_void)) < 0) { + if (!PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "Operators.chain() failed"); + return NULL; + } + } + Py_RETURN_NONE; } PyDoc_STRVAR(Operators_bidirectional_chain_doc, -".. staticmethod:: bidirectional_chain(it, pred)\n" -"\n" -" Builds a set of chains from the current set of ViewEdges. Each\n" -" ViewEdge of the current list potentially starts a new chain. The\n" -" chaining operator then iterates over the ViewEdges of the ViewMap\n" -" using the user specified iterator. This operator iterates both using\n" -" the increment and decrement operators and is therefore bidirectional.\n" -" This operator works with a ChainingIterator which contains the\n" -" chaining rules. It is this last one which can be told to chain only\n" -" edges that belong to the selection or not to process twice a ViewEdge\n" -" during the chaining. Each time a ViewEdge is added to a chain, its\n" -" chaining time stamp is incremented. This allows you to keep track of\n" -" the number of chains to which a ViewEdge belongs to.\n" -"\n" -" :arg it: The ChainingIterator on the ViewEdges of the ViewMap. It\n" -" contains the chaining rule.\n" -" :type it: :class:`ChainingIterator`\n" -" :arg pred: The predicate on the ViewEdge that expresses the\n" -" stopping condition.\n" -" :type pred: :class:`UnaryPredicate1D`\n" -"\n" -".. staticmethod:: bidirectional_chain(it)\n" -"\n" -" The only difference with the above bidirectional chaining algorithm\n" -" is that we don't need to pass a stopping criterion. This might be\n" -" desirable when the stopping criterion is already contained in the\n" -" iterator definition. Builds a set of chains from the current set of\n" -" ViewEdges. Each ViewEdge of the current list potentially starts a new\n" -" chain. The chaining operator then iterates over the ViewEdges of the\n" -" ViewMap using the user specified iterator. This operator iterates\n" -" both using the increment and decrement operators and is therefore\n" -" bidirectional. This operator works with a ChainingIterator which\n" -" contains the chaining rules. It is this last one which can be told to\n" -" chain only edges that belong to the selection or not to process twice\n" -" a ViewEdge during the chaining. Each time a ViewEdge is added to a\n" -" chain, its chaining time stamp is incremented. This allows you to\n" -" keep track of the number of chains to which a ViewEdge belongs to.\n" -"\n" -" :arg it: The ChainingIterator on the ViewEdges of the ViewMap. It\n" -" contains the chaining rule.\n" -" :type it: :class:`ChainingIterator`"); - -static PyObject *Operators_bidirectional_chain(BPy_Operators * /*self*/, PyObject *args, PyObject *kwds) + ".. staticmethod:: bidirectional_chain(it, pred)\n" + "\n" + " Builds a set of chains from the current set of ViewEdges. Each\n" + " ViewEdge of the current list potentially starts a new chain. The\n" + " chaining operator then iterates over the ViewEdges of the ViewMap\n" + " using the user specified iterator. This operator iterates both using\n" + " the increment and decrement operators and is therefore bidirectional.\n" + " This operator works with a ChainingIterator which contains the\n" + " chaining rules. It is this last one which can be told to chain only\n" + " edges that belong to the selection or not to process twice a ViewEdge\n" + " during the chaining. Each time a ViewEdge is added to a chain, its\n" + " chaining time stamp is incremented. This allows you to keep track of\n" + " the number of chains to which a ViewEdge belongs to.\n" + "\n" + " :arg it: The ChainingIterator on the ViewEdges of the ViewMap. It\n" + " contains the chaining rule.\n" + " :type it: :class:`ChainingIterator`\n" + " :arg pred: The predicate on the ViewEdge that expresses the\n" + " stopping condition.\n" + " :type pred: :class:`UnaryPredicate1D`\n" + "\n" + ".. staticmethod:: bidirectional_chain(it)\n" + "\n" + " The only difference with the above bidirectional chaining algorithm\n" + " is that we don't need to pass a stopping criterion. This might be\n" + " desirable when the stopping criterion is already contained in the\n" + " iterator definition. Builds a set of chains from the current set of\n" + " ViewEdges. Each ViewEdge of the current list potentially starts a new\n" + " chain. The chaining operator then iterates over the ViewEdges of the\n" + " ViewMap using the user specified iterator. This operator iterates\n" + " both using the increment and decrement operators and is therefore\n" + " bidirectional. This operator works with a ChainingIterator which\n" + " contains the chaining rules. It is this last one which can be told to\n" + " chain only edges that belong to the selection or not to process twice\n" + " a ViewEdge during the chaining. Each time a ViewEdge is added to a\n" + " chain, its chaining time stamp is incremented. This allows you to\n" + " keep track of the number of chains to which a ViewEdge belongs to.\n" + "\n" + " :arg it: The ChainingIterator on the ViewEdges of the ViewMap. It\n" + " contains the chaining rule.\n" + " :type it: :class:`ChainingIterator`"); + +static PyObject *Operators_bidirectional_chain(BPy_Operators * /*self*/, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"it", "pred", NULL}; - PyObject *obj1 = 0, *obj2 = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!|O!", (char **)kwlist, - &ChainingIterator_Type, &obj1, &UnaryPredicate1D_Type, &obj2)) - { - return NULL; - } - if (!((BPy_ChainingIterator *)obj1)->c_it) { - PyErr_SetString(PyExc_TypeError, - "Operators.bidirectional_chain(): 1st argument: invalid ChainingIterator object"); - return NULL; - } - if (!obj2) { - if (Operators::bidirectionalChain(*(((BPy_ChainingIterator *)obj1)->c_it)) < 0) { - if (!PyErr_Occurred()) - PyErr_SetString(PyExc_RuntimeError, "Operators.bidirectional_chain() failed"); - return NULL; - } - } - else { - if (!((BPy_UnaryPredicate1D *)obj2)->up1D) { - PyErr_SetString(PyExc_TypeError, - "Operators.bidirectional_chain(): 2nd argument: invalid UnaryPredicate1D object"); - return NULL; - } - if (Operators::bidirectionalChain(*(((BPy_ChainingIterator *)obj1)->c_it), - *(((BPy_UnaryPredicate1D *)obj2)->up1D)) < 0) - { - if (!PyErr_Occurred()) - PyErr_SetString(PyExc_RuntimeError, "Operators.bidirectional_chain() failed"); - return NULL; - } - } - Py_RETURN_NONE; + static const char *kwlist[] = {"it", "pred", NULL}; + PyObject *obj1 = 0, *obj2 = 0; + + if (!PyArg_ParseTupleAndKeywords(args, + kwds, + "O!|O!", + (char **)kwlist, + &ChainingIterator_Type, + &obj1, + &UnaryPredicate1D_Type, + &obj2)) { + return NULL; + } + if (!((BPy_ChainingIterator *)obj1)->c_it) { + PyErr_SetString( + PyExc_TypeError, + "Operators.bidirectional_chain(): 1st argument: invalid ChainingIterator object"); + return NULL; + } + if (!obj2) { + if (Operators::bidirectionalChain(*(((BPy_ChainingIterator *)obj1)->c_it)) < 0) { + if (!PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "Operators.bidirectional_chain() failed"); + return NULL; + } + } + else { + if (!((BPy_UnaryPredicate1D *)obj2)->up1D) { + PyErr_SetString( + PyExc_TypeError, + "Operators.bidirectional_chain(): 2nd argument: invalid UnaryPredicate1D object"); + return NULL; + } + if (Operators::bidirectionalChain(*(((BPy_ChainingIterator *)obj1)->c_it), + *(((BPy_UnaryPredicate1D *)obj2)->up1D)) < 0) { + if (!PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "Operators.bidirectional_chain() failed"); + return NULL; + } + } + Py_RETURN_NONE; } PyDoc_STRVAR(Operators_sequential_split_doc, -".. staticmethod:: sequential_split(starting_pred, stopping_pred, sampling=0.0)\n" -"\n" -" Splits each chain of the current set of chains in a sequential way.\n" -" The points of each chain are processed (with a specified sampling)\n" -" sequentially. Each time a user specified starting condition is\n" -" verified, a new chain begins and ends as soon as a user-defined\n" -" stopping predicate is verified. This allows chains overlapping rather\n" -" than chains partitioning. The first point of the initial chain is the\n" -" first point of one of the resulting chains. The splitting ends when\n" -" no more chain can start.\n" -"\n" -" :arg starting_pred: The predicate on a point that expresses the\n" -" starting condition.\n" -" :type starting_pred: :class:`UnaryPredicate0D`\n" -" :arg stopping_pred: The predicate on a point that expresses the\n" -" stopping condition.\n" -" :type stopping_pred: :class:`UnaryPredicate0D`\n" -" :arg sampling: The resolution used to sample the chain for the\n" -" predicates evaluation. (The chain is not actually resampled;\n" -" a virtual point only progresses along the curve using this\n" -" resolution.)\n" -" :type sampling: float\n" -"\n" -".. staticmethod:: sequential_split(pred, sampling=0.0)\n" -"\n" -" Splits each chain of the current set of chains in a sequential way.\n" -" The points of each chain are processed (with a specified sampling)\n" -" sequentially and each time a user specified condition is verified,\n" -" the chain is split into two chains. The resulting set of chains is a\n" -" partition of the initial chain\n" -"\n" -" :arg pred: The predicate on a point that expresses the splitting\n" -" condition.\n" -" :type pred: :class:`UnaryPredicate0D`\n" -" :arg sampling: The resolution used to sample the chain for the\n" -" predicate evaluation. (The chain is not actually resampled; a\n" -" virtual point only progresses along the curve using this\n" -" resolution.)\n" -" :type sampling: float"); - -static PyObject *Operators_sequential_split(BPy_Operators * /*self*/, PyObject *args, PyObject *kwds) + ".. staticmethod:: sequential_split(starting_pred, stopping_pred, sampling=0.0)\n" + "\n" + " Splits each chain of the current set of chains in a sequential way.\n" + " The points of each chain are processed (with a specified sampling)\n" + " sequentially. Each time a user specified starting condition is\n" + " verified, a new chain begins and ends as soon as a user-defined\n" + " stopping predicate is verified. This allows chains overlapping rather\n" + " than chains partitioning. The first point of the initial chain is the\n" + " first point of one of the resulting chains. The splitting ends when\n" + " no more chain can start.\n" + "\n" + " :arg starting_pred: The predicate on a point that expresses the\n" + " starting condition.\n" + " :type starting_pred: :class:`UnaryPredicate0D`\n" + " :arg stopping_pred: The predicate on a point that expresses the\n" + " stopping condition.\n" + " :type stopping_pred: :class:`UnaryPredicate0D`\n" + " :arg sampling: The resolution used to sample the chain for the\n" + " predicates evaluation. (The chain is not actually resampled;\n" + " a virtual point only progresses along the curve using this\n" + " resolution.)\n" + " :type sampling: float\n" + "\n" + ".. staticmethod:: sequential_split(pred, sampling=0.0)\n" + "\n" + " Splits each chain of the current set of chains in a sequential way.\n" + " The points of each chain are processed (with a specified sampling)\n" + " sequentially and each time a user specified condition is verified,\n" + " the chain is split into two chains. The resulting set of chains is a\n" + " partition of the initial chain\n" + "\n" + " :arg pred: The predicate on a point that expresses the splitting\n" + " condition.\n" + " :type pred: :class:`UnaryPredicate0D`\n" + " :arg sampling: The resolution used to sample the chain for the\n" + " predicate evaluation. (The chain is not actually resampled; a\n" + " virtual point only progresses along the curve using this\n" + " resolution.)\n" + " :type sampling: float"); + +static PyObject *Operators_sequential_split(BPy_Operators * /*self*/, + PyObject *args, + PyObject *kwds) { - static const char *kwlist_1[] = {"starting_pred", "stopping_pred", "sampling", NULL}; - static const char *kwlist_2[] = {"pred", "sampling", NULL}; - PyObject *obj1 = 0, *obj2 = 0; - float f = 0.0f; - - if (PyArg_ParseTupleAndKeywords(args, kwds, "O!O!|f", (char **)kwlist_1, - &UnaryPredicate0D_Type, &obj1, &UnaryPredicate0D_Type, &obj2, &f)) - { - if (!((BPy_UnaryPredicate0D *)obj1)->up0D) { - PyErr_SetString(PyExc_TypeError, - "Operators.sequential_split(): 1st argument: invalid UnaryPredicate0D object"); - return NULL; - } - if (!((BPy_UnaryPredicate0D *)obj2)->up0D) { - PyErr_SetString(PyExc_TypeError, - "Operators.sequential_split(): 2nd argument: invalid UnaryPredicate0D object"); - return NULL; - } - if (Operators::sequentialSplit(*(((BPy_UnaryPredicate0D *)obj1)->up0D), - *(((BPy_UnaryPredicate0D *)obj2)->up0D), - f) < 0) - { - if (!PyErr_Occurred()) - PyErr_SetString(PyExc_RuntimeError, "Operators.sequential_split() failed"); - return NULL; - } - } - else if (PyErr_Clear(), (f = 0.0f), - PyArg_ParseTupleAndKeywords(args, kwds, "O!|f", (char **)kwlist_2, - &UnaryPredicate0D_Type, &obj1, &f)) - { - if (!((BPy_UnaryPredicate0D *)obj1)->up0D) { - PyErr_SetString(PyExc_TypeError, - "Operators.sequential_split(): 1st argument: invalid UnaryPredicate0D object"); - return NULL; - } - if (Operators::sequentialSplit(*(((BPy_UnaryPredicate0D *)obj1)->up0D), f) < 0) { - if (!PyErr_Occurred()) - PyErr_SetString(PyExc_RuntimeError, "Operators.sequential_split() failed"); - return NULL; - } - } - else { - PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); - return NULL; - } - Py_RETURN_NONE; + static const char *kwlist_1[] = {"starting_pred", "stopping_pred", "sampling", NULL}; + static const char *kwlist_2[] = {"pred", "sampling", NULL}; + PyObject *obj1 = 0, *obj2 = 0; + float f = 0.0f; + + if (PyArg_ParseTupleAndKeywords(args, + kwds, + "O!O!|f", + (char **)kwlist_1, + &UnaryPredicate0D_Type, + &obj1, + &UnaryPredicate0D_Type, + &obj2, + &f)) { + if (!((BPy_UnaryPredicate0D *)obj1)->up0D) { + PyErr_SetString( + PyExc_TypeError, + "Operators.sequential_split(): 1st argument: invalid UnaryPredicate0D object"); + return NULL; + } + if (!((BPy_UnaryPredicate0D *)obj2)->up0D) { + PyErr_SetString( + PyExc_TypeError, + "Operators.sequential_split(): 2nd argument: invalid UnaryPredicate0D object"); + return NULL; + } + if (Operators::sequentialSplit(*(((BPy_UnaryPredicate0D *)obj1)->up0D), + *(((BPy_UnaryPredicate0D *)obj2)->up0D), + f) < 0) { + if (!PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "Operators.sequential_split() failed"); + return NULL; + } + } + else if (PyErr_Clear(), + (f = 0.0f), + PyArg_ParseTupleAndKeywords( + args, kwds, "O!|f", (char **)kwlist_2, &UnaryPredicate0D_Type, &obj1, &f)) { + if (!((BPy_UnaryPredicate0D *)obj1)->up0D) { + PyErr_SetString( + PyExc_TypeError, + "Operators.sequential_split(): 1st argument: invalid UnaryPredicate0D object"); + return NULL; + } + if (Operators::sequentialSplit(*(((BPy_UnaryPredicate0D *)obj1)->up0D), f) < 0) { + if (!PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "Operators.sequential_split() failed"); + return NULL; + } + } + else { + PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); + return NULL; + } + Py_RETURN_NONE; } PyDoc_STRVAR(Operators_recursive_split_doc, -".. staticmethod:: recursive_split(func, pred_1d, sampling=0.0)\n" -"\n" -" Splits the current set of chains in a recursive way. We process the\n" -" points of each chain (with a specified sampling) to find the point\n" -" minimizing a specified function. The chain is split in two at this\n" -" point and the two new chains are processed in the same way. The\n" -" recursivity level is controlled through a predicate 1D that expresses\n" -" a stopping condition on the chain that is about to be processed.\n" -"\n" -" :arg func: The Unary Function evaluated at each point of the chain.\n" -" The splitting point is the point minimizing this function.\n" -" :type func: :class:`UnaryFunction0DDouble`\n" -" :arg pred_1d: The Unary Predicate expressing the recursivity stopping\n" -" condition. This predicate is evaluated for each curve before it\n" -" actually gets split. If pred_1d(chain) is true, the curve won't be\n" -" split anymore.\n" -" :type pred_1d: :class:`UnaryPredicate1D`\n" -" :arg sampling: The resolution used to sample the chain for the\n" -" predicates evaluation. (The chain is not actually resampled, a\n" -" virtual point only progresses along the curve using this\n" -" resolution.)\n" -" :type sampling: float\n" -"\n" -".. staticmethod:: recursive_split(func, pred_0d, pred_1d, sampling=0.0)\n" -"\n" -" Splits the current set of chains in a recursive way. We process the\n" -" points of each chain (with a specified sampling) to find the point\n" -" minimizing a specified function. The chain is split in two at this\n" -" point and the two new chains are processed in the same way. The user\n" -" can specify a 0D predicate to make a first selection on the points\n" -" that can potentially be split. A point that doesn't verify the 0D\n" -" predicate won't be candidate in realizing the min. The recursivity\n" -" level is controlled through a predicate 1D that expresses a stopping\n" -" condition on the chain that is about to be processed.\n" -"\n" -" :arg func: The Unary Function evaluated at each point of the chain.\n" -" The splitting point is the point minimizing this function.\n" -" :type func: :class:`UnaryFunction0DDouble`\n" -" :arg pred_0d: The Unary Predicate 0D used to select the candidate\n" -" points where the split can occur. For example, it is very likely\n" -" that would rather have your chain splitting around its middle\n" -" point than around one of its extremities. A 0D predicate working\n" -" on the curvilinear abscissa allows to add this kind of constraints.\n" -" :type pred_0d: :class:`UnaryPredicate0D`\n" -" :arg pred_1d: The Unary Predicate expressing the recursivity stopping\n" -" condition. This predicate is evaluated for each curve before it\n" -" actually gets split. If pred_1d(chain) is true, the curve won't be\n" -" split anymore.\n" -" :type pred_1d: :class:`UnaryPredicate1D`\n" -" :arg sampling: The resolution used to sample the chain for the\n" -" predicates evaluation. (The chain is not actually resampled; a\n" -" virtual point only progresses along the curve using this\n" -" resolution.)\n" -" :type sampling: float"); - -static PyObject *Operators_recursive_split(BPy_Operators * /*self*/, PyObject *args, PyObject *kwds) + ".. staticmethod:: recursive_split(func, pred_1d, sampling=0.0)\n" + "\n" + " Splits the current set of chains in a recursive way. We process the\n" + " points of each chain (with a specified sampling) to find the point\n" + " minimizing a specified function. The chain is split in two at this\n" + " point and the two new chains are processed in the same way. The\n" + " recursivity level is controlled through a predicate 1D that expresses\n" + " a stopping condition on the chain that is about to be processed.\n" + "\n" + " :arg func: The Unary Function evaluated at each point of the chain.\n" + " The splitting point is the point minimizing this function.\n" + " :type func: :class:`UnaryFunction0DDouble`\n" + " :arg pred_1d: The Unary Predicate expressing the recursivity stopping\n" + " condition. This predicate is evaluated for each curve before it\n" + " actually gets split. If pred_1d(chain) is true, the curve won't be\n" + " split anymore.\n" + " :type pred_1d: :class:`UnaryPredicate1D`\n" + " :arg sampling: The resolution used to sample the chain for the\n" + " predicates evaluation. (The chain is not actually resampled, a\n" + " virtual point only progresses along the curve using this\n" + " resolution.)\n" + " :type sampling: float\n" + "\n" + ".. staticmethod:: recursive_split(func, pred_0d, pred_1d, sampling=0.0)\n" + "\n" + " Splits the current set of chains in a recursive way. We process the\n" + " points of each chain (with a specified sampling) to find the point\n" + " minimizing a specified function. The chain is split in two at this\n" + " point and the two new chains are processed in the same way. The user\n" + " can specify a 0D predicate to make a first selection on the points\n" + " that can potentially be split. A point that doesn't verify the 0D\n" + " predicate won't be candidate in realizing the min. The recursivity\n" + " level is controlled through a predicate 1D that expresses a stopping\n" + " condition on the chain that is about to be processed.\n" + "\n" + " :arg func: The Unary Function evaluated at each point of the chain.\n" + " The splitting point is the point minimizing this function.\n" + " :type func: :class:`UnaryFunction0DDouble`\n" + " :arg pred_0d: The Unary Predicate 0D used to select the candidate\n" + " points where the split can occur. For example, it is very likely\n" + " that would rather have your chain splitting around its middle\n" + " point than around one of its extremities. A 0D predicate working\n" + " on the curvilinear abscissa allows to add this kind of constraints.\n" + " :type pred_0d: :class:`UnaryPredicate0D`\n" + " :arg pred_1d: The Unary Predicate expressing the recursivity stopping\n" + " condition. This predicate is evaluated for each curve before it\n" + " actually gets split. If pred_1d(chain) is true, the curve won't be\n" + " split anymore.\n" + " :type pred_1d: :class:`UnaryPredicate1D`\n" + " :arg sampling: The resolution used to sample the chain for the\n" + " predicates evaluation. (The chain is not actually resampled; a\n" + " virtual point only progresses along the curve using this\n" + " resolution.)\n" + " :type sampling: float"); + +static PyObject *Operators_recursive_split(BPy_Operators * /*self*/, + PyObject *args, + PyObject *kwds) { - static const char *kwlist_1[] = {"func", "pred_1d", "sampling", NULL}; - static const char *kwlist_2[] = {"func", "pred_0d", "pred_1d", "sampling", NULL}; - PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0; - float f = 0.0f; - - if (PyArg_ParseTupleAndKeywords(args, kwds, "O!O!|f", (char **)kwlist_1, - &UnaryFunction0DDouble_Type, &obj1, &UnaryPredicate1D_Type, &obj2, &f)) - { - if (!((BPy_UnaryFunction0DDouble *)obj1)->uf0D_double) { - PyErr_SetString(PyExc_TypeError, - "Operators.recursive_split(): 1st argument: invalid UnaryFunction0DDouble object"); - return NULL; - } - if (!((BPy_UnaryPredicate1D *)obj2)->up1D) { - PyErr_SetString(PyExc_TypeError, - "Operators.recursive_split(): 2nd argument: invalid UnaryPredicate1D object"); - return NULL; - } - if (Operators::recursiveSplit(*(((BPy_UnaryFunction0DDouble *)obj1)->uf0D_double), - *(((BPy_UnaryPredicate1D *)obj2)->up1D), - f) < 0) - { - if (!PyErr_Occurred()) - PyErr_SetString(PyExc_RuntimeError, "Operators.recursive_split() failed"); - return NULL; - } - } - else if (PyErr_Clear(), (f = 0.0f), - PyArg_ParseTupleAndKeywords(args, kwds, "O!O!O!|f", (char **)kwlist_2, - &UnaryFunction0DDouble_Type, &obj1, &UnaryPredicate0D_Type, &obj2, - &UnaryPredicate1D_Type, &obj3, &f)) - { - if (!((BPy_UnaryFunction0DDouble *)obj1)->uf0D_double) { - PyErr_SetString(PyExc_TypeError, - "Operators.recursive_split(): 1st argument: invalid UnaryFunction0DDouble object"); - return NULL; - } - if (!((BPy_UnaryPredicate0D *)obj2)->up0D) { - PyErr_SetString(PyExc_TypeError, - "Operators.recursive_split(): 2nd argument: invalid UnaryPredicate0D object"); - return NULL; - } - if (!((BPy_UnaryPredicate1D *)obj3)->up1D) { - PyErr_SetString(PyExc_TypeError, - "Operators.recursive_split(): 3rd argument: invalid UnaryPredicate1D object"); - return NULL; - } - if (Operators::recursiveSplit(*(((BPy_UnaryFunction0DDouble *)obj1)->uf0D_double), - *(((BPy_UnaryPredicate0D *)obj2)->up0D), - *(((BPy_UnaryPredicate1D *)obj3)->up1D), - f) < 0) - { - if (!PyErr_Occurred()) - PyErr_SetString(PyExc_RuntimeError, "Operators.recursive_split() failed"); - return NULL; - } - } - else { - PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); - return NULL; - } - Py_RETURN_NONE; + static const char *kwlist_1[] = {"func", "pred_1d", "sampling", NULL}; + static const char *kwlist_2[] = {"func", "pred_0d", "pred_1d", "sampling", NULL}; + PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0; + float f = 0.0f; + + if (PyArg_ParseTupleAndKeywords(args, + kwds, + "O!O!|f", + (char **)kwlist_1, + &UnaryFunction0DDouble_Type, + &obj1, + &UnaryPredicate1D_Type, + &obj2, + &f)) { + if (!((BPy_UnaryFunction0DDouble *)obj1)->uf0D_double) { + PyErr_SetString( + PyExc_TypeError, + "Operators.recursive_split(): 1st argument: invalid UnaryFunction0DDouble object"); + return NULL; + } + if (!((BPy_UnaryPredicate1D *)obj2)->up1D) { + PyErr_SetString( + PyExc_TypeError, + "Operators.recursive_split(): 2nd argument: invalid UnaryPredicate1D object"); + return NULL; + } + if (Operators::recursiveSplit(*(((BPy_UnaryFunction0DDouble *)obj1)->uf0D_double), + *(((BPy_UnaryPredicate1D *)obj2)->up1D), + f) < 0) { + if (!PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "Operators.recursive_split() failed"); + return NULL; + } + } + else if (PyErr_Clear(), + (f = 0.0f), + PyArg_ParseTupleAndKeywords(args, + kwds, + "O!O!O!|f", + (char **)kwlist_2, + &UnaryFunction0DDouble_Type, + &obj1, + &UnaryPredicate0D_Type, + &obj2, + &UnaryPredicate1D_Type, + &obj3, + &f)) { + if (!((BPy_UnaryFunction0DDouble *)obj1)->uf0D_double) { + PyErr_SetString( + PyExc_TypeError, + "Operators.recursive_split(): 1st argument: invalid UnaryFunction0DDouble object"); + return NULL; + } + if (!((BPy_UnaryPredicate0D *)obj2)->up0D) { + PyErr_SetString( + PyExc_TypeError, + "Operators.recursive_split(): 2nd argument: invalid UnaryPredicate0D object"); + return NULL; + } + if (!((BPy_UnaryPredicate1D *)obj3)->up1D) { + PyErr_SetString( + PyExc_TypeError, + "Operators.recursive_split(): 3rd argument: invalid UnaryPredicate1D object"); + return NULL; + } + if (Operators::recursiveSplit(*(((BPy_UnaryFunction0DDouble *)obj1)->uf0D_double), + *(((BPy_UnaryPredicate0D *)obj2)->up0D), + *(((BPy_UnaryPredicate1D *)obj3)->up1D), + f) < 0) { + if (!PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "Operators.recursive_split() failed"); + return NULL; + } + } + else { + PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); + return NULL; + } + Py_RETURN_NONE; } PyDoc_STRVAR(Operators_sort_doc, -".. staticmethod:: sort(pred)\n" -"\n" -" Sorts the current set of chains (or viewedges) according to the\n" -" comparison predicate given as argument.\n" -"\n" -" :arg pred: The binary predicate used for the comparison.\n" -" :type pred: :class:`BinaryPredicate1D`"); + ".. staticmethod:: sort(pred)\n" + "\n" + " Sorts the current set of chains (or viewedges) according to the\n" + " comparison predicate given as argument.\n" + "\n" + " :arg pred: The binary predicate used for the comparison.\n" + " :type pred: :class:`BinaryPredicate1D`"); static PyObject *Operators_sort(BPy_Operators * /*self*/, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"pred", NULL}; - PyObject *obj = 0; - - if (!PyArg_ParseTupleAndKeywords(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()) - PyErr_SetString(PyExc_RuntimeError, "Operators.sort() failed"); - return NULL; - } - Py_RETURN_NONE; + static const char *kwlist[] = {"pred", NULL}; + PyObject *obj = 0; + + if (!PyArg_ParseTupleAndKeywords( + 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()) + PyErr_SetString(PyExc_RuntimeError, "Operators.sort() failed"); + return NULL; + } + Py_RETURN_NONE; } PyDoc_STRVAR(Operators_create_doc, -".. staticmethod:: create(pred, shaders)\n" -"\n" -" Creates and shades the strokes from the current set of chains. A\n" -" predicate can be specified to make a selection pass on the chains.\n" -"\n" -" :arg pred: The predicate that a chain must verify in order to be\n" -" transform as a stroke.\n" -" :type pred: :class:`UnaryPredicate1D`\n" -" :arg shaders: The list of shaders used to shade the strokes.\n" -" :type shaders: list of :class:`StrokeShader` objects"); + ".. staticmethod:: create(pred, shaders)\n" + "\n" + " Creates and shades the strokes from the current set of chains. A\n" + " predicate can be specified to make a selection pass on the chains.\n" + "\n" + " :arg pred: The predicate that a chain must verify in order to be\n" + " transform as a stroke.\n" + " :type pred: :class:`UnaryPredicate1D`\n" + " :arg shaders: The list of shaders used to shade the strokes.\n" + " :type shaders: list of :class:`StrokeShader` objects"); static PyObject *Operators_create(BPy_Operators * /*self*/, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"pred", "shaders", NULL}; - PyObject *obj1 = 0, *obj2 = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O!", (char **)kwlist, - &UnaryPredicate1D_Type, &obj1, &PyList_Type, &obj2)) - { - return NULL; - } - if (!((BPy_UnaryPredicate1D *)obj1)->up1D) { - PyErr_SetString(PyExc_TypeError, "Operators.create(): 1st argument: invalid UnaryPredicate1D object"); - return NULL; - } - vector shaders; - shaders.reserve(PyList_Size(obj2)); - for (int i = 0; i < PyList_Size(obj2); i++) { - PyObject *py_ss = PyList_GET_ITEM(obj2, i); - if (!BPy_StrokeShader_Check(py_ss)) { - PyErr_SetString(PyExc_TypeError, "Operators.create(): 2nd argument must be a list of StrokeShader objects"); - return NULL; - } - StrokeShader *shader = ((BPy_StrokeShader *)py_ss)->ss; - if (!shader) { - stringstream ss; - ss << "Operators.create(): item " << (i + 1) - << " of the shaders list is invalid likely due to missing call of StrokeShader.__init__()"; - PyErr_SetString(PyExc_TypeError, ss.str().c_str()); - return NULL; - } - shaders.push_back(shader); - } - if (Operators::create(*(((BPy_UnaryPredicate1D *)obj1)->up1D), shaders) < 0) { - if (!PyErr_Occurred()) - PyErr_SetString(PyExc_RuntimeError, "Operators.create() failed"); - return NULL; - } - Py_RETURN_NONE; + static const char *kwlist[] = {"pred", "shaders", NULL}; + PyObject *obj1 = 0, *obj2 = 0; + + if (!PyArg_ParseTupleAndKeywords(args, + kwds, + "O!O!", + (char **)kwlist, + &UnaryPredicate1D_Type, + &obj1, + &PyList_Type, + &obj2)) { + return NULL; + } + if (!((BPy_UnaryPredicate1D *)obj1)->up1D) { + PyErr_SetString(PyExc_TypeError, + "Operators.create(): 1st argument: invalid UnaryPredicate1D object"); + return NULL; + } + vector shaders; + shaders.reserve(PyList_Size(obj2)); + for (int i = 0; i < PyList_Size(obj2); i++) { + PyObject *py_ss = PyList_GET_ITEM(obj2, i); + if (!BPy_StrokeShader_Check(py_ss)) { + PyErr_SetString(PyExc_TypeError, + "Operators.create(): 2nd argument must be a list of StrokeShader objects"); + return NULL; + } + StrokeShader *shader = ((BPy_StrokeShader *)py_ss)->ss; + if (!shader) { + stringstream ss; + ss << "Operators.create(): item " << (i + 1) + << " of the shaders list is invalid likely due to missing call of " + "StrokeShader.__init__()"; + PyErr_SetString(PyExc_TypeError, ss.str().c_str()); + return NULL; + } + shaders.push_back(shader); + } + if (Operators::create(*(((BPy_UnaryPredicate1D *)obj1)->up1D), shaders) < 0) { + if (!PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "Operators.create() failed"); + return NULL; + } + Py_RETURN_NONE; } PyDoc_STRVAR(Operators_reset_doc, -".. staticmethod:: reset(delete_strokes=True)\n" -"\n" -" Resets the line stylization process to the initial state. The results of\n" -" stroke creation are accumulated if **delete_strokes** is set to False.\n" -"\n" -" :arg delete_strokes: Delete the strokes that are currently stored.\n" -" :type delete_strokes: bool\n"); + ".. staticmethod:: reset(delete_strokes=True)\n" + "\n" + " Resets the line stylization process to the initial state. The results of\n" + " stroke creation are accumulated if **delete_strokes** is set to False.\n" + "\n" + " :arg delete_strokes: Delete the strokes that are currently stored.\n" + " :type delete_strokes: bool\n"); static PyObject *Operators_reset(BPy_Operators * /*self*/, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"delete_strokes", NULL}; - PyObject *obj1 = 0; - if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &PyBool_Type, &obj1)) { - // true is the default - Operators::reset(obj1 ? bool_from_PyBool(obj1) : true); - } - else { - PyErr_SetString(PyExc_RuntimeError, "Operators.reset() failed"); - return NULL; - } - Py_RETURN_NONE; + static const char *kwlist[] = {"delete_strokes", NULL}; + PyObject *obj1 = 0; + if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &PyBool_Type, &obj1)) { + // true is the default + Operators::reset(obj1 ? bool_from_PyBool(obj1) : true); + } + else { + PyErr_SetString(PyExc_RuntimeError, "Operators.reset() failed"); + return NULL; + } + Py_RETURN_NONE; } PyDoc_STRVAR(Operators_get_viewedge_from_index_doc, -".. staticmethod:: get_viewedge_from_index(i)\n" -"\n" -" Returns the ViewEdge at the index in the current set of ViewEdges.\n" -"\n" -" :arg i: index (0 <= i < Operators.get_view_edges_size()).\n" -" :type i: int\n" -" :return: The ViewEdge object.\n" -" :rtype: :class:`ViewEdge`"); - -static PyObject *Operators_get_viewedge_from_index(BPy_Operators * /*self*/, PyObject *args, PyObject *kwds) + ".. staticmethod:: get_viewedge_from_index(i)\n" + "\n" + " Returns the ViewEdge at the index in the current set of ViewEdges.\n" + "\n" + " :arg i: index (0 <= i < Operators.get_view_edges_size()).\n" + " :type i: int\n" + " :return: The ViewEdge object.\n" + " :rtype: :class:`ViewEdge`"); + +static PyObject *Operators_get_viewedge_from_index(BPy_Operators * /*self*/, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"i", NULL}; - unsigned int 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; - } - return BPy_ViewEdge_from_ViewEdge(*(Operators::getViewEdgeFromIndex(i))); + static const char *kwlist[] = {"i", NULL}; + unsigned int 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; + } + return BPy_ViewEdge_from_ViewEdge(*(Operators::getViewEdgeFromIndex(i))); } PyDoc_STRVAR(Operators_get_chain_from_index_doc, -".. staticmethod:: get_chain_from_index(i)\n" -"\n" -" Returns the Chain at the index in the current set of Chains.\n" -"\n" -" :arg i: index (0 <= i < Operators.get_chains_size()).\n" -" :type i: int\n" -" :return: The Chain object.\n" -" :rtype: :class:`Chain`"); - -static PyObject *Operators_get_chain_from_index(BPy_Operators * /*self*/, PyObject *args, PyObject *kwds) + ".. staticmethod:: get_chain_from_index(i)\n" + "\n" + " Returns the Chain at the index in the current set of Chains.\n" + "\n" + " :arg i: index (0 <= i < Operators.get_chains_size()).\n" + " :type i: int\n" + " :return: The Chain object.\n" + " :rtype: :class:`Chain`"); + +static PyObject *Operators_get_chain_from_index(BPy_Operators * /*self*/, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"i", NULL}; - unsigned int 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; - } - return BPy_Chain_from_Chain(*(Operators::getChainFromIndex(i))); + static const char *kwlist[] = {"i", NULL}; + unsigned int 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; + } + return BPy_Chain_from_Chain(*(Operators::getChainFromIndex(i))); } PyDoc_STRVAR(Operators_get_stroke_from_index_doc, -".. staticmethod:: get_stroke_from_index(i)\n" -"\n" -" Returns the Stroke at the index in the current set of Strokes.\n" -"\n" -" :arg i: index (0 <= i < Operators.get_strokes_size()).\n" -" :type i: int\n" -" :return: The Stroke object.\n" -" :rtype: :class:`Stroke`"); - -static PyObject *Operators_get_stroke_from_index(BPy_Operators * /*self*/, PyObject *args, PyObject *kwds) + ".. staticmethod:: get_stroke_from_index(i)\n" + "\n" + " Returns the Stroke at the index in the current set of Strokes.\n" + "\n" + " :arg i: index (0 <= i < Operators.get_strokes_size()).\n" + " :type i: int\n" + " :return: The Stroke object.\n" + " :rtype: :class:`Stroke`"); + +static PyObject *Operators_get_stroke_from_index(BPy_Operators * /*self*/, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"i", NULL}; - unsigned int 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; - } - return BPy_Stroke_from_Stroke(*(Operators::getStrokeFromIndex(i))); + static const char *kwlist[] = {"i", NULL}; + unsigned int 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; + } + return BPy_Stroke_from_Stroke(*(Operators::getStrokeFromIndex(i))); } PyDoc_STRVAR(Operators_get_view_edges_size_doc, -".. staticmethod:: get_view_edges_size()\n" -"\n" -" Returns the number of ViewEdges.\n" -"\n" -" :return: The number of ViewEdges.\n" -" :rtype: int"); + ".. staticmethod:: get_view_edges_size()\n" + "\n" + " Returns the number of ViewEdges.\n" + "\n" + " :return: The number of ViewEdges.\n" + " :rtype: int"); static PyObject *Operators_get_view_edges_size(BPy_Operators * /*self*/) { - return PyLong_FromLong(Operators::getViewEdgesSize()); + return PyLong_FromLong(Operators::getViewEdgesSize()); } PyDoc_STRVAR(Operators_get_chains_size_doc, -".. staticmethod:: get_chains_size()\n" -"\n" -" Returns the number of Chains.\n" -"\n" -" :return: The number of Chains.\n" -" :rtype: int"); + ".. staticmethod:: get_chains_size()\n" + "\n" + " Returns the number of Chains.\n" + "\n" + " :return: The number of Chains.\n" + " :rtype: int"); static PyObject *Operators_get_chains_size(BPy_Operators * /*self*/) { - return PyLong_FromLong(Operators::getChainsSize()); + return PyLong_FromLong(Operators::getChainsSize()); } PyDoc_STRVAR(Operators_get_strokes_size_doc, -".. staticmethod:: get_strokes_size()\n" -"\n" -" Returns the number of Strokes.\n" -"\n" -" :return: The number of Strokes.\n" -" :rtype: int"); + ".. staticmethod:: get_strokes_size()\n" + "\n" + " Returns the number of Strokes.\n" + "\n" + " :return: The number of Strokes.\n" + " :rtype: int"); static PyObject *Operators_get_strokes_size(BPy_Operators * /*self*/) { - return PyLong_FromLong(Operators::getStrokesSize()); + return PyLong_FromLong(Operators::getStrokesSize()); } /*----------------------Operators instance definitions ----------------------------*/ static PyMethodDef BPy_Operators_methods[] = { - {"select", (PyCFunction) Operators_select, METH_VARARGS | METH_KEYWORDS | METH_STATIC, Operators_select_doc}, - {"chain", (PyCFunction) Operators_chain, METH_VARARGS | METH_KEYWORDS | METH_STATIC, Operators_chain_doc}, - {"bidirectional_chain", (PyCFunction) Operators_bidirectional_chain, METH_VARARGS | METH_KEYWORDS | METH_STATIC, - Operators_bidirectional_chain_doc}, - {"sequential_split", (PyCFunction) Operators_sequential_split, METH_VARARGS | METH_KEYWORDS | METH_STATIC, - Operators_sequential_split_doc}, - {"recursive_split", (PyCFunction) Operators_recursive_split, METH_VARARGS | METH_KEYWORDS | METH_STATIC, - Operators_recursive_split_doc}, - {"sort", (PyCFunction) Operators_sort, METH_VARARGS | METH_KEYWORDS | METH_STATIC, Operators_sort_doc}, - {"create", (PyCFunction) Operators_create, METH_VARARGS | METH_KEYWORDS | METH_STATIC, Operators_create_doc}, - {"reset", (PyCFunction) Operators_reset, METH_VARARGS | METH_KEYWORDS | METH_STATIC, Operators_reset_doc}, - {"get_viewedge_from_index", (PyCFunction) Operators_get_viewedge_from_index, - METH_VARARGS | METH_KEYWORDS | METH_STATIC, Operators_get_viewedge_from_index_doc}, - {"get_chain_from_index", (PyCFunction) Operators_get_chain_from_index, METH_VARARGS | METH_KEYWORDS | METH_STATIC, - Operators_get_chain_from_index_doc}, - {"get_stroke_from_index", (PyCFunction) Operators_get_stroke_from_index, METH_VARARGS | METH_KEYWORDS | METH_STATIC, - Operators_get_stroke_from_index_doc}, - {"get_view_edges_size", (PyCFunction) Operators_get_view_edges_size, METH_NOARGS | METH_STATIC, - Operators_get_view_edges_size_doc}, - {"get_chains_size", (PyCFunction) Operators_get_chains_size, METH_NOARGS | METH_STATIC, - Operators_get_chains_size_doc}, - {"get_strokes_size", (PyCFunction) Operators_get_strokes_size, METH_NOARGS | METH_STATIC, - Operators_get_strokes_size_doc}, - {NULL, NULL, 0, NULL}, + {"select", + (PyCFunction)Operators_select, + METH_VARARGS | METH_KEYWORDS | METH_STATIC, + Operators_select_doc}, + {"chain", + (PyCFunction)Operators_chain, + METH_VARARGS | METH_KEYWORDS | METH_STATIC, + Operators_chain_doc}, + {"bidirectional_chain", + (PyCFunction)Operators_bidirectional_chain, + METH_VARARGS | METH_KEYWORDS | METH_STATIC, + Operators_bidirectional_chain_doc}, + {"sequential_split", + (PyCFunction)Operators_sequential_split, + METH_VARARGS | METH_KEYWORDS | METH_STATIC, + Operators_sequential_split_doc}, + {"recursive_split", + (PyCFunction)Operators_recursive_split, + METH_VARARGS | METH_KEYWORDS | METH_STATIC, + Operators_recursive_split_doc}, + {"sort", + (PyCFunction)Operators_sort, + METH_VARARGS | METH_KEYWORDS | METH_STATIC, + Operators_sort_doc}, + {"create", + (PyCFunction)Operators_create, + METH_VARARGS | METH_KEYWORDS | METH_STATIC, + Operators_create_doc}, + {"reset", + (PyCFunction)Operators_reset, + METH_VARARGS | METH_KEYWORDS | METH_STATIC, + Operators_reset_doc}, + {"get_viewedge_from_index", + (PyCFunction)Operators_get_viewedge_from_index, + METH_VARARGS | METH_KEYWORDS | METH_STATIC, + Operators_get_viewedge_from_index_doc}, + {"get_chain_from_index", + (PyCFunction)Operators_get_chain_from_index, + METH_VARARGS | METH_KEYWORDS | METH_STATIC, + Operators_get_chain_from_index_doc}, + {"get_stroke_from_index", + (PyCFunction)Operators_get_stroke_from_index, + METH_VARARGS | METH_KEYWORDS | METH_STATIC, + Operators_get_stroke_from_index_doc}, + {"get_view_edges_size", + (PyCFunction)Operators_get_view_edges_size, + METH_NOARGS | METH_STATIC, + Operators_get_view_edges_size_doc}, + {"get_chains_size", + (PyCFunction)Operators_get_chains_size, + METH_NOARGS | METH_STATIC, + Operators_get_chains_size_doc}, + {"get_strokes_size", + (PyCFunction)Operators_get_strokes_size, + METH_NOARGS | METH_STATIC, + Operators_get_strokes_size_doc}, + {NULL, NULL, 0, NULL}, }; /*-----------------------BPy_Operators type definition ------------------------------*/ PyTypeObject Operators_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "Operators", /* tp_name */ - sizeof(BPy_Operators), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)Operators_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - Operators_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_Operators_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "Operators", /* tp_name */ + sizeof(BPy_Operators), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)Operators_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT, /* tp_flags */ + Operators_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_Operators_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_Operators.h b/source/blender/freestyle/intern/python/BPy_Operators.h index 7d91edc6373..15797ca742e 100644 --- a/source/blender/freestyle/intern/python/BPy_Operators.h +++ b/source/blender/freestyle/intern/python/BPy_Operators.h @@ -41,14 +41,13 @@ extern PyTypeObject Operators_Type; /*---------------------------Python BPy_Operators structure definition----------*/ typedef struct { - PyObject_HEAD + PyObject_HEAD } BPy_Operators; /*---------------------------Python BPy_Operators visible prototypes-----------*/ int Operators_Init(PyObject *module); - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/BPy_SShape.cpp b/source/blender/freestyle/intern/python/BPy_SShape.cpp index 024eb61736a..f8930a89a38 100644 --- a/source/blender/freestyle/intern/python/BPy_SShape.cpp +++ b/source/blender/freestyle/intern/python/BPy_SShape.cpp @@ -35,277 +35,291 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int SShape_Init(PyObject *module) { - if (module == NULL) - return -1; + if (module == NULL) + return -1; - if (PyType_Ready(&SShape_Type) < 0) - return -1; - Py_INCREF(&SShape_Type); - PyModule_AddObject(module, "SShape", (PyObject *)&SShape_Type); + if (PyType_Ready(&SShape_Type) < 0) + return -1; + Py_INCREF(&SShape_Type); + PyModule_AddObject(module, "SShape", (PyObject *)&SShape_Type); - return 0; + return 0; } /*----------------------SShape methods ----------------------------*/ PyDoc_STRVAR(SShape_doc, -"Class to define a feature shape. It is the gathering of feature\n" -"elements from an identified input shape.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __init__(brother)\n" -"\n" -" Copy constructor.\n" -"\n" -" :arg brother: An SShape object.\n" -" :type brother: :class:`SShape`"); + "Class to define a feature shape. It is the gathering of feature\n" + "elements from an identified input shape.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __init__(brother)\n" + "\n" + " Copy constructor.\n" + "\n" + " :arg brother: An SShape object.\n" + " :type brother: :class:`SShape`"); 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)) - return -1; - if (!brother) - self->ss = new SShape(); - else - self->ss = new SShape(*(((BPy_SShape *)brother)->ss)); - self->borrowed = false; - return 0; + static const char *kwlist[] = {"brother", NULL}; + PyObject *brother = 0; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &SShape_Type, &brother)) + return -1; + if (!brother) + self->ss = new SShape(); + 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) - delete self->ss; - Py_TYPE(self)->tp_free((PyObject *)self); + if (self->ss && !self->borrowed) + delete self->ss; + Py_TYPE(self)->tp_free((PyObject *)self); } static PyObject *SShape_repr(BPy_SShape *self) { - return PyUnicode_FromFormat("SShape - address: %p", self->ss); + return PyUnicode_FromFormat("SShape - address: %p", self->ss); } static char SShape_add_edge_doc[] = -".. method:: add_edge(edge)\n" -"\n" -" Adds an FEdge to the list of FEdges.\n" -"\n" -" :arg edge: An FEdge object.\n" -" :type edge: :class:`FEdge`\n"; + ".. method:: add_edge(edge)\n" + "\n" + " Adds an FEdge to the list of FEdges.\n" + "\n" + " :arg edge: An FEdge object.\n" + " :type edge: :class:`FEdge`\n"; static PyObject *SShape_add_edge(BPy_SShape *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"edge", NULL}; - PyObject *py_fe = 0; + static const char *kwlist[] = {"edge", NULL}; + PyObject *py_fe = 0; - 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; + 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; } PyDoc_STRVAR(SShape_add_vertex_doc, -".. method:: add_vertex(vertex)\n" -"\n" -" Adds an SVertex to the list of SVertex of this Shape. The SShape\n" -" attribute of the SVertex is also set to this SShape.\n" -"\n" -" :arg vertex: An SVertex object.\n" -" :type vertex: :class:`SVertex`"); + ".. method:: add_vertex(vertex)\n" + "\n" + " Adds an SVertex to the list of SVertex of this Shape. The SShape\n" + " attribute of the SVertex is also set to this SShape.\n" + "\n" + " :arg vertex: An SVertex object.\n" + " :type vertex: :class:`SVertex`"); static PyObject *SShape_add_vertex(BPy_SShape *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"edge", NULL}; - PyObject *py_sv = 0; + static const char *kwlist[] = {"edge", NULL}; + PyObject *py_sv = 0; - 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; + 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; } PyDoc_STRVAR(SShape_compute_bbox_doc, -".. method:: compute_bbox()\n" -"\n" -" Compute the bbox of the SShape."); + ".. method:: compute_bbox()\n" + "\n" + " Compute the bbox of the SShape."); static PyObject *SShape_compute_bbox(BPy_SShape *self) { - self->ss->ComputeBBox(); - Py_RETURN_NONE; + self->ss->ComputeBBox(); + Py_RETURN_NONE; } -// const Material & material (unsigned i) const -// const vector< Material > & materials () const -// void SetMaterials (const vector< Material > &iMaterials) +// const Material & material (unsigned i) const +// const vector< Material > & materials () const +// void SetMaterials (const vector< Material > &iMaterials) static PyMethodDef BPy_SShape_methods[] = { - {"add_edge", (PyCFunction)SShape_add_edge, METH_VARARGS | METH_KEYWORDS, SShape_add_edge_doc}, - {"add_vertex", (PyCFunction)SShape_add_vertex, METH_VARARGS | METH_KEYWORDS, SShape_add_vertex_doc}, - {"compute_bbox", (PyCFunction)SShape_compute_bbox, METH_NOARGS, SShape_compute_bbox_doc}, - {NULL, NULL, 0, NULL}, + {"add_edge", (PyCFunction)SShape_add_edge, METH_VARARGS | METH_KEYWORDS, SShape_add_edge_doc}, + {"add_vertex", + (PyCFunction)SShape_add_vertex, + METH_VARARGS | METH_KEYWORDS, + SShape_add_vertex_doc}, + {"compute_bbox", (PyCFunction)SShape_compute_bbox, METH_NOARGS, SShape_compute_bbox_doc}, + {NULL, NULL, 0, NULL}, }; /*----------------------SShape get/setters ----------------------------*/ PyDoc_STRVAR(SShape_id_doc, -"The Id of this SShape.\n" -"\n" -":type: :class:`Id`"); + "The Id of this SShape.\n" + "\n" + ":type: :class:`Id`"); static PyObject *SShape_id_get(BPy_SShape *self, void *UNUSED(closure)) { - Id id(self->ss->getId()); - return BPy_Id_from_Id(id); // return a copy + Id id(self->ss->getId()); + return BPy_Id_from_Id(id); // return a copy } static int SShape_id_set(BPy_SShape *self, PyObject *value, void *UNUSED(closure)) { - if (!BPy_Id_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be an Id"); - return -1; - } - self->ss->setId(*(((BPy_Id *)value)->id)); - return 0; + if (!BPy_Id_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an Id"); + return -1; + } + self->ss->setId(*(((BPy_Id *)value)->id)); + return 0; } PyDoc_STRVAR(SShape_name_doc, -"The name of the SShape.\n" -"\n" -":type: str"); + "The name of the SShape.\n" + "\n" + ":type: str"); static PyObject *SShape_name_get(BPy_SShape *self, void *UNUSED(closure)) { - return PyUnicode_FromString(self->ss->getName().c_str()); + return PyUnicode_FromString(self->ss->getName().c_str()); } static int SShape_name_set(BPy_SShape *self, PyObject *value, void *UNUSED(closure)) { - if (!PyUnicode_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be a string"); - return -1; - } - const char *name = _PyUnicode_AsString(value); - self->ss->setName(name); - return 0; + if (!PyUnicode_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be a string"); + return -1; + } + const char *name = _PyUnicode_AsString(value); + self->ss->setName(name); + return 0; } PyDoc_STRVAR(SShape_bbox_doc, -"The bounding box of the SShape.\n" -"\n" -":type: :class:`BBox`"); + "The bounding box of the SShape.\n" + "\n" + ":type: :class:`BBox`"); static PyObject *SShape_bbox_get(BPy_SShape *self, void *UNUSED(closure)) { - BBox bb(self->ss->bbox()); - return BPy_BBox_from_BBox(bb); // return a copy + BBox bb(self->ss->bbox()); + return BPy_BBox_from_BBox(bb); // return a copy } static int SShape_bbox_set(BPy_SShape *self, PyObject *value, void *UNUSED(closure)) { - if (!BPy_BBox_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be a BBox"); - return -1; - } - self->ss->setBBox(*(((BPy_BBox *)value)->bb)); - return 0; + if (!BPy_BBox_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be a BBox"); + return -1; + } + self->ss->setBBox(*(((BPy_BBox *)value)->bb)); + return 0; } PyDoc_STRVAR(SShape_vertices_doc, -"The list of vertices constituting this SShape.\n" -"\n" -":type: List of :class:`SVertex` objects"); + "The list of vertices constituting this SShape.\n" + "\n" + ":type: List of :class:`SVertex` objects"); static PyObject *SShape_vertices_get(BPy_SShape *self, void *UNUSED(closure)) { - vector< SVertex * > vertices = self->ss->getVertexList(); - vector< SVertex * >::iterator it; - PyObject *py_vertices = PyList_New(vertices.size()); - unsigned int i = 0; + vector vertices = self->ss->getVertexList(); + vector::iterator it; + PyObject *py_vertices = PyList_New(vertices.size()); + unsigned int i = 0; - for (it = vertices.begin(); it != vertices.end(); it++) { - PyList_SET_ITEM(py_vertices, i++, BPy_SVertex_from_SVertex(*(*it))); - } + for (it = vertices.begin(); it != vertices.end(); it++) { + PyList_SET_ITEM(py_vertices, i++, BPy_SVertex_from_SVertex(*(*it))); + } - return py_vertices; + return py_vertices; } PyDoc_STRVAR(SShape_edges_doc, -"The list of edges constituting this SShape.\n" -"\n" -":type: List of :class:`FEdge` objects"); + "The list of edges constituting this SShape.\n" + "\n" + ":type: List of :class:`FEdge` objects"); static PyObject *SShape_edges_get(BPy_SShape *self, void *UNUSED(closure)) { - vector< FEdge * > edges = self->ss->getEdgeList(); - vector< FEdge * >::iterator it; - PyObject *py_edges = PyList_New(edges.size()); - unsigned int i = 0; + vector edges = self->ss->getEdgeList(); + vector::iterator it; + PyObject *py_edges = PyList_New(edges.size()); + unsigned int i = 0; - for (it = edges.begin(); it != edges.end(); it++) { - PyList_SET_ITEM(py_edges, i++, Any_BPy_FEdge_from_FEdge(*(*it))); - } + for (it = edges.begin(); it != edges.end(); it++) { + PyList_SET_ITEM(py_edges, i++, Any_BPy_FEdge_from_FEdge(*(*it))); + } - return py_edges; + return py_edges; } static PyGetSetDef BPy_SShape_getseters[] = { - {(char *)"id", (getter)SShape_id_get, (setter)SShape_id_set, (char *)SShape_id_doc, NULL}, - {(char *)"name", (getter)SShape_name_get, (setter)SShape_name_set, (char *)SShape_name_doc, NULL}, - {(char *)"bbox", (getter)SShape_bbox_get, (setter)SShape_bbox_set, (char *)SShape_bbox_doc, NULL}, - {(char *)"edges", (getter)SShape_edges_get, (setter)NULL, (char *)SShape_edges_doc, NULL}, - {(char *)"vertices", (getter)SShape_vertices_get, (setter)NULL, (char *)SShape_vertices_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"id", (getter)SShape_id_get, (setter)SShape_id_set, (char *)SShape_id_doc, NULL}, + {(char *)"name", + (getter)SShape_name_get, + (setter)SShape_name_set, + (char *)SShape_name_doc, + NULL}, + {(char *)"bbox", + (getter)SShape_bbox_get, + (setter)SShape_bbox_set, + (char *)SShape_bbox_doc, + NULL}, + {(char *)"edges", (getter)SShape_edges_get, (setter)NULL, (char *)SShape_edges_doc, NULL}, + {(char *)"vertices", + (getter)SShape_vertices_get, + (setter)NULL, + (char *)SShape_vertices_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_SShape type definition ------------------------------*/ PyTypeObject SShape_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SShape", /* tp_name */ - sizeof(BPy_SShape), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)SShape_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)SShape_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - SShape_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_SShape_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_SShape_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)SShape_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "SShape", /* tp_name */ + sizeof(BPy_SShape), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)SShape_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)SShape_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + SShape_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_SShape_methods, /* tp_methods */ + 0, /* tp_members */ + BPy_SShape_getseters, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)SShape_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_SShape.h b/source/blender/freestyle/intern/python/BPy_SShape.h index 270c8cb8317..55ef11b9a0b 100644 --- a/source/blender/freestyle/intern/python/BPy_SShape.h +++ b/source/blender/freestyle/intern/python/BPy_SShape.h @@ -41,9 +41,8 @@ extern PyTypeObject SShape_Type; /*---------------------------Python BPy_SShape structure definition----------*/ typedef struct { - PyObject_HEAD - SShape *ss; - bool borrowed; /* true if *ss is a borrowed object */ + PyObject_HEAD SShape *ss; + bool borrowed; /* true if *ss is a borrowed object */ } BPy_SShape; /*---------------------------Python BPy_SShape visible prototypes-----------*/ diff --git a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp index 65d4ab6ce83..03933fe1915 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp +++ b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp @@ -31,603 +31,680 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int StrokeAttribute_Init(PyObject *module) { - if (module == NULL) - return -1; + if (module == NULL) + return -1; - if (PyType_Ready(&StrokeAttribute_Type) < 0) - return -1; - Py_INCREF(&StrokeAttribute_Type); - PyModule_AddObject(module, "StrokeAttribute", (PyObject *)&StrokeAttribute_Type); + if (PyType_Ready(&StrokeAttribute_Type) < 0) + return -1; + Py_INCREF(&StrokeAttribute_Type); + PyModule_AddObject(module, "StrokeAttribute", (PyObject *)&StrokeAttribute_Type); - StrokeAttribute_mathutils_register_callback(); - return 0; + StrokeAttribute_mathutils_register_callback(); + return 0; } //------------------------INSTANCE METHODS ---------------------------------- PyDoc_STRVAR(StrokeAttribute_doc, -"Class to define a set of attributes associated with a :class:`StrokeVertex`.\n" -"The attribute set stores the color, alpha and thickness values for a Stroke\n" -"Vertex.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __init__(brother)\n" -"\n" -" Copy constructor.\n" -"\n" -" :arg brother: A StrokeAttribute object.\n" -" :type brother: :class:`StrokeAttribute`\n" -"\n" -".. method:: __init__(red, green, blue, alpha, thickness_right, thickness_left)\n" -"\n" -" Build a stroke vertex attribute from a set of parameters.\n" -"\n" -" :arg red: Red component of a stroke color.\n" -" :type red: float\n" -" :arg green: Green component of a stroke color.\n" -" :type green: float\n" -" :arg blue: Blue component of a stroke color.\n" -" :type blue: float\n" -" :arg alpha: Alpha component of a stroke color.\n" -" :type alpha: float\n" -" :arg thickness_right: Stroke thickness on the right.\n" -" :type thickness_right: float\n" -" :arg thickness_left: Stroke thickness on the left.\n" -" :type thickness_left: float\n" -"\n" -".. method:: __init__(attribute1, attribute2, t)\n" -"\n" -" Interpolation constructor. Build a StrokeAttribute from two\n" -" StrokeAttribute objects and an interpolation parameter.\n" -"\n" -" :arg attribute1: The first StrokeAttribute object.\n" -" :type attribute1: :class:`StrokeAttribute`\n" -" :arg attribute2: The second StrokeAttribute object.\n" -" :type attribute2: :class:`StrokeAttribute`\n" -" :arg t: The interpolation parameter (0 <= t <= 1).\n" -" :type t: float\n"); + "Class to define a set of attributes associated with a :class:`StrokeVertex`.\n" + "The attribute set stores the color, alpha and thickness values for a Stroke\n" + "Vertex.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __init__(brother)\n" + "\n" + " Copy constructor.\n" + "\n" + " :arg brother: A StrokeAttribute object.\n" + " :type brother: :class:`StrokeAttribute`\n" + "\n" + ".. method:: __init__(red, green, blue, alpha, thickness_right, thickness_left)\n" + "\n" + " Build a stroke vertex attribute from a set of parameters.\n" + "\n" + " :arg red: Red component of a stroke color.\n" + " :type red: float\n" + " :arg green: Green component of a stroke color.\n" + " :type green: float\n" + " :arg blue: Blue component of a stroke color.\n" + " :type blue: float\n" + " :arg alpha: Alpha component of a stroke color.\n" + " :type alpha: float\n" + " :arg thickness_right: Stroke thickness on the right.\n" + " :type thickness_right: float\n" + " :arg thickness_left: Stroke thickness on the left.\n" + " :type thickness_left: float\n" + "\n" + ".. method:: __init__(attribute1, attribute2, t)\n" + "\n" + " Interpolation constructor. Build a StrokeAttribute from two\n" + " StrokeAttribute objects and an interpolation parameter.\n" + "\n" + " :arg attribute1: The first StrokeAttribute object.\n" + " :type attribute1: :class:`StrokeAttribute`\n" + " :arg attribute2: The second StrokeAttribute object.\n" + " :type attribute2: :class:`StrokeAttribute`\n" + " :arg t: The interpolation parameter (0 <= t <= 1).\n" + " :type t: float\n"); static int StrokeAttribute_init(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"attribute1", "attribute2", "t", NULL}; - static const char *kwlist_3[] = {"red", "green", "blue", "alpha", "thickness_right", "thickness_left", NULL}; - PyObject *obj1 = 0, *obj2 = 0; - float red, green, blue, alpha, thickness_right, thickness_left, t; - - if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &StrokeAttribute_Type, &obj1)) { - if (!obj1) - self->sa = new StrokeAttribute(); - else - self->sa = new StrokeAttribute(*(((BPy_StrokeAttribute *)obj1)->sa)); - } - else if (PyErr_Clear(), - PyArg_ParseTupleAndKeywords(args, kwds, "O!O!f", (char **)kwlist_2, - &StrokeAttribute_Type, &obj1, &StrokeAttribute_Type, &obj2, &t)) - { - self->sa = new StrokeAttribute(*(((BPy_StrokeAttribute *)obj1)->sa), *(((BPy_StrokeAttribute *)obj2)->sa), t); - } - else if (PyErr_Clear(), - PyArg_ParseTupleAndKeywords(args, kwds, "ffffff", (char **)kwlist_3, - &red, &green, &blue, &alpha, &thickness_right, &thickness_left)) - { - self->sa = new StrokeAttribute(red, green, blue, alpha, thickness_right, thickness_left); - } - else { - PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); - return -1; - } - self->borrowed = false; - return 0; + static const char *kwlist_1[] = {"brother", NULL}; + static const char *kwlist_2[] = {"attribute1", "attribute2", "t", NULL}; + static const char *kwlist_3[] = { + "red", "green", "blue", "alpha", "thickness_right", "thickness_left", NULL}; + PyObject *obj1 = 0, *obj2 = 0; + float red, green, blue, alpha, thickness_right, thickness_left, t; + + if (PyArg_ParseTupleAndKeywords( + args, kwds, "|O!", (char **)kwlist_1, &StrokeAttribute_Type, &obj1)) { + if (!obj1) + self->sa = new StrokeAttribute(); + else + self->sa = new StrokeAttribute(*(((BPy_StrokeAttribute *)obj1)->sa)); + } + else if (PyErr_Clear(), + PyArg_ParseTupleAndKeywords(args, + kwds, + "O!O!f", + (char **)kwlist_2, + &StrokeAttribute_Type, + &obj1, + &StrokeAttribute_Type, + &obj2, + &t)) { + self->sa = new StrokeAttribute( + *(((BPy_StrokeAttribute *)obj1)->sa), *(((BPy_StrokeAttribute *)obj2)->sa), t); + } + else if (PyErr_Clear(), + PyArg_ParseTupleAndKeywords(args, + kwds, + "ffffff", + (char **)kwlist_3, + &red, + &green, + &blue, + &alpha, + &thickness_right, + &thickness_left)) { + self->sa = new StrokeAttribute(red, green, blue, alpha, thickness_right, thickness_left); + } + else { + PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); + return -1; + } + self->borrowed = false; + return 0; } static void StrokeAttribute_dealloc(BPy_StrokeAttribute *self) { - if (self->sa && !self->borrowed) - delete self->sa; - Py_TYPE(self)->tp_free((PyObject *)self); + if (self->sa && !self->borrowed) + delete self->sa; + Py_TYPE(self)->tp_free((PyObject *)self); } static PyObject *StrokeAttribute_repr(BPy_StrokeAttribute *self) { - stringstream repr("StrokeAttribute:"); - repr << " r: " << self->sa->getColorR() << " g: " << self->sa->getColorG() << " b: " << self->sa->getColorB() << - " a: " << self->sa->getAlpha() << - " - R: " << self->sa->getThicknessR() << " L: " << self->sa->getThicknessL(); + stringstream repr("StrokeAttribute:"); + repr << " r: " << self->sa->getColorR() << " g: " << self->sa->getColorG() + << " b: " << self->sa->getColorB() << " a: " << self->sa->getAlpha() + << " - R: " << self->sa->getThicknessR() << " L: " << self->sa->getThicknessL(); - return PyUnicode_FromString(repr.str().c_str()); + return PyUnicode_FromString(repr.str().c_str()); } PyDoc_STRVAR(StrokeAttribute_get_attribute_real_doc, -".. method:: get_attribute_real(name)\n" -"\n" -" Returns an attribute of float type.\n" -"\n" -" :arg name: The name of the attribute.\n" -" :type name: str\n" -" :return: The attribute value.\n" -" :rtype: float\n"); - -static PyObject *StrokeAttribute_get_attribute_real(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds) + ".. method:: get_attribute_real(name)\n" + "\n" + " Returns an attribute of float type.\n" + "\n" + " :arg name: The name of the attribute.\n" + " :type name: str\n" + " :return: The attribute value.\n" + " :rtype: float\n"); + +static PyObject *StrokeAttribute_get_attribute_real(BPy_StrokeAttribute *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"name", NULL}; - char *attr; + static const char *kwlist[] = {"name", NULL}; + char *attr; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) - return NULL; - double a = self->sa->getAttributeReal(attr); - return PyFloat_FromDouble(a); + if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) + return NULL; + double a = self->sa->getAttributeReal(attr); + return PyFloat_FromDouble(a); } PyDoc_STRVAR(StrokeAttribute_get_attribute_vec2_doc, -".. method:: get_attribute_vec2(name)\n" -"\n" -" Returns an attribute of two-dimensional vector type.\n" -"\n" -" :arg name: The name of the attribute.\n" -" :type name: str\n" -" :return: The attribute value.\n" -" :rtype: :class:`mathutils.Vector`\n"); - -static PyObject *StrokeAttribute_get_attribute_vec2(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds) + ".. method:: get_attribute_vec2(name)\n" + "\n" + " Returns an attribute of two-dimensional vector type.\n" + "\n" + " :arg name: The name of the attribute.\n" + " :type name: str\n" + " :return: The attribute value.\n" + " :rtype: :class:`mathutils.Vector`\n"); + +static PyObject *StrokeAttribute_get_attribute_vec2(BPy_StrokeAttribute *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"name", NULL}; - char *attr; + static const char *kwlist[] = {"name", NULL}; + char *attr; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) - return NULL; - Vec2f a = self->sa->getAttributeVec2f(attr); - return Vector_from_Vec2f(a); + if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) + return NULL; + Vec2f a = self->sa->getAttributeVec2f(attr); + return Vector_from_Vec2f(a); } PyDoc_STRVAR(StrokeAttribute_get_attribute_vec3_doc, -".. method:: get_attribute_vec3(name)\n" -"\n" -" Returns an attribute of three-dimensional vector type.\n" -"\n" -" :arg name: The name of the attribute.\n" -" :type name: str\n" -" :return: The attribute value.\n" -" :rtype: :class:`mathutils.Vector`\n"); - -static PyObject *StrokeAttribute_get_attribute_vec3(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds) + ".. method:: get_attribute_vec3(name)\n" + "\n" + " Returns an attribute of three-dimensional vector type.\n" + "\n" + " :arg name: The name of the attribute.\n" + " :type name: str\n" + " :return: The attribute value.\n" + " :rtype: :class:`mathutils.Vector`\n"); + +static PyObject *StrokeAttribute_get_attribute_vec3(BPy_StrokeAttribute *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"name", NULL}; - char *attr; + static const char *kwlist[] = {"name", NULL}; + char *attr; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) - return NULL; - Vec3f a = self->sa->getAttributeVec3f(attr); - return Vector_from_Vec3f(a); + if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) + return NULL; + Vec3f a = self->sa->getAttributeVec3f(attr); + return Vector_from_Vec3f(a); } PyDoc_STRVAR(StrokeAttribute_has_attribute_real_doc, -".. method:: has_attribute_real(name)\n" -"\n" -" Checks whether the attribute name of float type is available.\n" -"\n" -" :arg name: The name of the attribute.\n" -" :type name: str\n" -" :return: True if the attribute is availbale.\n" -" :rtype: bool\n"); - -static PyObject *StrokeAttribute_has_attribute_real(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds) + ".. method:: has_attribute_real(name)\n" + "\n" + " Checks whether the attribute name of float type is available.\n" + "\n" + " :arg name: The name of the attribute.\n" + " :type name: str\n" + " :return: True if the attribute is availbale.\n" + " :rtype: bool\n"); + +static PyObject *StrokeAttribute_has_attribute_real(BPy_StrokeAttribute *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"name", NULL}; - char *attr; + static const char *kwlist[] = {"name", NULL}; + char *attr; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) - return NULL; - return PyBool_from_bool(self->sa->isAttributeAvailableReal(attr)); + if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) + return NULL; + return PyBool_from_bool(self->sa->isAttributeAvailableReal(attr)); } PyDoc_STRVAR(StrokeAttribute_has_attribute_vec2_doc, -".. method:: has_attribute_vec2(name)\n" -"\n" -" Checks whether the attribute name of two-dimensional vector type\n" -" is available.\n" -"\n" -" :arg name: The name of the attribute.\n" -" :type name: str\n" -" :return: True if the attribute is availbale.\n" -" :rtype: bool\n"); - -static PyObject *StrokeAttribute_has_attribute_vec2(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds) + ".. method:: has_attribute_vec2(name)\n" + "\n" + " Checks whether the attribute name of two-dimensional vector type\n" + " is available.\n" + "\n" + " :arg name: The name of the attribute.\n" + " :type name: str\n" + " :return: True if the attribute is availbale.\n" + " :rtype: bool\n"); + +static PyObject *StrokeAttribute_has_attribute_vec2(BPy_StrokeAttribute *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"name", NULL}; - char *attr; + static const char *kwlist[] = {"name", NULL}; + char *attr; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) - return NULL; - return PyBool_from_bool(self->sa->isAttributeAvailableVec2f(attr)); + if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) + return NULL; + return PyBool_from_bool(self->sa->isAttributeAvailableVec2f(attr)); } PyDoc_STRVAR(StrokeAttribute_has_attribute_vec3_doc, -".. method:: has_attribute_vec3(name)\n" -"\n" -" Checks whether the attribute name of three-dimensional vector\n" -" type is available.\n" -"\n" -" :arg name: The name of the attribute.\n" -" :type name: str\n" -" :return: True if the attribute is availbale.\n" -" :rtype: bool\n"); - -static PyObject *StrokeAttribute_has_attribute_vec3(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds) + ".. method:: has_attribute_vec3(name)\n" + "\n" + " Checks whether the attribute name of three-dimensional vector\n" + " type is available.\n" + "\n" + " :arg name: The name of the attribute.\n" + " :type name: str\n" + " :return: True if the attribute is availbale.\n" + " :rtype: bool\n"); + +static PyObject *StrokeAttribute_has_attribute_vec3(BPy_StrokeAttribute *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"name", NULL}; - char *attr; + static const char *kwlist[] = {"name", NULL}; + char *attr; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) - return NULL; - return PyBool_from_bool(self->sa->isAttributeAvailableVec3f(attr)); + if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &attr)) + return NULL; + return PyBool_from_bool(self->sa->isAttributeAvailableVec3f(attr)); } PyDoc_STRVAR(StrokeAttribute_set_attribute_real_doc, -".. method:: set_attribute_real(name, value)\n" -"\n" -" Adds a user-defined attribute of float type. If there is no\n" -" attribute of the given name, it is added. Otherwise, the new value\n" -" replaces the old one.\n" -"\n" -" :arg name: The name of the attribute.\n" -" :type name: str\n" -" :arg value: The attribute value.\n" -" :type value: float\n"); - -static PyObject *StrokeAttribute_set_attribute_real(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds) + ".. method:: set_attribute_real(name, value)\n" + "\n" + " Adds a user-defined attribute of float type. If there is no\n" + " attribute of the given name, it is added. Otherwise, the new value\n" + " replaces the old one.\n" + "\n" + " :arg name: The name of the attribute.\n" + " :type name: str\n" + " :arg value: The attribute value.\n" + " :type value: float\n"); + +static PyObject *StrokeAttribute_set_attribute_real(BPy_StrokeAttribute *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"name", "value", NULL}; - char *s = 0; - double d = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "sd", (char **)kwlist, &s, &d)) - return NULL; - self->sa->setAttributeReal(s, d); - Py_RETURN_NONE; + static const char *kwlist[] = {"name", "value", NULL}; + char *s = 0; + double d = 0; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "sd", (char **)kwlist, &s, &d)) + return NULL; + self->sa->setAttributeReal(s, d); + Py_RETURN_NONE; } PyDoc_STRVAR(StrokeAttribute_set_attribute_vec2_doc, -".. method:: set_attribute_vec2(name, value)\n" -"\n" -" Adds a user-defined attribute of two-dimensional vector type. If\n" -" there is no attribute of the given name, it is added. Otherwise,\n" -" the new value replaces the old one.\n" -"\n" -" :arg name: The name of the attribute.\n" -" :type name: str\n" -" :arg value: The attribute value.\n" -" :type value: :class:`mathutils.Vector`, list or tuple of 2 real numbers\n"); - -static PyObject *StrokeAttribute_set_attribute_vec2(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds) + ".. method:: set_attribute_vec2(name, value)\n" + "\n" + " Adds a user-defined attribute of two-dimensional vector type. If\n" + " there is no attribute of the given name, it is added. Otherwise,\n" + " the new value replaces the old one.\n" + "\n" + " :arg name: The name of the attribute.\n" + " :type name: str\n" + " :arg value: The attribute value.\n" + " :type value: :class:`mathutils.Vector`, list or tuple of 2 real numbers\n"); + +static PyObject *StrokeAttribute_set_attribute_vec2(BPy_StrokeAttribute *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"name", "value", NULL}; - char *s; - PyObject *obj = 0; - Vec2f vec; - - 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)"); - return NULL; - } - self->sa->setAttributeVec2f(s, vec); - Py_RETURN_NONE; + static const char *kwlist[] = {"name", "value", NULL}; + char *s; + PyObject *obj = 0; + Vec2f vec; + + 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)"); + return NULL; + } + self->sa->setAttributeVec2f(s, vec); + Py_RETURN_NONE; } PyDoc_STRVAR(StrokeAttribute_set_attribute_vec3_doc, -".. method:: set_attribute_vec3(name, value)\n" -"\n" -" Adds a user-defined attribute of three-dimensional vector type.\n" -" If there is no attribute of the given name, it is added.\n" -" Otherwise, the new value replaces the old one.\n" -"\n" -" :arg name: The name of the attribute.\n" -" :type name: str\n" -" :arg value: The attribute value.\n" -" :type value: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n"); - -static PyObject *StrokeAttribute_set_attribute_vec3(BPy_StrokeAttribute *self, PyObject *args, PyObject *kwds) + ".. method:: set_attribute_vec3(name, value)\n" + "\n" + " Adds a user-defined attribute of three-dimensional vector type.\n" + " If there is no attribute of the given name, it is added.\n" + " Otherwise, the new value replaces the old one.\n" + "\n" + " :arg name: The name of the attribute.\n" + " :type name: str\n" + " :arg value: The attribute value.\n" + " :type value: :class:`mathutils.Vector`, list or tuple of 3 real numbers\n"); + +static PyObject *StrokeAttribute_set_attribute_vec3(BPy_StrokeAttribute *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"name", "value", NULL}; - char *s; - PyObject *obj = 0; - Vec3f vec; - - 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)"); - return NULL; - } - self->sa->setAttributeVec3f(s, vec); - Py_RETURN_NONE; + static const char *kwlist[] = {"name", "value", NULL}; + char *s; + PyObject *obj = 0; + Vec3f vec; + + 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)"); + return NULL; + } + self->sa->setAttributeVec3f(s, vec); + Py_RETURN_NONE; } static PyMethodDef BPy_StrokeAttribute_methods[] = { - {"get_attribute_real", (PyCFunction) StrokeAttribute_get_attribute_real, METH_VARARGS | METH_KEYWORDS, - StrokeAttribute_get_attribute_real_doc}, - {"get_attribute_vec2", (PyCFunction) StrokeAttribute_get_attribute_vec2, METH_VARARGS | METH_KEYWORDS, - StrokeAttribute_get_attribute_vec2_doc}, - {"get_attribute_vec3", (PyCFunction) StrokeAttribute_get_attribute_vec3, METH_VARARGS | METH_KEYWORDS, - StrokeAttribute_get_attribute_vec3_doc}, - {"has_attribute_real", (PyCFunction) StrokeAttribute_has_attribute_real, METH_VARARGS | METH_KEYWORDS, - StrokeAttribute_has_attribute_real_doc}, - {"has_attribute_vec2", (PyCFunction) StrokeAttribute_has_attribute_vec2, METH_VARARGS | METH_KEYWORDS, - StrokeAttribute_has_attribute_vec2_doc}, - {"has_attribute_vec3", (PyCFunction) StrokeAttribute_has_attribute_vec3, METH_VARARGS | METH_KEYWORDS, - StrokeAttribute_has_attribute_vec3_doc}, - {"set_attribute_real", (PyCFunction) StrokeAttribute_set_attribute_real, METH_VARARGS | METH_KEYWORDS, - StrokeAttribute_set_attribute_real_doc}, - {"set_attribute_vec2", (PyCFunction) StrokeAttribute_set_attribute_vec2, METH_VARARGS | METH_KEYWORDS, - StrokeAttribute_set_attribute_vec2_doc}, - {"set_attribute_vec3", (PyCFunction) StrokeAttribute_set_attribute_vec3, METH_VARARGS | METH_KEYWORDS, - StrokeAttribute_set_attribute_vec3_doc}, - {NULL, NULL, 0, NULL}, + {"get_attribute_real", + (PyCFunction)StrokeAttribute_get_attribute_real, + METH_VARARGS | METH_KEYWORDS, + StrokeAttribute_get_attribute_real_doc}, + {"get_attribute_vec2", + (PyCFunction)StrokeAttribute_get_attribute_vec2, + METH_VARARGS | METH_KEYWORDS, + StrokeAttribute_get_attribute_vec2_doc}, + {"get_attribute_vec3", + (PyCFunction)StrokeAttribute_get_attribute_vec3, + METH_VARARGS | METH_KEYWORDS, + StrokeAttribute_get_attribute_vec3_doc}, + {"has_attribute_real", + (PyCFunction)StrokeAttribute_has_attribute_real, + METH_VARARGS | METH_KEYWORDS, + StrokeAttribute_has_attribute_real_doc}, + {"has_attribute_vec2", + (PyCFunction)StrokeAttribute_has_attribute_vec2, + METH_VARARGS | METH_KEYWORDS, + StrokeAttribute_has_attribute_vec2_doc}, + {"has_attribute_vec3", + (PyCFunction)StrokeAttribute_has_attribute_vec3, + METH_VARARGS | METH_KEYWORDS, + StrokeAttribute_has_attribute_vec3_doc}, + {"set_attribute_real", + (PyCFunction)StrokeAttribute_set_attribute_real, + METH_VARARGS | METH_KEYWORDS, + StrokeAttribute_set_attribute_real_doc}, + {"set_attribute_vec2", + (PyCFunction)StrokeAttribute_set_attribute_vec2, + METH_VARARGS | METH_KEYWORDS, + StrokeAttribute_set_attribute_vec2_doc}, + {"set_attribute_vec3", + (PyCFunction)StrokeAttribute_set_attribute_vec3, + METH_VARARGS | METH_KEYWORDS, + StrokeAttribute_set_attribute_vec3_doc}, + {NULL, NULL, 0, NULL}, }; /*----------------------mathutils callbacks ----------------------------*/ /* subtype */ -#define MATHUTILS_SUBTYPE_COLOR 1 -#define MATHUTILS_SUBTYPE_THICKNESS 2 +#define MATHUTILS_SUBTYPE_COLOR 1 +#define MATHUTILS_SUBTYPE_THICKNESS 2 static int StrokeAttribute_mathutils_check(BaseMathObject *bmo) { - if (!BPy_StrokeAttribute_Check(bmo->cb_user)) - return -1; - return 0; + if (!BPy_StrokeAttribute_Check(bmo->cb_user)) + return -1; + return 0; } static int StrokeAttribute_mathutils_get(BaseMathObject *bmo, int subtype) { - BPy_StrokeAttribute *self = (BPy_StrokeAttribute *)bmo->cb_user; - switch (subtype) { - case MATHUTILS_SUBTYPE_COLOR: - bmo->data[0] = self->sa->getColorR(); - bmo->data[1] = self->sa->getColorG(); - bmo->data[2] = self->sa->getColorB(); - break; - case MATHUTILS_SUBTYPE_THICKNESS: - bmo->data[0] = self->sa->getThicknessR(); - bmo->data[1] = self->sa->getThicknessL(); - break; - default: - return -1; - } - return 0; + BPy_StrokeAttribute *self = (BPy_StrokeAttribute *)bmo->cb_user; + switch (subtype) { + case MATHUTILS_SUBTYPE_COLOR: + bmo->data[0] = self->sa->getColorR(); + bmo->data[1] = self->sa->getColorG(); + bmo->data[2] = self->sa->getColorB(); + break; + case MATHUTILS_SUBTYPE_THICKNESS: + bmo->data[0] = self->sa->getThicknessR(); + bmo->data[1] = self->sa->getThicknessL(); + break; + default: + return -1; + } + return 0; } static int StrokeAttribute_mathutils_set(BaseMathObject *bmo, int subtype) { - BPy_StrokeAttribute *self = (BPy_StrokeAttribute *)bmo->cb_user; - switch (subtype) { - case MATHUTILS_SUBTYPE_COLOR: - self->sa->setColor(bmo->data[0], bmo->data[1], bmo->data[2]); - break; - case MATHUTILS_SUBTYPE_THICKNESS: - self->sa->setThickness(bmo->data[0], bmo->data[1]); - break; - default: - return -1; - } - return 0; + BPy_StrokeAttribute *self = (BPy_StrokeAttribute *)bmo->cb_user; + switch (subtype) { + case MATHUTILS_SUBTYPE_COLOR: + self->sa->setColor(bmo->data[0], bmo->data[1], bmo->data[2]); + break; + case MATHUTILS_SUBTYPE_THICKNESS: + self->sa->setThickness(bmo->data[0], bmo->data[1]); + break; + default: + return -1; + } + return 0; } static int StrokeAttribute_mathutils_get_index(BaseMathObject *bmo, int subtype, int index) { - BPy_StrokeAttribute *self = (BPy_StrokeAttribute *)bmo->cb_user; - switch (subtype) { - case MATHUTILS_SUBTYPE_COLOR: - switch (index) { - case 0: bmo->data[0] = self->sa->getColorR(); break; - case 1: bmo->data[1] = self->sa->getColorG(); break; - case 2: bmo->data[2] = self->sa->getColorB(); break; - default: - return -1; - } - break; - case MATHUTILS_SUBTYPE_THICKNESS: - switch (index) { - case 0: bmo->data[0] = self->sa->getThicknessR(); break; - case 1: bmo->data[1] = self->sa->getThicknessL(); break; - default: - return -1; - } - break; - default: - return -1; - } - return 0; + BPy_StrokeAttribute *self = (BPy_StrokeAttribute *)bmo->cb_user; + switch (subtype) { + case MATHUTILS_SUBTYPE_COLOR: + switch (index) { + case 0: + bmo->data[0] = self->sa->getColorR(); + break; + case 1: + bmo->data[1] = self->sa->getColorG(); + break; + case 2: + bmo->data[2] = self->sa->getColorB(); + break; + default: + return -1; + } + break; + case MATHUTILS_SUBTYPE_THICKNESS: + switch (index) { + case 0: + bmo->data[0] = self->sa->getThicknessR(); + break; + case 1: + bmo->data[1] = self->sa->getThicknessL(); + break; + default: + return -1; + } + break; + default: + return -1; + } + return 0; } static int StrokeAttribute_mathutils_set_index(BaseMathObject *bmo, int subtype, int index) { - BPy_StrokeAttribute *self = (BPy_StrokeAttribute *)bmo->cb_user; - switch (subtype) { - case MATHUTILS_SUBTYPE_COLOR: - { - float r = (index == 0) ? bmo->data[0] : self->sa->getColorR(); - float g = (index == 1) ? bmo->data[1] : self->sa->getColorG(); - float b = (index == 2) ? bmo->data[2] : self->sa->getColorB(); - self->sa->setColor(r, g, b); - } - break; - case MATHUTILS_SUBTYPE_THICKNESS: - { - float tr = (index == 0) ? bmo->data[0] : self->sa->getThicknessR(); - float tl = (index == 1) ? bmo->data[1] : self->sa->getThicknessL(); - self->sa->setThickness(tr, tl); - } - break; - default: - return -1; - } - return 0; + BPy_StrokeAttribute *self = (BPy_StrokeAttribute *)bmo->cb_user; + switch (subtype) { + case MATHUTILS_SUBTYPE_COLOR: { + float r = (index == 0) ? bmo->data[0] : self->sa->getColorR(); + float g = (index == 1) ? bmo->data[1] : self->sa->getColorG(); + float b = (index == 2) ? bmo->data[2] : self->sa->getColorB(); + self->sa->setColor(r, g, b); + } break; + case MATHUTILS_SUBTYPE_THICKNESS: { + float tr = (index == 0) ? bmo->data[0] : self->sa->getThicknessR(); + float tl = (index == 1) ? bmo->data[1] : self->sa->getThicknessL(); + self->sa->setThickness(tr, tl); + } break; + default: + return -1; + } + return 0; } static Mathutils_Callback StrokeAttribute_mathutils_cb = { - StrokeAttribute_mathutils_check, - StrokeAttribute_mathutils_get, - StrokeAttribute_mathutils_set, - StrokeAttribute_mathutils_get_index, - StrokeAttribute_mathutils_set_index, + StrokeAttribute_mathutils_check, + StrokeAttribute_mathutils_get, + StrokeAttribute_mathutils_set, + StrokeAttribute_mathutils_get_index, + StrokeAttribute_mathutils_set_index, }; static unsigned char StrokeAttribute_mathutils_cb_index = -1; void StrokeAttribute_mathutils_register_callback() { - StrokeAttribute_mathutils_cb_index = Mathutils_RegisterCallback(&StrokeAttribute_mathutils_cb); + StrokeAttribute_mathutils_cb_index = Mathutils_RegisterCallback(&StrokeAttribute_mathutils_cb); } /*----------------------StrokeAttribute get/setters ----------------------------*/ PyDoc_STRVAR(StrokeAttribute_alpha_doc, -"Alpha component of the stroke color.\n" -"\n" -":type: float"); + "Alpha component of the stroke color.\n" + "\n" + ":type: float"); static PyObject *StrokeAttribute_alpha_get(BPy_StrokeAttribute *self, void *UNUSED(closure)) { - return PyFloat_FromDouble(self->sa->getAlpha()); + return PyFloat_FromDouble(self->sa->getAlpha()); } -static int StrokeAttribute_alpha_set(BPy_StrokeAttribute *self, PyObject *value, void *UNUSED(closure)) +static int StrokeAttribute_alpha_set(BPy_StrokeAttribute *self, + PyObject *value, + void *UNUSED(closure)) { - float scalar; - if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) { /* parsed item not a number */ - PyErr_SetString(PyExc_TypeError, "value must be a number"); - return -1; - } - self->sa->setAlpha(scalar); - return 0; + float scalar; + if ((scalar = PyFloat_AsDouble(value)) == -1.0f && + PyErr_Occurred()) { /* parsed item not a number */ + PyErr_SetString(PyExc_TypeError, "value must be a number"); + return -1; + } + self->sa->setAlpha(scalar); + return 0; } PyDoc_STRVAR(StrokeAttribute_color_doc, -"RGB components of the stroke color.\n" -"\n" -":type: :class:`mathutils.Color`"); + "RGB components of the stroke color.\n" + "\n" + ":type: :class:`mathutils.Color`"); static PyObject *StrokeAttribute_color_get(BPy_StrokeAttribute *self, void *UNUSED(closure)) { - return Color_CreatePyObject_cb((PyObject *)self, StrokeAttribute_mathutils_cb_index, MATHUTILS_SUBTYPE_COLOR); + return Color_CreatePyObject_cb( + (PyObject *)self, StrokeAttribute_mathutils_cb_index, MATHUTILS_SUBTYPE_COLOR); } -static int StrokeAttribute_color_set(BPy_StrokeAttribute *self, PyObject *value, void *UNUSED(closure)) +static int StrokeAttribute_color_set(BPy_StrokeAttribute *self, + PyObject *value, + void *UNUSED(closure)) { - float v[3]; - if (mathutils_array_parse(v, 3, 3, value, - "value must be a 3-dimensional vector") == -1) - { - return -1; - } - self->sa->setColor(v[0], v[1], v[2]); - return 0; + float v[3]; + if (mathutils_array_parse(v, 3, 3, value, "value must be a 3-dimensional vector") == -1) { + return -1; + } + self->sa->setColor(v[0], v[1], v[2]); + return 0; } PyDoc_STRVAR(StrokeAttribute_thickness_doc, -"Right and left components of the stroke thickness.\n" -"The right (left) component is the thickness on the right (left) of the vertex\n" -"when following the stroke.\n" -"\n" -":type: :class:`mathutils.Vector`"); + "Right and left components of the stroke thickness.\n" + "The right (left) component is the thickness on the right (left) of the vertex\n" + "when following the stroke.\n" + "\n" + ":type: :class:`mathutils.Vector`"); static PyObject *StrokeAttribute_thickness_get(BPy_StrokeAttribute *self, void *UNUSED(closure)) { - return Vector_CreatePyObject_cb((PyObject *)self, 2, StrokeAttribute_mathutils_cb_index, - MATHUTILS_SUBTYPE_THICKNESS); + return Vector_CreatePyObject_cb( + (PyObject *)self, 2, StrokeAttribute_mathutils_cb_index, MATHUTILS_SUBTYPE_THICKNESS); } -static int StrokeAttribute_thickness_set(BPy_StrokeAttribute *self, PyObject *value, void *UNUSED(closure)) +static int StrokeAttribute_thickness_set(BPy_StrokeAttribute *self, + PyObject *value, + void *UNUSED(closure)) { - float v[2]; - if (mathutils_array_parse(v, 2, 2, value, - "value must be a 2-dimensional vector") == -1) - { - return -1; - } - self->sa->setThickness(v[0], v[1]); - return 0; + float v[2]; + if (mathutils_array_parse(v, 2, 2, value, "value must be a 2-dimensional vector") == -1) { + return -1; + } + self->sa->setThickness(v[0], v[1]); + return 0; } PyDoc_STRVAR(StrokeAttribute_visible_doc, -"The visibility flag. True if the StrokeVertex is visible.\n" -"\n" -":type: bool"); + "The visibility flag. True if the StrokeVertex is visible.\n" + "\n" + ":type: bool"); static PyObject *StrokeAttribute_visible_get(BPy_StrokeAttribute *self, void *UNUSED(closure)) { - return PyBool_from_bool(self->sa->isVisible()); + return PyBool_from_bool(self->sa->isVisible()); } -static int StrokeAttribute_visible_set(BPy_StrokeAttribute *self, PyObject *value, void *UNUSED(closure)) +static int StrokeAttribute_visible_set(BPy_StrokeAttribute *self, + PyObject *value, + void *UNUSED(closure)) { - if (!PyBool_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be boolean"); - return -1; - } - self->sa->setVisible(bool_from_PyBool(value)); - return 0; + if (!PyBool_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be boolean"); + return -1; + } + self->sa->setVisible(bool_from_PyBool(value)); + return 0; } static PyGetSetDef BPy_StrokeAttribute_getseters[] = { - {(char *)"alpha", (getter)StrokeAttribute_alpha_get, (setter)StrokeAttribute_alpha_set, - (char *)StrokeAttribute_alpha_doc, NULL}, - {(char *)"color", (getter)StrokeAttribute_color_get, (setter)StrokeAttribute_color_set, - (char *)StrokeAttribute_color_doc, NULL}, - {(char *)"thickness", (getter)StrokeAttribute_thickness_get, (setter)StrokeAttribute_thickness_set, - (char *)StrokeAttribute_thickness_doc, NULL}, - {(char *)"visible", (getter)StrokeAttribute_visible_get, (setter)StrokeAttribute_visible_set, - (char *)StrokeAttribute_visible_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"alpha", + (getter)StrokeAttribute_alpha_get, + (setter)StrokeAttribute_alpha_set, + (char *)StrokeAttribute_alpha_doc, + NULL}, + {(char *)"color", + (getter)StrokeAttribute_color_get, + (setter)StrokeAttribute_color_set, + (char *)StrokeAttribute_color_doc, + NULL}, + {(char *)"thickness", + (getter)StrokeAttribute_thickness_get, + (setter)StrokeAttribute_thickness_set, + (char *)StrokeAttribute_thickness_doc, + NULL}, + {(char *)"visible", + (getter)StrokeAttribute_visible_get, + (setter)StrokeAttribute_visible_set, + (char *)StrokeAttribute_visible_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_StrokeAttribute type definition ------------------------------*/ PyTypeObject StrokeAttribute_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "StrokeAttribute", /* tp_name */ - sizeof(BPy_StrokeAttribute), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)StrokeAttribute_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)StrokeAttribute_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - StrokeAttribute_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_StrokeAttribute_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_StrokeAttribute_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)StrokeAttribute_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "StrokeAttribute", /* tp_name */ + sizeof(BPy_StrokeAttribute), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)StrokeAttribute_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)StrokeAttribute_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + StrokeAttribute_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_StrokeAttribute_methods, /* tp_methods */ + 0, /* tp_members */ + BPy_StrokeAttribute_getseters, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)StrokeAttribute_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.h b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.h index 7b55fcc9444..9e14c292c0a 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeAttribute.h +++ b/source/blender/freestyle/intern/python/BPy_StrokeAttribute.h @@ -37,13 +37,13 @@ extern "C" { extern PyTypeObject StrokeAttribute_Type; -#define BPy_StrokeAttribute_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&StrokeAttribute_Type)) +#define BPy_StrokeAttribute_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&StrokeAttribute_Type)) /*---------------------------Python BPy_StrokeAttribute structure definition----------*/ typedef struct { - PyObject_HEAD - StrokeAttribute *sa; - bool borrowed; /* true if *sa is a borrowed reference */ + PyObject_HEAD StrokeAttribute *sa; + bool borrowed; /* true if *sa is a borrowed reference */ } BPy_StrokeAttribute; /*---------------------------Python BPy_StrokeAttribute visible prototypes-----------*/ diff --git a/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp b/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp index 54ac10f39f7..33028512b47 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp +++ b/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp @@ -51,245 +51,253 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int StrokeShader_Init(PyObject *module) { - if (module == NULL) - return -1; - - 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) - return -1; - Py_INCREF(&BackboneStretcherShader_Type); - PyModule_AddObject(module, "BackboneStretcherShader", (PyObject *)&BackboneStretcherShader_Type); - - 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) - return -1; - Py_INCREF(&BlenderTextureShader_Type); - PyModule_AddObject(module, "BlenderTextureShader", (PyObject *)&BlenderTextureShader_Type); - - 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) - return -1; - Py_INCREF(&ColorNoiseShader_Type); - PyModule_AddObject(module, "ColorNoiseShader", (PyObject *)&ColorNoiseShader_Type); - - 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) - return -1; - Py_INCREF(&ConstantThicknessShader_Type); - PyModule_AddObject(module, "ConstantThicknessShader", (PyObject *)&ConstantThicknessShader_Type); - - 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) - return -1; - Py_INCREF(&GuidingLinesShader_Type); - PyModule_AddObject(module, "GuidingLinesShader", (PyObject *)&GuidingLinesShader_Type); - - 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) - return -1; - Py_INCREF(&IncreasingThicknessShader_Type); - PyModule_AddObject(module, "IncreasingThicknessShader", (PyObject *)&IncreasingThicknessShader_Type); - - 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) - return -1; - Py_INCREF(&SamplingShader_Type); - PyModule_AddObject(module, "SamplingShader", (PyObject *)&SamplingShader_Type); - - 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) - return -1; - Py_INCREF(&SpatialNoiseShader_Type); - PyModule_AddObject(module, "SpatialNoiseShader", (PyObject *)&SpatialNoiseShader_Type); - - 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) - return -1; - Py_INCREF(&ThicknessNoiseShader_Type); - PyModule_AddObject(module, "ThicknessNoiseShader", (PyObject *)&ThicknessNoiseShader_Type); - - if (PyType_Ready(&TipRemoverShader_Type) < 0) - return -1; - Py_INCREF(&TipRemoverShader_Type); - PyModule_AddObject(module, "TipRemoverShader", (PyObject *)&TipRemoverShader_Type); - - return 0; + if (module == NULL) + return -1; + + 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) + return -1; + Py_INCREF(&BackboneStretcherShader_Type); + PyModule_AddObject(module, "BackboneStretcherShader", (PyObject *)&BackboneStretcherShader_Type); + + 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) + return -1; + Py_INCREF(&BlenderTextureShader_Type); + PyModule_AddObject(module, "BlenderTextureShader", (PyObject *)&BlenderTextureShader_Type); + + 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) + return -1; + Py_INCREF(&ColorNoiseShader_Type); + PyModule_AddObject(module, "ColorNoiseShader", (PyObject *)&ColorNoiseShader_Type); + + 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) + return -1; + Py_INCREF(&ConstantThicknessShader_Type); + PyModule_AddObject(module, "ConstantThicknessShader", (PyObject *)&ConstantThicknessShader_Type); + + 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) + return -1; + Py_INCREF(&GuidingLinesShader_Type); + PyModule_AddObject(module, "GuidingLinesShader", (PyObject *)&GuidingLinesShader_Type); + + 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) + return -1; + Py_INCREF(&IncreasingThicknessShader_Type); + PyModule_AddObject( + module, "IncreasingThicknessShader", (PyObject *)&IncreasingThicknessShader_Type); + + 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) + return -1; + Py_INCREF(&SamplingShader_Type); + PyModule_AddObject(module, "SamplingShader", (PyObject *)&SamplingShader_Type); + + 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) + return -1; + Py_INCREF(&SpatialNoiseShader_Type); + PyModule_AddObject(module, "SpatialNoiseShader", (PyObject *)&SpatialNoiseShader_Type); + + 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) + return -1; + Py_INCREF(&ThicknessNoiseShader_Type); + PyModule_AddObject(module, "ThicknessNoiseShader", (PyObject *)&ThicknessNoiseShader_Type); + + if (PyType_Ready(&TipRemoverShader_Type) < 0) + return -1; + Py_INCREF(&TipRemoverShader_Type); + PyModule_AddObject(module, "TipRemoverShader", (PyObject *)&TipRemoverShader_Type); + + return 0; } //------------------------INSTANCE METHODS ---------------------------------- static char StrokeShader___doc__[] = -"Base class for stroke shaders. Any stroke shader must inherit from\n" -"this class and overload the shade() method. A StrokeShader is\n" -"designed to modify stroke attributes such as thickness, color,\n" -"geometry, texture, blending mode, and so on. The basic way for this\n" -"operation is to iterate over the stroke vertices of the :class:`Stroke`\n" -"and to modify the :class:`StrokeAttribute` of each vertex. Here is a\n" -"code example of such an iteration::\n" -"\n" -" it = ioStroke.strokeVerticesBegin()\n" -" while not it.is_end:\n" -" att = it.object.attribute\n" -" ## perform here any attribute modification\n" -" it.increment()\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n"; + "Base class for stroke shaders. Any stroke shader must inherit from\n" + "this class and overload the shade() method. A StrokeShader is\n" + "designed to modify stroke attributes such as thickness, color,\n" + "geometry, texture, blending mode, and so on. The basic way for this\n" + "operation is to iterate over the stroke vertices of the :class:`Stroke`\n" + "and to modify the :class:`StrokeAttribute` of each vertex. Here is a\n" + "code example of such an iteration::\n" + "\n" + " it = ioStroke.strokeVerticesBegin()\n" + " while not it.is_end:\n" + " att = it.object.attribute\n" + " ## perform here any attribute modification\n" + " it.increment()\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n"; static int StrokeShader___init__(BPy_StrokeShader *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->ss = new StrokeShader(); - self->ss->py_ss = (PyObject *)self; - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->ss = new StrokeShader(); + self->ss->py_ss = (PyObject *)self; + return 0; } static void StrokeShader___dealloc__(BPy_StrokeShader *self) { - if (self->ss) - delete self->ss; - Py_TYPE(self)->tp_free((PyObject *)self); + if (self->ss) + delete self->ss; + Py_TYPE(self)->tp_free((PyObject *)self); } static PyObject *StrokeShader___repr__(BPy_StrokeShader *self) { - return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->ss); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->ss); } static char StrokeShader_shade___doc__[] = -".. method:: shade(stroke)\n" -"\n" -" The shading method. Must be overloaded by inherited classes.\n" -"\n" -" :arg stroke: A Stroke object.\n" -" :type stroke: :class:`Stroke`\n"; + ".. method:: shade(stroke)\n" + "\n" + " The shading method. Must be overloaded by inherited classes.\n" + "\n" + " :arg stroke: A Stroke object.\n" + " :type stroke: :class:`Stroke`\n"; static PyObject *StrokeShader_shade(BPy_StrokeShader *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"stroke", NULL}; - PyObject *py_s = 0; - - 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"); - return NULL; - } - if (self->ss->shade(*(((BPy_Stroke *)py_s)->s)) < 0) { - if (!PyErr_Occurred()) { - string class_name(Py_TYPE(self)->tp_name); - PyErr_SetString(PyExc_RuntimeError, (class_name + " shade method failed").c_str()); - } - return NULL; - } - Py_RETURN_NONE; + static const char *kwlist[] = {"stroke", NULL}; + PyObject *py_s = 0; + + 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"); + return NULL; + } + if (self->ss->shade(*(((BPy_Stroke *)py_s)->s)) < 0) { + if (!PyErr_Occurred()) { + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " shade method failed").c_str()); + } + return NULL; + } + Py_RETURN_NONE; } static PyMethodDef BPy_StrokeShader_methods[] = { - {"shade", (PyCFunction)StrokeShader_shade, METH_VARARGS | METH_KEYWORDS, StrokeShader_shade___doc__}, - {NULL, NULL, 0, NULL}, + {"shade", + (PyCFunction)StrokeShader_shade, + METH_VARARGS | METH_KEYWORDS, + StrokeShader_shade___doc__}, + {NULL, NULL, 0, NULL}, }; /*----------------------StrokeShader get/setters ----------------------------*/ PyDoc_STRVAR(StrokeShader_name_doc, -"The name of the stroke shader.\n" -"\n" -":type: str"); + "The name of the stroke shader.\n" + "\n" + ":type: str"); static PyObject *StrokeShader_name_get(BPy_StrokeShader *self, void *UNUSED(closure)) { - return PyUnicode_FromString(Py_TYPE(self)->tp_name); + return PyUnicode_FromString(Py_TYPE(self)->tp_name); } static PyGetSetDef BPy_StrokeShader_getseters[] = { - {(char *)"name", (getter)StrokeShader_name_get, (setter)NULL, (char *)StrokeShader_name_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"name", + (getter)StrokeShader_name_get, + (setter)NULL, + (char *)StrokeShader_name_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_StrokeShader type definition ------------------------------*/ PyTypeObject StrokeShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "StrokeShader", /* tp_name */ - sizeof(BPy_StrokeShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)StrokeShader___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)StrokeShader___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - StrokeShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_StrokeShader_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_StrokeShader_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)StrokeShader___init__, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "StrokeShader", /* tp_name */ + sizeof(BPy_StrokeShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)StrokeShader___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)StrokeShader___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + StrokeShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_StrokeShader_methods, /* tp_methods */ + 0, /* tp_members */ + BPy_StrokeShader_getseters, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)StrokeShader___init__, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_StrokeShader.h b/source/blender/freestyle/intern/python/BPy_StrokeShader.h index 80a7e3fab0f..23b1196fdb9 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeShader.h +++ b/source/blender/freestyle/intern/python/BPy_StrokeShader.h @@ -41,24 +41,22 @@ extern "C" { extern PyTypeObject StrokeShader_Type; -#define BPy_StrokeShader_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&StrokeShader_Type)) +#define BPy_StrokeShader_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&StrokeShader_Type)) /*---------------------------Python BPy_StrokeShader structure definition----------*/ typedef struct { - PyObject_HEAD - StrokeShader *ss; + PyObject_HEAD StrokeShader *ss; } BPy_StrokeShader; /*---------------------------Python BPy_StrokeShader visible prototypes-----------*/ int StrokeShader_Init(PyObject *module); - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus } #endif - #endif /* __FREESTYLE_PYTHON_STROKESHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp index 278faceadd4..90a9258d9e8 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.cpp @@ -40,118 +40,121 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int UnaryFunction0D_Init(PyObject *module) { - if (module == NULL) - return -1; - - if (PyType_Ready(&UnaryFunction0D_Type) < 0) - return -1; - Py_INCREF(&UnaryFunction0D_Type); - PyModule_AddObject(module, "UnaryFunction0D", (PyObject *)&UnaryFunction0D_Type); - - UnaryFunction0DDouble_Init(module); - UnaryFunction0DEdgeNature_Init(module); - UnaryFunction0DFloat_Init(module); - UnaryFunction0DId_Init(module); - UnaryFunction0DMaterial_Init(module); - UnaryFunction0DUnsigned_Init(module); - UnaryFunction0DVec2f_Init(module); - UnaryFunction0DVec3f_Init(module); - UnaryFunction0DVectorViewShape_Init(module); - UnaryFunction0DViewShape_Init(module); - - return 0; + if (module == NULL) + return -1; + + if (PyType_Ready(&UnaryFunction0D_Type) < 0) + return -1; + Py_INCREF(&UnaryFunction0D_Type); + PyModule_AddObject(module, "UnaryFunction0D", (PyObject *)&UnaryFunction0D_Type); + + UnaryFunction0DDouble_Init(module); + UnaryFunction0DEdgeNature_Init(module); + UnaryFunction0DFloat_Init(module); + UnaryFunction0DId_Init(module); + UnaryFunction0DMaterial_Init(module); + UnaryFunction0DUnsigned_Init(module); + UnaryFunction0DVec2f_Init(module); + UnaryFunction0DVec3f_Init(module); + UnaryFunction0DVectorViewShape_Init(module); + UnaryFunction0DViewShape_Init(module); + + return 0; } //------------------------INSTANCE METHODS ---------------------------------- static char UnaryFunction0D___doc__[] = -"Base class for Unary Functions (functors) working on\n" -":class:`Interface0DIterator`. A unary function will be used by\n" -"invoking __call__() on an Interface0DIterator. In Python, several\n" -"different subclasses of UnaryFunction0D are used depending on the\n" -"types of functors' return values. For example, you would inherit from\n" -"a :class:`UnaryFunction0DDouble` if you wish to define a function that\n" -"returns a double value. Available UnaryFunction0D subclasses are:\n" -"\n" -"* :class:`UnaryFunction0DDouble`\n" -"* :class:`UnaryFunction0DEdgeNature`\n" -"* :class:`UnaryFunction0DFloat`\n" -"* :class:`UnaryFunction0DId`\n" -"* :class:`UnaryFunction0DMaterial`\n" -"* :class:`UnaryFunction0DUnsigned`\n" -"* :class:`UnaryFunction0DVec2f`\n" -"* :class:`UnaryFunction0DVec3f`\n" -"* :class:`UnaryFunction0DVectorViewShape`\n" -"* :class:`UnaryFunction0DViewShape`\n"; + "Base class for Unary Functions (functors) working on\n" + ":class:`Interface0DIterator`. A unary function will be used by\n" + "invoking __call__() on an Interface0DIterator. In Python, several\n" + "different subclasses of UnaryFunction0D are used depending on the\n" + "types of functors' return values. For example, you would inherit from\n" + "a :class:`UnaryFunction0DDouble` if you wish to define a function that\n" + "returns a double value. Available UnaryFunction0D subclasses are:\n" + "\n" + "* :class:`UnaryFunction0DDouble`\n" + "* :class:`UnaryFunction0DEdgeNature`\n" + "* :class:`UnaryFunction0DFloat`\n" + "* :class:`UnaryFunction0DId`\n" + "* :class:`UnaryFunction0DMaterial`\n" + "* :class:`UnaryFunction0DUnsigned`\n" + "* :class:`UnaryFunction0DVec2f`\n" + "* :class:`UnaryFunction0DVec3f`\n" + "* :class:`UnaryFunction0DVectorViewShape`\n" + "* :class:`UnaryFunction0DViewShape`\n"; static void UnaryFunction0D___dealloc__(BPy_UnaryFunction0D *self) { - Py_TYPE(self)->tp_free((PyObject *)self); + Py_TYPE(self)->tp_free((PyObject *)self); } static PyObject *UnaryFunction0D___repr__(BPy_UnaryFunction0D * /*self*/) { - return PyUnicode_FromString("UnaryFunction0D"); + return PyUnicode_FromString("UnaryFunction0D"); } /*----------------------UnaryFunction0D get/setters ----------------------------*/ PyDoc_STRVAR(UnaryFunction0D_name_doc, -"The name of the unary 0D function.\n" -"\n" -":type: str"); + "The name of the unary 0D function.\n" + "\n" + ":type: str"); static PyObject *UnaryFunction0D_name_get(BPy_UnaryFunction0D *self, void *UNUSED(closure)) { - return PyUnicode_FromString(Py_TYPE(self)->tp_name); + return PyUnicode_FromString(Py_TYPE(self)->tp_name); } static PyGetSetDef BPy_UnaryFunction0D_getseters[] = { - {(char *)"name", (getter)UnaryFunction0D_name_get, (setter)NULL, (char *)UnaryFunction0D_name_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"name", + (getter)UnaryFunction0D_name_get, + (setter)NULL, + (char *)UnaryFunction0D_name_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction0D type definition ------------------------------*/ PyTypeObject UnaryFunction0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction0D", /* tp_name */ - sizeof(BPy_UnaryFunction0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0D___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0D___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_UnaryFunction0D_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction0D", /* tp_name */ + sizeof(BPy_UnaryFunction0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0D___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction0D___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + BPy_UnaryFunction0D_getseters, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.h b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.h index 2d045b39d82..c0834859dc8 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.h +++ b/source/blender/freestyle/intern/python/BPy_UnaryFunction0D.h @@ -37,12 +37,12 @@ extern "C" { extern PyTypeObject UnaryFunction0D_Type; -#define BPy_UnaryFunction0D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction0D_Type)) +#define BPy_UnaryFunction0D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction0D_Type)) /*---------------------------Python BPy_UnaryFunction0D structure definition----------*/ typedef struct { - PyObject_HEAD - PyObject *py_uf0D; + PyObject_HEAD PyObject *py_uf0D; } BPy_UnaryFunction0D; /*---------------------------Python BPy_UnaryFunction0D visible prototypes-----------*/ diff --git a/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp index a340a7b69bc..879f090275d 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.cpp @@ -38,114 +38,117 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int UnaryFunction1D_Init(PyObject *module) { - if (module == NULL) - return -1; - - if (PyType_Ready(&UnaryFunction1D_Type) < 0) - return -1; - Py_INCREF(&UnaryFunction1D_Type); - PyModule_AddObject(module, "UnaryFunction1D", (PyObject *)&UnaryFunction1D_Type); - - UnaryFunction1DDouble_Init(module); - UnaryFunction1DEdgeNature_Init(module); - UnaryFunction1DFloat_Init(module); - UnaryFunction1DUnsigned_Init(module); - UnaryFunction1DVec2f_Init(module); - UnaryFunction1DVec3f_Init(module); - UnaryFunction1DVectorViewShape_Init(module); - UnaryFunction1DVoid_Init(module); - - return 0; + if (module == NULL) + return -1; + + if (PyType_Ready(&UnaryFunction1D_Type) < 0) + return -1; + Py_INCREF(&UnaryFunction1D_Type); + PyModule_AddObject(module, "UnaryFunction1D", (PyObject *)&UnaryFunction1D_Type); + + UnaryFunction1DDouble_Init(module); + UnaryFunction1DEdgeNature_Init(module); + UnaryFunction1DFloat_Init(module); + UnaryFunction1DUnsigned_Init(module); + UnaryFunction1DVec2f_Init(module); + UnaryFunction1DVec3f_Init(module); + UnaryFunction1DVectorViewShape_Init(module); + UnaryFunction1DVoid_Init(module); + + return 0; } //------------------------INSTANCE METHODS ---------------------------------- static char UnaryFunction1D___doc__[] = -"Base class for Unary Functions (functors) working on\n" -":class:`Interface1D`. A unary function will be used by invoking\n" -"__call__() on an Interface1D. In Python, several different subclasses\n" -"of UnaryFunction1D are used depending on the types of functors' return\n" -"values. For example, you would inherit from a\n" -":class:`UnaryFunction1DDouble` if you wish to define a function that\n" -"returns a double value. Available UnaryFunction1D subclasses are:\n" -"\n" -"* :class:`UnaryFunction1DDouble`\n" -"* :class:`UnaryFunction1DEdgeNature`\n" -"* :class:`UnaryFunction1DFloat`\n" -"* :class:`UnaryFunction1DUnsigned`\n" -"* :class:`UnaryFunction1DVec2f`\n" -"* :class:`UnaryFunction1DVec3f`\n" -"* :class:`UnaryFunction1DVectorViewShape`\n" -"* :class:`UnaryFunction1DVoid`\n"; + "Base class for Unary Functions (functors) working on\n" + ":class:`Interface1D`. A unary function will be used by invoking\n" + "__call__() on an Interface1D. In Python, several different subclasses\n" + "of UnaryFunction1D are used depending on the types of functors' return\n" + "values. For example, you would inherit from a\n" + ":class:`UnaryFunction1DDouble` if you wish to define a function that\n" + "returns a double value. Available UnaryFunction1D subclasses are:\n" + "\n" + "* :class:`UnaryFunction1DDouble`\n" + "* :class:`UnaryFunction1DEdgeNature`\n" + "* :class:`UnaryFunction1DFloat`\n" + "* :class:`UnaryFunction1DUnsigned`\n" + "* :class:`UnaryFunction1DVec2f`\n" + "* :class:`UnaryFunction1DVec3f`\n" + "* :class:`UnaryFunction1DVectorViewShape`\n" + "* :class:`UnaryFunction1DVoid`\n"; static void UnaryFunction1D___dealloc__(BPy_UnaryFunction1D *self) { - Py_TYPE(self)->tp_free((PyObject *)self); + Py_TYPE(self)->tp_free((PyObject *)self); } static PyObject *UnaryFunction1D___repr__(BPy_UnaryFunction1D * /*self*/) { - return PyUnicode_FromString("UnaryFunction1D"); + return PyUnicode_FromString("UnaryFunction1D"); } /*----------------------UnaryFunction1D get/setters ----------------------------*/ PyDoc_STRVAR(UnaryFunction1D_name_doc, -"The name of the unary 1D function.\n" -"\n" -":type: str"); + "The name of the unary 1D function.\n" + "\n" + ":type: str"); static PyObject *UnaryFunction1D_name_get(BPy_UnaryFunction1D *self, void *UNUSED(closure)) { - return PyUnicode_FromString(Py_TYPE(self)->tp_name); + return PyUnicode_FromString(Py_TYPE(self)->tp_name); } static PyGetSetDef BPy_UnaryFunction1D_getseters[] = { - {(char *)"name", (getter)UnaryFunction1D_name_get, (setter)NULL, (char *)UnaryFunction1D_name_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"name", + (getter)UnaryFunction1D_name_get, + (setter)NULL, + (char *)UnaryFunction1D_name_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction1D type definition ------------------------------*/ PyTypeObject UnaryFunction1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction1D", /* tp_name */ - sizeof(BPy_UnaryFunction1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction1D___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction1D___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_UnaryFunction1D_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction1D", /* tp_name */ + sizeof(BPy_UnaryFunction1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction1D___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction1D___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + BPy_UnaryFunction1D_getseters, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + 0, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.h b/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.h index 842d228cf75..dfd0e56beb6 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.h +++ b/source/blender/freestyle/intern/python/BPy_UnaryFunction1D.h @@ -37,12 +37,12 @@ extern "C" { extern PyTypeObject UnaryFunction1D_Type; -#define BPy_UnaryFunction1D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction1D_Type)) +#define BPy_UnaryFunction1D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction1D_Type)) /*---------------------------Python BPy_UnaryFunction1D structure definition----------*/ typedef struct { - PyObject_HEAD - PyObject *py_uf1D; + PyObject_HEAD PyObject *py_uf1D; } BPy_UnaryFunction1D; /*---------------------------Python BPy_UnaryFunction1D visible prototypes-----------*/ diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp index d5323b8ff40..7d1a91f156d 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp @@ -34,161 +34,167 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int UnaryPredicate0D_Init(PyObject *module) { - if (module == NULL) - return -1; + if (module == NULL) + return -1; - if (PyType_Ready(&UnaryPredicate0D_Type) < 0) - return -1; - Py_INCREF(&UnaryPredicate0D_Type); - PyModule_AddObject(module, "UnaryPredicate0D", (PyObject *)&UnaryPredicate0D_Type); + 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) - return -1; - Py_INCREF(&FalseUP0D_Type); - PyModule_AddObject(module, "FalseUP0D", (PyObject *)&FalseUP0D_Type); + 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) - return -1; - Py_INCREF(&TrueUP0D_Type); - PyModule_AddObject(module, "TrueUP0D", (PyObject *)&TrueUP0D_Type); + if (PyType_Ready(&TrueUP0D_Type) < 0) + return -1; + Py_INCREF(&TrueUP0D_Type); + PyModule_AddObject(module, "TrueUP0D", (PyObject *)&TrueUP0D_Type); - return 0; + return 0; } //------------------------INSTANCE METHODS ---------------------------------- static char UnaryPredicate0D___doc__[] = -"Base class for unary predicates that work on\n" -":class:`Interface0DIterator`. A UnaryPredicate0D is a functor that\n" -"evaluates a condition on an Interface0DIterator and returns true or\n" -"false depending on whether this condition is satisfied or not. The\n" -"UnaryPredicate0D is used by invoking its __call__() method. Any\n" -"inherited class must overload the __call__() method.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Must be overload by inherited classes.\n" -"\n" -" :arg it: The Interface0DIterator pointing onto the Interface0D at\n" -" which we wish to evaluate the predicate.\n" -" :type it: :class:`Interface0DIterator`\n" -" :return: True if the condition is satisfied, false otherwise.\n" -" :rtype: bool\n"; + "Base class for unary predicates that work on\n" + ":class:`Interface0DIterator`. A UnaryPredicate0D is a functor that\n" + "evaluates a condition on an Interface0DIterator and returns true or\n" + "false depending on whether this condition is satisfied or not. The\n" + "UnaryPredicate0D is used by invoking its __call__() method. Any\n" + "inherited class must overload the __call__() method.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Must be overload by inherited classes.\n" + "\n" + " :arg it: The Interface0DIterator pointing onto the Interface0D at\n" + " which we wish to evaluate the predicate.\n" + " :type it: :class:`Interface0DIterator`\n" + " :return: True if the condition is satisfied, false otherwise.\n" + " :rtype: bool\n"; static int UnaryPredicate0D___init__(BPy_UnaryPredicate0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->up0D = new UnaryPredicate0D(); - self->up0D->py_up0D = (PyObject *)self; - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->up0D = new UnaryPredicate0D(); + self->up0D->py_up0D = (PyObject *)self; + return 0; } static void UnaryPredicate0D___dealloc__(BPy_UnaryPredicate0D *self) { - if (self->up0D) - delete self->up0D; - Py_TYPE(self)->tp_free((PyObject *)self); + if (self->up0D) + delete self->up0D; + Py_TYPE(self)->tp_free((PyObject *)self); } static PyObject *UnaryPredicate0D___repr__(BPy_UnaryPredicate0D *self) { - return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->up0D); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->up0D); } -static PyObject *UnaryPredicate0D___call__(BPy_UnaryPredicate0D *self, PyObject *args, PyObject *kwds) +static PyObject *UnaryPredicate0D___call__(BPy_UnaryPredicate0D *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"it", NULL}; - PyObject *py_if0D_it; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &py_if0D_it)) - return NULL; - - Interface0DIterator *if0D_it = ((BPy_Interface0DIterator *)py_if0D_it)->if0D_it; - - if (!if0D_it) { - string class_name(Py_TYPE(self)->tp_name); - PyErr_SetString(PyExc_RuntimeError, (class_name + " has no Interface0DIterator").c_str()); - return NULL; - } - if (typeid(*(self->up0D)) == typeid(UnaryPredicate0D)) { - PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; - } - if (self->up0D->operator()(*if0D_it) < 0) { - if (!PyErr_Occurred()) { - string class_name(Py_TYPE(self)->tp_name); - PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); - } - return NULL; - } - return PyBool_from_bool(self->up0D->result); + static const char *kwlist[] = {"it", NULL}; + PyObject *py_if0D_it; + + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &py_if0D_it)) + return NULL; + + Interface0DIterator *if0D_it = ((BPy_Interface0DIterator *)py_if0D_it)->if0D_it; + + if (!if0D_it) { + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " has no Interface0DIterator").c_str()); + return NULL; + } + if (typeid(*(self->up0D)) == typeid(UnaryPredicate0D)) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->up0D->operator()(*if0D_it) < 0) { + if (!PyErr_Occurred()) { + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); + } + return NULL; + } + return PyBool_from_bool(self->up0D->result); } /*----------------------UnaryPredicate0D get/setters ----------------------------*/ PyDoc_STRVAR(UnaryPredicate0D_name_doc, -"The name of the unary 0D predicate.\n" -"\n" -":type: str"); + "The name of the unary 0D predicate.\n" + "\n" + ":type: str"); static PyObject *UnaryPredicate0D_name_get(BPy_UnaryPredicate0D *self, void *UNUSED(closure)) { - return PyUnicode_FromString(Py_TYPE(self)->tp_name); + return PyUnicode_FromString(Py_TYPE(self)->tp_name); } static PyGetSetDef BPy_UnaryPredicate0D_getseters[] = { - {(char *)"name", (getter)UnaryPredicate0D_name_get, (setter)NULL, (char *)UnaryPredicate0D_name_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"name", + (getter)UnaryPredicate0D_name_get, + (setter)NULL, + (char *)UnaryPredicate0D_name_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_UnaryPredicate0D type definition ------------------------------*/ PyTypeObject UnaryPredicate0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryPredicate0D", /* tp_name */ - sizeof(BPy_UnaryPredicate0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryPredicate0D___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryPredicate0D___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryPredicate0D___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryPredicate0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_UnaryPredicate0D_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryPredicate0D___init__, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "UnaryPredicate0D", /* tp_name */ + sizeof(BPy_UnaryPredicate0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryPredicate0D___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryPredicate0D___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryPredicate0D___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryPredicate0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + BPy_UnaryPredicate0D_getseters, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryPredicate0D___init__, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.h b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.h index 685120cfb0c..d422b10f18e 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.h +++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.h @@ -37,12 +37,12 @@ extern "C" { extern PyTypeObject UnaryPredicate0D_Type; -#define BPy_UnaryPredicate0D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryPredicate0D_Type)) +#define BPy_UnaryPredicate0D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryPredicate0D_Type)) /*---------------------------Python BPy_UnaryPredicate0D structure definition----------*/ typedef struct { - PyObject_HEAD - UnaryPredicate0D *up0D; + PyObject_HEAD UnaryPredicate0D *up0D; } BPy_UnaryPredicate0D; /*---------------------------Python BPy_UnaryPredicate0D visible prototypes-----------*/ diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp index 11ab9eb2a2b..3c728d1a852 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp +++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp @@ -43,200 +43,207 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int UnaryPredicate1D_Init(PyObject *module) { - if (module == NULL) - return -1; - - 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) - return -1; - Py_INCREF(&ContourUP1D_Type); - PyModule_AddObject(module, "ContourUP1D", (PyObject *)&ContourUP1D_Type); - - 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) - return -1; - Py_INCREF(&EqualToChainingTimeStampUP1D_Type); - PyModule_AddObject(module, "EqualToChainingTimeStampUP1D", (PyObject *)&EqualToChainingTimeStampUP1D_Type); - - 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) - return -1; - Py_INCREF(&ExternalContourUP1D_Type); - PyModule_AddObject(module, "ExternalContourUP1D", (PyObject *)&ExternalContourUP1D_Type); - - 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) - return -1; - Py_INCREF(&QuantitativeInvisibilityUP1D_Type); - PyModule_AddObject(module, "QuantitativeInvisibilityUP1D", (PyObject *)&QuantitativeInvisibilityUP1D_Type); - - 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) - return -1; - Py_INCREF(&TrueUP1D_Type); - PyModule_AddObject(module, "TrueUP1D", (PyObject *)&TrueUP1D_Type); - - if (PyType_Ready(&WithinImageBoundaryUP1D_Type) < 0) - return -1; - Py_INCREF(&WithinImageBoundaryUP1D_Type); - PyModule_AddObject(module, "WithinImageBoundaryUP1D", (PyObject *)&WithinImageBoundaryUP1D_Type); - - return 0; + if (module == NULL) + return -1; + + 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) + return -1; + Py_INCREF(&ContourUP1D_Type); + PyModule_AddObject(module, "ContourUP1D", (PyObject *)&ContourUP1D_Type); + + 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) + return -1; + Py_INCREF(&EqualToChainingTimeStampUP1D_Type); + PyModule_AddObject( + module, "EqualToChainingTimeStampUP1D", (PyObject *)&EqualToChainingTimeStampUP1D_Type); + + 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) + return -1; + Py_INCREF(&ExternalContourUP1D_Type); + PyModule_AddObject(module, "ExternalContourUP1D", (PyObject *)&ExternalContourUP1D_Type); + + 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) + return -1; + Py_INCREF(&QuantitativeInvisibilityUP1D_Type); + PyModule_AddObject( + module, "QuantitativeInvisibilityUP1D", (PyObject *)&QuantitativeInvisibilityUP1D_Type); + + 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) + return -1; + Py_INCREF(&TrueUP1D_Type); + PyModule_AddObject(module, "TrueUP1D", (PyObject *)&TrueUP1D_Type); + + if (PyType_Ready(&WithinImageBoundaryUP1D_Type) < 0) + return -1; + Py_INCREF(&WithinImageBoundaryUP1D_Type); + PyModule_AddObject(module, "WithinImageBoundaryUP1D", (PyObject *)&WithinImageBoundaryUP1D_Type); + + return 0; } //------------------------INSTANCE METHODS ---------------------------------- static char UnaryPredicate1D___doc__[] = -"Base class for unary predicates that work on :class:`Interface1D`. A\n" -"UnaryPredicate1D is a functor that evaluates a condition on a\n" -"Interface1D and returns true or false depending on whether this\n" -"condition is satisfied or not. The UnaryPredicate1D is used by\n" -"invoking its __call__() method. Any inherited class must overload the\n" -"__call__() method.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Must be overload by inherited classes.\n" -"\n" -" :arg inter: The Interface1D on which we wish to evaluate the predicate.\n" -" :type inter: :class:`Interface1D`\n" -" :return: True if the condition is satisfied, false otherwise.\n" -" :rtype: bool\n"; + "Base class for unary predicates that work on :class:`Interface1D`. A\n" + "UnaryPredicate1D is a functor that evaluates a condition on a\n" + "Interface1D and returns true or false depending on whether this\n" + "condition is satisfied or not. The UnaryPredicate1D is used by\n" + "invoking its __call__() method. Any inherited class must overload the\n" + "__call__() method.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Must be overload by inherited classes.\n" + "\n" + " :arg inter: The Interface1D on which we wish to evaluate the predicate.\n" + " :type inter: :class:`Interface1D`\n" + " :return: True if the condition is satisfied, false otherwise.\n" + " :rtype: bool\n"; static int UnaryPredicate1D___init__(BPy_UnaryPredicate1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->up1D = new UnaryPredicate1D(); - self->up1D->py_up1D = (PyObject *)self; - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->up1D = new UnaryPredicate1D(); + self->up1D->py_up1D = (PyObject *)self; + return 0; } static void UnaryPredicate1D___dealloc__(BPy_UnaryPredicate1D *self) { - if (self->up1D) - delete self->up1D; - Py_TYPE(self)->tp_free((PyObject *)self); + if (self->up1D) + delete self->up1D; + Py_TYPE(self)->tp_free((PyObject *)self); } static PyObject *UnaryPredicate1D___repr__(BPy_UnaryPredicate1D *self) { - return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->up1D); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->up1D); } -static PyObject *UnaryPredicate1D___call__(BPy_UnaryPredicate1D *self, PyObject *args, PyObject *kwds) +static PyObject *UnaryPredicate1D___call__(BPy_UnaryPredicate1D *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"inter", NULL}; - PyObject *py_if1D; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &py_if1D)) - return NULL; - - Interface1D *if1D = ((BPy_Interface1D *)py_if1D)->if1D; - - if (!if1D) { - string class_name(Py_TYPE(self)->tp_name); - PyErr_SetString(PyExc_RuntimeError, (class_name + " has no Interface1D").c_str()); - return NULL; - } - if (typeid(*(self->up1D)) == typeid(UnaryPredicate1D)) { - PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; - } - if (self->up1D->operator()(*if1D) < 0) { - if (!PyErr_Occurred()) { - string class_name(Py_TYPE(self)->tp_name); - PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); - } - return NULL; - } - return PyBool_from_bool(self->up1D->result); + static const char *kwlist[] = {"inter", NULL}; + PyObject *py_if1D; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &py_if1D)) + return NULL; + + Interface1D *if1D = ((BPy_Interface1D *)py_if1D)->if1D; + + if (!if1D) { + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " has no Interface1D").c_str()); + return NULL; + } + if (typeid(*(self->up1D)) == typeid(UnaryPredicate1D)) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->up1D->operator()(*if1D) < 0) { + if (!PyErr_Occurred()) { + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); + } + return NULL; + } + return PyBool_from_bool(self->up1D->result); } /*----------------------UnaryPredicate1D get/setters ----------------------------*/ PyDoc_STRVAR(UnaryPredicate1D_name_doc, -"The name of the unary 1D predicate.\n" -"\n" -":type: str"); + "The name of the unary 1D predicate.\n" + "\n" + ":type: str"); static PyObject *UnaryPredicate1D_name_get(BPy_UnaryPredicate1D *self, void *UNUSED(closure)) { - return PyUnicode_FromString(Py_TYPE(self)->tp_name); + return PyUnicode_FromString(Py_TYPE(self)->tp_name); } static PyGetSetDef BPy_UnaryPredicate1D_getseters[] = { - {(char *)"name", (getter)UnaryPredicate1D_name_get, (setter)NULL, (char *)UnaryPredicate1D_name_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"name", + (getter)UnaryPredicate1D_name_get, + (setter)NULL, + (char *)UnaryPredicate1D_name_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_UnaryPredicate1D type definition ------------------------------*/ PyTypeObject UnaryPredicate1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryPredicate1D", /* tp_name */ - sizeof(BPy_UnaryPredicate1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryPredicate1D___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryPredicate1D___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryPredicate1D___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryPredicate1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_UnaryPredicate1D_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryPredicate1D___init__, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "UnaryPredicate1D", /* tp_name */ + sizeof(BPy_UnaryPredicate1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryPredicate1D___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryPredicate1D___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryPredicate1D___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryPredicate1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + BPy_UnaryPredicate1D_getseters, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryPredicate1D___init__, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.h b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.h index cd44569aac0..22358fab525 100644 --- a/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.h +++ b/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.h @@ -37,12 +37,12 @@ extern "C" { extern PyTypeObject UnaryPredicate1D_Type; -#define BPy_UnaryPredicate1D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryPredicate1D_Type)) +#define BPy_UnaryPredicate1D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryPredicate1D_Type)) /*---------------------------Python BPy_UnaryPredicate1D structure definition----------*/ typedef struct { - PyObject_HEAD - UnaryPredicate1D *up1D; + PyObject_HEAD UnaryPredicate1D *up1D; } BPy_UnaryPredicate1D; /*---------------------------Python BPy_UnaryPredicate1D visible prototypes-----------*/ diff --git a/source/blender/freestyle/intern/python/BPy_ViewMap.cpp b/source/blender/freestyle/intern/python/BPy_ViewMap.cpp index 39dd784bdfc..a46a63da03a 100644 --- a/source/blender/freestyle/intern/python/BPy_ViewMap.cpp +++ b/source/blender/freestyle/intern/python/BPy_ViewMap.cpp @@ -34,177 +34,183 @@ extern "C" { //-------------------MODULE INITIALIZATION-------------------------------- int ViewMap_Init(PyObject *module) { - if (module == NULL) - return -1; + if (module == NULL) + return -1; - if (PyType_Ready( &ViewMap_Type ) < 0) - return -1; - Py_INCREF(&ViewMap_Type); - PyModule_AddObject(module, "ViewMap", (PyObject *)&ViewMap_Type); + if (PyType_Ready(&ViewMap_Type) < 0) + return -1; + Py_INCREF(&ViewMap_Type); + PyModule_AddObject(module, "ViewMap", (PyObject *)&ViewMap_Type); - return 0; + return 0; } /*----------------------ViewMap methods----------------------------*/ PyDoc_STRVAR(ViewMap_doc, -"Class defining the ViewMap.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor."); + "Class defining the ViewMap.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor."); static int ViewMap_init(BPy_ViewMap *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->vm = new ViewMap(); - return 0; + 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) - delete self->vm; - Py_TYPE(self)->tp_free((PyObject *)self); + if (self->vm) + delete self->vm; + Py_TYPE(self)->tp_free((PyObject *)self); } static PyObject *ViewMap_repr(BPy_ViewMap *self) { - return PyUnicode_FromFormat("ViewMap - address: %p", self->vm); + return PyUnicode_FromFormat("ViewMap - address: %p", self->vm); } PyDoc_STRVAR(ViewMap_get_closest_viewedge_doc, -".. method:: get_closest_viewedge(x, y)\n" -"\n" -" Gets the ViewEdge nearest to the 2D point specified as arguments.\n" -"\n" -" :arg x: X coordinate of a 2D point.\n" -" :type x: float\n" -" :arg y: Y coordinate of a 2D point.\n" -" :type y: float\n" -" :return: The ViewEdge nearest to the specified 2D point.\n" -" :rtype: :class:`ViewEdge`"); + ".. method:: get_closest_viewedge(x, y)\n" + "\n" + " Gets the ViewEdge nearest to the 2D point specified as arguments.\n" + "\n" + " :arg x: X coordinate of a 2D point.\n" + " :type x: float\n" + " :arg y: Y coordinate of a 2D point.\n" + " :type y: float\n" + " :return: The ViewEdge nearest to the specified 2D point.\n" + " :rtype: :class:`ViewEdge`"); static PyObject *ViewMap_get_closest_viewedge(BPy_ViewMap *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"x", "y", NULL}; - double x, y; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "dd", (char **)kwlist, &x, &y)) - return NULL; - ViewEdge *ve = const_cast(self->vm->getClosestViewEdge(x, y)); - if (ve) - return BPy_ViewEdge_from_ViewEdge(*ve); - Py_RETURN_NONE; + static const char *kwlist[] = {"x", "y", NULL}; + double x, y; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "dd", (char **)kwlist, &x, &y)) + return NULL; + ViewEdge *ve = const_cast(self->vm->getClosestViewEdge(x, y)); + if (ve) + return BPy_ViewEdge_from_ViewEdge(*ve); + Py_RETURN_NONE; } PyDoc_STRVAR(ViewMap_get_closest_fedge_doc, -".. method:: get_closest_fedge(x, y)\n" -"\n" -" Gets the FEdge nearest to the 2D point specified as arguments.\n" -"\n" -" :arg x: X coordinate of a 2D point.\n" -" :type x: float\n" -" :arg y: Y coordinate of a 2D point.\n" -" :type y: float\n" -" :return: The FEdge nearest to the specified 2D point.\n" -" :rtype: :class:`FEdge`"); + ".. method:: get_closest_fedge(x, y)\n" + "\n" + " Gets the FEdge nearest to the 2D point specified as arguments.\n" + "\n" + " :arg x: X coordinate of a 2D point.\n" + " :type x: float\n" + " :arg y: Y coordinate of a 2D point.\n" + " :type y: float\n" + " :return: The FEdge nearest to the specified 2D point.\n" + " :rtype: :class:`FEdge`"); static PyObject *ViewMap_get_closest_fedge(BPy_ViewMap *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"x", "y", NULL}; - double x, y; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "dd", (char **)kwlist, &x, &y)) - return NULL; - FEdge *fe = const_cast(self->vm->getClosestFEdge(x, y)); - if (fe) - return Any_BPy_FEdge_from_FEdge(*fe); - Py_RETURN_NONE; + static const char *kwlist[] = {"x", "y", NULL}; + double x, y; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "dd", (char **)kwlist, &x, &y)) + return NULL; + FEdge *fe = const_cast(self->vm->getClosestFEdge(x, y)); + if (fe) + return Any_BPy_FEdge_from_FEdge(*fe); + Py_RETURN_NONE; } // static ViewMap *getInstance (); static PyMethodDef BPy_ViewMap_methods[] = { - {"get_closest_viewedge", (PyCFunction)ViewMap_get_closest_viewedge, METH_VARARGS | METH_KEYWORDS, - ViewMap_get_closest_viewedge_doc}, - {"get_closest_fedge", (PyCFunction)ViewMap_get_closest_fedge, METH_VARARGS | METH_KEYWORDS, - ViewMap_get_closest_fedge_doc}, - {NULL, NULL, 0, NULL}, + {"get_closest_viewedge", + (PyCFunction)ViewMap_get_closest_viewedge, + METH_VARARGS | METH_KEYWORDS, + ViewMap_get_closest_viewedge_doc}, + {"get_closest_fedge", + (PyCFunction)ViewMap_get_closest_fedge, + METH_VARARGS | METH_KEYWORDS, + ViewMap_get_closest_fedge_doc}, + {NULL, NULL, 0, NULL}, }; /*----------------------ViewMap get/setters ----------------------------*/ PyDoc_STRVAR(ViewMap_scene_bbox_doc, -"The 3D bounding box of the scene.\n" -"\n" -":type: :class:`BBox`"); + "The 3D bounding box of the scene.\n" + "\n" + ":type: :class:`BBox`"); static PyObject *ViewMap_scene_bbox_get(BPy_ViewMap *self, void *UNUSED(closure)) { - return BPy_BBox_from_BBox(self->vm->getScene3dBBox()); + return BPy_BBox_from_BBox(self->vm->getScene3dBBox()); } static int ViewMap_scene_bbox_set(BPy_ViewMap *self, PyObject *value, void *UNUSED(closure)) { - if (!BPy_BBox_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be a BBox"); - return -1; - } - self->vm->setScene3dBBox(*(((BPy_BBox *)value)->bb)); - return 0; + if (!BPy_BBox_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be a BBox"); + return -1; + } + self->vm->setScene3dBBox(*(((BPy_BBox *)value)->bb)); + return 0; } static PyGetSetDef BPy_ViewMap_getseters[] = { - {(char *)"scene_bbox", (getter)ViewMap_scene_bbox_get, (setter)ViewMap_scene_bbox_set, - (char *)ViewMap_scene_bbox_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"scene_bbox", + (getter)ViewMap_scene_bbox_get, + (setter)ViewMap_scene_bbox_set, + (char *)ViewMap_scene_bbox_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_ViewMap type definition ------------------------------*/ PyTypeObject ViewMap_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ViewMap", /* tp_name */ - sizeof(BPy_ViewMap), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)ViewMap_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)ViewMap_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ViewMap_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_ViewMap_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_ViewMap_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ViewMap_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "ViewMap", /* tp_name */ + sizeof(BPy_ViewMap), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)ViewMap_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)ViewMap_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ViewMap_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_ViewMap_methods, /* tp_methods */ + 0, /* tp_members */ + BPy_ViewMap_getseters, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ViewMap_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_ViewMap.h b/source/blender/freestyle/intern/python/BPy_ViewMap.h index f3659a096ab..fe1cd39deb3 100644 --- a/source/blender/freestyle/intern/python/BPy_ViewMap.h +++ b/source/blender/freestyle/intern/python/BPy_ViewMap.h @@ -41,8 +41,7 @@ extern PyTypeObject ViewMap_Type; /*---------------------------Python BPy_ViewMap structure definition----------*/ typedef struct { - PyObject_HEAD - ViewMap *vm; + PyObject_HEAD ViewMap *vm; } BPy_ViewMap; /*---------------------------Python BPy_ViewMap visible prototypes-----------*/ diff --git a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp index 1cd55f512f7..743a0ba79dc 100644 --- a/source/blender/freestyle/intern/python/BPy_ViewShape.cpp +++ b/source/blender/freestyle/intern/python/BPy_ViewShape.cpp @@ -35,336 +35,355 @@ extern "C" { int ViewShape_Init(PyObject *module) { - if (module == NULL) - return -1; + if (module == NULL) + return -1; - if (PyType_Ready(&ViewShape_Type) < 0) - return -1; - Py_INCREF(&ViewShape_Type); - PyModule_AddObject(module, "ViewShape", (PyObject *)&ViewShape_Type); + if (PyType_Ready(&ViewShape_Type) < 0) + return -1; + Py_INCREF(&ViewShape_Type); + PyModule_AddObject(module, "ViewShape", (PyObject *)&ViewShape_Type); - return 0; + return 0; } /*----------------------ViewShape methods ----------------------------*/ PyDoc_STRVAR(ViewShape_doc, -"Class gathering the elements of the ViewMap (i.e., :class:`ViewVertex`\n" -"and :class:`ViewEdge`) that are issued from the same input shape.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __init__(brother)\n" -"\n" -" Copy constructor.\n" -"\n" -" :arg brother: A ViewShape object.\n" -" :type brother: :class:`ViewShape`\n" -"\n" -".. method:: __init__(sshape)\n" -"\n" -" Builds a ViewShape from an SShape.\n" -"\n" -" :arg sshape: An SShape object.\n" -" :type sshape: :class:`SShape`"); + "Class gathering the elements of the ViewMap (i.e., :class:`ViewVertex`\n" + "and :class:`ViewEdge`) that are issued from the same input shape.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __init__(brother)\n" + "\n" + " Copy constructor.\n" + "\n" + " :arg brother: A ViewShape object.\n" + " :type brother: :class:`ViewShape`\n" + "\n" + ".. method:: __init__(sshape)\n" + "\n" + " Builds a ViewShape from an SShape.\n" + "\n" + " :arg sshape: An SShape object.\n" + " :type sshape: :class:`SShape`"); static int ViewShape_init(BPy_ViewShape *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"sshape", NULL}; - PyObject *obj = 0; - - if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &ViewShape_Type, &obj)) { - if (!obj) { - self->vs = new ViewShape(); - self->py_ss = NULL; - } - else { - self->vs = new ViewShape(*(((BPy_ViewShape *)obj)->vs)); - self->py_ss = ((BPy_ViewShape *)obj)->py_ss; - } - } - else if (PyErr_Clear(), - PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist_2, &SShape_Type, &obj)) - { - BPy_SShape *py_ss = (BPy_SShape *)obj; - self->vs = new ViewShape(py_ss->ss); - self->py_ss = (!py_ss->borrowed) ? py_ss : NULL; - } - else { - PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); - return -1; - } - self->borrowed = false; - Py_XINCREF(self->py_ss); - return 0; + static const char *kwlist_1[] = {"brother", NULL}; + static const char *kwlist_2[] = {"sshape", NULL}; + PyObject *obj = 0; + + if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &ViewShape_Type, &obj)) { + if (!obj) { + self->vs = new ViewShape(); + self->py_ss = NULL; + } + else { + self->vs = new ViewShape(*(((BPy_ViewShape *)obj)->vs)); + self->py_ss = ((BPy_ViewShape *)obj)->py_ss; + } + } + else if (PyErr_Clear(), + PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist_2, &SShape_Type, &obj)) { + BPy_SShape *py_ss = (BPy_SShape *)obj; + self->vs = new ViewShape(py_ss->ss); + self->py_ss = (!py_ss->borrowed) ? py_ss : NULL; + } + else { + PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); + return -1; + } + self->borrowed = false; + Py_XINCREF(self->py_ss); + return 0; } static void ViewShape_dealloc(BPy_ViewShape *self) { - if (self->py_ss) { - self->vs->setSShape((SShape *)NULL); - Py_DECREF(self->py_ss); - } - if (self->vs && !self->borrowed) - delete self->vs; - Py_TYPE(self)->tp_free((PyObject *)self); + if (self->py_ss) { + self->vs->setSShape((SShape *)NULL); + Py_DECREF(self->py_ss); + } + if (self->vs && !self->borrowed) + delete self->vs; + Py_TYPE(self)->tp_free((PyObject *)self); } static PyObject *ViewShape_repr(BPy_ViewShape *self) { - return PyUnicode_FromFormat("ViewShape - address: %p", self->vs); + return PyUnicode_FromFormat("ViewShape - address: %p", self->vs); } PyDoc_STRVAR(ViewShape_add_edge_doc, -".. method:: add_edge(edge)\n" -"\n" -" Adds a ViewEdge to the list of ViewEdge objects.\n" -"\n" -" :arg edge: A ViewEdge object.\n" -" :type edge: :class:`ViewEdge`\n"); + ".. method:: add_edge(edge)\n" + "\n" + " Adds a ViewEdge to the list of ViewEdge objects.\n" + "\n" + " :arg edge: A ViewEdge object.\n" + " :type edge: :class:`ViewEdge`\n"); static PyObject *ViewShape_add_edge(BPy_ViewShape *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"edge", NULL}; - PyObject *py_ve = 0; + static const char *kwlist[] = {"edge", NULL}; + PyObject *py_ve = 0; - 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; + 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; } PyDoc_STRVAR(ViewShape_add_vertex_doc, -".. method:: add_vertex(vertex)\n" -"\n" -" Adds a ViewVertex to the list of the ViewVertex objects.\n" -"\n" -" :arg vertex: A ViewVertex object.\n" -" :type vertex: :class:`ViewVertex`"); + ".. method:: add_vertex(vertex)\n" + "\n" + " Adds a ViewVertex to the list of the ViewVertex objects.\n" + "\n" + " :arg vertex: A ViewVertex object.\n" + " :type vertex: :class:`ViewVertex`"); static PyObject *ViewShape_add_vertex(BPy_ViewShape *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"vertex", NULL}; - PyObject *py_vv = 0; + static const char *kwlist[] = {"vertex", NULL}; + PyObject *py_vv = 0; - 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; + 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; } // virtual ViewShape *duplicate() static PyMethodDef BPy_ViewShape_methods[] = { - {"add_edge", (PyCFunction)ViewShape_add_edge, METH_VARARGS | METH_KEYWORDS, ViewShape_add_edge_doc}, - {"add_vertex", (PyCFunction)ViewShape_add_vertex, METH_VARARGS | METH_KEYWORDS, ViewShape_add_vertex_doc}, - {NULL, NULL, 0, NULL}, + {"add_edge", + (PyCFunction)ViewShape_add_edge, + METH_VARARGS | METH_KEYWORDS, + ViewShape_add_edge_doc}, + {"add_vertex", + (PyCFunction)ViewShape_add_vertex, + METH_VARARGS | METH_KEYWORDS, + ViewShape_add_vertex_doc}, + {NULL, NULL, 0, NULL}, }; /*----------------------ViewShape get/setters ----------------------------*/ PyDoc_STRVAR(ViewShape_sshape_doc, -"The SShape on top of which this ViewShape is built.\n" -"\n" -":type: :class:`SShape`"); + "The SShape on top of which this ViewShape is built.\n" + "\n" + ":type: :class:`SShape`"); static PyObject *ViewShape_sshape_get(BPy_ViewShape *self, void *UNUSED(closure)) { - SShape *ss = self->vs->sshape(); - if (!ss) - Py_RETURN_NONE; - return BPy_SShape_from_SShape(*ss); + SShape *ss = self->vs->sshape(); + if (!ss) + Py_RETURN_NONE; + return BPy_SShape_from_SShape(*ss); } static int ViewShape_sshape_set(BPy_ViewShape *self, PyObject *value, void *UNUSED(closure)) { - if (!BPy_SShape_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be an SShape"); - return -1; - } - BPy_SShape *py_ss = (BPy_SShape *)value; - self->vs->setSShape(py_ss->ss); - if (self->py_ss) - Py_DECREF(self->py_ss); - if (!py_ss->borrowed) { - self->py_ss = py_ss; - Py_INCREF(self->py_ss); - } - return 0; + if (!BPy_SShape_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an SShape"); + return -1; + } + BPy_SShape *py_ss = (BPy_SShape *)value; + self->vs->setSShape(py_ss->ss); + if (self->py_ss) + Py_DECREF(self->py_ss); + if (!py_ss->borrowed) { + self->py_ss = py_ss; + Py_INCREF(self->py_ss); + } + return 0; } PyDoc_STRVAR(ViewShape_vertices_doc, -"The list of ViewVertex objects contained in this ViewShape.\n" -"\n" -":type: List of :class:`ViewVertex` objects"); + "The list of ViewVertex objects contained in this ViewShape.\n" + "\n" + ":type: List of :class:`ViewVertex` objects"); static PyObject *ViewShape_vertices_get(BPy_ViewShape *self, void *UNUSED(closure)) { - vector vertices = self->vs->vertices(); - vector::iterator it; - PyObject *py_vertices = PyList_New(vertices.size()); - unsigned int i = 0; - - for (it = vertices.begin(); it != vertices.end(); it++) { - PyList_SET_ITEM(py_vertices, i++, Any_BPy_ViewVertex_from_ViewVertex(*(*it))); - } - return py_vertices; + vector vertices = self->vs->vertices(); + vector::iterator it; + PyObject *py_vertices = PyList_New(vertices.size()); + unsigned int i = 0; + + for (it = vertices.begin(); it != vertices.end(); it++) { + PyList_SET_ITEM(py_vertices, i++, Any_BPy_ViewVertex_from_ViewVertex(*(*it))); + } + return py_vertices; } static int ViewShape_vertices_set(BPy_ViewShape *self, PyObject *value, void *UNUSED(closure)) { - PyObject *item; - vector< ViewVertex *> v; - - if (!PyList_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be a list of ViewVertex objects"); - return -1; - } - - v.reserve(PyList_GET_SIZE(value)); - for (unsigned int i = 0; i < PyList_GET_SIZE(value); i++) { - item = PyList_GET_ITEM(value, i); - if (BPy_ViewVertex_Check(item)) { - v.push_back(((BPy_ViewVertex *)item)->vv); - } - else { - PyErr_SetString(PyExc_TypeError, "value must be a list of ViewVertex objects"); - return -1; - } - } - self->vs->setVertices(v); - return 0; + PyObject *item; + vector v; + + if (!PyList_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be a list of ViewVertex objects"); + return -1; + } + + v.reserve(PyList_GET_SIZE(value)); + for (unsigned int i = 0; i < PyList_GET_SIZE(value); i++) { + item = PyList_GET_ITEM(value, i); + if (BPy_ViewVertex_Check(item)) { + v.push_back(((BPy_ViewVertex *)item)->vv); + } + else { + PyErr_SetString(PyExc_TypeError, "value must be a list of ViewVertex objects"); + return -1; + } + } + self->vs->setVertices(v); + return 0; } PyDoc_STRVAR(ViewShape_edges_doc, -"The list of ViewEdge objects contained in this ViewShape.\n" -"\n" -":type: List of :class:`ViewEdge` objects"); + "The list of ViewEdge objects contained in this ViewShape.\n" + "\n" + ":type: List of :class:`ViewEdge` objects"); static PyObject *ViewShape_edges_get(BPy_ViewShape *self, void *UNUSED(closure)) { - vector edges = self->vs->edges(); - vector::iterator it; - PyObject *py_edges = PyList_New(edges.size()); - unsigned int i = 0; - - for (it = edges.begin(); it != edges.end(); it++) { - PyList_SET_ITEM(py_edges, i++, BPy_ViewEdge_from_ViewEdge(*(*it))); - } - return py_edges; + vector edges = self->vs->edges(); + vector::iterator it; + PyObject *py_edges = PyList_New(edges.size()); + unsigned int i = 0; + + for (it = edges.begin(); it != edges.end(); it++) { + PyList_SET_ITEM(py_edges, i++, BPy_ViewEdge_from_ViewEdge(*(*it))); + } + return py_edges; } static int ViewShape_edges_set(BPy_ViewShape *self, PyObject *value, void *UNUSED(closure)) { - PyObject *item; - vector v; - - if (!PyList_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be a list of ViewEdge objects"); - return -1; - } - - v.reserve(PyList_GET_SIZE(value)); - for (int i = 0; i < PyList_GET_SIZE(value); i++) { - item = PyList_GET_ITEM(value, i); - if (BPy_ViewEdge_Check(item)) { - v.push_back(((BPy_ViewEdge *)item)->ve); - } - else { - PyErr_SetString(PyExc_TypeError, "argument must be list of ViewEdge objects"); - return -1; - } - } - self->vs->setEdges(v); - return 0; + PyObject *item; + vector v; + + if (!PyList_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be a list of ViewEdge objects"); + return -1; + } + + v.reserve(PyList_GET_SIZE(value)); + for (int i = 0; i < PyList_GET_SIZE(value); i++) { + item = PyList_GET_ITEM(value, i); + if (BPy_ViewEdge_Check(item)) { + v.push_back(((BPy_ViewEdge *)item)->ve); + } + else { + PyErr_SetString(PyExc_TypeError, "argument must be list of ViewEdge objects"); + return -1; + } + } + self->vs->setEdges(v); + return 0; } PyDoc_STRVAR(ViewShape_name_doc, -"The name of the ViewShape.\n" -"\n" -":type: str"); + "The name of the ViewShape.\n" + "\n" + ":type: str"); static PyObject *ViewShape_name_get(BPy_ViewShape *self, void *UNUSED(closure)) { - return PyUnicode_FromString(self->vs->getName().c_str()); + return PyUnicode_FromString(self->vs->getName().c_str()); } PyDoc_STRVAR(ViewShape_library_path_doc, -"The library path of the ViewShape.\n" -"\n" -":type: str, or None if the ViewShape is not part of a library"); + "The library path of the ViewShape.\n" + "\n" + ":type: str, or None if the ViewShape is not part of a library"); static PyObject *ViewShape_library_path_get(BPy_ViewShape *self, void *UNUSED(closure)) { - return PyUnicode_FromString(self->vs->getLibraryPath().c_str()); + return PyUnicode_FromString(self->vs->getLibraryPath().c_str()); } PyDoc_STRVAR(ViewShape_id_doc, -"The Id of this ViewShape.\n" -"\n" -":type: :class:`Id`"); + "The Id of this ViewShape.\n" + "\n" + ":type: :class:`Id`"); static PyObject *ViewShape_id_get(BPy_ViewShape *self, void *UNUSED(closure)) { - Id id(self->vs->getId()); - return BPy_Id_from_Id(id); // return a copy + Id id(self->vs->getId()); + return BPy_Id_from_Id(id); // return a copy } static PyGetSetDef BPy_ViewShape_getseters[] = { - {(char *)"sshape", (getter)ViewShape_sshape_get, (setter)ViewShape_sshape_set, (char *)ViewShape_sshape_doc, NULL}, - {(char *)"vertices", (getter)ViewShape_vertices_get, (setter)ViewShape_vertices_set, - (char *)ViewShape_vertices_doc, NULL}, - {(char *)"edges", (getter)ViewShape_edges_get, (setter)ViewShape_edges_set, (char *)ViewShape_edges_doc, NULL}, - {(char *)"name", (getter)ViewShape_name_get, (setter)NULL, (char *)ViewShape_name_doc, NULL}, - {(char *)"library_path", (getter)ViewShape_library_path_get, (setter)NULL, (char *)ViewShape_library_path_doc, NULL}, - {(char *)"id", (getter)ViewShape_id_get, (setter)NULL, (char *)ViewShape_id_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"sshape", + (getter)ViewShape_sshape_get, + (setter)ViewShape_sshape_set, + (char *)ViewShape_sshape_doc, + NULL}, + {(char *)"vertices", + (getter)ViewShape_vertices_get, + (setter)ViewShape_vertices_set, + (char *)ViewShape_vertices_doc, + NULL}, + {(char *)"edges", + (getter)ViewShape_edges_get, + (setter)ViewShape_edges_set, + (char *)ViewShape_edges_doc, + NULL}, + {(char *)"name", (getter)ViewShape_name_get, (setter)NULL, (char *)ViewShape_name_doc, NULL}, + {(char *)"library_path", + (getter)ViewShape_library_path_get, + (setter)NULL, + (char *)ViewShape_library_path_doc, + NULL}, + {(char *)"id", (getter)ViewShape_id_get, (setter)NULL, (char *)ViewShape_id_doc, NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_ViewShape type definition ------------------------------*/ PyTypeObject ViewShape_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ViewShape", /* tp_name */ - sizeof(BPy_ViewShape), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)ViewShape_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)ViewShape_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ViewShape_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_ViewShape_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_ViewShape_getseters, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ViewShape_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "ViewShape", /* tp_name */ + sizeof(BPy_ViewShape), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)ViewShape_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)ViewShape_repr, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ViewShape_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_ViewShape_methods, /* tp_methods */ + 0, /* tp_members */ + BPy_ViewShape_getseters, /* tp_getset */ + 0, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ViewShape_init, /* tp_init */ + 0, /* tp_alloc */ + PyType_GenericNew, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BPy_ViewShape.h b/source/blender/freestyle/intern/python/BPy_ViewShape.h index 551e16c4438..3158353136f 100644 --- a/source/blender/freestyle/intern/python/BPy_ViewShape.h +++ b/source/blender/freestyle/intern/python/BPy_ViewShape.h @@ -43,10 +43,9 @@ extern PyTypeObject ViewShape_Type; /*---------------------------Python BPy_ViewShape structure definition----------*/ typedef struct { - PyObject_HEAD - ViewShape *vs; - bool borrowed; /* true if *vs a borrowed object */ - BPy_SShape *py_ss; + PyObject_HEAD ViewShape *vs; + bool borrowed; /* true if *vs a borrowed object */ + BPy_SShape *py_ss; } BPy_ViewShape; /*---------------------------Python BPy_ViewShape visible prototypes-----------*/ diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp index 0a84e3d5144..f8b2d5a1ab5 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.cpp @@ -29,69 +29,68 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char FalseBP1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.BinaryPredicate1D` > :class:`FalseBP1D`\n" -"\n" -".. method:: __call__(inter1, inter2)\n" -"\n" -" Always returns false.\n" -"\n" -" :arg inter1: The first Interface1D object.\n" -" :type inter1: :class:`freestyle.types.Interface1D`\n" -" :arg inter2: The second Interface1D object.\n" -" :type inter2: :class:`freestyle.types.Interface1D`\n" -" :return: False.\n" -" :rtype: bool\n"; + "Class hierarchy: :class:`freestyle.types.BinaryPredicate1D` > :class:`FalseBP1D`\n" + "\n" + ".. method:: __call__(inter1, inter2)\n" + "\n" + " Always returns false.\n" + "\n" + " :arg inter1: The first Interface1D object.\n" + " :type inter1: :class:`freestyle.types.Interface1D`\n" + " :arg inter2: The second Interface1D object.\n" + " :type inter2: :class:`freestyle.types.Interface1D`\n" + " :return: False.\n" + " :rtype: bool\n"; static int FalseBP1D___init__(BPy_FalseBP1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->py_bp1D.bp1D = new Predicates1D::FalseBP1D(); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->py_bp1D.bp1D = new Predicates1D::FalseBP1D(); + return 0; } /*-----------------------BPy_FalseBP1D type definition ------------------------------*/ PyTypeObject FalseBP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "FalseBP1D", /* tp_name */ - sizeof(BPy_FalseBP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - FalseBP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &BinaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)FalseBP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "FalseBP1D", /* tp_name */ + sizeof(BPy_FalseBP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + FalseBP1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &BinaryPredicate1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)FalseBP1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.h b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.h index 120cda356c4..abb9eca9b30 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.h +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_FalseBP1D.h @@ -35,7 +35,7 @@ extern PyTypeObject FalseBP1D_Type; /*---------------------------Python BPy_FalseBP1D structure definition----------*/ typedef struct { - BPy_BinaryPredicate1D py_bp1D; + BPy_BinaryPredicate1D py_bp1D; } BPy_FalseBP1D; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp index 50046fa0e1c..7387252bfd0 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.cpp @@ -29,71 +29,70 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char Length2DBP1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.BinaryPredicate1D` > :class:`Length2DBP1D`\n" -"\n" -".. method:: __call__(inter1, inter2)\n" -"\n" -" Returns true if the 2D length of inter1 is less than the 2D length\n" -" of inter2.\n" -"\n" -" :arg inter1: The first Interface1D object.\n" -" :type inter1: :class:`freestyle.types.Interface1D`\n" -" :arg inter2: The second Interface1D object.\n" -" :type inter2: :class:`freestyle.types.Interface1D`\n" -" :return: True or false.\n" -" :rtype: bool\n"; + "Class hierarchy: :class:`freestyle.types.BinaryPredicate1D` > :class:`Length2DBP1D`\n" + "\n" + ".. method:: __call__(inter1, inter2)\n" + "\n" + " Returns true if the 2D length of inter1 is less than the 2D length\n" + " of inter2.\n" + "\n" + " :arg inter1: The first Interface1D object.\n" + " :type inter1: :class:`freestyle.types.Interface1D`\n" + " :arg inter2: The second Interface1D object.\n" + " :type inter2: :class:`freestyle.types.Interface1D`\n" + " :return: True or false.\n" + " :rtype: bool\n"; static int Length2DBP1D___init__(BPy_Length2DBP1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->py_bp1D.bp1D = new Predicates1D::Length2DBP1D(); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->py_bp1D.bp1D = new Predicates1D::Length2DBP1D(); + return 0; } /*-----------------------BPy_Length2DBP1D type definition ------------------------------*/ PyTypeObject Length2DBP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "Length2DBP1D", /* tp_name */ - sizeof(BPy_Length2DBP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Length2DBP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &BinaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Length2DBP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "Length2DBP1D", /* tp_name */ + sizeof(BPy_Length2DBP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Length2DBP1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &BinaryPredicate1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Length2DBP1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.h b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.h index 3e73dfa9ad4..6ad2373c570 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.h +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_Length2DBP1D.h @@ -31,11 +31,12 @@ extern "C" { extern PyTypeObject Length2DBP1D_Type; -#define BPy_Length2DBP1D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&Length2DBP1D_Type)) +#define BPy_Length2DBP1D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&Length2DBP1D_Type)) /*---------------------------Python BPy_Length2DBP1D structure definition----------*/ typedef struct { - BPy_BinaryPredicate1D py_bp1D; + BPy_BinaryPredicate1D py_bp1D; } BPy_Length2DBP1D; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp index cee814e62de..005bbded74f 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.cpp @@ -29,70 +29,69 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char SameShapeIdBP1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.BinaryPredicate1D` > :class:`SameShapeIdBP1D`\n" -"\n" -".. method:: __call__(inter1, inter2)\n" -"\n" -" Returns true if inter1 and inter2 belong to the same shape.\n" -"\n" -" :arg inter1: The first Interface1D object.\n" -" :type inter1: :class:`freestyle.types.Interface1D`\n" -" :arg inter2: The second Interface1D object.\n" -" :type inter2: :class:`freestyle.types.Interface1D`\n" -" :return: True or false.\n" -" :rtype: bool\n"; + "Class hierarchy: :class:`freestyle.types.BinaryPredicate1D` > :class:`SameShapeIdBP1D`\n" + "\n" + ".. method:: __call__(inter1, inter2)\n" + "\n" + " Returns true if inter1 and inter2 belong to the same shape.\n" + "\n" + " :arg inter1: The first Interface1D object.\n" + " :type inter1: :class:`freestyle.types.Interface1D`\n" + " :arg inter2: The second Interface1D object.\n" + " :type inter2: :class:`freestyle.types.Interface1D`\n" + " :return: True or false.\n" + " :rtype: bool\n"; static int SameShapeIdBP1D___init__(BPy_SameShapeIdBP1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->py_bp1D.bp1D = new Predicates1D::SameShapeIdBP1D(); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->py_bp1D.bp1D = new Predicates1D::SameShapeIdBP1D(); + return 0; } /*-----------------------BPy_SameShapeIdBP1D type definition ------------------------------*/ PyTypeObject SameShapeIdBP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SameShapeIdBP1D", /* tp_name */ - sizeof(BPy_SameShapeIdBP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - SameShapeIdBP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &BinaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)SameShapeIdBP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "SameShapeIdBP1D", /* tp_name */ + sizeof(BPy_SameShapeIdBP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + SameShapeIdBP1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &BinaryPredicate1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)SameShapeIdBP1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.h b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.h index f20c4b48fb8..75fc5eaa271 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.h +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_SameShapeIdBP1D.h @@ -31,11 +31,12 @@ extern "C" { extern PyTypeObject SameShapeIdBP1D_Type; -#define BPy_SameShapeIdBP1D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&SameShapeIdBP1D_Type)) +#define BPy_SameShapeIdBP1D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&SameShapeIdBP1D_Type)) /*---------------------------Python BPy_SameShapeIdBP1D structure definition----------*/ typedef struct { - BPy_BinaryPredicate1D py_bp1D; + BPy_BinaryPredicate1D py_bp1D; } BPy_SameShapeIdBP1D; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp index 1375aa2d549..363c0386915 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.cpp @@ -29,70 +29,69 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char TrueBP1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.BinaryPredicate1D` > :class:`TrueBP1D`\n" -"\n" -".. method:: __call__(inter1, inter2)\n" -"\n" -" Always returns true.\n" -"\n" -" :arg inter1: The first Interface1D object.\n" -" :type inter1: :class:`freestyle.types.Interface1D`\n" -" :arg inter2: The second Interface1D object.\n" -" :type inter2: :class:`freestyle.types.Interface1D`\n" -" :return: True.\n" -" :rtype: bool\n"; + "Class hierarchy: :class:`freestyle.types.BinaryPredicate1D` > :class:`TrueBP1D`\n" + "\n" + ".. method:: __call__(inter1, inter2)\n" + "\n" + " Always returns true.\n" + "\n" + " :arg inter1: The first Interface1D object.\n" + " :type inter1: :class:`freestyle.types.Interface1D`\n" + " :arg inter2: The second Interface1D object.\n" + " :type inter2: :class:`freestyle.types.Interface1D`\n" + " :return: True.\n" + " :rtype: bool\n"; static int TrueBP1D___init__(BPy_TrueBP1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->py_bp1D.bp1D = new Predicates1D::TrueBP1D(); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->py_bp1D.bp1D = new Predicates1D::TrueBP1D(); + return 0; } /*-----------------------BPy_TrueBP1D type definition ------------------------------*/ PyTypeObject TrueBP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "TrueBP1D", /* tp_name */ - sizeof(BPy_TrueBP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - TrueBP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &BinaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)TrueBP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "TrueBP1D", /* tp_name */ + sizeof(BPy_TrueBP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + TrueBP1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &BinaryPredicate1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)TrueBP1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.h b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.h index 66fb7bc254d..ed6a783fa47 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.h +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_TrueBP1D.h @@ -35,7 +35,7 @@ extern PyTypeObject TrueBP1D_Type; /*---------------------------Python BPy_TrueBP1D structure definition----------*/ typedef struct { - BPy_BinaryPredicate1D py_bp1D; + BPy_BinaryPredicate1D py_bp1D; } BPy_TrueBP1D; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp index a7e5e7295a2..2068fe820d0 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.cpp @@ -34,91 +34,94 @@ extern "C" { //ViewMapGradientNormBP1D(int level, IntegrationType iType=MEAN, float sampling=2.0) static char ViewMapGradientNormBP1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.BinaryPredicate1D` > :class:`ViewMapGradientNormBP1D`\n" -"\n" -".. method:: __init__(level, integration_type=IntegrationType.MEAN, sampling=2.0)\n" -"\n" -" Builds a ViewMapGradientNormBP1D object.\n" -"\n" -" :arg level: The level of the pyramid from which the pixel must be\n" -" read.\n" -" :type level: int\n" -" :arg integration_type: The integration method used to compute a single value\n" -" from a set of values.\n" -" :type integration_type: :class:`freestyle.types.IntegrationType`\n" -" :arg sampling: The resolution used to sample the chain:\n" -" GetViewMapGradientNormF0D is evaluated at each sample point and\n" -" the result is obtained by combining the resulting values into a\n" -" single one, following the method specified by integration_type.\n" -" :type sampling: float\n" -"\n" -".. method:: __call__(inter1, inter2)\n" -"\n" -" Returns true if the evaluation of the Gradient norm Function is\n" -" higher for inter1 than for inter2.\n" -"\n" -" :arg inter1: The first Interface1D object.\n" -" :type inter1: :class:`freestyle.types.Interface1D`\n" -" :arg inter2: The second Interface1D object.\n" -" :type inter2: :class:`freestyle.types.Interface1D`\n" -" :return: True or false.\n" -" :rtype: bool\n"; + "Class hierarchy: :class:`freestyle.types.BinaryPredicate1D` > " + ":class:`ViewMapGradientNormBP1D`\n" + "\n" + ".. method:: __init__(level, integration_type=IntegrationType.MEAN, sampling=2.0)\n" + "\n" + " Builds a ViewMapGradientNormBP1D object.\n" + "\n" + " :arg level: The level of the pyramid from which the pixel must be\n" + " read.\n" + " :type level: int\n" + " :arg integration_type: The integration method used to compute a single value\n" + " from a set of values.\n" + " :type integration_type: :class:`freestyle.types.IntegrationType`\n" + " :arg sampling: The resolution used to sample the chain:\n" + " GetViewMapGradientNormF0D is evaluated at each sample point and\n" + " the result is obtained by combining the resulting values into a\n" + " single one, following the method specified by integration_type.\n" + " :type sampling: float\n" + "\n" + ".. method:: __call__(inter1, inter2)\n" + "\n" + " Returns true if the evaluation of the Gradient norm Function is\n" + " higher for inter1 than for inter2.\n" + "\n" + " :arg inter1: The first Interface1D object.\n" + " :type inter1: :class:`freestyle.types.Interface1D`\n" + " :arg inter2: The second Interface1D object.\n" + " :type inter2: :class:`freestyle.types.Interface1D`\n" + " :return: True or false.\n" + " :rtype: bool\n"; -static int ViewMapGradientNormBP1D___init__(BPy_ViewMapGradientNormBP1D *self, PyObject *args, PyObject *kwds) +static int ViewMapGradientNormBP1D___init__(BPy_ViewMapGradientNormBP1D *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"level", "integration_type", "sampling", NULL}; - PyObject *obj = 0; - int i; - float f = 2.0; + static const char *kwlist[] = {"level", "integration_type", "sampling", NULL}; + PyObject *obj = 0; + int i; + float f = 2.0; - if (!PyArg_ParseTupleAndKeywords(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; + if (!PyArg_ParseTupleAndKeywords( + 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; } /*-----------------------BPy_ViewMapGradientNormBP1D type definition ------------------------------*/ PyTypeObject ViewMapGradientNormBP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ViewMapGradientNormBP1D", /* tp_name */ - sizeof(BPy_ViewMapGradientNormBP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ViewMapGradientNormBP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &BinaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ViewMapGradientNormBP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "ViewMapGradientNormBP1D", /* tp_name */ + sizeof(BPy_ViewMapGradientNormBP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ViewMapGradientNormBP1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &BinaryPredicate1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ViewMapGradientNormBP1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.h b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.h index 7d7fce837db..1a451a688fb 100644 --- a/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.h +++ b/source/blender/freestyle/intern/python/BinaryPredicate1D/BPy_ViewMapGradientNormBP1D.h @@ -32,11 +32,11 @@ extern "C" { extern PyTypeObject ViewMapGradientNormBP1D_Type; #define BPy_ViewMapGradientNormBP1D_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&ViewMapGradientNormBP1D_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&ViewMapGradientNormBP1D_Type)) /*---------------------------Python BPy_ViewMapGradientNormBP1D structure definition----------*/ typedef struct { - BPy_BinaryPredicate1D py_bp1D; + BPy_BinaryPredicate1D py_bp1D; } BPy_ViewMapGradientNormBP1D; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Director.cpp b/source/blender/freestyle/intern/python/Director.cpp index f4e174af761..c86602c78b1 100644 --- a/source/blender/freestyle/intern/python/Director.cpp +++ b/source/blender/freestyle/intern/python/Director.cpp @@ -57,271 +57,275 @@ #include "UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.h" // BinaryPredicate0D: __call__ -int Director_BPy_BinaryPredicate0D___call__(BinaryPredicate0D *bp0D, Interface0D& i1, Interface0D& i2) +int Director_BPy_BinaryPredicate0D___call__(BinaryPredicate0D *bp0D, + Interface0D &i1, + Interface0D &i2) { - if (!bp0D->py_bp0D) { // internal error - PyErr_SetString(PyExc_RuntimeError, "Reference to Python object (py_bp0D) not initialized"); - return -1; - } - PyObject *arg1 = Any_BPy_Interface0D_from_Interface0D(i1); - PyObject *arg2 = Any_BPy_Interface0D_from_Interface0D(i2); - if (!arg1 || !arg2) { - Py_XDECREF(arg1); - Py_XDECREF(arg2); - return -1; - } - PyObject *result = PyObject_CallMethod((PyObject *)bp0D->py_bp0D, "__call__", "OO", arg1, arg2); - Py_DECREF(arg1); - Py_DECREF(arg2); - if (!result) - return -1; - int ret = PyObject_IsTrue(result); - Py_DECREF(result); - if (ret < 0) - return -1; - bp0D->result = ret; - return 0; + if (!bp0D->py_bp0D) { // internal error + PyErr_SetString(PyExc_RuntimeError, "Reference to Python object (py_bp0D) not initialized"); + return -1; + } + PyObject *arg1 = Any_BPy_Interface0D_from_Interface0D(i1); + PyObject *arg2 = Any_BPy_Interface0D_from_Interface0D(i2); + if (!arg1 || !arg2) { + Py_XDECREF(arg1); + Py_XDECREF(arg2); + return -1; + } + PyObject *result = PyObject_CallMethod((PyObject *)bp0D->py_bp0D, "__call__", "OO", arg1, arg2); + Py_DECREF(arg1); + Py_DECREF(arg2); + if (!result) + return -1; + int ret = PyObject_IsTrue(result); + Py_DECREF(result); + if (ret < 0) + return -1; + bp0D->result = ret; + return 0; } // BinaryPredicate1D: __call__ -int Director_BPy_BinaryPredicate1D___call__(BinaryPredicate1D *bp1D, Interface1D& i1, Interface1D& i2) +int Director_BPy_BinaryPredicate1D___call__(BinaryPredicate1D *bp1D, + Interface1D &i1, + Interface1D &i2) { - if (!bp1D->py_bp1D) { // internal error - PyErr_SetString(PyExc_RuntimeError, "Reference to Python object (py_bp1D) not initialized"); - return -1; - } - PyObject *arg1 = Any_BPy_Interface1D_from_Interface1D(i1); - PyObject *arg2 = Any_BPy_Interface1D_from_Interface1D(i2); - if (!arg1 || !arg2) { - Py_XDECREF(arg1); - Py_XDECREF(arg2); - return -1; - } - PyObject *result = PyObject_CallMethod((PyObject *)bp1D->py_bp1D, "__call__", "OO", arg1, arg2); - Py_DECREF(arg1); - Py_DECREF(arg2); - if (!result) - return -1; - int ret = PyObject_IsTrue(result); - Py_DECREF(result); - if (ret < 0) - return -1; - bp1D->result = ret; - return 0; + if (!bp1D->py_bp1D) { // internal error + PyErr_SetString(PyExc_RuntimeError, "Reference to Python object (py_bp1D) not initialized"); + return -1; + } + PyObject *arg1 = Any_BPy_Interface1D_from_Interface1D(i1); + PyObject *arg2 = Any_BPy_Interface1D_from_Interface1D(i2); + if (!arg1 || !arg2) { + Py_XDECREF(arg1); + Py_XDECREF(arg2); + return -1; + } + PyObject *result = PyObject_CallMethod((PyObject *)bp1D->py_bp1D, "__call__", "OO", arg1, arg2); + Py_DECREF(arg1); + Py_DECREF(arg2); + if (!result) + return -1; + int ret = PyObject_IsTrue(result); + Py_DECREF(result); + if (ret < 0) + return -1; + bp1D->result = ret; + return 0; } // UnaryPredicate0D: __call__ -int Director_BPy_UnaryPredicate0D___call__(UnaryPredicate0D *up0D, Interface0DIterator& if0D_it) +int Director_BPy_UnaryPredicate0D___call__(UnaryPredicate0D *up0D, Interface0DIterator &if0D_it) { - if (!up0D->py_up0D) { // internal error - PyErr_SetString(PyExc_RuntimeError, "Reference to Python object (py_up0D) not initialized"); - return -1; - } - PyObject *arg = BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, false); - if (!arg) - return -1; - PyObject *result = PyObject_CallMethod((PyObject *)up0D->py_up0D, "__call__", "O", arg); - Py_DECREF(arg); - if (!result) - return -1; - int ret = PyObject_IsTrue(result); - Py_DECREF(result); - if (ret < 0) - return -1; - up0D->result = ret; - return 0; + if (!up0D->py_up0D) { // internal error + PyErr_SetString(PyExc_RuntimeError, "Reference to Python object (py_up0D) not initialized"); + return -1; + } + PyObject *arg = BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, false); + if (!arg) + return -1; + PyObject *result = PyObject_CallMethod((PyObject *)up0D->py_up0D, "__call__", "O", arg); + Py_DECREF(arg); + if (!result) + return -1; + int ret = PyObject_IsTrue(result); + Py_DECREF(result); + if (ret < 0) + return -1; + up0D->result = ret; + return 0; } // UnaryPredicate1D: __call__ -int Director_BPy_UnaryPredicate1D___call__(UnaryPredicate1D *up1D, Interface1D& if1D) +int Director_BPy_UnaryPredicate1D___call__(UnaryPredicate1D *up1D, Interface1D &if1D) { - if (!up1D->py_up1D) { // internal error - PyErr_SetString(PyExc_RuntimeError, "Reference to Python object (py_up1D) not initialized"); - return -1; - } - PyObject *arg = Any_BPy_Interface1D_from_Interface1D(if1D); - if (!arg) - return -1; - PyObject *result = PyObject_CallMethod((PyObject *)up1D->py_up1D, "__call__", "O", arg); - Py_DECREF(arg); - if (!result) - return -1; - int ret = PyObject_IsTrue(result); - Py_DECREF(result); - if (ret < 0) - return -1; - up1D->result = ret; - return 0; + if (!up1D->py_up1D) { // internal error + PyErr_SetString(PyExc_RuntimeError, "Reference to Python object (py_up1D) not initialized"); + return -1; + } + PyObject *arg = Any_BPy_Interface1D_from_Interface1D(if1D); + if (!arg) + return -1; + PyObject *result = PyObject_CallMethod((PyObject *)up1D->py_up1D, "__call__", "O", arg); + Py_DECREF(arg); + if (!result) + return -1; + int ret = PyObject_IsTrue(result); + Py_DECREF(result); + if (ret < 0) + return -1; + up1D->result = ret; + return 0; } // StrokeShader: shade -int Director_BPy_StrokeShader_shade(StrokeShader *ss, Stroke& s) +int Director_BPy_StrokeShader_shade(StrokeShader *ss, Stroke &s) { - if (!ss->py_ss) { // internal error - PyErr_SetString(PyExc_RuntimeError, "Reference to Python object (py_ss) not initialized"); - return -1; - } - PyObject *arg = BPy_Stroke_from_Stroke(s); - if (!arg) - return -1; - PyObject *result = PyObject_CallMethod((PyObject *)ss->py_ss, "shade", "O", arg); - Py_DECREF(arg); - if (!result) - return -1; - Py_DECREF(result); - return 0; + if (!ss->py_ss) { // internal error + PyErr_SetString(PyExc_RuntimeError, "Reference to Python object (py_ss) not initialized"); + return -1; + } + PyObject *arg = BPy_Stroke_from_Stroke(s); + if (!arg) + return -1; + PyObject *result = PyObject_CallMethod((PyObject *)ss->py_ss, "shade", "O", arg); + Py_DECREF(arg); + if (!result) + return -1; + Py_DECREF(result); + return 0; } // ChainingIterator: init, traverse int Director_BPy_ChainingIterator_init(ChainingIterator *c_it) { - if (!c_it->py_c_it) { // internal error - PyErr_SetString(PyExc_RuntimeError, "Reference to Python object (py_c_it) not initialized"); - return -1; - } - PyObject *result = PyObject_CallMethod((PyObject *)c_it->py_c_it, "init", NULL); - if (!result) - return -1; - Py_DECREF(result); - return 0; + if (!c_it->py_c_it) { // internal error + PyErr_SetString(PyExc_RuntimeError, "Reference to Python object (py_c_it) not initialized"); + return -1; + } + PyObject *result = PyObject_CallMethod((PyObject *)c_it->py_c_it, "init", NULL); + if (!result) + return -1; + Py_DECREF(result); + return 0; } -int Director_BPy_ChainingIterator_traverse(ChainingIterator *c_it, AdjacencyIterator& a_it) +int Director_BPy_ChainingIterator_traverse(ChainingIterator *c_it, AdjacencyIterator &a_it) { - if (!c_it->py_c_it) { // internal error - PyErr_SetString(PyExc_RuntimeError, "Reference to Python object (py_c_it) not initialized"); - return -1; - } - PyObject *arg = BPy_AdjacencyIterator_from_AdjacencyIterator(a_it); - if (!arg) - return -1; - PyObject *result = PyObject_CallMethod((PyObject *)c_it->py_c_it, "traverse", "O", arg); - Py_DECREF(arg); - if (!result) - return -1; - if (BPy_ViewEdge_Check(result)) { - c_it->result = ((BPy_ViewEdge *)result)->ve; - } - else if (result == Py_None) { - c_it->result = NULL; - } - else { - PyErr_SetString(PyExc_RuntimeError, "traverse method returned a wrong value"); - Py_DECREF(result); - return -1; - } - Py_DECREF(result); - return 0; + if (!c_it->py_c_it) { // internal error + PyErr_SetString(PyExc_RuntimeError, "Reference to Python object (py_c_it) not initialized"); + return -1; + } + PyObject *arg = BPy_AdjacencyIterator_from_AdjacencyIterator(a_it); + if (!arg) + return -1; + PyObject *result = PyObject_CallMethod((PyObject *)c_it->py_c_it, "traverse", "O", arg); + Py_DECREF(arg); + if (!result) + return -1; + if (BPy_ViewEdge_Check(result)) { + c_it->result = ((BPy_ViewEdge *)result)->ve; + } + else if (result == Py_None) { + c_it->result = NULL; + } + else { + PyErr_SetString(PyExc_RuntimeError, "traverse method returned a wrong value"); + Py_DECREF(result); + return -1; + } + Py_DECREF(result); + return 0; } // BPy_UnaryFunction{0D,1D}: __call__ -int Director_BPy_UnaryFunction0D___call__(void *uf0D, void *py_uf0D, Interface0DIterator& if0D_it) +int Director_BPy_UnaryFunction0D___call__(void *uf0D, void *py_uf0D, Interface0DIterator &if0D_it) { - if (!py_uf0D) { // internal error - PyErr_SetString(PyExc_RuntimeError, "Reference to Python object (py_uf0D) not initialized"); - return -1; - } - PyObject *obj = (PyObject *)py_uf0D; - PyObject *arg = BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, false); - if (!arg) - return -1; - PyObject *result = PyObject_CallMethod(obj, "__call__", "O", arg); - Py_DECREF(arg); - if (!result) - return -1; - if (BPy_UnaryFunction0DDouble_Check(obj)) { - ((UnaryFunction0D *)uf0D)->result = PyFloat_AsDouble(result); - } - else if (BPy_UnaryFunction0DEdgeNature_Check(obj)) { - ((UnaryFunction0D *)uf0D)->result = EdgeNature_from_BPy_Nature(result); - } - else if (BPy_UnaryFunction0DFloat_Check(obj)) { - ((UnaryFunction0D *)uf0D)->result = PyFloat_AsDouble(result); - } - else if (BPy_UnaryFunction0DId_Check(obj)) { - ((UnaryFunction0D *)uf0D)->result = *(((BPy_Id *)result)->id); - } - else if (BPy_UnaryFunction0DMaterial_Check(obj)) { - ((UnaryFunction0D *)uf0D)->result = *(((BPy_FrsMaterial *)result)->m); - } - else if (BPy_UnaryFunction0DUnsigned_Check(obj)) { - ((UnaryFunction0D *)uf0D)->result = PyLong_AsLong(result); - } - else if (BPy_UnaryFunction0DVec2f_Check(obj)) { - Vec2f vec; - if (!Vec2f_ptr_from_Vector(result, vec)) - return -1; - ((UnaryFunction0D *)uf0D)->result = vec; - } - else if (BPy_UnaryFunction0DVec3f_Check(obj)) { - Vec3f vec; - if (!Vec3f_ptr_from_Vector(result, vec)) - return -1; - ((UnaryFunction0D *)uf0D)->result = vec; - } - else if (BPy_UnaryFunction0DVectorViewShape_Check(obj)) { - vector vec; - vec.reserve(PyList_Size(result)); - for (int i = 0; i < PyList_Size(result); i++) { - ViewShape *b = ((BPy_ViewShape *)PyList_GET_ITEM(result, i))->vs; - vec.push_back(b); - } - ((UnaryFunction0D< vector > *)uf0D)->result = vec; - } - else if (BPy_UnaryFunction0DViewShape_Check(obj)) { - ((UnaryFunction0D *)uf0D)->result = ((BPy_ViewShape *)result)->vs; - } - Py_DECREF(result); - return 0; + if (!py_uf0D) { // internal error + PyErr_SetString(PyExc_RuntimeError, "Reference to Python object (py_uf0D) not initialized"); + return -1; + } + PyObject *obj = (PyObject *)py_uf0D; + PyObject *arg = BPy_Interface0DIterator_from_Interface0DIterator(if0D_it, false); + if (!arg) + return -1; + PyObject *result = PyObject_CallMethod(obj, "__call__", "O", arg); + Py_DECREF(arg); + if (!result) + return -1; + if (BPy_UnaryFunction0DDouble_Check(obj)) { + ((UnaryFunction0D *)uf0D)->result = PyFloat_AsDouble(result); + } + else if (BPy_UnaryFunction0DEdgeNature_Check(obj)) { + ((UnaryFunction0D *)uf0D)->result = EdgeNature_from_BPy_Nature(result); + } + else if (BPy_UnaryFunction0DFloat_Check(obj)) { + ((UnaryFunction0D *)uf0D)->result = PyFloat_AsDouble(result); + } + else if (BPy_UnaryFunction0DId_Check(obj)) { + ((UnaryFunction0D *)uf0D)->result = *(((BPy_Id *)result)->id); + } + else if (BPy_UnaryFunction0DMaterial_Check(obj)) { + ((UnaryFunction0D *)uf0D)->result = *(((BPy_FrsMaterial *)result)->m); + } + else if (BPy_UnaryFunction0DUnsigned_Check(obj)) { + ((UnaryFunction0D *)uf0D)->result = PyLong_AsLong(result); + } + else if (BPy_UnaryFunction0DVec2f_Check(obj)) { + Vec2f vec; + if (!Vec2f_ptr_from_Vector(result, vec)) + return -1; + ((UnaryFunction0D *)uf0D)->result = vec; + } + else if (BPy_UnaryFunction0DVec3f_Check(obj)) { + Vec3f vec; + if (!Vec3f_ptr_from_Vector(result, vec)) + return -1; + ((UnaryFunction0D *)uf0D)->result = vec; + } + else if (BPy_UnaryFunction0DVectorViewShape_Check(obj)) { + vector vec; + vec.reserve(PyList_Size(result)); + for (int i = 0; i < PyList_Size(result); i++) { + ViewShape *b = ((BPy_ViewShape *)PyList_GET_ITEM(result, i))->vs; + vec.push_back(b); + } + ((UnaryFunction0D> *)uf0D)->result = vec; + } + else if (BPy_UnaryFunction0DViewShape_Check(obj)) { + ((UnaryFunction0D *)uf0D)->result = ((BPy_ViewShape *)result)->vs; + } + Py_DECREF(result); + return 0; } -int Director_BPy_UnaryFunction1D___call__(void *uf1D, void *py_uf1D, Interface1D& if1D) +int Director_BPy_UnaryFunction1D___call__(void *uf1D, void *py_uf1D, Interface1D &if1D) { - if (!py_uf1D) { // internal error - PyErr_SetString(PyExc_RuntimeError, "Reference to Python object (py_uf1D) not initialized"); - return -1; - } - PyObject *obj = (PyObject *)py_uf1D; - PyObject *arg = Any_BPy_Interface1D_from_Interface1D(if1D); - if (!arg) - return -1; - PyObject *result = PyObject_CallMethod(obj, "__call__", "O", arg); - Py_DECREF(arg); - if (!result) - return -1; - if (BPy_UnaryFunction1DDouble_Check(obj)) { - ((UnaryFunction1D *)uf1D)->result = PyFloat_AsDouble(result); - } - else if (BPy_UnaryFunction1DEdgeNature_Check(obj)) { - ((UnaryFunction1D *)uf1D)->result = EdgeNature_from_BPy_Nature(result); - } - else if (BPy_UnaryFunction1DFloat_Check(obj)) { - ((UnaryFunction1D *)uf1D)->result = PyFloat_AsDouble(result); - } - else if (BPy_UnaryFunction1DUnsigned_Check(obj)) { - ((UnaryFunction1D *)uf1D)->result = PyLong_AsLong(result); - } - else if (BPy_UnaryFunction1DVec2f_Check(obj)) { - Vec2f vec; - if (!Vec2f_ptr_from_Vector(result, vec)) - return -1; - ((UnaryFunction1D *)uf1D)->result = vec; - } - else if (BPy_UnaryFunction1DVec3f_Check(obj)) { - Vec3f vec; - if (!Vec3f_ptr_from_Vector(result, vec)) - return -1; - ((UnaryFunction1D *)uf1D)->result = vec; - } - else if (BPy_UnaryFunction1DVectorViewShape_Check(obj)) { - vector vec; - vec.reserve(PyList_Size(result)); - for (int i = 1; i < PyList_Size(result); i++) { - ViewShape *b = ((BPy_ViewShape *)PyList_GET_ITEM(result, i))->vs; - vec.push_back(b); - } - ((UnaryFunction1D< vector > *)uf1D)->result = vec; - } - Py_DECREF(result); - return 0; + if (!py_uf1D) { // internal error + PyErr_SetString(PyExc_RuntimeError, "Reference to Python object (py_uf1D) not initialized"); + return -1; + } + PyObject *obj = (PyObject *)py_uf1D; + PyObject *arg = Any_BPy_Interface1D_from_Interface1D(if1D); + if (!arg) + return -1; + PyObject *result = PyObject_CallMethod(obj, "__call__", "O", arg); + Py_DECREF(arg); + if (!result) + return -1; + if (BPy_UnaryFunction1DDouble_Check(obj)) { + ((UnaryFunction1D *)uf1D)->result = PyFloat_AsDouble(result); + } + else if (BPy_UnaryFunction1DEdgeNature_Check(obj)) { + ((UnaryFunction1D *)uf1D)->result = EdgeNature_from_BPy_Nature(result); + } + else if (BPy_UnaryFunction1DFloat_Check(obj)) { + ((UnaryFunction1D *)uf1D)->result = PyFloat_AsDouble(result); + } + else if (BPy_UnaryFunction1DUnsigned_Check(obj)) { + ((UnaryFunction1D *)uf1D)->result = PyLong_AsLong(result); + } + else if (BPy_UnaryFunction1DVec2f_Check(obj)) { + Vec2f vec; + if (!Vec2f_ptr_from_Vector(result, vec)) + return -1; + ((UnaryFunction1D *)uf1D)->result = vec; + } + else if (BPy_UnaryFunction1DVec3f_Check(obj)) { + Vec3f vec; + if (!Vec3f_ptr_from_Vector(result, vec)) + return -1; + ((UnaryFunction1D *)uf1D)->result = vec; + } + else if (BPy_UnaryFunction1DVectorViewShape_Check(obj)) { + vector vec; + vec.reserve(PyList_Size(result)); + for (int i = 1; i < PyList_Size(result); i++) { + ViewShape *b = ((BPy_ViewShape *)PyList_GET_ITEM(result, i))->vs; + vec.push_back(b); + } + ((UnaryFunction1D> *)uf1D)->result = vec; + } + Py_DECREF(result); + return 0; } diff --git a/source/blender/freestyle/intern/python/Director.h b/source/blender/freestyle/intern/python/Director.h index cf89b7f84e6..5c087e411ff 100644 --- a/source/blender/freestyle/intern/python/Director.h +++ b/source/blender/freestyle/intern/python/Director.h @@ -33,31 +33,35 @@ class Interface1D; class Interface0DIterator; class Stroke; class StrokeShader; -} +} // namespace Freestyle using namespace Freestyle; // BinaryPredicate0D: __call__ -int Director_BPy_BinaryPredicate0D___call__(BinaryPredicate0D *bp0D, Interface0D& i1, Interface0D& i2); +int Director_BPy_BinaryPredicate0D___call__(BinaryPredicate0D *bp0D, + Interface0D &i1, + Interface0D &i2); // BinaryPredicate1D: __call__ -int Director_BPy_BinaryPredicate1D___call__(BinaryPredicate1D *bp1D, Interface1D& i1, Interface1D& i2); +int Director_BPy_BinaryPredicate1D___call__(BinaryPredicate1D *bp1D, + Interface1D &i1, + Interface1D &i2); // UnaryFunction{0D,1D}: __call__ -int Director_BPy_UnaryFunction0D___call__(void *uf0D, void *py_uf0D, Interface0DIterator& if0D_it); -int Director_BPy_UnaryFunction1D___call__(void *uf1D, void *py_uf1D, Interface1D& if1D); +int Director_BPy_UnaryFunction0D___call__(void *uf0D, void *py_uf0D, Interface0DIterator &if0D_it); +int Director_BPy_UnaryFunction1D___call__(void *uf1D, void *py_uf1D, Interface1D &if1D); // UnaryPredicate0D: __call__ -int Director_BPy_UnaryPredicate0D___call__(UnaryPredicate0D *up0D, Interface0DIterator& if0D_it); +int Director_BPy_UnaryPredicate0D___call__(UnaryPredicate0D *up0D, Interface0DIterator &if0D_it); // UnaryPredicate1D: __call__ -int Director_BPy_UnaryPredicate1D___call__(UnaryPredicate1D *up1D, Interface1D& if1D); +int Director_BPy_UnaryPredicate1D___call__(UnaryPredicate1D *up1D, Interface1D &if1D); // StrokeShader: shade -int Director_BPy_StrokeShader_shade(StrokeShader *ss, Stroke& s); +int Director_BPy_StrokeShader_shade(StrokeShader *ss, Stroke &s); // ChainingIterator: init, traverse int Director_BPy_ChainingIterator_init(ChainingIterator *c_it); -int Director_BPy_ChainingIterator_traverse(ChainingIterator *c_it, AdjacencyIterator& a_it); +int Director_BPy_ChainingIterator_traverse(ChainingIterator *c_it, AdjacencyIterator &a_it); -#endif // __FREESTYLE_PYTHON_DIRECTOR_H__ +#endif // __FREESTYLE_PYTHON_DIRECTOR_H__ diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp index d000677ab55..e685491f682 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.cpp @@ -32,236 +32,260 @@ extern "C" { /*----------------------CurvePoint methods----------------------------*/ PyDoc_STRVAR(CurvePoint_doc, -"Class hierarchy: :class:`Interface0D` > :class:`CurvePoint`\n" -"\n" -"Class to represent a point of a curve. A CurvePoint can be any point\n" -"of a 1D curve (it doesn't have to be a vertex of the curve). Any\n" -":class:`Interface1D` is built upon ViewEdges, themselves built upon\n" -"FEdges. Therefore, a curve is basically a polyline made of a list of\n" -":class:`SVertex` objects. Thus, a CurvePoint is built by linearly\n" -"interpolating two :class:`SVertex` instances. CurvePoint can be used\n" -"as virtual points while querying 0D information along a curve at a\n" -"given resolution.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Defult constructor.\n" -"\n" -".. method:: __init__(brother)\n" -"\n" -" Copy constructor.\n" -"\n" -" :arg brother: A CurvePoint object.\n" -" :type brother: :class:`CurvePoint`\n" -"\n" -".. method:: __init__(first_vertex, second_vertex, t2d)\n" -"\n" -" Builds a CurvePoint from two SVertex objects and an interpolation parameter.\n" -"\n" -" :arg first_vertex: The first SVertex.\n" -" :type first_vertex: :class:`SVertex`\n" -" :arg second_vertex: The second SVertex.\n" -" :type second_vertex: :class:`SVertex`\n" -" :arg t2d: A 2D interpolation parameter used to linearly interpolate\n" -" first_vertex and second_vertex.\n" -" :type t2d: float\n" -"\n" -".. method:: __init__(first_point, second_point, t2d)\n" -"\n" -" Builds a CurvePoint from two CurvePoint objects and an interpolation\n" -" parameter.\n" -"\n" -" :arg first_point: The first CurvePoint.\n" -" :type first_point: :class:`CurvePoint`\n" -" :arg second_point: The second CurvePoint.\n" -" :type second_point: :class:`CurvePoint`\n" -" :arg t2d: The 2D interpolation parameter used to linearly interpolate\n" -" first_point and second_point.\n" -" :type t2d: float"); + "Class hierarchy: :class:`Interface0D` > :class:`CurvePoint`\n" + "\n" + "Class to represent a point of a curve. A CurvePoint can be any point\n" + "of a 1D curve (it doesn't have to be a vertex of the curve). Any\n" + ":class:`Interface1D` is built upon ViewEdges, themselves built upon\n" + "FEdges. Therefore, a curve is basically a polyline made of a list of\n" + ":class:`SVertex` objects. Thus, a CurvePoint is built by linearly\n" + "interpolating two :class:`SVertex` instances. CurvePoint can be used\n" + "as virtual points while querying 0D information along a curve at a\n" + "given resolution.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Defult constructor.\n" + "\n" + ".. method:: __init__(brother)\n" + "\n" + " Copy constructor.\n" + "\n" + " :arg brother: A CurvePoint object.\n" + " :type brother: :class:`CurvePoint`\n" + "\n" + ".. method:: __init__(first_vertex, second_vertex, t2d)\n" + "\n" + " Builds a CurvePoint from two SVertex objects and an interpolation parameter.\n" + "\n" + " :arg first_vertex: The first SVertex.\n" + " :type first_vertex: :class:`SVertex`\n" + " :arg second_vertex: The second SVertex.\n" + " :type second_vertex: :class:`SVertex`\n" + " :arg t2d: A 2D interpolation parameter used to linearly interpolate\n" + " first_vertex and second_vertex.\n" + " :type t2d: float\n" + "\n" + ".. method:: __init__(first_point, second_point, t2d)\n" + "\n" + " Builds a CurvePoint from two CurvePoint objects and an interpolation\n" + " parameter.\n" + "\n" + " :arg first_point: The first CurvePoint.\n" + " :type first_point: :class:`CurvePoint`\n" + " :arg second_point: The second CurvePoint.\n" + " :type second_point: :class:`CurvePoint`\n" + " :arg t2d: The 2D interpolation parameter used to linearly interpolate\n" + " first_point and second_point.\n" + " :type t2d: float"); static int CurvePoint_init(BPy_CurvePoint *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"first_vertex", "second_vertex", "t2d", NULL}; - static const char *kwlist_3[] = {"first_point", "second_point", "t2d", NULL}; - PyObject *obj1 = 0, *obj2 = 0; - float t2d; + static const char *kwlist_1[] = {"brother", NULL}; + static const char *kwlist_2[] = {"first_vertex", "second_vertex", "t2d", NULL}; + static const char *kwlist_3[] = {"first_point", "second_point", "t2d", NULL}; + PyObject *obj1 = 0, *obj2 = 0; + float t2d; - if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &CurvePoint_Type, &obj1)) { - if (!obj1) - self->cp = new CurvePoint(); - else - self->cp = new CurvePoint(*(((BPy_CurvePoint *)obj1)->cp)); - } - else if (PyErr_Clear(), - PyArg_ParseTupleAndKeywords(args, kwds, "O!O!f", (char **)kwlist_2, - &SVertex_Type, &obj1, &SVertex_Type, &obj2, &t2d)) - { - self->cp = new CurvePoint(((BPy_SVertex *)obj1)->sv, ((BPy_SVertex *)obj2)->sv, t2d); - } - else if (PyErr_Clear(), - PyArg_ParseTupleAndKeywords(args, kwds, "O!O!f", (char **)kwlist_3, - &CurvePoint_Type, &obj1, &CurvePoint_Type, &obj2, &t2d)) - { - CurvePoint *cp1 = ((BPy_CurvePoint *)obj1)->cp; - CurvePoint *cp2 = ((BPy_CurvePoint *)obj2)->cp; - if (!cp1 || cp1->A() == 0 || cp1->B() == 0) { - PyErr_SetString(PyExc_TypeError, "argument 1 is an invalid CurvePoint object"); - return -1; - } - if (!cp2 || cp2->A() == 0 || cp2->B() == 0) { - PyErr_SetString(PyExc_TypeError, "argument 2 is an invalid CurvePoint object"); - return -1; - } - self->cp = new CurvePoint(cp1, cp2, t2d); - } - else { - PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); - return -1; - } - self->py_if0D.if0D = self->cp; - self->py_if0D.borrowed = false; - return 0; + if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &CurvePoint_Type, &obj1)) { + if (!obj1) + self->cp = new CurvePoint(); + else + self->cp = new CurvePoint(*(((BPy_CurvePoint *)obj1)->cp)); + } + else if (PyErr_Clear(), + PyArg_ParseTupleAndKeywords(args, + kwds, + "O!O!f", + (char **)kwlist_2, + &SVertex_Type, + &obj1, + &SVertex_Type, + &obj2, + &t2d)) { + self->cp = new CurvePoint(((BPy_SVertex *)obj1)->sv, ((BPy_SVertex *)obj2)->sv, t2d); + } + else if (PyErr_Clear(), + PyArg_ParseTupleAndKeywords(args, + kwds, + "O!O!f", + (char **)kwlist_3, + &CurvePoint_Type, + &obj1, + &CurvePoint_Type, + &obj2, + &t2d)) { + CurvePoint *cp1 = ((BPy_CurvePoint *)obj1)->cp; + CurvePoint *cp2 = ((BPy_CurvePoint *)obj2)->cp; + if (!cp1 || cp1->A() == 0 || cp1->B() == 0) { + PyErr_SetString(PyExc_TypeError, "argument 1 is an invalid CurvePoint object"); + return -1; + } + if (!cp2 || cp2->A() == 0 || cp2->B() == 0) { + PyErr_SetString(PyExc_TypeError, "argument 2 is an invalid CurvePoint object"); + return -1; + } + self->cp = new CurvePoint(cp1, cp2, t2d); + } + else { + PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); + return -1; + } + self->py_if0D.if0D = self->cp; + self->py_if0D.borrowed = false; + return 0; } -///bool operator== (const CurvePoint &b) +///bool operator== (const CurvePoint &b) /*----------------------CurvePoint get/setters ----------------------------*/ PyDoc_STRVAR(CurvePoint_first_svertex_doc, -"The first SVertex upon which the CurvePoint is built.\n" -"\n" -":type: :class:`SVertex`"); + "The first SVertex upon which the CurvePoint is built.\n" + "\n" + ":type: :class:`SVertex`"); static PyObject *CurvePoint_first_svertex_get(BPy_CurvePoint *self, void *UNUSED(closure)) { - SVertex *A = self->cp->A(); - if (A) - return BPy_SVertex_from_SVertex(*A); - Py_RETURN_NONE; + SVertex *A = self->cp->A(); + if (A) + return BPy_SVertex_from_SVertex(*A); + Py_RETURN_NONE; } -static int CurvePoint_first_svertex_set(BPy_CurvePoint *self, PyObject *value, void *UNUSED(closure)) +static int CurvePoint_first_svertex_set(BPy_CurvePoint *self, + PyObject *value, + void *UNUSED(closure)) { - if (!BPy_SVertex_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be an SVertex"); - return -1; - } - self->cp->setA(((BPy_SVertex *)value)->sv); - return 0; + if (!BPy_SVertex_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an SVertex"); + return -1; + } + self->cp->setA(((BPy_SVertex *)value)->sv); + return 0; } PyDoc_STRVAR(CurvePoint_second_svertex_doc, -"The second SVertex upon which the CurvePoint is built.\n" -"\n" -":type: :class:`SVertex`"); + "The second SVertex upon which the CurvePoint is built.\n" + "\n" + ":type: :class:`SVertex`"); static PyObject *CurvePoint_second_svertex_get(BPy_CurvePoint *self, void *UNUSED(closure)) { - SVertex *B = self->cp->B(); - if (B) - return BPy_SVertex_from_SVertex(*B); - Py_RETURN_NONE; + SVertex *B = self->cp->B(); + if (B) + return BPy_SVertex_from_SVertex(*B); + Py_RETURN_NONE; } -static int CurvePoint_second_svertex_set(BPy_CurvePoint *self, PyObject *value, void *UNUSED(closure)) +static int CurvePoint_second_svertex_set(BPy_CurvePoint *self, + PyObject *value, + void *UNUSED(closure)) { - if (!BPy_SVertex_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be an SVertex"); - return -1; - } - self->cp->setB(((BPy_SVertex *)value)->sv); - return 0; + if (!BPy_SVertex_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an SVertex"); + return -1; + } + self->cp->setB(((BPy_SVertex *)value)->sv); + return 0; } PyDoc_STRVAR(CurvePoint_fedge_doc, -"Gets the FEdge for the two SVertices that given CurvePoints consists out of.\n" -"A shortcut for CurvePoint.first_svertex.get_fedge(CurvePoint.second_svertex).\n" -"\n" -":type: :class:`FEdge`"); + "Gets the FEdge for the two SVertices that given CurvePoints consists out of.\n" + "A shortcut for CurvePoint.first_svertex.get_fedge(CurvePoint.second_svertex).\n" + "\n" + ":type: :class:`FEdge`"); 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) - return Any_BPy_Interface1D_from_Interface1D(*(A->getFEdge(*B))); - Py_RETURN_NONE; + SVertex *A = self->cp->A(); + Interface0D *B = (Interface0D *)self->cp->B(); + // B can be NULL under certain circumstances + if (B) + return Any_BPy_Interface1D_from_Interface1D(*(A->getFEdge(*B))); + Py_RETURN_NONE; } PyDoc_STRVAR(CurvePoint_t2d_doc, -"The 2D interpolation parameter.\n" -"\n" -":type: float"); + "The 2D interpolation parameter.\n" + "\n" + ":type: float"); static PyObject *CurvePoint_t2d_get(BPy_CurvePoint *self, void *UNUSED(closure)) { - return PyFloat_FromDouble(self->cp->t2d()); + return PyFloat_FromDouble(self->cp->t2d()); } static int CurvePoint_t2d_set(BPy_CurvePoint *self, PyObject *value, void *UNUSED(closure)) { - float scalar; - if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, "value must be a number"); - return -1; - } - self->cp->setT2d(scalar); - return 0; + float scalar; + if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, "value must be a number"); + return -1; + } + self->cp->setT2d(scalar); + return 0; } static PyGetSetDef BPy_CurvePoint_getseters[] = { - {(char *)"first_svertex", (getter)CurvePoint_first_svertex_get, (setter)CurvePoint_first_svertex_set, - (char *)CurvePoint_first_svertex_doc, NULL}, - {(char *)"second_svertex", (getter)CurvePoint_second_svertex_get, (setter)CurvePoint_second_svertex_set, - (char *)CurvePoint_second_svertex_doc, NULL}, - {(char *)"fedge", (getter)CurvePoint_fedge_get, NULL, - CurvePoint_fedge_doc, NULL}, - {(char *)"t2d", (getter)CurvePoint_t2d_get, (setter)CurvePoint_t2d_set, (char *)CurvePoint_t2d_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"first_svertex", + (getter)CurvePoint_first_svertex_get, + (setter)CurvePoint_first_svertex_set, + (char *)CurvePoint_first_svertex_doc, + NULL}, + {(char *)"second_svertex", + (getter)CurvePoint_second_svertex_get, + (setter)CurvePoint_second_svertex_set, + (char *)CurvePoint_second_svertex_doc, + NULL}, + {(char *)"fedge", (getter)CurvePoint_fedge_get, NULL, CurvePoint_fedge_doc, NULL}, + {(char *)"t2d", + (getter)CurvePoint_t2d_get, + (setter)CurvePoint_t2d_set, + (char *)CurvePoint_t2d_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_CurvePoint type definition ------------------------------*/ PyTypeObject CurvePoint_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "CurvePoint", /* tp_name */ - sizeof(BPy_CurvePoint), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - CurvePoint_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_CurvePoint_getseters, /* tp_getset */ - &Interface0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)CurvePoint_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "CurvePoint", /* tp_name */ + sizeof(BPy_CurvePoint), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + CurvePoint_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + BPy_CurvePoint_getseters, /* tp_getset */ + &Interface0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)CurvePoint_init, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.h b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.h index 7cc78a12167..d0f4087f8a6 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.h +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_CurvePoint.h @@ -37,8 +37,8 @@ extern PyTypeObject CurvePoint_Type; /*---------------------------Python BPy_CurvePoint structure definition----------*/ typedef struct { - BPy_Interface0D py_if0D; - CurvePoint *cp; + BPy_Interface0D py_if0D; + CurvePoint *cp; } BPy_CurvePoint; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp index f4b232a957e..f4b8ca07d3f 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp @@ -33,433 +33,463 @@ extern "C" { /*----------------------SVertex methods ----------------------------*/ PyDoc_STRVAR(SVertex_doc, -"Class hierarchy: :class:`Interface0D` > :class:`SVertex`\n" -"\n" -"Class to define a vertex of the embedding.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __init__(brother)\n" -"\n" -" Copy constructor.\n" -"\n" -" :arg brother: A SVertex object.\n" -" :type brother: :class:`SVertex`\n" -"\n" -".. method:: __init__(point_3d, id)\n" -"\n" -" Builds a SVertex from 3D coordinates and an Id.\n" -"\n" -" :arg point_3d: A three-dimensional vector.\n" -" :type point_3d: :class:`mathutils.Vector`\n" -" :arg id: An Id object.\n" -" :type id: :class:`Id`"); + "Class hierarchy: :class:`Interface0D` > :class:`SVertex`\n" + "\n" + "Class to define a vertex of the embedding.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __init__(brother)\n" + "\n" + " Copy constructor.\n" + "\n" + " :arg brother: A SVertex object.\n" + " :type brother: :class:`SVertex`\n" + "\n" + ".. method:: __init__(point_3d, id)\n" + "\n" + " Builds a SVertex from 3D coordinates and an Id.\n" + "\n" + " :arg point_3d: A three-dimensional vector.\n" + " :type point_3d: :class:`mathutils.Vector`\n" + " :arg id: An Id object.\n" + " :type id: :class:`Id`"); static int SVertex_init(BPy_SVertex *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"point_3d", "id", NULL}; - PyObject *obj = 0; - float v[3]; - - if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &SVertex_Type, &obj)) { - if (!obj) - self->sv = new SVertex(); - else - self->sv = new SVertex(*(((BPy_SVertex *)obj)->sv)); - } - else if (PyErr_Clear(), - PyArg_ParseTupleAndKeywords(args, kwds, "O&O!", (char **)kwlist_2, convert_v3, v, &Id_Type, &obj)) - { - Vec3r point_3d(v[0], v[1], v[2]); - self->sv = new SVertex(point_3d, *(((BPy_Id *)obj)->id)); - } - else { - PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); - return -1; - } - self->py_if0D.if0D = self->sv; - self->py_if0D.borrowed = false; - return 0; + static const char *kwlist_1[] = {"brother", NULL}; + static const char *kwlist_2[] = {"point_3d", "id", NULL}; + PyObject *obj = 0; + float v[3]; + + if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &SVertex_Type, &obj)) { + if (!obj) + self->sv = new SVertex(); + else + self->sv = new SVertex(*(((BPy_SVertex *)obj)->sv)); + } + else if (PyErr_Clear(), + PyArg_ParseTupleAndKeywords( + args, kwds, "O&O!", (char **)kwlist_2, convert_v3, v, &Id_Type, &obj)) { + Vec3r point_3d(v[0], v[1], v[2]); + self->sv = new SVertex(point_3d, *(((BPy_Id *)obj)->id)); + } + else { + PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); + return -1; + } + self->py_if0D.if0D = self->sv; + self->py_if0D.borrowed = false; + return 0; } PyDoc_STRVAR(SVertex_add_normal_doc, -".. method:: add_normal(normal)\n" -"\n" -" Adds a normal to the SVertex's set of normals. If the same normal\n" -" is already in the set, nothing changes.\n" -"\n" -" :arg normal: A three-dimensional vector.\n" -" :type normal: :class:`mathutils.Vector`, list or tuple of 3 real numbers"); + ".. method:: add_normal(normal)\n" + "\n" + " Adds a normal to the SVertex's set of normals. If the same normal\n" + " is already in the set, nothing changes.\n" + "\n" + " :arg normal: A three-dimensional vector.\n" + " :type normal: :class:`mathutils.Vector`, list or tuple of 3 real numbers"); static PyObject *SVertex_add_normal(BPy_SVertex *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"normal", NULL}; - PyObject *py_normal; - Vec3r n; - - 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)"); - return NULL; - } - self->sv->AddNormal(n); - Py_RETURN_NONE; + static const char *kwlist[] = {"normal", NULL}; + PyObject *py_normal; + Vec3r n; + + 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)"); + return NULL; + } + self->sv->AddNormal(n); + Py_RETURN_NONE; } PyDoc_STRVAR(SVertex_add_fedge_doc, -".. method:: add_fedge(fedge)\n" -"\n" -" Add an FEdge to the list of edges emanating from this SVertex.\n" -"\n" -" :arg fedge: An FEdge.\n" -" :type fedge: :class:`FEdge`"); + ".. method:: add_fedge(fedge)\n" + "\n" + " Add an FEdge to the list of edges emanating from this SVertex.\n" + "\n" + " :arg fedge: An FEdge.\n" + " :type fedge: :class:`FEdge`"); static PyObject *SVertex_add_fedge(BPy_SVertex *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"fedge", NULL}; - PyObject *py_fe; + static const char *kwlist[] = {"fedge", NULL}; + PyObject *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; + 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; } -// virtual bool operator== (const SVertex &brother) +// virtual bool operator== (const SVertex &brother) static PyMethodDef BPy_SVertex_methods[] = { - {"add_normal", (PyCFunction)SVertex_add_normal, METH_VARARGS | METH_KEYWORDS, SVertex_add_normal_doc}, - {"add_fedge", (PyCFunction)SVertex_add_fedge, METH_VARARGS | METH_KEYWORDS, SVertex_add_fedge_doc}, - {NULL, NULL, 0, NULL}, + {"add_normal", + (PyCFunction)SVertex_add_normal, + METH_VARARGS | METH_KEYWORDS, + SVertex_add_normal_doc}, + {"add_fedge", + (PyCFunction)SVertex_add_fedge, + METH_VARARGS | METH_KEYWORDS, + SVertex_add_fedge_doc}, + {NULL, NULL, 0, NULL}, }; /*----------------------mathutils callbacks ----------------------------*/ /* subtype */ -#define MATHUTILS_SUBTYPE_POINT3D 1 -#define MATHUTILS_SUBTYPE_POINT2D 2 +#define MATHUTILS_SUBTYPE_POINT3D 1 +#define MATHUTILS_SUBTYPE_POINT2D 2 static int SVertex_mathutils_check(BaseMathObject *bmo) { - if (!BPy_SVertex_Check(bmo->cb_user)) - return -1; - return 0; + if (!BPy_SVertex_Check(bmo->cb_user)) + return -1; + return 0; } static int SVertex_mathutils_get(BaseMathObject *bmo, int subtype) { - BPy_SVertex *self = (BPy_SVertex *)bmo->cb_user; - switch (subtype) { - case MATHUTILS_SUBTYPE_POINT3D: - bmo->data[0] = self->sv->getX(); - bmo->data[1] = self->sv->getY(); - bmo->data[2] = self->sv->getZ(); - break; - case MATHUTILS_SUBTYPE_POINT2D: - bmo->data[0] = self->sv->getProjectedX(); - bmo->data[1] = self->sv->getProjectedY(); - bmo->data[2] = self->sv->getProjectedZ(); - break; - default: - return -1; - } - return 0; + BPy_SVertex *self = (BPy_SVertex *)bmo->cb_user; + switch (subtype) { + case MATHUTILS_SUBTYPE_POINT3D: + bmo->data[0] = self->sv->getX(); + bmo->data[1] = self->sv->getY(); + bmo->data[2] = self->sv->getZ(); + break; + case MATHUTILS_SUBTYPE_POINT2D: + bmo->data[0] = self->sv->getProjectedX(); + bmo->data[1] = self->sv->getProjectedY(); + bmo->data[2] = self->sv->getProjectedZ(); + break; + default: + return -1; + } + return 0; } static int SVertex_mathutils_set(BaseMathObject *bmo, int subtype) { - BPy_SVertex *self = (BPy_SVertex *)bmo->cb_user; - switch (subtype) { - case MATHUTILS_SUBTYPE_POINT3D: - { - Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]); - self->sv->setPoint3D(p); - } - break; - case MATHUTILS_SUBTYPE_POINT2D: - { - Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]); - self->sv->setPoint2D(p); - } - break; - default: - return -1; - } - return 0; + BPy_SVertex *self = (BPy_SVertex *)bmo->cb_user; + switch (subtype) { + case MATHUTILS_SUBTYPE_POINT3D: { + Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]); + self->sv->setPoint3D(p); + } break; + case MATHUTILS_SUBTYPE_POINT2D: { + Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]); + self->sv->setPoint2D(p); + } break; + default: + return -1; + } + return 0; } static int SVertex_mathutils_get_index(BaseMathObject *bmo, int subtype, int index) { - BPy_SVertex *self = (BPy_SVertex *)bmo->cb_user; - switch (subtype) { - case MATHUTILS_SUBTYPE_POINT3D: - switch (index) { - case 0: bmo->data[0] = self->sv->getX(); break; - case 1: bmo->data[1] = self->sv->getY(); break; - case 2: bmo->data[2] = self->sv->getZ(); break; - default: - return -1; - } - break; - case MATHUTILS_SUBTYPE_POINT2D: - switch (index) { - case 0: bmo->data[0] = self->sv->getProjectedX(); break; - case 1: bmo->data[1] = self->sv->getProjectedY(); break; - case 2: bmo->data[2] = self->sv->getProjectedZ(); break; - default: - return -1; - } - break; - default: - return -1; - } - return 0; + BPy_SVertex *self = (BPy_SVertex *)bmo->cb_user; + switch (subtype) { + case MATHUTILS_SUBTYPE_POINT3D: + switch (index) { + case 0: + bmo->data[0] = self->sv->getX(); + break; + case 1: + bmo->data[1] = self->sv->getY(); + break; + case 2: + bmo->data[2] = self->sv->getZ(); + break; + default: + return -1; + } + break; + case MATHUTILS_SUBTYPE_POINT2D: + switch (index) { + case 0: + bmo->data[0] = self->sv->getProjectedX(); + break; + case 1: + bmo->data[1] = self->sv->getProjectedY(); + break; + case 2: + bmo->data[2] = self->sv->getProjectedZ(); + break; + default: + return -1; + } + break; + default: + return -1; + } + return 0; } static int SVertex_mathutils_set_index(BaseMathObject *bmo, int subtype, int index) { - BPy_SVertex *self = (BPy_SVertex *)bmo->cb_user; - switch (subtype) { - case MATHUTILS_SUBTYPE_POINT3D: - { - Vec3r p(self->sv->point3D()); - p[index] = bmo->data[index]; - self->sv->setPoint3D(p); - } - break; - case MATHUTILS_SUBTYPE_POINT2D: - { - Vec3r p(self->sv->point2D()); - p[index] = bmo->data[index]; - self->sv->setPoint2D(p); - } - break; - default: - return -1; - } - return 0; + BPy_SVertex *self = (BPy_SVertex *)bmo->cb_user; + switch (subtype) { + case MATHUTILS_SUBTYPE_POINT3D: { + Vec3r p(self->sv->point3D()); + p[index] = bmo->data[index]; + self->sv->setPoint3D(p); + } break; + case MATHUTILS_SUBTYPE_POINT2D: { + Vec3r p(self->sv->point2D()); + p[index] = bmo->data[index]; + self->sv->setPoint2D(p); + } break; + default: + return -1; + } + return 0; } static Mathutils_Callback SVertex_mathutils_cb = { - SVertex_mathutils_check, - SVertex_mathutils_get, - SVertex_mathutils_set, - SVertex_mathutils_get_index, - SVertex_mathutils_set_index, + SVertex_mathutils_check, + SVertex_mathutils_get, + SVertex_mathutils_set, + SVertex_mathutils_get_index, + SVertex_mathutils_set_index, }; static unsigned char SVertex_mathutils_cb_index = -1; void SVertex_mathutils_register_callback() { - SVertex_mathutils_cb_index = Mathutils_RegisterCallback(&SVertex_mathutils_cb); + SVertex_mathutils_cb_index = Mathutils_RegisterCallback(&SVertex_mathutils_cb); } /*----------------------SVertex get/setters ----------------------------*/ PyDoc_STRVAR(SVertex_point_3d_doc, -"The 3D coordinates of the SVertex.\n" -"\n" -":type: :class:`mathutils.Vector`"); + "The 3D coordinates of the SVertex.\n" + "\n" + ":type: :class:`mathutils.Vector`"); static PyObject *SVertex_point_3d_get(BPy_SVertex *self, void *UNUSED(closure)) { - return Vector_CreatePyObject_cb((PyObject *)self, 3, SVertex_mathutils_cb_index, MATHUTILS_SUBTYPE_POINT3D); + return Vector_CreatePyObject_cb( + (PyObject *)self, 3, SVertex_mathutils_cb_index, MATHUTILS_SUBTYPE_POINT3D); } static int SVertex_point_3d_set(BPy_SVertex *self, PyObject *value, void *UNUSED(closure)) { - float v[3]; - if (mathutils_array_parse(v, 3, 3, value, - "value must be a 3-dimensional vector") == -1) - { - return -1; - } - Vec3r p(v[0], v[1], v[2]); - self->sv->setPoint3D(p); - return 0; + float v[3]; + if (mathutils_array_parse(v, 3, 3, value, "value must be a 3-dimensional vector") == -1) { + return -1; + } + Vec3r p(v[0], v[1], v[2]); + self->sv->setPoint3D(p); + return 0; } PyDoc_STRVAR(SVertex_point_2d_doc, -"The projected 3D coordinates of the SVertex.\n" -"\n" -":type: :class:`mathutils.Vector`"); + "The projected 3D coordinates of the SVertex.\n" + "\n" + ":type: :class:`mathutils.Vector`"); static PyObject *SVertex_point_2d_get(BPy_SVertex *self, void *UNUSED(closure)) { - return Vector_CreatePyObject_cb((PyObject *)self, 3, SVertex_mathutils_cb_index, MATHUTILS_SUBTYPE_POINT2D); + return Vector_CreatePyObject_cb( + (PyObject *)self, 3, SVertex_mathutils_cb_index, MATHUTILS_SUBTYPE_POINT2D); } static int SVertex_point_2d_set(BPy_SVertex *self, PyObject *value, void *UNUSED(closure)) { - float v[3]; - if (mathutils_array_parse(v, 3, 3, value, - "value must be a 3-dimensional vector") == -1) - { - return -1; - } - Vec3r p(v[0], v[1], v[2]); - self->sv->setPoint2D(p); - return 0; + float v[3]; + if (mathutils_array_parse(v, 3, 3, value, "value must be a 3-dimensional vector") == -1) { + return -1; + } + Vec3r p(v[0], v[1], v[2]); + self->sv->setPoint2D(p); + return 0; } PyDoc_STRVAR(SVertex_id_doc, -"The Id of this SVertex.\n" -"\n" -":type: :class:`Id`"); + "The Id of this SVertex.\n" + "\n" + ":type: :class:`Id`"); static PyObject *SVertex_id_get(BPy_SVertex *self, void *UNUSED(closure)) { - Id id(self->sv->getId()); - return BPy_Id_from_Id(id); // return a copy + Id id(self->sv->getId()); + return BPy_Id_from_Id(id); // return a copy } static int SVertex_id_set(BPy_SVertex *self, PyObject *value, void *UNUSED(closure)) { - if (!BPy_Id_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be an Id"); - return -1; - } - self->sv->setId(*(((BPy_Id *)value)->id)); - return 0; + if (!BPy_Id_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an Id"); + return -1; + } + self->sv->setId(*(((BPy_Id *)value)->id)); + return 0; } PyDoc_STRVAR(SVertex_normals_doc, -"The normals for this Vertex as a list. In a sharp surface, an SVertex\n" -"has exactly one normal. In a smooth surface, an SVertex can have any\n" -"number of normals.\n" -"\n" -":type: list of :class:`mathutils.Vector` objects"); + "The normals for this Vertex as a list. In a sharp surface, an SVertex\n" + "has exactly one normal. In a smooth surface, an SVertex can have any\n" + "number of normals.\n" + "\n" + ":type: list of :class:`mathutils.Vector` objects"); static PyObject *SVertex_normals_get(BPy_SVertex *self, void *UNUSED(closure)) { - PyObject *py_normals; - set< Vec3r > normals = self->sv->normals(); - set< Vec3r >::iterator it; - py_normals = PyList_New(normals.size()); - unsigned int i = 0; - - for (it = normals.begin(); it != normals.end(); it++) { - Vec3r v(*it); - PyList_SET_ITEM(py_normals, i++, Vector_from_Vec3r(v)); - } - return py_normals; + PyObject *py_normals; + set normals = self->sv->normals(); + set::iterator it; + py_normals = PyList_New(normals.size()); + unsigned int i = 0; + + for (it = normals.begin(); it != normals.end(); it++) { + Vec3r v(*it); + PyList_SET_ITEM(py_normals, i++, Vector_from_Vec3r(v)); + } + return py_normals; } PyDoc_STRVAR(SVertex_normals_size_doc, -"The number of different normals for this SVertex.\n" -"\n" -":type: int"); + "The number of different normals for this SVertex.\n" + "\n" + ":type: int"); static PyObject *SVertex_normals_size_get(BPy_SVertex *self, void *UNUSED(closure)) { - return PyLong_FromLong(self->sv->normalsSize()); + return PyLong_FromLong(self->sv->normalsSize()); } PyDoc_STRVAR(SVertex_viewvertex_doc, -"If this SVertex is also a ViewVertex, this property refers to the\n" -"ViewVertex, and None otherwise.\n" -"\n" -":type: :class:`ViewVertex`"); + "If this SVertex is also a ViewVertex, this property refers to the\n" + "ViewVertex, and None otherwise.\n" + "\n" + ":type: :class:`ViewVertex`"); static PyObject *SVertex_viewvertex_get(BPy_SVertex *self, void *UNUSED(closure)) { - ViewVertex *vv = self->sv->viewvertex(); - if (vv) - return Any_BPy_ViewVertex_from_ViewVertex(*vv); - Py_RETURN_NONE; + ViewVertex *vv = self->sv->viewvertex(); + if (vv) + return Any_BPy_ViewVertex_from_ViewVertex(*vv); + Py_RETURN_NONE; } PyDoc_STRVAR(SVertex_curvatures_doc, -"Curvature information expressed in the form of a seven-element tuple\n" -"(K1, e1, K2, e2, Kr, er, dKr), where K1 and K2 are scalar values\n" -"representing the first (maximum) and second (minimum) principal\n" -"curvatures at this SVertex, respectively; e1 and e2 are\n" -"three-dimensional vectors representing the first and second principal\n" -"directions, i.e. the directions of the normal plane where the\n" -"curvature takes its maximum and minimum values, respectively; and Kr,\n" -"er and dKr are the radial curvature, radial direction, and the\n" -"derivative of the radial curvature at this SVertex, respectively.\n" -"\n" -":type: tuple"); + "Curvature information expressed in the form of a seven-element tuple\n" + "(K1, e1, K2, e2, Kr, er, dKr), where K1 and K2 are scalar values\n" + "representing the first (maximum) and second (minimum) principal\n" + "curvatures at this SVertex, respectively; e1 and e2 are\n" + "three-dimensional vectors representing the first and second principal\n" + "directions, i.e. the directions of the normal plane where the\n" + "curvature takes its maximum and minimum values, respectively; and Kr,\n" + "er and dKr are the radial curvature, radial direction, and the\n" + "derivative of the radial curvature at this SVertex, respectively.\n" + "\n" + ":type: tuple"); static PyObject *SVertex_curvatures_get(BPy_SVertex *self, void *UNUSED(closure)) { - const CurvatureInfo *info = self->sv->getCurvatureInfo(); - 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()); - PyObject *retval = PyTuple_New(7); - PyTuple_SET_ITEMS(retval, - PyFloat_FromDouble(info->K1), - PyFloat_FromDouble(info->K2), - Vector_from_Vec3r(e1), - Vector_from_Vec3r(e2), - PyFloat_FromDouble(info->Kr), - Vector_from_Vec3r(er), - PyFloat_FromDouble(info->dKr)); - return retval; + const CurvatureInfo *info = self->sv->getCurvatureInfo(); + 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()); + PyObject *retval = PyTuple_New(7); + PyTuple_SET_ITEMS(retval, + PyFloat_FromDouble(info->K1), + PyFloat_FromDouble(info->K2), + Vector_from_Vec3r(e1), + Vector_from_Vec3r(e2), + PyFloat_FromDouble(info->Kr), + Vector_from_Vec3r(er), + PyFloat_FromDouble(info->dKr)); + return retval; } static PyGetSetDef BPy_SVertex_getseters[] = { - {(char *)"point_3d", (getter)SVertex_point_3d_get, (setter)SVertex_point_3d_set, - (char *)SVertex_point_3d_doc, NULL}, - {(char *)"point_2d", (getter)SVertex_point_2d_get, (setter)SVertex_point_2d_set, - (char *)SVertex_point_2d_doc, NULL}, - {(char *)"id", (getter)SVertex_id_get, (setter)SVertex_id_set, (char *)SVertex_id_doc, NULL}, - {(char *)"normals", (getter)SVertex_normals_get, (setter)NULL, (char *)SVertex_normals_doc, NULL}, - {(char *)"normals_size", (getter)SVertex_normals_size_get, (setter)NULL, (char *)SVertex_normals_size_doc, NULL}, - {(char *)"viewvertex", (getter)SVertex_viewvertex_get, (setter)NULL, (char *)SVertex_viewvertex_doc, NULL}, - {(char *)"curvatures", (getter)SVertex_curvatures_get, (setter)NULL, (char *)SVertex_curvatures_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"point_3d", + (getter)SVertex_point_3d_get, + (setter)SVertex_point_3d_set, + (char *)SVertex_point_3d_doc, + NULL}, + {(char *)"point_2d", + (getter)SVertex_point_2d_get, + (setter)SVertex_point_2d_set, + (char *)SVertex_point_2d_doc, + NULL}, + {(char *)"id", (getter)SVertex_id_get, (setter)SVertex_id_set, (char *)SVertex_id_doc, NULL}, + {(char *)"normals", + (getter)SVertex_normals_get, + (setter)NULL, + (char *)SVertex_normals_doc, + NULL}, + {(char *)"normals_size", + (getter)SVertex_normals_size_get, + (setter)NULL, + (char *)SVertex_normals_size_doc, + NULL}, + {(char *)"viewvertex", + (getter)SVertex_viewvertex_get, + (setter)NULL, + (char *)SVertex_viewvertex_doc, + NULL}, + {(char *)"curvatures", + (getter)SVertex_curvatures_get, + (setter)NULL, + (char *)SVertex_curvatures_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_SVertex type definition ------------------------------*/ PyTypeObject SVertex_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SVertex", /* tp_name */ - sizeof(BPy_SVertex), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - SVertex_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_SVertex_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_SVertex_getseters, /* tp_getset */ - &Interface0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)SVertex_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "SVertex", /* tp_name */ + sizeof(BPy_SVertex), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + SVertex_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_SVertex_methods, /* tp_methods */ + 0, /* tp_members */ + BPy_SVertex_getseters, /* tp_getset */ + &Interface0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)SVertex_init, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.h b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.h index dabc7119539..20a14f1422c 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.h +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.h @@ -37,8 +37,8 @@ extern PyTypeObject SVertex_Type; /*---------------------------Python BPy_SVertex structure definition----------*/ typedef struct { - BPy_Interface0D py_if0D; - SVertex *sv; + BPy_Interface0D py_if0D; + SVertex *sv; } BPy_SVertex; /*---------------------------Python BPy_SVertex visible prototypes-----------*/ diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp index 155dbf26888..1ff46482911 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp @@ -33,164 +33,168 @@ extern "C" { /*----------------------ViewVertex methods----------------------------*/ PyDoc_STRVAR(ViewVertex_doc, -"Class hierarchy: :class:`Interface0D` > :class:`ViewVertex`\n" -"\n" -"Class to define a view vertex. A view vertex is a feature vertex\n" -"corresponding to a point of the image graph, where the characteristics\n" -"of an edge (e.g., nature and visibility) might change. A\n" -":class:`ViewVertex` can be of two kinds: A :class:`TVertex` when it\n" -"corresponds to the intersection between two ViewEdges or a\n" -":class:`NonTVertex` when it corresponds to a vertex of the initial\n" -"input mesh (it is the case for vertices such as corners for example).\n" -"Thus, this class can be specialized into two classes, the\n" -":class:`TVertex` class and the :class:`NonTVertex` class."); + "Class hierarchy: :class:`Interface0D` > :class:`ViewVertex`\n" + "\n" + "Class to define a view vertex. A view vertex is a feature vertex\n" + "corresponding to a point of the image graph, where the characteristics\n" + "of an edge (e.g., nature and visibility) might change. A\n" + ":class:`ViewVertex` can be of two kinds: A :class:`TVertex` when it\n" + "corresponds to the intersection between two ViewEdges or a\n" + ":class:`NonTVertex` when it corresponds to a vertex of the initial\n" + "input mesh (it is the case for vertices such as corners for example).\n" + "Thus, this class can be specialized into two classes, the\n" + ":class:`TVertex` class and the :class:`NonTVertex` class."); static int ViewVertex_init(BPy_ViewVertex * /*self*/, PyObject * /*args*/, PyObject * /*kwds*/) { - PyErr_SetString(PyExc_TypeError, "cannot instantiate abstract class"); - return -1; + PyErr_SetString(PyExc_TypeError, "cannot instantiate abstract class"); + return -1; } PyDoc_STRVAR(ViewVertex_edges_begin_doc, -".. method:: edges_begin()\n" -"\n" -" Returns an iterator over the ViewEdges that goes to or comes from\n" -" this ViewVertex pointing to the first ViewEdge of the list. The\n" -" orientedViewEdgeIterator allows to iterate in CCW order over these\n" -" ViewEdges and to get the orientation for each ViewEdge\n" -" (incoming/outgoing).\n" -"\n" -" :return: An orientedViewEdgeIterator pointing to the first ViewEdge.\n" -" :rtype: :class:`orientedViewEdgeIterator`"); + ".. method:: edges_begin()\n" + "\n" + " Returns an iterator over the ViewEdges that goes to or comes from\n" + " this ViewVertex pointing to the first ViewEdge of the list. The\n" + " orientedViewEdgeIterator allows to iterate in CCW order over these\n" + " ViewEdges and to get the orientation for each ViewEdge\n" + " (incoming/outgoing).\n" + "\n" + " :return: An orientedViewEdgeIterator pointing to the first ViewEdge.\n" + " :rtype: :class:`orientedViewEdgeIterator`"); static PyObject *ViewVertex_edges_begin(BPy_ViewVertex *self) { - ViewVertexInternal::orientedViewEdgeIterator ove_it(self->vv->edgesBegin()); - return BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator(ove_it, false); + ViewVertexInternal::orientedViewEdgeIterator ove_it(self->vv->edgesBegin()); + return BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator(ove_it, false); } PyDoc_STRVAR(ViewVertex_edges_end_doc, -".. method:: edges_end()\n" -"\n" -" Returns an orientedViewEdgeIterator over the ViewEdges around this\n" -" ViewVertex, pointing after the last ViewEdge.\n" -"\n" -" :return: An orientedViewEdgeIterator pointing after the last ViewEdge.\n" -" :rtype: :class:`orientedViewEdgeIterator`"); + ".. method:: edges_end()\n" + "\n" + " Returns an orientedViewEdgeIterator over the ViewEdges around this\n" + " ViewVertex, pointing after the last ViewEdge.\n" + "\n" + " :return: An orientedViewEdgeIterator pointing after the last ViewEdge.\n" + " :rtype: :class:`orientedViewEdgeIterator`"); static PyObject *ViewVertex_edges_end(BPy_ViewVertex * /*self*/) { #if 0 - ViewVertexInternal::orientedViewEdgeIterator ove_it(self->vv->edgesEnd()); - return BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator(ove_it, 1); + ViewVertexInternal::orientedViewEdgeIterator ove_it(self->vv->edgesEnd()); + return BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator(ove_it, 1); #else - PyErr_SetString(PyExc_NotImplementedError, "edges_end method currently disabled"); - return NULL; + PyErr_SetString(PyExc_NotImplementedError, "edges_end method currently disabled"); + return NULL; #endif } PyDoc_STRVAR(ViewVertex_edges_iterator_doc, -".. method:: edges_iterator(edge)\n" -"\n" -" Returns an orientedViewEdgeIterator pointing to the ViewEdge given\n" -" as argument.\n" -"\n" -" :arg edge: A ViewEdge object.\n" -" :type edge: :class:`ViewEdge`\n" -" :return: An orientedViewEdgeIterator pointing to the given ViewEdge.\n" -" :rtype: :class:`orientedViewEdgeIterator`"); + ".. method:: edges_iterator(edge)\n" + "\n" + " Returns an orientedViewEdgeIterator pointing to the ViewEdge given\n" + " as argument.\n" + "\n" + " :arg edge: A ViewEdge object.\n" + " :type edge: :class:`ViewEdge`\n" + " :return: An orientedViewEdgeIterator pointing to the given ViewEdge.\n" + " :rtype: :class:`orientedViewEdgeIterator`"); static PyObject *ViewVertex_edges_iterator(BPy_ViewVertex *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"edge", NULL}; - PyObject *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); + static const char *kwlist[] = {"edge", NULL}; + PyObject *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); } static PyMethodDef BPy_ViewVertex_methods[] = { - {"edges_begin", (PyCFunction)ViewVertex_edges_begin, METH_NOARGS, ViewVertex_edges_begin_doc}, - {"edges_end", (PyCFunction)ViewVertex_edges_end, METH_NOARGS, ViewVertex_edges_end_doc}, - {"edges_iterator", (PyCFunction)ViewVertex_edges_iterator, METH_VARARGS | METH_KEYWORDS, - ViewVertex_edges_iterator_doc}, - {NULL, NULL, 0, NULL}, + {"edges_begin", (PyCFunction)ViewVertex_edges_begin, METH_NOARGS, ViewVertex_edges_begin_doc}, + {"edges_end", (PyCFunction)ViewVertex_edges_end, METH_NOARGS, ViewVertex_edges_end_doc}, + {"edges_iterator", + (PyCFunction)ViewVertex_edges_iterator, + METH_VARARGS | METH_KEYWORDS, + ViewVertex_edges_iterator_doc}, + {NULL, NULL, 0, NULL}, }; /*----------------------ViewVertex get/setters ----------------------------*/ PyDoc_STRVAR(ViewVertex_nature_doc, -"The nature of this ViewVertex.\n" -"\n" -":type: :class:`Nature`"); + "The nature of this ViewVertex.\n" + "\n" + ":type: :class:`Nature`"); static PyObject *ViewVertex_nature_get(BPy_ViewVertex *self, void *UNUSED(closure)) { - Nature::VertexNature nature = self->vv->getNature(); - if (PyErr_Occurred()) - return NULL; - return BPy_Nature_from_Nature(nature); // return a copy + Nature::VertexNature nature = self->vv->getNature(); + if (PyErr_Occurred()) + return NULL; + return BPy_Nature_from_Nature(nature); // return a copy } static int ViewVertex_nature_set(BPy_ViewVertex *self, PyObject *value, void *UNUSED(closure)) { - if (!BPy_Nature_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be a Nature"); - return -1; - } - self->vv->setNature(PyLong_AsLong((PyObject *)&((BPy_Nature *)value)->i)); - return 0; + if (!BPy_Nature_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be a Nature"); + return -1; + } + self->vv->setNature(PyLong_AsLong((PyObject *)&((BPy_Nature *)value)->i)); + return 0; } static PyGetSetDef BPy_ViewVertex_getseters[] = { - {(char *)"nature", (getter)ViewVertex_nature_get, (setter)ViewVertex_nature_set, - (char *)ViewVertex_nature_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"nature", + (getter)ViewVertex_nature_get, + (setter)ViewVertex_nature_set, + (char *)ViewVertex_nature_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_ViewVertex type definition ------------------------------*/ PyTypeObject ViewVertex_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ViewVertex", /* tp_name */ - sizeof(BPy_ViewVertex), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ViewVertex_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_ViewVertex_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_ViewVertex_getseters, /* tp_getset */ - &Interface0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ViewVertex_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "ViewVertex", /* tp_name */ + sizeof(BPy_ViewVertex), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ViewVertex_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_ViewVertex_methods, /* tp_methods */ + 0, /* tp_members */ + BPy_ViewVertex_getseters, /* tp_getset */ + &Interface0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ViewVertex_init, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.h b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.h index 63bff6557fc..6769efa4673 100644 --- a/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.h +++ b/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.h @@ -37,8 +37,8 @@ extern PyTypeObject ViewVertex_Type; /*---------------------------Python BPy_ViewVertex structure definition----------*/ typedef struct { - BPy_Interface0D py_if0D; - ViewVertex *vv; + BPy_Interface0D py_if0D; + ViewVertex *vv; } BPy_ViewVertex; /////////////////////////////////////////////////////////////////////////////////////////// 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 0df055194ae..3637899fbc2 100644 --- a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp @@ -33,342 +33,381 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- -PyDoc_STRVAR(StrokeVertex_doc, -"Class hierarchy: :class:`Interface0D` > :class:`CurvePoint` > :class:`StrokeVertex`\n" -"\n" -"Class to define a stroke vertex.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __init__(brother)\n" -"\n" -" Copy constructor.\n" -"\n" -" :arg brother: A StrokeVertex object.\n" -" :type brother: :class:`StrokeVertex`\n" -"\n" -".. method:: __init__(first_vertex, second_vertex, t3d)\n" -"\n" -" Build a stroke vertex from 2 stroke vertices and an interpolation\n" -" parameter.\n" -"\n" -" :arg first_vertex: The first StrokeVertex.\n" -" :type first_vertex: :class:`StrokeVertex`\n" -" :arg second_vertex: The second StrokeVertex.\n" -" :type second_vertex: :class:`StrokeVertex`\n" -" :arg t3d: An interpolation parameter.\n" -" :type t3d: float\n" -"\n" -".. method:: __init__(point)\n" -"\n" -" Build a stroke vertex from a CurvePoint\n" -"\n" -" :arg point: A CurvePoint object.\n" -" :type point: :class:`CurvePoint`\n" -"\n" -".. method:: __init__(svertex)\n" -"\n" -" Build a stroke vertex from a SVertex\n" -"\n" -" :arg svertex: An SVertex object.\n" -" :type svertex: :class:`SVertex`\n" -"\n" -".. method:: __init__(svertex, attribute)\n" -"\n" -" Build a stroke vertex from an SVertex and a StrokeAttribute object.\n" -"\n" -" :arg svertex: An SVertex object.\n" -" :type svertex: :class:`SVertex`\n" -" :arg attribute: A StrokeAttribute object.\n" -" :type attribute: :class:`StrokeAttribute`"); +PyDoc_STRVAR( + StrokeVertex_doc, + "Class hierarchy: :class:`Interface0D` > :class:`CurvePoint` > :class:`StrokeVertex`\n" + "\n" + "Class to define a stroke vertex.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __init__(brother)\n" + "\n" + " Copy constructor.\n" + "\n" + " :arg brother: A StrokeVertex object.\n" + " :type brother: :class:`StrokeVertex`\n" + "\n" + ".. method:: __init__(first_vertex, second_vertex, t3d)\n" + "\n" + " Build a stroke vertex from 2 stroke vertices and an interpolation\n" + " parameter.\n" + "\n" + " :arg first_vertex: The first StrokeVertex.\n" + " :type first_vertex: :class:`StrokeVertex`\n" + " :arg second_vertex: The second StrokeVertex.\n" + " :type second_vertex: :class:`StrokeVertex`\n" + " :arg t3d: An interpolation parameter.\n" + " :type t3d: float\n" + "\n" + ".. method:: __init__(point)\n" + "\n" + " Build a stroke vertex from a CurvePoint\n" + "\n" + " :arg point: A CurvePoint object.\n" + " :type point: :class:`CurvePoint`\n" + "\n" + ".. method:: __init__(svertex)\n" + "\n" + " Build a stroke vertex from a SVertex\n" + "\n" + " :arg svertex: An SVertex object.\n" + " :type svertex: :class:`SVertex`\n" + "\n" + ".. method:: __init__(svertex, attribute)\n" + "\n" + " Build a stroke vertex from an SVertex and a StrokeAttribute object.\n" + "\n" + " :arg svertex: An SVertex object.\n" + " :type svertex: :class:`SVertex`\n" + " :arg attribute: A StrokeAttribute object.\n" + " :type attribute: :class:`StrokeAttribute`"); static int StrokeVertex_init(BPy_StrokeVertex *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"first_vertex", "second_vertex", "t3d", NULL}; - static const char *kwlist_3[] = {"point", NULL}; - static const char *kwlist_4[] = {"svertex", "attribute", NULL}; - PyObject *obj1 = 0, *obj2 = 0; - float t3d; - - if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &StrokeVertex_Type, &obj1)) { - if (!obj1) { - self->sv = new StrokeVertex(); - } - else { - if (!((BPy_StrokeVertex *)obj1)->sv) { - PyErr_SetString(PyExc_TypeError, "argument 1 is an invalid StrokeVertex object"); - return -1; - } - self->sv = new StrokeVertex(*(((BPy_StrokeVertex *)obj1)->sv)); - } - } - else if (PyErr_Clear(), - PyArg_ParseTupleAndKeywords(args, kwds, "O!O!f", (char **)kwlist_2, - &StrokeVertex_Type, &obj1, &StrokeVertex_Type, &obj2, &t3d)) - { - StrokeVertex *sv1 = ((BPy_StrokeVertex *)obj1)->sv; - StrokeVertex *sv2 = ((BPy_StrokeVertex *)obj2)->sv; - if (!sv1 || (sv1->A() == 0 && sv1->B() == 0)) { - PyErr_SetString(PyExc_TypeError, "argument 1 is an invalid StrokeVertex object"); - return -1; - } - if (!sv2 || (sv2->A() == 0 && sv2->B() == 0)) { - PyErr_SetString(PyExc_TypeError, "argument 2 is an invalid StrokeVertex object"); - return -1; - } - self->sv = new StrokeVertex(sv1, sv2, t3d); - } - else if (PyErr_Clear(), - PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist_3, &CurvePoint_Type, &obj1)) - { - CurvePoint *cp = ((BPy_CurvePoint *)obj1)->cp; - if (!cp || cp->A() == 0 || cp->B() == 0) { - PyErr_SetString(PyExc_TypeError, "argument 1 is an invalid CurvePoint object"); - return -1; - } - self->sv = new StrokeVertex(cp); - } - else if (PyErr_Clear(), (obj2 = 0), - PyArg_ParseTupleAndKeywords(args, kwds, "O!|O!", (char **)kwlist_4, - &SVertex_Type, &obj1, &StrokeAttribute_Type, &obj2)) - { - if (!obj2) - self->sv = new StrokeVertex(((BPy_SVertex *)obj1)->sv); - else - self->sv = new StrokeVertex(((BPy_SVertex *)obj1)->sv, *(((BPy_StrokeAttribute *)obj2)->sa)); - } - else { - PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); - return -1; - } - self->py_cp.cp = self->sv; - self->py_cp.py_if0D.if0D = self->sv; - self->py_cp.py_if0D.borrowed = false; - return 0; + static const char *kwlist_1[] = {"brother", NULL}; + static const char *kwlist_2[] = {"first_vertex", "second_vertex", "t3d", NULL}; + static const char *kwlist_3[] = {"point", NULL}; + static const char *kwlist_4[] = {"svertex", "attribute", NULL}; + PyObject *obj1 = 0, *obj2 = 0; + float t3d; + + if (PyArg_ParseTupleAndKeywords( + args, kwds, "|O!", (char **)kwlist_1, &StrokeVertex_Type, &obj1)) { + if (!obj1) { + self->sv = new StrokeVertex(); + } + else { + if (!((BPy_StrokeVertex *)obj1)->sv) { + PyErr_SetString(PyExc_TypeError, "argument 1 is an invalid StrokeVertex object"); + return -1; + } + self->sv = new StrokeVertex(*(((BPy_StrokeVertex *)obj1)->sv)); + } + } + else if (PyErr_Clear(), + PyArg_ParseTupleAndKeywords(args, + kwds, + "O!O!f", + (char **)kwlist_2, + &StrokeVertex_Type, + &obj1, + &StrokeVertex_Type, + &obj2, + &t3d)) { + StrokeVertex *sv1 = ((BPy_StrokeVertex *)obj1)->sv; + StrokeVertex *sv2 = ((BPy_StrokeVertex *)obj2)->sv; + if (!sv1 || (sv1->A() == 0 && sv1->B() == 0)) { + PyErr_SetString(PyExc_TypeError, "argument 1 is an invalid StrokeVertex object"); + return -1; + } + if (!sv2 || (sv2->A() == 0 && sv2->B() == 0)) { + PyErr_SetString(PyExc_TypeError, "argument 2 is an invalid StrokeVertex object"); + return -1; + } + self->sv = new StrokeVertex(sv1, sv2, t3d); + } + else if (PyErr_Clear(), + PyArg_ParseTupleAndKeywords( + args, kwds, "O!", (char **)kwlist_3, &CurvePoint_Type, &obj1)) { + CurvePoint *cp = ((BPy_CurvePoint *)obj1)->cp; + if (!cp || cp->A() == 0 || cp->B() == 0) { + PyErr_SetString(PyExc_TypeError, "argument 1 is an invalid CurvePoint object"); + return -1; + } + self->sv = new StrokeVertex(cp); + } + else if (PyErr_Clear(), + (obj2 = 0), + PyArg_ParseTupleAndKeywords(args, + kwds, + "O!|O!", + (char **)kwlist_4, + &SVertex_Type, + &obj1, + &StrokeAttribute_Type, + &obj2)) { + if (!obj2) + self->sv = new StrokeVertex(((BPy_SVertex *)obj1)->sv); + else + self->sv = new StrokeVertex(((BPy_SVertex *)obj1)->sv, *(((BPy_StrokeAttribute *)obj2)->sa)); + } + else { + PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); + return -1; + } + self->py_cp.cp = self->sv; + self->py_cp.py_if0D.if0D = self->sv; + self->py_cp.py_if0D.borrowed = false; + return 0; } -// real operator[] (const int i) const -// real & operator[] (const int i) +// real operator[] (const int i) const +// real & operator[] (const int i) /*----------------------mathutils callbacks ----------------------------*/ static int StrokeVertex_mathutils_check(BaseMathObject *bmo) { - if (!BPy_StrokeVertex_Check(bmo->cb_user)) - return -1; - return 0; + if (!BPy_StrokeVertex_Check(bmo->cb_user)) + return -1; + return 0; } static int StrokeVertex_mathutils_get(BaseMathObject *bmo, int /*subtype*/) { - BPy_StrokeVertex *self = (BPy_StrokeVertex *)bmo->cb_user; - bmo->data[0] = (float)self->sv->x(); - bmo->data[1] = (float)self->sv->y(); - return 0; + BPy_StrokeVertex *self = (BPy_StrokeVertex *)bmo->cb_user; + bmo->data[0] = (float)self->sv->x(); + bmo->data[1] = (float)self->sv->y(); + return 0; } static int StrokeVertex_mathutils_set(BaseMathObject *bmo, int /*subtype*/) { - BPy_StrokeVertex *self = (BPy_StrokeVertex *)bmo->cb_user; - self->sv->setX((real)bmo->data[0]); - self->sv->setY((real)bmo->data[1]); - return 0; + BPy_StrokeVertex *self = (BPy_StrokeVertex *)bmo->cb_user; + self->sv->setX((real)bmo->data[0]); + self->sv->setY((real)bmo->data[1]); + return 0; } static int StrokeVertex_mathutils_get_index(BaseMathObject *bmo, int /*subtype*/, int index) { - BPy_StrokeVertex *self = (BPy_StrokeVertex *)bmo->cb_user; - switch (index) { - case 0: bmo->data[0] = (float)self->sv->x(); break; - case 1: bmo->data[1] = (float)self->sv->y(); break; - default: - return -1; - } - return 0; + BPy_StrokeVertex *self = (BPy_StrokeVertex *)bmo->cb_user; + switch (index) { + case 0: + bmo->data[0] = (float)self->sv->x(); + break; + case 1: + bmo->data[1] = (float)self->sv->y(); + break; + default: + return -1; + } + return 0; } static int StrokeVertex_mathutils_set_index(BaseMathObject *bmo, int /*subtype*/, int index) { - BPy_StrokeVertex *self = (BPy_StrokeVertex *)bmo->cb_user; - switch (index) { - case 0: self->sv->setX((real)bmo->data[0]); break; - case 1: self->sv->setY((real)bmo->data[1]); break; - default: - return -1; - } - return 0; + BPy_StrokeVertex *self = (BPy_StrokeVertex *)bmo->cb_user; + switch (index) { + case 0: + self->sv->setX((real)bmo->data[0]); + break; + case 1: + self->sv->setY((real)bmo->data[1]); + break; + default: + return -1; + } + return 0; } static Mathutils_Callback StrokeVertex_mathutils_cb = { - StrokeVertex_mathutils_check, - StrokeVertex_mathutils_get, - StrokeVertex_mathutils_set, - StrokeVertex_mathutils_get_index, - StrokeVertex_mathutils_set_index, + StrokeVertex_mathutils_check, + StrokeVertex_mathutils_get, + StrokeVertex_mathutils_set, + StrokeVertex_mathutils_get_index, + StrokeVertex_mathutils_set_index, }; static unsigned char StrokeVertex_mathutils_cb_index = -1; void StrokeVertex_mathutils_register_callback() { - StrokeVertex_mathutils_cb_index = Mathutils_RegisterCallback(&StrokeVertex_mathutils_cb); + StrokeVertex_mathutils_cb_index = Mathutils_RegisterCallback(&StrokeVertex_mathutils_cb); } /*----------------------StrokeVertex get/setters ----------------------------*/ PyDoc_STRVAR(StrokeVertex_attribute_doc, -"StrokeAttribute for this StrokeVertex.\n" -"\n" -":type: :class:`StrokeAttribute`"); + "StrokeAttribute for this StrokeVertex.\n" + "\n" + ":type: :class:`StrokeAttribute`"); static PyObject *StrokeVertex_attribute_get(BPy_StrokeVertex *self, void *UNUSED(closure)) { - return BPy_StrokeAttribute_from_StrokeAttribute(self->sv->attribute()); + return BPy_StrokeAttribute_from_StrokeAttribute(self->sv->attribute()); } -static int StrokeVertex_attribute_set(BPy_StrokeVertex *self, PyObject *value, void *UNUSED(closure)) +static int StrokeVertex_attribute_set(BPy_StrokeVertex *self, + PyObject *value, + void *UNUSED(closure)) { - if (!BPy_StrokeAttribute_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be a StrokeAttribute object"); - return -1; - } - self->sv->setAttribute(*(((BPy_StrokeAttribute *)value)->sa)); - return 0; + if (!BPy_StrokeAttribute_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be a StrokeAttribute object"); + return -1; + } + self->sv->setAttribute(*(((BPy_StrokeAttribute *)value)->sa)); + return 0; } PyDoc_STRVAR(StrokeVertex_curvilinear_abscissa_doc, -"Curvilinear abscissa of this StrokeVertex in the Stroke.\n" -"\n" -":type: float"); + "Curvilinear abscissa of this StrokeVertex in the Stroke.\n" + "\n" + ":type: float"); -static PyObject *StrokeVertex_curvilinear_abscissa_get(BPy_StrokeVertex *self, void *UNUSED(closure)) +static PyObject *StrokeVertex_curvilinear_abscissa_get(BPy_StrokeVertex *self, + void *UNUSED(closure)) { - return PyFloat_FromDouble(self->sv->curvilinearAbscissa()); + return PyFloat_FromDouble(self->sv->curvilinearAbscissa()); } -static int StrokeVertex_curvilinear_abscissa_set(BPy_StrokeVertex *self, PyObject *value, void *UNUSED(closure)) +static int StrokeVertex_curvilinear_abscissa_set(BPy_StrokeVertex *self, + PyObject *value, + void *UNUSED(closure)) { - float scalar; - if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) { /* parsed item not a number */ - PyErr_SetString(PyExc_TypeError, "value must be a number"); - return -1; - } - self->sv->setCurvilinearAbscissa(scalar); - return 0; + float scalar; + if ((scalar = PyFloat_AsDouble(value)) == -1.0f && + PyErr_Occurred()) { /* parsed item not a number */ + PyErr_SetString(PyExc_TypeError, "value must be a number"); + return -1; + } + self->sv->setCurvilinearAbscissa(scalar); + return 0; } PyDoc_STRVAR(StrokeVertex_point_doc, -"2D point coordinates.\n" -"\n" -":type: :class:`mathutils.Vector`"); + "2D point coordinates.\n" + "\n" + ":type: :class:`mathutils.Vector`"); static PyObject *StrokeVertex_point_get(BPy_StrokeVertex *self, void *UNUSED(closure)) { - return Vector_CreatePyObject_cb((PyObject *)self, 2, StrokeVertex_mathutils_cb_index, 0); + return Vector_CreatePyObject_cb((PyObject *)self, 2, StrokeVertex_mathutils_cb_index, 0); } static int StrokeVertex_point_set(BPy_StrokeVertex *self, PyObject *value, void *UNUSED(closure)) { - float v[2]; - if (mathutils_array_parse(v, 2, 2, value, - "value must be a 2-dimensional vector") == -1) - { - return -1; - } - self->sv->setX(v[0]); - self->sv->setY(v[1]); - return 0; + float v[2]; + if (mathutils_array_parse(v, 2, 2, value, "value must be a 2-dimensional vector") == -1) { + return -1; + } + self->sv->setX(v[0]); + self->sv->setY(v[1]); + return 0; } PyDoc_STRVAR(StrokeVertex_stroke_length_doc, -"Stroke length (it is only a value retained by the StrokeVertex,\n" -"and it won't change the real stroke length).\n" -"\n" -":type: float"); + "Stroke length (it is only a value retained by the StrokeVertex,\n" + "and it won't change the real stroke length).\n" + "\n" + ":type: float"); static PyObject *StrokeVertex_stroke_length_get(BPy_StrokeVertex *self, void *UNUSED(closure)) { - return PyFloat_FromDouble(self->sv->strokeLength()); + return PyFloat_FromDouble(self->sv->strokeLength()); } -static int StrokeVertex_stroke_length_set(BPy_StrokeVertex *self, PyObject *value, void *UNUSED(closure)) +static int StrokeVertex_stroke_length_set(BPy_StrokeVertex *self, + PyObject *value, + void *UNUSED(closure)) { - float scalar; - if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) { /* parsed item not a number */ - PyErr_SetString(PyExc_TypeError, "value must be a number"); - return -1; - } - self->sv->setStrokeLength(scalar); - return 0; + float scalar; + if ((scalar = PyFloat_AsDouble(value)) == -1.0f && + PyErr_Occurred()) { /* parsed item not a number */ + PyErr_SetString(PyExc_TypeError, "value must be a number"); + return -1; + } + self->sv->setStrokeLength(scalar); + return 0; } PyDoc_STRVAR(StrokeVertex_u_doc, -"Curvilinear abscissa of this StrokeVertex in the Stroke.\n" -"\n" -":type: float"); + "Curvilinear abscissa of this StrokeVertex in the Stroke.\n" + "\n" + ":type: float"); static PyObject *StrokeVertex_u_get(BPy_StrokeVertex *self, void *UNUSED(closure)) { - return PyFloat_FromDouble(self->sv->u()); + return PyFloat_FromDouble(self->sv->u()); } static PyGetSetDef BPy_StrokeVertex_getseters[] = { - {(char *)"attribute", (getter)StrokeVertex_attribute_get, (setter)StrokeVertex_attribute_set, - (char *)StrokeVertex_attribute_doc, NULL}, - {(char *)"curvilinear_abscissa", (getter)StrokeVertex_curvilinear_abscissa_get, - (setter)StrokeVertex_curvilinear_abscissa_set, - (char *)StrokeVertex_curvilinear_abscissa_doc, NULL}, - {(char *)"point", (getter)StrokeVertex_point_get, (setter)StrokeVertex_point_set, - (char *)StrokeVertex_point_doc, NULL}, - {(char *)"stroke_length", (getter)StrokeVertex_stroke_length_get, (setter)StrokeVertex_stroke_length_set, - (char *)StrokeVertex_stroke_length_doc, NULL}, - {(char *)"u", (getter)StrokeVertex_u_get, (setter)NULL, (char *)StrokeVertex_u_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"attribute", + (getter)StrokeVertex_attribute_get, + (setter)StrokeVertex_attribute_set, + (char *)StrokeVertex_attribute_doc, + NULL}, + {(char *)"curvilinear_abscissa", + (getter)StrokeVertex_curvilinear_abscissa_get, + (setter)StrokeVertex_curvilinear_abscissa_set, + (char *)StrokeVertex_curvilinear_abscissa_doc, + NULL}, + {(char *)"point", + (getter)StrokeVertex_point_get, + (setter)StrokeVertex_point_set, + (char *)StrokeVertex_point_doc, + NULL}, + {(char *)"stroke_length", + (getter)StrokeVertex_stroke_length_get, + (setter)StrokeVertex_stroke_length_set, + (char *)StrokeVertex_stroke_length_doc, + NULL}, + {(char *)"u", (getter)StrokeVertex_u_get, (setter)NULL, (char *)StrokeVertex_u_doc, NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_StrokeVertex type definition ------------------------------*/ PyTypeObject StrokeVertex_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "StrokeVertex", /* tp_name */ - sizeof(BPy_StrokeVertex), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - StrokeVertex_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_StrokeVertex_getseters, /* tp_getset */ - &CurvePoint_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)StrokeVertex_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "StrokeVertex", /* tp_name */ + sizeof(BPy_StrokeVertex), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + StrokeVertex_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + BPy_StrokeVertex_getseters, /* tp_getset */ + &CurvePoint_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)StrokeVertex_init, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.h b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.h index a7bbae59c38..e2eab6ab887 100644 --- a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.h +++ b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.h @@ -33,12 +33,13 @@ extern "C" { extern PyTypeObject StrokeVertex_Type; -#define BPy_StrokeVertex_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&StrokeVertex_Type)) +#define BPy_StrokeVertex_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&StrokeVertex_Type)) /*---------------------------Python BPy_StrokeVertex structure definition----------*/ typedef struct { - BPy_CurvePoint py_cp; - StrokeVertex *sv; + BPy_CurvePoint py_cp; + StrokeVertex *sv; } BPy_StrokeVertex; /*---------------------------Python BPy_StrokeVertex visible prototypes-----------*/ 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 49a1e7cc8b3..87873677189 100644 --- a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.cpp @@ -32,112 +32,114 @@ extern "C" { /*----------------------NonTVertex methods ----------------------------*/ PyDoc_STRVAR(NonTVertex_doc, -"Class hierarchy: :class:`Interface0D` > :class:`ViewVertex` > :class:`NonTVertex`\n" -"\n" -"View vertex for corners, cusps, etc. associated to a single SVertex.\n" -"Can be associated to 2 or more view edges.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __init__(svertex)\n" -"\n" -" Build a NonTVertex from a SVertex.\n" -"\n" -" :arg svertex: An SVertex object.\n" -" :type svertex: :class:`SVertex`"); + "Class hierarchy: :class:`Interface0D` > :class:`ViewVertex` > :class:`NonTVertex`\n" + "\n" + "View vertex for corners, cusps, etc. associated to a single SVertex.\n" + "Can be associated to 2 or more view edges.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __init__(svertex)\n" + "\n" + " Build a NonTVertex from a SVertex.\n" + "\n" + " :arg svertex: An SVertex object.\n" + " :type svertex: :class:`SVertex`"); /* Note: No copy constructor in Python because the C++ copy constructor is 'protected'. */ 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)) - return -1; - if (!obj) - self->ntv = new NonTVertex(); - 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; - return 0; + static const char *kwlist[] = {"svertex", NULL}; + PyObject *obj = 0; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &SVertex_Type, &obj)) + return -1; + if (!obj) + self->ntv = new NonTVertex(); + 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; + return 0; } /*----------------------NonTVertex get/setters ----------------------------*/ PyDoc_STRVAR(NonTVertex_svertex_doc, -"The SVertex on top of which this NonTVertex is built.\n" -"\n" -":type: :class:`SVertex`"); + "The SVertex on top of which this NonTVertex is built.\n" + "\n" + ":type: :class:`SVertex`"); static PyObject *NonTVertex_svertex_get(BPy_NonTVertex *self, void *UNUSED(closure)) { - SVertex *v = self->ntv->svertex(); - if (v) - return BPy_SVertex_from_SVertex(*v); - Py_RETURN_NONE; + SVertex *v = self->ntv->svertex(); + if (v) + return BPy_SVertex_from_SVertex(*v); + Py_RETURN_NONE; } static int NonTVertex_svertex_set(BPy_NonTVertex *self, PyObject *value, void *UNUSED(closure)) { - if (!BPy_SVertex_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be an SVertex"); - return -1; - } - self->ntv->setSVertex(((BPy_SVertex *)value)->sv); - return 0; + if (!BPy_SVertex_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an SVertex"); + return -1; + } + self->ntv->setSVertex(((BPy_SVertex *)value)->sv); + return 0; } static PyGetSetDef BPy_NonTVertex_getseters[] = { - {(char *)"svertex", (getter)NonTVertex_svertex_get, (setter)NonTVertex_svertex_set, - (char *)NonTVertex_svertex_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"svertex", + (getter)NonTVertex_svertex_get, + (setter)NonTVertex_svertex_set, + (char *)NonTVertex_svertex_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_NonTVertex type definition ------------------------------*/ PyTypeObject NonTVertex_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "NonTVertex", /* tp_name */ - sizeof(BPy_NonTVertex), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - NonTVertex_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_NonTVertex_getseters, /* tp_getset */ - &ViewVertex_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)NonTVertex_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "NonTVertex", /* tp_name */ + sizeof(BPy_NonTVertex), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + NonTVertex_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + BPy_NonTVertex_getseters, /* tp_getset */ + &ViewVertex_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)NonTVertex_init, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.h b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.h index fc65dd3eb0f..fdea985a125 100644 --- a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.h +++ b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_NonTVertex.h @@ -37,8 +37,8 @@ extern PyTypeObject NonTVertex_Type; /*---------------------------Python BPy_NonTVertex structure definition----------*/ typedef struct { - BPy_ViewVertex py_vv; - NonTVertex *ntv; + BPy_ViewVertex py_vv; + NonTVertex *ntv; } BPy_NonTVertex; /////////////////////////////////////////////////////////////////////////////////////////// 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 f24d551fad8..9a8592aaea5 100644 --- a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp +++ b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp @@ -35,205 +35,216 @@ extern "C" { /*----------------------TVertex methods ----------------------------*/ PyDoc_STRVAR(TVertex_doc, -"Class hierarchy: :class:`Interface0D` > :class:`ViewVertex` > :class:`TVertex`\n" -"\n" -"Class to define a T vertex, i.e. an intersection between two edges.\n" -"It points towards two SVertex and four ViewEdges. Among the\n" -"ViewEdges, two are front and the other two are back. Basically a\n" -"front edge hides part of a back edge. So, among the back edges, one\n" -"is of invisibility N and the other of invisibility N+1.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor."); + "Class hierarchy: :class:`Interface0D` > :class:`ViewVertex` > :class:`TVertex`\n" + "\n" + "Class to define a T vertex, i.e. an intersection between two edges.\n" + "It points towards two SVertex and four ViewEdges. Among the\n" + "ViewEdges, two are front and the other two are back. Basically a\n" + "front edge hides part of a back edge. So, among the back edges, one\n" + "is of invisibility N and the other of invisibility N+1.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor."); /* Note: No copy constructor in Python because the C++ copy constructor is 'protected'. */ static int TVertex_init(BPy_TVertex *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; - - 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; - self->py_vv.py_if0D.borrowed = false; - return 0; + static const char *kwlist[] = {NULL}; + + 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; + self->py_vv.py_if0D.borrowed = false; + return 0; } PyDoc_STRVAR(TVertex_get_svertex_doc, -".. method:: get_svertex(fedge)\n" -"\n" -" Returns the SVertex (among the 2) belonging to the given FEdge.\n" -"\n" -" :arg fedge: An FEdge object.\n" -" :type fedge: :class:`FEdge`\n" -" :return: The SVertex belonging to the given FEdge.\n" -" :rtype: :class:`SVertex`"); - -static PyObject *TVertex_get_svertex( BPy_TVertex *self, PyObject *args, PyObject *kwds) + ".. method:: get_svertex(fedge)\n" + "\n" + " Returns the SVertex (among the 2) belonging to the given FEdge.\n" + "\n" + " :arg fedge: An FEdge object.\n" + " :type fedge: :class:`FEdge`\n" + " :return: The SVertex belonging to the given FEdge.\n" + " :rtype: :class:`SVertex`"); + +static PyObject *TVertex_get_svertex(BPy_TVertex *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"fedge", NULL}; - PyObject *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) - return BPy_SVertex_from_SVertex(*sv); - Py_RETURN_NONE; + static const char *kwlist[] = {"fedge", NULL}; + PyObject *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) + return BPy_SVertex_from_SVertex(*sv); + Py_RETURN_NONE; } PyDoc_STRVAR(TVertex_get_mate_doc, -".. method:: get_mate(viewedge)\n" -"\n" -" Returns the mate edge of the ViewEdge given as argument. If the\n" -" ViewEdge is frontEdgeA, frontEdgeB is returned. If the ViewEdge is\n" -" frontEdgeB, frontEdgeA is returned. Same for back edges.\n" -"\n" -" :arg viewedge: A ViewEdge object.\n" -" :type viewedge: :class:`ViewEdge`\n" -" :return: The mate edge of the given ViewEdge.\n" -" :rtype: :class:`ViewEdge`"); - -static PyObject *TVertex_get_mate( BPy_TVertex *self, PyObject *args, PyObject *kwds) + ".. method:: get_mate(viewedge)\n" + "\n" + " Returns the mate edge of the ViewEdge given as argument. If the\n" + " ViewEdge is frontEdgeA, frontEdgeB is returned. If the ViewEdge is\n" + " frontEdgeB, frontEdgeA is returned. Same for back edges.\n" + "\n" + " :arg viewedge: A ViewEdge object.\n" + " :type viewedge: :class:`ViewEdge`\n" + " :return: The mate edge of the given ViewEdge.\n" + " :rtype: :class:`ViewEdge`"); + +static PyObject *TVertex_get_mate(BPy_TVertex *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"viewedge", NULL}; - PyObject *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) - return BPy_ViewEdge_from_ViewEdge(*ve); - Py_RETURN_NONE; + static const char *kwlist[] = {"viewedge", NULL}; + PyObject *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) + return BPy_ViewEdge_from_ViewEdge(*ve); + Py_RETURN_NONE; } static PyMethodDef BPy_TVertex_methods[] = { - {"get_svertex", (PyCFunction)TVertex_get_svertex, METH_VARARGS | METH_KEYWORDS, TVertex_get_svertex_doc}, - {"get_mate", (PyCFunction)TVertex_get_mate, METH_VARARGS | METH_KEYWORDS, TVertex_get_mate_doc}, - {NULL, NULL, 0, NULL}, + {"get_svertex", + (PyCFunction)TVertex_get_svertex, + METH_VARARGS | METH_KEYWORDS, + TVertex_get_svertex_doc}, + {"get_mate", + (PyCFunction)TVertex_get_mate, + METH_VARARGS | METH_KEYWORDS, + TVertex_get_mate_doc}, + {NULL, NULL, 0, NULL}, }; /*----------------------TVertex get/setters ----------------------------*/ PyDoc_STRVAR(TVertex_front_svertex_doc, -"The SVertex that is closer to the viewpoint.\n" -"\n" -":type: :class:`SVertex`"); + "The SVertex that is closer to the viewpoint.\n" + "\n" + ":type: :class:`SVertex`"); static PyObject *TVertex_front_svertex_get(BPy_TVertex *self, void *UNUSED(closure)) { - SVertex *v = self->tv->frontSVertex(); - if (v) - return BPy_SVertex_from_SVertex(*v); - Py_RETURN_NONE; + SVertex *v = self->tv->frontSVertex(); + if (v) + return BPy_SVertex_from_SVertex(*v); + Py_RETURN_NONE; } static int TVertex_front_svertex_set(BPy_TVertex *self, PyObject *value, void *UNUSED(closure)) { - if (!BPy_SVertex_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be an SVertex"); - return -1; - } - self->tv->setFrontSVertex(((BPy_SVertex *)value)->sv); - return 0; + if (!BPy_SVertex_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an SVertex"); + return -1; + } + self->tv->setFrontSVertex(((BPy_SVertex *)value)->sv); + return 0; } PyDoc_STRVAR(TVertex_back_svertex_doc, -"The SVertex that is further away from the viewpoint.\n" -"\n" -":type: :class:`SVertex`"); + "The SVertex that is further away from the viewpoint.\n" + "\n" + ":type: :class:`SVertex`"); static PyObject *TVertex_back_svertex_get(BPy_TVertex *self, void *UNUSED(closure)) { - SVertex *v = self->tv->backSVertex(); - if (v) - return BPy_SVertex_from_SVertex(*v); - Py_RETURN_NONE; + SVertex *v = self->tv->backSVertex(); + if (v) + return BPy_SVertex_from_SVertex(*v); + Py_RETURN_NONE; } static int TVertex_back_svertex_set(BPy_TVertex *self, PyObject *value, void *UNUSED(closure)) { - if (!BPy_SVertex_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be an SVertex"); - return -1; - } - self->tv->setBackSVertex(((BPy_SVertex *)value)->sv); - return 0; + if (!BPy_SVertex_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an SVertex"); + return -1; + } + self->tv->setBackSVertex(((BPy_SVertex *)value)->sv); + return 0; } PyDoc_STRVAR(TVertex_id_doc, -"The Id of this TVertex.\n" -"\n" -":type: :class:`Id`"); + "The Id of this TVertex.\n" + "\n" + ":type: :class:`Id`"); static PyObject *TVertex_id_get(BPy_TVertex *self, void *UNUSED(closure)) { - Id id(self->tv->getId()); - return BPy_Id_from_Id(id); // return a copy + Id id(self->tv->getId()); + return BPy_Id_from_Id(id); // return a copy } static int TVertex_id_set(BPy_TVertex *self, PyObject *value, void *UNUSED(closure)) { - if (!BPy_Id_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be an Id"); - return -1; - } - self->tv->setId(*(((BPy_Id *)value)->id)); - return 0; + if (!BPy_Id_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an Id"); + return -1; + } + self->tv->setId(*(((BPy_Id *)value)->id)); + return 0; } static PyGetSetDef BPy_TVertex_getseters[] = { - {(char *)"front_svertex", (getter)TVertex_front_svertex_get, (setter)TVertex_front_svertex_set, - (char *)TVertex_front_svertex_doc, NULL}, - {(char *)"back_svertex", (getter)TVertex_back_svertex_get, (setter)TVertex_back_svertex_set, - (char *)TVertex_back_svertex_doc, NULL}, - {(char *)"id", (getter)TVertex_id_get, (setter)TVertex_id_set, (char *)TVertex_id_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"front_svertex", + (getter)TVertex_front_svertex_get, + (setter)TVertex_front_svertex_set, + (char *)TVertex_front_svertex_doc, + NULL}, + {(char *)"back_svertex", + (getter)TVertex_back_svertex_get, + (setter)TVertex_back_svertex_set, + (char *)TVertex_back_svertex_doc, + NULL}, + {(char *)"id", (getter)TVertex_id_get, (setter)TVertex_id_set, (char *)TVertex_id_doc, NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_TVertex type definition ------------------------------*/ PyTypeObject TVertex_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "TVertex", /* tp_name */ - sizeof(BPy_TVertex), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - TVertex_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_TVertex_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_TVertex_getseters, /* tp_getset */ - &ViewVertex_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)TVertex_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "TVertex", /* tp_name */ + sizeof(BPy_TVertex), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + TVertex_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_TVertex_methods, /* tp_methods */ + 0, /* tp_members */ + BPy_TVertex_getseters, /* tp_getset */ + &ViewVertex_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)TVertex_init, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.h b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.h index a7526ffd1c4..165ad976fdf 100644 --- a/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.h +++ b/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.h @@ -37,8 +37,8 @@ extern PyTypeObject TVertex_Type; /*---------------------------Python BPy_TVertex structure definition----------*/ typedef struct { - BPy_ViewVertex py_vv; - TVertex *tv; + BPy_ViewVertex py_vv; + TVertex *tv; } BPy_TVertex; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp index 3bef47efd17..7ca783d9aa4 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.cpp @@ -35,336 +35,364 @@ extern "C" { /*----------------------FEdge methods ----------------------------*/ PyDoc_STRVAR(FEdge_doc, -"Class hierarchy: :class:`Interface1D` > :class:`FEdge`\n" -"\n" -"Base Class for feature edges. This FEdge can represent a silhouette,\n" -"a crease, a ridge/valley, a border or a suggestive contour. For\n" -"silhouettes, the FEdge is oriented so that the visible face lies on\n" -"the left of the edge. For borders, the FEdge is oriented so that the\n" -"face lies on the left of the edge. An FEdge can represent an initial\n" -"edge of the mesh or runs across a face of the initial mesh depending\n" -"on the smoothness or sharpness of the mesh. This class is specialized\n" -"into a smooth and a sharp version since their properties slightly vary\n" -"from one to the other.\n" -"\n" -".. method:: FEdge()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: FEdge(brother)\n" -"\n" -" Copy constructor.\n" -"\n" -" :arg brother: An FEdge object.\n" -" :type brother: :class:`FEdge`\n" -"\n" -".. method:: FEdge(first_vertex, second_vertex)\n" -"\n" -" Builds an FEdge going from the first vertex to the second.\n" -"\n" -" :arg first_vertex: The first SVertex.\n" -" :type first_vertex: :class:`SVertex`\n" -" :arg second_vertex: The second SVertex.\n" -" :type second_vertex: :class:`SVertex`"); + "Class hierarchy: :class:`Interface1D` > :class:`FEdge`\n" + "\n" + "Base Class for feature edges. This FEdge can represent a silhouette,\n" + "a crease, a ridge/valley, a border or a suggestive contour. For\n" + "silhouettes, the FEdge is oriented so that the visible face lies on\n" + "the left of the edge. For borders, the FEdge is oriented so that the\n" + "face lies on the left of the edge. An FEdge can represent an initial\n" + "edge of the mesh or runs across a face of the initial mesh depending\n" + "on the smoothness or sharpness of the mesh. This class is specialized\n" + "into a smooth and a sharp version since their properties slightly vary\n" + "from one to the other.\n" + "\n" + ".. method:: FEdge()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: FEdge(brother)\n" + "\n" + " Copy constructor.\n" + "\n" + " :arg brother: An FEdge object.\n" + " :type brother: :class:`FEdge`\n" + "\n" + ".. method:: FEdge(first_vertex, second_vertex)\n" + "\n" + " Builds an FEdge going from the first vertex to the second.\n" + "\n" + " :arg first_vertex: The first SVertex.\n" + " :type first_vertex: :class:`SVertex`\n" + " :arg second_vertex: The second SVertex.\n" + " :type second_vertex: :class:`SVertex`"); static int FEdge_init(BPy_FEdge *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"first_vertex", "second_vertex", NULL}; - PyObject *obj1 = 0, *obj2 = 0; - - if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &FEdge_Type, &obj1)) { - if (!obj1) - self->fe = new FEdge(); - else - self->fe = new FEdge(*(((BPy_FEdge *)obj1)->fe)); - } - else if (PyErr_Clear(), - PyArg_ParseTupleAndKeywords(args, kwds, "O!O!", (char **)kwlist_2, - &SVertex_Type, &obj1, &SVertex_Type, &obj2)) - { - self->fe = new FEdge(((BPy_SVertex *)obj1)->sv, ((BPy_SVertex *)obj2)->sv); - } - else { - PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); - return -1; - } - self->py_if1D.if1D = self->fe; - self->py_if1D.borrowed = false; - return 0; + static const char *kwlist_1[] = {"brother", NULL}; + static const char *kwlist_2[] = {"first_vertex", "second_vertex", NULL}; + PyObject *obj1 = 0, *obj2 = 0; + + if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &FEdge_Type, &obj1)) { + if (!obj1) + self->fe = new FEdge(); + else + self->fe = new FEdge(*(((BPy_FEdge *)obj1)->fe)); + } + else if (PyErr_Clear(), + PyArg_ParseTupleAndKeywords(args, + kwds, + "O!O!", + (char **)kwlist_2, + &SVertex_Type, + &obj1, + &SVertex_Type, + &obj2)) { + self->fe = new FEdge(((BPy_SVertex *)obj1)->sv, ((BPy_SVertex *)obj2)->sv); + } + else { + PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); + return -1; + } + self->py_if1D.if1D = self->fe; + self->py_if1D.borrowed = false; + return 0; } /*----------------------FEdge sequence protocol ----------------------------*/ static Py_ssize_t FEdge_sq_length(BPy_FEdge * /*self*/) { - return 2; + return 2; } static PyObject *FEdge_sq_item(BPy_FEdge *self, int keynum) { - if (keynum < 0) - keynum += FEdge_sq_length(self); - if (keynum == 0 || keynum == 1) { - SVertex *v = self->fe->operator[](keynum); - if (v) - return BPy_SVertex_from_SVertex(*v); - Py_RETURN_NONE; - } - PyErr_Format(PyExc_IndexError, "FEdge[index]: index %d out of range", keynum); - return NULL; + if (keynum < 0) + keynum += FEdge_sq_length(self); + if (keynum == 0 || keynum == 1) { + SVertex *v = self->fe->operator[](keynum); + if (v) + return BPy_SVertex_from_SVertex(*v); + Py_RETURN_NONE; + } + PyErr_Format(PyExc_IndexError, "FEdge[index]: index %d out of range", keynum); + return NULL; } static PySequenceMethods BPy_FEdge_as_sequence = { - (lenfunc)FEdge_sq_length, /* sq_length */ - NULL, /* sq_concat */ - NULL, /* sq_repeat */ - (ssizeargfunc)FEdge_sq_item, /* sq_item */ - NULL, /* sq_slice */ - NULL, /* sq_ass_item */ - NULL, /* *was* sq_ass_slice */ - NULL, /* sq_contains */ - NULL, /* sq_inplace_concat */ - NULL, /* sq_inplace_repeat */ + (lenfunc)FEdge_sq_length, /* sq_length */ + NULL, /* sq_concat */ + NULL, /* sq_repeat */ + (ssizeargfunc)FEdge_sq_item, /* sq_item */ + NULL, /* sq_slice */ + NULL, /* sq_ass_item */ + NULL, /* *was* sq_ass_slice */ + NULL, /* sq_contains */ + NULL, /* sq_inplace_concat */ + NULL, /* sq_inplace_repeat */ }; /*----------------------FEdge get/setters ----------------------------*/ PyDoc_STRVAR(FEdge_first_svertex_doc, -"The first SVertex constituting this FEdge.\n" -"\n" -":type: :class:`SVertex`"); + "The first SVertex constituting this FEdge.\n" + "\n" + ":type: :class:`SVertex`"); static PyObject *FEdge_first_svertex_get(BPy_FEdge *self, void *UNUSED(closure)) { - SVertex *A = self->fe->vertexA(); - if (A) - return BPy_SVertex_from_SVertex(*A); - Py_RETURN_NONE; + SVertex *A = self->fe->vertexA(); + if (A) + return BPy_SVertex_from_SVertex(*A); + Py_RETURN_NONE; } static int FEdge_first_svertex_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure)) { - if (!BPy_SVertex_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be an SVertex"); - return -1; - } - self->fe->setVertexA(((BPy_SVertex *)value)->sv); - return 0; + if (!BPy_SVertex_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an SVertex"); + return -1; + } + self->fe->setVertexA(((BPy_SVertex *)value)->sv); + return 0; } PyDoc_STRVAR(FEdge_second_svertex_doc, -"The second SVertex constituting this FEdge.\n" -"\n" -":type: :class:`SVertex`"); + "The second SVertex constituting this FEdge.\n" + "\n" + ":type: :class:`SVertex`"); static PyObject *FEdge_second_svertex_get(BPy_FEdge *self, void *UNUSED(closure)) { - SVertex *B = self->fe->vertexB(); - if (B) - return BPy_SVertex_from_SVertex(*B); - Py_RETURN_NONE; + SVertex *B = self->fe->vertexB(); + if (B) + return BPy_SVertex_from_SVertex(*B); + Py_RETURN_NONE; } static int FEdge_second_svertex_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure)) { - if (!BPy_SVertex_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be an SVertex"); - return -1; - } - self->fe->setVertexB(((BPy_SVertex *)value)->sv); - return 0; + if (!BPy_SVertex_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an SVertex"); + return -1; + } + self->fe->setVertexB(((BPy_SVertex *)value)->sv); + return 0; } PyDoc_STRVAR(FEdge_next_fedge_doc, -"The FEdge following this one in the ViewEdge. The value is None if\n" -"this FEdge is the last of the ViewEdge.\n" -"\n" -":type: :class:`FEdge`"); + "The FEdge following this one in the ViewEdge. The value is None if\n" + "this FEdge is the last of the ViewEdge.\n" + "\n" + ":type: :class:`FEdge`"); static PyObject *FEdge_next_fedge_get(BPy_FEdge *self, void *UNUSED(closure)) { - FEdge *fe = self->fe->nextEdge(); - if (fe) - return Any_BPy_FEdge_from_FEdge(*fe); - Py_RETURN_NONE; + FEdge *fe = self->fe->nextEdge(); + if (fe) + return Any_BPy_FEdge_from_FEdge(*fe); + Py_RETURN_NONE; } static int FEdge_next_fedge_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure)) { - if (!BPy_FEdge_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be an FEdge"); - return -1; - } - self->fe->setNextEdge(((BPy_FEdge *)value)->fe); - return 0; + if (!BPy_FEdge_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an FEdge"); + return -1; + } + self->fe->setNextEdge(((BPy_FEdge *)value)->fe); + return 0; } PyDoc_STRVAR(FEdge_previous_fedge_doc, -"The FEdge preceding this one in the ViewEdge. The value is None if\n" -"this FEdge is the first one of the ViewEdge.\n" -"\n" -":type: :class:`FEdge`"); + "The FEdge preceding this one in the ViewEdge. The value is None if\n" + "this FEdge is the first one of the ViewEdge.\n" + "\n" + ":type: :class:`FEdge`"); static PyObject *FEdge_previous_fedge_get(BPy_FEdge *self, void *UNUSED(closure)) { - FEdge *fe = self->fe->previousEdge(); - if (fe) - return Any_BPy_FEdge_from_FEdge(*fe); - Py_RETURN_NONE; + FEdge *fe = self->fe->previousEdge(); + if (fe) + return Any_BPy_FEdge_from_FEdge(*fe); + Py_RETURN_NONE; } static int FEdge_previous_fedge_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure)) { - if (!BPy_FEdge_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be an FEdge"); - return -1; - } - self->fe->setPreviousEdge(((BPy_FEdge *)value)->fe); - return 0; + if (!BPy_FEdge_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an FEdge"); + return -1; + } + self->fe->setPreviousEdge(((BPy_FEdge *)value)->fe); + return 0; } PyDoc_STRVAR(FEdge_viewedge_doc, -"The ViewEdge to which this FEdge belongs to.\n" -"\n" -":type: :class:`ViewEdge`"); + "The ViewEdge to which this FEdge belongs to.\n" + "\n" + ":type: :class:`ViewEdge`"); static PyObject *FEdge_viewedge_get(BPy_FEdge *self, void *UNUSED(closure)) { - ViewEdge *ve = self->fe->viewedge(); - if (ve) - return BPy_ViewEdge_from_ViewEdge(*ve); - Py_RETURN_NONE; + ViewEdge *ve = self->fe->viewedge(); + if (ve) + return BPy_ViewEdge_from_ViewEdge(*ve); + Py_RETURN_NONE; } static int FEdge_viewedge_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure)) { - if (!BPy_ViewEdge_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be an ViewEdge"); - return -1; - } - self->fe->setViewEdge(((BPy_ViewEdge *)value)->ve); - return 0; + if (!BPy_ViewEdge_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an ViewEdge"); + return -1; + } + self->fe->setViewEdge(((BPy_ViewEdge *)value)->ve); + return 0; } PyDoc_STRVAR(FEdge_is_smooth_doc, -"True if this FEdge is a smooth FEdge.\n" -"\n" -":type: bool"); + "True if this FEdge is a smooth FEdge.\n" + "\n" + ":type: bool"); static PyObject *FEdge_is_smooth_get(BPy_FEdge *self, void *UNUSED(closure)) { - return PyBool_from_bool(self->fe->isSmooth()); + return PyBool_from_bool(self->fe->isSmooth()); } static int FEdge_is_smooth_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure)) { - if (!PyBool_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be boolean"); - return -1; - } - self->fe->setSmooth(bool_from_PyBool(value)); - return 0; + if (!PyBool_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be boolean"); + return -1; + } + self->fe->setSmooth(bool_from_PyBool(value)); + return 0; } PyDoc_STRVAR(FEdge_id_doc, -"The Id of this FEdge.\n" -"\n" -":type: :class:`Id`"); + "The Id of this FEdge.\n" + "\n" + ":type: :class:`Id`"); static PyObject *FEdge_id_get(BPy_FEdge *self, void *UNUSED(closure)) { - Id id(self->fe->getId()); - return BPy_Id_from_Id(id); // return a copy + Id id(self->fe->getId()); + return BPy_Id_from_Id(id); // return a copy } static int FEdge_id_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure)) { - if (!BPy_Id_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be an Id"); - return -1; - } - self->fe->setId(*(((BPy_Id *)value)->id)); - return 0; + if (!BPy_Id_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an Id"); + return -1; + } + self->fe->setId(*(((BPy_Id *)value)->id)); + return 0; } PyDoc_STRVAR(FEdge_nature_doc, -"The nature of this FEdge.\n" -"\n" -":type: :class:`Nature`"); + "The nature of this FEdge.\n" + "\n" + ":type: :class:`Nature`"); static PyObject *FEdge_nature_get(BPy_FEdge *self, void *UNUSED(closure)) { - return BPy_Nature_from_Nature(self->fe->getNature()); + return BPy_Nature_from_Nature(self->fe->getNature()); } static int FEdge_nature_set(BPy_FEdge *self, PyObject *value, void *UNUSED(closure)) { - if (!BPy_Nature_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be a Nature"); - return -1; - } - self->fe->setNature(PyLong_AsLong((PyObject *)&((BPy_Nature *)value)->i)); - return 0; + if (!BPy_Nature_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be a Nature"); + return -1; + } + self->fe->setNature(PyLong_AsLong((PyObject *)&((BPy_Nature *)value)->i)); + return 0; } static PyGetSetDef BPy_FEdge_getseters[] = { - {(char *)"first_svertex", (getter)FEdge_first_svertex_get, (setter)FEdge_first_svertex_set, - (char *)FEdge_first_svertex_doc, NULL}, - {(char *)"second_svertex", (getter)FEdge_second_svertex_get, (setter)FEdge_second_svertex_set, - (char *)FEdge_second_svertex_doc, NULL}, - {(char *)"next_fedge", (getter)FEdge_next_fedge_get, (setter)FEdge_next_fedge_set, - (char *)FEdge_next_fedge_doc, NULL}, - {(char *)"previous_fedge", (getter)FEdge_previous_fedge_get, (setter)FEdge_previous_fedge_set, - (char *)FEdge_previous_fedge_doc, NULL}, - {(char *)"viewedge", (getter)FEdge_viewedge_get, (setter)FEdge_viewedge_set, (char *)FEdge_viewedge_doc, NULL}, - {(char *)"is_smooth", (getter)FEdge_is_smooth_get, (setter)FEdge_is_smooth_set, (char *)FEdge_is_smooth_doc, NULL}, - {(char *)"id", (getter)FEdge_id_get, (setter)FEdge_id_set, (char *)FEdge_id_doc, NULL}, - {(char *)"nature", (getter)FEdge_nature_get, (setter)FEdge_nature_set, (char *)FEdge_nature_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"first_svertex", + (getter)FEdge_first_svertex_get, + (setter)FEdge_first_svertex_set, + (char *)FEdge_first_svertex_doc, + NULL}, + {(char *)"second_svertex", + (getter)FEdge_second_svertex_get, + (setter)FEdge_second_svertex_set, + (char *)FEdge_second_svertex_doc, + NULL}, + {(char *)"next_fedge", + (getter)FEdge_next_fedge_get, + (setter)FEdge_next_fedge_set, + (char *)FEdge_next_fedge_doc, + NULL}, + {(char *)"previous_fedge", + (getter)FEdge_previous_fedge_get, + (setter)FEdge_previous_fedge_set, + (char *)FEdge_previous_fedge_doc, + NULL}, + {(char *)"viewedge", + (getter)FEdge_viewedge_get, + (setter)FEdge_viewedge_set, + (char *)FEdge_viewedge_doc, + NULL}, + {(char *)"is_smooth", + (getter)FEdge_is_smooth_get, + (setter)FEdge_is_smooth_set, + (char *)FEdge_is_smooth_doc, + NULL}, + {(char *)"id", (getter)FEdge_id_get, (setter)FEdge_id_set, (char *)FEdge_id_doc, NULL}, + {(char *)"nature", + (getter)FEdge_nature_get, + (setter)FEdge_nature_set, + (char *)FEdge_nature_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_FEdge type definition ------------------------------*/ PyTypeObject FEdge_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "FEdge", /* tp_name */ - sizeof(BPy_FEdge), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - &BPy_FEdge_as_sequence, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - FEdge_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_FEdge_getseters, /* tp_getset */ - &Interface1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)FEdge_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "FEdge", /* tp_name */ + sizeof(BPy_FEdge), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + &BPy_FEdge_as_sequence, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + FEdge_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + BPy_FEdge_getseters, /* tp_getset */ + &Interface1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)FEdge_init, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.h b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.h index 094f59f0908..3ab8c5f8273 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.h +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FEdge.h @@ -37,8 +37,8 @@ extern PyTypeObject FEdge_Type; /*---------------------------Python BPy_FEdge structure definition----------*/ typedef struct { - BPy_Interface1D py_if1D; - FEdge *fe; + BPy_Interface1D py_if1D; + FEdge *fe; } BPy_FEdge; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp index 1932a2fd7ae..1d2d4f51028 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp @@ -34,192 +34,201 @@ extern "C" { /*----------------------CurvePoint methods ----------------------------*/ PyDoc_STRVAR(FrsCurve_doc, -"Class hierarchy: :class:`Interface1D` > :class:`Curve`\n" -"\n" -"Base class for curves made of CurvePoints. :class:`SVertex` is the\n" -"type of the initial curve vertices. A :class:`Chain` is a\n" -"specialization of a Curve.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default Constructor.\n" -"\n" -".. method:: __init__(brother)\n" -"\n" -" Copy Constructor.\n" -"\n" -" :arg brother: A Curve object.\n" -" :type brother: :class:`Curve`\n" -"\n" -".. method:: __init__(id)\n" -"\n" -" Builds a Curve from its Id.\n" -"\n" -" :arg id: An Id object.\n" -" :type id: :class:`Id`"); + "Class hierarchy: :class:`Interface1D` > :class:`Curve`\n" + "\n" + "Base class for curves made of CurvePoints. :class:`SVertex` is the\n" + "type of the initial curve vertices. A :class:`Chain` is a\n" + "specialization of a Curve.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default Constructor.\n" + "\n" + ".. method:: __init__(brother)\n" + "\n" + " Copy Constructor.\n" + "\n" + " :arg brother: A Curve object.\n" + " :type brother: :class:`Curve`\n" + "\n" + ".. method:: __init__(id)\n" + "\n" + " Builds a Curve from its Id.\n" + "\n" + " :arg id: An Id object.\n" + " :type id: :class:`Id`"); static int FrsCurve_init(BPy_FrsCurve *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"id", NULL}; - PyObject *obj = 0; - - if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &FrsCurve_Type, &obj)) { - if (!obj) - self->c = new Curve(); - else - self->c = new Curve(*(((BPy_FrsCurve *)obj)->c)); - } - else if (PyErr_Clear(), - PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist_2, &Id_Type, &obj)) - { - self->c = new Curve(*(((BPy_Id *)obj)->id)); - } - else { - PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); - return -1; - } - self->py_if1D.if1D = self->c; - self->py_if1D.borrowed = false; - return 0; + static const char *kwlist_1[] = {"brother", NULL}; + static const char *kwlist_2[] = {"id", NULL}; + PyObject *obj = 0; + + if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &FrsCurve_Type, &obj)) { + if (!obj) + self->c = new Curve(); + else + self->c = new Curve(*(((BPy_FrsCurve *)obj)->c)); + } + else if (PyErr_Clear(), + PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist_2, &Id_Type, &obj)) { + self->c = new Curve(*(((BPy_Id *)obj)->id)); + } + else { + PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); + return -1; + } + self->py_if1D.if1D = self->c; + self->py_if1D.borrowed = false; + return 0; } PyDoc_STRVAR(FrsCurve_push_vertex_back_doc, -".. method:: push_vertex_back(vertex)\n" -"\n" -" Adds a single vertex at the end of the Curve.\n" -"\n" -" :arg vertex: A vertex object.\n" -" :type vertex: :class:`SVertex` or :class:`CurvePoint`"); + ".. method:: push_vertex_back(vertex)\n" + "\n" + " Adds a single vertex at the end of the Curve.\n" + "\n" + " :arg vertex: A vertex object.\n" + " :type vertex: :class:`SVertex` or :class:`CurvePoint`"); static PyObject *FrsCurve_push_vertex_back(BPy_FrsCurve *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"vertex", NULL}; - PyObject *obj = 0; - - 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); - } - else if (BPy_SVertex_Check(obj)) { - self->c->push_vertex_back(((BPy_SVertex *)obj)->sv); - } - else { - PyErr_SetString(PyExc_TypeError, "invalid argument"); - return NULL; - } - Py_RETURN_NONE; + static const char *kwlist[] = {"vertex", NULL}; + PyObject *obj = 0; + + 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); + } + else if (BPy_SVertex_Check(obj)) { + self->c->push_vertex_back(((BPy_SVertex *)obj)->sv); + } + else { + PyErr_SetString(PyExc_TypeError, "invalid argument"); + return NULL; + } + Py_RETURN_NONE; } PyDoc_STRVAR(FrsCurve_push_vertex_front_doc, -".. method:: push_vertex_front(vertex)\n" -"\n" -" Adds a single vertex at the front of the Curve.\n" -"\n" -" :arg vertex: A vertex object.\n" -" :type vertex: :class:`SVertex` or :class:`CurvePoint`"); + ".. method:: push_vertex_front(vertex)\n" + "\n" + " Adds a single vertex at the front of the Curve.\n" + "\n" + " :arg vertex: A vertex object.\n" + " :type vertex: :class:`SVertex` or :class:`CurvePoint`"); static PyObject *FrsCurve_push_vertex_front(BPy_FrsCurve *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"vertex", NULL}; - PyObject *obj = 0; - - 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); - } - else if (BPy_SVertex_Check(obj)) { - self->c->push_vertex_front(((BPy_SVertex *)obj)->sv); - } - else { - PyErr_SetString(PyExc_TypeError, "invalid argument"); - return NULL; - } - Py_RETURN_NONE; + static const char *kwlist[] = {"vertex", NULL}; + PyObject *obj = 0; + + 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); + } + else if (BPy_SVertex_Check(obj)) { + self->c->push_vertex_front(((BPy_SVertex *)obj)->sv); + } + else { + PyErr_SetString(PyExc_TypeError, "invalid argument"); + return NULL; + } + Py_RETURN_NONE; } static PyMethodDef BPy_FrsCurve_methods[] = { - {"push_vertex_back", (PyCFunction)FrsCurve_push_vertex_back, METH_VARARGS | METH_KEYWORDS, - FrsCurve_push_vertex_back_doc}, - {"push_vertex_front", (PyCFunction)FrsCurve_push_vertex_front, METH_VARARGS | METH_KEYWORDS, - FrsCurve_push_vertex_front_doc}, - {NULL, NULL, 0, NULL}, + {"push_vertex_back", + (PyCFunction)FrsCurve_push_vertex_back, + METH_VARARGS | METH_KEYWORDS, + FrsCurve_push_vertex_back_doc}, + {"push_vertex_front", + (PyCFunction)FrsCurve_push_vertex_front, + METH_VARARGS | METH_KEYWORDS, + FrsCurve_push_vertex_front_doc}, + {NULL, NULL, 0, NULL}, }; /*----------------------CurvePoint get/setters ----------------------------*/ PyDoc_STRVAR(FrsCurve_is_empty_doc, -"True if the Curve doesn't have any Vertex yet.\n" -"\n" -":type: bool"); + "True if the Curve doesn't have any Vertex yet.\n" + "\n" + ":type: bool"); static PyObject *FrsCurve_is_empty_get(BPy_FrsCurve *self, void *UNUSED(closure)) { - return PyBool_from_bool(self->c->empty()); + return PyBool_from_bool(self->c->empty()); } PyDoc_STRVAR(FrsCurve_segments_size_doc, -"The number of segments in the polyline constituting the Curve.\n" -"\n" -":type: int"); + "The number of segments in the polyline constituting the Curve.\n" + "\n" + ":type: int"); static PyObject *FrsCurve_segments_size_get(BPy_FrsCurve *self, void *UNUSED(closure)) { - return PyLong_FromLong(self->c->nSegments()); + return PyLong_FromLong(self->c->nSegments()); } static PyGetSetDef BPy_FrsCurve_getseters[] = { - {(char *)"is_empty", (getter)FrsCurve_is_empty_get, (setter)NULL, (char *)FrsCurve_is_empty_doc, NULL}, - {(char *)"segments_size", (getter)FrsCurve_segments_size_get, (setter)NULL, - (char *)FrsCurve_segments_size_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"is_empty", + (getter)FrsCurve_is_empty_get, + (setter)NULL, + (char *)FrsCurve_is_empty_doc, + NULL}, + {(char *)"segments_size", + (getter)FrsCurve_segments_size_get, + (setter)NULL, + (char *)FrsCurve_segments_size_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_FrsCurve type definition ------------------------------*/ PyTypeObject FrsCurve_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "Curve", /* tp_name */ - sizeof(BPy_FrsCurve), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - FrsCurve_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_FrsCurve_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_FrsCurve_getseters, /* tp_getset */ - &Interface1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)FrsCurve_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "Curve", /* tp_name */ + sizeof(BPy_FrsCurve), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + FrsCurve_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_FrsCurve_methods, /* tp_methods */ + 0, /* tp_members */ + BPy_FrsCurve_getseters, /* tp_getset */ + &Interface1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)FrsCurve_init, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.h b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.h index 05415662764..aa4fb409076 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.h +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.h @@ -37,8 +37,8 @@ extern PyTypeObject FrsCurve_Type; /*---------------------------Python BPy_FrsCurve structure definition----------*/ typedef struct { - BPy_Interface1D py_if1D; - Curve *c; + BPy_Interface1D py_if1D; + Curve *c; } BPy_FrsCurve; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp index 73907467f66..423a61c7f1d 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp @@ -42,457 +42,495 @@ extern "C" { // - is it even used ? not even in SWIG version PyDoc_STRVAR(Stroke_doc, -"Class hierarchy: :class:`Interface1D` > :class:`Stroke`\n" -"\n" -"Class to define a stroke. A stroke is made of a set of 2D vertices\n" -"(:class:`StrokeVertex`), regularly spaced out. This set of vertices\n" -"defines the stroke's backbone geometry. Each of these stroke vertices\n" -"defines the stroke's shape and appearance at this vertex position.\n" -"\n" -".. method:: Stroke()\n" -"\n" -" Default constructor\n" -"\n" -".. method:: Stroke(brother)\n" -"\n" -" Copy constructor"); + "Class hierarchy: :class:`Interface1D` > :class:`Stroke`\n" + "\n" + "Class to define a stroke. A stroke is made of a set of 2D vertices\n" + "(:class:`StrokeVertex`), regularly spaced out. This set of vertices\n" + "defines the stroke's backbone geometry. Each of these stroke vertices\n" + "defines the stroke's shape and appearance at this vertex position.\n" + "\n" + ".. method:: Stroke()\n" + "\n" + " Default constructor\n" + "\n" + ".. method:: Stroke(brother)\n" + "\n" + " Copy constructor"); 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)) - return -1; - if (!brother) - self->s = new Stroke(); - else - self->s = new Stroke(*(((BPy_Stroke *)brother)->s)); - self->py_if1D.if1D = self->s; - self->py_if1D.borrowed = false; - return 0; + static const char *kwlist[] = {"brother", NULL}; + PyObject *brother = 0; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &Stroke_Type, &brother)) + return -1; + if (!brother) + self->s = new Stroke(); + else + self->s = new Stroke(*(((BPy_Stroke *)brother)->s)); + self->py_if1D.if1D = self->s; + self->py_if1D.borrowed = false; + return 0; } static PyObject *Stroke_iter(PyObject *self) { - StrokeInternal::StrokeVertexIterator sv_it( ((BPy_Stroke *)self)->s->strokeVerticesBegin() ); - return BPy_StrokeVertexIterator_from_StrokeVertexIterator(sv_it, false); + StrokeInternal::StrokeVertexIterator sv_it(((BPy_Stroke *)self)->s->strokeVerticesBegin()); + return BPy_StrokeVertexIterator_from_StrokeVertexIterator(sv_it, false); } static Py_ssize_t Stroke_sq_length(BPy_Stroke *self) { - return self->s->strokeVerticesSize(); + return self->s->strokeVerticesSize(); } static PyObject *Stroke_sq_item(BPy_Stroke *self, int keynum) { - 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; - } - return BPy_StrokeVertex_from_StrokeVertex(self->s->strokeVerticeAt(keynum)); + 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; + } + return BPy_StrokeVertex_from_StrokeVertex(self->s->strokeVerticeAt(keynum)); } PyDoc_STRVAR(Stroke_compute_sampling_doc, -".. method:: compute_sampling(n)\n" -"\n" -" Compute the sampling needed to get N vertices. If the\n" -" specified number of vertices is less than the actual number of\n" -" vertices, the actual sampling value is returned. (To remove Vertices,\n" -" use the RemoveVertex() method of this class.)\n" -"\n" -" :arg n: The number of stroke vertices we eventually want\n" -" in our Stroke.\n" -" :type n: int\n" -" :return: The sampling that must be used in the Resample(float)\n" -" method.\n" -" :rtype: float"); + ".. method:: compute_sampling(n)\n" + "\n" + " Compute the sampling needed to get N vertices. If the\n" + " specified number of vertices is less than the actual number of\n" + " vertices, the actual sampling value is returned. (To remove Vertices,\n" + " use the RemoveVertex() method of this class.)\n" + "\n" + " :arg n: The number of stroke vertices we eventually want\n" + " in our Stroke.\n" + " :type n: int\n" + " :return: The sampling that must be used in the Resample(float)\n" + " method.\n" + " :rtype: float"); static PyObject *Stroke_compute_sampling(BPy_Stroke *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"n", NULL}; - int i; + static const char *kwlist[] = {"n", NULL}; + int i; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist, &i)) - return NULL; - return PyFloat_FromDouble(self->s->ComputeSampling(i)); + if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist, &i)) + return NULL; + return PyFloat_FromDouble(self->s->ComputeSampling(i)); } PyDoc_STRVAR(Stroke_resample_doc, -".. method:: resample(n)\n" -"\n" -" Resamples the stroke so that it eventually has N points. That means\n" -" it is going to add N-vertices_size, where vertices_size is the\n" -" number of points we already have. If vertices_size >= N, no\n" -" resampling is done.\n" -"\n" -" :arg n: The number of vertices we eventually want in our stroke.\n" -" :type n: int\n" -"\n" -".. method:: resample(sampling)\n" -"\n" -" Resamples the stroke with a given sampling. If the sampling is\n" -" smaller than the actual sampling value, no resampling is done.\n" -"\n" -" :arg sampling: The new sampling value.\n" -" :type sampling: float"); + ".. method:: resample(n)\n" + "\n" + " Resamples the stroke so that it eventually has N points. That means\n" + " it is going to add N-vertices_size, where vertices_size is the\n" + " number of points we already have. If vertices_size >= N, no\n" + " resampling is done.\n" + "\n" + " :arg n: The number of vertices we eventually want in our stroke.\n" + " :type n: int\n" + "\n" + ".. method:: resample(sampling)\n" + "\n" + " Resamples the stroke with a given sampling. If the sampling is\n" + " smaller than the actual sampling value, no resampling is done.\n" + "\n" + " :arg sampling: The new sampling value.\n" + " :type sampling: float"); static PyObject *Stroke_resample(BPy_Stroke *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"n", NULL}; - static const char *kwlist_2[] = {"sampling", NULL}; - int i; - float f; - - if (PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist_1, &i)) { - if (self->s->Resample(i) < 0) { - PyErr_SetString(PyExc_RuntimeError, "Stroke resampling (by vertex count) failed"); - return NULL; - } - } - else if (PyErr_Clear(), PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist_2, &f)) { - if (self->s->Resample(f) < 0) { - PyErr_SetString(PyExc_RuntimeError, "Stroke resampling (by vertex interval) failed"); - return NULL; - } - } - else { - PyErr_SetString(PyExc_TypeError, "invalid argument"); - return NULL; - } - Py_RETURN_NONE; + static const char *kwlist_1[] = {"n", NULL}; + static const char *kwlist_2[] = {"sampling", NULL}; + int i; + float f; + + if (PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist_1, &i)) { + if (self->s->Resample(i) < 0) { + PyErr_SetString(PyExc_RuntimeError, "Stroke resampling (by vertex count) failed"); + return NULL; + } + } + else if (PyErr_Clear(), PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist_2, &f)) { + if (self->s->Resample(f) < 0) { + PyErr_SetString(PyExc_RuntimeError, "Stroke resampling (by vertex interval) failed"); + return NULL; + } + } + else { + PyErr_SetString(PyExc_TypeError, "invalid argument"); + return NULL; + } + Py_RETURN_NONE; } PyDoc_STRVAR(Stroke_insert_vertex_doc, -".. method:: insert_vertex(vertex, next)\n" -"\n" -" Inserts the StrokeVertex given as argument into the Stroke before the\n" -" point specified by next. The length and curvilinear abscissa are\n" -" updated consequently.\n" -"\n" -" :arg vertex: The StrokeVertex to insert in the Stroke.\n" -" :type vertex: :class:`StrokeVertex`\n" -" :arg next: A StrokeVertexIterator pointing to the StrokeVertex\n" -" before which vertex must be inserted.\n" -" :type next: :class:`StrokeVertexIterator`"); + ".. method:: insert_vertex(vertex, next)\n" + "\n" + " Inserts the StrokeVertex given as argument into the Stroke before the\n" + " point specified by next. The length and curvilinear abscissa are\n" + " updated consequently.\n" + "\n" + " :arg vertex: The StrokeVertex to insert in the Stroke.\n" + " :type vertex: :class:`StrokeVertex`\n" + " :arg next: A StrokeVertexIterator pointing to the StrokeVertex\n" + " before which vertex must be inserted.\n" + " :type next: :class:`StrokeVertexIterator`"); static PyObject *Stroke_insert_vertex(BPy_Stroke *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"vertex", "next", NULL}; - PyObject *py_sv = 0, *py_sv_it = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O!", (char **)kwlist, - &StrokeVertex_Type, &py_sv, &StrokeVertexIterator_Type, &py_sv_it)) - { - return NULL; - } - ((BPy_StrokeVertex *)py_sv)->py_cp.py_if0D.borrowed = true; /* make the wrapped StrokeVertex internal */ - StrokeVertex *sv = ((BPy_StrokeVertex *)py_sv)->sv; - StrokeInternal::StrokeVertexIterator sv_it(*(((BPy_StrokeVertexIterator *)py_sv_it)->sv_it)); - self->s->InsertVertex(sv, sv_it); - Py_RETURN_NONE; + static const char *kwlist[] = {"vertex", "next", NULL}; + PyObject *py_sv = 0, *py_sv_it = 0; + + if (!PyArg_ParseTupleAndKeywords(args, + kwds, + "O!O!", + (char **)kwlist, + &StrokeVertex_Type, + &py_sv, + &StrokeVertexIterator_Type, + &py_sv_it)) { + return NULL; + } + ((BPy_StrokeVertex *)py_sv)->py_cp.py_if0D.borrowed = + true; /* make the wrapped StrokeVertex internal */ + StrokeVertex *sv = ((BPy_StrokeVertex *)py_sv)->sv; + StrokeInternal::StrokeVertexIterator sv_it(*(((BPy_StrokeVertexIterator *)py_sv_it)->sv_it)); + self->s->InsertVertex(sv, sv_it); + Py_RETURN_NONE; } PyDoc_STRVAR(Stroke_remove_vertex_doc, -".. method:: remove_vertex(vertex)\n" -"\n" -" Removes the StrokeVertex given as argument from the Stroke. The length\n" -" and curvilinear abscissa are updated consequently.\n" -"\n" -" :arg vertex: the StrokeVertex to remove from the Stroke.\n" -" :type vertex: :class:`StrokeVertex`"); - -static PyObject *Stroke_remove_vertex( BPy_Stroke *self, PyObject *args, PyObject *kwds) + ".. method:: remove_vertex(vertex)\n" + "\n" + " Removes the StrokeVertex given as argument from the Stroke. The length\n" + " and curvilinear abscissa are updated consequently.\n" + "\n" + " :arg vertex: the StrokeVertex to remove from the Stroke.\n" + " :type vertex: :class:`StrokeVertex`"); + +static PyObject *Stroke_remove_vertex(BPy_Stroke *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"vertex", NULL}; - PyObject *py_sv = 0; - - 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); - } - else { - PyErr_SetString(PyExc_TypeError, "invalid argument"); - return NULL; - } - Py_RETURN_NONE; + static const char *kwlist[] = {"vertex", NULL}; + PyObject *py_sv = 0; + + 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); + } + else { + PyErr_SetString(PyExc_TypeError, "invalid argument"); + return NULL; + } + Py_RETURN_NONE; } PyDoc_STRVAR(Stroke_remove_all_vertices_doc, -".. method:: remove_all_vertices()\n" -"\n" -" Removes all vertices from the Stroke."); + ".. method:: remove_all_vertices()\n" + "\n" + " Removes all vertices from the Stroke."); static PyObject *Stroke_remove_all_vertices(BPy_Stroke *self) { - self->s->RemoveAllVertices(); - Py_RETURN_NONE; + self->s->RemoveAllVertices(); + Py_RETURN_NONE; } PyDoc_STRVAR(Stroke_update_length_doc, -".. method:: update_length()\n" -"\n" -" Updates the 2D length of the Stroke."); + ".. method:: update_length()\n" + "\n" + " Updates the 2D length of the Stroke."); static PyObject *Stroke_update_length(BPy_Stroke *self) { - self->s->UpdateLength(); - Py_RETURN_NONE; + self->s->UpdateLength(); + Py_RETURN_NONE; } PyDoc_STRVAR(Stroke_stroke_vertices_begin_doc, -".. method:: stroke_vertices_begin(t=0.0)\n" -"\n" -" Returns a StrokeVertexIterator pointing on the first StrokeVertex of\n" -" the Stroke. One can specify a sampling value to resample the Stroke\n" -" on the fly if needed.\n" -"\n" -" :arg t: The resampling value with which we want our Stroke to be\n" -" resampled. If 0 is specified, no resampling is done.\n" -" :type t: float\n" -" :return: A StrokeVertexIterator pointing on the first StrokeVertex.\n" -" :rtype: :class:`StrokeVertexIterator`"); + ".. method:: stroke_vertices_begin(t=0.0)\n" + "\n" + " Returns a StrokeVertexIterator pointing on the first StrokeVertex of\n" + " the Stroke. One can specify a sampling value to resample the Stroke\n" + " on the fly if needed.\n" + "\n" + " :arg t: The resampling value with which we want our Stroke to be\n" + " resampled. If 0 is specified, no resampling is done.\n" + " :type t: float\n" + " :return: A StrokeVertexIterator pointing on the first StrokeVertex.\n" + " :rtype: :class:`StrokeVertexIterator`"); static PyObject *Stroke_stroke_vertices_begin(BPy_Stroke *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"t", NULL}; - float f = 0.0f; + static const char *kwlist[] = {"t", NULL}; + float f = 0.0f; - 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); + 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); } PyDoc_STRVAR(Stroke_stroke_vertices_end_doc, -".. method:: stroke_vertices_end()\n" -"\n" -" Returns a StrokeVertexIterator pointing after the last StrokeVertex\n" -" of the Stroke.\n" -"\n" -" :return: A StrokeVertexIterator pointing after the last StrokeVertex.\n" -" :rtype: :class:`StrokeVertexIterator`"); + ".. method:: stroke_vertices_end()\n" + "\n" + " Returns a StrokeVertexIterator pointing after the last StrokeVertex\n" + " of the Stroke.\n" + "\n" + " :return: A StrokeVertexIterator pointing after the last StrokeVertex.\n" + " :rtype: :class:`StrokeVertexIterator`"); static PyObject *Stroke_stroke_vertices_end(BPy_Stroke *self) { - StrokeInternal::StrokeVertexIterator sv_it(self->s->strokeVerticesEnd()); - return BPy_StrokeVertexIterator_from_StrokeVertexIterator(sv_it, true); + StrokeInternal::StrokeVertexIterator sv_it(self->s->strokeVerticesEnd()); + return BPy_StrokeVertexIterator_from_StrokeVertexIterator(sv_it, true); } PyDoc_STRVAR(Stroke_reversed_doc, -".. method:: __reversed__()\n" -"\n" -" Returns a StrokeVertexIterator iterating over the vertices of the Stroke\n" -" in the reversed order (from the last to the first).\n" -"\n" -" :return: A StrokeVertexIterator pointing after the last StrokeVertex.\n" -" :rtype: :class:`StrokeVertexIterator`"); + ".. method:: __reversed__()\n" + "\n" + " Returns a StrokeVertexIterator iterating over the vertices of the Stroke\n" + " in the reversed order (from the last to the first).\n" + "\n" + " :return: A StrokeVertexIterator pointing after the last StrokeVertex.\n" + " :rtype: :class:`StrokeVertexIterator`"); static PyObject *Stroke_reversed(BPy_Stroke *self) { - StrokeInternal::StrokeVertexIterator sv_it(self->s->strokeVerticesEnd()); - return BPy_StrokeVertexIterator_from_StrokeVertexIterator(sv_it, true); + StrokeInternal::StrokeVertexIterator sv_it(self->s->strokeVerticesEnd()); + return BPy_StrokeVertexIterator_from_StrokeVertexIterator(sv_it, true); } PyDoc_STRVAR(Stroke_stroke_vertices_size_doc, -".. method:: stroke_vertices_size()\n" -"\n" -" Returns the number of StrokeVertex constituting the Stroke.\n" -"\n" -" :return: The number of stroke vertices.\n" -" :rtype: int"); + ".. method:: stroke_vertices_size()\n" + "\n" + " Returns the number of StrokeVertex constituting the Stroke.\n" + "\n" + " :return: The number of stroke vertices.\n" + " :rtype: int"); static PyObject *Stroke_stroke_vertices_size(BPy_Stroke *self) { - return PyLong_FromLong(self->s->strokeVerticesSize()); + return PyLong_FromLong(self->s->strokeVerticesSize()); } static PyMethodDef BPy_Stroke_methods[] = { - {"compute_sampling", (PyCFunction)Stroke_compute_sampling, METH_VARARGS | METH_KEYWORDS, - Stroke_compute_sampling_doc}, - {"resample", (PyCFunction)Stroke_resample, METH_VARARGS | METH_KEYWORDS, Stroke_resample_doc}, - {"remove_all_vertices", (PyCFunction)Stroke_remove_all_vertices, METH_NOARGS, Stroke_remove_all_vertices_doc}, - {"remove_vertex", (PyCFunction)Stroke_remove_vertex, METH_VARARGS | METH_KEYWORDS, Stroke_remove_vertex_doc}, - {"insert_vertex", (PyCFunction)Stroke_insert_vertex, METH_VARARGS | METH_KEYWORDS, Stroke_insert_vertex_doc}, - {"update_length", (PyCFunction)Stroke_update_length, METH_NOARGS, Stroke_update_length_doc}, - {"stroke_vertices_begin", (PyCFunction)Stroke_stroke_vertices_begin, METH_VARARGS | METH_KEYWORDS, - Stroke_stroke_vertices_begin_doc}, - {"stroke_vertices_end", (PyCFunction)Stroke_stroke_vertices_end, METH_NOARGS, Stroke_stroke_vertices_end_doc}, - {"__reversed__", (PyCFunction)Stroke_reversed, METH_NOARGS, Stroke_reversed_doc}, - {"stroke_vertices_size", (PyCFunction)Stroke_stroke_vertices_size, METH_NOARGS, Stroke_stroke_vertices_size_doc}, - {NULL, NULL, 0, NULL}, + {"compute_sampling", + (PyCFunction)Stroke_compute_sampling, + METH_VARARGS | METH_KEYWORDS, + Stroke_compute_sampling_doc}, + {"resample", (PyCFunction)Stroke_resample, METH_VARARGS | METH_KEYWORDS, Stroke_resample_doc}, + {"remove_all_vertices", + (PyCFunction)Stroke_remove_all_vertices, + METH_NOARGS, + Stroke_remove_all_vertices_doc}, + {"remove_vertex", + (PyCFunction)Stroke_remove_vertex, + METH_VARARGS | METH_KEYWORDS, + Stroke_remove_vertex_doc}, + {"insert_vertex", + (PyCFunction)Stroke_insert_vertex, + METH_VARARGS | METH_KEYWORDS, + Stroke_insert_vertex_doc}, + {"update_length", (PyCFunction)Stroke_update_length, METH_NOARGS, Stroke_update_length_doc}, + {"stroke_vertices_begin", + (PyCFunction)Stroke_stroke_vertices_begin, + METH_VARARGS | METH_KEYWORDS, + Stroke_stroke_vertices_begin_doc}, + {"stroke_vertices_end", + (PyCFunction)Stroke_stroke_vertices_end, + METH_NOARGS, + Stroke_stroke_vertices_end_doc}, + {"__reversed__", (PyCFunction)Stroke_reversed, METH_NOARGS, Stroke_reversed_doc}, + {"stroke_vertices_size", + (PyCFunction)Stroke_stroke_vertices_size, + METH_NOARGS, + Stroke_stroke_vertices_size_doc}, + {NULL, NULL, 0, NULL}, }; /*----------------------Stroke get/setters ----------------------------*/ PyDoc_STRVAR(Stroke_medium_type_doc, -"The MediumType used for this Stroke.\n" -"\n" -":type: :class:`MediumType`"); + "The MediumType used for this Stroke.\n" + "\n" + ":type: :class:`MediumType`"); static PyObject *Stroke_medium_type_get(BPy_Stroke *self, void *UNUSED(closure)) { - return BPy_MediumType_from_MediumType(self->s->getMediumType()); + return BPy_MediumType_from_MediumType(self->s->getMediumType()); } static int Stroke_medium_type_set(BPy_Stroke *self, PyObject *value, void *UNUSED(closure)) { - if (!BPy_MediumType_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be a MediumType"); - return -1; - } - self->s->setMediumType(MediumType_from_BPy_MediumType(value)); - return 0; + if (!BPy_MediumType_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be a MediumType"); + return -1; + } + self->s->setMediumType(MediumType_from_BPy_MediumType(value)); + return 0; } PyDoc_STRVAR(Stroke_texture_id_doc, -"The ID of the texture used to simulate th marks system for this Stroke.\n" -"\n" -":type: int"); + "The ID of the texture used to simulate th marks system for this Stroke.\n" + "\n" + ":type: int"); static PyObject *Stroke_texture_id_get(BPy_Stroke *self, void *UNUSED(closure)) { - return PyLong_FromLong( self->s->getTextureId() ); + return PyLong_FromLong(self->s->getTextureId()); } static int Stroke_texture_id_set(BPy_Stroke *self, PyObject *value, void *UNUSED(closure)) { - unsigned int i = PyLong_AsUnsignedLong(value); - if (PyErr_Occurred()) - return -1; - self->s->setTextureId(i); - return 0; + unsigned int i = PyLong_AsUnsignedLong(value); + if (PyErr_Occurred()) + return -1; + self->s->setTextureId(i); + return 0; } PyDoc_STRVAR(Stroke_tips_doc, -"True if this Stroke uses a texture with tips, and false otherwise.\n" -"\n" -":type: bool"); + "True if this Stroke uses a texture with tips, and false otherwise.\n" + "\n" + ":type: bool"); static PyObject *Stroke_tips_get(BPy_Stroke *self, void *UNUSED(closure)) { - return PyBool_from_bool(self->s->hasTips()); + return PyBool_from_bool(self->s->hasTips()); } static int Stroke_tips_set(BPy_Stroke *self, PyObject *value, void *UNUSED(closure)) { - if (!PyBool_Check(value)) - return -1; - self->s->setTips(bool_from_PyBool(value)); - return 0; + if (!PyBool_Check(value)) + return -1; + self->s->setTips(bool_from_PyBool(value)); + return 0; } PyDoc_STRVAR(Stroke_length_2d_doc, -"The 2D length of the Stroke.\n" -"\n" -":type: float"); + "The 2D length of the Stroke.\n" + "\n" + ":type: float"); static PyObject *Stroke_length_2d_get(BPy_Stroke *self, void *UNUSED(closure)) { - return PyFloat_FromDouble(self->s->getLength2D()); + return PyFloat_FromDouble(self->s->getLength2D()); } static int Stroke_length_2d_set(BPy_Stroke *self, PyObject *value, void *UNUSED(closure)) { - float scalar; - if ((scalar = PyFloat_AsDouble(value)) == -1.0f && PyErr_Occurred()) { /* parsed item not a number */ - PyErr_SetString(PyExc_TypeError, "value must be a number"); - return -1; - } - self->s->setLength(scalar); - return 0; + float scalar; + if ((scalar = PyFloat_AsDouble(value)) == -1.0f && + PyErr_Occurred()) { /* parsed item not a number */ + PyErr_SetString(PyExc_TypeError, "value must be a number"); + return -1; + } + self->s->setLength(scalar); + return 0; } PyDoc_STRVAR(Stroke_id_doc, -"The Id of this Stroke.\n" -"\n" -":type: :class:`Id`"); + "The Id of this Stroke.\n" + "\n" + ":type: :class:`Id`"); static PyObject *Stroke_id_get(BPy_Stroke *self, void *UNUSED(closure)) { - Id id(self->s->getId()); - return BPy_Id_from_Id(id); // return a copy + Id id(self->s->getId()); + return BPy_Id_from_Id(id); // return a copy } static int Stroke_id_set(BPy_Stroke *self, PyObject *value, void *UNUSED(closure)) { - if (!BPy_Id_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be an Id"); - return -1; - } - self->s->setId(*(((BPy_Id *)value)->id)); - return 0; + if (!BPy_Id_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an Id"); + return -1; + } + self->s->setId(*(((BPy_Id *)value)->id)); + return 0; } static PyGetSetDef BPy_Stroke_getseters[] = { - {(char *)"medium_type", (getter)Stroke_medium_type_get, (setter)Stroke_medium_type_set, - (char *)Stroke_medium_type_doc, NULL}, - {(char *)"texture_id", (getter)Stroke_texture_id_get, (setter)Stroke_texture_id_set, - (char *)Stroke_texture_id_doc, NULL}, - {(char *)"tips", (getter)Stroke_tips_get, (setter)Stroke_tips_set, (char *)Stroke_tips_doc, NULL}, - {(char *)"length_2d", (getter)Stroke_length_2d_get, (setter)Stroke_length_2d_set, - (char *)Stroke_length_2d_doc, NULL}, - {(char *)"id", (getter)Stroke_id_get, (setter)Stroke_id_set, (char *)Stroke_id_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"medium_type", + (getter)Stroke_medium_type_get, + (setter)Stroke_medium_type_set, + (char *)Stroke_medium_type_doc, + NULL}, + {(char *)"texture_id", + (getter)Stroke_texture_id_get, + (setter)Stroke_texture_id_set, + (char *)Stroke_texture_id_doc, + NULL}, + {(char *)"tips", + (getter)Stroke_tips_get, + (setter)Stroke_tips_set, + (char *)Stroke_tips_doc, + NULL}, + {(char *)"length_2d", + (getter)Stroke_length_2d_get, + (setter)Stroke_length_2d_set, + (char *)Stroke_length_2d_doc, + NULL}, + {(char *)"id", (getter)Stroke_id_get, (setter)Stroke_id_set, (char *)Stroke_id_doc, NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_Stroke type definition ------------------------------*/ static PySequenceMethods BPy_Stroke_as_sequence = { - (lenfunc)Stroke_sq_length, /* sq_length */ - NULL, /* sq_concat */ - NULL, /* sq_repeat */ - (ssizeargfunc)Stroke_sq_item, /* sq_item */ - NULL, /* sq_slice */ - NULL, /* sq_ass_item */ - NULL, /* *was* sq_ass_slice */ - NULL, /* sq_contains */ - NULL, /* sq_inplace_concat */ - NULL, /* sq_inplace_repeat */ + (lenfunc)Stroke_sq_length, /* sq_length */ + NULL, /* sq_concat */ + NULL, /* sq_repeat */ + (ssizeargfunc)Stroke_sq_item, /* sq_item */ + NULL, /* sq_slice */ + NULL, /* sq_ass_item */ + NULL, /* *was* sq_ass_slice */ + NULL, /* sq_contains */ + NULL, /* sq_inplace_concat */ + NULL, /* sq_inplace_repeat */ }; PyTypeObject Stroke_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "Stroke", /* tp_name */ - sizeof(BPy_Stroke), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - &BPy_Stroke_as_sequence, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Stroke_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - (getiterfunc)Stroke_iter, /* tp_iter */ - 0, /* tp_iternext */ - BPy_Stroke_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_Stroke_getseters, /* tp_getset */ - &Interface1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Stroke_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "Stroke", /* tp_name */ + sizeof(BPy_Stroke), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + &BPy_Stroke_as_sequence, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Stroke_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + (getiterfunc)Stroke_iter, /* tp_iter */ + 0, /* tp_iternext */ + BPy_Stroke_methods, /* tp_methods */ + 0, /* tp_members */ + BPy_Stroke_getseters, /* tp_getset */ + &Interface1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Stroke_init, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.h b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.h index 869ff7d07d5..a08905e6043 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.h +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.h @@ -33,12 +33,12 @@ extern "C" { extern PyTypeObject Stroke_Type; -#define BPy_Stroke_Check(v) (((PyObject *)v)->ob_type == &Stroke_Type) +#define BPy_Stroke_Check(v) (((PyObject *)v)->ob_type == &Stroke_Type) /*---------------------------Python BPy_Stroke structure definition----------*/ typedef struct { - BPy_Interface1D py_if1D; - Stroke *s; + BPy_Interface1D py_if1D; + Stroke *s; } BPy_Stroke; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp index c047b678a64..6331145974a 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.cpp @@ -37,338 +37,381 @@ extern "C" { /*----------------------ViewEdge methods ----------------------------*/ PyDoc_STRVAR(ViewEdge_doc, -"Class hierarchy: :class:`Interface1D` > :class:`ViewEdge`\n" -"\n" -"Class defining a ViewEdge. A ViewEdge in an edge of the image graph.\n" -"it connects two :class:`ViewVertex` objects. It is made by connecting\n" -"a set of FEdges.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __init__(brother)\n" -"\n" -" Copy constructor.\n" -"\n" -" :arg brother: A ViewEdge object.\n" -" :type brother: :class:`ViewEdge`"); + "Class hierarchy: :class:`Interface1D` > :class:`ViewEdge`\n" + "\n" + "Class defining a ViewEdge. A ViewEdge in an edge of the image graph.\n" + "it connects two :class:`ViewVertex` objects. It is made by connecting\n" + "a set of FEdges.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __init__(brother)\n" + "\n" + " Copy constructor.\n" + "\n" + " :arg brother: A ViewEdge object.\n" + " :type brother: :class:`ViewEdge`"); 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)) - return -1; - if (!brother) - self->ve = new ViewEdge(); - else - self->ve = new ViewEdge(*(((BPy_ViewEdge *)brother)->ve)); - self->py_if1D.if1D = self->ve; - self->py_if1D.borrowed = false; - return 0; + static const char *kwlist[] = {"brother", NULL}; + PyObject *brother = 0; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &ViewEdge_Type, &brother)) + return -1; + if (!brother) + self->ve = new ViewEdge(); + else + self->ve = new ViewEdge(*(((BPy_ViewEdge *)brother)->ve)); + self->py_if1D.if1D = self->ve; + self->py_if1D.borrowed = false; + return 0; } PyDoc_STRVAR(ViewEdge_update_fedges_doc, -".. method:: update_fedges()\n" -"\n" -" Sets Viewedge to this for all embedded fedges.\n"); + ".. method:: update_fedges()\n" + "\n" + " Sets Viewedge to this for all embedded fedges.\n"); static PyObject *ViewEdge_update_fedges(BPy_ViewEdge *self) { - self->ve->UpdateFEdges(); - Py_RETURN_NONE; + self->ve->UpdateFEdges(); + Py_RETURN_NONE; } static PyMethodDef BPy_ViewEdge_methods[] = { - {"update_fedges", (PyCFunction)ViewEdge_update_fedges, METH_NOARGS, ViewEdge_update_fedges_doc}, - {NULL, NULL, 0, NULL}, + {"update_fedges", + (PyCFunction)ViewEdge_update_fedges, + METH_NOARGS, + ViewEdge_update_fedges_doc}, + {NULL, NULL, 0, NULL}, }; /*----------------------ViewEdge get/setters ----------------------------*/ PyDoc_STRVAR(ViewEdge_first_viewvertex_doc, -"The first ViewVertex.\n" -"\n" -":type: :class:`ViewVertex`"); + "The first ViewVertex.\n" + "\n" + ":type: :class:`ViewVertex`"); static PyObject *ViewEdge_first_viewvertex_get(BPy_ViewEdge *self, void *UNUSED(closure)) { - ViewVertex *v = self->ve->A(); - if (v) - return Any_BPy_ViewVertex_from_ViewVertex(*v); - Py_RETURN_NONE; + ViewVertex *v = self->ve->A(); + if (v) + return Any_BPy_ViewVertex_from_ViewVertex(*v); + Py_RETURN_NONE; } -static int ViewEdge_first_viewvertex_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure)) +static int ViewEdge_first_viewvertex_set(BPy_ViewEdge *self, + PyObject *value, + void *UNUSED(closure)) { - if (!BPy_ViewVertex_Check(value)) - return -1; - self->ve->setA(((BPy_ViewVertex *)value)->vv); - return 0; + if (!BPy_ViewVertex_Check(value)) + return -1; + self->ve->setA(((BPy_ViewVertex *)value)->vv); + return 0; } PyDoc_STRVAR(ViewEdge_last_viewvertex_doc, -"The second ViewVertex.\n" -"\n" -":type: :class:`ViewVertex`"); + "The second ViewVertex.\n" + "\n" + ":type: :class:`ViewVertex`"); static PyObject *ViewEdge_last_viewvertex_get(BPy_ViewEdge *self, void *UNUSED(closure)) { - ViewVertex *v = self->ve->B(); - if (v) - return Any_BPy_ViewVertex_from_ViewVertex(*v); - Py_RETURN_NONE; + ViewVertex *v = self->ve->B(); + 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)) - return -1; - self->ve->setB(((BPy_ViewVertex *)value)->vv); - return 0; + if (!BPy_ViewVertex_Check(value)) + return -1; + self->ve->setB(((BPy_ViewVertex *)value)->vv); + return 0; } PyDoc_STRVAR(ViewEdge_first_fedge_doc, -"The first FEdge that constitutes this ViewEdge.\n" -"\n" -":type: :class:`FEdge`"); + "The first FEdge that constitutes this ViewEdge.\n" + "\n" + ":type: :class:`FEdge`"); static PyObject *ViewEdge_first_fedge_get(BPy_ViewEdge *self, void *UNUSED(closure)) { - FEdge *fe = self->ve->fedgeA(); - if (fe) - return Any_BPy_FEdge_from_FEdge(*fe); - Py_RETURN_NONE; + FEdge *fe = self->ve->fedgeA(); + 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)) - return -1; - self->ve->setFEdgeA(((BPy_FEdge *)value)->fe); - return 0; + if (!BPy_FEdge_Check(value)) + return -1; + self->ve->setFEdgeA(((BPy_FEdge *)value)->fe); + return 0; } PyDoc_STRVAR(ViewEdge_last_fedge_doc, -"The last FEdge that constitutes this ViewEdge.\n" -"\n" -":type: :class:`FEdge`"); + "The last FEdge that constitutes this ViewEdge.\n" + "\n" + ":type: :class:`FEdge`"); static PyObject *ViewEdge_last_fedge_get(BPy_ViewEdge *self, void *UNUSED(closure)) { - FEdge *fe = self->ve->fedgeB(); - if (fe) - return Any_BPy_FEdge_from_FEdge(*fe); - Py_RETURN_NONE; + FEdge *fe = self->ve->fedgeB(); + 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)) - return -1; - self->ve->setFEdgeB(((BPy_FEdge *)value)->fe); - return 0; + if (!BPy_FEdge_Check(value)) + return -1; + self->ve->setFEdgeB(((BPy_FEdge *)value)->fe); + return 0; } PyDoc_STRVAR(ViewEdge_viewshape_doc, -"The ViewShape to which this ViewEdge belongs to.\n" -"\n" -":type: :class:`ViewShape`"); + "The ViewShape to which this ViewEdge belongs to.\n" + "\n" + ":type: :class:`ViewShape`"); static PyObject *ViewEdge_viewshape_get(BPy_ViewEdge *self, void *UNUSED(closure)) { - ViewShape *vs = self->ve->viewShape(); - if (vs) - return BPy_ViewShape_from_ViewShape(*vs); - Py_RETURN_NONE; + ViewShape *vs = self->ve->viewShape(); + 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)) - return -1; - self->ve->setShape(((BPy_ViewShape *)value)->vs); - return 0; + if (!BPy_ViewShape_Check(value)) + return -1; + self->ve->setShape(((BPy_ViewShape *)value)->vs); + return 0; } PyDoc_STRVAR(ViewEdge_occludee_doc, -"The shape that is occluded by the ViewShape to which this ViewEdge\n" -"belongs to. If no object is occluded, this property is set to None.\n" -"\n" -":type: :class:`ViewShape`"); + "The shape that is occluded by the ViewShape to which this ViewEdge\n" + "belongs to. If no object is occluded, this property is set to None.\n" + "\n" + ":type: :class:`ViewShape`"); static PyObject *ViewEdge_occludee_get(BPy_ViewEdge *self, void *UNUSED(closure)) { - ViewShape *vs = self->ve->aShape(); - if (vs) - return BPy_ViewShape_from_ViewShape(*vs); - Py_RETURN_NONE; + ViewShape *vs = self->ve->aShape(); + 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)) - return -1; - self->ve->setaShape(((BPy_ViewShape *)value)->vs); - return 0; + if (!BPy_ViewShape_Check(value)) + return -1; + self->ve->setaShape(((BPy_ViewShape *)value)->vs); + return 0; } PyDoc_STRVAR(ViewEdge_is_closed_doc, -"True if this ViewEdge forms a closed loop.\n" -"\n" -":type: bool"); + "True if this ViewEdge forms a closed loop.\n" + "\n" + ":type: bool"); static PyObject *ViewEdge_is_closed_get(BPy_ViewEdge *self, void *UNUSED(closure)) { - return PyBool_from_bool(self->ve->isClosed()); + return PyBool_from_bool(self->ve->isClosed()); } PyDoc_STRVAR(ViewEdge_id_doc, -"The Id of this ViewEdge.\n" -"\n" -":type: :class:`Id`"); + "The Id of this ViewEdge.\n" + "\n" + ":type: :class:`Id`"); static PyObject *ViewEdge_id_get(BPy_ViewEdge *self, void *UNUSED(closure)) { - Id id(self->ve->getId()); - return BPy_Id_from_Id(id); // return a copy + Id id(self->ve->getId()); + return BPy_Id_from_Id(id); // return a copy } static int ViewEdge_id_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure)) { - if (!BPy_Id_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be an Id"); - return -1; - } - self->ve->setId(*(((BPy_Id *)value)->id)); - return 0; + if (!BPy_Id_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an Id"); + return -1; + } + self->ve->setId(*(((BPy_Id *)value)->id)); + return 0; } PyDoc_STRVAR(ViewEdge_nature_doc, -"The nature of this ViewEdge.\n" -"\n" -":type: :class:`Nature`"); + "The nature of this ViewEdge.\n" + "\n" + ":type: :class:`Nature`"); static PyObject *ViewEdge_nature_get(BPy_ViewEdge *self, void *UNUSED(closure)) { - return BPy_Nature_from_Nature(self->ve->getNature()); + return BPy_Nature_from_Nature(self->ve->getNature()); } static int ViewEdge_nature_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure)) { - if (!BPy_Nature_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be a Nature"); - return -1; - } - self->ve->setNature(PyLong_AsLong((PyObject *)&((BPy_Nature *)value)->i)); - return 0; + if (!BPy_Nature_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be a Nature"); + return -1; + } + self->ve->setNature(PyLong_AsLong((PyObject *)&((BPy_Nature *)value)->i)); + return 0; } PyDoc_STRVAR(ViewEdge_qi_doc, -"The quantitative invisibility.\n" -"\n" -":type: int"); + "The quantitative invisibility.\n" + "\n" + ":type: int"); static PyObject *ViewEdge_qi_get(BPy_ViewEdge *self, void *UNUSED(closure)) { - return PyLong_FromLong(self->ve->qi()); + return PyLong_FromLong(self->ve->qi()); } static int ViewEdge_qi_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure)) { - int qi; + int qi; - if ((qi = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) - return -1; - self->ve->setQI(qi); - return 0; + if ((qi = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) + return -1; + self->ve->setQI(qi); + return 0; } PyDoc_STRVAR(ViewEdge_chaining_time_stamp_doc, -"The time stamp of this ViewEdge.\n" -"\n" -":type: int"); + "The time stamp of this ViewEdge.\n" + "\n" + ":type: int"); static PyObject *ViewEdge_chaining_time_stamp_get(BPy_ViewEdge *self, void *UNUSED(closure)) { - return PyLong_FromLong(self->ve->getChainingTimeStamp()); + return PyLong_FromLong(self->ve->getChainingTimeStamp()); } -static int ViewEdge_chaining_time_stamp_set(BPy_ViewEdge *self, PyObject *value, void *UNUSED(closure)) +static int ViewEdge_chaining_time_stamp_set(BPy_ViewEdge *self, + PyObject *value, + void *UNUSED(closure)) { - int timestamp; + int timestamp; - if ((timestamp = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) - return -1; - self->ve->setChainingTimeStamp(timestamp); - return 0; + if ((timestamp = PyLong_AsLong(value)) == -1 && PyErr_Occurred()) + return -1; + self->ve->setChainingTimeStamp(timestamp); + return 0; } static PyGetSetDef BPy_ViewEdge_getseters[] = { - {(char *)"first_viewvertex", (getter)ViewEdge_first_viewvertex_get, (setter)ViewEdge_first_viewvertex_set, - (char *)ViewEdge_first_viewvertex_doc, NULL}, - {(char *)"last_viewvertex", (getter)ViewEdge_last_viewvertex_get, (setter)ViewEdge_last_viewvertex_set, - (char *)ViewEdge_last_viewvertex_doc, NULL}, - {(char *)"first_fedge", (getter)ViewEdge_first_fedge_get, (setter)ViewEdge_first_fedge_set, - (char *)ViewEdge_first_fedge_doc, NULL}, - {(char *)"last_fedge", (getter)ViewEdge_last_fedge_get, (setter)ViewEdge_last_fedge_set, - (char *)ViewEdge_last_fedge_doc, NULL}, - {(char *)"viewshape", (getter)ViewEdge_viewshape_get, (setter)ViewEdge_viewshape_set, - (char *)ViewEdge_viewshape_doc, NULL}, - {(char *)"occludee", (getter)ViewEdge_occludee_get, (setter)ViewEdge_occludee_set, - (char *)ViewEdge_occludee_doc, NULL}, - {(char *)"is_closed", (getter)ViewEdge_is_closed_get, (setter)NULL, (char *)ViewEdge_is_closed_doc, NULL}, - {(char *)"id", (getter)ViewEdge_id_get, (setter)ViewEdge_id_set, (char *)ViewEdge_id_doc, NULL}, - {(char *)"nature", (getter)ViewEdge_nature_get, (setter)ViewEdge_nature_set, (char *)ViewEdge_nature_doc, NULL}, - {(char *)"qi", (getter)ViewEdge_qi_get, (setter)ViewEdge_qi_set, (char *)ViewEdge_qi_doc, NULL}, - {(char *)"chaining_time_stamp", (getter)ViewEdge_chaining_time_stamp_get, (setter)ViewEdge_chaining_time_stamp_set, - (char *)ViewEdge_chaining_time_stamp_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"first_viewvertex", + (getter)ViewEdge_first_viewvertex_get, + (setter)ViewEdge_first_viewvertex_set, + (char *)ViewEdge_first_viewvertex_doc, + NULL}, + {(char *)"last_viewvertex", + (getter)ViewEdge_last_viewvertex_get, + (setter)ViewEdge_last_viewvertex_set, + (char *)ViewEdge_last_viewvertex_doc, + NULL}, + {(char *)"first_fedge", + (getter)ViewEdge_first_fedge_get, + (setter)ViewEdge_first_fedge_set, + (char *)ViewEdge_first_fedge_doc, + NULL}, + {(char *)"last_fedge", + (getter)ViewEdge_last_fedge_get, + (setter)ViewEdge_last_fedge_set, + (char *)ViewEdge_last_fedge_doc, + NULL}, + {(char *)"viewshape", + (getter)ViewEdge_viewshape_get, + (setter)ViewEdge_viewshape_set, + (char *)ViewEdge_viewshape_doc, + NULL}, + {(char *)"occludee", + (getter)ViewEdge_occludee_get, + (setter)ViewEdge_occludee_set, + (char *)ViewEdge_occludee_doc, + NULL}, + {(char *)"is_closed", + (getter)ViewEdge_is_closed_get, + (setter)NULL, + (char *)ViewEdge_is_closed_doc, + NULL}, + {(char *)"id", + (getter)ViewEdge_id_get, + (setter)ViewEdge_id_set, + (char *)ViewEdge_id_doc, + NULL}, + {(char *)"nature", + (getter)ViewEdge_nature_get, + (setter)ViewEdge_nature_set, + (char *)ViewEdge_nature_doc, + NULL}, + {(char *)"qi", + (getter)ViewEdge_qi_get, + (setter)ViewEdge_qi_set, + (char *)ViewEdge_qi_doc, + NULL}, + {(char *)"chaining_time_stamp", + (getter)ViewEdge_chaining_time_stamp_get, + (setter)ViewEdge_chaining_time_stamp_set, + (char *)ViewEdge_chaining_time_stamp_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_ViewEdge type definition ------------------------------*/ PyTypeObject ViewEdge_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ViewEdge", /* tp_name */ - sizeof(BPy_ViewEdge), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ViewEdge_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_ViewEdge_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_ViewEdge_getseters, /* tp_getset */ - &Interface1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ViewEdge_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "ViewEdge", /* tp_name */ + sizeof(BPy_ViewEdge), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ViewEdge_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_ViewEdge_methods, /* tp_methods */ + 0, /* tp_members */ + BPy_ViewEdge_getseters, /* tp_getset */ + &Interface1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ViewEdge_init, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.h b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.h index 81fd21fa092..c02d5d0f21b 100644 --- a/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.h +++ b/source/blender/freestyle/intern/python/Interface1D/BPy_ViewEdge.h @@ -37,8 +37,8 @@ extern PyTypeObject ViewEdge_Type; /*---------------------------Python BPy_ViewEdge structure definition----------*/ typedef struct { - BPy_Interface1D py_if1D; - ViewEdge *ve; + BPy_Interface1D py_if1D; + ViewEdge *ve; } BPy_ViewEdge; /////////////////////////////////////////////////////////////////////////////////////////// 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 0185fcc5ebe..7a6b2a01728 100644 --- a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp @@ -33,160 +33,160 @@ extern "C" { /*----------------------Chain methods ----------------------------*/ PyDoc_STRVAR(Chain_doc, -"Class hierarchy: :class:`Interface1D` > :class:`Curve` > :class:`Chain`\n" -"\n" -"Class to represent a 1D elements issued from the chaining process. A\n" -"Chain is the last step before the :class:`Stroke` and is used in the\n" -"Splitting and Creation processes.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __init__(brother)\n" -"\n" -" Copy constructor.\n" -"\n" -" :arg brother: A Chain object.\n" -" :type brother: :class:`Chain`\n" -"\n" -".. method:: __init__(id)\n" -"\n" -" Builds a chain from its Id.\n" -"\n" -" :arg id: An Id object.\n" -" :type id: :class:`Id`"); + "Class hierarchy: :class:`Interface1D` > :class:`Curve` > :class:`Chain`\n" + "\n" + "Class to represent a 1D elements issued from the chaining process. A\n" + "Chain is the last step before the :class:`Stroke` and is used in the\n" + "Splitting and Creation processes.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __init__(brother)\n" + "\n" + " Copy constructor.\n" + "\n" + " :arg brother: A Chain object.\n" + " :type brother: :class:`Chain`\n" + "\n" + ".. method:: __init__(id)\n" + "\n" + " Builds a chain from its Id.\n" + "\n" + " :arg id: An Id object.\n" + " :type id: :class:`Id`"); static int Chain_init(BPy_Chain *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"id", NULL}; - PyObject *obj = 0; - - if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &Chain_Type, &obj)) { - if (!obj) - self->c = new Chain(); - else - self->c = new Chain(*(((BPy_Chain *)obj)->c)); - } - else if (PyErr_Clear(), - PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist_2, &Id_Type, &obj)) - { - self->c = new Chain(*(((BPy_Id *)obj)->id)); - } - else { - PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); - return -1; - } - self->py_c.c = self->c; - self->py_c.py_if1D.if1D = self->c; - self->py_c.py_if1D.borrowed = false; - return 0; + static const char *kwlist_1[] = {"brother", NULL}; + static const char *kwlist_2[] = {"id", NULL}; + PyObject *obj = 0; + + if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &Chain_Type, &obj)) { + if (!obj) + self->c = new Chain(); + else + self->c = new Chain(*(((BPy_Chain *)obj)->c)); + } + else if (PyErr_Clear(), + PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist_2, &Id_Type, &obj)) { + self->c = new Chain(*(((BPy_Id *)obj)->id)); + } + else { + PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); + return -1; + } + self->py_c.c = self->c; + self->py_c.py_if1D.if1D = self->c; + self->py_c.py_if1D.borrowed = false; + return 0; } PyDoc_STRVAR(Chain_push_viewedge_back_doc, -".. method:: push_viewedge_back(viewedge, orientation)\n" -"\n" -" Adds a ViewEdge at the end of the Chain.\n" -"\n" -" :arg viewedge: The ViewEdge that must be added.\n" -" :type viewedge: :class:`ViewEdge`\n" -" :arg orientation: The orientation with which the ViewEdge must be\n" -" processed.\n" -" :type orientation: bool"); + ".. method:: push_viewedge_back(viewedge, orientation)\n" + "\n" + " Adds a ViewEdge at the end of the Chain.\n" + "\n" + " :arg viewedge: The ViewEdge that must be added.\n" + " :type viewedge: :class:`ViewEdge`\n" + " :arg orientation: The orientation with which the ViewEdge must be\n" + " processed.\n" + " :type orientation: bool"); static PyObject *Chain_push_viewedge_back(BPy_Chain *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"viewedge", "orientation", NULL}; - PyObject *obj1 = 0, *obj2 = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O!", (char **)kwlist, - &ViewEdge_Type, &obj1, &PyBool_Type, &obj2)) - { - return NULL; - } - ViewEdge *ve = ((BPy_ViewEdge *)obj1)->ve; - bool orientation = bool_from_PyBool(obj2); - self->c->push_viewedge_back(ve, orientation); - Py_RETURN_NONE; + static const char *kwlist[] = {"viewedge", "orientation", NULL}; + PyObject *obj1 = 0, *obj2 = 0; + + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "O!O!", (char **)kwlist, &ViewEdge_Type, &obj1, &PyBool_Type, &obj2)) { + return NULL; + } + ViewEdge *ve = ((BPy_ViewEdge *)obj1)->ve; + bool orientation = bool_from_PyBool(obj2); + self->c->push_viewedge_back(ve, orientation); + Py_RETURN_NONE; } PyDoc_STRVAR(Chain_push_viewedge_front_doc, -".. method:: push_viewedge_front(viewedge, orientation)\n" -"\n" -" Adds a ViewEdge at the beginning of the Chain.\n" -"\n" -" :arg viewedge: The ViewEdge that must be added.\n" -" :type viewedge: :class:`ViewEdge`\n" -" :arg orientation: The orientation with which the ViewEdge must be\n" -" processed.\n" -" :type orientation: bool"); + ".. method:: push_viewedge_front(viewedge, orientation)\n" + "\n" + " Adds a ViewEdge at the beginning of the Chain.\n" + "\n" + " :arg viewedge: The ViewEdge that must be added.\n" + " :type viewedge: :class:`ViewEdge`\n" + " :arg orientation: The orientation with which the ViewEdge must be\n" + " processed.\n" + " :type orientation: bool"); static PyObject *Chain_push_viewedge_front(BPy_Chain *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"viewedge", "orientation", NULL}; - PyObject *obj1 = 0, *obj2 = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!O!", (char **)kwlist, - &ViewEdge_Type, &obj1, &PyBool_Type, &obj2)) - { - return NULL; - } - ViewEdge *ve = ((BPy_ViewEdge *)obj1)->ve; - bool orientation = bool_from_PyBool(obj2); - self->c->push_viewedge_front(ve, orientation); - Py_RETURN_NONE; + static const char *kwlist[] = {"viewedge", "orientation", NULL}; + PyObject *obj1 = 0, *obj2 = 0; + + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "O!O!", (char **)kwlist, &ViewEdge_Type, &obj1, &PyBool_Type, &obj2)) { + return NULL; + } + ViewEdge *ve = ((BPy_ViewEdge *)obj1)->ve; + bool orientation = bool_from_PyBool(obj2); + self->c->push_viewedge_front(ve, orientation); + Py_RETURN_NONE; } static PyMethodDef BPy_Chain_methods[] = { - {"push_viewedge_back", (PyCFunction)Chain_push_viewedge_back, METH_VARARGS | METH_KEYWORDS, - Chain_push_viewedge_back_doc}, - {"push_viewedge_front", (PyCFunction)Chain_push_viewedge_front, METH_VARARGS | METH_KEYWORDS, - Chain_push_viewedge_front_doc}, - {NULL, NULL, 0, NULL}, + {"push_viewedge_back", + (PyCFunction)Chain_push_viewedge_back, + METH_VARARGS | METH_KEYWORDS, + Chain_push_viewedge_back_doc}, + {"push_viewedge_front", + (PyCFunction)Chain_push_viewedge_front, + METH_VARARGS | METH_KEYWORDS, + Chain_push_viewedge_front_doc}, + {NULL, NULL, 0, NULL}, }; /*-----------------------BPy_Chain type definition ------------------------------*/ PyTypeObject Chain_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "Chain", /* tp_name */ - sizeof(BPy_Chain), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Chain_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_Chain_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &FrsCurve_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Chain_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "Chain", /* tp_name */ + sizeof(BPy_Chain), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Chain_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_Chain_methods, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &FrsCurve_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Chain_init, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.h b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.h index 3356b0144d6..a9392cd81bf 100644 --- a/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.h +++ b/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.h @@ -37,8 +37,8 @@ extern PyTypeObject Chain_Type; /*---------------------------Python BPy_Chain structure definition----------*/ typedef struct { - BPy_FrsCurve py_c; - Chain *c; + BPy_FrsCurve py_c; + Chain *c; } BPy_Chain; /////////////////////////////////////////////////////////////////////////////////////////// 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 8d83c942d93..e91ae155929 100644 --- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.cpp @@ -32,396 +32,414 @@ extern "C" { /*----------------------FEdgeSharp methods ----------------------------*/ PyDoc_STRVAR(FEdgeSharp_doc, -"Class hierarchy: :class:`Interface1D` > :class:`FEdge` > :class:`FEdgeSharp`\n" -"\n" -"Class defining a sharp FEdge. A Sharp FEdge corresponds to an initial\n" -"edge of the input mesh. It can be a silhouette, a crease or a border.\n" -"If it is a crease edge, then it is borded by two faces of the mesh.\n" -"Face a lies on its right whereas Face b lies on its left. If it is a\n" -"border edge, then it doesn't have any face on its right, and thus Face\n" -"a is None.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __init__(brother)\n" -"\n" -" Copy constructor.\n" -"\n" -" :arg brother: An FEdgeSharp object.\n" -" :type brother: :class:`FEdgeSharp`\n" -"\n" -".. method:: __init__(first_vertex, second_vertex)\n" -"\n" -" Builds an FEdgeSharp going from the first vertex to the second.\n" -"\n" -" :arg first_vertex: The first SVertex object.\n" -" :type first_vertex: :class:`SVertex`\n" -" :arg second_vertex: The second SVertex object.\n" -" :type second_vertex: :class:`SVertex`"); + "Class hierarchy: :class:`Interface1D` > :class:`FEdge` > :class:`FEdgeSharp`\n" + "\n" + "Class defining a sharp FEdge. A Sharp FEdge corresponds to an initial\n" + "edge of the input mesh. It can be a silhouette, a crease or a border.\n" + "If it is a crease edge, then it is borded by two faces of the mesh.\n" + "Face a lies on its right whereas Face b lies on its left. If it is a\n" + "border edge, then it doesn't have any face on its right, and thus Face\n" + "a is None.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __init__(brother)\n" + "\n" + " Copy constructor.\n" + "\n" + " :arg brother: An FEdgeSharp object.\n" + " :type brother: :class:`FEdgeSharp`\n" + "\n" + ".. method:: __init__(first_vertex, second_vertex)\n" + "\n" + " Builds an FEdgeSharp going from the first vertex to the second.\n" + "\n" + " :arg first_vertex: The first SVertex object.\n" + " :type first_vertex: :class:`SVertex`\n" + " :arg second_vertex: The second SVertex object.\n" + " :type second_vertex: :class:`SVertex`"); static int FEdgeSharp_init(BPy_FEdgeSharp *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"first_vertex", "second_vertex", NULL}; - PyObject *obj1 = 0, *obj2 = 0; - - if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &FEdgeSharp_Type, &obj1)) { - if (!obj1) - self->fes = new FEdgeSharp(); - else - self->fes = new FEdgeSharp(*(((BPy_FEdgeSharp *)obj1)->fes)); - } - else if (PyErr_Clear(), - PyArg_ParseTupleAndKeywords(args, kwds, "O!O!", (char **)kwlist_2, - &SVertex_Type, &obj1, &SVertex_Type, &obj2)) - { - self->fes = new FEdgeSharp(((BPy_SVertex *)obj1)->sv, ((BPy_SVertex *)obj2)->sv); - } - else { - PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); - return -1; - } - self->py_fe.fe = self->fes; - self->py_fe.py_if1D.if1D = self->fes; - self->py_fe.py_if1D.borrowed = false; - return 0; + static const char *kwlist_1[] = {"brother", NULL}; + static const char *kwlist_2[] = {"first_vertex", "second_vertex", NULL}; + PyObject *obj1 = 0, *obj2 = 0; + + if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &FEdgeSharp_Type, &obj1)) { + if (!obj1) + self->fes = new FEdgeSharp(); + else + self->fes = new FEdgeSharp(*(((BPy_FEdgeSharp *)obj1)->fes)); + } + else if (PyErr_Clear(), + PyArg_ParseTupleAndKeywords(args, + kwds, + "O!O!", + (char **)kwlist_2, + &SVertex_Type, + &obj1, + &SVertex_Type, + &obj2)) { + self->fes = new FEdgeSharp(((BPy_SVertex *)obj1)->sv, ((BPy_SVertex *)obj2)->sv); + } + else { + PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); + return -1; + } + self->py_fe.fe = self->fes; + self->py_fe.py_if1D.if1D = self->fes; + self->py_fe.py_if1D.borrowed = false; + return 0; } /*----------------------mathutils callbacks ----------------------------*/ /* subtype */ -#define MATHUTILS_SUBTYPE_NORMAL_A 1 -#define MATHUTILS_SUBTYPE_NORMAL_B 2 +#define MATHUTILS_SUBTYPE_NORMAL_A 1 +#define MATHUTILS_SUBTYPE_NORMAL_B 2 static int FEdgeSharp_mathutils_check(BaseMathObject *bmo) { - if (!BPy_FEdgeSharp_Check(bmo->cb_user)) - return -1; - return 0; + if (!BPy_FEdgeSharp_Check(bmo->cb_user)) + return -1; + return 0; } static int FEdgeSharp_mathutils_get(BaseMathObject *bmo, int subtype) { - BPy_FEdgeSharp *self = (BPy_FEdgeSharp *)bmo->cb_user; - switch (subtype) { - case MATHUTILS_SUBTYPE_NORMAL_A: - { - Vec3r p(self->fes->normalA()); - bmo->data[0] = p[0]; - bmo->data[1] = p[1]; - bmo->data[2] = p[2]; - } - break; - case MATHUTILS_SUBTYPE_NORMAL_B: - { - Vec3r p(self->fes->normalB()); - bmo->data[0] = p[0]; - bmo->data[1] = p[1]; - bmo->data[2] = p[2]; - } - break; - default: - return -1; - } - return 0; + BPy_FEdgeSharp *self = (BPy_FEdgeSharp *)bmo->cb_user; + switch (subtype) { + case MATHUTILS_SUBTYPE_NORMAL_A: { + Vec3r p(self->fes->normalA()); + bmo->data[0] = p[0]; + bmo->data[1] = p[1]; + bmo->data[2] = p[2]; + } break; + case MATHUTILS_SUBTYPE_NORMAL_B: { + Vec3r p(self->fes->normalB()); + bmo->data[0] = p[0]; + bmo->data[1] = p[1]; + bmo->data[2] = p[2]; + } break; + default: + return -1; + } + return 0; } static int FEdgeSharp_mathutils_set(BaseMathObject *bmo, int subtype) { - BPy_FEdgeSharp *self = (BPy_FEdgeSharp *)bmo->cb_user; - switch (subtype) { - case MATHUTILS_SUBTYPE_NORMAL_A: - { - Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]); - self->fes->setNormalA(p); - } - break; - case MATHUTILS_SUBTYPE_NORMAL_B: - { - Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]); - self->fes->setNormalB(p); - } - break; - default: - return -1; - } - return 0; + BPy_FEdgeSharp *self = (BPy_FEdgeSharp *)bmo->cb_user; + switch (subtype) { + case MATHUTILS_SUBTYPE_NORMAL_A: { + Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]); + self->fes->setNormalA(p); + } break; + case MATHUTILS_SUBTYPE_NORMAL_B: { + Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]); + self->fes->setNormalB(p); + } break; + default: + return -1; + } + return 0; } static int FEdgeSharp_mathutils_get_index(BaseMathObject *bmo, int subtype, int index) { - BPy_FEdgeSharp *self = (BPy_FEdgeSharp *)bmo->cb_user; - switch (subtype) { - case MATHUTILS_SUBTYPE_NORMAL_A: - { - Vec3r p(self->fes->normalA()); - bmo->data[index] = p[index]; - } - break; - case MATHUTILS_SUBTYPE_NORMAL_B: - { - Vec3r p(self->fes->normalB()); - bmo->data[index] = p[index]; - } - break; - default: - return -1; - } - return 0; + BPy_FEdgeSharp *self = (BPy_FEdgeSharp *)bmo->cb_user; + switch (subtype) { + case MATHUTILS_SUBTYPE_NORMAL_A: { + Vec3r p(self->fes->normalA()); + bmo->data[index] = p[index]; + } break; + case MATHUTILS_SUBTYPE_NORMAL_B: { + Vec3r p(self->fes->normalB()); + bmo->data[index] = p[index]; + } break; + default: + return -1; + } + return 0; } static int FEdgeSharp_mathutils_set_index(BaseMathObject *bmo, int subtype, int index) { - BPy_FEdgeSharp *self = (BPy_FEdgeSharp *)bmo->cb_user; - switch (subtype) { - case MATHUTILS_SUBTYPE_NORMAL_A: - { - Vec3r p(self->fes->normalA()); - p[index] = bmo->data[index]; - self->fes->setNormalA(p); - } - break; - case MATHUTILS_SUBTYPE_NORMAL_B: - { - Vec3r p(self->fes->normalB()); - p[index] = bmo->data[index]; - self->fes->setNormalB(p); - } - break; - default: - return -1; - } - return 0; + BPy_FEdgeSharp *self = (BPy_FEdgeSharp *)bmo->cb_user; + switch (subtype) { + case MATHUTILS_SUBTYPE_NORMAL_A: { + Vec3r p(self->fes->normalA()); + p[index] = bmo->data[index]; + self->fes->setNormalA(p); + } break; + case MATHUTILS_SUBTYPE_NORMAL_B: { + Vec3r p(self->fes->normalB()); + p[index] = bmo->data[index]; + self->fes->setNormalB(p); + } break; + default: + return -1; + } + return 0; } static Mathutils_Callback FEdgeSharp_mathutils_cb = { - FEdgeSharp_mathutils_check, - FEdgeSharp_mathutils_get, - FEdgeSharp_mathutils_set, - FEdgeSharp_mathutils_get_index, - FEdgeSharp_mathutils_set_index, + FEdgeSharp_mathutils_check, + FEdgeSharp_mathutils_get, + FEdgeSharp_mathutils_set, + FEdgeSharp_mathutils_get_index, + FEdgeSharp_mathutils_set_index, }; static unsigned char FEdgeSharp_mathutils_cb_index = -1; void FEdgeSharp_mathutils_register_callback() { - FEdgeSharp_mathutils_cb_index = Mathutils_RegisterCallback(&FEdgeSharp_mathutils_cb); + FEdgeSharp_mathutils_cb_index = Mathutils_RegisterCallback(&FEdgeSharp_mathutils_cb); } /*----------------------FEdgeSharp get/setters ----------------------------*/ PyDoc_STRVAR(FEdgeSharp_normal_right_doc, -"The normal to the face lying on the right of the FEdge. If this FEdge\n" -"is a border, it has no Face on its right and therefore no normal.\n" -"\n" -":type: :class:`mathutils.Vector`"); + "The normal to the face lying on the right of the FEdge. If this FEdge\n" + "is a border, it has no Face on its right and therefore no normal.\n" + "\n" + ":type: :class:`mathutils.Vector`"); static PyObject *FEdgeSharp_normal_right_get(BPy_FEdgeSharp *self, void *UNUSED(closure)) { - return Vector_CreatePyObject_cb((PyObject *)self, 3, FEdgeSharp_mathutils_cb_index, MATHUTILS_SUBTYPE_NORMAL_A); + return Vector_CreatePyObject_cb( + (PyObject *)self, 3, FEdgeSharp_mathutils_cb_index, MATHUTILS_SUBTYPE_NORMAL_A); } -static int FEdgeSharp_normal_right_set(BPy_FEdgeSharp *self, PyObject *value, void *UNUSED(closure)) +static int FEdgeSharp_normal_right_set(BPy_FEdgeSharp *self, + PyObject *value, + void *UNUSED(closure)) { - float v[3]; - if (mathutils_array_parse(v, 3, 3, value, - "value must be a 3-dimensional vector") == -1) - { - return -1; - } - Vec3r p(v[0], v[1], v[2]); - self->fes->setNormalA(p); - return 0; + float v[3]; + if (mathutils_array_parse(v, 3, 3, value, "value must be a 3-dimensional vector") == -1) { + return -1; + } + Vec3r p(v[0], v[1], v[2]); + self->fes->setNormalA(p); + return 0; } PyDoc_STRVAR(FEdgeSharp_normal_left_doc, -"The normal to the face lying on the left of the FEdge.\n" -"\n" -":type: :class:`mathutils.Vector`"); + "The normal to the face lying on the left of the FEdge.\n" + "\n" + ":type: :class:`mathutils.Vector`"); static PyObject *FEdgeSharp_normal_left_get(BPy_FEdgeSharp *self, void *UNUSED(closure)) { - return Vector_CreatePyObject_cb((PyObject *)self, 3, FEdgeSharp_mathutils_cb_index, MATHUTILS_SUBTYPE_NORMAL_B); + return Vector_CreatePyObject_cb( + (PyObject *)self, 3, FEdgeSharp_mathutils_cb_index, MATHUTILS_SUBTYPE_NORMAL_B); } static int FEdgeSharp_normal_left_set(BPy_FEdgeSharp *self, PyObject *value, void *UNUSED(closure)) { - float v[3]; - if (mathutils_array_parse(v, 3, 3, value, - "value must be a 3-dimensional vector") == -1) - { - return -1; - } - Vec3r p(v[0], v[1], v[2]); - self->fes->setNormalB(p); - return 0; + float v[3]; + if (mathutils_array_parse(v, 3, 3, value, "value must be a 3-dimensional vector") == -1) { + return -1; + } + Vec3r p(v[0], v[1], v[2]); + self->fes->setNormalB(p); + return 0; } PyDoc_STRVAR(FEdgeSharp_material_index_right_doc, -"The index of the material of the face lying on the right of the FEdge.\n" -"If this FEdge is a border, it has no Face on its right and therefore\n" -"no material.\n" -"\n" -":type: int"); + "The index of the material of the face lying on the right of the FEdge.\n" + "If this FEdge is a border, it has no Face on its right and therefore\n" + "no material.\n" + "\n" + ":type: int"); static PyObject *FEdgeSharp_material_index_right_get(BPy_FEdgeSharp *self, void *UNUSED(closure)) { - return PyLong_FromLong(self->fes->aFrsMaterialIndex()); + return PyLong_FromLong(self->fes->aFrsMaterialIndex()); } -static int FEdgeSharp_material_index_right_set(BPy_FEdgeSharp *self, PyObject *value, void *UNUSED(closure)) +static int FEdgeSharp_material_index_right_set(BPy_FEdgeSharp *self, + PyObject *value, + void *UNUSED(closure)) { - unsigned int i = PyLong_AsUnsignedLong(value); - if (PyErr_Occurred()) - return -1; - self->fes->setaFrsMaterialIndex(i); - return 0; + unsigned int i = PyLong_AsUnsignedLong(value); + if (PyErr_Occurred()) + return -1; + self->fes->setaFrsMaterialIndex(i); + return 0; } PyDoc_STRVAR(FEdgeSharp_material_index_left_doc, -"The index of the material of the face lying on the left of the FEdge.\n" -"\n" -":type: int"); + "The index of the material of the face lying on the left of the FEdge.\n" + "\n" + ":type: int"); static PyObject *FEdgeSharp_material_index_left_get(BPy_FEdgeSharp *self, void *UNUSED(closure)) { - return PyLong_FromLong(self->fes->bFrsMaterialIndex()); + return PyLong_FromLong(self->fes->bFrsMaterialIndex()); } -static int FEdgeSharp_material_index_left_set(BPy_FEdgeSharp *self, PyObject *value, void *UNUSED(closure)) +static int FEdgeSharp_material_index_left_set(BPy_FEdgeSharp *self, + PyObject *value, + void *UNUSED(closure)) { - unsigned int i = PyLong_AsUnsignedLong(value); - if (PyErr_Occurred()) - return -1; - self->fes->setbFrsMaterialIndex(i); - return 0; + unsigned int i = PyLong_AsUnsignedLong(value); + if (PyErr_Occurred()) + return -1; + self->fes->setbFrsMaterialIndex(i); + return 0; } PyDoc_STRVAR(FEdgeSharp_material_right_doc, -"The material of the face lying on the right of the FEdge. If this FEdge\n" -"is a border, it has no Face on its right and therefore no material.\n" -"\n" -":type: :class:`Material`"); + "The material of the face lying on the right of the FEdge. If this FEdge\n" + "is a border, it has no Face on its right and therefore no material.\n" + "\n" + ":type: :class:`Material`"); static PyObject *FEdgeSharp_material_right_get(BPy_FEdgeSharp *self, void *UNUSED(closure)) { - return BPy_FrsMaterial_from_FrsMaterial(self->fes->aFrsMaterial()); + return BPy_FrsMaterial_from_FrsMaterial(self->fes->aFrsMaterial()); } PyDoc_STRVAR(FEdgeSharp_material_left_doc, -"The material of the face lying on the left of the FEdge.\n" -"\n" -":type: :class:`Material`"); + "The material of the face lying on the left of the FEdge.\n" + "\n" + ":type: :class:`Material`"); static PyObject *FEdgeSharp_material_left_get(BPy_FEdgeSharp *self, void *UNUSED(closure)) { - return BPy_FrsMaterial_from_FrsMaterial(self->fes->bFrsMaterial()); + return BPy_FrsMaterial_from_FrsMaterial(self->fes->bFrsMaterial()); } PyDoc_STRVAR(FEdgeSharp_face_mark_right_doc, -"The face mark of the face lying on the right of the FEdge. If this FEdge\n" -"is a border, it has no face on the right and thus this property is set to\n" -"false.\n" -"\n" -":type: bool"); + "The face mark of the face lying on the right of the FEdge. If this FEdge\n" + "is a border, it has no face on the right and thus this property is set to\n" + "false.\n" + "\n" + ":type: bool"); static PyObject *FEdgeSharp_face_mark_right_get(BPy_FEdgeSharp *self, void *UNUSED(closure)) { - return PyBool_from_bool(self->fes->aFaceMark()); + return PyBool_from_bool(self->fes->aFaceMark()); } -static int FEdgeSharp_face_mark_right_set(BPy_FEdgeSharp *self, PyObject *value, void *UNUSED(closure)) +static int FEdgeSharp_face_mark_right_set(BPy_FEdgeSharp *self, + PyObject *value, + void *UNUSED(closure)) { - if (!PyBool_Check(value)) - return -1; - self->fes->setaFaceMark(bool_from_PyBool(value)); - return 0; + if (!PyBool_Check(value)) + return -1; + self->fes->setaFaceMark(bool_from_PyBool(value)); + return 0; } PyDoc_STRVAR(FEdgeSharp_face_mark_left_doc, -"The face mark of the face lying on the left of the FEdge.\n" -"\n" -":type: bool"); + "The face mark of the face lying on the left of the FEdge.\n" + "\n" + ":type: bool"); static PyObject *FEdgeSharp_face_mark_left_get(BPy_FEdgeSharp *self, void *UNUSED(closure)) { - return PyBool_from_bool(self->fes->bFaceMark()); + return PyBool_from_bool(self->fes->bFaceMark()); } -static int FEdgeSharp_face_mark_left_set(BPy_FEdgeSharp *self, PyObject *value, void *UNUSED(closure)) +static int FEdgeSharp_face_mark_left_set(BPy_FEdgeSharp *self, + PyObject *value, + void *UNUSED(closure)) { - if (!PyBool_Check(value)) - return -1; - self->fes->setbFaceMark(bool_from_PyBool(value)); - return 0; + if (!PyBool_Check(value)) + return -1; + self->fes->setbFaceMark(bool_from_PyBool(value)); + return 0; } static PyGetSetDef BPy_FEdgeSharp_getseters[] = { - {(char *)"normal_right", (getter)FEdgeSharp_normal_right_get, (setter)FEdgeSharp_normal_right_set, - (char *)FEdgeSharp_normal_right_doc, NULL}, - {(char *)"normal_left", (getter)FEdgeSharp_normal_left_get, (setter)FEdgeSharp_normal_left_set, - (char *)FEdgeSharp_normal_left_doc, NULL}, - {(char *)"material_index_right", (getter)FEdgeSharp_material_index_right_get, - (setter)FEdgeSharp_material_index_right_set, - (char *)FEdgeSharp_material_index_right_doc, NULL}, - {(char *)"material_index_left", (getter)FEdgeSharp_material_index_left_get, - (setter)FEdgeSharp_material_index_left_set, - (char *)FEdgeSharp_material_index_left_doc, NULL}, - {(char *)"material_right", (getter)FEdgeSharp_material_right_get, (setter)NULL, - (char *)FEdgeSharp_material_right_doc, NULL}, - {(char *)"material_left", (getter)FEdgeSharp_material_left_get, (setter)NULL, - (char *)FEdgeSharp_material_left_doc, NULL}, - {(char *)"face_mark_right", (getter)FEdgeSharp_face_mark_right_get, (setter)FEdgeSharp_face_mark_right_set, - (char *)FEdgeSharp_face_mark_right_doc, NULL}, - {(char *)"face_mark_left", (getter)FEdgeSharp_face_mark_left_get, (setter)FEdgeSharp_face_mark_left_set, - (char *)FEdgeSharp_face_mark_left_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"normal_right", + (getter)FEdgeSharp_normal_right_get, + (setter)FEdgeSharp_normal_right_set, + (char *)FEdgeSharp_normal_right_doc, + NULL}, + {(char *)"normal_left", + (getter)FEdgeSharp_normal_left_get, + (setter)FEdgeSharp_normal_left_set, + (char *)FEdgeSharp_normal_left_doc, + NULL}, + {(char *)"material_index_right", + (getter)FEdgeSharp_material_index_right_get, + (setter)FEdgeSharp_material_index_right_set, + (char *)FEdgeSharp_material_index_right_doc, + NULL}, + {(char *)"material_index_left", + (getter)FEdgeSharp_material_index_left_get, + (setter)FEdgeSharp_material_index_left_set, + (char *)FEdgeSharp_material_index_left_doc, + NULL}, + {(char *)"material_right", + (getter)FEdgeSharp_material_right_get, + (setter)NULL, + (char *)FEdgeSharp_material_right_doc, + NULL}, + {(char *)"material_left", + (getter)FEdgeSharp_material_left_get, + (setter)NULL, + (char *)FEdgeSharp_material_left_doc, + NULL}, + {(char *)"face_mark_right", + (getter)FEdgeSharp_face_mark_right_get, + (setter)FEdgeSharp_face_mark_right_set, + (char *)FEdgeSharp_face_mark_right_doc, + NULL}, + {(char *)"face_mark_left", + (getter)FEdgeSharp_face_mark_left_get, + (setter)FEdgeSharp_face_mark_left_set, + (char *)FEdgeSharp_face_mark_left_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_FEdgeSharp type definition ------------------------------*/ PyTypeObject FEdgeSharp_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "FEdgeSharp", /* tp_name */ - sizeof(BPy_FEdgeSharp), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - FEdgeSharp_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_FEdgeSharp_getseters, /* tp_getset */ - &FEdge_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)FEdgeSharp_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "FEdgeSharp", /* tp_name */ + sizeof(BPy_FEdgeSharp), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + FEdgeSharp_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + BPy_FEdgeSharp_getseters, /* tp_getset */ + &FEdge_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)FEdgeSharp_init, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.h b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.h index be9adf311b6..450539acb16 100644 --- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.h +++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSharp.h @@ -37,8 +37,8 @@ extern PyTypeObject FEdgeSharp_Type; /*---------------------------Python BPy_FEdgeSharp structure definition----------*/ typedef struct { - BPy_FEdge py_fe; - FEdgeSharp *fes; + BPy_FEdge py_fe; + FEdgeSharp *fes; } BPy_FEdgeSharp; /*---------------------------Python BPy_FEdgeSharp visible prototypes-----------*/ 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 726fe97b3ea..08d18123172 100644 --- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp +++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.cpp @@ -32,243 +32,261 @@ extern "C" { /*----------------------FEdgeSmooth methods ----------------------------*/ PyDoc_STRVAR(FEdgeSmooth_doc, -"Class hierarchy: :class:`Interface1D` > :class:`FEdge` > :class:`FEdgeSmooth`\n" -"\n" -"Class defining a smooth edge. This kind of edge typically runs across\n" -"a face of the input mesh. It can be a silhouette, a ridge or valley,\n" -"a suggestive contour.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __init__(brother)\n" -"\n" -" Copy constructor.\n" -"\n" -" :arg brother: An FEdgeSmooth object.\n" -" :type brother: :class:`FEdgeSmooth`\n" -"\n" -".. method:: __init__(first_vertex, second_vertex)\n" -"\n" -" Builds an FEdgeSmooth going from the first to the second.\n" -"\n" -" :arg first_vertex: The first SVertex object.\n" -" :type first_vertex: :class:`SVertex`\n" -" :arg second_vertex: The second SVertex object.\n" -" :type second_vertex: :class:`SVertex`"); + "Class hierarchy: :class:`Interface1D` > :class:`FEdge` > :class:`FEdgeSmooth`\n" + "\n" + "Class defining a smooth edge. This kind of edge typically runs across\n" + "a face of the input mesh. It can be a silhouette, a ridge or valley,\n" + "a suggestive contour.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __init__(brother)\n" + "\n" + " Copy constructor.\n" + "\n" + " :arg brother: An FEdgeSmooth object.\n" + " :type brother: :class:`FEdgeSmooth`\n" + "\n" + ".. method:: __init__(first_vertex, second_vertex)\n" + "\n" + " Builds an FEdgeSmooth going from the first to the second.\n" + "\n" + " :arg first_vertex: The first SVertex object.\n" + " :type first_vertex: :class:`SVertex`\n" + " :arg second_vertex: The second SVertex object.\n" + " :type second_vertex: :class:`SVertex`"); static int FEdgeSmooth_init(BPy_FEdgeSmooth *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"first_vertex", "second_vertex", NULL}; - PyObject *obj1 = 0, *obj2 = 0; - - if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &FEdgeSmooth_Type, &obj1)) { - if (!obj1) - self->fes = new FEdgeSmooth(); - else - self->fes = new FEdgeSmooth(*(((BPy_FEdgeSmooth *)obj1)->fes)); - } - else if (PyErr_Clear(), - PyArg_ParseTupleAndKeywords(args, kwds, "O!O!", (char **)kwlist_2, - &SVertex_Type, &obj1, &SVertex_Type, &obj2)) - { - self->fes = new FEdgeSmooth(((BPy_SVertex *)obj1)->sv, ((BPy_SVertex *)obj2)->sv); - } - else { - PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); - return -1; - } - self->py_fe.fe = self->fes; - self->py_fe.py_if1D.if1D = self->fes; - self->py_fe.py_if1D.borrowed = false; - return 0; + static const char *kwlist_1[] = {"brother", NULL}; + static const char *kwlist_2[] = {"first_vertex", "second_vertex", NULL}; + PyObject *obj1 = 0, *obj2 = 0; + + if (PyArg_ParseTupleAndKeywords( + args, kwds, "|O!", (char **)kwlist_1, &FEdgeSmooth_Type, &obj1)) { + if (!obj1) + self->fes = new FEdgeSmooth(); + else + self->fes = new FEdgeSmooth(*(((BPy_FEdgeSmooth *)obj1)->fes)); + } + else if (PyErr_Clear(), + PyArg_ParseTupleAndKeywords(args, + kwds, + "O!O!", + (char **)kwlist_2, + &SVertex_Type, + &obj1, + &SVertex_Type, + &obj2)) { + self->fes = new FEdgeSmooth(((BPy_SVertex *)obj1)->sv, ((BPy_SVertex *)obj2)->sv); + } + else { + PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); + return -1; + } + self->py_fe.fe = self->fes; + self->py_fe.py_if1D.if1D = self->fes; + self->py_fe.py_if1D.borrowed = false; + return 0; } /*----------------------mathutils callbacks ----------------------------*/ static int FEdgeSmooth_mathutils_check(BaseMathObject *bmo) { - if (!BPy_FEdgeSmooth_Check(bmo->cb_user)) - return -1; - return 0; + if (!BPy_FEdgeSmooth_Check(bmo->cb_user)) + return -1; + return 0; } static int FEdgeSmooth_mathutils_get(BaseMathObject *bmo, int /*subtype*/) { - BPy_FEdgeSmooth *self = (BPy_FEdgeSmooth *)bmo->cb_user; - Vec3r p(self->fes->normal()); - bmo->data[0] = p[0]; - bmo->data[1] = p[1]; - bmo->data[2] = p[2]; - return 0; + BPy_FEdgeSmooth *self = (BPy_FEdgeSmooth *)bmo->cb_user; + Vec3r p(self->fes->normal()); + bmo->data[0] = p[0]; + bmo->data[1] = p[1]; + bmo->data[2] = p[2]; + return 0; } static int FEdgeSmooth_mathutils_set(BaseMathObject *bmo, int /*subtype*/) { - BPy_FEdgeSmooth *self = (BPy_FEdgeSmooth *)bmo->cb_user; - Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]); - self->fes->setNormal(p); - return 0; + BPy_FEdgeSmooth *self = (BPy_FEdgeSmooth *)bmo->cb_user; + Vec3r p(bmo->data[0], bmo->data[1], bmo->data[2]); + self->fes->setNormal(p); + return 0; } static int FEdgeSmooth_mathutils_get_index(BaseMathObject *bmo, int /*subtype*/, int index) { - BPy_FEdgeSmooth *self = (BPy_FEdgeSmooth *)bmo->cb_user; - Vec3r p(self->fes->normal()); - bmo->data[index] = p[index]; - return 0; + BPy_FEdgeSmooth *self = (BPy_FEdgeSmooth *)bmo->cb_user; + Vec3r p(self->fes->normal()); + bmo->data[index] = p[index]; + return 0; } static int FEdgeSmooth_mathutils_set_index(BaseMathObject *bmo, int /*subtype*/, int index) { - BPy_FEdgeSmooth *self = (BPy_FEdgeSmooth *)bmo->cb_user; - Vec3r p(self->fes->normal()); - p[index] = bmo->data[index]; - self->fes->setNormal(p); - return 0; + BPy_FEdgeSmooth *self = (BPy_FEdgeSmooth *)bmo->cb_user; + Vec3r p(self->fes->normal()); + p[index] = bmo->data[index]; + self->fes->setNormal(p); + return 0; } static Mathutils_Callback FEdgeSmooth_mathutils_cb = { - FEdgeSmooth_mathutils_check, - FEdgeSmooth_mathutils_get, - FEdgeSmooth_mathutils_set, - FEdgeSmooth_mathutils_get_index, - FEdgeSmooth_mathutils_set_index, + FEdgeSmooth_mathutils_check, + FEdgeSmooth_mathutils_get, + FEdgeSmooth_mathutils_set, + FEdgeSmooth_mathutils_get_index, + FEdgeSmooth_mathutils_set_index, }; static unsigned char FEdgeSmooth_mathutils_cb_index = -1; void FEdgeSmooth_mathutils_register_callback() { - FEdgeSmooth_mathutils_cb_index = Mathutils_RegisterCallback(&FEdgeSmooth_mathutils_cb); + FEdgeSmooth_mathutils_cb_index = Mathutils_RegisterCallback(&FEdgeSmooth_mathutils_cb); } /*----------------------FEdgeSmooth get/setters ----------------------------*/ PyDoc_STRVAR(FEdgeSmooth_normal_doc, -"The normal of the face that this FEdge is running across.\n" -"\n" -":type: :class:`mathutils.Vector`"); + "The normal of the face that this FEdge is running across.\n" + "\n" + ":type: :class:`mathutils.Vector`"); static PyObject *FEdgeSmooth_normal_get(BPy_FEdgeSmooth *self, void *UNUSED(closure)) { - return Vector_CreatePyObject_cb((PyObject *)self, 3, FEdgeSmooth_mathutils_cb_index, 0); + return Vector_CreatePyObject_cb((PyObject *)self, 3, FEdgeSmooth_mathutils_cb_index, 0); } static int FEdgeSmooth_normal_set(BPy_FEdgeSmooth *self, PyObject *value, void *UNUSED(closure)) { - float v[3]; - if (mathutils_array_parse(v, 3, 3, value, - "value must be a 3-dimensional vector") == -1) - { - return -1; - } - Vec3r p(v[0], v[1], v[2]); - self->fes->setNormal(p); - return 0; + float v[3]; + if (mathutils_array_parse(v, 3, 3, value, "value must be a 3-dimensional vector") == -1) { + return -1; + } + Vec3r p(v[0], v[1], v[2]); + self->fes->setNormal(p); + return 0; } PyDoc_STRVAR(FEdgeSmooth_material_index_doc, -"The index of the material of the face that this FEdge is running across.\n" -"\n" -":type: int"); + "The index of the material of the face that this FEdge is running across.\n" + "\n" + ":type: int"); static PyObject *FEdgeSmooth_material_index_get(BPy_FEdgeSmooth *self, void *UNUSED(closure)) { - return PyLong_FromLong(self->fes->frs_materialIndex()); + return PyLong_FromLong(self->fes->frs_materialIndex()); } -static int FEdgeSmooth_material_index_set(BPy_FEdgeSmooth *self, PyObject *value, void *UNUSED(closure)) +static int FEdgeSmooth_material_index_set(BPy_FEdgeSmooth *self, + PyObject *value, + void *UNUSED(closure)) { - unsigned int i = PyLong_AsUnsignedLong(value); - if (PyErr_Occurred()) - return -1; - self->fes->setFrsMaterialIndex(i); - return 0; + unsigned int i = PyLong_AsUnsignedLong(value); + if (PyErr_Occurred()) + return -1; + self->fes->setFrsMaterialIndex(i); + return 0; } PyDoc_STRVAR(FEdgeSmooth_material_doc, -"The material of the face that this FEdge is running across.\n" -"\n" -":type: :class:`Material`"); + "The material of the face that this FEdge is running across.\n" + "\n" + ":type: :class:`Material`"); static PyObject *FEdgeSmooth_material_get(BPy_FEdgeSmooth *self, void *UNUSED(closure)) { - return BPy_FrsMaterial_from_FrsMaterial(self->fes->frs_material()); + return BPy_FrsMaterial_from_FrsMaterial(self->fes->frs_material()); } PyDoc_STRVAR(FEdgeSmooth_face_mark_doc, -"The face mark of the face that this FEdge is running across.\n" -"\n" -":type: bool"); + "The face mark of the face that this FEdge is running across.\n" + "\n" + ":type: bool"); static PyObject *FEdgeSmooth_face_mark_get(BPy_FEdgeSmooth *self, void *UNUSED(closure)) { - return PyBool_from_bool(self->fes->faceMark()); + return PyBool_from_bool(self->fes->faceMark()); } static int FEdgeSmooth_face_mark_set(BPy_FEdgeSmooth *self, PyObject *value, void *UNUSED(closure)) { - if (!PyBool_Check(value)) - return -1; - self->fes->setFaceMark(bool_from_PyBool(value)); - return 0; + if (!PyBool_Check(value)) + return -1; + self->fes->setFaceMark(bool_from_PyBool(value)); + return 0; } static PyGetSetDef BPy_FEdgeSmooth_getseters[] = { - {(char *)"normal", (getter)FEdgeSmooth_normal_get, (setter)FEdgeSmooth_normal_set, - (char *)FEdgeSmooth_normal_doc, NULL}, - {(char *)"material_index", (getter)FEdgeSmooth_material_index_get, (setter)FEdgeSmooth_material_index_set, - (char *)FEdgeSmooth_material_index_doc, NULL}, - {(char *)"material", (getter)FEdgeSmooth_material_get, (setter)NULL, (char *)FEdgeSmooth_material_doc, NULL}, - {(char *)"face_mark", (getter)FEdgeSmooth_face_mark_get, (setter)FEdgeSmooth_face_mark_set, - (char *)FEdgeSmooth_face_mark_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"normal", + (getter)FEdgeSmooth_normal_get, + (setter)FEdgeSmooth_normal_set, + (char *)FEdgeSmooth_normal_doc, + NULL}, + {(char *)"material_index", + (getter)FEdgeSmooth_material_index_get, + (setter)FEdgeSmooth_material_index_set, + (char *)FEdgeSmooth_material_index_doc, + NULL}, + {(char *)"material", + (getter)FEdgeSmooth_material_get, + (setter)NULL, + (char *)FEdgeSmooth_material_doc, + NULL}, + {(char *)"face_mark", + (getter)FEdgeSmooth_face_mark_get, + (setter)FEdgeSmooth_face_mark_set, + (char *)FEdgeSmooth_face_mark_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_FEdgeSmooth type definition ------------------------------*/ PyTypeObject FEdgeSmooth_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "FEdgeSmooth", /* tp_name */ - sizeof(BPy_FEdgeSmooth), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - FEdgeSmooth_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_FEdgeSmooth_getseters, /* tp_getset */ - &FEdge_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)FEdgeSmooth_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "FEdgeSmooth", /* tp_name */ + sizeof(BPy_FEdgeSmooth), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + FEdgeSmooth_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + BPy_FEdgeSmooth_getseters, /* tp_getset */ + &FEdge_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)FEdgeSmooth_init, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.h b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.h index b460795228c..901741a76ff 100644 --- a/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.h +++ b/source/blender/freestyle/intern/python/Interface1D/FEdge/BPy_FEdgeSmooth.h @@ -33,12 +33,13 @@ extern "C" { extern PyTypeObject FEdgeSmooth_Type; -#define BPy_FEdgeSmooth_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&FEdgeSmooth_Type)) +#define BPy_FEdgeSmooth_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&FEdgeSmooth_Type)) /*---------------------------Python BPy_FEdgeSmooth structure definition----------*/ typedef struct { - BPy_FEdge py_fe; - FEdgeSmooth *fes; + BPy_FEdge py_fe; + FEdgeSmooth *fes; } BPy_FEdgeSmooth; /*---------------------------Python BPy_FEdgeSmooth visible prototypes-----------*/ diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp index f8bae0e5aca..6b23ffadffb 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.cpp @@ -31,179 +31,198 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- -PyDoc_STRVAR(AdjacencyIterator_doc, -"Class hierarchy: :class:`Iterator` > :class:`AdjacencyIterator`\n" -"\n" -"Class for representing adjacency iterators used in the chaining\n" -"process. An AdjacencyIterator is created in the increment() and\n" -"decrement() methods of a :class:`ChainingIterator` and passed to the\n" -"traverse() method of the ChainingIterator.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __init__(brother)\n" -"\n" -" Copy constructor.\n" -"\n" -" :arg brother: An AdjacencyIterator object.\n" -" :type brother: :class:`AdjacencyIterator`\n" -"\n" -".. method:: __init__(vertex, restrict_to_selection=True, restrict_to_unvisited=True)\n" -"\n" -" Builds a AdjacencyIterator object.\n" -"\n" -" :arg vertex: The vertex which is the next crossing.\n" -" :type vertex: :class:`ViewVertex`\n" -" :arg restrict_to_selection: Indicates whether to force the chaining\n" -" to stay within the set of selected ViewEdges or not.\n" -" :type restrict_to_selection: bool\n" -" :arg restrict_to_unvisited: Indicates whether a ViewEdge that has\n" -" already been chained must be ignored ot not.\n" -" :type restrict_to_unvisited: bool"); +PyDoc_STRVAR( + AdjacencyIterator_doc, + "Class hierarchy: :class:`Iterator` > :class:`AdjacencyIterator`\n" + "\n" + "Class for representing adjacency iterators used in the chaining\n" + "process. An AdjacencyIterator is created in the increment() and\n" + "decrement() methods of a :class:`ChainingIterator` and passed to the\n" + "traverse() method of the ChainingIterator.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __init__(brother)\n" + "\n" + " Copy constructor.\n" + "\n" + " :arg brother: An AdjacencyIterator object.\n" + " :type brother: :class:`AdjacencyIterator`\n" + "\n" + ".. method:: __init__(vertex, restrict_to_selection=True, restrict_to_unvisited=True)\n" + "\n" + " Builds a AdjacencyIterator object.\n" + "\n" + " :arg vertex: The vertex which is the next crossing.\n" + " :type vertex: :class:`ViewVertex`\n" + " :arg restrict_to_selection: Indicates whether to force the chaining\n" + " to stay within the set of selected ViewEdges or not.\n" + " :type restrict_to_selection: bool\n" + " :arg restrict_to_unvisited: Indicates whether a ViewEdge that has\n" + " already been chained must be ignored ot not.\n" + " :type restrict_to_unvisited: bool"); static int AdjacencyIterator_init(BPy_AdjacencyIterator *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"vertex", "restrict_to_selection", "restrict_to_unvisited", NULL}; - PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0; - - if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &AdjacencyIterator_Type, &obj1)) { - if (!obj1) { - self->a_it = new AdjacencyIterator(); - self->at_start = true; - } - else { - self->a_it = new AdjacencyIterator(*(((BPy_AdjacencyIterator *)obj1)->a_it)); - self->at_start = ((BPy_AdjacencyIterator *)obj1)->at_start; - } - } - else if (PyErr_Clear(), (obj2 = obj3 = 0), - PyArg_ParseTupleAndKeywords(args, kwds, "O!|O!O!", (char **)kwlist_2, - &ViewVertex_Type, &obj1, &PyBool_Type, &obj2, &PyBool_Type, &obj3)) - { - bool restrictToSelection = (!obj2) ? true : bool_from_PyBool(obj2); - bool restrictToUnvisited = (!obj3) ? true : bool_from_PyBool(obj3); - self->a_it = new AdjacencyIterator(((BPy_ViewVertex *)obj1)->vv, restrictToSelection, restrictToUnvisited); - self->at_start = ((BPy_AdjacencyIterator *)obj1)->at_start; - } - else { - PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); - return -1; - } - self->py_it.it = self->a_it; - return 0; + static const char *kwlist_1[] = {"brother", NULL}; + static const char *kwlist_2[] = { + "vertex", "restrict_to_selection", "restrict_to_unvisited", NULL}; + PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0; + + if (PyArg_ParseTupleAndKeywords( + args, kwds, "|O!", (char **)kwlist_1, &AdjacencyIterator_Type, &obj1)) { + if (!obj1) { + self->a_it = new AdjacencyIterator(); + self->at_start = true; + } + else { + self->a_it = new AdjacencyIterator(*(((BPy_AdjacencyIterator *)obj1)->a_it)); + self->at_start = ((BPy_AdjacencyIterator *)obj1)->at_start; + } + } + else if (PyErr_Clear(), + (obj2 = obj3 = 0), + PyArg_ParseTupleAndKeywords(args, + kwds, + "O!|O!O!", + (char **)kwlist_2, + &ViewVertex_Type, + &obj1, + &PyBool_Type, + &obj2, + &PyBool_Type, + &obj3)) { + bool restrictToSelection = (!obj2) ? true : bool_from_PyBool(obj2); + bool restrictToUnvisited = (!obj3) ? true : bool_from_PyBool(obj3); + self->a_it = new AdjacencyIterator( + ((BPy_ViewVertex *)obj1)->vv, restrictToSelection, restrictToUnvisited); + self->at_start = ((BPy_AdjacencyIterator *)obj1)->at_start; + } + else { + PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); + return -1; + } + self->py_it.it = self->a_it; + return 0; } static PyObject *AdjacencyIterator_iter(BPy_AdjacencyIterator *self) { - Py_INCREF(self); - self->at_start = true; - return (PyObject *) self; + Py_INCREF(self); + self->at_start = true; + return (PyObject *)self; } static PyObject *AdjacencyIterator_iternext(BPy_AdjacencyIterator *self) { - if (self->a_it->isEnd()) { - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } - if (self->at_start) - self->at_start = false; - else { - self->a_it->increment(); - if (self->a_it->isEnd()) { - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } - } - ViewEdge *ve = self->a_it->operator->(); - return BPy_ViewEdge_from_ViewEdge(*ve); + if (self->a_it->isEnd()) { + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } + if (self->at_start) + self->at_start = false; + else { + self->a_it->increment(); + if (self->a_it->isEnd()) { + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } + } + ViewEdge *ve = self->a_it->operator->(); + return BPy_ViewEdge_from_ViewEdge(*ve); } /*----------------------AdjacencyIterator get/setters ----------------------------*/ PyDoc_STRVAR(AdjacencyIterator_object_doc, -"The ViewEdge object currently pointed to by this iterator.\n" -"\n" -":type: :class:`ViewEdge`"); + "The ViewEdge object currently pointed to by this iterator.\n" + "\n" + ":type: :class:`ViewEdge`"); static PyObject *AdjacencyIterator_object_get(BPy_AdjacencyIterator *self, void *UNUSED(closure)) { - if (self->a_it->isEnd()) { - PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); - return NULL; - } - ViewEdge *ve = self->a_it->operator*(); - if (ve) - return BPy_ViewEdge_from_ViewEdge(*ve); - Py_RETURN_NONE; + if (self->a_it->isEnd()) { + PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); + return NULL; + } + ViewEdge *ve = self->a_it->operator*(); + if (ve) + return BPy_ViewEdge_from_ViewEdge(*ve); + Py_RETURN_NONE; } PyDoc_STRVAR(AdjacencyIterator_is_incoming_doc, -"True if the current ViewEdge is coming towards the iteration vertex, and\n" -"False otherwise.\n" -"\n" -":type: bool"); + "True if the current ViewEdge is coming towards the iteration vertex, and\n" + "False otherwise.\n" + "\n" + ":type: bool"); -static PyObject *AdjacencyIterator_is_incoming_get(BPy_AdjacencyIterator *self, void *UNUSED(closure)) +static PyObject *AdjacencyIterator_is_incoming_get(BPy_AdjacencyIterator *self, + void *UNUSED(closure)) { - if (self->a_it->isEnd()) { - PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); - return NULL; - } - return PyBool_from_bool(self->a_it->isIncoming()); + if (self->a_it->isEnd()) { + PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); + return NULL; + } + return PyBool_from_bool(self->a_it->isIncoming()); } static PyGetSetDef BPy_AdjacencyIterator_getseters[] = { - {(char *)"is_incoming", (getter)AdjacencyIterator_is_incoming_get, (setter)NULL, - (char *)AdjacencyIterator_is_incoming_doc, NULL}, - {(char *)"object", (getter)AdjacencyIterator_object_get, (setter)NULL, (char *)AdjacencyIterator_object_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"is_incoming", + (getter)AdjacencyIterator_is_incoming_get, + (setter)NULL, + (char *)AdjacencyIterator_is_incoming_doc, + NULL}, + {(char *)"object", + (getter)AdjacencyIterator_object_get, + (setter)NULL, + (char *)AdjacencyIterator_object_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_AdjacencyIterator type definition ------------------------------*/ PyTypeObject AdjacencyIterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "AdjacencyIterator", /* tp_name */ - sizeof(BPy_AdjacencyIterator), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - AdjacencyIterator_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - (getiterfunc)AdjacencyIterator_iter, /* tp_iter */ - (iternextfunc)AdjacencyIterator_iternext, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_AdjacencyIterator_getseters, /* tp_getset */ - &Iterator_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)AdjacencyIterator_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "AdjacencyIterator", /* tp_name */ + sizeof(BPy_AdjacencyIterator), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + AdjacencyIterator_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + (getiterfunc)AdjacencyIterator_iter, /* tp_iter */ + (iternextfunc)AdjacencyIterator_iternext, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + BPy_AdjacencyIterator_getseters, /* tp_getset */ + &Iterator_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)AdjacencyIterator_init, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.h index 775f8a2628d..9a360f23f0a 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.h +++ b/source/blender/freestyle/intern/python/Iterator/BPy_AdjacencyIterator.h @@ -33,13 +33,14 @@ extern "C" { extern PyTypeObject AdjacencyIterator_Type; -#define BPy_AdjacencyIterator_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&AdjacencyIterator_Type)) +#define BPy_AdjacencyIterator_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&AdjacencyIterator_Type)) /*---------------------------Python BPy_AdjacencyIterator structure definition----------*/ typedef struct { - BPy_Iterator py_it; - AdjacencyIterator *a_it; - bool at_start; + BPy_Iterator py_it; + AdjacencyIterator *a_it; + bool at_start; } BPy_AdjacencyIterator; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp index 994eb715fe3..f25435b421c 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.cpp @@ -35,152 +35,172 @@ extern "C" { PyDoc_STRVAR(ChainPredicateIterator_doc, -"Class hierarchy: :class:`freestyle.types.Iterator` >\n" -":class:`freestyle.types.ViewEdgeIterator` >\n" -":class:`freestyle.types.ChainingIterator` >\n" -":class:`ChainPredicateIterator`\n" -"\n" -"A \"generic\" user-controlled ViewEdge iterator. This iterator is in\n" -"particular built from a unary predicate and a binary predicate.\n" -"First, the unary predicate is evaluated for all potential next\n" -"ViewEdges in order to only keep the ones respecting a certain\n" -"constraint. Then, the binary predicate is evaluated on the current\n" -"ViewEdge together with each ViewEdge of the previous selection. The\n" -"first ViewEdge respecting both the unary predicate and the binary\n" -"predicate is kept as the next one. If none of the potential next\n" -"ViewEdge respects these two predicates, None is returned.\n" -"\n" -".. method:: __init__(upred, bpred, restrict_to_selection=True, restrict_to_unvisited=True, begin=None, " -"orientation=True)\n" -"\n" -" Builds a ChainPredicateIterator from a unary predicate, a binary\n" -" predicate, a starting ViewEdge and its orientation.\n" -"\n" -" :arg upred: The unary predicate that the next ViewEdge must satisfy.\n" -" :type upred: :class:`freestyle.types.UnaryPredicate1D`\n" -" :arg bpred: The binary predicate that the next ViewEdge must\n" -" satisfy together with the actual pointed ViewEdge.\n" -" :type bpred: :class:`freestyle.types.BinaryPredicate1D`\n" -" :arg restrict_to_selection: Indicates whether to force the chaining\n" -" to stay within the set of selected ViewEdges or not.\n" -" :type restrict_to_selection: bool\n" -" :arg restrict_to_unvisited: Indicates whether a ViewEdge that has\n" -" already been chained must be ignored ot not.\n" -" :type restrict_to_unvisited: bool\n" -" :arg begin: The ViewEdge from where to start the iteration.\n" -" :type begin: :class:`freestyle.types.ViewEdge` or None\n" -" :arg orientation: If true, we'll look for the next ViewEdge among\n" -" the ViewEdges that surround the ending ViewVertex of begin. If\n" -" false, we'll search over the ViewEdges surrounding the ending\n" -" ViewVertex of begin.\n" -" :type orientation: bool\n" -"\n" -".. method:: __init__(brother)\n" -"\n" -" Copy constructor.\n" -"\n" -" :arg brother: A ChainPredicateIterator object.\n" -" :type brother: :class:`ChainPredicateIterator`"); + "Class hierarchy: :class:`freestyle.types.Iterator` >\n" + ":class:`freestyle.types.ViewEdgeIterator` >\n" + ":class:`freestyle.types.ChainingIterator` >\n" + ":class:`ChainPredicateIterator`\n" + "\n" + "A \"generic\" user-controlled ViewEdge iterator. This iterator is in\n" + "particular built from a unary predicate and a binary predicate.\n" + "First, the unary predicate is evaluated for all potential next\n" + "ViewEdges in order to only keep the ones respecting a certain\n" + "constraint. Then, the binary predicate is evaluated on the current\n" + "ViewEdge together with each ViewEdge of the previous selection. The\n" + "first ViewEdge respecting both the unary predicate and the binary\n" + "predicate is kept as the next one. If none of the potential next\n" + "ViewEdge respects these two predicates, None is returned.\n" + "\n" + ".. method:: __init__(upred, bpred, restrict_to_selection=True, " + "restrict_to_unvisited=True, begin=None, " + "orientation=True)\n" + "\n" + " Builds a ChainPredicateIterator from a unary predicate, a binary\n" + " predicate, a starting ViewEdge and its orientation.\n" + "\n" + " :arg upred: The unary predicate that the next ViewEdge must satisfy.\n" + " :type upred: :class:`freestyle.types.UnaryPredicate1D`\n" + " :arg bpred: The binary predicate that the next ViewEdge must\n" + " satisfy together with the actual pointed ViewEdge.\n" + " :type bpred: :class:`freestyle.types.BinaryPredicate1D`\n" + " :arg restrict_to_selection: Indicates whether to force the chaining\n" + " to stay within the set of selected ViewEdges or not.\n" + " :type restrict_to_selection: bool\n" + " :arg restrict_to_unvisited: Indicates whether a ViewEdge that has\n" + " already been chained must be ignored ot not.\n" + " :type restrict_to_unvisited: bool\n" + " :arg begin: The ViewEdge from where to start the iteration.\n" + " :type begin: :class:`freestyle.types.ViewEdge` or None\n" + " :arg orientation: If true, we'll look for the next ViewEdge among\n" + " the ViewEdges that surround the ending ViewVertex of begin. If\n" + " false, we'll search over the ViewEdges surrounding the ending\n" + " ViewVertex of begin.\n" + " :type orientation: bool\n" + "\n" + ".. method:: __init__(brother)\n" + "\n" + " Copy constructor.\n" + "\n" + " :arg brother: A ChainPredicateIterator object.\n" + " :type brother: :class:`ChainPredicateIterator`"); static int check_begin(PyObject *obj, void *v) { - if (obj != NULL && obj != Py_None && !BPy_ViewEdge_Check(obj)) - return 0; - *((PyObject **)v) = obj; - return 1; + if (obj != NULL && obj != Py_None && !BPy_ViewEdge_Check(obj)) + return 0; + *((PyObject **)v) = obj; + return 1; } -static int ChainPredicateIterator_init(BPy_ChainPredicateIterator *self, PyObject *args, PyObject *kwds) +static int ChainPredicateIterator_init(BPy_ChainPredicateIterator *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"upred", "bpred", "restrict_to_selection", "restrict_to_unvisited", "begin", - "orientation", NULL}; - PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0, *obj4 = 0, *obj5 = 0, *obj6 = 0; - - if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist_1, &ChainPredicateIterator_Type, &obj1)) { - self->cp_it = new ChainPredicateIterator(*(((BPy_ChainPredicateIterator *)obj1)->cp_it)); - self->upred = ((BPy_ChainPredicateIterator *)obj1)->upred; - self->bpred = ((BPy_ChainPredicateIterator *)obj1)->bpred; - Py_INCREF(self->upred); - Py_INCREF(self->bpred); - } - else if (PyErr_Clear(), (obj3 = obj4 = obj5 = obj6 = 0), - PyArg_ParseTupleAndKeywords(args, kwds, "O!O!|O!O!O&O!", (char **)kwlist_2, - &UnaryPredicate1D_Type, &obj1, &BinaryPredicate1D_Type, &obj2, - &PyBool_Type, &obj3, &PyBool_Type, &obj4, check_begin, &obj5, - &PyBool_Type, &obj6)) - { - UnaryPredicate1D *up1D = ((BPy_UnaryPredicate1D *)obj1)->up1D; - BinaryPredicate1D *bp1D = ((BPy_BinaryPredicate1D *)obj2)->bp1D; - bool restrict_to_selection = (!obj3) ? true : bool_from_PyBool(obj3); - bool restrict_to_unvisited = (!obj4) ? true : bool_from_PyBool(obj4); - ViewEdge *begin = (!obj5 || obj5 == Py_None) ? NULL : ((BPy_ViewEdge *)obj5)->ve; - bool orientation = (!obj6) ? true : bool_from_PyBool(obj6); - self->cp_it = new ChainPredicateIterator(*up1D, *bp1D, restrict_to_selection, restrict_to_unvisited, begin, - orientation); - self->upred = obj1; - self->bpred = obj2; - Py_INCREF(self->upred); - Py_INCREF(self->bpred); - } - else { - PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); - return -1; - } - self->py_c_it.c_it = self->cp_it; - self->py_c_it.py_ve_it.ve_it = self->cp_it; - self->py_c_it.py_ve_it.py_it.it = self->cp_it; - return 0; + static const char *kwlist_1[] = {"brother", NULL}; + static const char *kwlist_2[] = {"upred", + "bpred", + "restrict_to_selection", + "restrict_to_unvisited", + "begin", + "orientation", + NULL}; + PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0, *obj4 = 0, *obj5 = 0, *obj6 = 0; + + if (PyArg_ParseTupleAndKeywords( + args, kwds, "O!", (char **)kwlist_1, &ChainPredicateIterator_Type, &obj1)) { + self->cp_it = new ChainPredicateIterator(*(((BPy_ChainPredicateIterator *)obj1)->cp_it)); + self->upred = ((BPy_ChainPredicateIterator *)obj1)->upred; + self->bpred = ((BPy_ChainPredicateIterator *)obj1)->bpred; + Py_INCREF(self->upred); + Py_INCREF(self->bpred); + } + else if (PyErr_Clear(), + (obj3 = obj4 = obj5 = obj6 = 0), + PyArg_ParseTupleAndKeywords(args, + kwds, + "O!O!|O!O!O&O!", + (char **)kwlist_2, + &UnaryPredicate1D_Type, + &obj1, + &BinaryPredicate1D_Type, + &obj2, + &PyBool_Type, + &obj3, + &PyBool_Type, + &obj4, + check_begin, + &obj5, + &PyBool_Type, + &obj6)) { + UnaryPredicate1D *up1D = ((BPy_UnaryPredicate1D *)obj1)->up1D; + BinaryPredicate1D *bp1D = ((BPy_BinaryPredicate1D *)obj2)->bp1D; + bool restrict_to_selection = (!obj3) ? true : bool_from_PyBool(obj3); + bool restrict_to_unvisited = (!obj4) ? true : bool_from_PyBool(obj4); + ViewEdge *begin = (!obj5 || obj5 == Py_None) ? NULL : ((BPy_ViewEdge *)obj5)->ve; + bool orientation = (!obj6) ? true : bool_from_PyBool(obj6); + self->cp_it = new ChainPredicateIterator( + *up1D, *bp1D, restrict_to_selection, restrict_to_unvisited, begin, orientation); + self->upred = obj1; + self->bpred = obj2; + Py_INCREF(self->upred); + Py_INCREF(self->bpred); + } + else { + PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); + return -1; + } + self->py_c_it.c_it = self->cp_it; + self->py_c_it.py_ve_it.ve_it = self->cp_it; + self->py_c_it.py_ve_it.py_it.it = self->cp_it; + return 0; } static void ChainPredicateIterator_dealloc(BPy_ChainPredicateIterator *self) { - Py_XDECREF(self->upred); - Py_XDECREF(self->bpred); - ChainingIterator_Type.tp_dealloc((PyObject *)self); + Py_XDECREF(self->upred); + Py_XDECREF(self->bpred); + ChainingIterator_Type.tp_dealloc((PyObject *)self); } /*-----------------------BPy_ChainPredicateIterator type definition ------------------------------*/ PyTypeObject ChainPredicateIterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ChainPredicateIterator", /* tp_name */ - sizeof(BPy_ChainPredicateIterator), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)ChainPredicateIterator_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ChainPredicateIterator_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &ChainingIterator_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ChainPredicateIterator_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "ChainPredicateIterator", /* tp_name */ + sizeof(BPy_ChainPredicateIterator), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)ChainPredicateIterator_dealloc, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ChainPredicateIterator_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &ChainingIterator_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ChainPredicateIterator_init, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.h index 2fab8671239..645e6573257 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.h +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainPredicateIterator.h @@ -34,14 +34,14 @@ extern "C" { extern PyTypeObject ChainPredicateIterator_Type; #define BPy_ChainPredicateIterator_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&ChainPredicateIterator_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&ChainPredicateIterator_Type)) /*---------------------------Python BPy_ChainPredicateIterator structure definition----------*/ typedef struct { - BPy_ChainingIterator py_c_it; - ChainPredicateIterator *cp_it; - PyObject *upred; - PyObject *bpred; + BPy_ChainingIterator py_c_it; + ChainPredicateIterator *cp_it; + PyObject *upred; + PyObject *bpred; } BPy_ChainPredicateIterator; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp index 73e178a6706..6a4af0f8053 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.cpp @@ -35,118 +35,128 @@ extern "C" { // ChainSilhouetteIterator (const ChainSilhouetteIterator &brother) PyDoc_STRVAR(ChainSilhouetteIterator_doc, -"Class hierarchy: :class:`freestyle.types.Iterator` >\n" -":class:`freestyle.types.ViewEdgeIterator` >\n" -":class:`freestyle.types.ChainingIterator` >\n" -":class:`ChainSilhouetteIterator`\n" -"\n" -"A ViewEdge Iterator used to follow ViewEdges the most naturally. For\n" -"example, it will follow visible ViewEdges of same nature. As soon, as\n" -"the nature or the visibility changes, the iteration stops (by setting\n" -"the pointed ViewEdge to 0). In the case of an iteration over a set of\n" -"ViewEdge that are both Silhouette and Crease, there will be a\n" -"precedence of the silhouette over the crease criterion.\n" -"\n" -".. method:: __init__(restrict_to_selection=True, begin=None, orientation=True)\n" -"\n" -" Builds a ChainSilhouetteIterator from the first ViewEdge used for\n" -" iteration and its orientation.\n" -"\n" -" :arg restrict_to_selection: Indicates whether to force the chaining\n" -" to stay within the set of selected ViewEdges or not.\n" -" :type restrict_to_selection: bool\n" -" :arg begin: The ViewEdge from where to start the iteration.\n" -" :type begin: :class:`freestyle.types.ViewEdge` or None\n" -" :arg orientation: If true, we'll look for the next ViewEdge among\n" -" the ViewEdges that surround the ending ViewVertex of begin. If\n" -" false, we'll search over the ViewEdges surrounding the ending\n" -" ViewVertex of begin.\n" -" :type orientation: bool\n" -"\n" -".. method:: __init__(brother)\n" -"\n" -" Copy constructor.\n" -"\n" -" :arg brother: A ChainSilhouetteIterator object.\n" -" :type brother: :class:`ChainSilhouetteIterator`"); + "Class hierarchy: :class:`freestyle.types.Iterator` >\n" + ":class:`freestyle.types.ViewEdgeIterator` >\n" + ":class:`freestyle.types.ChainingIterator` >\n" + ":class:`ChainSilhouetteIterator`\n" + "\n" + "A ViewEdge Iterator used to follow ViewEdges the most naturally. For\n" + "example, it will follow visible ViewEdges of same nature. As soon, as\n" + "the nature or the visibility changes, the iteration stops (by setting\n" + "the pointed ViewEdge to 0). In the case of an iteration over a set of\n" + "ViewEdge that are both Silhouette and Crease, there will be a\n" + "precedence of the silhouette over the crease criterion.\n" + "\n" + ".. method:: __init__(restrict_to_selection=True, begin=None, orientation=True)\n" + "\n" + " Builds a ChainSilhouetteIterator from the first ViewEdge used for\n" + " iteration and its orientation.\n" + "\n" + " :arg restrict_to_selection: Indicates whether to force the chaining\n" + " to stay within the set of selected ViewEdges or not.\n" + " :type restrict_to_selection: bool\n" + " :arg begin: The ViewEdge from where to start the iteration.\n" + " :type begin: :class:`freestyle.types.ViewEdge` or None\n" + " :arg orientation: If true, we'll look for the next ViewEdge among\n" + " the ViewEdges that surround the ending ViewVertex of begin. If\n" + " false, we'll search over the ViewEdges surrounding the ending\n" + " ViewVertex of begin.\n" + " :type orientation: bool\n" + "\n" + ".. method:: __init__(brother)\n" + "\n" + " Copy constructor.\n" + "\n" + " :arg brother: A ChainSilhouetteIterator object.\n" + " :type brother: :class:`ChainSilhouetteIterator`"); static int check_begin(PyObject *obj, void *v) { - if (obj != NULL && obj != Py_None && !BPy_ViewEdge_Check(obj)) - return 0; - *((PyObject **)v) = obj; - return 1; + if (obj != NULL && obj != Py_None && !BPy_ViewEdge_Check(obj)) + return 0; + *((PyObject **)v) = obj; + return 1; } -static int ChainSilhouetteIterator_init(BPy_ChainSilhouetteIterator *self, PyObject *args, PyObject *kwds) +static int ChainSilhouetteIterator_init(BPy_ChainSilhouetteIterator *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"restrict_to_selection", "begin", "orientation", NULL}; - PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0; + static const char *kwlist_1[] = {"brother", NULL}; + static const char *kwlist_2[] = {"restrict_to_selection", "begin", "orientation", NULL}; + PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0; - if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist_1, &ChainSilhouetteIterator_Type, &obj1)) { - self->cs_it = new ChainSilhouetteIterator(*(((BPy_ChainSilhouetteIterator *)obj1)->cs_it)); - } - else if (PyErr_Clear(), (obj1 = obj2 = obj3 = 0), - PyArg_ParseTupleAndKeywords(args, kwds, "|O!O&O!", (char **)kwlist_2, - &PyBool_Type, &obj1, check_begin, &obj2, &PyBool_Type, &obj3)) - { - bool restrict_to_selection = (!obj1) ? true : bool_from_PyBool(obj1); - ViewEdge *begin = (!obj2 || obj2 == Py_None) ? NULL : ((BPy_ViewEdge *)obj2)->ve; - bool orientation = (!obj3) ? true : bool_from_PyBool(obj3); - self->cs_it = new ChainSilhouetteIterator(restrict_to_selection, begin, orientation); - } - else { - PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); - return -1; - } - self->py_c_it.c_it = self->cs_it; - self->py_c_it.py_ve_it.ve_it = self->cs_it; - self->py_c_it.py_ve_it.py_it.it = self->cs_it; - return 0; + if (PyArg_ParseTupleAndKeywords( + args, kwds, "O!", (char **)kwlist_1, &ChainSilhouetteIterator_Type, &obj1)) { + self->cs_it = new ChainSilhouetteIterator(*(((BPy_ChainSilhouetteIterator *)obj1)->cs_it)); + } + else if (PyErr_Clear(), + (obj1 = obj2 = obj3 = 0), + PyArg_ParseTupleAndKeywords(args, + kwds, + "|O!O&O!", + (char **)kwlist_2, + &PyBool_Type, + &obj1, + check_begin, + &obj2, + &PyBool_Type, + &obj3)) { + bool restrict_to_selection = (!obj1) ? true : bool_from_PyBool(obj1); + ViewEdge *begin = (!obj2 || obj2 == Py_None) ? NULL : ((BPy_ViewEdge *)obj2)->ve; + bool orientation = (!obj3) ? true : bool_from_PyBool(obj3); + self->cs_it = new ChainSilhouetteIterator(restrict_to_selection, begin, orientation); + } + else { + PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); + return -1; + } + self->py_c_it.c_it = self->cs_it; + self->py_c_it.py_ve_it.ve_it = self->cs_it; + self->py_c_it.py_ve_it.py_it.it = self->cs_it; + return 0; } /*-----------------------BPy_ChainSilhouetteIterator type definition ------------------------------*/ PyTypeObject ChainSilhouetteIterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ChainSilhouetteIterator", /* tp_name */ - sizeof(BPy_ChainSilhouetteIterator), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ChainSilhouetteIterator_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &ChainingIterator_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ChainSilhouetteIterator_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "ChainSilhouetteIterator", /* tp_name */ + sizeof(BPy_ChainSilhouetteIterator), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ChainSilhouetteIterator_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &ChainingIterator_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ChainSilhouetteIterator_init, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.h index 7c5974ec218..72823832441 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.h +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainSilhouetteIterator.h @@ -34,12 +34,12 @@ extern "C" { extern PyTypeObject ChainSilhouetteIterator_Type; #define BPy_ChainSilhouetteIterator_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&ChainSilhouetteIterator_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&ChainSilhouetteIterator_Type)) /*---------------------------Python BPy_ChainSilhouetteIterator structure definition----------*/ typedef struct { - BPy_ChainingIterator py_c_it; - ChainSilhouetteIterator *cs_it; + BPy_ChainingIterator py_c_it; + ChainSilhouetteIterator *cs_it; } BPy_ChainSilhouetteIterator; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp index afd7f6f69c6..370ef23d8ef 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.cpp @@ -33,229 +33,260 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- -PyDoc_STRVAR(ChainingIterator_doc, -"Class hierarchy: :class:`Iterator` > :class:`ViewEdgeIterator` > :class:`ChainingIterator`\n" -"\n" -"Base class for chaining iterators. This class is designed to be\n" -"overloaded in order to describe chaining rules. It makes the\n" -"description of chaining rules easier. The two main methods that need\n" -"to overloaded are traverse() and init(). traverse() tells which\n" -":class:`ViewEdge` to follow, among the adjacent ones. If you specify\n" -"restriction rules (such as \"Chain only ViewEdges of the selection\"),\n" -"they will be included in the adjacency iterator (i.e, the adjacent\n" -"iterator will only stop on \"valid\" edges).\n" -"\n" -".. method:: __init__(restrict_to_selection=True, restrict_to_unvisited=True, begin=None, orientation=True)\n" -"\n" -" Builds a Chaining Iterator from the first ViewEdge used for\n" -" iteration and its orientation.\n" -"\n" -" :arg restrict_to_selection: Indicates whether to force the chaining\n" -" to stay within the set of selected ViewEdges or not.\n" -" :type restrict_to_selection: bool\n" -" :arg restrict_to_unvisited: Indicates whether a ViewEdge that has\n" -" already been chained must be ignored ot not.\n" -" :type restrict_to_unvisited: bool\n" -" :arg begin: The ViewEdge from which to start the chain.\n" -" :type begin: :class:`ViewEdge` or None\n" -" :arg orientation: The direction to follow to explore the graph. If\n" -" true, the direction indicated by the first ViewEdge is used.\n" -" :type orientation: bool\n" -"\n" -".. method:: __init__(brother)\n" -"\n" -" Copy constructor.\n" -"\n" -" :arg brother: \n" -" :type brother: ChainingIterator"); +PyDoc_STRVAR( + ChainingIterator_doc, + "Class hierarchy: :class:`Iterator` > :class:`ViewEdgeIterator` > :class:`ChainingIterator`\n" + "\n" + "Base class for chaining iterators. This class is designed to be\n" + "overloaded in order to describe chaining rules. It makes the\n" + "description of chaining rules easier. The two main methods that need\n" + "to overloaded are traverse() and init(). traverse() tells which\n" + ":class:`ViewEdge` to follow, among the adjacent ones. If you specify\n" + "restriction rules (such as \"Chain only ViewEdges of the selection\"),\n" + "they will be included in the adjacency iterator (i.e, the adjacent\n" + "iterator will only stop on \"valid\" edges).\n" + "\n" + ".. method:: __init__(restrict_to_selection=True, restrict_to_unvisited=True, begin=None, " + "orientation=True)\n" + "\n" + " Builds a Chaining Iterator from the first ViewEdge used for\n" + " iteration and its orientation.\n" + "\n" + " :arg restrict_to_selection: Indicates whether to force the chaining\n" + " to stay within the set of selected ViewEdges or not.\n" + " :type restrict_to_selection: bool\n" + " :arg restrict_to_unvisited: Indicates whether a ViewEdge that has\n" + " already been chained must be ignored ot not.\n" + " :type restrict_to_unvisited: bool\n" + " :arg begin: The ViewEdge from which to start the chain.\n" + " :type begin: :class:`ViewEdge` or None\n" + " :arg orientation: The direction to follow to explore the graph. If\n" + " true, the direction indicated by the first ViewEdge is used.\n" + " :type orientation: bool\n" + "\n" + ".. method:: __init__(brother)\n" + "\n" + " Copy constructor.\n" + "\n" + " :arg brother: \n" + " :type brother: ChainingIterator"); static int check_begin(PyObject *obj, void *v) { - if (obj != NULL && obj != Py_None && !BPy_ViewEdge_Check(obj)) - return 0; - *((PyObject **)v) = obj; - return 1; + if (obj != NULL && obj != Py_None && !BPy_ViewEdge_Check(obj)) + return 0; + *((PyObject **)v) = obj; + return 1; } static int ChainingIterator___init__(BPy_ChainingIterator *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"restrict_to_selection", "restrict_to_unvisited", "begin", "orientation", NULL}; - PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0, *obj4 = 0; - - if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist_1, &ChainingIterator_Type, &obj1)) { - self->c_it = new ChainingIterator(*(((BPy_ChainingIterator *)obj1)->c_it)); - } - else if (PyErr_Clear(), (obj1 = obj2 = obj3 = obj4 = 0), - PyArg_ParseTupleAndKeywords(args, kwds, "|O!O!O&O!", (char **)kwlist_2, - &PyBool_Type, &obj1, &PyBool_Type, &obj2, check_begin, &obj3, - &PyBool_Type, &obj4)) - { - bool restrict_to_selection = (!obj1) ? true : bool_from_PyBool(obj1); - bool restrict_to_unvisited = (!obj2) ? true : bool_from_PyBool(obj2); - ViewEdge *begin = (!obj3 || obj3 == Py_None) ? NULL : ((BPy_ViewEdge *)obj3)->ve; - bool orientation = (!obj4) ? true : bool_from_PyBool(obj4); - self->c_it = new ChainingIterator(restrict_to_selection, restrict_to_unvisited, begin, orientation); - } - else { - PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); - return -1; - } - self->py_ve_it.ve_it = self->c_it; - self->py_ve_it.py_it.it = self->c_it; - - self->c_it->py_c_it = (PyObject *)self; - - return 0; + static const char *kwlist_1[] = {"brother", NULL}; + static const char *kwlist_2[] = { + "restrict_to_selection", "restrict_to_unvisited", "begin", "orientation", NULL}; + PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0, *obj4 = 0; + + if (PyArg_ParseTupleAndKeywords( + args, kwds, "O!", (char **)kwlist_1, &ChainingIterator_Type, &obj1)) { + self->c_it = new ChainingIterator(*(((BPy_ChainingIterator *)obj1)->c_it)); + } + else if (PyErr_Clear(), + (obj1 = obj2 = obj3 = obj4 = 0), + PyArg_ParseTupleAndKeywords(args, + kwds, + "|O!O!O&O!", + (char **)kwlist_2, + &PyBool_Type, + &obj1, + &PyBool_Type, + &obj2, + check_begin, + &obj3, + &PyBool_Type, + &obj4)) { + bool restrict_to_selection = (!obj1) ? true : bool_from_PyBool(obj1); + bool restrict_to_unvisited = (!obj2) ? true : bool_from_PyBool(obj2); + ViewEdge *begin = (!obj3 || obj3 == Py_None) ? NULL : ((BPy_ViewEdge *)obj3)->ve; + bool orientation = (!obj4) ? true : bool_from_PyBool(obj4); + self->c_it = new ChainingIterator( + restrict_to_selection, restrict_to_unvisited, begin, orientation); + } + else { + PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); + return -1; + } + self->py_ve_it.ve_it = self->c_it; + self->py_ve_it.py_it.it = self->c_it; + + self->c_it->py_c_it = (PyObject *)self; + + return 0; } PyDoc_STRVAR(ChainingIterator_init_doc, -".. method:: init()\n" -"\n" -" Initializes the iterator context. This method is called each\n" -" time a new chain is started. It can be used to reset some\n" -" history information that you might want to keep."); + ".. method:: init()\n" + "\n" + " Initializes the iterator context. This method is called each\n" + " time a new chain is started. It can be used to reset some\n" + " history information that you might want to keep."); static PyObject *ChainingIterator_init(BPy_ChainingIterator *self) { - if (typeid(*(self->c_it)) == typeid(ChainingIterator)) { - PyErr_SetString(PyExc_TypeError, "init() method not properly overridden"); - return NULL; - } - self->c_it->init(); - Py_RETURN_NONE; + if (typeid(*(self->c_it)) == typeid(ChainingIterator)) { + PyErr_SetString(PyExc_TypeError, "init() method not properly overridden"); + return NULL; + } + self->c_it->init(); + Py_RETURN_NONE; } PyDoc_STRVAR(ChainingIterator_traverse_doc, -".. method:: traverse(it)\n" -"\n" -" This method iterates over the potential next ViewEdges and returns\n" -" the one that will be followed next. Returns the next ViewEdge to\n" -" follow or None when the end of the chain is reached.\n" -"\n" -" :arg it: The iterator over the ViewEdges adjacent to the end vertex\n" -" of the current ViewEdge. The adjacency iterator reflects the\n" -" restriction rules by only iterating over the valid ViewEdges.\n" -" :type it: :class:`AdjacencyIterator`\n" -" :return: Returns the next ViewEdge to follow, or None if chaining ends.\n" -" :rtype: :class:`ViewEdge` or None"); - -static PyObject *ChainingIterator_traverse(BPy_ChainingIterator *self, PyObject *args, PyObject *kwds) + ".. method:: traverse(it)\n" + "\n" + " This method iterates over the potential next ViewEdges and returns\n" + " the one that will be followed next. Returns the next ViewEdge to\n" + " follow or None when the end of the chain is reached.\n" + "\n" + " :arg it: The iterator over the ViewEdges adjacent to the end vertex\n" + " of the current ViewEdge. The adjacency iterator reflects the\n" + " restriction rules by only iterating over the valid ViewEdges.\n" + " :type it: :class:`AdjacencyIterator`\n" + " :return: Returns the next ViewEdge to follow, or None if chaining ends.\n" + " :rtype: :class:`ViewEdge` or None"); + +static PyObject *ChainingIterator_traverse(BPy_ChainingIterator *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"it", NULL}; - PyObject *py_a_it; - - if (typeid(*(self->c_it)) == typeid(ChainingIterator)) { - PyErr_SetString(PyExc_TypeError, "traverse() method not properly overridden"); - return NULL; - } - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &AdjacencyIterator_Type, &py_a_it)) - return NULL; - if (((BPy_AdjacencyIterator *)py_a_it)->a_it) - self->c_it->traverse(*(((BPy_AdjacencyIterator *)py_a_it)->a_it)); - Py_RETURN_NONE; + static const char *kwlist[] = {"it", NULL}; + PyObject *py_a_it; + + if (typeid(*(self->c_it)) == typeid(ChainingIterator)) { + PyErr_SetString(PyExc_TypeError, "traverse() method not properly overridden"); + return NULL; + } + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "O!", (char **)kwlist, &AdjacencyIterator_Type, &py_a_it)) + return NULL; + if (((BPy_AdjacencyIterator *)py_a_it)->a_it) + self->c_it->traverse(*(((BPy_AdjacencyIterator *)py_a_it)->a_it)); + Py_RETURN_NONE; } static PyMethodDef BPy_ChainingIterator_methods[] = { - {"init", (PyCFunction) ChainingIterator_init, METH_NOARGS, ChainingIterator_init_doc}, - {"traverse", (PyCFunction) ChainingIterator_traverse, METH_VARARGS | METH_KEYWORDS, ChainingIterator_traverse_doc}, - {NULL, NULL, 0, NULL}, + {"init", (PyCFunction)ChainingIterator_init, METH_NOARGS, ChainingIterator_init_doc}, + {"traverse", + (PyCFunction)ChainingIterator_traverse, + METH_VARARGS | METH_KEYWORDS, + ChainingIterator_traverse_doc}, + {NULL, NULL, 0, NULL}, }; /*----------------------ChainingIterator get/setters ----------------------------*/ PyDoc_STRVAR(ChainingIterator_object_doc, -"The ViewEdge object currently pointed by this iterator.\n" -"\n" -":type: :class:`ViewEdge`"); + "The ViewEdge object currently pointed by this iterator.\n" + "\n" + ":type: :class:`ViewEdge`"); static PyObject *ChainingIterator_object_get(BPy_ChainingIterator *self, void *UNUSED(closure)) { - if (self->c_it->isEnd()) { - PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); - return NULL; - } - ViewEdge *ve = self->c_it->operator*(); - if (ve) - return BPy_ViewEdge_from_ViewEdge(*ve); - - Py_RETURN_NONE; + if (self->c_it->isEnd()) { + PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); + return NULL; + } + ViewEdge *ve = self->c_it->operator*(); + if (ve) + return BPy_ViewEdge_from_ViewEdge(*ve); + + Py_RETURN_NONE; } PyDoc_STRVAR(ChainingIterator_next_vertex_doc, -"The ViewVertex that is the next crossing.\n" -"\n" -":type: :class:`ViewVertex`"); + "The ViewVertex that is the next crossing.\n" + "\n" + ":type: :class:`ViewVertex`"); -static PyObject *ChainingIterator_next_vertex_get(BPy_ChainingIterator *self, void *UNUSED(closure)) +static PyObject *ChainingIterator_next_vertex_get(BPy_ChainingIterator *self, + void *UNUSED(closure)) { - ViewVertex *v = self->c_it->getVertex(); - if (v) - return Any_BPy_ViewVertex_from_ViewVertex(*v); + ViewVertex *v = self->c_it->getVertex(); + if (v) + return Any_BPy_ViewVertex_from_ViewVertex(*v); - Py_RETURN_NONE; + Py_RETURN_NONE; } PyDoc_STRVAR(ChainingIterator_is_incrementing_doc, -"True if the current iteration is an incrementation.\n" -"\n" -":type: bool"); + "True if the current iteration is an incrementation.\n" + "\n" + ":type: bool"); -static PyObject *ChainingIterator_is_incrementing_get(BPy_ChainingIterator *self, void *UNUSED(closure)) +static PyObject *ChainingIterator_is_incrementing_get(BPy_ChainingIterator *self, + void *UNUSED(closure)) { - return PyBool_from_bool(self->c_it->isIncrementing()); + return PyBool_from_bool(self->c_it->isIncrementing()); } static PyGetSetDef BPy_ChainingIterator_getseters[] = { - {(char *)"object", (getter)ChainingIterator_object_get, (setter)NULL, (char *)ChainingIterator_object_doc, NULL}, - {(char *)"next_vertex", (getter)ChainingIterator_next_vertex_get, (setter)NULL, - (char *)ChainingIterator_next_vertex_doc, NULL}, - {(char *)"is_incrementing", (getter)ChainingIterator_is_incrementing_get, (setter)NULL, - (char *)ChainingIterator_is_incrementing_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"object", + (getter)ChainingIterator_object_get, + (setter)NULL, + (char *)ChainingIterator_object_doc, + NULL}, + {(char *)"next_vertex", + (getter)ChainingIterator_next_vertex_get, + (setter)NULL, + (char *)ChainingIterator_next_vertex_doc, + NULL}, + {(char *)"is_incrementing", + (getter)ChainingIterator_is_incrementing_get, + (setter)NULL, + (char *)ChainingIterator_is_incrementing_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_ChainingIterator type definition ------------------------------*/ PyTypeObject ChainingIterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ChainingIterator", /* tp_name */ - sizeof(BPy_ChainingIterator), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ChainingIterator_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_ChainingIterator_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_ChainingIterator_getseters, /* tp_getset */ - &ViewEdgeIterator_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ChainingIterator___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "ChainingIterator", /* tp_name */ + sizeof(BPy_ChainingIterator), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ChainingIterator_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_ChainingIterator_methods, /* tp_methods */ + 0, /* tp_members */ + BPy_ChainingIterator_getseters, /* tp_getset */ + &ViewEdgeIterator_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ChainingIterator___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.h index 898662c4f09..7e3be0bc6cd 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.h +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.h @@ -33,12 +33,13 @@ extern "C" { extern PyTypeObject ChainingIterator_Type; -#define BPy_ChainingIterator_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&ChainingIterator_Type)) +#define BPy_ChainingIterator_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&ChainingIterator_Type)) /*---------------------------Python BPy_ChainingIterator structure definition----------*/ typedef struct { - BPy_ViewEdgeIterator py_ve_it; - ChainingIterator *c_it; + BPy_ViewEdgeIterator py_ve_it; + ChainingIterator *c_it; } BPy_ChainingIterator; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp index 1caf0e9eb58..5b287433c13 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.cpp @@ -32,143 +32,153 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- PyDoc_STRVAR(CurvePointIterator_doc, -"Class hierarchy: :class:`Iterator` > :class:`CurvePointIterator`\n" -"\n" -"Class representing an iterator on a curve. Allows an iterating\n" -"outside initial vertices. A CurvePoint is instanciated and returned\n" -"through the .object attribute.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __init__(brother)\n" -"\n" -" Copy constructor.\n" -"\n" -" :arg brother: A CurvePointIterator object.\n" -" :type brother: :class:`CurvePointIterator`\n" -"\n" -".. method:: __init__(step=0.0)\n" -"\n" -" Builds a CurvePointIterator object.\n" -"\n" -" :arg step: A resampling resolution with which the curve is resampled.\n" -" If zero, no resampling is done (i.e., the iterator iterates over\n" -" initial vertices).\n" -" :type step: float"); + "Class hierarchy: :class:`Iterator` > :class:`CurvePointIterator`\n" + "\n" + "Class representing an iterator on a curve. Allows an iterating\n" + "outside initial vertices. A CurvePoint is instanciated and returned\n" + "through the .object attribute.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __init__(brother)\n" + "\n" + " Copy constructor.\n" + "\n" + " :arg brother: A CurvePointIterator object.\n" + " :type brother: :class:`CurvePointIterator`\n" + "\n" + ".. method:: __init__(step=0.0)\n" + "\n" + " Builds a CurvePointIterator object.\n" + "\n" + " :arg step: A resampling resolution with which the curve is resampled.\n" + " If zero, no resampling is done (i.e., the iterator iterates over\n" + " initial vertices).\n" + " :type step: float"); static int CurvePointIterator_init(BPy_CurvePointIterator *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"step", NULL}; - PyObject *brother = 0; - float step; - - if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &CurvePointIterator_Type, &brother)) { - if (!brother) - self->cp_it = new CurveInternal::CurvePointIterator(); - 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); - } - else { - PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); - return -1; - } - self->py_it.it = self->cp_it; - return 0; + static const char *kwlist_1[] = {"brother", NULL}; + static const char *kwlist_2[] = {"step", NULL}; + PyObject *brother = 0; + float step; + + if (PyArg_ParseTupleAndKeywords( + args, kwds, "|O!", (char **)kwlist_1, &CurvePointIterator_Type, &brother)) { + if (!brother) + self->cp_it = new CurveInternal::CurvePointIterator(); + 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); + } + else { + PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); + return -1; + } + self->py_it.it = self->cp_it; + return 0; } /*----------------------CurvePointIterator get/setters ----------------------------*/ PyDoc_STRVAR(CurvePointIterator_object_doc, -"The CurvePoint object currently pointed by this iterator.\n" -"\n" -":type: :class:`CurvePoint`"); + "The CurvePoint object currently pointed by this iterator.\n" + "\n" + ":type: :class:`CurvePoint`"); static PyObject *CurvePointIterator_object_get(BPy_CurvePointIterator *self, void *UNUSED(closure)) { - if (self->cp_it->isEnd()) { - PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); - return NULL; - } - return BPy_CurvePoint_from_CurvePoint(self->cp_it->operator*()); + if (self->cp_it->isEnd()) { + PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); + return NULL; + } + return BPy_CurvePoint_from_CurvePoint(self->cp_it->operator*()); } PyDoc_STRVAR(CurvePointIterator_t_doc, -"The curvilinear abscissa of the current point.\n" -"\n" -":type: float"); + "The curvilinear abscissa of the current point.\n" + "\n" + ":type: float"); static PyObject *CurvePointIterator_t_get(BPy_CurvePointIterator *self, void *UNUSED(closure)) { - return PyFloat_FromDouble(self->cp_it->t()); + return PyFloat_FromDouble(self->cp_it->t()); } PyDoc_STRVAR(CurvePointIterator_u_doc, -"The point parameter at the current point in the stroke (0 <= u <= 1).\n" -"\n" -":type: float"); + "The point parameter at the current point in the stroke (0 <= u <= 1).\n" + "\n" + ":type: float"); static PyObject *CurvePointIterator_u_get(BPy_CurvePointIterator *self, void *UNUSED(closure)) { - return PyFloat_FromDouble(self->cp_it->u()); + return PyFloat_FromDouble(self->cp_it->u()); } static PyGetSetDef BPy_CurvePointIterator_getseters[] = { - {(char *)"object", (getter)CurvePointIterator_object_get, (setter)NULL, - (char *)CurvePointIterator_object_doc, NULL}, - {(char *)"t", (getter)CurvePointIterator_t_get, (setter)NULL, (char *)CurvePointIterator_t_doc, NULL}, - {(char *)"u", (getter)CurvePointIterator_u_get, (setter)NULL, (char *)CurvePointIterator_u_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"object", + (getter)CurvePointIterator_object_get, + (setter)NULL, + (char *)CurvePointIterator_object_doc, + NULL}, + {(char *)"t", + (getter)CurvePointIterator_t_get, + (setter)NULL, + (char *)CurvePointIterator_t_doc, + NULL}, + {(char *)"u", + (getter)CurvePointIterator_u_get, + (setter)NULL, + (char *)CurvePointIterator_u_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_CurvePointIterator type definition ------------------------------*/ PyTypeObject CurvePointIterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "CurvePointIterator", /* tp_name */ - sizeof(BPy_CurvePointIterator), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - CurvePointIterator_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_CurvePointIterator_getseters, /* tp_getset */ - &Iterator_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)CurvePointIterator_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "CurvePointIterator", /* tp_name */ + sizeof(BPy_CurvePointIterator), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + CurvePointIterator_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + BPy_CurvePointIterator_getseters, /* tp_getset */ + &Iterator_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)CurvePointIterator_init, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.h index 41a3007d12c..aa84b1020ce 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.h +++ b/source/blender/freestyle/intern/python/Iterator/BPy_CurvePointIterator.h @@ -33,12 +33,13 @@ extern "C" { extern PyTypeObject CurvePointIterator_Type; -#define BPy_CurvePointIterator_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&CurvePointIterator_Type)) +#define BPy_CurvePointIterator_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&CurvePointIterator_Type)) /*---------------------------Python BPy_CurvePointIterator structure definition----------*/ typedef struct { - BPy_Iterator py_it; - CurveInternal::CurvePointIterator *cp_it; + BPy_Iterator py_it; + CurveInternal::CurvePointIterator *cp_it; } BPy_CurvePointIterator; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp index 6e3606c0041..6218541df9b 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.cpp @@ -32,210 +32,227 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- PyDoc_STRVAR(Interface0DIterator_doc, -"Class hierarchy: :class:`Iterator` > :class:`Interface0DIterator`\n" -"\n" -"Class defining an iterator over Interface0D elements. An instance of\n" -"this iterator is always obtained from a 1D element.\n" -"\n" -".. method:: __init__(brother)\n" -"\n" -" Copy constructor.\n" -"\n" -" :arg brother: An Interface0DIterator object.\n" -" :type brother: :class:`Interface0DIterator`\n" -"\n" -".. method:: __init__(it)\n" -"\n" -" Construct a nested Interface0DIterator that can be the argument of\n" -" a Function0D.\n" -"\n" -" :arg it: An iterator object to be nested.\n" -" :type it: :class:`SVertexIterator`, :class:`CurvePointIterator`, or\n" -" :class:`StrokeVertexIterator`"); + "Class hierarchy: :class:`Iterator` > :class:`Interface0DIterator`\n" + "\n" + "Class defining an iterator over Interface0D elements. An instance of\n" + "this iterator is always obtained from a 1D element.\n" + "\n" + ".. method:: __init__(brother)\n" + "\n" + " Copy constructor.\n" + "\n" + " :arg brother: An Interface0DIterator object.\n" + " :type brother: :class:`Interface0DIterator`\n" + "\n" + ".. method:: __init__(it)\n" + "\n" + " Construct a nested Interface0DIterator that can be the argument of\n" + " a Function0D.\n" + "\n" + " :arg it: An iterator object to be nested.\n" + " :type it: :class:`SVertexIterator`, :class:`CurvePointIterator`, or\n" + " :class:`StrokeVertexIterator`"); static int convert_nested_it(PyObject *obj, void *v) { - if (!obj || !BPy_Iterator_Check(obj)) - return 0; - Interface0DIteratorNested *nested_it = dynamic_cast(((BPy_Iterator *)obj)->it); - if (!nested_it) - return 0; - *((Interface0DIteratorNested **)v) = nested_it; - return 1; + if (!obj || !BPy_Iterator_Check(obj)) + return 0; + Interface0DIteratorNested *nested_it = dynamic_cast( + ((BPy_Iterator *)obj)->it); + if (!nested_it) + return 0; + *((Interface0DIteratorNested **)v) = nested_it; + return 1; } static int Interface0DIterator_init(BPy_Interface0DIterator *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"it", NULL}; - static const char *kwlist_2[] = {"inter", NULL}; - static const char *kwlist_3[] = {"brother", NULL}; - Interface0DIteratorNested *nested_it; - PyObject *brother, *inter; - - if (PyArg_ParseTupleAndKeywords(args, kwds, "O&", (char **)kwlist_1, convert_nested_it, &nested_it)) { - self->if0D_it = new Interface0DIterator(nested_it->copy()); - self->at_start = true; - self->reversed = false; - } - else if (PyErr_Clear(), - PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist_2, &Interface1D_Type, &inter)) - { - self->if0D_it = new Interface0DIterator(((BPy_Interface1D *)inter)->if1D->verticesBegin()); - self->at_start = true; - self->reversed = false; - } - else if (PyErr_Clear(), - PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist_3, &Interface0DIterator_Type, &brother)) - { - self->if0D_it = new Interface0DIterator(*(((BPy_Interface0DIterator *)brother)->if0D_it)); - self->at_start = ((BPy_Interface0DIterator *)brother)->at_start; - self->reversed = ((BPy_Interface0DIterator *)brother)->reversed; - } - else { - PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); - return -1; - } - self->py_it.it = self->if0D_it; - return 0; + static const char *kwlist_1[] = {"it", NULL}; + static const char *kwlist_2[] = {"inter", NULL}; + static const char *kwlist_3[] = {"brother", NULL}; + Interface0DIteratorNested *nested_it; + PyObject *brother, *inter; + + if (PyArg_ParseTupleAndKeywords( + args, kwds, "O&", (char **)kwlist_1, convert_nested_it, &nested_it)) { + self->if0D_it = new Interface0DIterator(nested_it->copy()); + self->at_start = true; + self->reversed = false; + } + else if (PyErr_Clear(), + PyArg_ParseTupleAndKeywords( + args, kwds, "O!", (char **)kwlist_2, &Interface1D_Type, &inter)) { + self->if0D_it = new Interface0DIterator(((BPy_Interface1D *)inter)->if1D->verticesBegin()); + self->at_start = true; + self->reversed = false; + } + else if (PyErr_Clear(), + PyArg_ParseTupleAndKeywords( + args, kwds, "O!", (char **)kwlist_3, &Interface0DIterator_Type, &brother)) { + self->if0D_it = new Interface0DIterator(*(((BPy_Interface0DIterator *)brother)->if0D_it)); + self->at_start = ((BPy_Interface0DIterator *)brother)->at_start; + self->reversed = ((BPy_Interface0DIterator *)brother)->reversed; + } + else { + PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); + return -1; + } + self->py_it.it = self->if0D_it; + return 0; } static PyObject *Interface0DIterator_iter(BPy_Interface0DIterator *self) { - Py_INCREF(self); - self->at_start = true; - return (PyObject *) self; + Py_INCREF(self); + self->at_start = true; + return (PyObject *)self; } static PyObject *Interface0DIterator_iternext(BPy_Interface0DIterator *self) { - if (self->reversed) { - if (self->if0D_it->isBegin()) { - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } - self->if0D_it->decrement(); - } - else { - if (self->if0D_it->isEnd()) { - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } - else if (self->at_start) { - self->at_start = false; - } - else if (self->if0D_it->atLast()) { - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } - else { - self->if0D_it->increment(); - } - } - Interface0D *if0D = self->if0D_it->operator->(); - return Any_BPy_Interface0D_from_Interface0D(*if0D); + if (self->reversed) { + if (self->if0D_it->isBegin()) { + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } + self->if0D_it->decrement(); + } + else { + if (self->if0D_it->isEnd()) { + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } + else if (self->at_start) { + self->at_start = false; + } + else if (self->if0D_it->atLast()) { + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } + else { + self->if0D_it->increment(); + } + } + Interface0D *if0D = self->if0D_it->operator->(); + return Any_BPy_Interface0D_from_Interface0D(*if0D); } /*----------------------Interface0DIterator get/setters ----------------------------*/ PyDoc_STRVAR(Interface0DIterator_object_doc, -"The 0D object currently pointed to by this iterator. Note that the object\n" -"may be an instance of an Interface0D subclass. For example if the iterator\n" -"has been created from the `vertices_begin()` method of the :class:`Stroke`\n" -"class, the .object property refers to a :class:`StrokeVertex` object.\n" -"\n" -":type: :class:`Interface0D` or one of its subclasses."); - -static PyObject *Interface0DIterator_object_get(BPy_Interface0DIterator *self, void *UNUSED(closure)) + "The 0D object currently pointed to by this iterator. Note that the object\n" + "may be an instance of an Interface0D subclass. For example if the iterator\n" + "has been created from the `vertices_begin()` method of the :class:`Stroke`\n" + "class, the .object property refers to a :class:`StrokeVertex` object.\n" + "\n" + ":type: :class:`Interface0D` or one of its subclasses."); + +static PyObject *Interface0DIterator_object_get(BPy_Interface0DIterator *self, + void *UNUSED(closure)) { - if (self->if0D_it->isEnd()) { - PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); - return NULL; - } - return Any_BPy_Interface0D_from_Interface0D(self->if0D_it->operator*()); + if (self->if0D_it->isEnd()) { + PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); + return NULL; + } + return Any_BPy_Interface0D_from_Interface0D(self->if0D_it->operator*()); } PyDoc_STRVAR(Interface0DIterator_t_doc, -"The curvilinear abscissa of the current point.\n" -"\n" -":type: float"); + "The curvilinear abscissa of the current point.\n" + "\n" + ":type: float"); static PyObject *Interface0DIterator_t_get(BPy_Interface0DIterator *self, void *UNUSED(closure)) { - return PyFloat_FromDouble(self->if0D_it->t()); + return PyFloat_FromDouble(self->if0D_it->t()); } PyDoc_STRVAR(Interface0DIterator_u_doc, -"The point parameter at the current point in the 1D element (0 <= u <= 1).\n" -"\n" -":type: float"); + "The point parameter at the current point in the 1D element (0 <= u <= 1).\n" + "\n" + ":type: float"); static PyObject *Interface0DIterator_u_get(BPy_Interface0DIterator *self, void *UNUSED(closure)) { - return PyFloat_FromDouble(self->if0D_it->u()); + return PyFloat_FromDouble(self->if0D_it->u()); } PyDoc_STRVAR(Interface0DIterator_at_last_doc, -"True if the interator points to the last valid element.\n" -"For its counterpart (pointing to the first valid element), use it.is_begin.\n" -"\n" -":type: bool"); + "True if the interator points to the last valid element.\n" + "For its counterpart (pointing to the first valid element), use it.is_begin.\n" + "\n" + ":type: bool"); -static PyObject *Interface0DIterator_at_last_get(BPy_Interface0DIterator *self, void *UNUSED(closure)) +static PyObject *Interface0DIterator_at_last_get(BPy_Interface0DIterator *self, + void *UNUSED(closure)) { - return PyBool_from_bool(self->if0D_it->atLast()); + return PyBool_from_bool(self->if0D_it->atLast()); } static PyGetSetDef BPy_Interface0DIterator_getseters[] = { - {(char *)"object", (getter)Interface0DIterator_object_get, (setter)NULL, - (char *)Interface0DIterator_object_doc, NULL}, - {(char *)"t", (getter)Interface0DIterator_t_get, (setter)NULL, (char *)Interface0DIterator_t_doc, NULL}, - {(char *)"u", (getter)Interface0DIterator_u_get, (setter)NULL, (char *)Interface0DIterator_u_doc, NULL}, - {(char *)"at_last", (getter)Interface0DIterator_at_last_get, (setter)NULL, - (char *)Interface0DIterator_at_last_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"object", + (getter)Interface0DIterator_object_get, + (setter)NULL, + (char *)Interface0DIterator_object_doc, + NULL}, + {(char *)"t", + (getter)Interface0DIterator_t_get, + (setter)NULL, + (char *)Interface0DIterator_t_doc, + NULL}, + {(char *)"u", + (getter)Interface0DIterator_u_get, + (setter)NULL, + (char *)Interface0DIterator_u_doc, + NULL}, + {(char *)"at_last", + (getter)Interface0DIterator_at_last_get, + (setter)NULL, + (char *)Interface0DIterator_at_last_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_Interface0DIterator type definition ------------------------------*/ PyTypeObject Interface0DIterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "Interface0DIterator", /* tp_name */ - sizeof(BPy_Interface0DIterator), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Interface0DIterator_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - (getiterfunc)Interface0DIterator_iter, /* tp_iter */ - (iternextfunc)Interface0DIterator_iternext, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_Interface0DIterator_getseters, /* tp_getset */ - &Iterator_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Interface0DIterator_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "Interface0DIterator", /* tp_name */ + sizeof(BPy_Interface0DIterator), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Interface0DIterator_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + (getiterfunc)Interface0DIterator_iter, /* tp_iter */ + (iternextfunc)Interface0DIterator_iternext, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + BPy_Interface0DIterator_getseters, /* tp_getset */ + &Iterator_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Interface0DIterator_init, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.h index 7379ec5112d..3695cda6c76 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.h +++ b/source/blender/freestyle/intern/python/Iterator/BPy_Interface0DIterator.h @@ -33,14 +33,15 @@ extern "C" { extern PyTypeObject Interface0DIterator_Type; -#define BPy_Interface0DIterator_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&Interface0DIterator_Type)) +#define BPy_Interface0DIterator_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&Interface0DIterator_Type)) /*---------------------------Python BPy_Interface0DIterator structure definition----------*/ typedef struct { - BPy_Iterator py_it; - Interface0DIterator *if0D_it; - bool reversed; - bool at_start; + BPy_Iterator py_it; + Interface0DIterator *if0D_it; + bool reversed; + bool at_start; } BPy_Interface0DIterator; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp index ef8e1135139..2a860976d7f 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.cpp @@ -33,162 +33,179 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- PyDoc_STRVAR(SVertexIterator_doc, -"Class hierarchy: :class:`Iterator` > :class:`SVertexIterator`\n" -"\n" -"Class representing an iterator over :class:`SVertex` of a\n" -":class:`ViewEdge`. An instance of an SVertexIterator can be obtained\n" -"from a ViewEdge by calling verticesBegin() or verticesEnd().\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __init__(brother)\n" -"\n" -" Copy constructor.\n" -"\n" -" :arg brother: An SVertexIterator object.\n" -" :type brother: :class:`SVertexIterator`\n" -"\n" -".. method:: __init__(vertex, begin, previous_edge, next_edge, t)\n" -"\n" -" Build an SVertexIterator that starts iteration from an SVertex\n" -" object v.\n" -"\n" -" :arg vertex: The SVertex from which the iterator starts iteration.\n" -" :type vertex: :class:`SVertex`\n" -" :arg begin: The first SVertex of a ViewEdge.\n" -" :type begin: :class:`SVertex`\n" -" :arg previous_edge: The previous FEdge coming to vertex.\n" -" :type previous_edge: :class:`FEdge`\n" -" :arg next_edge: The next FEdge going out from vertex.\n" -" :type next_edge: :class:`FEdge`\n" -" :arg t: The curvilinear abscissa at vertex.\n" -" :type t: float"); + "Class hierarchy: :class:`Iterator` > :class:`SVertexIterator`\n" + "\n" + "Class representing an iterator over :class:`SVertex` of a\n" + ":class:`ViewEdge`. An instance of an SVertexIterator can be obtained\n" + "from a ViewEdge by calling verticesBegin() or verticesEnd().\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __init__(brother)\n" + "\n" + " Copy constructor.\n" + "\n" + " :arg brother: An SVertexIterator object.\n" + " :type brother: :class:`SVertexIterator`\n" + "\n" + ".. method:: __init__(vertex, begin, previous_edge, next_edge, t)\n" + "\n" + " Build an SVertexIterator that starts iteration from an SVertex\n" + " object v.\n" + "\n" + " :arg vertex: The SVertex from which the iterator starts iteration.\n" + " :type vertex: :class:`SVertex`\n" + " :arg begin: The first SVertex of a ViewEdge.\n" + " :type begin: :class:`SVertex`\n" + " :arg previous_edge: The previous FEdge coming to vertex.\n" + " :type previous_edge: :class:`FEdge`\n" + " :arg next_edge: The next FEdge going out from vertex.\n" + " :type next_edge: :class:`FEdge`\n" + " :arg t: The curvilinear abscissa at vertex.\n" + " :type t: float"); static int SVertexIterator_init(BPy_SVertexIterator *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"vertex", "begin", "previous_edge", "next_edge", "t", NULL}; - PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0, *obj4 = 0; - float t; - - if (PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_1, &SVertexIterator_Type, &obj1)) { - if (!obj1) - self->sv_it = new ViewEdgeInternal::SVertexIterator(); - else - self->sv_it = new ViewEdgeInternal::SVertexIterator(*(((BPy_SVertexIterator *)obj1)->sv_it)); - } - else if (PyErr_Clear(), - PyArg_ParseTupleAndKeywords(args, kwds, "O!O!O!O!f", (char **)kwlist_2, - &SVertex_Type, &obj1, - &SVertex_Type, &obj2, - &FEdge_Type, &obj3, - &FEdge_Type, &obj4, - &t)) - { - self->sv_it = new ViewEdgeInternal::SVertexIterator( - ((BPy_SVertex *)obj1)->sv, - ((BPy_SVertex *)obj2)->sv, - ((BPy_FEdge *)obj3)->fe, - ((BPy_FEdge *)obj4)->fe, - t); - } - else { - PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); - return -1; - } - self->py_it.it = self->sv_it; - return 0; + static const char *kwlist_1[] = {"brother", NULL}; + static const char *kwlist_2[] = {"vertex", "begin", "previous_edge", "next_edge", "t", NULL}; + PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0, *obj4 = 0; + float t; + + if (PyArg_ParseTupleAndKeywords( + args, kwds, "|O!", (char **)kwlist_1, &SVertexIterator_Type, &obj1)) { + if (!obj1) + self->sv_it = new ViewEdgeInternal::SVertexIterator(); + else + self->sv_it = new ViewEdgeInternal::SVertexIterator(*(((BPy_SVertexIterator *)obj1)->sv_it)); + } + else if (PyErr_Clear(), + PyArg_ParseTupleAndKeywords(args, + kwds, + "O!O!O!O!f", + (char **)kwlist_2, + &SVertex_Type, + &obj1, + &SVertex_Type, + &obj2, + &FEdge_Type, + &obj3, + &FEdge_Type, + &obj4, + &t)) { + self->sv_it = new ViewEdgeInternal::SVertexIterator(((BPy_SVertex *)obj1)->sv, + ((BPy_SVertex *)obj2)->sv, + ((BPy_FEdge *)obj3)->fe, + ((BPy_FEdge *)obj4)->fe, + t); + } + else { + PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); + return -1; + } + self->py_it.it = self->sv_it; + return 0; } /*----------------------SVertexIterator get/setters ----------------------------*/ PyDoc_STRVAR(SVertexIterator_object_doc, -"The SVertex object currently pointed by this iterator.\n" -"\n" -":type: :class:`SVertex`"); + "The SVertex object currently pointed by this iterator.\n" + "\n" + ":type: :class:`SVertex`"); static PyObject *SVertexIterator_object_get(BPy_SVertexIterator *self, void *UNUSED(closure)) { - if (self->sv_it->isEnd()) { - PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); - return NULL; - } - SVertex *sv = self->sv_it->operator->(); - if (sv) - return BPy_SVertex_from_SVertex(*sv); - Py_RETURN_NONE; + if (self->sv_it->isEnd()) { + PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); + return NULL; + } + SVertex *sv = self->sv_it->operator->(); + if (sv) + return BPy_SVertex_from_SVertex(*sv); + Py_RETURN_NONE; } PyDoc_STRVAR(SVertexIterator_t_doc, -"The curvilinear abscissa of the current point.\n" -"\n" -":type: float"); + "The curvilinear abscissa of the current point.\n" + "\n" + ":type: float"); static PyObject *SVertexIterator_t_get(BPy_SVertexIterator *self, void *UNUSED(closure)) { - return PyFloat_FromDouble(self->sv_it->t()); + return PyFloat_FromDouble(self->sv_it->t()); } PyDoc_STRVAR(SVertexIterator_u_doc, -"The point parameter at the current point in the 1D element (0 <= u <= 1).\n" -"\n" -":type: float"); + "The point parameter at the current point in the 1D element (0 <= u <= 1).\n" + "\n" + ":type: float"); static PyObject *SVertexIterator_u_get(BPy_SVertexIterator *self, void *UNUSED(closure)) { - return PyFloat_FromDouble(self->sv_it->u()); + return PyFloat_FromDouble(self->sv_it->u()); } static PyGetSetDef BPy_SVertexIterator_getseters[] = { - {(char *)"object", (getter)SVertexIterator_object_get, (setter)NULL, (char *)SVertexIterator_object_doc, NULL}, - {(char *)"t", (getter)SVertexIterator_t_get, (setter)NULL, (char *)SVertexIterator_t_doc, NULL}, - {(char *)"u", (getter)SVertexIterator_u_get, (setter)NULL, (char *)SVertexIterator_u_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"object", + (getter)SVertexIterator_object_get, + (setter)NULL, + (char *)SVertexIterator_object_doc, + NULL}, + {(char *)"t", + (getter)SVertexIterator_t_get, + (setter)NULL, + (char *)SVertexIterator_t_doc, + NULL}, + {(char *)"u", + (getter)SVertexIterator_u_get, + (setter)NULL, + (char *)SVertexIterator_u_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_SVertexIterator type definition ------------------------------*/ PyTypeObject SVertexIterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SVertexIterator", /* tp_name */ - sizeof(BPy_SVertexIterator), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - SVertexIterator_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_SVertexIterator_getseters, /* tp_getset */ - &Iterator_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)SVertexIterator_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "SVertexIterator", /* tp_name */ + sizeof(BPy_SVertexIterator), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + SVertexIterator_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + BPy_SVertexIterator_getseters, /* tp_getset */ + &Iterator_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)SVertexIterator_init, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.h index 43e67af1183..2a3bfa6baf9 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.h +++ b/source/blender/freestyle/intern/python/Iterator/BPy_SVertexIterator.h @@ -33,12 +33,13 @@ extern "C" { extern PyTypeObject SVertexIterator_Type; -#define BPy_SVertexIterator_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&SVertexIterator_Type)) +#define BPy_SVertexIterator_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&SVertexIterator_Type)) /*---------------------------Python BPy_SVertexIterator structure definition----------*/ typedef struct { - BPy_Iterator py_it; - ViewEdgeInternal::SVertexIterator *sv_it; + BPy_Iterator py_it; + ViewEdgeInternal::SVertexIterator *sv_it; } BPy_SVertexIterator; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp index f39f95fda2d..5727ac2e461 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.cpp @@ -33,271 +33,298 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- PyDoc_STRVAR(StrokeVertexIterator_doc, -"Class hierarchy: :class:`Iterator` > :class:`StrokeVertexIterator`\n" -"\n" -"Class defining an iterator designed to iterate over the\n" -":class:`StrokeVertex` of a :class:`Stroke`. An instance of a\n" -"StrokeVertexIterator can be obtained from a Stroke by calling\n" -"iter(), stroke_vertices_begin() or stroke_vertices_begin(). It is iterating\n" -"over the same vertices as an :class:`Interface0DIterator`. The difference\n" -"resides in the object access: an Interface0DIterator only allows\n" -"access to an Interface0D while one might need to access the\n" -"specialized StrokeVertex type. In this case, one should use a\n" -"StrokeVertexIterator. To call functions of the UnaryFuntion0D type,\n" -"a StrokeVertexIterator can be converted to an Interface0DIterator by\n" -"by calling Interface0DIterator(it).\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __init__(brother)\n" -"\n" -" Copy constructor.\n" -"\n" -" :arg brother: A StrokeVertexIterator object.\n" -" :type brother: :class:`StrokeVertexIterator`"); - -static int StrokeVertexIterator_init(BPy_StrokeVertexIterator *self, PyObject *args, PyObject *kwds) + "Class hierarchy: :class:`Iterator` > :class:`StrokeVertexIterator`\n" + "\n" + "Class defining an iterator designed to iterate over the\n" + ":class:`StrokeVertex` of a :class:`Stroke`. An instance of a\n" + "StrokeVertexIterator can be obtained from a Stroke by calling\n" + "iter(), stroke_vertices_begin() or stroke_vertices_begin(). It is iterating\n" + "over the same vertices as an :class:`Interface0DIterator`. The difference\n" + "resides in the object access: an Interface0DIterator only allows\n" + "access to an Interface0D while one might need to access the\n" + "specialized StrokeVertex type. In this case, one should use a\n" + "StrokeVertexIterator. To call functions of the UnaryFuntion0D type,\n" + "a StrokeVertexIterator can be converted to an Interface0DIterator by\n" + "by calling Interface0DIterator(it).\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __init__(brother)\n" + "\n" + " Copy constructor.\n" + "\n" + " :arg brother: A StrokeVertexIterator object.\n" + " :type brother: :class:`StrokeVertexIterator`"); + +static int StrokeVertexIterator_init(BPy_StrokeVertexIterator *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"stroke", NULL}; - PyObject *brother = 0, *stroke = 0; - - if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist_1, &StrokeVertexIterator_Type, &brother)) { - self->sv_it = new StrokeInternal::StrokeVertexIterator(*(((BPy_StrokeVertexIterator *)brother)->sv_it)); - self->reversed = ((BPy_StrokeVertexIterator *)brother)->reversed; - self->at_start = ((BPy_StrokeVertexIterator *)brother)->at_start; - } - - else if (PyErr_Clear(), - PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist_2, &Stroke_Type, &stroke)) - { - if (!stroke) - self->sv_it = new StrokeInternal::StrokeVertexIterator(); - else - self->sv_it = new StrokeInternal::StrokeVertexIterator(((BPy_Stroke *)stroke)->s->strokeVerticesBegin()); - self->reversed = false; - self->at_start = true; - } - else { - PyErr_SetString(PyExc_TypeError, "argument 1 must be StrokeVertexIterator or Stroke"); - return -1; - } - self->py_it.it = self->sv_it; - return 0; + static const char *kwlist_1[] = {"brother", NULL}; + static const char *kwlist_2[] = {"stroke", NULL}; + PyObject *brother = 0, *stroke = 0; + + if (PyArg_ParseTupleAndKeywords( + args, kwds, "O!", (char **)kwlist_1, &StrokeVertexIterator_Type, &brother)) { + self->sv_it = new StrokeInternal::StrokeVertexIterator( + *(((BPy_StrokeVertexIterator *)brother)->sv_it)); + self->reversed = ((BPy_StrokeVertexIterator *)brother)->reversed; + self->at_start = ((BPy_StrokeVertexIterator *)brother)->at_start; + } + + else if (PyErr_Clear(), + PyArg_ParseTupleAndKeywords( + args, kwds, "|O!", (char **)kwlist_2, &Stroke_Type, &stroke)) { + if (!stroke) + self->sv_it = new StrokeInternal::StrokeVertexIterator(); + else + self->sv_it = new StrokeInternal::StrokeVertexIterator( + ((BPy_Stroke *)stroke)->s->strokeVerticesBegin()); + self->reversed = false; + self->at_start = true; + } + else { + PyErr_SetString(PyExc_TypeError, "argument 1 must be StrokeVertexIterator or Stroke"); + return -1; + } + self->py_it.it = self->sv_it; + return 0; } static PyObject *StrokeVertexIterator_iter(BPy_StrokeVertexIterator *self) { - Py_INCREF(self); - self->at_start = true; - return (PyObject *) self; + Py_INCREF(self); + self->at_start = true; + return (PyObject *)self; } static PyObject *StrokeVertexIterator_iternext(BPy_StrokeVertexIterator *self) { - /* Because Freestyle iterators for which it.isEnd() holds true have no valid object - * (they point to the past-the-end element and can't be dereferenced), we have to check - * iterators for validity. - * Additionally, the at_start attribute is used to keep Freestyle iterator objects - * and Python for loops in sync. */ - - if (self->reversed) { - if (self->sv_it->isBegin()) { - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } - self->sv_it->decrement(); - } - else { - /* If sv_it.isEnd() is true, the iterator can't be incremented. */ - if (self->sv_it->isEnd()) { - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } - /* If at the start of the iterator, only return the object - * and don't increment, to keep for-loops in sync */ - else if (self->at_start) { - self->at_start = false; - } - /* If sv_it.atLast() is true, the iterator is currently pointing to the final valid element. - * Incrementing it further would lead to a state that the iterator can't be dereferenced. */ - else if (self->sv_it->atLast()) { - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } - else { - self->sv_it->increment(); - } - } - StrokeVertex *sv = self->sv_it->operator->(); - return BPy_StrokeVertex_from_StrokeVertex(*sv); + /* Because Freestyle iterators for which it.isEnd() holds true have no valid object + * (they point to the past-the-end element and can't be dereferenced), we have to check + * iterators for validity. + * Additionally, the at_start attribute is used to keep Freestyle iterator objects + * and Python for loops in sync. */ + + if (self->reversed) { + if (self->sv_it->isBegin()) { + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } + self->sv_it->decrement(); + } + else { + /* If sv_it.isEnd() is true, the iterator can't be incremented. */ + if (self->sv_it->isEnd()) { + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } + /* If at the start of the iterator, only return the object + * and don't increment, to keep for-loops in sync */ + else if (self->at_start) { + self->at_start = false; + } + /* If sv_it.atLast() is true, the iterator is currently pointing to the final valid element. + * Incrementing it further would lead to a state that the iterator can't be dereferenced. */ + else if (self->sv_it->atLast()) { + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } + else { + self->sv_it->increment(); + } + } + StrokeVertex *sv = self->sv_it->operator->(); + return BPy_StrokeVertex_from_StrokeVertex(*sv); } /*----------------------StrokeVertexIterator methods ----------------------------*/ PyDoc_STRVAR(StrokeVertexIterator_incremented_doc, -".. method:: incremented()\n" -"\n" -" Returns a copy of an incremented StrokeVertexIterator.\n" -"\n" -" :return: A StrokeVertexIterator pointing the next StrokeVertex.\n" -" :rtype: :class:`StrokeVertexIterator`"); + ".. method:: incremented()\n" + "\n" + " Returns a copy of an incremented StrokeVertexIterator.\n" + "\n" + " :return: A StrokeVertexIterator pointing the next StrokeVertex.\n" + " :rtype: :class:`StrokeVertexIterator`"); static PyObject *StrokeVertexIterator_incremented(BPy_StrokeVertexIterator *self) { - if (self->sv_it->isEnd()) { - PyErr_SetString(PyExc_RuntimeError, "cannot increment any more"); - return NULL; - } - StrokeInternal::StrokeVertexIterator copy(*self->sv_it); - copy.increment(); - return BPy_StrokeVertexIterator_from_StrokeVertexIterator(copy, self->reversed); + if (self->sv_it->isEnd()) { + PyErr_SetString(PyExc_RuntimeError, "cannot increment any more"); + return NULL; + } + StrokeInternal::StrokeVertexIterator copy(*self->sv_it); + copy.increment(); + return BPy_StrokeVertexIterator_from_StrokeVertexIterator(copy, self->reversed); } PyDoc_STRVAR(StrokeVertexIterator_decremented_doc, -".. method:: decremented()\n" -"\n" -" Returns a copy of a decremented StrokeVertexIterator.\n" -"\n" -" :return: A StrokeVertexIterator pointing the previous StrokeVertex.\n" -" :rtype: :class:`StrokeVertexIterator`"); + ".. method:: decremented()\n" + "\n" + " Returns a copy of a decremented StrokeVertexIterator.\n" + "\n" + " :return: A StrokeVertexIterator pointing the previous StrokeVertex.\n" + " :rtype: :class:`StrokeVertexIterator`"); static PyObject *StrokeVertexIterator_decremented(BPy_StrokeVertexIterator *self) { - if (self->sv_it->isBegin()) { - PyErr_SetString(PyExc_RuntimeError, "cannot decrement any more"); - return NULL; - } - StrokeInternal::StrokeVertexIterator copy(*self->sv_it); - copy.decrement(); - return BPy_StrokeVertexIterator_from_StrokeVertexIterator(copy, self->reversed); + if (self->sv_it->isBegin()) { + PyErr_SetString(PyExc_RuntimeError, "cannot decrement any more"); + return NULL; + } + StrokeInternal::StrokeVertexIterator copy(*self->sv_it); + copy.decrement(); + return BPy_StrokeVertexIterator_from_StrokeVertexIterator(copy, self->reversed); } PyDoc_STRVAR(StrokeVertexIterator_reversed_doc, -".. method:: reversed()\n" -"\n" -" Returns a StrokeVertexIterator that traverses stroke vertices in the\n" -" reversed order.\n" -"\n" -" :return: A StrokeVertexIterator traversing stroke vertices backward.\n" -" :rtype: :class:`StrokeVertexIterator`"); + ".. method:: reversed()\n" + "\n" + " Returns a StrokeVertexIterator that traverses stroke vertices in the\n" + " reversed order.\n" + "\n" + " :return: A StrokeVertexIterator traversing stroke vertices backward.\n" + " :rtype: :class:`StrokeVertexIterator`"); static PyObject *StrokeVertexIterator_reversed(BPy_StrokeVertexIterator *self) { - return BPy_StrokeVertexIterator_from_StrokeVertexIterator(*self->sv_it, !self->reversed); + return BPy_StrokeVertexIterator_from_StrokeVertexIterator(*self->sv_it, !self->reversed); } static PyMethodDef BPy_StrokeVertexIterator_methods[] = { - {"incremented", (PyCFunction)StrokeVertexIterator_incremented, METH_NOARGS, StrokeVertexIterator_incremented_doc}, - {"decremented", (PyCFunction)StrokeVertexIterator_decremented, METH_NOARGS, StrokeVertexIterator_decremented_doc}, - {"reversed", (PyCFunction)StrokeVertexIterator_reversed, METH_NOARGS, StrokeVertexIterator_reversed_doc}, - {NULL, NULL, 0, NULL}, + {"incremented", + (PyCFunction)StrokeVertexIterator_incremented, + METH_NOARGS, + StrokeVertexIterator_incremented_doc}, + {"decremented", + (PyCFunction)StrokeVertexIterator_decremented, + METH_NOARGS, + StrokeVertexIterator_decremented_doc}, + {"reversed", + (PyCFunction)StrokeVertexIterator_reversed, + METH_NOARGS, + StrokeVertexIterator_reversed_doc}, + {NULL, NULL, 0, NULL}, }; /*----------------------StrokeVertexIterator get/setters ----------------------------*/ PyDoc_STRVAR(StrokeVertexIterator_object_doc, -"The StrokeVertex object currently pointed to by this iterator.\n" -"\n" -":type: :class:`StrokeVertex`"); + "The StrokeVertex object currently pointed to by this iterator.\n" + "\n" + ":type: :class:`StrokeVertex`"); -static PyObject *StrokeVertexIterator_object_get(BPy_StrokeVertexIterator *self, void *UNUSED(closure)) +static PyObject *StrokeVertexIterator_object_get(BPy_StrokeVertexIterator *self, + void *UNUSED(closure)) { - if (self->sv_it->isEnd()) { - PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); - return NULL; - } - StrokeVertex *sv = self->sv_it->operator->(); - if (sv) - return BPy_StrokeVertex_from_StrokeVertex(*sv); - Py_RETURN_NONE; + if (self->sv_it->isEnd()) { + PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); + return NULL; + } + StrokeVertex *sv = self->sv_it->operator->(); + if (sv) + return BPy_StrokeVertex_from_StrokeVertex(*sv); + Py_RETURN_NONE; } PyDoc_STRVAR(StrokeVertexIterator_t_doc, -"The curvilinear abscissa of the current point.\n" -"\n" -":type: float"); + "The curvilinear abscissa of the current point.\n" + "\n" + ":type: float"); static PyObject *StrokeVertexIterator_t_get(BPy_StrokeVertexIterator *self, void *UNUSED(closure)) { - return PyFloat_FromDouble(self->sv_it->t()); + return PyFloat_FromDouble(self->sv_it->t()); } PyDoc_STRVAR(StrokeVertexIterator_u_doc, -"The point parameter at the current point in the stroke (0 <= u <= 1).\n" -"\n" -":type: float"); + "The point parameter at the current point in the stroke (0 <= u <= 1).\n" + "\n" + ":type: float"); static PyObject *StrokeVertexIterator_u_get(BPy_StrokeVertexIterator *self, void *UNUSED(closure)) { - return PyFloat_FromDouble(self->sv_it->u()); + return PyFloat_FromDouble(self->sv_it->u()); } PyDoc_STRVAR(StrokeVertexIterator_at_last_doc, -"True if the interator points to the last valid element.\n" -"For its counterpart (pointing to the first valid element), use it.is_begin.\n" -"\n" -":type: bool"); + "True if the interator points to the last valid element.\n" + "For its counterpart (pointing to the first valid element), use it.is_begin.\n" + "\n" + ":type: bool"); static PyObject *StrokeVertexIterator_at_last_get(BPy_StrokeVertexIterator *self) { - return PyBool_from_bool(self->sv_it->atLast()); - + return PyBool_from_bool(self->sv_it->atLast()); } static PyGetSetDef BPy_StrokeVertexIterator_getseters[] = { - {(char *)"object", (getter)StrokeVertexIterator_object_get, (setter)NULL, - (char *)StrokeVertexIterator_object_doc, NULL}, - {(char *)"t", (getter)StrokeVertexIterator_t_get, (setter)NULL, (char *)StrokeVertexIterator_t_doc, NULL}, - {(char *)"u", (getter)StrokeVertexIterator_u_get, (setter)NULL, (char *)StrokeVertexIterator_u_doc, NULL}, - {(char *)"at_last", (getter)StrokeVertexIterator_at_last_get, (setter)NULL, - (char *)StrokeVertexIterator_at_last_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"object", + (getter)StrokeVertexIterator_object_get, + (setter)NULL, + (char *)StrokeVertexIterator_object_doc, + NULL}, + {(char *)"t", + (getter)StrokeVertexIterator_t_get, + (setter)NULL, + (char *)StrokeVertexIterator_t_doc, + NULL}, + {(char *)"u", + (getter)StrokeVertexIterator_u_get, + (setter)NULL, + (char *)StrokeVertexIterator_u_doc, + NULL}, + {(char *)"at_last", + (getter)StrokeVertexIterator_at_last_get, + (setter)NULL, + (char *)StrokeVertexIterator_at_last_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_StrokeVertexIterator type definition ------------------------------*/ PyTypeObject StrokeVertexIterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "StrokeVertexIterator", /* tp_name */ - sizeof(BPy_StrokeVertexIterator), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - StrokeVertexIterator_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - (getiterfunc)StrokeVertexIterator_iter, /* tp_iter */ - (iternextfunc)StrokeVertexIterator_iternext, /* tp_iternext */ - BPy_StrokeVertexIterator_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_StrokeVertexIterator_getseters, /* tp_getset */ - &Iterator_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)StrokeVertexIterator_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "StrokeVertexIterator", /* tp_name */ + sizeof(BPy_StrokeVertexIterator), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + StrokeVertexIterator_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + (getiterfunc)StrokeVertexIterator_iter, /* tp_iter */ + (iternextfunc)StrokeVertexIterator_iternext, /* tp_iternext */ + BPy_StrokeVertexIterator_methods, /* tp_methods */ + 0, /* tp_members */ + BPy_StrokeVertexIterator_getseters, /* tp_getset */ + &Iterator_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)StrokeVertexIterator_init, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.h index 22bdf3341c4..04bca16337d 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.h +++ b/source/blender/freestyle/intern/python/Iterator/BPy_StrokeVertexIterator.h @@ -33,15 +33,16 @@ extern "C" { extern PyTypeObject StrokeVertexIterator_Type; -#define BPy_StrokeVertexIterator_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&StrokeVertexIterator_Type)) +#define BPy_StrokeVertexIterator_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&StrokeVertexIterator_Type)) /*---------------------------Python BPy_StrokeVertexIterator structure definition----------*/ typedef struct { - BPy_Iterator py_it; - StrokeInternal::StrokeVertexIterator *sv_it; - bool reversed; - /* attribute to make next() work correctly */ - bool at_start; + BPy_Iterator py_it; + StrokeInternal::StrokeVertexIterator *sv_it; + bool reversed; + /* attribute to make next() work correctly */ + bool at_start; } BPy_StrokeVertexIterator; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp index efd0aafbc17..525df5dd89b 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.cpp @@ -32,224 +32,247 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- PyDoc_STRVAR(ViewEdgeIterator_doc, -"Class hierarchy: :class:`Iterator` > :class:`ViewEdgeIterator`\n" -"\n" -"Base class for iterators over ViewEdges of the :class:`ViewMap` Graph.\n" -"Basically the increment() operator of this class should be able to\n" -"take the decision of \"where\" (on which ViewEdge) to go when pointing\n" -"on a given ViewEdge.\n" -"\n" -".. method:: __init__(begin=None, orientation=True)\n" -"\n" -" Builds a ViewEdgeIterator from a starting ViewEdge and its\n" -" orientation.\n" -"\n" -" :arg begin: The ViewEdge from where to start the iteration.\n" -" :type begin: :class:`ViewEdge` or None\n" -" :arg orientation: If true, we'll look for the next ViewEdge among\n" -" the ViewEdges that surround the ending ViewVertex of begin. If\n" -" false, we'll search over the ViewEdges surrounding the ending\n" -" ViewVertex of begin.\n" -" :type orientation: bool\n" -"\n" -".. method:: __init__(brother)\n" -"\n" -" Copy constructor.\n" -"\n" -" :arg brother: A ViewEdgeIterator object.\n" -" :type brother: :class:`ViewEdgeIterator`"); + "Class hierarchy: :class:`Iterator` > :class:`ViewEdgeIterator`\n" + "\n" + "Base class for iterators over ViewEdges of the :class:`ViewMap` Graph.\n" + "Basically the increment() operator of this class should be able to\n" + "take the decision of \"where\" (on which ViewEdge) to go when pointing\n" + "on a given ViewEdge.\n" + "\n" + ".. method:: __init__(begin=None, orientation=True)\n" + "\n" + " Builds a ViewEdgeIterator from a starting ViewEdge and its\n" + " orientation.\n" + "\n" + " :arg begin: The ViewEdge from where to start the iteration.\n" + " :type begin: :class:`ViewEdge` or None\n" + " :arg orientation: If true, we'll look for the next ViewEdge among\n" + " the ViewEdges that surround the ending ViewVertex of begin. If\n" + " false, we'll search over the ViewEdges surrounding the ending\n" + " ViewVertex of begin.\n" + " :type orientation: bool\n" + "\n" + ".. method:: __init__(brother)\n" + "\n" + " Copy constructor.\n" + "\n" + " :arg brother: A ViewEdgeIterator object.\n" + " :type brother: :class:`ViewEdgeIterator`"); static int check_begin(PyObject *obj, void *v) { - if (obj != NULL && obj != Py_None && !BPy_ViewEdge_Check(obj)) - return 0; - *((PyObject **)v) = obj; - return 1; + if (obj != NULL && obj != Py_None && !BPy_ViewEdge_Check(obj)) + return 0; + *((PyObject **)v) = obj; + return 1; } static int ViewEdgeIterator_init(BPy_ViewEdgeIterator *self, PyObject *args, PyObject *kwds) { - static const char *kwlist_1[] = {"brother", NULL}; - static const char *kwlist_2[] = {"begin", "orientation", NULL}; - PyObject *obj1 = 0, *obj2 = 0; + static const char *kwlist_1[] = {"brother", NULL}; + static const char *kwlist_2[] = {"begin", "orientation", NULL}; + PyObject *obj1 = 0, *obj2 = 0; - if (PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist_1, &ViewEdgeIterator_Type, &obj1)) { - self->ve_it = new ViewEdgeInternal::ViewEdgeIterator(*(((BPy_ViewEdgeIterator *)obj1)->ve_it)); - } - else if (PyErr_Clear(), (obj1 = obj2 = 0), - PyArg_ParseTupleAndKeywords(args, kwds, "|O&O!", (char **)kwlist_2, - check_begin, &obj1, &PyBool_Type, &obj2)) - { - ViewEdge *begin = (!obj1 || obj1 == Py_None) ? NULL : ((BPy_ViewEdge *)obj1)->ve; - bool orientation = (!obj2) ? true : bool_from_PyBool(obj2); - self->ve_it = new ViewEdgeInternal::ViewEdgeIterator(begin, orientation); - } - else { - PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); - return -1; - } - self->py_it.it = self->ve_it; - return 0; + if (PyArg_ParseTupleAndKeywords( + args, kwds, "O!", (char **)kwlist_1, &ViewEdgeIterator_Type, &obj1)) { + self->ve_it = new ViewEdgeInternal::ViewEdgeIterator(*(((BPy_ViewEdgeIterator *)obj1)->ve_it)); + } + else if (PyErr_Clear(), + (obj1 = obj2 = 0), + PyArg_ParseTupleAndKeywords( + args, kwds, "|O&O!", (char **)kwlist_2, check_begin, &obj1, &PyBool_Type, &obj2)) { + ViewEdge *begin = (!obj1 || obj1 == Py_None) ? NULL : ((BPy_ViewEdge *)obj1)->ve; + bool orientation = (!obj2) ? true : bool_from_PyBool(obj2); + self->ve_it = new ViewEdgeInternal::ViewEdgeIterator(begin, orientation); + } + else { + PyErr_SetString(PyExc_TypeError, "invalid argument(s)"); + return -1; + } + self->py_it.it = self->ve_it; + return 0; } PyDoc_STRVAR(ViewEdgeIterator_change_orientation_doc, -".. method:: change_orientation()\n" -"\n" -" Changes the current orientation."); + ".. method:: change_orientation()\n" + "\n" + " Changes the current orientation."); static PyObject *ViewEdgeIterator_change_orientation(BPy_ViewEdgeIterator *self) { - self->ve_it->changeOrientation(); - Py_RETURN_NONE; + self->ve_it->changeOrientation(); + Py_RETURN_NONE; } static PyMethodDef BPy_ViewEdgeIterator_methods[] = { - {"change_orientation", (PyCFunction) ViewEdgeIterator_change_orientation, METH_NOARGS, - ViewEdgeIterator_change_orientation_doc}, - {NULL, NULL, 0, NULL}, + {"change_orientation", + (PyCFunction)ViewEdgeIterator_change_orientation, + METH_NOARGS, + ViewEdgeIterator_change_orientation_doc}, + {NULL, NULL, 0, NULL}, }; /*----------------------ViewEdgeIterator get/setters ----------------------------*/ PyDoc_STRVAR(ViewEdgeIterator_object_doc, -"The ViewEdge object currently pointed by this iterator.\n" -"\n" -":type: :class:`ViewEdge`"); + "The ViewEdge object currently pointed by this iterator.\n" + "\n" + ":type: :class:`ViewEdge`"); static PyObject *ViewEdgeIterator_object_get(BPy_ViewEdgeIterator *self, void *UNUSED(closure)) { - if (!self->ve_it->isEnd()) { - PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); - return NULL; - } - ViewEdge *ve = self->ve_it->operator*(); - if (ve) - return BPy_ViewEdge_from_ViewEdge(*ve); - Py_RETURN_NONE; + if (!self->ve_it->isEnd()) { + PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); + return NULL; + } + ViewEdge *ve = self->ve_it->operator*(); + if (ve) + return BPy_ViewEdge_from_ViewEdge(*ve); + Py_RETURN_NONE; } PyDoc_STRVAR(ViewEdgeIterator_current_edge_doc, -"The ViewEdge object currently pointed by this iterator.\n" -"\n" -":type: :class:`ViewEdge`"); + "The ViewEdge object currently pointed by this iterator.\n" + "\n" + ":type: :class:`ViewEdge`"); -static PyObject *ViewEdgeIterator_current_edge_get(BPy_ViewEdgeIterator *self, void *UNUSED(closure)) +static PyObject *ViewEdgeIterator_current_edge_get(BPy_ViewEdgeIterator *self, + void *UNUSED(closure)) { - ViewEdge *ve = self->ve_it->getCurrentEdge(); - if (ve) - return BPy_ViewEdge_from_ViewEdge(*ve); - Py_RETURN_NONE; + ViewEdge *ve = self->ve_it->getCurrentEdge(); + if (ve) + return BPy_ViewEdge_from_ViewEdge(*ve); + Py_RETURN_NONE; } -static int ViewEdgeIterator_current_edge_set(BPy_ViewEdgeIterator *self, PyObject *value, void *UNUSED(closure)) +static int ViewEdgeIterator_current_edge_set(BPy_ViewEdgeIterator *self, + PyObject *value, + void *UNUSED(closure)) { - if (!BPy_ViewEdge_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be a ViewEdge"); - return -1; - } - self->ve_it->setCurrentEdge(((BPy_ViewEdge *)value)->ve); - return 0; + if (!BPy_ViewEdge_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be a ViewEdge"); + return -1; + } + self->ve_it->setCurrentEdge(((BPy_ViewEdge *)value)->ve); + return 0; } PyDoc_STRVAR(ViewEdgeIterator_orientation_doc, -"The orientation of the pointed ViewEdge in the iteration.\n" -"If true, the iterator looks for the next ViewEdge among those ViewEdges\n" -"that surround the ending ViewVertex of the \"begin\" ViewEdge. If false,\n" -"the iterator searches over the ViewEdges surrounding the ending ViewVertex\n" -"of the \"begin\" ViewEdge.\n" -"\n" -":type: bool"); + "The orientation of the pointed ViewEdge in the iteration.\n" + "If true, the iterator looks for the next ViewEdge among those ViewEdges\n" + "that surround the ending ViewVertex of the \"begin\" ViewEdge. If false,\n" + "the iterator searches over the ViewEdges surrounding the ending ViewVertex\n" + "of the \"begin\" ViewEdge.\n" + "\n" + ":type: bool"); -static PyObject *ViewEdgeIterator_orientation_get(BPy_ViewEdgeIterator *self, void *UNUSED(closure)) +static PyObject *ViewEdgeIterator_orientation_get(BPy_ViewEdgeIterator *self, + void *UNUSED(closure)) { - return PyBool_from_bool(self->ve_it->getOrientation()); + return PyBool_from_bool(self->ve_it->getOrientation()); } -static int ViewEdgeIterator_orientation_set(BPy_ViewEdgeIterator *self, PyObject *value, void *UNUSED(closure)) +static int ViewEdgeIterator_orientation_set(BPy_ViewEdgeIterator *self, + PyObject *value, + void *UNUSED(closure)) { - if (!PyBool_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be a boolean"); - return -1; - } - self->ve_it->setOrientation(bool_from_PyBool(value)); - return 0; + if (!PyBool_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be a boolean"); + return -1; + } + self->ve_it->setOrientation(bool_from_PyBool(value)); + return 0; } PyDoc_STRVAR(ViewEdgeIterator_begin_doc, -"The first ViewEdge used for the iteration.\n" -"\n" -":type: :class:`ViewEdge`"); + "The first ViewEdge used for the iteration.\n" + "\n" + ":type: :class:`ViewEdge`"); static PyObject *ViewEdgeIterator_begin_get(BPy_ViewEdgeIterator *self, void *UNUSED(closure)) { - ViewEdge *ve = self->ve_it->getBegin(); - if (ve) - return BPy_ViewEdge_from_ViewEdge(*ve); - Py_RETURN_NONE; + ViewEdge *ve = self->ve_it->getBegin(); + if (ve) + return BPy_ViewEdge_from_ViewEdge(*ve); + Py_RETURN_NONE; } -static int ViewEdgeIterator_begin_set(BPy_ViewEdgeIterator *self, PyObject *value, void *UNUSED(closure)) +static int ViewEdgeIterator_begin_set(BPy_ViewEdgeIterator *self, + PyObject *value, + void *UNUSED(closure)) { - if (!BPy_ViewEdge_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be a ViewEdge"); - return -1; - } - self->ve_it->setBegin(((BPy_ViewEdge *)value)->ve); - return 0; + if (!BPy_ViewEdge_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be a ViewEdge"); + return -1; + } + self->ve_it->setBegin(((BPy_ViewEdge *)value)->ve); + return 0; } static PyGetSetDef BPy_ViewEdgeIterator_getseters[] = { - {(char *)"object", (getter)ViewEdgeIterator_object_get, (setter)NULL, (char *)ViewEdgeIterator_object_doc, NULL}, - {(char *)"current_edge", (getter)ViewEdgeIterator_current_edge_get, (setter)ViewEdgeIterator_current_edge_set, - (char *)ViewEdgeIterator_current_edge_doc, NULL}, - {(char *)"orientation", (getter)ViewEdgeIterator_orientation_get, (setter)ViewEdgeIterator_orientation_set, - (char *)ViewEdgeIterator_orientation_doc, NULL}, - {(char *)"begin", (getter)ViewEdgeIterator_begin_get, (setter)ViewEdgeIterator_begin_set, - (char *)ViewEdgeIterator_begin_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"object", + (getter)ViewEdgeIterator_object_get, + (setter)NULL, + (char *)ViewEdgeIterator_object_doc, + NULL}, + {(char *)"current_edge", + (getter)ViewEdgeIterator_current_edge_get, + (setter)ViewEdgeIterator_current_edge_set, + (char *)ViewEdgeIterator_current_edge_doc, + NULL}, + {(char *)"orientation", + (getter)ViewEdgeIterator_orientation_get, + (setter)ViewEdgeIterator_orientation_set, + (char *)ViewEdgeIterator_orientation_doc, + NULL}, + {(char *)"begin", + (getter)ViewEdgeIterator_begin_get, + (setter)ViewEdgeIterator_begin_set, + (char *)ViewEdgeIterator_begin_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_ViewEdgeIterator type definition ------------------------------*/ PyTypeObject ViewEdgeIterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ViewEdgeIterator", /* tp_name */ - sizeof(BPy_ViewEdgeIterator), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ViewEdgeIterator_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BPy_ViewEdgeIterator_methods, /* tp_methods */ - 0, /* tp_members */ - BPy_ViewEdgeIterator_getseters, /* tp_getset */ - &Iterator_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ViewEdgeIterator_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "ViewEdgeIterator", /* tp_name */ + sizeof(BPy_ViewEdgeIterator), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ViewEdgeIterator_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + BPy_ViewEdgeIterator_methods, /* tp_methods */ + 0, /* tp_members */ + BPy_ViewEdgeIterator_getseters, /* tp_getset */ + &Iterator_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ViewEdgeIterator_init, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.h index 83c1512e239..c9061d30e07 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.h +++ b/source/blender/freestyle/intern/python/Iterator/BPy_ViewEdgeIterator.h @@ -33,12 +33,13 @@ extern "C" { extern PyTypeObject ViewEdgeIterator_Type; -#define BPy_ViewEdgeIterator_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&ViewEdgeIterator_Type)) +#define BPy_ViewEdgeIterator_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&ViewEdgeIterator_Type)) /*---------------------------Python BPy_ViewEdgeIterator structure definition----------*/ typedef struct { - BPy_Iterator py_it; - ViewEdgeInternal::ViewEdgeIterator *ve_it; + BPy_Iterator py_it; + ViewEdgeInternal::ViewEdgeIterator *ve_it; } BPy_ViewEdgeIterator; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp index 4ef1eca4e0a..3cb114a0037 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp +++ b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.cpp @@ -31,145 +31,152 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- PyDoc_STRVAR(orientedViewEdgeIterator_doc, -"Class hierarchy: :class:`Iterator` > :class:`orientedViewEdgeIterator`\n" -"\n" -"Class representing an iterator over oriented ViewEdges around a\n" -":class:`ViewVertex`. This iterator allows a CCW iteration (in the image\n" -"plane). An instance of an orientedViewEdgeIterator can only be\n" -"obtained from a ViewVertex by calling edges_begin() or edges_end().\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __init__(iBrother)\n" -"\n" -" Copy constructor.\n" -"\n" -" :arg iBrother: An orientedViewEdgeIterator object.\n" -" :type iBrother: :class:`orientedViewEdgeIterator`"); - -static int orientedViewEdgeIterator_init(BPy_orientedViewEdgeIterator *self, PyObject *args, PyObject *kwds) + "Class hierarchy: :class:`Iterator` > :class:`orientedViewEdgeIterator`\n" + "\n" + "Class representing an iterator over oriented ViewEdges around a\n" + ":class:`ViewVertex`. This iterator allows a CCW iteration (in the image\n" + "plane). An instance of an orientedViewEdgeIterator can only be\n" + "obtained from a ViewVertex by calling edges_begin() or edges_end().\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __init__(iBrother)\n" + "\n" + " Copy constructor.\n" + "\n" + " :arg iBrother: An orientedViewEdgeIterator object.\n" + " :type iBrother: :class:`orientedViewEdgeIterator`"); + +static int orientedViewEdgeIterator_init(BPy_orientedViewEdgeIterator *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"brother", NULL}; - PyObject *brother = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &orientedViewEdgeIterator_Type, &brother)) - return -1; - if (!brother) { - self->ove_it = new ViewVertexInternal::orientedViewEdgeIterator(); - self->at_start = true; - self->reversed = false; - } - else { - self->ove_it = new ViewVertexInternal::orientedViewEdgeIterator(*(((BPy_orientedViewEdgeIterator *)brother)->ove_it)); - self->at_start = ((BPy_orientedViewEdgeIterator *)brother)->at_start; - self->reversed = ((BPy_orientedViewEdgeIterator *)brother)->reversed; - } - self->py_it.it = self->ove_it; - return 0; + static const char *kwlist[] = {"brother", NULL}; + PyObject *brother = 0; + + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "|O!", (char **)kwlist, &orientedViewEdgeIterator_Type, &brother)) + return -1; + if (!brother) { + self->ove_it = new ViewVertexInternal::orientedViewEdgeIterator(); + self->at_start = true; + self->reversed = false; + } + else { + self->ove_it = new ViewVertexInternal::orientedViewEdgeIterator( + *(((BPy_orientedViewEdgeIterator *)brother)->ove_it)); + self->at_start = ((BPy_orientedViewEdgeIterator *)brother)->at_start; + self->reversed = ((BPy_orientedViewEdgeIterator *)brother)->reversed; + } + self->py_it.it = self->ove_it; + return 0; } static PyObject *orientedViewEdgeIterator_iter(BPy_orientedViewEdgeIterator *self) { - Py_INCREF(self); - self->at_start = true; - return (PyObject *) self; + Py_INCREF(self); + self->at_start = true; + return (PyObject *)self; } static PyObject *orientedViewEdgeIterator_iternext(BPy_orientedViewEdgeIterator *self) { - if (self->reversed) { - if (self->ove_it->isBegin()) { - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } - self->ove_it->decrement(); - } - else { - if (self->ove_it->isEnd()) { - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } - if (self->at_start) - self->at_start = false; - else { - self->ove_it->increment(); - if (self->ove_it->isEnd()) { - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } - } - } - ViewVertex::directedViewEdge *dve = self->ove_it->operator->(); - return BPy_directedViewEdge_from_directedViewEdge(*dve); + if (self->reversed) { + if (self->ove_it->isBegin()) { + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } + self->ove_it->decrement(); + } + else { + if (self->ove_it->isEnd()) { + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } + if (self->at_start) + self->at_start = false; + else { + self->ove_it->increment(); + if (self->ove_it->isEnd()) { + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } + } + } + ViewVertex::directedViewEdge *dve = self->ove_it->operator->(); + return BPy_directedViewEdge_from_directedViewEdge(*dve); } /*----------------------orientedViewEdgeIterator get/setters ----------------------------*/ PyDoc_STRVAR(orientedViewEdgeIterator_object_doc, -"The oriented ViewEdge (i.e., a tuple of the pointed ViewEdge and a boolean\n" -"value) currently pointed to by this iterator. If the boolean value is true,\n" -"the ViewEdge is incoming.\n" -"\n" -":type: (:class:`ViewEdge`, bool)"); - -static PyObject *orientedViewEdgeIterator_object_get(BPy_orientedViewEdgeIterator *self, void *UNUSED(closure)) + "The oriented ViewEdge (i.e., a tuple of the pointed ViewEdge and a boolean\n" + "value) currently pointed to by this iterator. If the boolean value is true,\n" + "the ViewEdge is incoming.\n" + "\n" + ":type: (:class:`ViewEdge`, bool)"); + +static PyObject *orientedViewEdgeIterator_object_get(BPy_orientedViewEdgeIterator *self, + void *UNUSED(closure)) { - if (self->ove_it->isEnd()) { - PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); - return NULL; - } - return BPy_directedViewEdge_from_directedViewEdge(self->ove_it->operator*()); + if (self->ove_it->isEnd()) { + PyErr_SetString(PyExc_RuntimeError, "iteration has stopped"); + return NULL; + } + return BPy_directedViewEdge_from_directedViewEdge(self->ove_it->operator*()); } static PyGetSetDef BPy_orientedViewEdgeIterator_getseters[] = { - {(char *)"object", (getter)orientedViewEdgeIterator_object_get, (setter)NULL, - (char *)orientedViewEdgeIterator_object_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"object", + (getter)orientedViewEdgeIterator_object_get, + (setter)NULL, + (char *)orientedViewEdgeIterator_object_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_orientedViewEdgeIterator type definition ------------------------------*/ PyTypeObject orientedViewEdgeIterator_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "orientedViewEdgeIterator", /* tp_name */ - sizeof(BPy_orientedViewEdgeIterator), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - orientedViewEdgeIterator_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - (getiterfunc)orientedViewEdgeIterator_iter, /* tp_iter */ - (iternextfunc)orientedViewEdgeIterator_iternext, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_orientedViewEdgeIterator_getseters, /* tp_getset */ - &Iterator_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)orientedViewEdgeIterator_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "orientedViewEdgeIterator", /* tp_name */ + sizeof(BPy_orientedViewEdgeIterator), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + orientedViewEdgeIterator_doc, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + (getiterfunc)orientedViewEdgeIterator_iter, /* tp_iter */ + (iternextfunc)orientedViewEdgeIterator_iternext, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + BPy_orientedViewEdgeIterator_getseters, /* tp_getset */ + &Iterator_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)orientedViewEdgeIterator_init, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.h b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.h index 226535e3882..179e315b1be 100644 --- a/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.h +++ b/source/blender/freestyle/intern/python/Iterator/BPy_orientedViewEdgeIterator.h @@ -34,14 +34,14 @@ extern "C" { extern PyTypeObject orientedViewEdgeIterator_Type; #define BPy_orientedViewEdgeIterator_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&orientedViewEdgeIterator_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&orientedViewEdgeIterator_Type)) /*---------------------------Python BPy_orientedViewEdgeIterator structure definition----------*/ typedef struct { - BPy_Iterator py_it; - ViewVertexInternal::orientedViewEdgeIterator *ove_it; - bool reversed; - bool at_start; + BPy_Iterator py_it; + ViewVertexInternal::orientedViewEdgeIterator *ove_it; + bool reversed; + bool at_start; } BPy_orientedViewEdgeIterator; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp index 1fa26efdbce..7ee1372aa22 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.cpp @@ -31,77 +31,78 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char BackboneStretcherShader___doc__[] = -"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`BackboneStretcherShader`\n" -"\n" -"[Geometry shader]\n" -"\n" -".. method:: __init__(amount=2.0)\n" -"\n" -" Builds a BackboneStretcherShader object.\n" -"\n" -" :arg amount: The stretching amount value.\n" -" :type amount: float\n" -"\n" -".. method:: shade(stroke)\n" -"\n" -" Stretches the stroke at its two extremities and following the\n" -" respective directions: v(1)v(0) and v(n-1)v(n).\n" -"\n" -" :arg stroke: A Stroke object.\n" -" :type stroke: :class:`freestyle.types.Stroke`\n"; + "Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`BackboneStretcherShader`\n" + "\n" + "[Geometry shader]\n" + "\n" + ".. method:: __init__(amount=2.0)\n" + "\n" + " Builds a BackboneStretcherShader object.\n" + "\n" + " :arg amount: The stretching amount value.\n" + " :type amount: float\n" + "\n" + ".. method:: shade(stroke)\n" + "\n" + " Stretches the stroke at its two extremities and following the\n" + " respective directions: v(1)v(0) and v(n-1)v(n).\n" + "\n" + " :arg stroke: A Stroke object.\n" + " :type stroke: :class:`freestyle.types.Stroke`\n"; -static int BackboneStretcherShader___init__(BPy_BackboneStretcherShader *self, PyObject *args, PyObject *kwds) +static int BackboneStretcherShader___init__(BPy_BackboneStretcherShader *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"amount", NULL}; - float f = 2.0; + static const char *kwlist[] = {"amount", NULL}; + float f = 2.0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f)) - return -1; - self->py_ss.ss = new StrokeShaders::BackboneStretcherShader(f); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f)) + return -1; + self->py_ss.ss = new StrokeShaders::BackboneStretcherShader(f); + return 0; } /*-----------------------BPy_BackboneStretcherShader type definition ------------------------------*/ PyTypeObject BackboneStretcherShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "BackboneStretcherShader", /* tp_name */ - sizeof(BPy_BackboneStretcherShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - BackboneStretcherShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)BackboneStretcherShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "BackboneStretcherShader", /* tp_name */ + sizeof(BPy_BackboneStretcherShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + BackboneStretcherShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)BackboneStretcherShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.h index 037a06725c1..c37d330e4a7 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BackboneStretcherShader.h @@ -32,19 +32,17 @@ extern "C" { extern PyTypeObject BackboneStretcherShader_Type; #define BPy_BackboneStretcherShader_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&BackboneStretcherShader_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&BackboneStretcherShader_Type)) /*---------------------------Python BPy_BackboneStretcherShader structure definition----------*/ typedef struct { - BPy_StrokeShader py_ss; + BPy_StrokeShader py_ss; } BPy_BackboneStretcherShader; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus } #endif - #endif /* __FREESTYLE_PYTHON_BACKBONESTRETCHERSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp index 4bb86a0bb0e..ff5b98cf912 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.cpp @@ -31,79 +31,78 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char BezierCurveShader___doc__[] = -"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`BezierCurveShader`\n" -"\n" -"[Geometry shader]\n" -"\n" -".. method:: __init__(error=4.0)\n" -"\n" -" Builds a BezierCurveShader object.\n" -"\n" -" :arg error: The error we're allowing for the approximation. This\n" -" error is the max distance allowed between the new curve and the\n" -" original geometry.\n" -" :type error: float\n" -"\n" -".. method:: shade(stroke)\n" -"\n" -" Transforms the stroke backbone geometry so that it corresponds to a\n" -" Bezier Curve approximation of the original backbone geometry.\n" -"\n" -" :arg stroke: A Stroke object.\n" -" :type stroke: :class:`freestyle.types.Stroke`\n"; + "Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`BezierCurveShader`\n" + "\n" + "[Geometry shader]\n" + "\n" + ".. method:: __init__(error=4.0)\n" + "\n" + " Builds a BezierCurveShader object.\n" + "\n" + " :arg error: The error we're allowing for the approximation. This\n" + " error is the max distance allowed between the new curve and the\n" + " original geometry.\n" + " :type error: float\n" + "\n" + ".. method:: shade(stroke)\n" + "\n" + " Transforms the stroke backbone geometry so that it corresponds to a\n" + " Bezier Curve approximation of the original backbone geometry.\n" + "\n" + " :arg stroke: A Stroke object.\n" + " :type stroke: :class:`freestyle.types.Stroke`\n"; static int BezierCurveShader___init__(BPy_BezierCurveShader *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"error", NULL}; - float f = 4.0; + static const char *kwlist[] = {"error", NULL}; + float f = 4.0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f)) - return -1; - self->py_ss.ss = new StrokeShaders::BezierCurveShader(f); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|f", (char **)kwlist, &f)) + return -1; + self->py_ss.ss = new StrokeShaders::BezierCurveShader(f); + return 0; } /*-----------------------BPy_BezierCurveShader type definition ------------------------------*/ PyTypeObject BezierCurveShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "BezierCurveShader", /* tp_name */ - sizeof(BPy_BezierCurveShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - BezierCurveShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)BezierCurveShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "BezierCurveShader", /* tp_name */ + sizeof(BPy_BezierCurveShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + BezierCurveShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)BezierCurveShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.h index ea289bbbf62..b38fcec838d 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BezierCurveShader.h @@ -31,19 +31,18 @@ extern "C" { extern PyTypeObject BezierCurveShader_Type; -#define BPy_BezierCurveShader_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&BezierCurveShader_Type)) +#define BPy_BezierCurveShader_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&BezierCurveShader_Type)) /*---------------------------Python BPy_BezierCurveShader structure definition----------*/ typedef struct { - BPy_StrokeShader py_ss; + BPy_StrokeShader py_ss; } BPy_BezierCurveShader; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus } #endif - #endif /* __FREESTYLE_PYTHON_BEZIERCURVESHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp index 91a95d054cd..2984f52203d 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.cpp @@ -33,94 +33,96 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char BlenderTextureShader___doc__[] = -"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`BlenderTextureShader`\n" -"\n" -"[Texture shader]\n" -"\n" -".. method:: __init__(texture)\n" -"\n" -" Builds a BlenderTextureShader object.\n" -"\n" -" :arg texture: A line style texture slot or a shader node tree to define\n" -" a set of textures.\n" -" :type texture: :class:`bpy.types.LineStyleTextureSlot` or\n" -" :class:`bpy.types.ShaderNodeTree`\n" -"\n" -".. method:: shade(stroke)\n" -"\n" -" Assigns a blender texture slot to the stroke shading in order to\n" -" simulate marks.\n" -"\n" -" :arg stroke: A Stroke object.\n" -" :type stroke: :class:`freestyle.types.Stroke`\n"; + "Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`BlenderTextureShader`\n" + "\n" + "[Texture shader]\n" + "\n" + ".. method:: __init__(texture)\n" + "\n" + " Builds a BlenderTextureShader object.\n" + "\n" + " :arg texture: A line style texture slot or a shader node tree to define\n" + " a set of textures.\n" + " :type texture: :class:`bpy.types.LineStyleTextureSlot` or\n" + " :class:`bpy.types.ShaderNodeTree`\n" + "\n" + ".. method:: shade(stroke)\n" + "\n" + " Assigns a blender texture slot to the stroke shading in order to\n" + " simulate marks.\n" + "\n" + " :arg stroke: A Stroke object.\n" + " :type stroke: :class:`freestyle.types.Stroke`\n"; -static int BlenderTextureShader___init__(BPy_BlenderTextureShader *self, PyObject *args, PyObject *kwds) +static int BlenderTextureShader___init__(BPy_BlenderTextureShader *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"texture", NULL}; - PyObject *obj; - MTex *_mtex; - bNodeTree *_nodetree; + static const char *kwlist[] = {"texture", NULL}; + PyObject *obj; + MTex *_mtex; + bNodeTree *_nodetree; - 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); - return 0; - } - PyErr_Clear(); - _nodetree = (bNodeTree *)PyC_RNA_AsPointer(obj, "ShaderNodeTree"); - if (_nodetree) { - self->py_ss.ss = new StrokeShaders::BlenderTextureShader(_nodetree); - return 0; - } - PyErr_Format(PyExc_TypeError, - "expected either 'LineStyleTextureSlot' or 'ShaderNodeTree', " - "found '%.200s' instead", Py_TYPE(obj)->tp_name); - return -1; + 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); + return 0; + } + PyErr_Clear(); + _nodetree = (bNodeTree *)PyC_RNA_AsPointer(obj, "ShaderNodeTree"); + if (_nodetree) { + self->py_ss.ss = new StrokeShaders::BlenderTextureShader(_nodetree); + return 0; + } + PyErr_Format(PyExc_TypeError, + "expected either 'LineStyleTextureSlot' or 'ShaderNodeTree', " + "found '%.200s' instead", + Py_TYPE(obj)->tp_name); + return -1; } /*-----------------------BPy_BlenderTextureShader type definition ------------------------------*/ PyTypeObject BlenderTextureShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "BlenderTextureShader", /* tp_name */ - sizeof(BPy_BlenderTextureShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - BlenderTextureShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)BlenderTextureShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "BlenderTextureShader", /* tp_name */ + sizeof(BPy_BlenderTextureShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + BlenderTextureShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)BlenderTextureShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.h index 7fdc3b4f9fd..35335ffc023 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_BlenderTextureShader.h @@ -27,26 +27,24 @@ extern "C" { #endif - /////////////////////////////////////////////////////////////////////////////////////////// #include extern PyTypeObject BlenderTextureShader_Type; -#define BPy_BlenderTextureShader_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&BlenderTextureShader_Type)) +#define BPy_BlenderTextureShader_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&BlenderTextureShader_Type)) /*---------------------------Python BPy_BlenderTextureShader structure definition-----------*/ typedef struct { - BPy_StrokeShader py_ss; + BPy_StrokeShader py_ss; } BPy_BlenderTextureShader; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus } #endif - #endif /* __FREESTYLE_PYTHON_BLENDERTEXTURESHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp index 33734313857..98b50f2112c 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.cpp @@ -32,95 +32,95 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char CalligraphicShader___doc__[] = -"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`CalligraphicShader`\n" -"\n" -"[Thickness Shader]\n" -"\n" -".. method:: __init__(thickness_min, thickness_max, orientation, clamp)\n" -"\n" -" Builds a CalligraphicShader object.\n" -"\n" -" :arg thickness_min: The minimum thickness in the direction\n" -" perpendicular to the main direction.\n" -" :type thickness_min: float\n" -" :arg thickness_max: The maximum thickness in the main direction.\n" -" :type thickness_max: float\n" -" :arg orientation: The 2D vector giving the main direction.\n" -" :type orientation: :class:`mathutils.Vector`\n" -" :arg clamp: If true, the strokes are drawn in black when the stroke\n" -" direction is between -90 and 90 degrees with respect to the main\n" -" direction and drawn in white otherwise. If false, the strokes\n" -" are always drawn in black.\n" -" :type clamp: bool\n" -"\n" -".. method:: shade(stroke)\n" -"\n" -" Assigns thicknesses to the stroke vertices so that the stroke looks\n" -" like made with a calligraphic tool, i.e. the stroke will be the\n" -" thickest in a main direction, and the thinest in the direction\n" -" perpendicular to this one, and an interpolation inbetween.\n" -"\n" -" :arg stroke: A Stroke object.\n" -" :type stroke: :class:`freestyle.types.Stroke`\n"; + "Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`CalligraphicShader`\n" + "\n" + "[Thickness Shader]\n" + "\n" + ".. method:: __init__(thickness_min, thickness_max, orientation, clamp)\n" + "\n" + " Builds a CalligraphicShader object.\n" + "\n" + " :arg thickness_min: The minimum thickness in the direction\n" + " perpendicular to the main direction.\n" + " :type thickness_min: float\n" + " :arg thickness_max: The maximum thickness in the main direction.\n" + " :type thickness_max: float\n" + " :arg orientation: The 2D vector giving the main direction.\n" + " :type orientation: :class:`mathutils.Vector`\n" + " :arg clamp: If true, the strokes are drawn in black when the stroke\n" + " direction is between -90 and 90 degrees with respect to the main\n" + " direction and drawn in white otherwise. If false, the strokes\n" + " are always drawn in black.\n" + " :type clamp: bool\n" + "\n" + ".. method:: shade(stroke)\n" + "\n" + " Assigns thicknesses to the stroke vertices so that the stroke looks\n" + " like made with a calligraphic tool, i.e. the stroke will be the\n" + " thickest in a main direction, and the thinest in the direction\n" + " perpendicular to this one, and an interpolation inbetween.\n" + "\n" + " :arg stroke: A Stroke object.\n" + " :type stroke: :class:`freestyle.types.Stroke`\n"; -static int CalligraphicShader___init__(BPy_CalligraphicShader *self, PyObject *args, PyObject *kwds) +static int CalligraphicShader___init__(BPy_CalligraphicShader *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"thickness_min", "thickness_max", "orientation", "clamp", NULL}; - double d1, d2; - float f3[2]; - PyObject *obj4 = 0; + static const char *kwlist[] = {"thickness_min", "thickness_max", "orientation", "clamp", NULL}; + double d1, d2; + float f3[2]; + PyObject *obj4 = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "ddO&O!", (char **)kwlist, - &d1, &d2, convert_v2, f3, &PyBool_Type, &obj4)) - { - return -1; - } - Vec2f v(f3[0], f3[1]); - self->py_ss.ss = new CalligraphicShader(d1, d2, v, bool_from_PyBool(obj4)); - return 0; + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "ddO&O!", (char **)kwlist, &d1, &d2, convert_v2, f3, &PyBool_Type, &obj4)) { + return -1; + } + Vec2f v(f3[0], f3[1]); + self->py_ss.ss = new CalligraphicShader(d1, d2, v, bool_from_PyBool(obj4)); + return 0; } /*-----------------------BPy_CalligraphicShader type definition ------------------------------*/ PyTypeObject CalligraphicShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "CalligraphicShader", /* tp_name */ - sizeof(BPy_CalligraphicShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - CalligraphicShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)CalligraphicShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "CalligraphicShader", /* tp_name */ + sizeof(BPy_CalligraphicShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + CalligraphicShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)CalligraphicShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.h index 1932e5e4dc2..8acb1215980 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_CalligraphicShader.h @@ -35,15 +35,13 @@ extern PyTypeObject CalligraphicShader_Type; /*---------------------------Python BPy_CalligraphicShader structure definition----------*/ typedef struct { - BPy_StrokeShader py_ss; + BPy_StrokeShader py_ss; } BPy_CalligraphicShader; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus } #endif - #endif /* __FREESTYLE_PYTHON_CALLIGRAPHICSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp index 3e5da7289fa..8de33188639 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.cpp @@ -31,78 +31,77 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ColorNoiseShader___doc__[] = -"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`ColorNoiseShader`\n" -"\n" -"[Color shader]\n" -"\n" -".. method:: __init__(amplitude, period)\n" -"\n" -" Builds a ColorNoiseShader object.\n" -"\n" -" :arg amplitude: The amplitude of the noise signal.\n" -" :type amplitude: float\n" -" :arg period: The period of the noise signal.\n" -" :type period: float\n" -"\n" -".. method:: shade(stroke)\n" -"\n" -" Shader to add noise to the stroke colors.\n" -"\n" -" :arg stroke: A Stroke object.\n" -" :type stroke: :class:`freestyle.types.Stroke`\n"; + "Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`ColorNoiseShader`\n" + "\n" + "[Color shader]\n" + "\n" + ".. method:: __init__(amplitude, period)\n" + "\n" + " Builds a ColorNoiseShader object.\n" + "\n" + " :arg amplitude: The amplitude of the noise signal.\n" + " :type amplitude: float\n" + " :arg period: The period of the noise signal.\n" + " :type period: float\n" + "\n" + ".. method:: shade(stroke)\n" + "\n" + " Shader to add noise to the stroke colors.\n" + "\n" + " :arg stroke: A Stroke object.\n" + " :type stroke: :class:`freestyle.types.Stroke`\n"; static int ColorNoiseShader___init__(BPy_ColorNoiseShader *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"amplitude", "period", NULL}; - float f1, f2; + static const char *kwlist[] = {"amplitude", "period", NULL}; + float 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; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "ff", (char **)kwlist, &f1, &f2)) + return -1; + self->py_ss.ss = new StrokeShaders::ColorNoiseShader(f1, f2); + return 0; } /*-----------------------BPy_ColorNoiseShader type definition ------------------------------*/ PyTypeObject ColorNoiseShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ColorNoiseShader", /* tp_name */ - sizeof(BPy_ColorNoiseShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ColorNoiseShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ColorNoiseShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "ColorNoiseShader", /* tp_name */ + sizeof(BPy_ColorNoiseShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ColorNoiseShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ColorNoiseShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.h index 0ee5964641d..054479d916d 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorNoiseShader.h @@ -31,19 +31,18 @@ extern "C" { extern PyTypeObject ColorNoiseShader_Type; -#define BPy_ColorNoiseShader_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&ColorNoiseShader_Type)) +#define BPy_ColorNoiseShader_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&ColorNoiseShader_Type)) /*---------------------------Python BPy_ColorNoiseShader structure definition----------*/ typedef struct { - BPy_StrokeShader py_ss; + BPy_StrokeShader py_ss; } BPy_ColorNoiseShader; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus } #endif - #endif /* __FREESTYLE_PYTHON_COLORNOISESHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp index 99dc4a07370..6dbbd1396d9 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.cpp @@ -31,82 +31,83 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ConstantColorShader___doc__[] = -"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`ConstantColorShader`\n" -"\n" -"[Color shader]\n" -"\n" -".. method:: __init__(red, green, blue, alpha=1.0)\n" -"\n" -" Builds a ConstantColorShader object.\n" -"\n" -" :arg red: The red component.\n" -" :type red: float\n" -" :arg green: The green component.\n" -" :type green: float\n" -" :arg blue: The blue component.\n" -" :type blue: float\n" -" :arg alpha: The alpha value.\n" -" :type alpha: float\n" -"\n" -".. method:: shade(stroke)\n" -"\n" -" Assigns a constant color to every vertex of the Stroke.\n" -"\n" -" :arg stroke: A Stroke object.\n" -" :type stroke: :class:`freestyle.types.Stroke`\n"; + "Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`ConstantColorShader`\n" + "\n" + "[Color shader]\n" + "\n" + ".. method:: __init__(red, green, blue, alpha=1.0)\n" + "\n" + " Builds a ConstantColorShader object.\n" + "\n" + " :arg red: The red component.\n" + " :type red: float\n" + " :arg green: The green component.\n" + " :type green: float\n" + " :arg blue: The blue component.\n" + " :type blue: float\n" + " :arg alpha: The alpha value.\n" + " :type alpha: float\n" + "\n" + ".. method:: shade(stroke)\n" + "\n" + " Assigns a constant color to every vertex of the Stroke.\n" + "\n" + " :arg stroke: A Stroke object.\n" + " :type stroke: :class:`freestyle.types.Stroke`\n"; -static int ConstantColorShader___init__(BPy_ConstantColorShader *self, PyObject *args, PyObject *kwds) +static int ConstantColorShader___init__(BPy_ConstantColorShader *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"red", "green", "blue", "alpha", NULL}; - float f1, f2, f3, f4 = 1.0; + 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)) - return -1; - self->py_ss.ss = new StrokeShaders::ConstantColorShader(f1, f2, f3, f4); - return 0; + 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; } /*-----------------------BPy_ConstantColorShader type definition ------------------------------*/ PyTypeObject ConstantColorShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ConstantColorShader", /* tp_name */ - sizeof(BPy_ConstantColorShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ConstantColorShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ConstantColorShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "ConstantColorShader", /* tp_name */ + sizeof(BPy_ConstantColorShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ConstantColorShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ConstantColorShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.h index ad0ddeb23f2..36b59e6493e 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantColorShader.h @@ -31,19 +31,18 @@ extern "C" { extern PyTypeObject ConstantColorShader_Type; -#define BPy_ConstantColorShader_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&ConstantColorShader_Type)) +#define BPy_ConstantColorShader_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&ConstantColorShader_Type)) /*---------------------------Python BPy_ConstantColorShader structure definition----------*/ typedef struct { - BPy_StrokeShader py_ss; + BPy_StrokeShader py_ss; } BPy_ConstantColorShader; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus } #endif - #endif /* __FREESTYLE_PYTHON_CONSTANTCOLORSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp index 511ac47b74b..c226cc0df25 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp @@ -31,76 +31,77 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ConstantThicknessShader___doc__[] = -"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`ConstantThicknessShader`\n" -"\n" -"[Thickness shader]\n" -"\n" -".. method:: __init__(thickness)\n" -"\n" -" Builds a ConstantThicknessShader object.\n" -"\n" -" :arg thickness: The thickness that must be assigned to the stroke.\n" -" :type thickness: float\n" -"\n" -".. method:: shade(stroke)\n" -"\n" -" Assigns an absolute constant thickness to every vertex of the Stroke.\n" -"\n" -" :arg stroke: A Stroke object.\n" -" :type stroke: :class:`freestyle.types.Stroke`\n"; + "Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`ConstantThicknessShader`\n" + "\n" + "[Thickness shader]\n" + "\n" + ".. method:: __init__(thickness)\n" + "\n" + " Builds a ConstantThicknessShader object.\n" + "\n" + " :arg thickness: The thickness that must be assigned to the stroke.\n" + " :type thickness: float\n" + "\n" + ".. method:: shade(stroke)\n" + "\n" + " Assigns an absolute constant thickness to every vertex of the Stroke.\n" + "\n" + " :arg stroke: A Stroke object.\n" + " :type stroke: :class:`freestyle.types.Stroke`\n"; -static int ConstantThicknessShader___init__(BPy_ConstantThicknessShader *self, PyObject *args, PyObject *kwds) +static int ConstantThicknessShader___init__(BPy_ConstantThicknessShader *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"thickness", NULL}; - float f; + static const char *kwlist[] = {"thickness", NULL}; + float f; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f)) - return -1; - self->py_ss.ss = new StrokeShaders::ConstantThicknessShader(f); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f)) + return -1; + self->py_ss.ss = new StrokeShaders::ConstantThicknessShader(f); + return 0; } /*-----------------------BPy_ConstantThicknessShader type definition ------------------------------*/ PyTypeObject ConstantThicknessShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ConstantThicknessShader", /* tp_name */ - sizeof(BPy_ConstantThicknessShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ConstantThicknessShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ConstantThicknessShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "ConstantThicknessShader", /* tp_name */ + sizeof(BPy_ConstantThicknessShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ConstantThicknessShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ConstantThicknessShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.h index d07ab7250f9..3a11ab9c9a0 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstantThicknessShader.h @@ -32,19 +32,17 @@ extern "C" { extern PyTypeObject ConstantThicknessShader_Type; #define BPy_ConstantThicknessShader_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&ConstantThicknessShader_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&ConstantThicknessShader_Type)) /*---------------------------Python BPy_ConstantThicknessShader structure definition----------*/ typedef struct { - BPy_StrokeShader py_ss; + BPy_StrokeShader py_ss; } BPy_ConstantThicknessShader; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus } #endif - #endif /* __FREESTYLE_PYTHON_CONSTANTTHICKNESSSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp index f50d496b03a..22a67c65df8 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp @@ -31,83 +31,83 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ConstrainedIncreasingThicknessShader___doc__[] = -"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`ConstrainedIncreasingThicknessShader`\n" -"\n" -"[Thickness shader]\n" -"\n" -".. method:: __init__(thickness_min, thickness_max, ratio)\n" -"\n" -" Builds a ConstrainedIncreasingThicknessShader object.\n" -"\n" -" :arg thickness_min: The minimum thickness.\n" -" :type thickness_min: float\n" -" :arg thickness_max: The maximum thickness.\n" -" :type thickness_max: float\n" -" :arg ratio: The thickness/length ratio that we don't want to exceed. \n" -" :type ratio: float\n" -"\n" -".. method:: shade(stroke)\n" -"\n" -" Same as the :class:`IncreasingThicknessShader`, but here we allow\n" -" the user to control the thickness/length ratio so that we don't get\n" -" fat short lines.\n" -"\n" -" :arg stroke: A Stroke object.\n" -" :type stroke: :class:`freestyle.types.Stroke`\n"; + "Class hierarchy: :class:`freestyle.types.StrokeShader` > " + ":class:`ConstrainedIncreasingThicknessShader`\n" + "\n" + "[Thickness shader]\n" + "\n" + ".. method:: __init__(thickness_min, thickness_max, ratio)\n" + "\n" + " Builds a ConstrainedIncreasingThicknessShader object.\n" + "\n" + " :arg thickness_min: The minimum thickness.\n" + " :type thickness_min: float\n" + " :arg thickness_max: The maximum thickness.\n" + " :type thickness_max: float\n" + " :arg ratio: The thickness/length ratio that we don't want to exceed. \n" + " :type ratio: float\n" + "\n" + ".. method:: shade(stroke)\n" + "\n" + " Same as the :class:`IncreasingThicknessShader`, but here we allow\n" + " the user to control the thickness/length ratio so that we don't get\n" + " fat short lines.\n" + "\n" + " :arg stroke: A Stroke object.\n" + " :type stroke: :class:`freestyle.types.Stroke`\n"; -static int ConstrainedIncreasingThicknessShader___init__(BPy_ConstrainedIncreasingThicknessShader *self, - PyObject *args, PyObject *kwds) +static int ConstrainedIncreasingThicknessShader___init__( + BPy_ConstrainedIncreasingThicknessShader *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"thickness_min", "thickness_max", "ratio", NULL}; - float f1, f2, f3; + 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)) - return -1; - self->py_ss.ss = new StrokeShaders::ConstrainedIncreasingThicknessShader(f1, f2, f3); - return 0; + 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; } /*-----------------------BPy_ConstrainedIncreasingThicknessShader type definition ------------------------------*/ PyTypeObject ConstrainedIncreasingThicknessShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ConstrainedIncreasingThicknessShader", /* tp_name */ - sizeof(BPy_ConstrainedIncreasingThicknessShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ConstrainedIncreasingThicknessShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ConstrainedIncreasingThicknessShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "ConstrainedIncreasingThicknessShader", /* tp_name */ + sizeof(BPy_ConstrainedIncreasingThicknessShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ConstrainedIncreasingThicknessShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ConstrainedIncreasingThicknessShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.h index 2c53ee40db4..907355ea69c 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.h @@ -32,19 +32,17 @@ extern "C" { extern PyTypeObject ConstrainedIncreasingThicknessShader_Type; #define BPy_ConstrainedIncreasingThicknessShader_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&ConstrainedIncreasingThicknessShader_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&ConstrainedIncreasingThicknessShader_Type)) /*---------------------------Python BPy_ConstrainedIncreasingThicknessShader structure definition----------*/ typedef struct { - BPy_StrokeShader py_ss; + BPy_StrokeShader py_ss; } BPy_ConstrainedIncreasingThicknessShader; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus } #endif - #endif /* __FREESTYLE_PYTHON_CONSTRAINEDINCREASINGTHICKNESSSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp index 79566195633..a3cf272a1ab 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.cpp @@ -31,84 +31,85 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GuidingLinesShader___doc__[] = -"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`GuidingLinesShader`\n" -"\n" -"[Geometry shader]\n" -"\n" -".. method:: __init__(offset)\n" -"\n" -" Builds a GuidingLinesShader object.\n" -"\n" -" :arg offset: The line that replaces the stroke is initially in the\n" -" middle of the initial stroke bounding box. offset is the value\n" -" of the displacement which is applied to this line along its\n" -" normal.\n" -" :type offset: float\n" -"\n" -".. method:: shade(stroke)\n" -"\n" -" Shader to modify the Stroke geometry so that it corresponds to its\n" -" main direction line. This shader must be used together with the\n" -" splitting operator using the curvature criterion. Indeed, the\n" -" precision of the approximation will depend on the size of the\n" -" stroke's pieces. The bigger the pieces are, the rougher the\n" -" approximation is.\n" -"\n" -" :arg stroke: A Stroke object.\n" -" :type stroke: :class:`freestyle.types.Stroke`\n"; + "Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`GuidingLinesShader`\n" + "\n" + "[Geometry shader]\n" + "\n" + ".. method:: __init__(offset)\n" + "\n" + " Builds a GuidingLinesShader object.\n" + "\n" + " :arg offset: The line that replaces the stroke is initially in the\n" + " middle of the initial stroke bounding box. offset is the value\n" + " of the displacement which is applied to this line along its\n" + " normal.\n" + " :type offset: float\n" + "\n" + ".. method:: shade(stroke)\n" + "\n" + " Shader to modify the Stroke geometry so that it corresponds to its\n" + " main direction line. This shader must be used together with the\n" + " splitting operator using the curvature criterion. Indeed, the\n" + " precision of the approximation will depend on the size of the\n" + " stroke's pieces. The bigger the pieces are, the rougher the\n" + " approximation is.\n" + "\n" + " :arg stroke: A Stroke object.\n" + " :type stroke: :class:`freestyle.types.Stroke`\n"; -static int GuidingLinesShader___init__(BPy_GuidingLinesShader *self, PyObject *args, PyObject *kwds) +static int GuidingLinesShader___init__(BPy_GuidingLinesShader *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"offset", NULL}; - float f; + static const char *kwlist[] = {"offset", NULL}; + float f; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f)) - return -1; - self->py_ss.ss = new StrokeShaders::GuidingLinesShader(f); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f)) + return -1; + self->py_ss.ss = new StrokeShaders::GuidingLinesShader(f); + return 0; } /*-----------------------BPy_GuidingLinesShader type definition ------------------------------*/ PyTypeObject GuidingLinesShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "GuidingLinesShader", /* tp_name */ - sizeof(BPy_GuidingLinesShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GuidingLinesShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GuidingLinesShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "GuidingLinesShader", /* tp_name */ + sizeof(BPy_GuidingLinesShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GuidingLinesShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GuidingLinesShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.h index 1603efce35a..217acbc4648 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_GuidingLinesShader.h @@ -31,19 +31,18 @@ extern "C" { extern PyTypeObject GuidingLinesShader_Type; -#define BPy_GuidingLinesShader_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&GuidingLinesShader_Type)) +#define BPy_GuidingLinesShader_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&GuidingLinesShader_Type)) /*---------------------------Python BPy_GuidingLinesShader structure definition----------*/ typedef struct { - BPy_StrokeShader py_ss; + BPy_StrokeShader py_ss; } BPy_GuidingLinesShader; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus } #endif - #endif /* __FREESTYLE_PYTHON_GUIDINGLINESSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp index a27092d9c61..bc0bc5bd721 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.cpp @@ -31,93 +31,103 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char IncreasingColorShader___doc__[] = -"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`IncreasingColorShader`\n" -"\n" -"[Color shader]\n" -"\n" -".. method:: __init__(red_min, green_min, blue_min, alpha_min, red_max, green_max, blue_max, alpha_max)\n" -"\n" -" Builds an IncreasingColorShader object.\n" -"\n" -" :arg red_min: The first color red component.\n" -" :type red_min: float\n" -" :arg green_min: The first color green component.\n" -" :type green_min: float\n" -" :arg blue_min: The first color blue component.\n" -" :type blue_min: float\n" -" :arg alpha_min: The first color alpha value.\n" -" :type alpha_min: float\n" -" :arg red_max: The second color red component.\n" -" :type red_max: float\n" -" :arg green_max: The second color green component.\n" -" :type green_max: float\n" -" :arg blue_max: The second color blue component.\n" -" :type blue_max: float\n" -" :arg alpha_max: The second color alpha value.\n" -" :type alpha_max: float\n" -"\n" -".. method:: shade(stroke)\n" -"\n" -" Assigns a varying color to the stroke. The user specifies two\n" -" colors A and B. The stroke color will change linearly from A to B\n" -" between the first and the last vertex.\n" -"\n" -" :arg stroke: A Stroke object.\n" -" :type stroke: :class:`freestyle.types.Stroke`\n"; + "Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`IncreasingColorShader`\n" + "\n" + "[Color shader]\n" + "\n" + ".. method:: __init__(red_min, green_min, blue_min, alpha_min, red_max, green_max, blue_max, " + "alpha_max)\n" + "\n" + " Builds an IncreasingColorShader object.\n" + "\n" + " :arg red_min: The first color red component.\n" + " :type red_min: float\n" + " :arg green_min: The first color green component.\n" + " :type green_min: float\n" + " :arg blue_min: The first color blue component.\n" + " :type blue_min: float\n" + " :arg alpha_min: The first color alpha value.\n" + " :type alpha_min: float\n" + " :arg red_max: The second color red component.\n" + " :type red_max: float\n" + " :arg green_max: The second color green component.\n" + " :type green_max: float\n" + " :arg blue_max: The second color blue component.\n" + " :type blue_max: float\n" + " :arg alpha_max: The second color alpha value.\n" + " :type alpha_max: float\n" + "\n" + ".. method:: shade(stroke)\n" + "\n" + " Assigns a varying color to the stroke. The user specifies two\n" + " colors A and B. The stroke color will change linearly from A to B\n" + " between the first and the last vertex.\n" + "\n" + " :arg stroke: A Stroke object.\n" + " :type stroke: :class:`freestyle.types.Stroke`\n"; -static int IncreasingColorShader___init__(BPy_IncreasingColorShader *self, PyObject *args, PyObject *kwds) +static int IncreasingColorShader___init__(BPy_IncreasingColorShader *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"red_min", "green_min", "blue_min", "alpha_min", - "red_max", "green_max", "blue_max", "alpha_max", NULL}; - float f1, f2, f3, f4, f5, f6, f7, f8; + static const char *kwlist[] = {"red_min", + "green_min", + "blue_min", + "alpha_min", + "red_max", + "green_max", + "blue_max", + "alpha_max", + NULL}; + 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)) - return -1; - self->py_ss.ss = new StrokeShaders::IncreasingColorShader(f1, f2, f3, f4, f5, f6, f7, f8); - return 0; + if (!PyArg_ParseTupleAndKeywords( + 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; } /*-----------------------BPy_IncreasingColorShader type definition ------------------------------*/ PyTypeObject IncreasingColorShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "IncreasingColorShader", /* tp_name */ - sizeof(BPy_IncreasingColorShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - IncreasingColorShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)IncreasingColorShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "IncreasingColorShader", /* tp_name */ + sizeof(BPy_IncreasingColorShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + IncreasingColorShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)IncreasingColorShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.h index 812b8df1271..d7d1d053efd 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingColorShader.h @@ -31,19 +31,18 @@ extern "C" { extern PyTypeObject IncreasingColorShader_Type; -#define BPy_IncreasingColorShader_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&IncreasingColorShader_Type)) +#define BPy_IncreasingColorShader_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&IncreasingColorShader_Type)) /*---------------------------Python BPy_IncreasingColorShader structure definition----------*/ typedef struct { - BPy_StrokeShader py_ss; + BPy_StrokeShader py_ss; } BPy_IncreasingColorShader; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus } #endif - #endif /* __FREESTYLE_PYTHON_INCREASINGCOLORSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp index 34b62b02a39..324f1c1a40b 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.cpp @@ -31,82 +31,83 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char IncreasingThicknessShader___doc__[] = -"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`IncreasingThicknessShader`\n" -"\n" -"[Thickness shader]\n" -"\n" -".. method:: __init__(thickness_A, thickness_B)\n" -"\n" -" Builds an IncreasingThicknessShader object.\n" -"\n" -" :arg thickness_A: The first thickness value.\n" -" :type thickness_A: float\n" -" :arg thickness_B: The second thickness value.\n" -" :type thickness_B: float\n" -"\n" -".. method:: shade(stroke)\n" -"\n" -" Assigns thicknesses values such as the thickness increases from a\n" -" thickness value A to a thickness value B between the first vertex\n" -" to the midpoint vertex and then decreases from B to a A between\n" -" this midpoint vertex and the last vertex. The thickness is\n" -" linearly interpolated from A to B.\n" -"\n" -" :arg stroke: A Stroke object.\n" -" :type stroke: :class:`freestyle.types.Stroke`\n"; + "Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`IncreasingThicknessShader`\n" + "\n" + "[Thickness shader]\n" + "\n" + ".. method:: __init__(thickness_A, thickness_B)\n" + "\n" + " Builds an IncreasingThicknessShader object.\n" + "\n" + " :arg thickness_A: The first thickness value.\n" + " :type thickness_A: float\n" + " :arg thickness_B: The second thickness value.\n" + " :type thickness_B: float\n" + "\n" + ".. method:: shade(stroke)\n" + "\n" + " Assigns thicknesses values such as the thickness increases from a\n" + " thickness value A to a thickness value B between the first vertex\n" + " to the midpoint vertex and then decreases from B to a A between\n" + " this midpoint vertex and the last vertex. The thickness is\n" + " linearly interpolated from A to B.\n" + "\n" + " :arg stroke: A Stroke object.\n" + " :type stroke: :class:`freestyle.types.Stroke`\n"; -static int IncreasingThicknessShader___init__(BPy_IncreasingThicknessShader *self, PyObject *args, PyObject *kwds) +static int IncreasingThicknessShader___init__(BPy_IncreasingThicknessShader *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"thickness_A", "thickness_B", NULL}; - float f1, f2; + static const char *kwlist[] = {"thickness_A", "thickness_B", NULL}; + float 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; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "ff", (char **)kwlist, &f1, &f2)) + return -1; + self->py_ss.ss = new StrokeShaders::IncreasingThicknessShader(f1, f2); + return 0; } /*-----------------------BPy_IncreasingThicknessShader type definition ------------------------------*/ PyTypeObject IncreasingThicknessShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "IncreasingThicknessShader", /* tp_name */ - sizeof(BPy_IncreasingThicknessShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - IncreasingThicknessShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)IncreasingThicknessShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "IncreasingThicknessShader", /* tp_name */ + sizeof(BPy_IncreasingThicknessShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + IncreasingThicknessShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)IncreasingThicknessShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.h index 08c2a067d13..28636263813 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_IncreasingThicknessShader.h @@ -32,19 +32,17 @@ extern "C" { extern PyTypeObject IncreasingThicknessShader_Type; #define BPy_IncreasingThicknessShader_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&IncreasingThicknessShader_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&IncreasingThicknessShader_Type)) /*---------------------------Python BPy_IncreasingThicknessShader structure definition----------*/ typedef struct { - BPy_StrokeShader py_ss; + BPy_StrokeShader py_ss; } BPy_IncreasingThicknessShader; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus } #endif - #endif /* __FREESTYLE_PYTHON_INCREASINGTHICKNESSSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp index 3444272d77a..273e41a7b9f 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.cpp @@ -31,83 +31,84 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char PolygonalizationShader___doc__[] = -"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`PolygonalizationShader`\n" -"\n" -"[Geometry shader]\n" -"\n" -".. method:: __init__(error)\n" -"\n" -" Builds a PolygonalizationShader object.\n" -"\n" -" :arg error: The error we want our polygonal approximation to have\n" -" with respect to the original geometry. The smaller, the closer\n" -" the new stroke is to the orinal one. This error corresponds to\n" -" the maximum distance between the new stroke and the old one.\n" -" :type error: float\n" -"\n" -".. method:: shade(stroke)\n" -"\n" -" Modifies the Stroke geometry so that it looks more \"polygonal\".\n" -" The basic idea is to start from the minimal stroke approximation\n" -" consisting in a line joining the first vertex to the last one and\n" -" to subdivide using the original stroke vertices until a certain\n" -" error is reached.\n" -"\n" -" :arg stroke: A Stroke object.\n" -" :type stroke: :class:`freestyle.types.Stroke`\n"; + "Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`PolygonalizationShader`\n" + "\n" + "[Geometry shader]\n" + "\n" + ".. method:: __init__(error)\n" + "\n" + " Builds a PolygonalizationShader object.\n" + "\n" + " :arg error: The error we want our polygonal approximation to have\n" + " with respect to the original geometry. The smaller, the closer\n" + " the new stroke is to the orinal one. This error corresponds to\n" + " the maximum distance between the new stroke and the old one.\n" + " :type error: float\n" + "\n" + ".. method:: shade(stroke)\n" + "\n" + " Modifies the Stroke geometry so that it looks more \"polygonal\".\n" + " The basic idea is to start from the minimal stroke approximation\n" + " consisting in a line joining the first vertex to the last one and\n" + " to subdivide using the original stroke vertices until a certain\n" + " error is reached.\n" + "\n" + " :arg stroke: A Stroke object.\n" + " :type stroke: :class:`freestyle.types.Stroke`\n"; -static int PolygonalizationShader___init__(BPy_PolygonalizationShader *self, PyObject *args, PyObject *kwds) +static int PolygonalizationShader___init__(BPy_PolygonalizationShader *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"error", NULL}; - float f; + static const char *kwlist[] = {"error", NULL}; + float f; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f)) - return -1; - self->py_ss.ss = new StrokeShaders::PolygonalizationShader(f); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f)) + return -1; + self->py_ss.ss = new StrokeShaders::PolygonalizationShader(f); + return 0; } /*-----------------------BPy_PolygonalizationShader type definition ------------------------------*/ PyTypeObject PolygonalizationShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "PolygonalizationShader", /* tp_name */ - sizeof(BPy_PolygonalizationShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - PolygonalizationShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)PolygonalizationShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "PolygonalizationShader", /* tp_name */ + sizeof(BPy_PolygonalizationShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + PolygonalizationShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)PolygonalizationShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.h index dc314c29294..e44ca1caa51 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_PolygonalizationShader.h @@ -32,19 +32,17 @@ extern "C" { extern PyTypeObject PolygonalizationShader_Type; #define BPy_PolygonalizationShader_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&PolygonalizationShader_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&PolygonalizationShader_Type)) /*---------------------------Python BPy_PolygonalizationShader structure definition----------*/ typedef struct { - BPy_StrokeShader py_ss; + BPy_StrokeShader py_ss; } BPy_PolygonalizationShader; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus } #endif - #endif /* __FREESTYLE_PYTHON_POLYGONALIZATIONSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp index cb8af522798..8769433123a 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.cpp @@ -31,76 +31,75 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char SamplingShader___doc__[] = -"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`SamplingShader`\n" -"\n" -"[Geometry shader]\n" -"\n" -".. method:: __init__(sampling)\n" -"\n" -" Builds a SamplingShader object.\n" -"\n" -" :arg sampling: The sampling to use for the stroke resampling.\n" -" :type sampling: float\n" -"\n" -".. method:: shade(stroke)\n" -"\n" -" Resamples the stroke.\n" -"\n" -" :arg stroke: A Stroke object.\n" -" :type stroke: :class:`freestyle.types.Stroke`\n"; + "Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`SamplingShader`\n" + "\n" + "[Geometry shader]\n" + "\n" + ".. method:: __init__(sampling)\n" + "\n" + " Builds a SamplingShader object.\n" + "\n" + " :arg sampling: The sampling to use for the stroke resampling.\n" + " :type sampling: float\n" + "\n" + ".. method:: shade(stroke)\n" + "\n" + " Resamples the stroke.\n" + "\n" + " :arg stroke: A Stroke object.\n" + " :type stroke: :class:`freestyle.types.Stroke`\n"; static int SamplingShader___init__(BPy_SamplingShader *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"sampling", NULL}; - float f; + static const char *kwlist[] = {"sampling", NULL}; + float f; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f)) - return -1; - self->py_ss.ss = new StrokeShaders::SamplingShader(f); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &f)) + return -1; + self->py_ss.ss = new StrokeShaders::SamplingShader(f); + return 0; } /*-----------------------BPy_SamplingShader type definition ------------------------------*/ PyTypeObject SamplingShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SamplingShader", /* tp_name */ - sizeof(BPy_SamplingShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - SamplingShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)SamplingShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "SamplingShader", /* tp_name */ + sizeof(BPy_SamplingShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + SamplingShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)SamplingShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.h index e474e836f11..50dbae6916e 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SamplingShader.h @@ -31,19 +31,18 @@ extern "C" { extern PyTypeObject SamplingShader_Type; -#define BPy_SamplingShader_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&SamplingShader_Type)) +#define BPy_SamplingShader_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&SamplingShader_Type)) /*---------------------------Python BPy_SamplingShader structure definition----------*/ typedef struct { - BPy_StrokeShader py_ss; + BPy_StrokeShader py_ss; } BPy_SamplingShader; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus } #endif - #endif /* __FREESTYLE_PYTHON_SAMPLINGSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp index 870af96caf2..72d5799412f 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.cpp @@ -31,102 +31,106 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char SmoothingShader___doc__[] = -"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`SmoothingShader`\n" -"\n" -"[Geometry shader]\n" -"\n" -".. method:: __init__(num_iterations=100, factor_point=0.1,\n" -" factor_curvature=0.0, factor_curvature_difference=0.2,\n" -" aniso_point=0.0, aniso_normal=0.0, aniso_curvature=0.0,\n" -" carricature_factor=1.0)\n" -"\n" -" Builds a SmoothingShader object.\n" -"\n" -" :arg num_iterations: The number of iterations.\n" -" :type num_iterations: int\n" -" :arg factor_point: 0.1\n" -" :type factor_point: float\n" -" :arg factor_curvature: 0.0\n" -" :type factor_curvature: float\n" -" :arg factor_curvature_difference: 0.2\n" -" :type factor_curvature_difference: float\n" -" :arg aniso_point: 0.0\n" -" :type aniso_point: float\n" -" :arg aniso_normal: 0.0\n" -" :type aniso_normal: float\n" -" :arg aniso_curvature: 0.0\n" -" :type aniso_curvature: float\n" -" :arg carricature_factor: 1.0\n" -" :type carricature_factor: float\n" -"\n" -".. method:: shade(stroke)\n" -"\n" -" Smoothes the stroke by moving the vertices to make the stroke\n" -" smoother. Uses curvature flow to converge towards a curve of\n" -" constant curvature. The diffusion method we use is anisotropic to\n" -" prevent the diffusion across corners.\n" -"\n" -" :arg stroke: A Stroke object.\n" -" :type stroke: :class:`freestyle.types.Stroke`\n"; + "Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`SmoothingShader`\n" + "\n" + "[Geometry shader]\n" + "\n" + ".. method:: __init__(num_iterations=100, factor_point=0.1,\n" + " factor_curvature=0.0, factor_curvature_difference=0.2,\n" + " aniso_point=0.0, aniso_normal=0.0, aniso_curvature=0.0,\n" + " carricature_factor=1.0)\n" + "\n" + " Builds a SmoothingShader object.\n" + "\n" + " :arg num_iterations: The number of iterations.\n" + " :type num_iterations: int\n" + " :arg factor_point: 0.1\n" + " :type factor_point: float\n" + " :arg factor_curvature: 0.0\n" + " :type factor_curvature: float\n" + " :arg factor_curvature_difference: 0.2\n" + " :type factor_curvature_difference: float\n" + " :arg aniso_point: 0.0\n" + " :type aniso_point: float\n" + " :arg aniso_normal: 0.0\n" + " :type aniso_normal: float\n" + " :arg aniso_curvature: 0.0\n" + " :type aniso_curvature: float\n" + " :arg carricature_factor: 1.0\n" + " :type carricature_factor: float\n" + "\n" + ".. method:: shade(stroke)\n" + "\n" + " Smoothes the stroke by moving the vertices to make the stroke\n" + " smoother. Uses curvature flow to converge towards a curve of\n" + " constant curvature. The diffusion method we use is anisotropic to\n" + " prevent the diffusion across corners.\n" + "\n" + " :arg stroke: A Stroke object.\n" + " :type stroke: :class:`freestyle.types.Stroke`\n"; static int SmoothingShader___init__(BPy_SmoothingShader *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"num_iterations", "factor_point", "factor_curvature", - "factor_curvature_difference", "aniso_point", "aniso_normal", - "aniso_curvature", "carricature_factor", NULL}; - int i1 = 100; - double d2 = 0.1, d3 = 0.0, d4 = 0.2, d5 = 0.0, d6 = 0.0, d7 = 0.0, d8 = 1.0; + static const char *kwlist[] = {"num_iterations", + "factor_point", + "factor_curvature", + "factor_curvature_difference", + "aniso_point", + "aniso_normal", + "aniso_curvature", + "carricature_factor", + NULL}; + int i1 = 100; + double d2 = 0.1, d3 = 0.0, d4 = 0.2, d5 = 0.0, d6 = 0.0, d7 = 0.0, d8 = 1.0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|iddddddd", (char **)kwlist, - &i1, &d2, &d3, &d4, &d5, &d6, &d7, &d8)) - { - return -1; - } - self->py_ss.ss = new SmoothingShader(i1, d2, d3, d4, d5, d6, d7, d8); - return 0; + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "|iddddddd", (char **)kwlist, &i1, &d2, &d3, &d4, &d5, &d6, &d7, &d8)) { + return -1; + } + self->py_ss.ss = new SmoothingShader(i1, d2, d3, d4, d5, d6, d7, d8); + return 0; } /*-----------------------BPy_SmoothingShader type definition ------------------------------*/ PyTypeObject SmoothingShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SmoothingShader", /* tp_name */ - sizeof(BPy_SmoothingShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - SmoothingShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)SmoothingShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "SmoothingShader", /* tp_name */ + sizeof(BPy_SmoothingShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + SmoothingShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)SmoothingShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.h index 35f046a6d4f..4b553d76770 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SmoothingShader.h @@ -31,19 +31,18 @@ extern "C" { extern PyTypeObject SmoothingShader_Type; -#define BPy_SmoothingShader_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&SmoothingShader_Type)) +#define BPy_SmoothingShader_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&SmoothingShader_Type)) /*---------------------------Python BPy_SmoothingShader structure definition----------*/ typedef struct { - BPy_StrokeShader py_ss; + BPy_StrokeShader py_ss; } BPy_SmoothingShader; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus } #endif - #endif /* __FREESTYLE_PYTHONSMOOTHINGSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp index 5f1c1cb7b0d..f45d97047eb 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp @@ -32,90 +32,100 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char SpatialNoiseShader___doc__[] = -"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`SpatialNoiseShader`\n" -"\n" -"[Geometry shader]\n" -"\n" -".. method:: __init__(amount, scale, num_octaves, smooth, pure_random)\n" -"\n" -" Builds a SpatialNoiseShader object.\n" -"\n" -" :arg amount: The amplitude of the noise.\n" -" :type amount: float\n" -" :arg scale: The noise frequency.\n" -" :type scale: float\n" -" :arg num_octaves: The number of octaves\n" -" :type num_octaves: int\n" -" :arg smooth: True if you want the noise to be smooth.\n" -" :type smooth: bool\n" -" :arg pure_random: True if you don't want any coherence.\n" -" :type pure_random: bool\n" -"\n" -".. method:: shade(stroke)\n" -"\n" -" Spatial Noise stroke shader. Moves the vertices to make the stroke\n" -" more noisy.\n" -"\n" -" :arg stroke: A Stroke object.\n" -" :type stroke: :class:`freestyle.types.Stroke`\n"; + "Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`SpatialNoiseShader`\n" + "\n" + "[Geometry shader]\n" + "\n" + ".. method:: __init__(amount, scale, num_octaves, smooth, pure_random)\n" + "\n" + " Builds a SpatialNoiseShader object.\n" + "\n" + " :arg amount: The amplitude of the noise.\n" + " :type amount: float\n" + " :arg scale: The noise frequency.\n" + " :type scale: float\n" + " :arg num_octaves: The number of octaves\n" + " :type num_octaves: int\n" + " :arg smooth: True if you want the noise to be smooth.\n" + " :type smooth: bool\n" + " :arg pure_random: True if you don't want any coherence.\n" + " :type pure_random: bool\n" + "\n" + ".. method:: shade(stroke)\n" + "\n" + " Spatial Noise stroke shader. Moves the vertices to make the stroke\n" + " more noisy.\n" + "\n" + " :arg stroke: A Stroke object.\n" + " :type stroke: :class:`freestyle.types.Stroke`\n"; -static int SpatialNoiseShader___init__(BPy_SpatialNoiseShader *self, PyObject *args, PyObject *kwds) +static int SpatialNoiseShader___init__(BPy_SpatialNoiseShader *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"amount", "scale", "num_octaves", "smooth", "pure_random", NULL}; - float f1, f2; - int i3; - PyObject *obj4 = 0, *obj5 = 0; + static const char *kwlist[] = {"amount", "scale", "num_octaves", "smooth", "pure_random", NULL}; + float f1, f2; + int i3; + PyObject *obj4 = 0, *obj5 = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "ffiO!O!", (char **)kwlist, - &f1, &f2, &i3, &PyBool_Type, &obj4, &PyBool_Type, &obj5)) - { - return -1; - } - self->py_ss.ss = new SpatialNoiseShader(f1, f2, i3, bool_from_PyBool(obj4), bool_from_PyBool(obj5)); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, + kwds, + "ffiO!O!", + (char **)kwlist, + &f1, + &f2, + &i3, + &PyBool_Type, + &obj4, + &PyBool_Type, + &obj5)) { + return -1; + } + self->py_ss.ss = new SpatialNoiseShader( + f1, f2, i3, bool_from_PyBool(obj4), bool_from_PyBool(obj5)); + return 0; } /*-----------------------BPy_SpatialNoiseShader type definition ------------------------------*/ PyTypeObject SpatialNoiseShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "SpatialNoiseShader", /* tp_name */ - sizeof(BPy_SpatialNoiseShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - SpatialNoiseShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)SpatialNoiseShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "SpatialNoiseShader", /* tp_name */ + sizeof(BPy_SpatialNoiseShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + SpatialNoiseShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)SpatialNoiseShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.h index 73fd0c32f45..7e5e644c46f 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_SpatialNoiseShader.h @@ -31,19 +31,18 @@ extern "C" { extern PyTypeObject SpatialNoiseShader_Type; -#define BPy_SpatialNoiseShader_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&SpatialNoiseShader_Type)) +#define BPy_SpatialNoiseShader_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&SpatialNoiseShader_Type)) /*---------------------------Python BPy_SpatialNoiseShader structure definition----------*/ typedef struct { - BPy_StrokeShader py_ss; + BPy_StrokeShader py_ss; } BPy_SpatialNoiseShader; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus } #endif - #endif /* __FREESTYLE_PYTHON_SPATIALNOISESHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp index 8f7c3728be4..3d76d71bab6 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp @@ -31,76 +31,77 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char StrokeTextureStepShader___doc__[] = -"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`StrokeTextureStepShader`\n" -"\n" -"[Texture shader]\n" -"\n" -".. method:: __init__(step)\n" -"\n" -" Builds a StrokeTextureStepShader object.\n" -"\n" -" :arg step: The spacing along the stroke.\n" -" :type step: float\n" -"\n" -".. method:: shade(stroke)\n" -"\n" -" Assigns a spacing factor to the texture coordinates of the Stroke.\n" -"\n" -" :arg stroke: A Stroke object.\n" -" :type stroke: :class:`freestyle.types.Stroke`\n"; + "Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`StrokeTextureStepShader`\n" + "\n" + "[Texture shader]\n" + "\n" + ".. method:: __init__(step)\n" + "\n" + " Builds a StrokeTextureStepShader object.\n" + "\n" + " :arg step: The spacing along the stroke.\n" + " :type step: float\n" + "\n" + ".. method:: shade(stroke)\n" + "\n" + " Assigns a spacing factor to the texture coordinates of the Stroke.\n" + "\n" + " :arg stroke: A Stroke object.\n" + " :type stroke: :class:`freestyle.types.Stroke`\n"; -static int StrokeTextureStepShader___init__(BPy_StrokeTextureStepShader *self, PyObject *args, PyObject *kwds) +static int StrokeTextureStepShader___init__(BPy_StrokeTextureStepShader *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"step", NULL}; - float step = 0.1; + static const char *kwlist[] = {"step", NULL}; + float step = 0.1; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &step)) - return -1; - self->py_ss.ss = new StrokeShaders::StrokeTextureStepShader(step); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "f", (char **)kwlist, &step)) + return -1; + self->py_ss.ss = new StrokeShaders::StrokeTextureStepShader(step); + return 0; } /*-----------------------BPy_StrokeTextureStepShader type definition ------------------------------*/ PyTypeObject StrokeTextureStepShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "StrokeTextureStepShader", /* tp_name */ - sizeof(BPy_StrokeTextureStepShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - StrokeTextureStepShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)StrokeTextureStepShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "StrokeTextureStepShader", /* tp_name */ + sizeof(BPy_StrokeTextureStepShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + StrokeTextureStepShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)StrokeTextureStepShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.h index 97522da52fd..d53ca139b2b 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureStepShader.h @@ -33,19 +33,18 @@ extern "C" { extern PyTypeObject StrokeTextureStepShader_Type; -#define BPy_StrokeTextureStepShader_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&StrokeTextureStepShader_Type)) +#define BPy_StrokeTextureStepShader_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&StrokeTextureStepShader_Type)) /*---------------------------Python BPy_StrokeTextureStepShader structure definition----------*/ typedef struct { - BPy_StrokeShader py_ss; + BPy_StrokeShader py_ss; } BPy_StrokeTextureStepShader; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus } #endif - #endif /* __FREESTYLE_PYTHON_STROKETEXTURESTEPSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp index 3ba2cec4dae..56f04fb9c88 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp @@ -31,78 +31,79 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ThicknessNoiseShader___doc__[] = -"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`ThicknessNoiseShader`\n" -"\n" -"[Thickness shader]\n" -"\n" -".. method:: __init__(amplitude, period)\n" -"\n" -" Builds a ThicknessNoiseShader object.\n" -"\n" -" :arg amplitude: The amplitude of the noise signal.\n" -" :type amplitude: float\n" -" :arg period: The period of the noise signal.\n" -" :type period: float\n" -"\n" -".. method:: shade(stroke)\n" -"\n" -" Adds some noise to the stroke thickness.\n" -"\n" -" :arg stroke: A Stroke object.\n" -" :type stroke: :class:`freestyle.types.Stroke`\n"; + "Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`ThicknessNoiseShader`\n" + "\n" + "[Thickness shader]\n" + "\n" + ".. method:: __init__(amplitude, period)\n" + "\n" + " Builds a ThicknessNoiseShader object.\n" + "\n" + " :arg amplitude: The amplitude of the noise signal.\n" + " :type amplitude: float\n" + " :arg period: The period of the noise signal.\n" + " :type period: float\n" + "\n" + ".. method:: shade(stroke)\n" + "\n" + " Adds some noise to the stroke thickness.\n" + "\n" + " :arg stroke: A Stroke object.\n" + " :type stroke: :class:`freestyle.types.Stroke`\n"; -static int ThicknessNoiseShader___init__(BPy_ThicknessNoiseShader *self, PyObject *args, PyObject *kwds) +static int ThicknessNoiseShader___init__(BPy_ThicknessNoiseShader *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"amplitude", "period", NULL}; - float f1, f2; + static const char *kwlist[] = {"amplitude", "period", NULL}; + float 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; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "ff", (char **)kwlist, &f1, &f2)) + return -1; + self->py_ss.ss = new StrokeShaders::ThicknessNoiseShader(f1, f2); + return 0; } /*-----------------------BPy_ThicknessNoiseShader type definition ------------------------------*/ PyTypeObject ThicknessNoiseShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ThicknessNoiseShader", /* tp_name */ - sizeof(BPy_ThicknessNoiseShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ThicknessNoiseShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ThicknessNoiseShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "ThicknessNoiseShader", /* tp_name */ + sizeof(BPy_ThicknessNoiseShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ThicknessNoiseShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ThicknessNoiseShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.h index ec18ae24966..1a42985b245 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessNoiseShader.h @@ -31,19 +31,18 @@ extern "C" { extern PyTypeObject ThicknessNoiseShader_Type; -#define BPy_ThicknessNoiseShader_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&ThicknessNoiseShader_Type)) +#define BPy_ThicknessNoiseShader_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&ThicknessNoiseShader_Type)) /*---------------------------Python BPy_ThicknessNoiseShader structure definition----------*/ typedef struct { - BPy_StrokeShader py_ss; + BPy_StrokeShader py_ss; } BPy_ThicknessNoiseShader; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus } #endif - #endif /* __FREESTYLE_PYTHON_THICKNESSNOISESHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp index 1d33aeb559b..3c3c31f4a70 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.cpp @@ -31,77 +31,76 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char TipRemoverShader___doc__[] = -"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`TipRemoverShader`\n" -"\n" -"[Geometry shader]\n" -"\n" -".. method:: __init__(tip_length)\n" -"\n" -" Builds a TipRemoverShader object.\n" -"\n" -" :arg tip_length: The length of the piece of stroke we want to remove\n" -" at each extremity.\n" -" :type tip_length: float\n" -"\n" -".. method:: shade(stroke)\n" -"\n" -" Removes the stroke's extremities.\n" -"\n" -" :arg stroke: A Stroke object.\n" -" :type stroke: :class:`freestyle.types.Stroke`\n"; + "Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`TipRemoverShader`\n" + "\n" + "[Geometry shader]\n" + "\n" + ".. method:: __init__(tip_length)\n" + "\n" + " Builds a TipRemoverShader object.\n" + "\n" + " :arg tip_length: The length of the piece of stroke we want to remove\n" + " at each extremity.\n" + " :type tip_length: float\n" + "\n" + ".. method:: shade(stroke)\n" + "\n" + " Removes the stroke's extremities.\n" + "\n" + " :arg stroke: A Stroke object.\n" + " :type stroke: :class:`freestyle.types.Stroke`\n"; static int TipRemoverShader___init__(BPy_TipRemoverShader *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"tip_length", NULL}; - double d; + static const char *kwlist[] = {"tip_length", NULL}; + double d; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "d", (char **)kwlist, &d)) - return -1; - self->py_ss.ss = new StrokeShaders::TipRemoverShader(d); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "d", (char **)kwlist, &d)) + return -1; + self->py_ss.ss = new StrokeShaders::TipRemoverShader(d); + return 0; } /*-----------------------BPy_TipRemoverShader type definition ------------------------------*/ PyTypeObject TipRemoverShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "TipRemoverShader", /* tp_name */ - sizeof(BPy_TipRemoverShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - TipRemoverShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)TipRemoverShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "TipRemoverShader", /* tp_name */ + sizeof(BPy_TipRemoverShader), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + TipRemoverShader___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &StrokeShader_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)TipRemoverShader___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.h index 9615c4caff8..a82be691c81 100644 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.h +++ b/source/blender/freestyle/intern/python/StrokeShader/BPy_TipRemoverShader.h @@ -31,19 +31,18 @@ extern "C" { extern PyTypeObject TipRemoverShader_Type; -#define BPy_TipRemoverShader_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&TipRemoverShader_Type)) +#define BPy_TipRemoverShader_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&TipRemoverShader_Type)) /*---------------------------Python BPy_TipRemoverShader structure definition----------*/ typedef struct { - BPy_StrokeShader py_ss; + BPy_StrokeShader py_ss; } BPy_TipRemoverShader; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus } #endif - #endif /* __FREESTYLE_PYTHON_TIPREMOVERSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp index ebd67c124ea..2b3aaf6f3cd 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp @@ -44,165 +44,169 @@ extern "C" { int UnaryFunction0DDouble_Init(PyObject *module) { - if (module == NULL) - return -1; - - 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) - return -1; - Py_INCREF(&DensityF0D_Type); - PyModule_AddObject(module, "DensityF0D", (PyObject *)&DensityF0D_Type); - - 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) - return -1; - Py_INCREF(&Curvature2DAngleF0D_Type); - PyModule_AddObject(module, "Curvature2DAngleF0D", (PyObject *)&Curvature2DAngleF0D_Type); - - 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) - return -1; - Py_INCREF(&GetProjectedYF0D_Type); - PyModule_AddObject(module, "GetProjectedYF0D", (PyObject *)&GetProjectedYF0D_Type); - - 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) - return -1; - Py_INCREF(&GetXF0D_Type); - PyModule_AddObject(module, "GetXF0D", (PyObject *)&GetXF0D_Type); - - 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) - return -1; - Py_INCREF(&GetZF0D_Type); - PyModule_AddObject(module, "GetZF0D", (PyObject *)&GetZF0D_Type); - - if (PyType_Ready(&ZDiscontinuityF0D_Type) < 0) - return -1; - Py_INCREF(&ZDiscontinuityF0D_Type); - PyModule_AddObject(module, "ZDiscontinuityF0D", (PyObject *)&ZDiscontinuityF0D_Type); - - return 0; + if (module == NULL) + return -1; + + 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) + return -1; + Py_INCREF(&DensityF0D_Type); + PyModule_AddObject(module, "DensityF0D", (PyObject *)&DensityF0D_Type); + + 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) + return -1; + Py_INCREF(&Curvature2DAngleF0D_Type); + PyModule_AddObject(module, "Curvature2DAngleF0D", (PyObject *)&Curvature2DAngleF0D_Type); + + 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) + return -1; + Py_INCREF(&GetProjectedYF0D_Type); + PyModule_AddObject(module, "GetProjectedYF0D", (PyObject *)&GetProjectedYF0D_Type); + + 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) + return -1; + Py_INCREF(&GetXF0D_Type); + PyModule_AddObject(module, "GetXF0D", (PyObject *)&GetXF0D_Type); + + 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) + return -1; + Py_INCREF(&GetZF0D_Type); + PyModule_AddObject(module, "GetZF0D", (PyObject *)&GetZF0D_Type); + + if (PyType_Ready(&ZDiscontinuityF0D_Type) < 0) + return -1; + Py_INCREF(&ZDiscontinuityF0D_Type); + PyModule_AddObject(module, "ZDiscontinuityF0D", (PyObject *)&ZDiscontinuityF0D_Type); + + return 0; } //------------------------INSTANCE METHODS ---------------------------------- static char UnaryFunction0DDouble___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DDouble`\n" -"\n" -"Base class for unary functions (functors) that work on\n" -":class:`Interface0DIterator` and return a float value.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n"; - -static int UnaryFunction0DDouble___init__(BPy_UnaryFunction0DDouble *self, PyObject *args, PyObject *kwds) + "Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DDouble`\n" + "\n" + "Base class for unary functions (functors) that work on\n" + ":class:`Interface0DIterator` and return a float value.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n"; + +static int UnaryFunction0DDouble___init__(BPy_UnaryFunction0DDouble *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->uf0D_double = new UnaryFunction0D(); - self->uf0D_double->py_uf0D = (PyObject *)self; - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->uf0D_double = new UnaryFunction0D(); + self->uf0D_double->py_uf0D = (PyObject *)self; + return 0; } static void UnaryFunction0DDouble___dealloc__(BPy_UnaryFunction0DDouble *self) { - if (self->uf0D_double) - delete self->uf0D_double; - UnaryFunction0D_Type.tp_dealloc((PyObject *)self); + if (self->uf0D_double) + delete self->uf0D_double; + UnaryFunction0D_Type.tp_dealloc((PyObject *)self); } static PyObject *UnaryFunction0DDouble___repr__(BPy_UnaryFunction0DDouble *self) { - return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_double); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_double); } -static PyObject *UnaryFunction0DDouble___call__(BPy_UnaryFunction0DDouble *self, PyObject *args, PyObject *kwds) +static PyObject *UnaryFunction0DDouble___call__(BPy_UnaryFunction0DDouble *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"it", NULL}; - PyObject *obj; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) - return NULL; - - if (typeid(*(self->uf0D_double)) == typeid(UnaryFunction0D)) { - PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; - } - if (self->uf0D_double->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { - if (!PyErr_Occurred()) { - string class_name(Py_TYPE(self)->tp_name); - PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); - } - return NULL; - } - return PyFloat_FromDouble(self->uf0D_double->result); + static const char *kwlist[] = {"it", NULL}; + PyObject *obj; + + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) + return NULL; + + if (typeid(*(self->uf0D_double)) == typeid(UnaryFunction0D)) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->uf0D_double->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { + if (!PyErr_Occurred()) { + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); + } + return NULL; + } + return PyFloat_FromDouble(self->uf0D_double->result); } /*-----------------------BPy_UnaryFunction0DDouble type definition ------------------------------*/ PyTypeObject UnaryFunction0DDouble_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction0DDouble", /* tp_name */ - sizeof(BPy_UnaryFunction0DDouble), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DDouble___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DDouble___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DDouble___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction0DDouble___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DDouble___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction0DDouble", /* tp_name */ + sizeof(BPy_UnaryFunction0DDouble), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DDouble___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction0DDouble___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction0DDouble___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DDouble___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DDouble___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.h index b31297394e6..8abccd27591 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.h @@ -31,18 +31,18 @@ extern "C" { extern PyTypeObject UnaryFunction0DDouble_Type; -#define BPy_UnaryFunction0DDouble_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction0DDouble_Type)) +#define BPy_UnaryFunction0DDouble_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction0DDouble_Type)) /*---------------------------Python BPy_UnaryFunction0DDouble structure definition----------*/ typedef struct { - BPy_UnaryFunction0D py_uf0D; - UnaryFunction0D *uf0D_double; + BPy_UnaryFunction0D py_uf0D; + UnaryFunction0D *uf0D_double; } BPy_UnaryFunction0DDouble; /*---------------------------Python BPy_UnaryFunction0DDouble visible prototypes-----------*/ int UnaryFunction0DDouble_Init(PyObject *module); - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp index 816fd622927..76dbe2ef023 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp @@ -35,121 +35,126 @@ extern "C" { int UnaryFunction0DEdgeNature_Init(PyObject *module) { - if (module == NULL) - return -1; + if (module == NULL) + return -1; - if (PyType_Ready(&UnaryFunction0DEdgeNature_Type) < 0) - return -1; - Py_INCREF(&UnaryFunction0DEdgeNature_Type); - PyModule_AddObject(module, "UnaryFunction0DEdgeNature", (PyObject *)&UnaryFunction0DEdgeNature_Type); + 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) - return -1; - Py_INCREF(&CurveNatureF0D_Type); - PyModule_AddObject(module, "CurveNatureF0D", (PyObject *)&CurveNatureF0D_Type); + if (PyType_Ready(&CurveNatureF0D_Type) < 0) + return -1; + Py_INCREF(&CurveNatureF0D_Type); + PyModule_AddObject(module, "CurveNatureF0D", (PyObject *)&CurveNatureF0D_Type); - return 0; + return 0; } //------------------------INSTANCE METHODS ---------------------------------- static char UnaryFunction0DEdgeNature___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DEdgeNature`\n" -"\n" -"Base class for unary functions (functors) that work on\n" -":class:`Interface0DIterator` and return a :class:`Nature` object.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n"; - -static int UnaryFunction0DEdgeNature___init__(BPy_UnaryFunction0DEdgeNature *self, PyObject *args, PyObject *kwds) + "Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DEdgeNature`\n" + "\n" + "Base class for unary functions (functors) that work on\n" + ":class:`Interface0DIterator` and return a :class:`Nature` object.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n"; + +static int UnaryFunction0DEdgeNature___init__(BPy_UnaryFunction0DEdgeNature *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->uf0D_edgenature = new UnaryFunction0D(); - self->uf0D_edgenature->py_uf0D = (PyObject *)self; - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->uf0D_edgenature = new UnaryFunction0D(); + self->uf0D_edgenature->py_uf0D = (PyObject *)self; + return 0; } static void UnaryFunction0DEdgeNature___dealloc__(BPy_UnaryFunction0DEdgeNature *self) { - if (self->uf0D_edgenature) - delete self->uf0D_edgenature; - UnaryFunction0D_Type.tp_dealloc((PyObject *)self); + if (self->uf0D_edgenature) + delete self->uf0D_edgenature; + UnaryFunction0D_Type.tp_dealloc((PyObject *)self); } static PyObject *UnaryFunction0DEdgeNature___repr__(BPy_UnaryFunction0DEdgeNature *self) { - return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_edgenature); + return PyUnicode_FromFormat( + "type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_edgenature); } static PyObject *UnaryFunction0DEdgeNature___call__(BPy_UnaryFunction0DEdgeNature *self, - PyObject *args, PyObject *kwds) + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"it", NULL}; - PyObject *obj; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) - return NULL; - - if (typeid(*(self->uf0D_edgenature)) == typeid(UnaryFunction0D)) { - PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; - } - if (self->uf0D_edgenature->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { - if (!PyErr_Occurred()) { - string class_name(Py_TYPE(self)->tp_name); - PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); - } - return NULL; - } - return BPy_Nature_from_Nature(self->uf0D_edgenature->result); + static const char *kwlist[] = {"it", NULL}; + PyObject *obj; + + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) + return NULL; + + if (typeid(*(self->uf0D_edgenature)) == typeid(UnaryFunction0D)) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->uf0D_edgenature->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { + if (!PyErr_Occurred()) { + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); + } + return NULL; + } + return BPy_Nature_from_Nature(self->uf0D_edgenature->result); } /*-----------------------BPy_UnaryFunction0DEdgeNature type definition ------------------------------*/ PyTypeObject UnaryFunction0DEdgeNature_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction0DEdgeNature", /* tp_name */ - sizeof(BPy_UnaryFunction0DEdgeNature), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DEdgeNature___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DEdgeNature___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DEdgeNature___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction0DEdgeNature___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DEdgeNature___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction0DEdgeNature", /* tp_name */ + sizeof(BPy_UnaryFunction0DEdgeNature), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DEdgeNature___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction0DEdgeNature___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction0DEdgeNature___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DEdgeNature___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DEdgeNature___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.h index f178c8eff39..5a92142c88a 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.h @@ -34,18 +34,17 @@ extern "C" { extern PyTypeObject UnaryFunction0DEdgeNature_Type; #define BPy_UnaryFunction0DEdgeNature_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction0DEdgeNature_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction0DEdgeNature_Type)) /*---------------------------Python BPy_UnaryFunction0DEdgeNature structure definition----------*/ typedef struct { - BPy_UnaryFunction0D py_uf0D; - UnaryFunction0D *uf0D_edgenature; + BPy_UnaryFunction0D py_uf0D; + UnaryFunction0D *uf0D_edgenature; } BPy_UnaryFunction0DEdgeNature; /*---------------------------Python BPy_UnaryFunction0DEdgeNature visible prototypes-----------*/ int UnaryFunction0DEdgeNature_Init(PyObject *module); - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp index 4ee2057bafa..150b8f4e553 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp @@ -40,145 +40,153 @@ extern "C" { int UnaryFunction0DFloat_Init(PyObject *module) { - if (module == NULL) - return -1; - - 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) - return -1; - Py_INCREF(&GetCurvilinearAbscissaF0D_Type); - PyModule_AddObject(module, "GetCurvilinearAbscissaF0D", (PyObject *)&GetCurvilinearAbscissaF0D_Type); - - 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) - return -1; - Py_INCREF(&GetViewMapGradientNormF0D_Type); - PyModule_AddObject(module, "GetViewMapGradientNormF0D", (PyObject *)&GetViewMapGradientNormF0D_Type); - - 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) - return -1; - Py_INCREF(&ReadMapPixelF0D_Type); - PyModule_AddObject(module, "ReadMapPixelF0D", (PyObject *)&ReadMapPixelF0D_Type); - - if (PyType_Ready(&ReadSteerableViewMapPixelF0D_Type) < 0) - return -1; - Py_INCREF(&ReadSteerableViewMapPixelF0D_Type); - PyModule_AddObject(module, "ReadSteerableViewMapPixelF0D", (PyObject *)&ReadSteerableViewMapPixelF0D_Type); - - return 0; + if (module == NULL) + return -1; + + 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) + return -1; + Py_INCREF(&GetCurvilinearAbscissaF0D_Type); + PyModule_AddObject( + module, "GetCurvilinearAbscissaF0D", (PyObject *)&GetCurvilinearAbscissaF0D_Type); + + 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) + return -1; + Py_INCREF(&GetViewMapGradientNormF0D_Type); + PyModule_AddObject( + module, "GetViewMapGradientNormF0D", (PyObject *)&GetViewMapGradientNormF0D_Type); + + 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) + return -1; + Py_INCREF(&ReadMapPixelF0D_Type); + PyModule_AddObject(module, "ReadMapPixelF0D", (PyObject *)&ReadMapPixelF0D_Type); + + if (PyType_Ready(&ReadSteerableViewMapPixelF0D_Type) < 0) + return -1; + Py_INCREF(&ReadSteerableViewMapPixelF0D_Type); + PyModule_AddObject( + module, "ReadSteerableViewMapPixelF0D", (PyObject *)&ReadSteerableViewMapPixelF0D_Type); + + return 0; } //------------------------INSTANCE METHODS ---------------------------------- static char UnaryFunction0DFloat___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DFloat`\n" -"\n" -"Base class for unary functions (functors) that work on\n" -":class:`Interface0DIterator` and return a float value.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n"; - -static int UnaryFunction0DFloat___init__(BPy_UnaryFunction0DFloat *self, PyObject *args, PyObject *kwds) + "Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DFloat`\n" + "\n" + "Base class for unary functions (functors) that work on\n" + ":class:`Interface0DIterator` and return a float value.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n"; + +static int UnaryFunction0DFloat___init__(BPy_UnaryFunction0DFloat *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->uf0D_float = new UnaryFunction0D(); - self->uf0D_float->py_uf0D = (PyObject *)self; - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->uf0D_float = new UnaryFunction0D(); + self->uf0D_float->py_uf0D = (PyObject *)self; + return 0; } static void UnaryFunction0DFloat___dealloc__(BPy_UnaryFunction0DFloat *self) { - if (self->uf0D_float) - delete self->uf0D_float; - UnaryFunction0D_Type.tp_dealloc((PyObject *)self); + if (self->uf0D_float) + delete self->uf0D_float; + UnaryFunction0D_Type.tp_dealloc((PyObject *)self); } static PyObject *UnaryFunction0DFloat___repr__(BPy_UnaryFunction0DFloat *self) { - return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_float); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_float); } -static PyObject *UnaryFunction0DFloat___call__(BPy_UnaryFunction0DFloat *self, PyObject *args, PyObject *kwds) +static PyObject *UnaryFunction0DFloat___call__(BPy_UnaryFunction0DFloat *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"it", NULL}; - PyObject *obj; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) - return NULL; - - if (typeid(*(self->uf0D_float)) == typeid(UnaryFunction0D)) { - PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; - } - if (self->uf0D_float->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { - if (!PyErr_Occurred()) { - string class_name(Py_TYPE(self)->tp_name); - PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); - } - return NULL; - } - return PyFloat_FromDouble(self->uf0D_float->result); + static const char *kwlist[] = {"it", NULL}; + PyObject *obj; + + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) + return NULL; + + if (typeid(*(self->uf0D_float)) == typeid(UnaryFunction0D)) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->uf0D_float->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { + if (!PyErr_Occurred()) { + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); + } + return NULL; + } + return PyFloat_FromDouble(self->uf0D_float->result); } /*-----------------------BPy_UnaryFunction0DFloat type definition ------------------------------*/ PyTypeObject UnaryFunction0DFloat_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction0DFloat", /* tp_name */ - sizeof(BPy_UnaryFunction0DFloat), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DFloat___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DFloat___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DFloat___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction0DFloat___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DFloat___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction0DFloat", /* tp_name */ + sizeof(BPy_UnaryFunction0DFloat), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DFloat___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction0DFloat___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction0DFloat___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DFloat___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DFloat___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.h index a36b6046a6f..53dc88d0e21 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DFloat.h @@ -31,18 +31,18 @@ extern "C" { extern PyTypeObject UnaryFunction0DFloat_Type; -#define BPy_UnaryFunction0DFloat_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction0DFloat_Type)) +#define BPy_UnaryFunction0DFloat_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction0DFloat_Type)) /*---------------------------Python BPy_UnaryFunction0DFloat structure definition----------*/ typedef struct { - BPy_UnaryFunction0D py_uf0D; - UnaryFunction0D *uf0D_float; + BPy_UnaryFunction0D py_uf0D; + UnaryFunction0D *uf0D_float; } BPy_UnaryFunction0DFloat; /*---------------------------Python BPy_UnaryFunction0DFloat visible prototypes-----------*/ int UnaryFunction0DFloat_Init(PyObject *module); - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp index 43f73a3fedc..e9455f3dd39 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.cpp @@ -35,120 +35,122 @@ extern "C" { int UnaryFunction0DId_Init(PyObject *module) { - if (module == NULL) - return -1; + if (module == NULL) + return -1; - if (PyType_Ready(&UnaryFunction0DId_Type) < 0) - return -1; - Py_INCREF(&UnaryFunction0DId_Type); - PyModule_AddObject(module, "UnaryFunction0DId", (PyObject *)&UnaryFunction0DId_Type); + 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) - return -1; - Py_INCREF(&ShapeIdF0D_Type); - PyModule_AddObject(module, "ShapeIdF0D", (PyObject *)&ShapeIdF0D_Type); + if (PyType_Ready(&ShapeIdF0D_Type) < 0) + return -1; + Py_INCREF(&ShapeIdF0D_Type); + PyModule_AddObject(module, "ShapeIdF0D", (PyObject *)&ShapeIdF0D_Type); - return 0; + return 0; } //------------------------INSTANCE METHODS ---------------------------------- static char UnaryFunction0DId___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DId`\n" -"\n" -"Base class for unary functions (functors) that work on\n" -":class:`Interface0DIterator` and return an :class:`Id` object.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n"; + "Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DId`\n" + "\n" + "Base class for unary functions (functors) that work on\n" + ":class:`Interface0DIterator` and return an :class:`Id` object.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n"; static int UnaryFunction0DId___init__(BPy_UnaryFunction0DId *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->uf0D_id = new UnaryFunction0D(); - self->uf0D_id->py_uf0D = (PyObject *)self; - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->uf0D_id = new UnaryFunction0D(); + self->uf0D_id->py_uf0D = (PyObject *)self; + return 0; } static void UnaryFunction0DId___dealloc__(BPy_UnaryFunction0DId *self) { - if (self->uf0D_id) - delete self->uf0D_id; - UnaryFunction0D_Type.tp_dealloc((PyObject *)self); + if (self->uf0D_id) + delete self->uf0D_id; + UnaryFunction0D_Type.tp_dealloc((PyObject *)self); } static PyObject *UnaryFunction0DId___repr__(BPy_UnaryFunction0DId *self) { - return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_id); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_id); } -static PyObject *UnaryFunction0DId___call__(BPy_UnaryFunction0DId *self, PyObject *args, PyObject *kwds) +static PyObject *UnaryFunction0DId___call__(BPy_UnaryFunction0DId *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"it", NULL}; - PyObject *obj; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) - return NULL; - - if (typeid(*(self->uf0D_id)) == typeid(UnaryFunction0D)) { - PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; - } - if (self->uf0D_id->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { - if (!PyErr_Occurred()) { - string class_name(Py_TYPE(self)->tp_name); - PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); - } - return NULL; - } - return BPy_Id_from_Id(self->uf0D_id->result); + static const char *kwlist[] = {"it", NULL}; + PyObject *obj; + + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) + return NULL; + + if (typeid(*(self->uf0D_id)) == typeid(UnaryFunction0D)) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->uf0D_id->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { + if (!PyErr_Occurred()) { + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); + } + return NULL; + } + return BPy_Id_from_Id(self->uf0D_id->result); } /*-----------------------BPy_UnaryFunction0DId type definition ------------------------------*/ PyTypeObject UnaryFunction0DId_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction0DId", /* tp_name */ - sizeof(BPy_UnaryFunction0DId), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DId___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DId___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DId___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction0DId___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DId___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction0DId", /* tp_name */ + sizeof(BPy_UnaryFunction0DId), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DId___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction0DId___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction0DId___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DId___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DId___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.h index b0c07db56e8..a8887b081ce 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DId.h @@ -33,18 +33,18 @@ extern "C" { extern PyTypeObject UnaryFunction0DId_Type; -#define BPy_UnaryFunction0DId_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction0DId_Type)) +#define BPy_UnaryFunction0DId_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction0DId_Type)) /*---------------------------Python BPy_UnaryFunction0DId structure definition----------*/ typedef struct { - BPy_UnaryFunction0D py_uf0D; - UnaryFunction0D *uf0D_id; + BPy_UnaryFunction0D py_uf0D; + UnaryFunction0D *uf0D_id; } BPy_UnaryFunction0DId; /*---------------------------Python BPy_UnaryFunction0DId visible prototypes-----------*/ int UnaryFunction0DId_Init(PyObject *module); - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp index 1cfdcd23ad6..a375ac506f0 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp @@ -35,120 +35,125 @@ extern "C" { int UnaryFunction0DMaterial_Init(PyObject *module) { - if (module == NULL) - return -1; + if (module == NULL) + return -1; - if (PyType_Ready(&UnaryFunction0DMaterial_Type) < 0) - return -1; - Py_INCREF(&UnaryFunction0DMaterial_Type); - PyModule_AddObject(module, "UnaryFunction0DMaterial", (PyObject *)&UnaryFunction0DMaterial_Type); + 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) - return -1; - Py_INCREF(&MaterialF0D_Type); - PyModule_AddObject(module, "MaterialF0D", (PyObject *)&MaterialF0D_Type); + if (PyType_Ready(&MaterialF0D_Type) < 0) + return -1; + Py_INCREF(&MaterialF0D_Type); + PyModule_AddObject(module, "MaterialF0D", (PyObject *)&MaterialF0D_Type); - return 0; + return 0; } //------------------------INSTANCE METHODS ---------------------------------- static char UnaryFunction0DMaterial___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DMaterial`\n" -"\n" -"Base class for unary functions (functors) that work on\n" -":class:`Interface0DIterator` and return a :class:`Material` object.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n"; - -static int UnaryFunction0DMaterial___init__(BPy_UnaryFunction0DMaterial *self, PyObject *args, PyObject *kwds) + "Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DMaterial`\n" + "\n" + "Base class for unary functions (functors) that work on\n" + ":class:`Interface0DIterator` and return a :class:`Material` object.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n"; + +static int UnaryFunction0DMaterial___init__(BPy_UnaryFunction0DMaterial *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->uf0D_material = new UnaryFunction0D(); - self->uf0D_material->py_uf0D = (PyObject *)self; - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->uf0D_material = new UnaryFunction0D(); + self->uf0D_material->py_uf0D = (PyObject *)self; + return 0; } static void UnaryFunction0DMaterial___dealloc__(BPy_UnaryFunction0DMaterial *self) { - if (self->uf0D_material) - delete self->uf0D_material; - UnaryFunction0D_Type.tp_dealloc((PyObject *)self); + if (self->uf0D_material) + delete self->uf0D_material; + UnaryFunction0D_Type.tp_dealloc((PyObject *)self); } static PyObject *UnaryFunction0DMaterial___repr__(BPy_UnaryFunction0DMaterial *self) { - return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_material); + return PyUnicode_FromFormat( + "type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_material); } -static PyObject *UnaryFunction0DMaterial___call__(BPy_UnaryFunction0DMaterial *self, PyObject *args, PyObject *kwds) +static PyObject *UnaryFunction0DMaterial___call__(BPy_UnaryFunction0DMaterial *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"it", NULL}; - PyObject *obj; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) - return NULL; - - if (typeid(*(self->uf0D_material)) == typeid(UnaryFunction0D)) { - PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; - } - if (self->uf0D_material->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { - if (!PyErr_Occurred()) { - string class_name(Py_TYPE(self)->tp_name); - PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); - } - return NULL; - } - return BPy_FrsMaterial_from_FrsMaterial(self->uf0D_material->result); + static const char *kwlist[] = {"it", NULL}; + PyObject *obj; + + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) + return NULL; + + if (typeid(*(self->uf0D_material)) == typeid(UnaryFunction0D)) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->uf0D_material->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { + if (!PyErr_Occurred()) { + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); + } + return NULL; + } + return BPy_FrsMaterial_from_FrsMaterial(self->uf0D_material->result); } /*-----------------------BPy_UnaryFunction0DMaterial type definition ------------------------------*/ PyTypeObject UnaryFunction0DMaterial_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction0DMaterial", /* tp_name */ - sizeof(BPy_UnaryFunction0DMaterial), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DMaterial___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DMaterial___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DMaterial___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction0DMaterial___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DMaterial___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction0DMaterial", /* tp_name */ + sizeof(BPy_UnaryFunction0DMaterial), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DMaterial___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction0DMaterial___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction0DMaterial___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DMaterial___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DMaterial___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.h index 53035601ef2..558719032f8 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DMaterial.h @@ -34,18 +34,17 @@ extern "C" { extern PyTypeObject UnaryFunction0DMaterial_Type; #define BPy_UnaryFunction0DMaterial_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction0DMaterial_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction0DMaterial_Type)) /*---------------------------Python BPy_UnaryFunction0DMaterial structure definition----------*/ typedef struct { - BPy_UnaryFunction0D py_uf0D; - UnaryFunction0D *uf0D_material; + BPy_UnaryFunction0D py_uf0D; + UnaryFunction0D *uf0D_material; } BPy_UnaryFunction0DMaterial; /*---------------------------Python BPy_UnaryFunction0DMaterial visible prototypes-----------*/ int UnaryFunction0DMaterial_Init(PyObject *module); - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp index 3aa1edb70a8..756e5cde3ce 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp @@ -35,120 +35,126 @@ extern "C" { int UnaryFunction0DUnsigned_Init(PyObject *module) { - if (module == NULL) - return -1; + if (module == NULL) + return -1; - if (PyType_Ready(&UnaryFunction0DUnsigned_Type) < 0) - return -1; - Py_INCREF(&UnaryFunction0DUnsigned_Type); - PyModule_AddObject(module, "UnaryFunction0DUnsigned", (PyObject *)&UnaryFunction0DUnsigned_Type); + 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) - return -1; - Py_INCREF(&QuantitativeInvisibilityF0D_Type); - PyModule_AddObject(module, "QuantitativeInvisibilityF0D", (PyObject *)&QuantitativeInvisibilityF0D_Type); + if (PyType_Ready(&QuantitativeInvisibilityF0D_Type) < 0) + return -1; + Py_INCREF(&QuantitativeInvisibilityF0D_Type); + PyModule_AddObject( + module, "QuantitativeInvisibilityF0D", (PyObject *)&QuantitativeInvisibilityF0D_Type); - return 0; + return 0; } //------------------------INSTANCE METHODS ---------------------------------- static char UnaryFunction0DUnsigned___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DUnsigned`\n" -"\n" -"Base class for unary functions (functors) that work on\n" -":class:`Interface0DIterator` and return an int value.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n"; - -static int UnaryFunction0DUnsigned___init__(BPy_UnaryFunction0DUnsigned *self, PyObject *args, PyObject *kwds) + "Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DUnsigned`\n" + "\n" + "Base class for unary functions (functors) that work on\n" + ":class:`Interface0DIterator` and return an int value.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n"; + +static int UnaryFunction0DUnsigned___init__(BPy_UnaryFunction0DUnsigned *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->uf0D_unsigned = new UnaryFunction0D(); - self->uf0D_unsigned->py_uf0D = (PyObject *)self; - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->uf0D_unsigned = new UnaryFunction0D(); + self->uf0D_unsigned->py_uf0D = (PyObject *)self; + return 0; } static void UnaryFunction0DUnsigned___dealloc__(BPy_UnaryFunction0DUnsigned *self) { - if (self->uf0D_unsigned) - delete self->uf0D_unsigned; - UnaryFunction0D_Type.tp_dealloc((PyObject *)self); + if (self->uf0D_unsigned) + delete self->uf0D_unsigned; + UnaryFunction0D_Type.tp_dealloc((PyObject *)self); } static PyObject *UnaryFunction0DUnsigned___repr__(BPy_UnaryFunction0DUnsigned *self) { - return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_unsigned); + return PyUnicode_FromFormat( + "type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_unsigned); } -static PyObject *UnaryFunction0DUnsigned___call__(BPy_UnaryFunction0DUnsigned *self, PyObject *args, PyObject *kwds) +static PyObject *UnaryFunction0DUnsigned___call__(BPy_UnaryFunction0DUnsigned *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"it", NULL}; - PyObject *obj; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) - return NULL; - - if (typeid(*(self->uf0D_unsigned)) == typeid(UnaryFunction0D)) { - PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; - } - if (self->uf0D_unsigned->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { - if (!PyErr_Occurred()) { - string class_name(Py_TYPE(self)->tp_name); - PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); - } - return NULL; - } - return PyLong_FromLong(self->uf0D_unsigned->result); + static const char *kwlist[] = {"it", NULL}; + PyObject *obj; + + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) + return NULL; + + if (typeid(*(self->uf0D_unsigned)) == typeid(UnaryFunction0D)) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->uf0D_unsigned->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { + if (!PyErr_Occurred()) { + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); + } + return NULL; + } + return PyLong_FromLong(self->uf0D_unsigned->result); } /*-----------------------BPy_UnaryFunction0DUnsigned type definition ------------------------------*/ PyTypeObject UnaryFunction0DUnsigned_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction0DUnsigned", /* tp_name */ - sizeof(BPy_UnaryFunction0DUnsigned), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DUnsigned___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DUnsigned___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DUnsigned___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction0DUnsigned___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DUnsigned___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction0DUnsigned", /* tp_name */ + sizeof(BPy_UnaryFunction0DUnsigned), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DUnsigned___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction0DUnsigned___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction0DUnsigned___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DUnsigned___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DUnsigned___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.h index 3205a2a01dc..ac09b51eceb 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.h @@ -32,18 +32,17 @@ extern "C" { extern PyTypeObject UnaryFunction0DUnsigned_Type; #define BPy_UnaryFunction0DUnsigned_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction0DUnsigned_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction0DUnsigned_Type)) /*---------------------------Python BPy_UnaryFunction0DUnsigned structure definition----------*/ typedef struct { - BPy_UnaryFunction0D py_uf0D; - UnaryFunction0D *uf0D_unsigned; + BPy_UnaryFunction0D py_uf0D; + UnaryFunction0D *uf0D_unsigned; } BPy_UnaryFunction0DUnsigned; /*---------------------------Python BPy_UnaryFunction0DUnsigned visible prototypes-----------*/ int UnaryFunction0DUnsigned_Init(PyObject *module); - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp index 025d2801fbf..48cb3453ea8 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp @@ -36,125 +36,129 @@ extern "C" { int UnaryFunction0DVec2f_Init(PyObject *module) { - if (module == NULL) - return -1; + if (module == NULL) + return -1; - if (PyType_Ready(&UnaryFunction0DVec2f_Type) < 0) - return -1; - Py_INCREF(&UnaryFunction0DVec2f_Type); - PyModule_AddObject(module, "UnaryFunction0DVec2f", (PyObject *)&UnaryFunction0DVec2f_Type); + 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) - return -1; - Py_INCREF(&Normal2DF0D_Type); - PyModule_AddObject(module, "Normal2DF0D", (PyObject *)&Normal2DF0D_Type); + 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) - return -1; - Py_INCREF(&VertexOrientation2DF0D_Type); - PyModule_AddObject(module, "VertexOrientation2DF0D", (PyObject *)&VertexOrientation2DF0D_Type); + if (PyType_Ready(&VertexOrientation2DF0D_Type) < 0) + return -1; + Py_INCREF(&VertexOrientation2DF0D_Type); + PyModule_AddObject(module, "VertexOrientation2DF0D", (PyObject *)&VertexOrientation2DF0D_Type); - return 0; + return 0; } //------------------------INSTANCE METHODS ---------------------------------- static char UnaryFunction0DVec2f___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DVec2f`\n" -"\n" -"Base class for unary functions (functors) that work on\n" -":class:`Interface0DIterator` and return a 2D vector.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n"; - -static int UnaryFunction0DVec2f___init__(BPy_UnaryFunction0DVec2f *self, PyObject *args, PyObject *kwds) + "Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DVec2f`\n" + "\n" + "Base class for unary functions (functors) that work on\n" + ":class:`Interface0DIterator` and return a 2D vector.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n"; + +static int UnaryFunction0DVec2f___init__(BPy_UnaryFunction0DVec2f *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->uf0D_vec2f = new UnaryFunction0D(); - self->uf0D_vec2f->py_uf0D = (PyObject *)self; - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->uf0D_vec2f = new UnaryFunction0D(); + self->uf0D_vec2f->py_uf0D = (PyObject *)self; + return 0; } static void UnaryFunction0DVec2f___dealloc__(BPy_UnaryFunction0DVec2f *self) { - if (self->uf0D_vec2f) - delete self->uf0D_vec2f; - UnaryFunction0D_Type.tp_dealloc((PyObject *)self); + if (self->uf0D_vec2f) + delete self->uf0D_vec2f; + UnaryFunction0D_Type.tp_dealloc((PyObject *)self); } static PyObject *UnaryFunction0DVec2f___repr__(BPy_UnaryFunction0DVec2f *self) { - return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_vec2f); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_vec2f); } -static PyObject *UnaryFunction0DVec2f___call__(BPy_UnaryFunction0DVec2f *self, PyObject *args, PyObject *kwds) +static PyObject *UnaryFunction0DVec2f___call__(BPy_UnaryFunction0DVec2f *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"it", NULL}; - PyObject *obj; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) - return NULL; - - if (typeid(*(self->uf0D_vec2f)) == typeid(UnaryFunction0D)) { - PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; - } - if (self->uf0D_vec2f->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { - if (!PyErr_Occurred()) { - string class_name(Py_TYPE(self)->tp_name); - PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); - } - return NULL; - } - return Vector_from_Vec2f(self->uf0D_vec2f->result); + static const char *kwlist[] = {"it", NULL}; + PyObject *obj; + + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) + return NULL; + + if (typeid(*(self->uf0D_vec2f)) == typeid(UnaryFunction0D)) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->uf0D_vec2f->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { + if (!PyErr_Occurred()) { + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); + } + return NULL; + } + return Vector_from_Vec2f(self->uf0D_vec2f->result); } /*-----------------------BPy_UnaryFunction0DVec2f type definition ------------------------------*/ PyTypeObject UnaryFunction0DVec2f_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction0DVec2f", /* tp_name */ - sizeof(BPy_UnaryFunction0DVec2f), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DVec2f___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DVec2f___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DVec2f___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction0DVec2f___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DVec2f___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction0DVec2f", /* tp_name */ + sizeof(BPy_UnaryFunction0DVec2f), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DVec2f___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction0DVec2f___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction0DVec2f___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DVec2f___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DVec2f___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.h index 974298c290b..1639e1a5356 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec2f.h @@ -34,18 +34,18 @@ extern "C" { extern PyTypeObject UnaryFunction0DVec2f_Type; -#define BPy_UnaryFunction0DVec2f_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction0DVec2f_Type)) +#define BPy_UnaryFunction0DVec2f_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction0DVec2f_Type)) /*---------------------------Python BPy_UnaryFunction0DVec2f structure definition----------*/ typedef struct { - BPy_UnaryFunction0D py_uf0D; - UnaryFunction0D *uf0D_vec2f; + BPy_UnaryFunction0D py_uf0D; + UnaryFunction0D *uf0D_vec2f; } BPy_UnaryFunction0DVec2f; /*---------------------------Python BPy_UnaryFunction0DVec2f visible prototypes-----------*/ int UnaryFunction0DVec2f_Init(PyObject *module); - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp index 53b3610ea2d..6b12136693f 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp @@ -35,120 +35,124 @@ extern "C" { int UnaryFunction0DVec3f_Init(PyObject *module) { - if (module == NULL) - return -1; + if (module == NULL) + return -1; - if (PyType_Ready(&UnaryFunction0DVec3f_Type) < 0) - return -1; - Py_INCREF(&UnaryFunction0DVec3f_Type); - PyModule_AddObject(module, "UnaryFunction0DVec3f", (PyObject *)&UnaryFunction0DVec3f_Type); + 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) - return -1; - Py_INCREF(&VertexOrientation3DF0D_Type); - PyModule_AddObject(module, "VertexOrientation3DF0D", (PyObject *)&VertexOrientation3DF0D_Type); + if (PyType_Ready(&VertexOrientation3DF0D_Type) < 0) + return -1; + Py_INCREF(&VertexOrientation3DF0D_Type); + PyModule_AddObject(module, "VertexOrientation3DF0D", (PyObject *)&VertexOrientation3DF0D_Type); - return 0; + return 0; } //------------------------INSTANCE METHODS ---------------------------------- static char UnaryFunction0DVec3f___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DVec3f`\n" -"\n" -"Base class for unary functions (functors) that work on\n" -":class:`Interface0DIterator` and return a 3D vector.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n"; - -static int UnaryFunction0DVec3f___init__(BPy_UnaryFunction0DVec3f *self, PyObject *args, PyObject *kwds) + "Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DVec3f`\n" + "\n" + "Base class for unary functions (functors) that work on\n" + ":class:`Interface0DIterator` and return a 3D vector.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n"; + +static int UnaryFunction0DVec3f___init__(BPy_UnaryFunction0DVec3f *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->uf0D_vec3f = new UnaryFunction0D(); - self->uf0D_vec3f->py_uf0D = (PyObject *)self; - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->uf0D_vec3f = new UnaryFunction0D(); + self->uf0D_vec3f->py_uf0D = (PyObject *)self; + return 0; } static void UnaryFunction0DVec3f___dealloc__(BPy_UnaryFunction0DVec3f *self) { - if (self->uf0D_vec3f) - delete self->uf0D_vec3f; - UnaryFunction0D_Type.tp_dealloc((PyObject *)self); + if (self->uf0D_vec3f) + delete self->uf0D_vec3f; + UnaryFunction0D_Type.tp_dealloc((PyObject *)self); } static PyObject *UnaryFunction0DVec3f___repr__(BPy_UnaryFunction0DVec3f *self) { - return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_vec3f); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_vec3f); } -static PyObject *UnaryFunction0DVec3f___call__(BPy_UnaryFunction0DVec3f *self, PyObject *args, PyObject *kwds) +static PyObject *UnaryFunction0DVec3f___call__(BPy_UnaryFunction0DVec3f *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"it", NULL}; - PyObject *obj; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) - return NULL; - - if (typeid(*(self->uf0D_vec3f)) == typeid(UnaryFunction0D)) { - PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; - } - if (self->uf0D_vec3f->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { - if (!PyErr_Occurred()) { - string class_name(Py_TYPE(self)->tp_name); - PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); - } - return NULL; - } - return Vector_from_Vec3f(self->uf0D_vec3f->result); + static const char *kwlist[] = {"it", NULL}; + PyObject *obj; + + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) + return NULL; + + if (typeid(*(self->uf0D_vec3f)) == typeid(UnaryFunction0D)) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->uf0D_vec3f->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { + if (!PyErr_Occurred()) { + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); + } + return NULL; + } + return Vector_from_Vec3f(self->uf0D_vec3f->result); } /*-----------------------BPy_UnaryFunction0DVec3f type definition ------------------------------*/ PyTypeObject UnaryFunction0DVec3f_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction0DVec3f", /* tp_name */ - sizeof(BPy_UnaryFunction0DVec3f), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DVec3f___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DVec3f___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DVec3f___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction0DVec3f___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DVec3f___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction0DVec3f", /* tp_name */ + sizeof(BPy_UnaryFunction0DVec3f), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DVec3f___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction0DVec3f___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction0DVec3f___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DVec3f___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DVec3f___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.h index fb938f019ad..0f3bcc51f2e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVec3f.h @@ -34,18 +34,18 @@ extern "C" { extern PyTypeObject UnaryFunction0DVec3f_Type; -#define BPy_UnaryFunction0DVec3f_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction0DVec3f_Type)) +#define BPy_UnaryFunction0DVec3f_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction0DVec3f_Type)) /*---------------------------Python BPy_UnaryFunction0DVec3f structure definition----------*/ typedef struct { - BPy_UnaryFunction0D py_uf0D; - UnaryFunction0D *uf0D_vec3f; + BPy_UnaryFunction0D py_uf0D; + UnaryFunction0D *uf0D_vec3f; } BPy_UnaryFunction0DVec3f; /*---------------------------Python BPy_UnaryFunction0DVec3f visible prototypes-----------*/ int UnaryFunction0DVec3f_Init(PyObject *module); - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp index ac3eb72038c..039727f4fab 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp @@ -35,131 +35,135 @@ extern "C" { int UnaryFunction0DVectorViewShape_Init(PyObject *module) { - if (module == NULL) - return -1; + if (module == NULL) + return -1; - if (PyType_Ready(&UnaryFunction0DVectorViewShape_Type) < 0) - return -1; - Py_INCREF(&UnaryFunction0DVectorViewShape_Type); - PyModule_AddObject(module, "UnaryFunction0DVectorViewShape", (PyObject *)&UnaryFunction0DVectorViewShape_Type); + 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) - return -1; - Py_INCREF(&GetOccludersF0D_Type); - PyModule_AddObject(module, "GetOccludersF0D", (PyObject *)&GetOccludersF0D_Type); + if (PyType_Ready(&GetOccludersF0D_Type) < 0) + return -1; + Py_INCREF(&GetOccludersF0D_Type); + PyModule_AddObject(module, "GetOccludersF0D", (PyObject *)&GetOccludersF0D_Type); - return 0; + return 0; } //------------------------INSTANCE METHODS ---------------------------------- static char UnaryFunction0DVectorViewShape___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DVectorViewShape`\n" -"\n" -"Base class for unary functions (functors) that work on\n" -":class:`Interface0DIterator` and return a list of :class:`ViewShape`\n" -"objects.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n"; + "Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DVectorViewShape`\n" + "\n" + "Base class for unary functions (functors) that work on\n" + ":class:`Interface0DIterator` and return a list of :class:`ViewShape`\n" + "objects.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n"; static int UnaryFunction0DVectorViewShape___init__(BPy_UnaryFunction0DVectorViewShape *self, - PyObject *args, PyObject *kwds) + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->uf0D_vectorviewshape = new UnaryFunction0D< std::vector >(); - self->uf0D_vectorviewshape->py_uf0D = (PyObject *)self; - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->uf0D_vectorviewshape = new UnaryFunction0D>(); + self->uf0D_vectorviewshape->py_uf0D = (PyObject *)self; + return 0; } static void UnaryFunction0DVectorViewShape___dealloc__(BPy_UnaryFunction0DVectorViewShape *self) { - if (self->uf0D_vectorviewshape) - delete self->uf0D_vectorviewshape; - UnaryFunction0D_Type.tp_dealloc((PyObject *)self); + if (self->uf0D_vectorviewshape) + delete self->uf0D_vectorviewshape; + UnaryFunction0D_Type.tp_dealloc((PyObject *)self); } static PyObject *UnaryFunction0DVectorViewShape___repr__(BPy_UnaryFunction0DVectorViewShape *self) { - return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_vectorviewshape); + return PyUnicode_FromFormat( + "type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_vectorviewshape); } static PyObject *UnaryFunction0DVectorViewShape___call__(BPy_UnaryFunction0DVectorViewShape *self, - PyObject *args, PyObject *kwds) + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"it", NULL}; - PyObject *obj; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) - return NULL; - - if (typeid(*(self->uf0D_vectorviewshape)) == typeid(UnaryFunction0D< std::vector >)) { - PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; - } - if (self->uf0D_vectorviewshape->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { - if (!PyErr_Occurred()) { - string class_name(Py_TYPE(self)->tp_name); - PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); - } - return NULL; - } - - const unsigned int list_len = self->uf0D_vectorviewshape->result.size(); - PyObject *list = PyList_New(list_len); - for (unsigned int i = 0; i < list_len; i++) { - ViewShape *v = self->uf0D_vectorviewshape->result[i]; - PyList_SET_ITEM(list, i, v ? BPy_ViewShape_from_ViewShape(*v) : (Py_INCREF(Py_None), Py_None)); - } - - return list; + static const char *kwlist[] = {"it", NULL}; + PyObject *obj; + + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) + return NULL; + + if (typeid(*(self->uf0D_vectorviewshape)) == typeid(UnaryFunction0D>)) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->uf0D_vectorviewshape->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { + if (!PyErr_Occurred()) { + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); + } + return NULL; + } + + const unsigned int list_len = self->uf0D_vectorviewshape->result.size(); + PyObject *list = PyList_New(list_len); + for (unsigned int i = 0; i < list_len; i++) { + ViewShape *v = self->uf0D_vectorviewshape->result[i]; + PyList_SET_ITEM(list, i, v ? BPy_ViewShape_from_ViewShape(*v) : (Py_INCREF(Py_None), Py_None)); + } + + return list; } /*-----------------------BPy_UnaryFunction0DVectorViewShape type definition ------------------------------*/ PyTypeObject UnaryFunction0DVectorViewShape_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction0DVectorViewShape", /* tp_name */ - sizeof(BPy_UnaryFunction0DVectorViewShape), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DVectorViewShape___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DVectorViewShape___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DVectorViewShape___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction0DVectorViewShape___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DVectorViewShape___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction0DVectorViewShape", /* tp_name */ + sizeof(BPy_UnaryFunction0DVectorViewShape), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DVectorViewShape___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction0DVectorViewShape___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction0DVectorViewShape___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DVectorViewShape___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DVectorViewShape___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.h index bbcef5add69..22cf50ce5a2 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.h @@ -35,18 +35,17 @@ extern "C" { extern PyTypeObject UnaryFunction0DVectorViewShape_Type; #define BPy_UnaryFunction0DVectorViewShape_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction0DVectorViewShape_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction0DVectorViewShape_Type)) /*---------------------------Python BPy_UnaryFunction0DVectorViewShape structure definition----------*/ typedef struct { - BPy_UnaryFunction0D py_uf0D; - UnaryFunction0D< std::vector > *uf0D_vectorviewshape; + BPy_UnaryFunction0D py_uf0D; + UnaryFunction0D> *uf0D_vectorviewshape; } BPy_UnaryFunction0DVectorViewShape; /*---------------------------Python BPy_UnaryFunction0DVectorViewShape visible prototypes-----------*/ int UnaryFunction0DVectorViewShape_Init(PyObject *module); - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp index 9ee302e4a5c..1df3be084c0 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp @@ -36,125 +36,131 @@ extern "C" { int UnaryFunction0DViewShape_Init(PyObject *module) { - if (module == NULL) - return -1; - - 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) - return -1; - Py_INCREF(&GetOccludeeF0D_Type); - PyModule_AddObject(module, "GetOccludeeF0D", (PyObject *)&GetOccludeeF0D_Type); - - if (PyType_Ready(&GetShapeF0D_Type) < 0) - return -1; - Py_INCREF(&GetShapeF0D_Type); - PyModule_AddObject(module, "GetShapeF0D", (PyObject *)&GetShapeF0D_Type); - - return 0; + if (module == NULL) + return -1; + + 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) + return -1; + Py_INCREF(&GetOccludeeF0D_Type); + PyModule_AddObject(module, "GetOccludeeF0D", (PyObject *)&GetOccludeeF0D_Type); + + if (PyType_Ready(&GetShapeF0D_Type) < 0) + return -1; + Py_INCREF(&GetShapeF0D_Type); + PyModule_AddObject(module, "GetShapeF0D", (PyObject *)&GetShapeF0D_Type); + + return 0; } //------------------------INSTANCE METHODS ---------------------------------- static char UnaryFunction0DViewShape___doc__[] = -"Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DViewShape`\n" -"\n" -"Base class for unary functions (functors) that work on\n" -":class:`Interface0DIterator` and return a :class:`ViewShape` object.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n"; - -static int UnaryFunction0DViewShape___init__(BPy_UnaryFunction0DViewShape *self, PyObject *args, PyObject *kwds) + "Class hierarchy: :class:`UnaryFunction0D` > :class:`UnaryFunction0DViewShape`\n" + "\n" + "Base class for unary functions (functors) that work on\n" + ":class:`Interface0DIterator` and return a :class:`ViewShape` object.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n"; + +static int UnaryFunction0DViewShape___init__(BPy_UnaryFunction0DViewShape *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->uf0D_viewshape = new UnaryFunction0D(); - self->uf0D_viewshape->py_uf0D = (PyObject *)self; - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->uf0D_viewshape = new UnaryFunction0D(); + self->uf0D_viewshape->py_uf0D = (PyObject *)self; + return 0; } static void UnaryFunction0DViewShape___dealloc__(BPy_UnaryFunction0DViewShape *self) { - if (self->uf0D_viewshape) - delete self->uf0D_viewshape; - UnaryFunction0D_Type.tp_dealloc((PyObject *)self); + if (self->uf0D_viewshape) + delete self->uf0D_viewshape; + UnaryFunction0D_Type.tp_dealloc((PyObject *)self); } static PyObject *UnaryFunction0DViewShape___repr__(BPy_UnaryFunction0DViewShape *self) { - return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_viewshape); + return PyUnicode_FromFormat( + "type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf0D_viewshape); } -static PyObject *UnaryFunction0DViewShape___call__(BPy_UnaryFunction0DViewShape *self, PyObject *args, PyObject *kwds) +static PyObject *UnaryFunction0DViewShape___call__(BPy_UnaryFunction0DViewShape *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"it", NULL}; - PyObject *obj; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) - return NULL; - - if (typeid(*(self->uf0D_viewshape)) == typeid(UnaryFunction0D)) { - PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; - } - if (self->uf0D_viewshape->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { - if (!PyErr_Occurred()) { - string class_name(Py_TYPE(self)->tp_name); - PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); - } - return NULL; - } - return BPy_ViewShape_from_ViewShape(*(self->uf0D_viewshape->result)); + static const char *kwlist[] = {"it", NULL}; + PyObject *obj; + + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "O!", (char **)kwlist, &Interface0DIterator_Type, &obj)) + return NULL; + + if (typeid(*(self->uf0D_viewshape)) == typeid(UnaryFunction0D)) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->uf0D_viewshape->operator()(*(((BPy_Interface0DIterator *)obj)->if0D_it)) < 0) { + if (!PyErr_Occurred()) { + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); + } + return NULL; + } + return BPy_ViewShape_from_ViewShape(*(self->uf0D_viewshape->result)); } /*-----------------------BPy_UnaryFunction0DViewShape type definition ------------------------------*/ PyTypeObject UnaryFunction0DViewShape_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction0DViewShape", /* tp_name */ - sizeof(BPy_UnaryFunction0DViewShape), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction0DViewShape___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction0DViewShape___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction0DViewShape___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction0DViewShape___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction0DViewShape___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction0DViewShape", /* tp_name */ + sizeof(BPy_UnaryFunction0DViewShape), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction0DViewShape___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction0DViewShape___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction0DViewShape___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction0DViewShape___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction0DViewShape___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.h b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.h index d94cc89c3fc..af3661669bd 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/BPy_UnaryFunction0DViewShape.h @@ -34,18 +34,17 @@ extern "C" { extern PyTypeObject UnaryFunction0DViewShape_Type; #define BPy_UnaryFunction0DViewShape_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction0DViewShape_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction0DViewShape_Type)) /*---------------------------Python BPy_UnaryFunction0DViewShape structure definition----------*/ typedef struct { - BPy_UnaryFunction0D py_uf0D; - UnaryFunction0D *uf0D_viewshape; + BPy_UnaryFunction0D py_uf0D; + UnaryFunction0D *uf0D_viewshape; } BPy_UnaryFunction0DViewShape; /*---------------------------Python BPy_UnaryFunction0DViewShape visible prototypes-----------*/ int UnaryFunction0DViewShape_Init(PyObject *module); - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 1019c2495a2..6529c4f435b 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 @@ -31,81 +31,81 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ShapeIdF0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DId` > :class:`ShapeIdF0D`\n" -"\n" -".. method:: __init__()\n" -"\n" -" Builds a ShapeIdF0D object.\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Returns the :class:`freestyle.types.Id` of the Shape the\n" -" :class:`freestyle.types.Interface0D` pointed by the\n" -" Interface0DIterator belongs to. This evaluation can be ambiguous (in\n" -" the case of a :class:`freestyle.types.TVertex` for example). This\n" -" functor tries to remove this ambiguity using the context offered by\n" -" the 1D element to which the Interface0DIterator belongs to. However,\n" -" there still can be problematic cases, and the user willing to deal\n" -" with this cases in a specific way should implement its own\n" -" getShapeIdF0D functor.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: The Id of the Shape the pointed Interface0D belongs to.\n" -" :rtype: :class:`freestyle.types.Id`\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > " + ":class:`freestyle.types.UnaryFunction0DId` > :class:`ShapeIdF0D`\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Builds a ShapeIdF0D object.\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Returns the :class:`freestyle.types.Id` of the Shape the\n" + " :class:`freestyle.types.Interface0D` pointed by the\n" + " Interface0DIterator belongs to. This evaluation can be ambiguous (in\n" + " the case of a :class:`freestyle.types.TVertex` for example). This\n" + " functor tries to remove this ambiguity using the context offered by\n" + " the 1D element to which the Interface0DIterator belongs to. However,\n" + " there still can be problematic cases, and the user willing to deal\n" + " with this cases in a specific way should implement its own\n" + " getShapeIdF0D functor.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: The Id of the Shape the pointed Interface0D belongs to.\n" + " :rtype: :class:`freestyle.types.Id`\n"; static int ShapeIdF0D___init__(BPy_ShapeIdF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - 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; + 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; } /*-----------------------BPy_ShapeIdF0D type definition ------------------------------*/ PyTypeObject ShapeIdF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ShapeIdF0D", /* tp_name */ - sizeof(BPy_ShapeIdF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ShapeIdF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DId_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ShapeIdF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "ShapeIdF0D", /* tp_name */ + sizeof(BPy_ShapeIdF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ShapeIdF0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0DId_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ShapeIdF0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.h index c4794e7cbda..1aea0736c9b 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.h @@ -35,10 +35,9 @@ extern PyTypeObject ShapeIdF0D_Type; /*---------------------------Python BPy_ShapeIdF0D structure definition----------*/ typedef struct { - BPy_UnaryFunction0DId py_uf0D_id; + BPy_UnaryFunction0DId py_uf0D_id; } BPy_ShapeIdF0D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 8333a7dad74..6fb65b8f132 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 @@ -31,84 +31,84 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char MaterialF0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DMaterial` > :class:`MaterialF0D`\n" -"\n" -".. method:: __init__()\n" -"\n" -" Builds a MaterialF0D object.\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Returns the material of the object evaluated at the\n" -" :class:`freestyle.types.Interface0D` pointed by the\n" -" Interface0DIterator. This evaluation can be ambiguous (in the case of\n" -" a :class:`freestyle.types.TVertex` for example. This functor tries to\n" -" remove this ambiguity using the context offered by the 1D element to\n" -" which the Interface0DIterator belongs to and by arbitrary choosing the\n" -" material of the face that lies on its left when following the 1D\n" -" element if there are two different materials on each side of the\n" -" point. However, there still can be problematic cases, and the user\n" -" willing to deal with this cases in a specific way should implement its\n" -" own getMaterial functor.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: The material of the object evaluated at the pointed\n" -" Interface0D.\n" -" :rtype: :class:`freestyle.types.Material`\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > " + ":class:`freestyle.types.UnaryFunction0DMaterial` > :class:`MaterialF0D`\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Builds a MaterialF0D object.\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Returns the material of the object evaluated at the\n" + " :class:`freestyle.types.Interface0D` pointed by the\n" + " Interface0DIterator. This evaluation can be ambiguous (in the case of\n" + " a :class:`freestyle.types.TVertex` for example. This functor tries to\n" + " remove this ambiguity using the context offered by the 1D element to\n" + " which the Interface0DIterator belongs to and by arbitrary choosing the\n" + " material of the face that lies on its left when following the 1D\n" + " element if there are two different materials on each side of the\n" + " point. However, there still can be problematic cases, and the user\n" + " willing to deal with this cases in a specific way should implement its\n" + " own getMaterial functor.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: The material of the object evaluated at the pointed\n" + " Interface0D.\n" + " :rtype: :class:`freestyle.types.Material`\n"; static int MaterialF0D___init__(BPy_MaterialF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - 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; + 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; } /*-----------------------BPy_MaterialF0D type definition ------------------------------*/ PyTypeObject MaterialF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "MaterialF0D", /* tp_name */ - sizeof(BPy_MaterialF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - MaterialF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DMaterial_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)MaterialF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "MaterialF0D", /* tp_name */ + sizeof(BPy_MaterialF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + MaterialF0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0DMaterial_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)MaterialF0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.h index 10f7b11eb32..f1520fa63ee 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject MaterialF0D_Type; -#define BPy_MaterialF0D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&MaterialF0D_Type)) +#define BPy_MaterialF0D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&MaterialF0D_Type)) /*---------------------------Python BPy_MaterialF0D structure definition----------*/ typedef struct { - BPy_UnaryFunction0DMaterial py_uf0D_material; + BPy_UnaryFunction0DMaterial py_uf0D_material; } BPy_MaterialF0D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 c67a7efc92f..a3e5871b20d 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 @@ -31,75 +31,75 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char CurveNatureF0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DEdgeNature` > :class:`CurveNatureF0D`\n" -"\n" -".. method:: __init__()\n" -"\n" -" Builds a CurveNatureF0D object.\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Returns the :class:`freestyle.types.Nature` of the 1D element the\n" -" Interface0D pointed by the Interface0DIterator belongs to.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: The nature of the 1D element to which the pointed Interface0D\n" -" belongs.\n" -" :rtype: :class:`freestyle.types.Nature`\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > " + ":class:`freestyle.types.UnaryFunction0DEdgeNature` > :class:`CurveNatureF0D`\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Builds a CurveNatureF0D object.\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Returns the :class:`freestyle.types.Nature` of the 1D element the\n" + " Interface0D pointed by the Interface0DIterator belongs to.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: The nature of the 1D element to which the pointed Interface0D\n" + " belongs.\n" + " :rtype: :class:`freestyle.types.Nature`\n"; static int CurveNatureF0D___init__(BPy_CurveNatureF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - 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; + 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; } /*-----------------------BPy_CurveNatureF0D type definition ------------------------------*/ PyTypeObject CurveNatureF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "CurveNatureF0D", /* tp_name */ - sizeof(BPy_CurveNatureF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - CurveNatureF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DEdgeNature_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)CurveNatureF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "CurveNatureF0D", /* tp_name */ + sizeof(BPy_CurveNatureF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + CurveNatureF0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0DEdgeNature_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)CurveNatureF0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.h index 8a60c28beaa..f24e63d09f9 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject CurveNatureF0D_Type; -#define BPy_CurveNatureF0D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&CurveNatureF0D_Type)) +#define BPy_CurveNatureF0D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&CurveNatureF0D_Type)) /*---------------------------Python BPy_CurveNatureF0D structure definition----------*/ typedef struct { - BPy_UnaryFunction0DEdgeNature py_uf0D_edgenature; + BPy_UnaryFunction0DEdgeNature py_uf0D_edgenature; } BPy_CurveNatureF0D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 5cd92790ea5..cd50e23f1d7 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 @@ -31,77 +31,77 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char Normal2DF0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DVec2f` > :class:`Normal2DF0D`\n" -"\n" -".. method:: __init__()\n" -"\n" -" Builds a Normal2DF0D object.\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Returns a two-dimensional vector giving the normalized 2D normal to\n" -" the 1D element to which the :class:`freestyle.types.Interface0D`\n" -" pointed by the Interface0DIterator belongs. The normal is evaluated\n" -" at the pointed Interface0D.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: The 2D normal of the 1D element evaluated at the pointed\n" -" Interface0D.\n" -" :rtype: :class:`mathutils.Vector`\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > " + ":class:`freestyle.types.UnaryFunction0DVec2f` > :class:`Normal2DF0D`\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Builds a Normal2DF0D object.\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Returns a two-dimensional vector giving the normalized 2D normal to\n" + " the 1D element to which the :class:`freestyle.types.Interface0D`\n" + " pointed by the Interface0DIterator belongs. The normal is evaluated\n" + " at the pointed Interface0D.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: The 2D normal of the 1D element evaluated at the pointed\n" + " Interface0D.\n" + " :rtype: :class:`mathutils.Vector`\n"; static int Normal2DF0D___init__(BPy_Normal2DF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - 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; + 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; } /*-----------------------BPy_Normal2DF0D type definition ------------------------------*/ PyTypeObject Normal2DF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "Normal2DF0D", /* tp_name */ - sizeof(BPy_Normal2DF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Normal2DF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DVec2f_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Normal2DF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "Normal2DF0D", /* tp_name */ + sizeof(BPy_Normal2DF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Normal2DF0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0DVec2f_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Normal2DF0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.h index 590b8f201eb..45a4ec3124d 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject Normal2DF0D_Type; -#define BPy_Normal2DF0D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&Normal2DF0D_Type)) +#define BPy_Normal2DF0D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&Normal2DF0D_Type)) /*---------------------------Python BPy_Normal2DF0D structure definition----------*/ typedef struct { - BPy_UnaryFunction0DVec2f py_uf0D_vec2f; + BPy_UnaryFunction0DVec2f py_uf0D_vec2f; } BPy_Normal2DF0D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 52aabb351ad..623ec4db50e 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 @@ -31,77 +31,79 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char VertexOrientation2DF0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DVec2f` > :class:`VertexOrientation2DF0D`\n" -"\n" -".. method:: __init__()\n" -"\n" -" Builds a VertexOrientation2DF0D object.\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Returns a two-dimensional vector giving the 2D oriented tangent to the\n" -" 1D element to which the :class:`freestyle.types.Interface0D` pointed\n" -" by the Interface0DIterator belongs. The 2D oriented tangent is\n" -" evaluated at the pointed Interface0D.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: The 2D oriented tangent to the 1D element evaluated at the\n" -" pointed Interface0D.\n" -" :rtype: :class:`mathutils.Vector`\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > " + ":class:`freestyle.types.UnaryFunction0DVec2f` > :class:`VertexOrientation2DF0D`\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Builds a VertexOrientation2DF0D object.\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Returns a two-dimensional vector giving the 2D oriented tangent to the\n" + " 1D element to which the :class:`freestyle.types.Interface0D` pointed\n" + " by the Interface0DIterator belongs. The 2D oriented tangent is\n" + " evaluated at the pointed Interface0D.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: The 2D oriented tangent to the 1D element evaluated at the\n" + " pointed Interface0D.\n" + " :rtype: :class:`mathutils.Vector`\n"; -static int VertexOrientation2DF0D___init__(BPy_VertexOrientation2DF0D *self, PyObject *args, PyObject *kwds) +static int VertexOrientation2DF0D___init__(BPy_VertexOrientation2DF0D *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - 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; + 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; } /*-----------------------BPy_VertexOrientation2DF0D type definition ------------------------------*/ PyTypeObject VertexOrientation2DF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "VertexOrientation2DF0D", /* tp_name */ - sizeof(BPy_VertexOrientation2DF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - VertexOrientation2DF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DVec2f_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)VertexOrientation2DF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "VertexOrientation2DF0D", /* tp_name */ + sizeof(BPy_VertexOrientation2DF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + VertexOrientation2DF0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0DVec2f_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)VertexOrientation2DF0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.h index 157737e3f4d..8e76c31ff27 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.h @@ -32,14 +32,13 @@ extern "C" { extern PyTypeObject VertexOrientation2DF0D_Type; #define BPy_VertexOrientation2DF0D_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&VertexOrientation2DF0D_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&VertexOrientation2DF0D_Type)) /*---------------------------Python BPy_VertexOrientation2DF0D structure definition----------*/ typedef struct { - BPy_UnaryFunction0DVec2f py_uf0D_vec2f; + BPy_UnaryFunction0DVec2f py_uf0D_vec2f; } BPy_VertexOrientation2DF0D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 c3d30d9b7e5..6ed52014719 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 @@ -31,77 +31,79 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char VertexOrientation3DF0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DVec3f` > :class:`VertexOrientation3DF0D`\n" -"\n" -".. method:: __init__()\n" -"\n" -" Builds a VertexOrientation3DF0D object.\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Returns a three-dimensional vector giving the 3D oriented tangent to\n" -" the 1D element to which the :class:`freestyle.types.Interface0D`\n" -" pointed by the Interface0DIterator belongs. The 3D oriented tangent\n" -" is evaluated at the pointed Interface0D.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: The 3D oriented tangent to the 1D element evaluated at the\n" -" pointed Interface0D.\n" -" :rtype: :class:`mathutils.Vector`\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > " + ":class:`freestyle.types.UnaryFunction0DVec3f` > :class:`VertexOrientation3DF0D`\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Builds a VertexOrientation3DF0D object.\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Returns a three-dimensional vector giving the 3D oriented tangent to\n" + " the 1D element to which the :class:`freestyle.types.Interface0D`\n" + " pointed by the Interface0DIterator belongs. The 3D oriented tangent\n" + " is evaluated at the pointed Interface0D.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: The 3D oriented tangent to the 1D element evaluated at the\n" + " pointed Interface0D.\n" + " :rtype: :class:`mathutils.Vector`\n"; -static int VertexOrientation3DF0D___init__(BPy_VertexOrientation3DF0D *self, PyObject *args, PyObject *kwds) +static int VertexOrientation3DF0D___init__(BPy_VertexOrientation3DF0D *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - 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; + 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; } /*-----------------------BPy_VertexOrientation3DF0D type definition ------------------------------*/ PyTypeObject VertexOrientation3DF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "VertexOrientation3DF0D", /* tp_name */ - sizeof(BPy_VertexOrientation3DF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - VertexOrientation3DF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DVec3f_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)VertexOrientation3DF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "VertexOrientation3DF0D", /* tp_name */ + sizeof(BPy_VertexOrientation3DF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + VertexOrientation3DF0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0DVec3f_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)VertexOrientation3DF0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.h index 0254de71b68..391f7c9536b 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.h @@ -32,14 +32,13 @@ extern "C" { extern PyTypeObject VertexOrientation3DF0D_Type; #define BPy_VertexOrientation3DF0D_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&VertexOrientation3DF0D_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&VertexOrientation3DF0D_Type)) /*---------------------------Python BPy_VertexOrientation3DF0D structure definition----------*/ typedef struct { - BPy_UnaryFunction0DVec3f py_uf0D_vec3f; + BPy_UnaryFunction0DVec3f py_uf0D_vec3f; } BPy_VertexOrientation3DF0D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 3636ecead72..88f4b9d32ec 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 @@ -31,74 +31,74 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetOccludeeF0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DViewShape` > :class:`GetOccludeeF0D`\n" -"\n" -".. method:: __init__()\n" -"\n" -" Builds a GetOccludeeF0D object.\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Returns the :class:`freestyle.types.ViewShape` that the Interface0D\n" -" pointed by the Interface0DIterator occludes.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: The ViewShape occluded by the pointed Interface0D.\n" -" :rtype: :class:`freestyle.types.ViewShape`\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > " + ":class:`freestyle.types.UnaryFunction0DViewShape` > :class:`GetOccludeeF0D`\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Builds a GetOccludeeF0D object.\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Returns the :class:`freestyle.types.ViewShape` that the Interface0D\n" + " pointed by the Interface0DIterator occludes.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: The ViewShape occluded by the pointed Interface0D.\n" + " :rtype: :class:`freestyle.types.ViewShape`\n"; static int GetOccludeeF0D___init__(BPy_GetOccludeeF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - 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; + 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; } /*-----------------------BPy_GetOccludeeF0D type definition ------------------------------*/ PyTypeObject GetOccludeeF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "GetOccludeeF0D", /* tp_name */ - sizeof(BPy_GetOccludeeF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetOccludeeF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DViewShape_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetOccludeeF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "GetOccludeeF0D", /* tp_name */ + sizeof(BPy_GetOccludeeF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetOccludeeF0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0DViewShape_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetOccludeeF0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.h index 606049b1461..45c9524e185 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject GetOccludeeF0D_Type; -#define BPy_GetOccludeeF0D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetOccludeeF0D_Type)) +#define BPy_GetOccludeeF0D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetOccludeeF0D_Type)) /*---------------------------Python BPy_GetOccludeeF0D structure definition----------*/ typedef struct { - BPy_UnaryFunction0DViewShape py_uf0D_viewshape; + BPy_UnaryFunction0DViewShape py_uf0D_viewshape; } BPy_GetOccludeeF0D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 f3f8c028a96..558e403d09c 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 @@ -31,74 +31,74 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetShapeF0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DViewShape` > :class:`GetShapeF0D`\n" -"\n" -".. method:: __init__()\n" -"\n" -" Builds a GetShapeF0D object.\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Returns the :class:`freestyle.types.ViewShape` containing the\n" -" Interface0D pointed by the Interface0DIterator.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: The ViewShape containing the pointed Interface0D.\n" -" :rtype: :class:`freestyle.types.ViewShape`\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > " + ":class:`freestyle.types.UnaryFunction0DViewShape` > :class:`GetShapeF0D`\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Builds a GetShapeF0D object.\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Returns the :class:`freestyle.types.ViewShape` containing the\n" + " Interface0D pointed by the Interface0DIterator.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: The ViewShape containing the pointed Interface0D.\n" + " :rtype: :class:`freestyle.types.ViewShape`\n"; static int GetShapeF0D___init__(BPy_GetShapeF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - 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; + 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; } /*-----------------------BPy_GetShapeF0D type definition ------------------------------*/ PyTypeObject GetShapeF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "GetShapeF0D", /* tp_name */ - sizeof(BPy_GetShapeF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetShapeF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DViewShape_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetShapeF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "GetShapeF0D", /* tp_name */ + sizeof(BPy_GetShapeF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetShapeF0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0DViewShape_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetShapeF0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.h index 3033c98671c..c1db8c1219a 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject GetShapeF0D_Type; -#define BPy_GetShapeF0D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetShapeF0D_Type)) +#define BPy_GetShapeF0D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetShapeF0D_Type)) /*---------------------------Python BPy_GetShapeF0D structure definition----------*/ typedef struct { - BPy_UnaryFunction0DViewShape py_uf0D_viewshape; + BPy_UnaryFunction0DViewShape py_uf0D_viewshape; } BPy_GetShapeF0D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 e0c2582e841..0205adada46 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 @@ -31,77 +31,79 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char Curvature2DAngleF0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DDouble` > :class:`Curvature2DAngleF0D`\n" -"\n" -".. method:: __init__()\n" -"\n" -" Builds a Curvature2DAngleF0D object.\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Returns a real value giving the 2D curvature (as an angle) of the 1D\n" -" element to which the :class:`freestyle.types.Interface0D` pointed by\n" -" the Interface0DIterator belongs. The 2D curvature is evaluated at the\n" -" Interface0D.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: The 2D curvature of the 1D element evaluated at the\n" -" pointed Interface0D.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > " + ":class:`freestyle.types.UnaryFunction0DDouble` > :class:`Curvature2DAngleF0D`\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Builds a Curvature2DAngleF0D object.\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Returns a real value giving the 2D curvature (as an angle) of the 1D\n" + " element to which the :class:`freestyle.types.Interface0D` pointed by\n" + " the Interface0DIterator belongs. The 2D curvature is evaluated at the\n" + " Interface0D.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: The 2D curvature of the 1D element evaluated at the\n" + " pointed Interface0D.\n" + " :rtype: float\n"; -static int Curvature2DAngleF0D___init__(BPy_Curvature2DAngleF0D *self, PyObject *args, PyObject *kwds) +static int Curvature2DAngleF0D___init__(BPy_Curvature2DAngleF0D *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - 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; + 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; } /*-----------------------BPy_Curvature2DAngleF0D type definition ------------------------------*/ PyTypeObject Curvature2DAngleF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "Curvature2DAngleF0D", /* tp_name */ - sizeof(BPy_Curvature2DAngleF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Curvature2DAngleF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Curvature2DAngleF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "Curvature2DAngleF0D", /* tp_name */ + sizeof(BPy_Curvature2DAngleF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Curvature2DAngleF0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Curvature2DAngleF0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.h index 9f7e5f54c6a..b57119257b9 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject Curvature2DAngleF0D_Type; -#define BPy_Curvature2DAngleF0D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&Curvature2DAngleF0D_Type)) +#define BPy_Curvature2DAngleF0D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&Curvature2DAngleF0D_Type)) /*---------------------------Python BPy_Curvature2DAngleF0D structure definition----------*/ typedef struct { - BPy_UnaryFunction0DDouble py_uf0D_double; + BPy_UnaryFunction0DDouble py_uf0D_double; } BPy_Curvature2DAngleF0D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 912b56d5555..c18a4e1ab40 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 @@ -31,84 +31,84 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char DensityF0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DDouble` > :class:`DensityF0D`\n" -"\n" -".. method:: __init__(sigma=2.0)\n" -"\n" -" Builds a DensityF0D object.\n" -"\n" -" :arg sigma: The gaussian sigma value indicating the X value for\n" -" which the gaussian function is 0.5. It leads to the window size\n" -" value (the larger, the smoother).\n" -" :type sigma: float\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Returns the density of the (result) image evaluated at the\n" -" :class:`freestyle.types.Interface0D` pointed by the\n" -" Interface0DIterator. This density is evaluated using a pixels square\n" -" window around the evaluation point and integrating these values using\n" -" a gaussian.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: The density of the image evaluated at the pointed\n" -" Interface0D.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > " + ":class:`freestyle.types.UnaryFunction0DDouble` > :class:`DensityF0D`\n" + "\n" + ".. method:: __init__(sigma=2.0)\n" + "\n" + " Builds a DensityF0D object.\n" + "\n" + " :arg sigma: The gaussian sigma value indicating the X value for\n" + " which the gaussian function is 0.5. It leads to the window size\n" + " value (the larger, the smoother).\n" + " :type sigma: float\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Returns the density of the (result) image evaluated at the\n" + " :class:`freestyle.types.Interface0D` pointed by the\n" + " Interface0DIterator. This density is evaluated using a pixels square\n" + " window around the evaluation point and integrating these values using\n" + " a gaussian.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: The density of the image evaluated at the pointed\n" + " Interface0D.\n" + " :rtype: float\n"; static int DensityF0D___init__(BPy_DensityF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"sigma", NULL}; - double d = 2; + static const char *kwlist[] = {"sigma", NULL}; + double d = 2; - 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; + 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; } /*-----------------------BPy_DensityF0D type definition ------------------------------*/ PyTypeObject DensityF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "DensityF0D", /* tp_name */ - sizeof(BPy_DensityF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - DensityF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)DensityF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "DensityF0D", /* tp_name */ + sizeof(BPy_DensityF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + DensityF0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)DensityF0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.h index 55fd8042654..34bbd8331fb 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.h @@ -35,10 +35,9 @@ extern PyTypeObject DensityF0D_Type; /*---------------------------Python BPy_DensityF0D structure definition----------*/ typedef struct { - BPy_UnaryFunction0DDouble py_uf0D_double; + BPy_UnaryFunction0DDouble py_uf0D_double; } BPy_DensityF0D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 7c75b96c2ec..6bf7fd3895c 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 @@ -31,74 +31,74 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetProjectedXF0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DDouble` > :class:`GetProjectedXF0D`\n" -"\n" -".. method:: __init__()\n" -"\n" -" Builds a GetProjectedXF0D object.\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Returns the X 3D projected coordinate of the :class:`freestyle.types.Interface0D`\n" -" pointed by the Interface0DIterator.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: The X 3D projected coordinate of the pointed Interface0D.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > " + ":class:`freestyle.types.UnaryFunction0DDouble` > :class:`GetProjectedXF0D`\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Builds a GetProjectedXF0D object.\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Returns the X 3D projected coordinate of the :class:`freestyle.types.Interface0D`\n" + " pointed by the Interface0DIterator.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: The X 3D projected coordinate of the pointed Interface0D.\n" + " :rtype: float\n"; static int GetProjectedXF0D___init__(BPy_GetProjectedXF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - 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; + 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; } /*-----------------------BPy_GetProjectedXF0D type definition ------------------------------*/ PyTypeObject GetProjectedXF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "GetProjectedXF0D", /* tp_name */ - sizeof(BPy_GetProjectedXF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetProjectedXF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetProjectedXF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "GetProjectedXF0D", /* tp_name */ + sizeof(BPy_GetProjectedXF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetProjectedXF0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetProjectedXF0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.h index 7fedc2eedf8..ddd500f617e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject GetProjectedXF0D_Type; -#define BPy_GetProjectedXF0D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetProjectedXF0D_Type)) +#define BPy_GetProjectedXF0D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetProjectedXF0D_Type)) /*---------------------------Python BPy_GetProjectedXF0D structure definition----------*/ typedef struct { - BPy_UnaryFunction0DDouble py_uf0D_double; + BPy_UnaryFunction0DDouble py_uf0D_double; } BPy_GetProjectedXF0D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 c3c42372361..af2b05bcc02 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 @@ -31,74 +31,74 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetProjectedYF0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DDouble` > :class:`GetProjectedYF0D`\n" -"\n" -".. method:: __init__()\n" -"\n" -" Builds a GetProjectedYF0D object.\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Returns the Y 3D projected coordinate of the :class:`freestyle.types.Interface0D`\n" -" pointed by the Interface0DIterator.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: The Y 3D projected coordinate of the pointed Interface0D.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > " + ":class:`freestyle.types.UnaryFunction0DDouble` > :class:`GetProjectedYF0D`\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Builds a GetProjectedYF0D object.\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Returns the Y 3D projected coordinate of the :class:`freestyle.types.Interface0D`\n" + " pointed by the Interface0DIterator.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: The Y 3D projected coordinate of the pointed Interface0D.\n" + " :rtype: float\n"; static int GetProjectedYF0D___init__(BPy_GetProjectedYF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - 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; + 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; } /*-----------------------BPy_GetProjectedYF0D type definition ------------------------------*/ PyTypeObject GetProjectedYF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "GetProjectedYF0D", /* tp_name */ - sizeof(BPy_GetProjectedYF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetProjectedYF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetProjectedYF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "GetProjectedYF0D", /* tp_name */ + sizeof(BPy_GetProjectedYF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetProjectedYF0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetProjectedYF0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.h index d1a5d754103..8fccf14971f 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject GetProjectedYF0D_Type; -#define BPy_GetProjectedYF0D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetProjectedYF0D_Type)) +#define BPy_GetProjectedYF0D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetProjectedYF0D_Type)) /*---------------------------Python BPy_GetProjectedYF0D structure definition----------*/ typedef struct { - BPy_UnaryFunction0DDouble py_uf0D_double; + BPy_UnaryFunction0DDouble py_uf0D_double; } BPy_GetProjectedYF0D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 3a3cfb96404..db066f445f5 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 @@ -31,74 +31,74 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetProjectedZF0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DDouble` > :class:`GetProjectedZF0D`\n" -"\n" -".. method:: __init__()\n" -"\n" -" Builds a GetProjectedZF0D object.\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Returns the Z 3D projected coordinate of the :class:`freestyle.types.Interface0D`\n" -" pointed by the Interface0DIterator.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: The Z 3D projected coordinate of the pointed Interface0D.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > " + ":class:`freestyle.types.UnaryFunction0DDouble` > :class:`GetProjectedZF0D`\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Builds a GetProjectedZF0D object.\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Returns the Z 3D projected coordinate of the :class:`freestyle.types.Interface0D`\n" + " pointed by the Interface0DIterator.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: The Z 3D projected coordinate of the pointed Interface0D.\n" + " :rtype: float\n"; static int GetProjectedZF0D___init__(BPy_GetProjectedZF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - 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; + 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; } /*-----------------------BPy_GetProjectedZF0D type definition ------------------------------*/ PyTypeObject GetProjectedZF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "GetProjectedZF0D", /* tp_name */ - sizeof(BPy_GetProjectedZF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetProjectedZF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetProjectedZF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "GetProjectedZF0D", /* tp_name */ + sizeof(BPy_GetProjectedZF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetProjectedZF0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetProjectedZF0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.h index 00e933ba88e..eecf69adb12 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject GetProjectedZF0D_Type; -#define BPy_GetProjectedZF0D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetProjectedZF0D_Type)) +#define BPy_GetProjectedZF0D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetProjectedZF0D_Type)) /*---------------------------Python BPy_GetProjectedZF0D structure definition----------*/ typedef struct { - BPy_UnaryFunction0DDouble py_uf0D_double; + BPy_UnaryFunction0DDouble py_uf0D_double; } BPy_GetProjectedZF0D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 063d1470bb7..e95b9146248 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 @@ -31,74 +31,74 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetXF0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DDouble` > :class:`GetXF0D`\n" -"\n" -".. method:: __init__()\n" -"\n" -" Builds a GetXF0D object.\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Returns the X 3D coordinate of the :class:`freestyle.types.Interface0D` pointed by\n" -" the Interface0DIterator.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: The X 3D coordinate of the pointed Interface0D.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > " + ":class:`freestyle.types.UnaryFunction0DDouble` > :class:`GetXF0D`\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Builds a GetXF0D object.\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Returns the X 3D coordinate of the :class:`freestyle.types.Interface0D` pointed by\n" + " the Interface0DIterator.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: The X 3D coordinate of the pointed Interface0D.\n" + " :rtype: float\n"; static int GetXF0D___init__(BPy_GetXF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - 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; + 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; } /*-----------------------BPy_GetXF0D type definition ------------------------------*/ PyTypeObject GetXF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "GetXF0D", /* tp_name */ - sizeof(BPy_GetXF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetXF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetXF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "GetXF0D", /* tp_name */ + sizeof(BPy_GetXF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetXF0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetXF0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.h index 8d29f401faf..745bd5c628d 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.h @@ -35,10 +35,9 @@ extern PyTypeObject GetXF0D_Type; /*---------------------------Python BPy_GetXF0D structure definition----------*/ typedef struct { - BPy_UnaryFunction0DDouble py_uf0D_double; + BPy_UnaryFunction0DDouble py_uf0D_double; } BPy_GetXF0D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 9c22ac1acbc..c4ce2dc6140 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 @@ -31,74 +31,74 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetYF0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DDouble` > :class:`GetYF0D`\n" -"\n" -".. method:: __init__()\n" -"\n" -" Builds a GetYF0D object.\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Returns the Y 3D coordinate of the :class:`freestyle.types.Interface0D` pointed by\n" -" the Interface0DIterator.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: The Y 3D coordinate of the pointed Interface0D.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > " + ":class:`freestyle.types.UnaryFunction0DDouble` > :class:`GetYF0D`\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Builds a GetYF0D object.\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Returns the Y 3D coordinate of the :class:`freestyle.types.Interface0D` pointed by\n" + " the Interface0DIterator.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: The Y 3D coordinate of the pointed Interface0D.\n" + " :rtype: float\n"; static int GetYF0D___init__(BPy_GetYF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - 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; + 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; } /*-----------------------BPy_GetYF0D type definition ------------------------------*/ PyTypeObject GetYF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "GetYF0D", /* tp_name */ - sizeof(BPy_GetYF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetYF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetYF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "GetYF0D", /* tp_name */ + sizeof(BPy_GetYF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetYF0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetYF0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.h index 56cf07992d7..437ec573585 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.h @@ -35,10 +35,9 @@ extern PyTypeObject GetYF0D_Type; /*---------------------------Python BPy_GetYF0D structure definition----------*/ typedef struct { - BPy_UnaryFunction0DDouble py_uf0D_double; + BPy_UnaryFunction0DDouble py_uf0D_double; } BPy_GetYF0D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 5c280d74d59..1b93a295f53 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 @@ -31,74 +31,74 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetZF0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DDouble` > :class:`GetZF0D`\n" -"\n" -".. method:: __init__()\n" -"\n" -" Builds a GetZF0D object.\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Returns the Z 3D coordinate of the :class:`freestyle.types.Interface0D` pointed by\n" -" the Interface0DIterator.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: The Z 3D coordinate of the pointed Interface0D.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > " + ":class:`freestyle.types.UnaryFunction0DDouble` > :class:`GetZF0D`\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Builds a GetZF0D object.\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Returns the Z 3D coordinate of the :class:`freestyle.types.Interface0D` pointed by\n" + " the Interface0DIterator.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: The Z 3D coordinate of the pointed Interface0D.\n" + " :rtype: float\n"; static int GetZF0D___init__(BPy_GetZF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - 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; + 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; } /*-----------------------BPy_GetZF0D type definition ------------------------------*/ PyTypeObject GetZF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "GetZF0D", /* tp_name */ - sizeof(BPy_GetZF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetZF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetZF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "GetZF0D", /* tp_name */ + sizeof(BPy_GetZF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetZF0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetZF0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.h index 944e575937f..840303fa59d 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.h @@ -35,10 +35,9 @@ extern PyTypeObject GetZF0D_Type; /*---------------------------Python BPy_GetZF0D structure definition----------*/ typedef struct { - BPy_UnaryFunction0DDouble py_uf0D_double; + BPy_UnaryFunction0DDouble py_uf0D_double; } BPy_GetZF0D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 775c058e882..dc304574c7f 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 @@ -31,80 +31,82 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char LocalAverageDepthF0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DDouble` > :class:`LocalAverageDepthF0D`\n" -"\n" -".. method:: __init__(mask_size=5.0)\n" -"\n" -" Builds a LocalAverageDepthF0D object.\n" -"\n" -" :arg mask_size: The size of the mask.\n" -" :type mask_size: float\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Returns the average depth around the\n" -" :class:`freestyle.types.Interface0D` pointed by the\n" -" Interface0DIterator. The result is obtained by querying the depth\n" -" buffer on a window around that point.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: The average depth around the pointed Interface0D.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > " + ":class:`freestyle.types.UnaryFunction0DDouble` > :class:`LocalAverageDepthF0D`\n" + "\n" + ".. method:: __init__(mask_size=5.0)\n" + "\n" + " Builds a LocalAverageDepthF0D object.\n" + "\n" + " :arg mask_size: The size of the mask.\n" + " :type mask_size: float\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Returns the average depth around the\n" + " :class:`freestyle.types.Interface0D` pointed by the\n" + " Interface0DIterator. The result is obtained by querying the depth\n" + " buffer on a window around that point.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: The average depth around the pointed Interface0D.\n" + " :rtype: float\n"; -static int LocalAverageDepthF0D___init__(BPy_LocalAverageDepthF0D *self, PyObject *args, PyObject *kwds) +static int LocalAverageDepthF0D___init__(BPy_LocalAverageDepthF0D *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"mask_size", NULL}; - double d = 5.0; + static const char *kwlist[] = {"mask_size", NULL}; + double d = 5.0; - 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; + 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; } /*-----------------------BPy_LocalAverageDepthF0D type definition ------------------------------*/ PyTypeObject LocalAverageDepthF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "LocalAverageDepthF0D", /* tp_name */ - sizeof(BPy_LocalAverageDepthF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - LocalAverageDepthF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)LocalAverageDepthF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "LocalAverageDepthF0D", /* tp_name */ + sizeof(BPy_LocalAverageDepthF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + LocalAverageDepthF0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)LocalAverageDepthF0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.h index 951b036f72a..f8072427d47 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject LocalAverageDepthF0D_Type; -#define BPy_LocalAverageDepthF0D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&LocalAverageDepthF0D_Type)) +#define BPy_LocalAverageDepthF0D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&LocalAverageDepthF0D_Type)) /*---------------------------Python BPy_LocalAverageDepthF0D structure definition----------*/ typedef struct { - BPy_UnaryFunction0DDouble py_uf0D_double; + BPy_UnaryFunction0DDouble py_uf0D_double; } BPy_LocalAverageDepthF0D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 7b3a2f568d2..d2ae0f0fa31 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 @@ -31,79 +31,79 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ZDiscontinuityF0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DDouble` > :class:`ZDiscontinuityF0D`\n" -"\n" -".. method:: __init__()\n" -"\n" -" Builds a ZDiscontinuityF0D object.\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Returns a real value giving the distance between the\n" -" :class:`freestyle.types.Interface0D` pointed by the\n" -" Interface0DIterator and the shape that lies behind (occludee). This\n" -" distance is evaluated in the camera space and normalized between 0 and\n" -" 1. Therefore, if no object is occluded by the shape to which the\n" -" Interface0D belongs to, 1 is returned.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: The normalized distance between the pointed Interface0D\n" -" and the occludee.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > " + ":class:`freestyle.types.UnaryFunction0DDouble` > :class:`ZDiscontinuityF0D`\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Builds a ZDiscontinuityF0D object.\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Returns a real value giving the distance between the\n" + " :class:`freestyle.types.Interface0D` pointed by the\n" + " Interface0DIterator and the shape that lies behind (occludee). This\n" + " distance is evaluated in the camera space and normalized between 0 and\n" + " 1. Therefore, if no object is occluded by the shape to which the\n" + " Interface0D belongs to, 1 is returned.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: The normalized distance between the pointed Interface0D\n" + " and the occludee.\n" + " :rtype: float\n"; static int ZDiscontinuityF0D___init__(BPy_ZDiscontinuityF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - 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; + 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; } /*-----------------------BPy_ZDiscontinuityF0D type definition ------------------------------*/ PyTypeObject ZDiscontinuityF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ZDiscontinuityF0D", /* tp_name */ - sizeof(BPy_ZDiscontinuityF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ZDiscontinuityF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ZDiscontinuityF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "ZDiscontinuityF0D", /* tp_name */ + sizeof(BPy_ZDiscontinuityF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ZDiscontinuityF0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ZDiscontinuityF0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.h index ccfb186fb28..d0aed95fc1a 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject ZDiscontinuityF0D_Type; -#define BPy_ZDiscontinuityF0D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&ZDiscontinuityF0D_Type)) +#define BPy_ZDiscontinuityF0D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&ZDiscontinuityF0D_Type)) /*---------------------------Python BPy_ZDiscontinuityF0D structure definition----------*/ typedef struct { - BPy_UnaryFunction0DDouble py_uf0D_double; + BPy_UnaryFunction0DDouble py_uf0D_double; } BPy_ZDiscontinuityF0D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 726412428a6..ce8852a2b6c 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 @@ -31,75 +31,77 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetCurvilinearAbscissaF0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DFloat` > :class:`GetCurvilinearAbscissaF0D`\n" -"\n" -".. method:: __init__()\n" -"\n" -" Builds a GetCurvilinearAbscissaF0D object.\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Returns the curvilinear abscissa of the\n" -" :class:`freestyle.types.Interface0D` pointed by the\n" -" Interface0DIterator in the context of its 1D element.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: The curvilinear abscissa of the pointed Interface0D.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > " + ":class:`freestyle.types.UnaryFunction0DFloat` > :class:`GetCurvilinearAbscissaF0D`\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Builds a GetCurvilinearAbscissaF0D object.\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Returns the curvilinear abscissa of the\n" + " :class:`freestyle.types.Interface0D` pointed by the\n" + " Interface0DIterator in the context of its 1D element.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: The curvilinear abscissa of the pointed Interface0D.\n" + " :rtype: float\n"; -static int GetCurvilinearAbscissaF0D___init__(BPy_GetCurvilinearAbscissaF0D *self, PyObject *args, PyObject *kwds) +static int GetCurvilinearAbscissaF0D___init__(BPy_GetCurvilinearAbscissaF0D *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - 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; + 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; } /*-----------------------BPy_GetCurvilinearAbscissaF0D type definition ------------------------------*/ PyTypeObject GetCurvilinearAbscissaF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "GetCurvilinearAbscissaF0D", /* tp_name */ - sizeof(BPy_GetCurvilinearAbscissaF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetCurvilinearAbscissaF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DFloat_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetCurvilinearAbscissaF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "GetCurvilinearAbscissaF0D", /* tp_name */ + sizeof(BPy_GetCurvilinearAbscissaF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetCurvilinearAbscissaF0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0DFloat_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetCurvilinearAbscissaF0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.h index 33d268afce2..72238cfc255 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.h @@ -32,14 +32,13 @@ extern "C" { extern PyTypeObject GetCurvilinearAbscissaF0D_Type; #define BPy_GetCurvilinearAbscissaF0D_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetCurvilinearAbscissaF0D_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetCurvilinearAbscissaF0D_Type)) /*---------------------------Python BPy_GetCurvilinearAbscissaF0D structure definition----------*/ typedef struct { - BPy_UnaryFunction0DFloat py_uf0D_float; + BPy_UnaryFunction0DFloat py_uf0D_float; } BPy_GetCurvilinearAbscissaF0D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 c6c3d351f8f..bc67c4dd91d 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 @@ -31,74 +31,74 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetParameterF0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DFloat` > :class:`GetParameterF0D`\n" -"\n" -".. method:: __init__()\n" -"\n" -" Builds a GetParameterF0D object.\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Returns the parameter of the :class:`freestyle.types.Interface0D`\n" -" pointed by the Interface0DIterator in the context of its 1D element.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: The parameter of an Interface0D.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > " + ":class:`freestyle.types.UnaryFunction0DFloat` > :class:`GetParameterF0D`\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Builds a GetParameterF0D object.\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Returns the parameter of the :class:`freestyle.types.Interface0D`\n" + " pointed by the Interface0DIterator in the context of its 1D element.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: The parameter of an Interface0D.\n" + " :rtype: float\n"; static int GetParameterF0D___init__(BPy_GetParameterF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - 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; + 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; } /*-----------------------BPy_GetParameterF0D type definition ------------------------------*/ PyTypeObject GetParameterF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "GetParameterF0D", /* tp_name */ - sizeof(BPy_GetParameterF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetParameterF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DFloat_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetParameterF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "GetParameterF0D", /* tp_name */ + sizeof(BPy_GetParameterF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetParameterF0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0DFloat_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetParameterF0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.h index 3917c27db77..4fdb6419f21 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject GetParameterF0D_Type; -#define BPy_GetParameterF0D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetParameterF0D_Type)) +#define BPy_GetParameterF0D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetParameterF0D_Type)) /*---------------------------Python BPy_GetParameterF0D structure definition----------*/ typedef struct { - BPy_UnaryFunction0DFloat py_uf0D_float; + BPy_UnaryFunction0DFloat py_uf0D_float; } BPy_GetParameterF0D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 d56fc8fb321..3cf5efc59d7 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 @@ -31,80 +31,82 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetViewMapGradientNormF0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DFloat` > :class:`GetViewMapGradientNormF0D`\n" -"\n" -".. method:: __init__(level)\n" -"\n" -" Builds a GetViewMapGradientNormF0D object.\n" -"\n" -" :arg level: The level of the pyramid from which the pixel must be\n" -" read.\n" -" :type level: int\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Returns the norm of the gradient of the global viewmap density\n" -" image.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: The norm of the gradient of the global viewmap density\n" -" image.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > " + ":class:`freestyle.types.UnaryFunction0DFloat` > :class:`GetViewMapGradientNormF0D`\n" + "\n" + ".. method:: __init__(level)\n" + "\n" + " Builds a GetViewMapGradientNormF0D object.\n" + "\n" + " :arg level: The level of the pyramid from which the pixel must be\n" + " read.\n" + " :type level: int\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Returns the norm of the gradient of the global viewmap density\n" + " image.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: The norm of the gradient of the global viewmap density\n" + " image.\n" + " :rtype: float\n"; -static int GetViewMapGradientNormF0D___init__(BPy_GetViewMapGradientNormF0D *self, PyObject *args, PyObject *kwds) +static int GetViewMapGradientNormF0D___init__(BPy_GetViewMapGradientNormF0D *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"level", NULL}; - int i; + static const char *kwlist[] = {"level", NULL}; + int 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; + 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; } /*-----------------------BPy_GetViewMapGradientNormF0D type definition ------------------------------*/ PyTypeObject GetViewMapGradientNormF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "GetViewMapGradientNormF0D", /* tp_name */ - sizeof(BPy_GetViewMapGradientNormF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetViewMapGradientNormF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DFloat_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetViewMapGradientNormF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "GetViewMapGradientNormF0D", /* tp_name */ + sizeof(BPy_GetViewMapGradientNormF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetViewMapGradientNormF0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0DFloat_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetViewMapGradientNormF0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.h index 24a8bef6277..6ed42ee8019 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.h @@ -32,14 +32,13 @@ extern "C" { extern PyTypeObject GetViewMapGradientNormF0D_Type; #define BPy_GetViewMapGradientNormF0D_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetViewMapGradientNormF0D_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetViewMapGradientNormF0D_Type)) /*---------------------------Python BPy_GetViewMapGradientNormF0D structure definition----------*/ typedef struct { - BPy_UnaryFunction0DFloat py_uf0D_float; + BPy_UnaryFunction0DFloat py_uf0D_float; } BPy_GetViewMapGradientNormF0D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 f04284cdb22..a70cf817b46 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 @@ -31,78 +31,80 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ReadCompleteViewMapPixelF0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DFloat` > :class:`ReadCompleteViewMapPixelF0D`\n" -"\n" -".. method:: __init__(level)\n" -"\n" -" Builds a ReadCompleteViewMapPixelF0D object.\n" -"\n" -" :arg level: The level of the pyramid from which the pixel must be\n" -" read.\n" -" :type level: int\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Reads a pixel in one of the level of the complete viewmap.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: A pixel in one of the level of the complete viewmap.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > " + ":class:`freestyle.types.UnaryFunction0DFloat` > :class:`ReadCompleteViewMapPixelF0D`\n" + "\n" + ".. method:: __init__(level)\n" + "\n" + " Builds a ReadCompleteViewMapPixelF0D object.\n" + "\n" + " :arg level: The level of the pyramid from which the pixel must be\n" + " read.\n" + " :type level: int\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Reads a pixel in one of the level of the complete viewmap.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: A pixel in one of the level of the complete viewmap.\n" + " :rtype: float\n"; -static int ReadCompleteViewMapPixelF0D___init__(BPy_ReadCompleteViewMapPixelF0D *self, PyObject *args, PyObject *kwds) +static int ReadCompleteViewMapPixelF0D___init__(BPy_ReadCompleteViewMapPixelF0D *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"level", NULL}; - int i; + static const char *kwlist[] = {"level", NULL}; + int 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; + 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; } /*-----------------------BPy_ReadCompleteViewMapPixelF0D type definition ------------------------------*/ PyTypeObject ReadCompleteViewMapPixelF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ReadCompleteViewMapPixelF0D", /* tp_name */ - sizeof(BPy_ReadCompleteViewMapPixelF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ReadCompleteViewMapPixelF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DFloat_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ReadCompleteViewMapPixelF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "ReadCompleteViewMapPixelF0D", /* tp_name */ + sizeof(BPy_ReadCompleteViewMapPixelF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ReadCompleteViewMapPixelF0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0DFloat_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ReadCompleteViewMapPixelF0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.h index 53afad75533..6ccfd9764c5 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.h @@ -32,14 +32,13 @@ extern "C" { extern PyTypeObject ReadCompleteViewMapPixelF0D_Type; #define BPy_ReadCompleteViewMapPixelF0D_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&ReadCompleteViewMapPixelF0D_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&ReadCompleteViewMapPixelF0D_Type)) /*---------------------------Python BPy_ReadCompleteViewMapPixelF0D structure definition----------*/ typedef struct { - BPy_UnaryFunction0DFloat py_uf0D_float; + BPy_UnaryFunction0DFloat py_uf0D_float; } BPy_ReadCompleteViewMapPixelF0D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 eb1e8c8c068..dea8923777b 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 @@ -31,81 +31,81 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ReadMapPixelF0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DFloat` > :class:`ReadMapPixelF0D`\n" -"\n" -".. method:: __init__(map_name, level)\n" -"\n" -" Builds a ReadMapPixelF0D object.\n" -"\n" -" :arg map_name: The name of the map to be read.\n" -" :type map_name: str\n" -" :arg level: The level of the pyramid from which the pixel must be\n" -" read.\n" -" :type level: int\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Reads a pixel in a map.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: A pixel in a map.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > " + ":class:`freestyle.types.UnaryFunction0DFloat` > :class:`ReadMapPixelF0D`\n" + "\n" + ".. method:: __init__(map_name, level)\n" + "\n" + " Builds a ReadMapPixelF0D object.\n" + "\n" + " :arg map_name: The name of the map to be read.\n" + " :type map_name: str\n" + " :arg level: The level of the pyramid from which the pixel must be\n" + " read.\n" + " :type level: int\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Reads a pixel in a map.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: A pixel in a map.\n" + " :rtype: float\n"; static int ReadMapPixelF0D___init__(BPy_ReadMapPixelF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"map_name", "level", NULL}; - const char *s; - int i; + static const char *kwlist[] = {"map_name", "level", NULL}; + const char *s; + int 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; + 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; } /*-----------------------BPy_ReadMapPixelF0D type definition ------------------------------*/ PyTypeObject ReadMapPixelF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ReadMapPixelF0D", /* tp_name */ - sizeof(BPy_ReadMapPixelF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ReadMapPixelF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DFloat_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ReadMapPixelF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "ReadMapPixelF0D", /* tp_name */ + sizeof(BPy_ReadMapPixelF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ReadMapPixelF0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0DFloat_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ReadMapPixelF0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.h index 3c6a05d8233..014a4aa2b8e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject ReadMapPixelF0D_Type; -#define BPy_ReadMapPixelF0D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&ReadMapPixelF0D_Type)) +#define BPy_ReadMapPixelF0D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&ReadMapPixelF0D_Type)) /*---------------------------Python BPy_ReadMapPixelF0D structure definition----------*/ typedef struct { - BPy_UnaryFunction0DFloat py_uf0D_float; + BPy_UnaryFunction0DFloat py_uf0D_float; } BPy_ReadMapPixelF0D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 99f87dfcdee..3dec389f1f1 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 @@ -31,82 +31,84 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ReadSteerableViewMapPixelF0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DFloat` > :class:`ReadSteerableViewMapPixelF0D`\n" -"\n" -".. method:: __init__(orientation, level)\n" -"\n" -" Builds a ReadSteerableViewMapPixelF0D object.\n" -"\n" -" :arg orientation: The integer belonging to [0, 4] indicating the\n" -" orientation (E, NE, N, NW) we are interested in.\n" -" :type orientation: int\n" -" :arg level: The level of the pyramid from which the pixel must be\n" -" read.\n" -" :type level: int\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Reads a pixel in one of the level of one of the steerable viewmaps.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: A pixel in one of the level of one of the steerable viewmaps.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > " + ":class:`freestyle.types.UnaryFunction0DFloat` > :class:`ReadSteerableViewMapPixelF0D`\n" + "\n" + ".. method:: __init__(orientation, level)\n" + "\n" + " Builds a ReadSteerableViewMapPixelF0D object.\n" + "\n" + " :arg orientation: The integer belonging to [0, 4] indicating the\n" + " orientation (E, NE, N, NW) we are interested in.\n" + " :type orientation: int\n" + " :arg level: The level of the pyramid from which the pixel must be\n" + " read.\n" + " :type level: int\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Reads a pixel in one of the level of one of the steerable viewmaps.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: A pixel in one of the level of one of the steerable viewmaps.\n" + " :rtype: float\n"; -static int ReadSteerableViewMapPixelF0D___init__(BPy_ReadSteerableViewMapPixelF0D *self, PyObject *args, PyObject *kwds) +static int ReadSteerableViewMapPixelF0D___init__(BPy_ReadSteerableViewMapPixelF0D *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"orientation", "level", NULL}; - unsigned int u; - int i; + static const char *kwlist[] = {"orientation", "level", NULL}; + unsigned int u; + int 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; + 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; } /*-----------------------BPy_ReadSteerableViewMapPixelF0D type definition ------------------------------*/ PyTypeObject ReadSteerableViewMapPixelF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ReadSteerableViewMapPixelF0D", /* tp_name */ - sizeof(BPy_ReadSteerableViewMapPixelF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ReadSteerableViewMapPixelF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DFloat_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ReadSteerableViewMapPixelF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "ReadSteerableViewMapPixelF0D", /* tp_name */ + sizeof(BPy_ReadSteerableViewMapPixelF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ReadSteerableViewMapPixelF0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0DFloat_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ReadSteerableViewMapPixelF0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.h index 07d9b4996de..c0c62a50941 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.h @@ -32,14 +32,13 @@ extern "C" { extern PyTypeObject ReadSteerableViewMapPixelF0D_Type; #define BPy_ReadSteerableViewMapPixelF0D_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&ReadSteerableViewMapPixelF0D_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&ReadSteerableViewMapPixelF0D_Type)) /*---------------------------Python BPy_ReadSteerableViewMapPixelF0D structure definition----------*/ typedef struct { - BPy_UnaryFunction0DFloat py_uf0D_float; + BPy_UnaryFunction0DFloat py_uf0D_float; } BPy_ReadSteerableViewMapPixelF0D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 6569c8a8c1f..f35f6ad7814 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 @@ -31,80 +31,82 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char QuantitativeInvisibilityF0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DUnsigned` > :class:`QuantitativeInvisibilityF0D`\n" -"\n" -".. method:: __init__()\n" -"\n" -" Builds a QuantitativeInvisibilityF0D object.\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Returns the quantitative invisibility of the\n" -" :class:`freestyle.types.Interface0D` pointed by the\n" -" Interface0DIterator. This evaluation can be ambiguous (in the case of\n" -" a :class:`freestyle.types.TVertex` for example). This functor tries\n" -" to remove this ambiguity using the context offered by the 1D element\n" -" to which the Interface0D belongs to. However, there still can be\n" -" problematic cases, and the user willing to deal with this cases in a\n" -" specific way should implement its own getQIF0D functor.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: The quantitative invisibility of the pointed Interface0D.\n" -" :rtype: int\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > " + ":class:`freestyle.types.UnaryFunction0DUnsigned` > :class:`QuantitativeInvisibilityF0D`\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Builds a QuantitativeInvisibilityF0D object.\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Returns the quantitative invisibility of the\n" + " :class:`freestyle.types.Interface0D` pointed by the\n" + " Interface0DIterator. This evaluation can be ambiguous (in the case of\n" + " a :class:`freestyle.types.TVertex` for example). This functor tries\n" + " to remove this ambiguity using the context offered by the 1D element\n" + " to which the Interface0D belongs to. However, there still can be\n" + " problematic cases, and the user willing to deal with this cases in a\n" + " specific way should implement its own getQIF0D functor.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: The quantitative invisibility of the pointed Interface0D.\n" + " :rtype: int\n"; -static int QuantitativeInvisibilityF0D___init__(BPy_QuantitativeInvisibilityF0D *self, PyObject *args, PyObject *kwds) +static int QuantitativeInvisibilityF0D___init__(BPy_QuantitativeInvisibilityF0D *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - 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; + 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; } /*-----------------------BPy_QuantitativeInvisibilityF0D type definition ------------------------------*/ PyTypeObject QuantitativeInvisibilityF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "QuantitativeInvisibilityF0D", /* tp_name */ - sizeof(BPy_QuantitativeInvisibilityF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - QuantitativeInvisibilityF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DUnsigned_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)QuantitativeInvisibilityF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "QuantitativeInvisibilityF0D", /* tp_name */ + sizeof(BPy_QuantitativeInvisibilityF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + QuantitativeInvisibilityF0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0DUnsigned_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)QuantitativeInvisibilityF0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.h index cf2bfaac9b6..933deb706ee 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.h @@ -32,14 +32,13 @@ extern "C" { extern PyTypeObject QuantitativeInvisibilityF0D_Type; #define BPy_QuantitativeInvisibilityF0D_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&QuantitativeInvisibilityF0D_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&QuantitativeInvisibilityF0D_Type)) /*---------------------------Python BPy_QuantitativeInvisibilityF0D structure definition----------*/ typedef struct { - BPy_UnaryFunction0DUnsigned py_uf0D_unsigned; + BPy_UnaryFunction0DUnsigned py_uf0D_unsigned; } BPy_QuantitativeInvisibilityF0D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 e0753337d1b..37f8f82978f 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 @@ -31,75 +31,75 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetOccludersF0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > :class:`freestyle.types.UnaryFunction0DVectorViewShape` > :class:`GetOccludersF0D`\n" -"\n" -".. method:: __init__()\n" -"\n" -" Builds a GetOccludersF0D object.\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Returns a list of :class:`freestyle.types.ViewShape` objects occluding the\n" -" :class:`freestyle.types.Interface0D` pointed by the Interface0DIterator.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: A list of ViewShape objects occluding the pointed\n" -" Interface0D.\n" -" :rtype: list of :class:`freestyle.types.ViewShape` objects\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction0D` > " + ":class:`freestyle.types.UnaryFunction0DVectorViewShape` > :class:`GetOccludersF0D`\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Builds a GetOccludersF0D object.\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Returns a list of :class:`freestyle.types.ViewShape` objects occluding the\n" + " :class:`freestyle.types.Interface0D` pointed by the Interface0DIterator.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: A list of ViewShape objects occluding the pointed\n" + " Interface0D.\n" + " :rtype: list of :class:`freestyle.types.ViewShape` objects\n"; static int GetOccludersF0D___init__(BPy_GetOccludersF0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - 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; + 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; } /*-----------------------BPy_GetOccludersF0D type definition ------------------------------*/ PyTypeObject GetOccludersF0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "GetOccludersF0D", /* tp_name */ - sizeof(BPy_GetOccludersF0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetOccludersF0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction0DVectorViewShape_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetOccludersF0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "GetOccludersF0D", /* tp_name */ + sizeof(BPy_GetOccludersF0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetOccludersF0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction0DVectorViewShape_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetOccludersF0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.h b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.h index 0c74fcd5234..82889b64aba 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject GetOccludersF0D_Type; -#define BPy_GetOccludersF0D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetOccludersF0D_Type)) +#define BPy_GetOccludersF0D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetOccludersF0D_Type)) /*---------------------------Python BPy_GetOccludersF0D structure definition----------*/ typedef struct { - BPy_UnaryFunction0DVectorViewShape py_uf0D_vectorviewshape; + BPy_UnaryFunction0DVectorViewShape py_uf0D_vectorviewshape; } BPy_GetOccludersF0D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp index 5d6863d4e8e..84aa10098ee 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp @@ -49,229 +49,243 @@ extern "C" { int UnaryFunction1DDouble_Init(PyObject *module) { - if (module == NULL) - return -1; - - 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) - return -1; - Py_INCREF(&DensityF1D_Type); - PyModule_AddObject(module, "DensityF1D", (PyObject *)&DensityF1D_Type); - - 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) - return -1; - Py_INCREF(&GetCompleteViewMapDensityF1D_Type); - PyModule_AddObject(module, "GetCompleteViewMapDensityF1D", (PyObject *)&GetCompleteViewMapDensityF1D_Type); - - 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) - return -1; - Py_INCREF(&GetProjectedXF1D_Type); - PyModule_AddObject(module, "GetProjectedXF1D", (PyObject *)&GetProjectedXF1D_Type); - - 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) - return -1; - Py_INCREF(&GetProjectedZF1D_Type); - PyModule_AddObject(module, "GetProjectedZF1D", (PyObject *)&GetProjectedZF1D_Type); - - 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) - return -1; - Py_INCREF(&GetViewMapGradientNormF1D_Type); - PyModule_AddObject(module, "GetViewMapGradientNormF1D", (PyObject *)&GetViewMapGradientNormF1D_Type); - - 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) - return -1; - Py_INCREF(&GetYF1D_Type); - PyModule_AddObject(module, "GetYF1D", (PyObject *)&GetYF1D_Type); - - 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) - return -1; - Py_INCREF(&LocalAverageDepthF1D_Type); - PyModule_AddObject(module, "LocalAverageDepthF1D", (PyObject *)&LocalAverageDepthF1D_Type); - - if (PyType_Ready(&ZDiscontinuityF1D_Type) < 0) - return -1; - Py_INCREF(&ZDiscontinuityF1D_Type); - PyModule_AddObject(module, "ZDiscontinuityF1D", (PyObject *)&ZDiscontinuityF1D_Type); - - return 0; + if (module == NULL) + return -1; + + 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) + return -1; + Py_INCREF(&DensityF1D_Type); + PyModule_AddObject(module, "DensityF1D", (PyObject *)&DensityF1D_Type); + + 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) + return -1; + Py_INCREF(&GetCompleteViewMapDensityF1D_Type); + PyModule_AddObject( + module, "GetCompleteViewMapDensityF1D", (PyObject *)&GetCompleteViewMapDensityF1D_Type); + + 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) + return -1; + Py_INCREF(&GetProjectedXF1D_Type); + PyModule_AddObject(module, "GetProjectedXF1D", (PyObject *)&GetProjectedXF1D_Type); + + 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) + return -1; + Py_INCREF(&GetProjectedZF1D_Type); + PyModule_AddObject(module, "GetProjectedZF1D", (PyObject *)&GetProjectedZF1D_Type); + + 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) + return -1; + Py_INCREF(&GetViewMapGradientNormF1D_Type); + PyModule_AddObject( + module, "GetViewMapGradientNormF1D", (PyObject *)&GetViewMapGradientNormF1D_Type); + + 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) + return -1; + Py_INCREF(&GetYF1D_Type); + PyModule_AddObject(module, "GetYF1D", (PyObject *)&GetYF1D_Type); + + 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) + return -1; + Py_INCREF(&LocalAverageDepthF1D_Type); + PyModule_AddObject(module, "LocalAverageDepthF1D", (PyObject *)&LocalAverageDepthF1D_Type); + + if (PyType_Ready(&ZDiscontinuityF1D_Type) < 0) + return -1; + Py_INCREF(&ZDiscontinuityF1D_Type); + PyModule_AddObject(module, "ZDiscontinuityF1D", (PyObject *)&ZDiscontinuityF1D_Type); + + return 0; } //------------------------INSTANCE METHODS ---------------------------------- static char UnaryFunction1DDouble___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble`\n" -"\n" -"Base class for unary functions (functors) that work on\n" -":class:`Interface1D` and return a float value.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __init__(integration_type)\n" -"\n" -" Builds a unary 1D function using the integration method given as\n" -" argument.\n" -"\n" -" :arg integration_type: An integration method.\n" -" :type integration_type: :class:`IntegrationType`\n"; - -static int UnaryFunction1DDouble___init__(BPy_UnaryFunction1DDouble *self, PyObject *args, PyObject *kwds) + "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DDouble`\n" + "\n" + "Base class for unary functions (functors) that work on\n" + ":class:`Interface1D` and return a float value.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __init__(integration_type)\n" + "\n" + " Builds a unary 1D function using the integration method given as\n" + " argument.\n" + "\n" + " :arg integration_type: An integration method.\n" + " :type integration_type: :class:`IntegrationType`\n"; + +static int UnaryFunction1DDouble___init__(BPy_UnaryFunction1DDouble *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"integration", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration", NULL}; + PyObject *obj = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) - return -1; + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) + return -1; - if (!obj) - self->uf1D_double = new UnaryFunction1D(); - else { - self->uf1D_double = new UnaryFunction1D(IntegrationType_from_BPy_IntegrationType(obj)); - } + if (!obj) + self->uf1D_double = new UnaryFunction1D(); + else { + self->uf1D_double = new UnaryFunction1D(IntegrationType_from_BPy_IntegrationType(obj)); + } - self->uf1D_double->py_uf1D = (PyObject *)self; + self->uf1D_double->py_uf1D = (PyObject *)self; - return 0; + return 0; } static void UnaryFunction1DDouble___dealloc__(BPy_UnaryFunction1DDouble *self) { - if (self->uf1D_double) - delete self->uf1D_double; - UnaryFunction1D_Type.tp_dealloc((PyObject *)self); + if (self->uf1D_double) + delete self->uf1D_double; + UnaryFunction1D_Type.tp_dealloc((PyObject *)self); } static PyObject *UnaryFunction1DDouble___repr__(BPy_UnaryFunction1DDouble *self) { - return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_double); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_double); } -static PyObject *UnaryFunction1DDouble___call__(BPy_UnaryFunction1DDouble *self, PyObject *args, PyObject *kwds) +static PyObject *UnaryFunction1DDouble___call__(BPy_UnaryFunction1DDouble *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"inter", NULL}; - PyObject *obj = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) - return NULL; - - if (typeid(*(self->uf1D_double)) == typeid(UnaryFunction1D)) { - PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; - } - if (self->uf1D_double->operator()(*(((BPy_Interface1D *) obj)->if1D)) < 0) { - if (!PyErr_Occurred()) { - string class_name(Py_TYPE(self)->tp_name); - PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); - } - return NULL; - } - return PyFloat_FromDouble(self->uf1D_double->result); + static const char *kwlist[] = {"inter", NULL}; + PyObject *obj = 0; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) + return NULL; + + if (typeid(*(self->uf1D_double)) == typeid(UnaryFunction1D)) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->uf1D_double->operator()(*(((BPy_Interface1D *)obj)->if1D)) < 0) { + if (!PyErr_Occurred()) { + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); + } + return NULL; + } + return PyFloat_FromDouble(self->uf1D_double->result); } /*----------------------UnaryFunction1DDouble get/setters ----------------------------*/ PyDoc_STRVAR(integration_type_doc, -"The integration method.\n" -"\n" -":type: :class:`IntegrationType`"); + "The integration method.\n" + "\n" + ":type: :class:`IntegrationType`"); static PyObject *integration_type_get(BPy_UnaryFunction1DDouble *self, void *UNUSED(closure)) { - return BPy_IntegrationType_from_IntegrationType(self->uf1D_double->getIntegrationType()); + return BPy_IntegrationType_from_IntegrationType(self->uf1D_double->getIntegrationType()); } -static int integration_type_set(BPy_UnaryFunction1DDouble *self, PyObject *value, void *UNUSED(closure)) +static int integration_type_set(BPy_UnaryFunction1DDouble *self, + PyObject *value, + void *UNUSED(closure)) { - if (!BPy_IntegrationType_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); - return -1; - } - self->uf1D_double->setIntegrationType(IntegrationType_from_BPy_IntegrationType(value)); - return 0; + if (!BPy_IntegrationType_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); + return -1; + } + self->uf1D_double->setIntegrationType(IntegrationType_from_BPy_IntegrationType(value)); + return 0; } static PyGetSetDef BPy_UnaryFunction1DDouble_getseters[] = { - {(char *)"integration_type", (getter)integration_type_get, (setter)integration_type_set, - (char *)integration_type_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"integration_type", + (getter)integration_type_get, + (setter)integration_type_set, + (char *)integration_type_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction1DDouble type definition ------------------------------*/ PyTypeObject UnaryFunction1DDouble_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction1DDouble", /* tp_name */ - sizeof(BPy_UnaryFunction1DDouble), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction1DDouble___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction1DDouble___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction1DDouble___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction1DDouble___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_UnaryFunction1DDouble_getseters, /* tp_getset */ - &UnaryFunction1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction1DDouble___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction1DDouble", /* tp_name */ + sizeof(BPy_UnaryFunction1DDouble), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction1DDouble___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction1DDouble___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction1DDouble___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction1DDouble___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + BPy_UnaryFunction1DDouble_getseters, /* tp_getset */ + &UnaryFunction1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction1DDouble___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.h index 0335356e207..cfd7f954b54 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DDouble.h @@ -31,18 +31,18 @@ extern "C" { extern PyTypeObject UnaryFunction1DDouble_Type; -#define BPy_UnaryFunction1DDouble_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction1DDouble_Type)) +#define BPy_UnaryFunction1DDouble_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction1DDouble_Type)) /*---------------------------Python BPy_UnaryFunction1DDouble structure definition----------*/ typedef struct { - BPy_UnaryFunction1D py_uf1D; - UnaryFunction1D *uf1D_double; + BPy_UnaryFunction1D py_uf1D; + UnaryFunction1D *uf1D_double; } BPy_UnaryFunction1DDouble; /*---------------------------Python BPy_UnaryFunction1DDouble visible prototypes-----------*/ int UnaryFunction1DDouble_Init(PyObject *module); - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp index 41fcab32746..2bcda9718c3 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp @@ -36,165 +36,176 @@ extern "C" { int UnaryFunction1DEdgeNature_Init(PyObject *module) { - if (module == NULL) - return -1; + if (module == NULL) + return -1; - if (PyType_Ready(&UnaryFunction1DEdgeNature_Type) < 0) - return -1; - Py_INCREF(&UnaryFunction1DEdgeNature_Type); - PyModule_AddObject(module, "UnaryFunction1DEdgeNature", (PyObject *)&UnaryFunction1DEdgeNature_Type); + 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) - return -1; - Py_INCREF(&CurveNatureF1D_Type); - PyModule_AddObject(module, "CurveNatureF1D", (PyObject *)&CurveNatureF1D_Type); + if (PyType_Ready(&CurveNatureF1D_Type) < 0) + return -1; + Py_INCREF(&CurveNatureF1D_Type); + PyModule_AddObject(module, "CurveNatureF1D", (PyObject *)&CurveNatureF1D_Type); - return 0; + return 0; } //------------------------INSTANCE METHODS ---------------------------------- static char UnaryFunction1DEdgeNature___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DEdgeNature`\n" -"\n" -"Base class for unary functions (functors) that work on\n" -":class:`Interface1D` and return a :class:`Nature` object.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __init__(integration_type)\n" -"\n" -" Builds a unary 1D function using the integration method given as\n" -" argument.\n" -"\n" -" :arg integration_type: An integration method.\n" -" :type integration_type: :class:`IntegrationType`\n"; - -static int UnaryFunction1DEdgeNature___init__(BPy_UnaryFunction1DEdgeNature *self, PyObject *args, PyObject *kwds) + "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DEdgeNature`\n" + "\n" + "Base class for unary functions (functors) that work on\n" + ":class:`Interface1D` and return a :class:`Nature` object.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __init__(integration_type)\n" + "\n" + " Builds a unary 1D function using the integration method given as\n" + " argument.\n" + "\n" + " :arg integration_type: An integration method.\n" + " :type integration_type: :class:`IntegrationType`\n"; + +static int UnaryFunction1DEdgeNature___init__(BPy_UnaryFunction1DEdgeNature *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"integration", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration", NULL}; + PyObject *obj = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) - return -1; + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) + return -1; - if (!obj) - self->uf1D_edgenature = new UnaryFunction1D(); - else { - self->uf1D_edgenature = new UnaryFunction1D(IntegrationType_from_BPy_IntegrationType(obj)); - } + if (!obj) + self->uf1D_edgenature = new UnaryFunction1D(); + else { + self->uf1D_edgenature = new UnaryFunction1D( + IntegrationType_from_BPy_IntegrationType(obj)); + } - self->uf1D_edgenature->py_uf1D = (PyObject *)self; + self->uf1D_edgenature->py_uf1D = (PyObject *)self; - return 0; + return 0; } static void UnaryFunction1DEdgeNature___dealloc__(BPy_UnaryFunction1DEdgeNature *self) { - if (self->uf1D_edgenature) - delete self->uf1D_edgenature; - UnaryFunction1D_Type.tp_dealloc((PyObject *)self); + if (self->uf1D_edgenature) + delete self->uf1D_edgenature; + UnaryFunction1D_Type.tp_dealloc((PyObject *)self); } static PyObject *UnaryFunction1DEdgeNature___repr__(BPy_UnaryFunction1DEdgeNature *self) { - return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_edgenature); + return PyUnicode_FromFormat( + "type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_edgenature); } static PyObject *UnaryFunction1DEdgeNature___call__(BPy_UnaryFunction1DEdgeNature *self, - PyObject *args, PyObject *kwds) + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"inter", NULL}; - PyObject *obj = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) - return NULL; - - if (typeid(*(self->uf1D_edgenature)) == typeid(UnaryFunction1D)) { - PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; - } - if (self->uf1D_edgenature->operator()(*(((BPy_Interface1D *) obj)->if1D)) < 0) { - if (!PyErr_Occurred()) { - string class_name(Py_TYPE(self)->tp_name); - PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); - } - return NULL; - } - return BPy_Nature_from_Nature(self->uf1D_edgenature->result); + static const char *kwlist[] = {"inter", NULL}; + PyObject *obj = 0; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) + return NULL; + + if (typeid(*(self->uf1D_edgenature)) == typeid(UnaryFunction1D)) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->uf1D_edgenature->operator()(*(((BPy_Interface1D *)obj)->if1D)) < 0) { + if (!PyErr_Occurred()) { + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); + } + return NULL; + } + return BPy_Nature_from_Nature(self->uf1D_edgenature->result); } /*----------------------UnaryFunction1DEdgeNature get/setters ----------------------------*/ PyDoc_STRVAR(integration_type_doc, -"The integration method.\n" -"\n" -":type: :class:`IntegrationType`"); + "The integration method.\n" + "\n" + ":type: :class:`IntegrationType`"); static PyObject *integration_type_get(BPy_UnaryFunction1DEdgeNature *self, void *UNUSED(closure)) { - return BPy_IntegrationType_from_IntegrationType(self->uf1D_edgenature->getIntegrationType()); + return BPy_IntegrationType_from_IntegrationType(self->uf1D_edgenature->getIntegrationType()); } -static int integration_type_set(BPy_UnaryFunction1DEdgeNature *self, PyObject *value, void *UNUSED(closure)) +static int integration_type_set(BPy_UnaryFunction1DEdgeNature *self, + PyObject *value, + void *UNUSED(closure)) { - if (!BPy_IntegrationType_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); - return -1; - } - self->uf1D_edgenature->setIntegrationType(IntegrationType_from_BPy_IntegrationType(value)); - return 0; + if (!BPy_IntegrationType_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); + return -1; + } + self->uf1D_edgenature->setIntegrationType(IntegrationType_from_BPy_IntegrationType(value)); + return 0; } static PyGetSetDef BPy_UnaryFunction1DEdgeNature_getseters[] = { - {(char *)"integration_type", (getter)integration_type_get, (setter)integration_type_set, - (char *)integration_type_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"integration_type", + (getter)integration_type_get, + (setter)integration_type_set, + (char *)integration_type_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction1DEdgeNature type definition ------------------------------*/ PyTypeObject UnaryFunction1DEdgeNature_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction1DEdgeNature", /* tp_name */ - sizeof(BPy_UnaryFunction1DEdgeNature), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction1DEdgeNature___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction1DEdgeNature___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction1DEdgeNature___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction1DEdgeNature___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_UnaryFunction1DEdgeNature_getseters, /* tp_getset */ - &UnaryFunction1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction1DEdgeNature___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction1DEdgeNature", /* tp_name */ + sizeof(BPy_UnaryFunction1DEdgeNature), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction1DEdgeNature___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction1DEdgeNature___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction1DEdgeNature___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction1DEdgeNature___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + BPy_UnaryFunction1DEdgeNature_getseters, /* tp_getset */ + &UnaryFunction1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction1DEdgeNature___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.h index fbe3759d48a..1a7a5a2d7ee 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.h @@ -34,18 +34,17 @@ extern "C" { extern PyTypeObject UnaryFunction1DEdgeNature_Type; #define BPy_UnaryFunction1DEdgeNature_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction1DEdgeNature_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction1DEdgeNature_Type)) /*---------------------------Python BPy_UnaryFunction1DEdgeNature structure definition----------*/ typedef struct { - BPy_UnaryFunction1D py_uf1D; - UnaryFunction1D *uf1D_edgenature; + BPy_UnaryFunction1D py_uf1D; + UnaryFunction1D *uf1D_edgenature; } BPy_UnaryFunction1DEdgeNature; /*---------------------------Python BPy_UnaryFunction1DEdgeNature visible prototypes-----------*/ int UnaryFunction1DEdgeNature_Init(PyObject *module); - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp index 4e0ac9fac12..fcd670ea1e7 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp @@ -34,159 +34,168 @@ extern "C" { int UnaryFunction1DFloat_Init(PyObject *module) { - if (module == NULL) - return -1; + if (module == NULL) + return -1; - if (PyType_Ready(&UnaryFunction1DFloat_Type) < 0) - return -1; - Py_INCREF(&UnaryFunction1DFloat_Type); - PyModule_AddObject(module, "UnaryFunction1DFloat", (PyObject *)&UnaryFunction1DFloat_Type); + if (PyType_Ready(&UnaryFunction1DFloat_Type) < 0) + return -1; + Py_INCREF(&UnaryFunction1DFloat_Type); + PyModule_AddObject(module, "UnaryFunction1DFloat", (PyObject *)&UnaryFunction1DFloat_Type); - return 0; + return 0; } //------------------------INSTANCE METHODS ---------------------------------- static char UnaryFunction1DFloat___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DFloat`\n" -"\n" -"Base class for unary functions (functors) that work on\n" -":class:`Interface1D` and return a float value.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __init__(integration_type)\n" -"\n" -" Builds a unary 1D function using the integration method given as\n" -" argument.\n" -"\n" -" :arg integration_type: An integration method.\n" -" :type integration_type: :class:`IntegrationType`\n"; - -static int UnaryFunction1DFloat___init__(BPy_UnaryFunction1DFloat *self, PyObject *args, PyObject *kwds) + "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DFloat`\n" + "\n" + "Base class for unary functions (functors) that work on\n" + ":class:`Interface1D` and return a float value.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __init__(integration_type)\n" + "\n" + " Builds a unary 1D function using the integration method given as\n" + " argument.\n" + "\n" + " :arg integration_type: An integration method.\n" + " :type integration_type: :class:`IntegrationType`\n"; + +static int UnaryFunction1DFloat___init__(BPy_UnaryFunction1DFloat *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"integration", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration", NULL}; + PyObject *obj = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) - return -1; + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) + return -1; - if (!obj) - self->uf1D_float = new UnaryFunction1D(); - else { - self->uf1D_float = new UnaryFunction1D(IntegrationType_from_BPy_IntegrationType(obj)); - } + if (!obj) + self->uf1D_float = new UnaryFunction1D(); + else { + self->uf1D_float = new UnaryFunction1D(IntegrationType_from_BPy_IntegrationType(obj)); + } - self->uf1D_float->py_uf1D = (PyObject *)self; + self->uf1D_float->py_uf1D = (PyObject *)self; - return 0; + return 0; } static void UnaryFunction1DFloat___dealloc__(BPy_UnaryFunction1DFloat *self) { - if (self->uf1D_float) - delete self->uf1D_float; - UnaryFunction1D_Type.tp_dealloc((PyObject *)self); + if (self->uf1D_float) + delete self->uf1D_float; + UnaryFunction1D_Type.tp_dealloc((PyObject *)self); } static PyObject *UnaryFunction1DFloat___repr__(BPy_UnaryFunction1DFloat *self) { - return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_float); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_float); } -static PyObject *UnaryFunction1DFloat___call__(BPy_UnaryFunction1DFloat *self, PyObject *args, PyObject *kwds) +static PyObject *UnaryFunction1DFloat___call__(BPy_UnaryFunction1DFloat *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"inter", NULL}; - PyObject *obj = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) - return NULL; - - if (typeid(*(self->uf1D_float)) == typeid(UnaryFunction1D)) { - PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; - } - if (self->uf1D_float->operator()(*(((BPy_Interface1D *) obj)->if1D)) < 0) { - if (!PyErr_Occurred()) { - string class_name(Py_TYPE(self)->tp_name); - PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); - } - return NULL; - } - return PyFloat_FromDouble(self->uf1D_float->result); + static const char *kwlist[] = {"inter", NULL}; + PyObject *obj = 0; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) + return NULL; + + if (typeid(*(self->uf1D_float)) == typeid(UnaryFunction1D)) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->uf1D_float->operator()(*(((BPy_Interface1D *)obj)->if1D)) < 0) { + if (!PyErr_Occurred()) { + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); + } + return NULL; + } + return PyFloat_FromDouble(self->uf1D_float->result); } /*----------------------UnaryFunction1DFloat get/setters ----------------------------*/ PyDoc_STRVAR(integration_type_doc, -"The integration method.\n" -"\n" -":type: :class:`IntegrationType`"); + "The integration method.\n" + "\n" + ":type: :class:`IntegrationType`"); static PyObject *integration_type_get(BPy_UnaryFunction1DFloat *self, void *UNUSED(closure)) { - return BPy_IntegrationType_from_IntegrationType(self->uf1D_float->getIntegrationType()); + return BPy_IntegrationType_from_IntegrationType(self->uf1D_float->getIntegrationType()); } -static int integration_type_set(BPy_UnaryFunction1DFloat *self, PyObject *value, void *UNUSED(closure)) +static int integration_type_set(BPy_UnaryFunction1DFloat *self, + PyObject *value, + void *UNUSED(closure)) { - if (!BPy_IntegrationType_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); - return -1; - } - self->uf1D_float->setIntegrationType(IntegrationType_from_BPy_IntegrationType(value)); - return 0; + if (!BPy_IntegrationType_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); + return -1; + } + self->uf1D_float->setIntegrationType(IntegrationType_from_BPy_IntegrationType(value)); + return 0; } static PyGetSetDef BPy_UnaryFunction1DFloat_getseters[] = { - {(char *)"integration_type", (getter)integration_type_get, (setter)integration_type_set, - (char *)integration_type_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"integration_type", + (getter)integration_type_get, + (setter)integration_type_set, + (char *)integration_type_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction1DFloat type definition ------------------------------*/ PyTypeObject UnaryFunction1DFloat_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction1DFloat", /* tp_name */ - sizeof(BPy_UnaryFunction1DFloat), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction1DFloat___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction1DFloat___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction1DFloat___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction1DFloat___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_UnaryFunction1DFloat_getseters, /* tp_getset */ - &UnaryFunction1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction1DFloat___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction1DFloat", /* tp_name */ + sizeof(BPy_UnaryFunction1DFloat), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction1DFloat___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction1DFloat___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction1DFloat___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction1DFloat___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + BPy_UnaryFunction1DFloat_getseters, /* tp_getset */ + &UnaryFunction1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction1DFloat___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.h index 4b269783712..8a5a329b0bf 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DFloat.h @@ -31,18 +31,18 @@ extern "C" { extern PyTypeObject UnaryFunction1DFloat_Type; -#define BPy_UnaryFunction1DFloat_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction1DFloat_Type)) +#define BPy_UnaryFunction1DFloat_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction1DFloat_Type)) /*---------------------------Python BPy_UnaryFunction1DFloat structure definition----------*/ typedef struct { - BPy_UnaryFunction1D py_uf1D; - UnaryFunction1D *uf1D_float; + BPy_UnaryFunction1D py_uf1D; + UnaryFunction1D *uf1D_float; } BPy_UnaryFunction1DFloat; /*---------------------------Python BPy_UnaryFunction1DFloat visible prototypes-----------*/ int UnaryFunction1DFloat_Init(PyObject *module); - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp index 8bb551de823..a28448314cd 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp @@ -36,164 +36,176 @@ extern "C" { int UnaryFunction1DUnsigned_Init(PyObject *module) { - if (module == NULL) - return -1; + if (module == NULL) + return -1; - if (PyType_Ready(&UnaryFunction1DUnsigned_Type) < 0) - return -1; - Py_INCREF(&UnaryFunction1DUnsigned_Type); - PyModule_AddObject(module, "UnaryFunction1DUnsigned", (PyObject *)&UnaryFunction1DUnsigned_Type); + 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) - return -1; - Py_INCREF(&QuantitativeInvisibilityF1D_Type); - PyModule_AddObject(module, "QuantitativeInvisibilityF1D", (PyObject *)&QuantitativeInvisibilityF1D_Type); + if (PyType_Ready(&QuantitativeInvisibilityF1D_Type) < 0) + return -1; + Py_INCREF(&QuantitativeInvisibilityF1D_Type); + PyModule_AddObject( + module, "QuantitativeInvisibilityF1D", (PyObject *)&QuantitativeInvisibilityF1D_Type); - return 0; + return 0; } //------------------------INSTANCE METHODS ---------------------------------- static char UnaryFunction1DUnsigned___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DUnsigned`\n" -"\n" -"Base class for unary functions (functors) that work on\n" -":class:`Interface1D` and return an int value.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __init__(integration_type)\n" -"\n" -" Builds a unary 1D function using the integration method given as\n" -" argument.\n" -"\n" -" :arg integration_type: An integration method.\n" -" :type integration_type: :class:`IntegrationType`\n"; - -static int UnaryFunction1DUnsigned___init__(BPy_UnaryFunction1DUnsigned *self, PyObject *args, PyObject *kwds) + "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DUnsigned`\n" + "\n" + "Base class for unary functions (functors) that work on\n" + ":class:`Interface1D` and return an int value.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __init__(integration_type)\n" + "\n" + " Builds a unary 1D function using the integration method given as\n" + " argument.\n" + "\n" + " :arg integration_type: An integration method.\n" + " :type integration_type: :class:`IntegrationType`\n"; + +static int UnaryFunction1DUnsigned___init__(BPy_UnaryFunction1DUnsigned *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"integration", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration", NULL}; + PyObject *obj = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) - return -1; + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) + return -1; - if (!obj) - self->uf1D_unsigned = new UnaryFunction1D(); - else { - self->uf1D_unsigned = new UnaryFunction1D(IntegrationType_from_BPy_IntegrationType(obj)); - } + if (!obj) + self->uf1D_unsigned = new UnaryFunction1D(); + else { + self->uf1D_unsigned = new UnaryFunction1D( + IntegrationType_from_BPy_IntegrationType(obj)); + } - self->uf1D_unsigned->py_uf1D = (PyObject *)self; + self->uf1D_unsigned->py_uf1D = (PyObject *)self; - return 0; + return 0; } static void UnaryFunction1DUnsigned___dealloc__(BPy_UnaryFunction1DUnsigned *self) { - if (self->uf1D_unsigned) - delete self->uf1D_unsigned; - UnaryFunction1D_Type.tp_dealloc((PyObject *)self); + if (self->uf1D_unsigned) + delete self->uf1D_unsigned; + UnaryFunction1D_Type.tp_dealloc((PyObject *)self); } static PyObject *UnaryFunction1DUnsigned___repr__(BPy_UnaryFunction1DUnsigned *self) { - return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_unsigned); + return PyUnicode_FromFormat( + "type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_unsigned); } -static PyObject *UnaryFunction1DUnsigned___call__(BPy_UnaryFunction1DUnsigned *self, PyObject *args, PyObject *kwds) +static PyObject *UnaryFunction1DUnsigned___call__(BPy_UnaryFunction1DUnsigned *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"inter", NULL}; - PyObject *obj = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) - return NULL; - - if (typeid(*(self->uf1D_unsigned)) == typeid(UnaryFunction1D)) { - PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; - } - if (self->uf1D_unsigned->operator()(*(((BPy_Interface1D *) obj)->if1D)) < 0) { - if (!PyErr_Occurred()) { - string class_name(Py_TYPE(self)->tp_name); - PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); - } - return NULL; - } - return PyLong_FromLong(self->uf1D_unsigned->result); + static const char *kwlist[] = {"inter", NULL}; + PyObject *obj = 0; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) + return NULL; + + if (typeid(*(self->uf1D_unsigned)) == typeid(UnaryFunction1D)) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->uf1D_unsigned->operator()(*(((BPy_Interface1D *)obj)->if1D)) < 0) { + if (!PyErr_Occurred()) { + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); + } + return NULL; + } + return PyLong_FromLong(self->uf1D_unsigned->result); } /*----------------------UnaryFunction1DUnsigned get/setters ----------------------------*/ PyDoc_STRVAR(integration_type_doc, -"The integration method.\n" -"\n" -":type: :class:`IntegrationType`"); + "The integration method.\n" + "\n" + ":type: :class:`IntegrationType`"); static PyObject *integration_type_get(BPy_UnaryFunction1DUnsigned *self, void *UNUSED(closure)) { - return BPy_IntegrationType_from_IntegrationType(self->uf1D_unsigned->getIntegrationType()); + return BPy_IntegrationType_from_IntegrationType(self->uf1D_unsigned->getIntegrationType()); } -static int integration_type_set(BPy_UnaryFunction1DUnsigned *self, PyObject *value, void *UNUSED(closure)) +static int integration_type_set(BPy_UnaryFunction1DUnsigned *self, + PyObject *value, + void *UNUSED(closure)) { - if (!BPy_IntegrationType_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); - return -1; - } - self->uf1D_unsigned->setIntegrationType(IntegrationType_from_BPy_IntegrationType(value)); - return 0; + if (!BPy_IntegrationType_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); + return -1; + } + self->uf1D_unsigned->setIntegrationType(IntegrationType_from_BPy_IntegrationType(value)); + return 0; } static PyGetSetDef BPy_UnaryFunction1DUnsigned_getseters[] = { - {(char *)"integration_type", (getter)integration_type_get, (setter)integration_type_set, - (char *)integration_type_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"integration_type", + (getter)integration_type_get, + (setter)integration_type_set, + (char *)integration_type_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction1DUnsigned type definition ------------------------------*/ PyTypeObject UnaryFunction1DUnsigned_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction1DUnsigned", /* tp_name */ - sizeof(BPy_UnaryFunction1DUnsigned), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction1DUnsigned___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction1DUnsigned___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction1DUnsigned___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction1DUnsigned___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_UnaryFunction1DUnsigned_getseters, /* tp_getset */ - &UnaryFunction1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction1DUnsigned___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction1DUnsigned", /* tp_name */ + sizeof(BPy_UnaryFunction1DUnsigned), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction1DUnsigned___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction1DUnsigned___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction1DUnsigned___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction1DUnsigned___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + BPy_UnaryFunction1DUnsigned_getseters, /* tp_getset */ + &UnaryFunction1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction1DUnsigned___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.h index 28f2bd7270c..b18bf34b27e 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.h @@ -32,18 +32,17 @@ extern "C" { extern PyTypeObject UnaryFunction1DUnsigned_Type; #define BPy_UnaryFunction1DUnsigned_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction1DUnsigned_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction1DUnsigned_Type)) /*---------------------------Python BPy_UnaryFunction1DUnsigned structure definition----------*/ typedef struct { - BPy_UnaryFunction1D py_uf1D; - UnaryFunction1D *uf1D_unsigned; + BPy_UnaryFunction1D py_uf1D; + UnaryFunction1D *uf1D_unsigned; } BPy_UnaryFunction1DUnsigned; /*---------------------------Python BPy_UnaryFunction1DUnsigned visible prototypes-----------*/ int UnaryFunction1DUnsigned_Init(PyObject *module); - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp index 525218374a7..d41f035af3f 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp @@ -37,169 +37,178 @@ extern "C" { int UnaryFunction1DVec2f_Init(PyObject *module) { - if (module == NULL) - return -1; + if (module == NULL) + return -1; - if (PyType_Ready(&UnaryFunction1DVec2f_Type) < 0) - return -1; - Py_INCREF(&UnaryFunction1DVec2f_Type); - PyModule_AddObject(module, "UnaryFunction1DVec2f", (PyObject *)&UnaryFunction1DVec2f_Type); + 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) - return -1; - Py_INCREF(&Normal2DF1D_Type); - PyModule_AddObject(module, "Normal2DF1D", (PyObject *)&Normal2DF1D_Type); + 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) - return -1; - Py_INCREF(&Orientation2DF1D_Type); - PyModule_AddObject(module, "Orientation2DF1D", (PyObject *)&Orientation2DF1D_Type); + if (PyType_Ready(&Orientation2DF1D_Type) < 0) + return -1; + Py_INCREF(&Orientation2DF1D_Type); + PyModule_AddObject(module, "Orientation2DF1D", (PyObject *)&Orientation2DF1D_Type); - return 0; + return 0; } //------------------------INSTANCE METHODS ---------------------------------- static char UnaryFunction1DVec2f___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DVec2f`\n" -"\n" -"Base class for unary functions (functors) that work on\n" -":class:`Interface1D` and return a 2D vector.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __init__(integration_type)\n" -"\n" -" Builds a unary 1D function using the integration method given as\n" -" argument.\n" -"\n" -" :arg integration_type: An integration method.\n" -" :type integration_type: :class:`IntegrationType`\n"; - -static int UnaryFunction1DVec2f___init__(BPy_UnaryFunction1DVec2f *self, PyObject *args, PyObject *kwds) + "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DVec2f`\n" + "\n" + "Base class for unary functions (functors) that work on\n" + ":class:`Interface1D` and return a 2D vector.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __init__(integration_type)\n" + "\n" + " Builds a unary 1D function using the integration method given as\n" + " argument.\n" + "\n" + " :arg integration_type: An integration method.\n" + " :type integration_type: :class:`IntegrationType`\n"; + +static int UnaryFunction1DVec2f___init__(BPy_UnaryFunction1DVec2f *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"integration", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration", NULL}; + PyObject *obj = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) - return -1; + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) + return -1; - if (!obj) - self->uf1D_vec2f = new UnaryFunction1D(); - else { - self->uf1D_vec2f = new UnaryFunction1D(IntegrationType_from_BPy_IntegrationType(obj)); - } + if (!obj) + self->uf1D_vec2f = new UnaryFunction1D(); + else { + self->uf1D_vec2f = new UnaryFunction1D(IntegrationType_from_BPy_IntegrationType(obj)); + } - self->uf1D_vec2f->py_uf1D = (PyObject *)self; + self->uf1D_vec2f->py_uf1D = (PyObject *)self; - return 0; + return 0; } static void UnaryFunction1DVec2f___dealloc__(BPy_UnaryFunction1DVec2f *self) { - if (self->uf1D_vec2f) - delete self->uf1D_vec2f; - UnaryFunction1D_Type.tp_dealloc((PyObject *)self); + if (self->uf1D_vec2f) + delete self->uf1D_vec2f; + UnaryFunction1D_Type.tp_dealloc((PyObject *)self); } static PyObject *UnaryFunction1DVec2f___repr__(BPy_UnaryFunction1DVec2f *self) { - return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_vec2f); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_vec2f); } -static PyObject *UnaryFunction1DVec2f___call__(BPy_UnaryFunction1DVec2f *self, PyObject *args, PyObject *kwds) +static PyObject *UnaryFunction1DVec2f___call__(BPy_UnaryFunction1DVec2f *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"inter", NULL}; - PyObject *obj = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) - return NULL; - - if (typeid(*(self->uf1D_vec2f)) == typeid(UnaryFunction1D)) { - PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; - } - if (self->uf1D_vec2f->operator()(*(((BPy_Interface1D *) obj)->if1D)) < 0) { - if (!PyErr_Occurred()) { - string class_name(Py_TYPE(self)->tp_name); - PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); - } - return NULL; - } - return Vector_from_Vec2f(self->uf1D_vec2f->result); + static const char *kwlist[] = {"inter", NULL}; + PyObject *obj = 0; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) + return NULL; + + if (typeid(*(self->uf1D_vec2f)) == typeid(UnaryFunction1D)) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->uf1D_vec2f->operator()(*(((BPy_Interface1D *)obj)->if1D)) < 0) { + if (!PyErr_Occurred()) { + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); + } + return NULL; + } + return Vector_from_Vec2f(self->uf1D_vec2f->result); } /*----------------------UnaryFunction1DVec2f get/setters ----------------------------*/ PyDoc_STRVAR(integration_type_doc, -"The integration method.\n" -"\n" -":type: :class:`IntegrationType`"); + "The integration method.\n" + "\n" + ":type: :class:`IntegrationType`"); static PyObject *integration_type_get(BPy_UnaryFunction1DVec2f *self, void *UNUSED(closure)) { - return BPy_IntegrationType_from_IntegrationType(self->uf1D_vec2f->getIntegrationType()); + return BPy_IntegrationType_from_IntegrationType(self->uf1D_vec2f->getIntegrationType()); } -static int integration_type_set(BPy_UnaryFunction1DVec2f *self, PyObject *value, void *UNUSED(closure)) +static int integration_type_set(BPy_UnaryFunction1DVec2f *self, + PyObject *value, + void *UNUSED(closure)) { - if (!BPy_IntegrationType_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); - return -1; - } - self->uf1D_vec2f->setIntegrationType(IntegrationType_from_BPy_IntegrationType(value)); - return 0; + if (!BPy_IntegrationType_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); + return -1; + } + self->uf1D_vec2f->setIntegrationType(IntegrationType_from_BPy_IntegrationType(value)); + return 0; } static PyGetSetDef BPy_UnaryFunction1DVec2f_getseters[] = { - {(char *)"integration_type", (getter)integration_type_get, (setter)integration_type_set, - (char *)integration_type_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"integration_type", + (getter)integration_type_get, + (setter)integration_type_set, + (char *)integration_type_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction1DVec2f type definition ------------------------------*/ PyTypeObject UnaryFunction1DVec2f_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction1DVec2f", /* tp_name */ - sizeof(BPy_UnaryFunction1DVec2f), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction1DVec2f___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction1DVec2f___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction1DVec2f___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction1DVec2f___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_UnaryFunction1DVec2f_getseters, /* tp_getset */ - &UnaryFunction1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction1DVec2f___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction1DVec2f", /* tp_name */ + sizeof(BPy_UnaryFunction1DVec2f), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction1DVec2f___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction1DVec2f___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction1DVec2f___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction1DVec2f___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + BPy_UnaryFunction1DVec2f_getseters, /* tp_getset */ + &UnaryFunction1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction1DVec2f___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.h index 56a10d8c1eb..f4cad92334f 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec2f.h @@ -34,18 +34,18 @@ extern "C" { extern PyTypeObject UnaryFunction1DVec2f_Type; -#define BPy_UnaryFunction1DVec2f_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction1DVec2f_Type)) +#define BPy_UnaryFunction1DVec2f_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction1DVec2f_Type)) /*---------------------------Python BPy_UnaryFunction1DVec2f structure definition----------*/ typedef struct { - BPy_UnaryFunction1D py_uf1D; - UnaryFunction1D *uf1D_vec2f; + BPy_UnaryFunction1D py_uf1D; + UnaryFunction1D *uf1D_vec2f; } BPy_UnaryFunction1DVec2f; /*---------------------------Python BPy_UnaryFunction1DVec2f visible prototypes-----------*/ int UnaryFunction1DVec2f_Init(PyObject *module); - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp index ace1fb7f153..61b393cd732 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp @@ -36,164 +36,173 @@ extern "C" { int UnaryFunction1DVec3f_Init(PyObject *module) { - if (module == NULL) - return -1; + if (module == NULL) + return -1; - if (PyType_Ready(&UnaryFunction1DVec3f_Type) < 0) - return -1; - Py_INCREF(&UnaryFunction1DVec3f_Type); - PyModule_AddObject(module, "UnaryFunction1DVec3f", (PyObject *)&UnaryFunction1DVec3f_Type); + 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) - return -1; - Py_INCREF(&Orientation3DF1D_Type); - PyModule_AddObject(module, "Orientation3DF1D", (PyObject *)&Orientation3DF1D_Type); + if (PyType_Ready(&Orientation3DF1D_Type) < 0) + return -1; + Py_INCREF(&Orientation3DF1D_Type); + PyModule_AddObject(module, "Orientation3DF1D", (PyObject *)&Orientation3DF1D_Type); - return 0; + return 0; } //------------------------INSTANCE METHODS ---------------------------------- static char UnaryFunction1DVec3f___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DVec3f`\n" -"\n" -"Base class for unary functions (functors) that work on\n" -":class:`Interface1D` and return a 3D vector.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __init__(integration_type)\n" -"\n" -" Builds a unary 1D function using the integration method given as\n" -" argument.\n" -"\n" -" :arg integration_type: An integration method.\n" -" :type integration_type: :class:`IntegrationType`\n"; - -static int UnaryFunction1DVec3f___init__(BPy_UnaryFunction1DVec3f *self, PyObject *args, PyObject *kwds) + "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DVec3f`\n" + "\n" + "Base class for unary functions (functors) that work on\n" + ":class:`Interface1D` and return a 3D vector.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __init__(integration_type)\n" + "\n" + " Builds a unary 1D function using the integration method given as\n" + " argument.\n" + "\n" + " :arg integration_type: An integration method.\n" + " :type integration_type: :class:`IntegrationType`\n"; + +static int UnaryFunction1DVec3f___init__(BPy_UnaryFunction1DVec3f *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"integration", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration", NULL}; + PyObject *obj = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) - return -1; + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) + return -1; - if (!obj) - self->uf1D_vec3f = new UnaryFunction1D(); - else { - self->uf1D_vec3f = new UnaryFunction1D(IntegrationType_from_BPy_IntegrationType(obj)); - } + if (!obj) + self->uf1D_vec3f = new UnaryFunction1D(); + else { + self->uf1D_vec3f = new UnaryFunction1D(IntegrationType_from_BPy_IntegrationType(obj)); + } - self->uf1D_vec3f->py_uf1D = (PyObject *)self; + self->uf1D_vec3f->py_uf1D = (PyObject *)self; - return 0; + return 0; } static void UnaryFunction1DVec3f___dealloc__(BPy_UnaryFunction1DVec3f *self) { - if (self->uf1D_vec3f) - delete self->uf1D_vec3f; - UnaryFunction1D_Type.tp_dealloc((PyObject *)self); + if (self->uf1D_vec3f) + delete self->uf1D_vec3f; + UnaryFunction1D_Type.tp_dealloc((PyObject *)self); } static PyObject *UnaryFunction1DVec3f___repr__(BPy_UnaryFunction1DVec3f *self) { - return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_vec3f); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_vec3f); } -static PyObject *UnaryFunction1DVec3f___call__(BPy_UnaryFunction1DVec3f *self, PyObject *args, PyObject *kwds) +static PyObject *UnaryFunction1DVec3f___call__(BPy_UnaryFunction1DVec3f *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"inter", NULL}; - PyObject *obj = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) - return NULL; - - if (typeid(*(self->uf1D_vec3f)) == typeid(UnaryFunction1D)) { - PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; - } - if (self->uf1D_vec3f->operator()(*(((BPy_Interface1D *) obj)->if1D)) < 0) { - if (!PyErr_Occurred()) { - string class_name(Py_TYPE(self)->tp_name); - PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); - } - return NULL; - } - return Vector_from_Vec3f(self->uf1D_vec3f->result); + static const char *kwlist[] = {"inter", NULL}; + PyObject *obj = 0; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) + return NULL; + + if (typeid(*(self->uf1D_vec3f)) == typeid(UnaryFunction1D)) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->uf1D_vec3f->operator()(*(((BPy_Interface1D *)obj)->if1D)) < 0) { + if (!PyErr_Occurred()) { + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); + } + return NULL; + } + return Vector_from_Vec3f(self->uf1D_vec3f->result); } /*----------------------UnaryFunction1DVec3f get/setters ----------------------------*/ PyDoc_STRVAR(integration_type_doc, -"The integration method.\n" -"\n" -":type: :class:`IntegrationType`"); + "The integration method.\n" + "\n" + ":type: :class:`IntegrationType`"); static PyObject *integration_type_get(BPy_UnaryFunction1DVec3f *self, void *UNUSED(closure)) { - return BPy_IntegrationType_from_IntegrationType(self->uf1D_vec3f->getIntegrationType()); + return BPy_IntegrationType_from_IntegrationType(self->uf1D_vec3f->getIntegrationType()); } -static int integration_type_set(BPy_UnaryFunction1DVec3f *self, PyObject *value, void *UNUSED(closure)) +static int integration_type_set(BPy_UnaryFunction1DVec3f *self, + PyObject *value, + void *UNUSED(closure)) { - if (!BPy_IntegrationType_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); - return -1; - } - self->uf1D_vec3f->setIntegrationType(IntegrationType_from_BPy_IntegrationType(value)); - return 0; + if (!BPy_IntegrationType_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); + return -1; + } + self->uf1D_vec3f->setIntegrationType(IntegrationType_from_BPy_IntegrationType(value)); + return 0; } static PyGetSetDef BPy_UnaryFunction1DVec3f_getseters[] = { - {(char *)"integration_type", (getter)integration_type_get, (setter)integration_type_set, - (char *)integration_type_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"integration_type", + (getter)integration_type_get, + (setter)integration_type_set, + (char *)integration_type_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction1DVec3f type definition ------------------------------*/ PyTypeObject UnaryFunction1DVec3f_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction1DVec3f", /* tp_name */ - sizeof(BPy_UnaryFunction1DVec3f), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction1DVec3f___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction1DVec3f___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction1DVec3f___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction1DVec3f___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_UnaryFunction1DVec3f_getseters, /* tp_getset */ - &UnaryFunction1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction1DVec3f___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction1DVec3f", /* tp_name */ + sizeof(BPy_UnaryFunction1DVec3f), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction1DVec3f___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction1DVec3f___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction1DVec3f___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction1DVec3f___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + BPy_UnaryFunction1DVec3f_getseters, /* tp_getset */ + &UnaryFunction1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction1DVec3f___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.h index 57257bec850..253a8d550e3 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVec3f.h @@ -34,18 +34,18 @@ extern "C" { extern PyTypeObject UnaryFunction1DVec3f_Type; -#define BPy_UnaryFunction1DVec3f_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction1DVec3f_Type)) +#define BPy_UnaryFunction1DVec3f_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction1DVec3f_Type)) /*---------------------------Python BPy_UnaryFunction1DVec3f structure definition----------*/ typedef struct { - BPy_UnaryFunction1D py_uf1D; - UnaryFunction1D *uf1D_vec3f; + BPy_UnaryFunction1D py_uf1D; + UnaryFunction1D *uf1D_vec3f; } BPy_UnaryFunction1DVec3f; /*---------------------------Python BPy_UnaryFunction1DVec3f visible prototypes-----------*/ int UnaryFunction1DVec3f_Init(PyObject *module); - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp index 1be830c2e89..f7a80a270b6 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp @@ -38,186 +38,198 @@ extern "C" { int UnaryFunction1DVectorViewShape_Init(PyObject *module) { - if (module == NULL) - return -1; - - 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) - return -1; - Py_INCREF(&GetOccludeeF1D_Type); - PyModule_AddObject(module, "GetOccludeeF1D", (PyObject *)&GetOccludeeF1D_Type); - - 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) - return -1; - Py_INCREF(&GetShapeF1D_Type); - PyModule_AddObject(module, "GetShapeF1D", (PyObject *)&GetShapeF1D_Type); - - return 0; + if (module == NULL) + return -1; + + 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) + return -1; + Py_INCREF(&GetOccludeeF1D_Type); + PyModule_AddObject(module, "GetOccludeeF1D", (PyObject *)&GetOccludeeF1D_Type); + + 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) + return -1; + Py_INCREF(&GetShapeF1D_Type); + PyModule_AddObject(module, "GetShapeF1D", (PyObject *)&GetShapeF1D_Type); + + return 0; } //------------------------INSTANCE METHODS ---------------------------------- static char UnaryFunction1DVectorViewShape___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DVectorViewShape`\n" -"\n" -"Base class for unary functions (functors) that work on\n" -":class:`Interface1D` and return a list of :class:`ViewShape`\n" -"objects.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __init__(integration_type)\n" -"\n" -" Builds a unary 1D function using the integration method given as\n" -" argument.\n" -"\n" -" :arg integration_type: An integration method.\n" -" :type integration_type: :class:`IntegrationType`\n"; + "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DVectorViewShape`\n" + "\n" + "Base class for unary functions (functors) that work on\n" + ":class:`Interface1D` and return a list of :class:`ViewShape`\n" + "objects.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __init__(integration_type)\n" + "\n" + " Builds a unary 1D function using the integration method given as\n" + " argument.\n" + "\n" + " :arg integration_type: An integration method.\n" + " :type integration_type: :class:`IntegrationType`\n"; static int UnaryFunction1DVectorViewShape___init__(BPy_UnaryFunction1DVectorViewShape *self, - PyObject *args, PyObject *kwds) + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"integration", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration", NULL}; + PyObject *obj = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) - return -1; + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) + return -1; - if (!obj) { - self->uf1D_vectorviewshape = new UnaryFunction1D< std::vector >(); - } - else { - self->uf1D_vectorviewshape = new UnaryFunction1D< std::vector >(IntegrationType_from_BPy_IntegrationType(obj)); - } + if (!obj) { + self->uf1D_vectorviewshape = new UnaryFunction1D>(); + } + else { + self->uf1D_vectorviewshape = new UnaryFunction1D>( + IntegrationType_from_BPy_IntegrationType(obj)); + } - self->uf1D_vectorviewshape->py_uf1D = (PyObject *)self; + self->uf1D_vectorviewshape->py_uf1D = (PyObject *)self; - return 0; + return 0; } static void UnaryFunction1DVectorViewShape___dealloc__(BPy_UnaryFunction1DVectorViewShape *self) { - if (self->uf1D_vectorviewshape) - delete self->uf1D_vectorviewshape; - UnaryFunction1D_Type.tp_dealloc((PyObject *)self); + if (self->uf1D_vectorviewshape) + delete self->uf1D_vectorviewshape; + UnaryFunction1D_Type.tp_dealloc((PyObject *)self); } static PyObject *UnaryFunction1DVectorViewShape___repr__(BPy_UnaryFunction1DVectorViewShape *self) { - return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_vectorviewshape); + return PyUnicode_FromFormat( + "type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_vectorviewshape); } static PyObject *UnaryFunction1DVectorViewShape___call__(BPy_UnaryFunction1DVectorViewShape *self, - PyObject *args, PyObject *kwds) + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"inter", NULL}; - PyObject *obj = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) - return NULL; - - if (typeid(*(self->uf1D_vectorviewshape)) == typeid(UnaryFunction1D< std::vector >)) { - PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); - return NULL; - } - if (self->uf1D_vectorviewshape->operator()(*(((BPy_Interface1D *) obj)->if1D)) < 0) { - if (!PyErr_Occurred()) { - string class_name(Py_TYPE(self)->tp_name); - PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); - } - return NULL; - } - - const unsigned int list_len = self->uf1D_vectorviewshape->result.size(); - PyObject *list = PyList_New(list_len); - for (unsigned int i = 0; i < list_len; i++) { - ViewShape *v = self->uf1D_vectorviewshape->result[i]; - PyList_SET_ITEM(list, i, v ? BPy_ViewShape_from_ViewShape(*v) : (Py_INCREF(Py_None), Py_None)); - } - - return list; + static const char *kwlist[] = {"inter", NULL}; + PyObject *obj = 0; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!", (char **)kwlist, &Interface1D_Type, &obj)) + return NULL; + + if (typeid(*(self->uf1D_vectorviewshape)) == typeid(UnaryFunction1D>)) { + PyErr_SetString(PyExc_TypeError, "__call__ method not properly overridden"); + return NULL; + } + if (self->uf1D_vectorviewshape->operator()(*(((BPy_Interface1D *)obj)->if1D)) < 0) { + if (!PyErr_Occurred()) { + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); + } + return NULL; + } + + const unsigned int list_len = self->uf1D_vectorviewshape->result.size(); + PyObject *list = PyList_New(list_len); + for (unsigned int i = 0; i < list_len; i++) { + ViewShape *v = self->uf1D_vectorviewshape->result[i]; + PyList_SET_ITEM(list, i, v ? BPy_ViewShape_from_ViewShape(*v) : (Py_INCREF(Py_None), Py_None)); + } + + return list; } /*----------------------UnaryFunction1DVectorViewShape get/setters ----------------------------*/ PyDoc_STRVAR(integration_type_doc, -"The integration method.\n" -"\n" -":type: :class:`IntegrationType`"); + "The integration method.\n" + "\n" + ":type: :class:`IntegrationType`"); -static PyObject *integration_type_get(BPy_UnaryFunction1DVectorViewShape *self, void *UNUSED(closure)) +static PyObject *integration_type_get(BPy_UnaryFunction1DVectorViewShape *self, + void *UNUSED(closure)) { - return BPy_IntegrationType_from_IntegrationType(self->uf1D_vectorviewshape->getIntegrationType()); + return BPy_IntegrationType_from_IntegrationType( + self->uf1D_vectorviewshape->getIntegrationType()); } -static int integration_type_set(BPy_UnaryFunction1DVectorViewShape *self, PyObject *value, void *UNUSED(closure)) +static int integration_type_set(BPy_UnaryFunction1DVectorViewShape *self, + PyObject *value, + void *UNUSED(closure)) { - if (!BPy_IntegrationType_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); - return -1; - } - self->uf1D_vectorviewshape->setIntegrationType(IntegrationType_from_BPy_IntegrationType(value)); - return 0; + if (!BPy_IntegrationType_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); + return -1; + } + self->uf1D_vectorviewshape->setIntegrationType(IntegrationType_from_BPy_IntegrationType(value)); + return 0; } static PyGetSetDef BPy_UnaryFunction1DVectorViewShape_getseters[] = { - {(char *)"integration_type", (getter)integration_type_get, (setter)integration_type_set, - (char *)integration_type_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"integration_type", + (getter)integration_type_get, + (setter)integration_type_set, + (char *)integration_type_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction1DVectorViewShape type definition ------------------------------*/ PyTypeObject UnaryFunction1DVectorViewShape_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction1DVectorViewShape", /* tp_name */ - sizeof(BPy_UnaryFunction1DVectorViewShape), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction1DVectorViewShape___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction1DVectorViewShape___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction1DVectorViewShape___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction1DVectorViewShape___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_UnaryFunction1DVectorViewShape_getseters, /* tp_getset */ - &UnaryFunction1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction1DVectorViewShape___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction1DVectorViewShape", /* tp_name */ + sizeof(BPy_UnaryFunction1DVectorViewShape), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction1DVectorViewShape___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction1DVectorViewShape___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction1DVectorViewShape___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction1DVectorViewShape___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + BPy_UnaryFunction1DVectorViewShape_getseters, /* tp_getset */ + &UnaryFunction1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction1DVectorViewShape___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.h index 575d0a272c8..92889ddbfd9 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.h @@ -35,18 +35,17 @@ extern "C" { extern PyTypeObject UnaryFunction1DVectorViewShape_Type; #define BPy_UnaryFunction1DVectorViewShape_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction1DVectorViewShape_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction1DVectorViewShape_Type)) /*---------------------------Python BPy_UnaryFunction1DVectorViewShape structure definition----------*/ typedef struct { - BPy_UnaryFunction1D py_uf1D; - UnaryFunction1D< std::vector > *uf1D_vectorviewshape; + BPy_UnaryFunction1D py_uf1D; + UnaryFunction1D> *uf1D_vectorviewshape; } BPy_UnaryFunction1DVectorViewShape; /*---------------------------Python BPy_UnaryFunction1DVectorViewShape visible prototypes-----------*/ int UnaryFunction1DVectorViewShape_Init(PyObject *module); - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp index 01636d76084..c9009dc6889 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp @@ -28,7 +28,6 @@ #include "UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.h" #include "UnaryFunction1D_void/BPy_TimeStampF1D.h" - #ifdef __cplusplus extern "C" { #endif @@ -39,174 +38,184 @@ extern "C" { int UnaryFunction1DVoid_Init(PyObject *module) { - if (module == NULL) - return -1; - - 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) - return -1; - Py_INCREF(&ChainingTimeStampF1D_Type); - PyModule_AddObject(module, "ChainingTimeStampF1D", (PyObject *)&ChainingTimeStampF1D_Type); - - 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) - return -1; - Py_INCREF(&TimeStampF1D_Type); - PyModule_AddObject(module, "TimeStampF1D", (PyObject *)&TimeStampF1D_Type); - - return 0; + if (module == NULL) + return -1; + + 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) + return -1; + Py_INCREF(&ChainingTimeStampF1D_Type); + PyModule_AddObject(module, "ChainingTimeStampF1D", (PyObject *)&ChainingTimeStampF1D_Type); + + 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) + return -1; + Py_INCREF(&TimeStampF1D_Type); + PyModule_AddObject(module, "TimeStampF1D", (PyObject *)&TimeStampF1D_Type); + + return 0; } //------------------------INSTANCE METHODS ---------------------------------- static char UnaryFunction1DVoid___doc__[] = -"Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DVoid`\n" -"\n" -"Base class for unary functions (functors) working on\n" -":class:`Interface1D`.\n" -"\n" -".. method:: __init__()\n" -"\n" -" Default constructor.\n" -"\n" -".. method:: __init__(integration_type)\n" -"\n" -" Builds a unary 1D function using the integration method given as\n" -" argument.\n" -"\n" -" :arg integration_type: An integration method.\n" -" :type integration_type: :class:`IntegrationType`\n"; - -static int UnaryFunction1DVoid___init__(BPy_UnaryFunction1DVoid *self, PyObject *args, PyObject *kwds) + "Class hierarchy: :class:`UnaryFunction1D` > :class:`UnaryFunction1DVoid`\n" + "\n" + "Base class for unary functions (functors) working on\n" + ":class:`Interface1D`.\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Default constructor.\n" + "\n" + ".. method:: __init__(integration_type)\n" + "\n" + " Builds a unary 1D function using the integration method given as\n" + " argument.\n" + "\n" + " :arg integration_type: An integration method.\n" + " :type integration_type: :class:`IntegrationType`\n"; + +static int UnaryFunction1DVoid___init__(BPy_UnaryFunction1DVoid *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"integration", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration", NULL}; + PyObject *obj = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) - return -1; + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "|O!", (char **)kwlist, &IntegrationType_Type, &obj)) + return -1; - if (!obj) - self->uf1D_void = new UnaryFunction1D_void(); - else { - self->uf1D_void = new UnaryFunction1D_void(IntegrationType_from_BPy_IntegrationType(obj)); - } + if (!obj) + self->uf1D_void = new UnaryFunction1D_void(); + else { + self->uf1D_void = new UnaryFunction1D_void(IntegrationType_from_BPy_IntegrationType(obj)); + } - self->uf1D_void->py_uf1D = (PyObject *)self; + self->uf1D_void->py_uf1D = (PyObject *)self; - return 0; + return 0; } static void UnaryFunction1DVoid___dealloc__(BPy_UnaryFunction1DVoid *self) { - if (self->uf1D_void) - delete self->uf1D_void; - UnaryFunction1D_Type.tp_dealloc((PyObject *)self); + if (self->uf1D_void) + delete self->uf1D_void; + UnaryFunction1D_Type.tp_dealloc((PyObject *)self); } static PyObject *UnaryFunction1DVoid___repr__(BPy_UnaryFunction1DVoid *self) { - return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_void); + return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->uf1D_void); } -static PyObject *UnaryFunction1DVoid___call__(BPy_UnaryFunction1DVoid *self, PyObject *args, PyObject *kwds) +static PyObject *UnaryFunction1DVoid___call__(BPy_UnaryFunction1DVoid *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"inter", NULL}; - PyObject *obj = 0; - - 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"); - return NULL; - } - if (self->uf1D_void->operator()(*(((BPy_Interface1D *) obj)->if1D)) < 0) { - if (!PyErr_Occurred()) { - string class_name(Py_TYPE(self)->tp_name); - PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); - } - return NULL; - } - Py_RETURN_NONE; + static const char *kwlist[] = {"inter", NULL}; + PyObject *obj = 0; + + 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"); + return NULL; + } + if (self->uf1D_void->operator()(*(((BPy_Interface1D *)obj)->if1D)) < 0) { + if (!PyErr_Occurred()) { + string class_name(Py_TYPE(self)->tp_name); + PyErr_SetString(PyExc_RuntimeError, (class_name + " __call__ method failed").c_str()); + } + return NULL; + } + Py_RETURN_NONE; } /*----------------------UnaryFunction1DVoid get/setters ----------------------------*/ PyDoc_STRVAR(integration_type_doc, -"The integration method.\n" -"\n" -":type: :class:`IntegrationType`"); + "The integration method.\n" + "\n" + ":type: :class:`IntegrationType`"); static PyObject *integration_type_get(BPy_UnaryFunction1DVoid *self, void *UNUSED(closure)) { - return BPy_IntegrationType_from_IntegrationType(self->uf1D_void->getIntegrationType()); + return BPy_IntegrationType_from_IntegrationType(self->uf1D_void->getIntegrationType()); } -static int integration_type_set(BPy_UnaryFunction1DVoid *self, PyObject *value, void *UNUSED(closure)) +static int integration_type_set(BPy_UnaryFunction1DVoid *self, + PyObject *value, + void *UNUSED(closure)) { - if (!BPy_IntegrationType_Check(value)) { - PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); - return -1; - } - self->uf1D_void->setIntegrationType(IntegrationType_from_BPy_IntegrationType(value)); - return 0; + if (!BPy_IntegrationType_Check(value)) { + PyErr_SetString(PyExc_TypeError, "value must be an IntegrationType"); + return -1; + } + self->uf1D_void->setIntegrationType(IntegrationType_from_BPy_IntegrationType(value)); + return 0; } static PyGetSetDef BPy_UnaryFunction1DVoid_getseters[] = { - {(char *)"integration_type", (getter)integration_type_get, (setter)integration_type_set, - (char *)integration_type_doc, NULL}, - {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ + {(char *)"integration_type", + (getter)integration_type_get, + (setter)integration_type_set, + (char *)integration_type_doc, + NULL}, + {NULL, NULL, NULL, NULL, NULL} /* Sentinel */ }; /*-----------------------BPy_UnaryFunction1DVoid type definition ------------------------------*/ PyTypeObject UnaryFunction1DVoid_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "UnaryFunction1DVoid", /* tp_name */ - sizeof(BPy_UnaryFunction1DVoid), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)UnaryFunction1DVoid___dealloc__, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)UnaryFunction1DVoid___repr__, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)UnaryFunction1DVoid___call__, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - UnaryFunction1DVoid___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - BPy_UnaryFunction1DVoid_getseters, /* tp_getset */ - &UnaryFunction1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)UnaryFunction1DVoid___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "UnaryFunction1DVoid", /* tp_name */ + sizeof(BPy_UnaryFunction1DVoid), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)UnaryFunction1DVoid___dealloc__, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + (reprfunc)UnaryFunction1DVoid___repr__, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + (ternaryfunc)UnaryFunction1DVoid___call__, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + UnaryFunction1DVoid___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + BPy_UnaryFunction1DVoid_getseters, /* tp_getset */ + &UnaryFunction1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)UnaryFunction1DVoid___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.h b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.h index cbc74bda99b..03d949f879d 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/BPy_UnaryFunction1DVoid.h @@ -31,18 +31,18 @@ extern "C" { extern PyTypeObject UnaryFunction1DVoid_Type; -#define BPy_UnaryFunction1DVoid_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction1DVoid_Type)) +#define BPy_UnaryFunction1DVoid_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&UnaryFunction1DVoid_Type)) /*---------------------------Python BPy_UnaryFunction1DVoid structure definition----------*/ typedef struct { - BPy_UnaryFunction1D py_uf1D; - UnaryFunction1D_void *uf1D_void; + BPy_UnaryFunction1D py_uf1D; + UnaryFunction1D_void *uf1D_void; } BPy_UnaryFunction1DVoid; /*---------------------------Python BPy_UnaryFunction1DVoid visible prototypes-----------*/ int UnaryFunction1DVoid_Init(PyObject *module); - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 77c8d48305d..248f1cc0ca1 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 @@ -33,84 +33,85 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char CurveNatureF1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DEdgeNature` > :class:`CurveNatureF1D`\n" -"\n" -".. method:: __init__(integration_type=IntegrationType.MEAN)\n" -"\n" -" Builds a CurveNatureF1D object.\n" -"\n" -" :arg integration_type: The integration method used to compute a single value\n" -" from a set of values.\n" -" :type integration_type: :class:`freestyle.types.IntegrationType`\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns the nature of the Interface1D (silhouette, ridge, crease, and\n" -" so on). Except if the Interface1D is a\n" -" :class:`freestyle.types.ViewEdge`, this result might be ambiguous.\n" -" Indeed, the Interface1D might result from the gathering of several 1D\n" -" elements, each one being of a different nature. An integration\n" -" method, such as the MEAN, might give, in this case, irrelevant\n" -" results.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: The nature of the Interface1D.\n" -" :rtype: :class:`freestyle.types.Nature`\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > " + ":class:`freestyle.types.UnaryFunction1DEdgeNature` > :class:`CurveNatureF1D`\n" + "\n" + ".. method:: __init__(integration_type=IntegrationType.MEAN)\n" + "\n" + " Builds a CurveNatureF1D object.\n" + "\n" + " :arg integration_type: The integration method used to compute a single value\n" + " from a set of values.\n" + " :type integration_type: :class:`freestyle.types.IntegrationType`\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns the nature of the Interface1D (silhouette, ridge, crease, and\n" + " so on). Except if the Interface1D is a\n" + " :class:`freestyle.types.ViewEdge`, this result might be ambiguous.\n" + " Indeed, the Interface1D might result from the gathering of several 1D\n" + " elements, each one being of a different nature. An integration\n" + " method, such as the MEAN, might give, in this case, irrelevant\n" + " results.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: The nature of the Interface1D.\n" + " :rtype: :class:`freestyle.types.Nature`\n"; static int CurveNatureF1D___init__(BPy_CurveNatureF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration_type", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration_type", NULL}; + PyObject *obj = 0; - if (!PyArg_ParseTupleAndKeywords(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; + if (!PyArg_ParseTupleAndKeywords( + 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; } /*-----------------------BPy_CurveNatureF1D type definition ------------------------------*/ PyTypeObject CurveNatureF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "CurveNatureF1D", /* tp_name */ - sizeof(BPy_CurveNatureF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - CurveNatureF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DEdgeNature_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)CurveNatureF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "CurveNatureF1D", /* tp_name */ + sizeof(BPy_CurveNatureF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + CurveNatureF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DEdgeNature_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)CurveNatureF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.h index 211f7148fef..15c381eb279 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject CurveNatureF1D_Type; -#define BPy_CurveNatureF1D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&CurveNatureF1D_Type)) +#define BPy_CurveNatureF1D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&CurveNatureF1D_Type)) /*---------------------------Python BPy_CurveNatureF1D structure definition----------*/ typedef struct { - BPy_UnaryFunction1DEdgeNature py_uf1D_edgenature; + BPy_UnaryFunction1DEdgeNature py_uf1D_edgenature; } BPy_CurveNatureF1D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 e77a05c1373..530f76ee706 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 @@ -33,78 +33,79 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char Normal2DF1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DVec2f` > :class:`Normal2DF1D`\n" -"\n" -".. method:: __init__(integration_type=IntegrationType.MEAN)\n" -"\n" -" Builds a Normal2DF1D object.\n" -"\n" -" :arg integration_type: The integration method used to compute a single value\n" -" from a set of values.\n" -" :type integration_type: :class:`freestyle.types.IntegrationType`\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns the 2D normal for the Interface1D.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: The 2D normal for the Interface1D.\n" -" :rtype: :class:`mathutils.Vector`\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > " + ":class:`freestyle.types.UnaryFunction1DVec2f` > :class:`Normal2DF1D`\n" + "\n" + ".. method:: __init__(integration_type=IntegrationType.MEAN)\n" + "\n" + " Builds a Normal2DF1D object.\n" + "\n" + " :arg integration_type: The integration method used to compute a single value\n" + " from a set of values.\n" + " :type integration_type: :class:`freestyle.types.IntegrationType`\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns the 2D normal for the Interface1D.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: The 2D normal for the Interface1D.\n" + " :rtype: :class:`mathutils.Vector`\n"; static int Normal2DF1D___init__(BPy_Normal2DF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration_type", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration_type", NULL}; + PyObject *obj = 0; - if (!PyArg_ParseTupleAndKeywords(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; + if (!PyArg_ParseTupleAndKeywords( + 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; } /*-----------------------BPy_Normal2DF1D type definition ------------------------------*/ PyTypeObject Normal2DF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "Normal2DF1D", /* tp_name */ - sizeof(BPy_Normal2DF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Normal2DF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DVec2f_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Normal2DF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "Normal2DF1D", /* tp_name */ + sizeof(BPy_Normal2DF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Normal2DF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DVec2f_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Normal2DF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.h index 00bb526e92d..343c4379b4a 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject Normal2DF1D_Type; -#define BPy_Normal2DF1D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&Normal2DF1D_Type)) +#define BPy_Normal2DF1D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&Normal2DF1D_Type)) /*---------------------------Python BPy_Normal2DF1D structure definition----------*/ typedef struct { - BPy_UnaryFunction1DVec2f py_uf1D_vec2f; + BPy_UnaryFunction1DVec2f py_uf1D_vec2f; } BPy_Normal2DF1D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 a216b19dacc..6449ab95611 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 @@ -33,78 +33,79 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char Orientation2DF1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DVec2f` > :class:`Orientation2DF1D`\n" -"\n" -".. method:: __init__(integration_type=IntegrationType.MEAN)\n" -"\n" -" Builds an Orientation2DF1D object.\n" -"\n" -" :arg integration_type: The integration method used to compute a single value\n" -" from a set of values.\n" -" :type integration_type: :class:`freestyle.types.IntegrationType`\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns the 2D orientation of the Interface1D.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: The 2D orientation of the Interface1D.\n" -" :rtype: :class:`mathutils.Vector`\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > " + ":class:`freestyle.types.UnaryFunction1DVec2f` > :class:`Orientation2DF1D`\n" + "\n" + ".. method:: __init__(integration_type=IntegrationType.MEAN)\n" + "\n" + " Builds an Orientation2DF1D object.\n" + "\n" + " :arg integration_type: The integration method used to compute a single value\n" + " from a set of values.\n" + " :type integration_type: :class:`freestyle.types.IntegrationType`\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns the 2D orientation of the Interface1D.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: The 2D orientation of the Interface1D.\n" + " :rtype: :class:`mathutils.Vector`\n"; static int Orientation2DF1D___init__(BPy_Orientation2DF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration_type", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration_type", NULL}; + PyObject *obj = 0; - if (!PyArg_ParseTupleAndKeywords(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; + if (!PyArg_ParseTupleAndKeywords( + 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; } /*-----------------------BPy_Orientation2DF1D type definition ------------------------------*/ PyTypeObject Orientation2DF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "Orientation2DF1D", /* tp_name */ - sizeof(BPy_Orientation2DF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Orientation2DF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DVec2f_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Orientation2DF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "Orientation2DF1D", /* tp_name */ + sizeof(BPy_Orientation2DF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Orientation2DF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DVec2f_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Orientation2DF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.h index fb0c00c0277..5b453cbe714 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject Orientation2DF1D_Type; -#define BPy_Orientation2DF1D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&Orientation2DF1D_Type)) +#define BPy_Orientation2DF1D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&Orientation2DF1D_Type)) /*---------------------------Python BPy_Orientation2DF1D structure definition----------*/ typedef struct { - BPy_UnaryFunction1DVec2f py_uf1D_vec2f; + BPy_UnaryFunction1DVec2f py_uf1D_vec2f; } BPy_Orientation2DF1D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 80f1bac5d41..adfe7b0961b 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 @@ -33,78 +33,79 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char Orientation3DF1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DVec3f` > :class:`Orientation3DF1D`\n" -"\n" -".. method:: __init__(integration_type=IntegrationType.MEAN)\n" -"\n" -" Builds an Orientation3DF1D object.\n" -"\n" -" :arg integration_type: The integration method used to compute a single value\n" -" from a set of values.\n" -" :type integration_type: :class:`freestyle.types.IntegrationType`\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns the 3D orientation of the Interface1D.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: The 3D orientation of the Interface1D.\n" -" :rtype: :class:`mathutils.Vector`\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > " + ":class:`freestyle.types.UnaryFunction1DVec3f` > :class:`Orientation3DF1D`\n" + "\n" + ".. method:: __init__(integration_type=IntegrationType.MEAN)\n" + "\n" + " Builds an Orientation3DF1D object.\n" + "\n" + " :arg integration_type: The integration method used to compute a single value\n" + " from a set of values.\n" + " :type integration_type: :class:`freestyle.types.IntegrationType`\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns the 3D orientation of the Interface1D.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: The 3D orientation of the Interface1D.\n" + " :rtype: :class:`mathutils.Vector`\n"; static int Orientation3DF1D___init__(BPy_Orientation3DF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration_type", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration_type", NULL}; + PyObject *obj = 0; - if (!PyArg_ParseTupleAndKeywords(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; + if (!PyArg_ParseTupleAndKeywords( + 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; } /*-----------------------BPy_Orientation3DF1D type definition ------------------------------*/ PyTypeObject Orientation3DF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "Orientation3DF1D", /* tp_name */ - sizeof(BPy_Orientation3DF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Orientation3DF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DVec3f_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Orientation3DF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "Orientation3DF1D", /* tp_name */ + sizeof(BPy_Orientation3DF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Orientation3DF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DVec3f_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Orientation3DF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.h index 592337052f7..26c6cd845db 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject Orientation3DF1D_Type; -#define BPy_Orientation3DF1D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&Orientation3DF1D_Type)) +#define BPy_Orientation3DF1D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&Orientation3DF1D_Type)) /*---------------------------Python BPy_Orientation3DF1D structure definition----------*/ typedef struct { - BPy_UnaryFunction1DVec3f py_uf1D_vec3f; + BPy_UnaryFunction1DVec3f py_uf1D_vec3f; } BPy_Orientation3DF1D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 f780e15a578..d1e893a1550 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 @@ -33,78 +33,80 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char Curvature2DAngleF1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` > :class:`Curvature2DAngleF1D`\n" -"\n" -".. method:: __init__(integration_type=IntegrationType.MEAN)\n" -"\n" -" Builds a Curvature2DAngleF1D object.\n" -"\n" -" :arg integration_type: The integration method used to compute a single value\n" -" from a set of values.\n" -" :type integration_type: :class:`freestyle.types.IntegrationType`\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns the 2D curvature as an angle for an Interface1D.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: The 2D curvature as an angle.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > " + ":class:`freestyle.types.UnaryFunction1DDouble` > :class:`Curvature2DAngleF1D`\n" + "\n" + ".. method:: __init__(integration_type=IntegrationType.MEAN)\n" + "\n" + " Builds a Curvature2DAngleF1D object.\n" + "\n" + " :arg integration_type: The integration method used to compute a single value\n" + " from a set of values.\n" + " :type integration_type: :class:`freestyle.types.IntegrationType`\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns the 2D curvature as an angle for an Interface1D.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: The 2D curvature as an angle.\n" + " :rtype: float\n"; -static int Curvature2DAngleF1D___init__(BPy_Curvature2DAngleF1D *self, PyObject *args, PyObject *kwds) +static int Curvature2DAngleF1D___init__(BPy_Curvature2DAngleF1D *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"integration_type", NULL}; - PyObject *obj = 0; - - if (!PyArg_ParseTupleAndKeywords(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; + static const char *kwlist[] = {"integration_type", NULL}; + PyObject *obj = 0; + if (!PyArg_ParseTupleAndKeywords( + 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; } /*-----------------------BPy_Curvature2DAngleF1D type definition ------------------------------*/ PyTypeObject Curvature2DAngleF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "Curvature2DAngleF1D", /* tp_name */ - sizeof(BPy_Curvature2DAngleF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Curvature2DAngleF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)Curvature2DAngleF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "Curvature2DAngleF1D", /* tp_name */ + sizeof(BPy_Curvature2DAngleF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + Curvature2DAngleF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)Curvature2DAngleF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.h index a5f81f6d99f..7a3a3fcff4b 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject Curvature2DAngleF1D_Type; -#define BPy_Curvature2DAngleF1D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&Curvature2DAngleF1D_Type)) +#define BPy_Curvature2DAngleF1D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&Curvature2DAngleF1D_Type)) /*---------------------------Python BPy_Curvature2DAngleF1D structure definition----------*/ typedef struct { - BPy_UnaryFunction1DDouble py_uf1D_double; + BPy_UnaryFunction1DDouble py_uf1D_double; } BPy_Curvature2DAngleF1D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 9059516e8fc..6218eed5b70 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 @@ -33,92 +33,93 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char DensityF1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` > :class:`DensityF1D`\n" -"\n" -".. method:: __init__(sigma=2.0, integration_type=IntegrationType.MEAN, sampling=2.0)\n" -"\n" -" Builds a DensityF1D object.\n" -"\n" -" :arg sigma: The sigma used in DensityF0D and determining the window size\n" -" used in each density query.\n" -" :type sigma: float\n" -" :arg integration_type: The integration method used to compute a single value\n" -" from a set of values.\n" -" :type integration_type: :class:`freestyle.types.IntegrationType`\n" -" :arg sampling: The resolution used to sample the chain: the\n" -" corresponding 0D function is evaluated at each sample point and\n" -" the result is obtained by combining the resulting values into a\n" -" single one, following the method specified by integration_type.\n" -" :type sampling: float\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns the density evaluated for an Interface1D. The density is\n" -" evaluated for a set of points along the Interface1D (using the\n" -" :class:`freestyle.functions.DensityF0D` functor) with a user-defined\n" -" sampling and then integrated into a single value using a user-defined\n" -" integration method.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: The density evaluated for an Interface1D.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > " + ":class:`freestyle.types.UnaryFunction1DDouble` > :class:`DensityF1D`\n" + "\n" + ".. method:: __init__(sigma=2.0, integration_type=IntegrationType.MEAN, sampling=2.0)\n" + "\n" + " Builds a DensityF1D object.\n" + "\n" + " :arg sigma: The sigma used in DensityF0D and determining the window size\n" + " used in each density query.\n" + " :type sigma: float\n" + " :arg integration_type: The integration method used to compute a single value\n" + " from a set of values.\n" + " :type integration_type: :class:`freestyle.types.IntegrationType`\n" + " :arg sampling: The resolution used to sample the chain: the\n" + " corresponding 0D function is evaluated at each sample point and\n" + " the result is obtained by combining the resulting values into a\n" + " single one, following the method specified by integration_type.\n" + " :type sampling: float\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns the density evaluated for an Interface1D. The density is\n" + " evaluated for a set of points along the Interface1D (using the\n" + " :class:`freestyle.functions.DensityF0D` functor) with a user-defined\n" + " sampling and then integrated into a single value using a user-defined\n" + " integration method.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: The density evaluated for an Interface1D.\n" + " :rtype: float\n"; static int DensityF1D___init__(BPy_DensityF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"sigma", "integration_type", "sampling", NULL}; - PyObject *obj = 0; - double d = 2.0; - float f = 2.0; + static const char *kwlist[] = {"sigma", "integration_type", "sampling", NULL}; + PyObject *obj = 0; + double d = 2.0; + float f = 2.0; - if (!PyArg_ParseTupleAndKeywords(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; + if (!PyArg_ParseTupleAndKeywords( + 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; } /*-----------------------BPy_DensityF1D type definition ------------------------------*/ PyTypeObject DensityF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "DensityF1D", /* tp_name */ - sizeof(BPy_DensityF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - DensityF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)DensityF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "DensityF1D", /* tp_name */ + sizeof(BPy_DensityF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + DensityF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)DensityF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.h index 6483a3fb87c..71daa14069a 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.h @@ -35,10 +35,9 @@ extern PyTypeObject DensityF1D_Type; /*---------------------------Python BPy_DensityF1D structure definition----------*/ typedef struct { - BPy_UnaryFunction1DDouble py_uf1D_double; + BPy_UnaryFunction1DDouble py_uf1D_double; } BPy_DensityF1D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 62039c8df87..419ea1f54a9 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 @@ -33,94 +33,97 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetCompleteViewMapDensityF1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` > :class:`GetCompleteViewMapDensityF1D`\n" -"\n" -".. method:: __init__(level, integration_type=IntegrationType.MEAN, sampling=2.0)\n" -"\n" -" Builds a GetCompleteViewMapDensityF1D object.\n" -"\n" -" :arg level: The level of the pyramid from which the pixel must be\n" -" read.\n" -" :type level: int\n" -" :arg integration_type: The integration method used to compute a single value\n" -" from a set of values.\n" -" :type integration_type: :class:`freestyle.types.IntegrationType`\n" -" :arg sampling: The resolution used to sample the chain: the\n" -" corresponding 0D function is evaluated at each sample point and\n" -" the result is obtained by combining the resulting values into a\n" -" single one, following the method specified by integration_type.\n" -" :type sampling: float\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns the density evaluated for an Interface1D in the complete\n" -" viewmap image. The density is evaluated for a set of points along the\n" -" Interface1D (using the\n" -" :class:`freestyle.functions.ReadCompleteViewMapPixelF0D` functor) and\n" -" then integrated into a single value using a user-defined integration\n" -" method.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: The density evaluated for the Interface1D in the complete\n" -" viewmap image.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > " + ":class:`freestyle.types.UnaryFunction1DDouble` > :class:`GetCompleteViewMapDensityF1D`\n" + "\n" + ".. method:: __init__(level, integration_type=IntegrationType.MEAN, sampling=2.0)\n" + "\n" + " Builds a GetCompleteViewMapDensityF1D object.\n" + "\n" + " :arg level: The level of the pyramid from which the pixel must be\n" + " read.\n" + " :type level: int\n" + " :arg integration_type: The integration method used to compute a single value\n" + " from a set of values.\n" + " :type integration_type: :class:`freestyle.types.IntegrationType`\n" + " :arg sampling: The resolution used to sample the chain: the\n" + " corresponding 0D function is evaluated at each sample point and\n" + " the result is obtained by combining the resulting values into a\n" + " single one, following the method specified by integration_type.\n" + " :type sampling: float\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns the density evaluated for an Interface1D in the complete\n" + " viewmap image. The density is evaluated for a set of points along the\n" + " Interface1D (using the\n" + " :class:`freestyle.functions.ReadCompleteViewMapPixelF0D` functor) and\n" + " then integrated into a single value using a user-defined integration\n" + " method.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: The density evaluated for the Interface1D in the complete\n" + " viewmap image.\n" + " :rtype: float\n"; -static int GetCompleteViewMapDensityF1D___init__(BPy_GetCompleteViewMapDensityF1D *self, PyObject *args, PyObject *kwds) +static int GetCompleteViewMapDensityF1D___init__(BPy_GetCompleteViewMapDensityF1D *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"level", "integration_type", "sampling", NULL}; - PyObject *obj = 0; - int i; - float f = 2.0; + static const char *kwlist[] = {"level", "integration_type", "sampling", NULL}; + PyObject *obj = 0; + int i; + float f = 2.0; - if (!PyArg_ParseTupleAndKeywords(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; + if (!PyArg_ParseTupleAndKeywords( + 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; } /*-----------------------BPy_GetCompleteViewMapDensityF1D type definition ------------------------------*/ PyTypeObject GetCompleteViewMapDensityF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "GetCompleteViewMapDensityF1D", /* tp_name */ - sizeof(BPy_GetCompleteViewMapDensityF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetCompleteViewMapDensityF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetCompleteViewMapDensityF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "GetCompleteViewMapDensityF1D", /* tp_name */ + sizeof(BPy_GetCompleteViewMapDensityF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetCompleteViewMapDensityF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetCompleteViewMapDensityF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.h index 5b05aed0d06..c0a78e89551 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.h @@ -32,14 +32,13 @@ extern "C" { extern PyTypeObject GetCompleteViewMapDensityF1D_Type; #define BPy_GetCompleteViewMapDensityF1D_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetCompleteViewMapDensityF1D_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetCompleteViewMapDensityF1D_Type)) /*---------------------------Python BPy_GetCompleteViewMapDensityF1D structure definition----------*/ typedef struct { - BPy_UnaryFunction1DDouble py_uf1D_double; + BPy_UnaryFunction1DDouble py_uf1D_double; } BPy_GetCompleteViewMapDensityF1D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 4fd2b3c9d3f..58290f6b45f 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 @@ -33,100 +33,104 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetDirectionalViewMapDensityF1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` " -"> :class:`GetDirectionalViewMapDensityF1D`\n" -"\n" -".. method:: __init__(orientation, level, integration_type=IntegrationType.MEAN, sampling=2.0)\n" -"\n" -" Builds a GetDirectionalViewMapDensityF1D object.\n" -"\n" -" :arg orientation: The number of the directional map we must work\n" -" with.\n" -" :type orientation: int\n" -" :arg level: The level of the pyramid from which the pixel must be\n" -" read.\n" -" :type level: int\n" -" :arg integration_type: The integration method used to compute a single value\n" -" from a set of values.\n" -" :type integration_type: :class:`freestyle.types.IntegrationType`\n" -" :arg sampling: The resolution used to sample the chain: the\n" -" corresponding 0D function is evaluated at each sample point and\n" -" the result is obtained by combining the resulting values into a\n" -" single one, following the method specified by integration_type.\n" -" :type sampling: float\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns the density evaluated for an Interface1D in of the steerable\n" -" viewmaps image. The direction telling which Directional map to choose\n" -" is explicitly specified by the user. The density is evaluated for a\n" -" set of points along the Interface1D (using the\n" -" :class:`freestyle.functions.ReadSteerableViewMapPixelF0D` functor) and\n" -" then integrated into a single value using a user-defined integration\n" -" method.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: the density evaluated for an Interface1D in of the\n" -" steerable viewmaps image.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > " + ":class:`freestyle.types.UnaryFunction1DDouble` " + "> :class:`GetDirectionalViewMapDensityF1D`\n" + "\n" + ".. method:: __init__(orientation, level, integration_type=IntegrationType.MEAN, " + "sampling=2.0)\n" + "\n" + " Builds a GetDirectionalViewMapDensityF1D object.\n" + "\n" + " :arg orientation: The number of the directional map we must work\n" + " with.\n" + " :type orientation: int\n" + " :arg level: The level of the pyramid from which the pixel must be\n" + " read.\n" + " :type level: int\n" + " :arg integration_type: The integration method used to compute a single value\n" + " from a set of values.\n" + " :type integration_type: :class:`freestyle.types.IntegrationType`\n" + " :arg sampling: The resolution used to sample the chain: the\n" + " corresponding 0D function is evaluated at each sample point and\n" + " the result is obtained by combining the resulting values into a\n" + " single one, following the method specified by integration_type.\n" + " :type sampling: float\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns the density evaluated for an Interface1D in of the steerable\n" + " viewmaps image. The direction telling which Directional map to choose\n" + " is explicitly specified by the user. The density is evaluated for a\n" + " set of points along the Interface1D (using the\n" + " :class:`freestyle.functions.ReadSteerableViewMapPixelF0D` functor) and\n" + " then integrated into a single value using a user-defined integration\n" + " method.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: the density evaluated for an Interface1D in of the\n" + " steerable viewmaps image.\n" + " :rtype: float\n"; static int GetDirectionalViewMapDensityF1D___init__(BPy_GetDirectionalViewMapDensityF1D *self, - PyObject *args, PyObject *kwds) + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"orientation", "level", "integration_type", "sampling", NULL}; - PyObject *obj = 0; - unsigned int u1, u2; - float f = 2.0; + static const char *kwlist[] = {"orientation", "level", "integration_type", "sampling", NULL}; + PyObject *obj = 0; + unsigned int u1, u2; + float f = 2.0; - if (!PyArg_ParseTupleAndKeywords(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); - return 0; + if (!PyArg_ParseTupleAndKeywords( + 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); + return 0; } /*-----------------------BPy_GetDirectionalViewMapDensityF1D type definition ------------------------------*/ PyTypeObject GetDirectionalViewMapDensityF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "GetDirectionalViewMapDensityF1D", /* tp_name */ - sizeof(BPy_GetDirectionalViewMapDensityF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetDirectionalViewMapDensityF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetDirectionalViewMapDensityF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "GetDirectionalViewMapDensityF1D", /* tp_name */ + sizeof(BPy_GetDirectionalViewMapDensityF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetDirectionalViewMapDensityF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetDirectionalViewMapDensityF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.h index cf91eed1a70..d78ffe84381 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.h @@ -32,14 +32,13 @@ extern "C" { extern PyTypeObject GetDirectionalViewMapDensityF1D_Type; #define BPy_GetDirectionalViewMapDensityF1D_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetDirectionalViewMapDensityF1D_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetDirectionalViewMapDensityF1D_Type)) /*---------------------------Python BPy_GetDirectionalViewMapDensityF1D structure definition----------*/ typedef struct { - BPy_UnaryFunction1DDouble py_uf1D_double; + BPy_UnaryFunction1DDouble py_uf1D_double; } BPy_GetDirectionalViewMapDensityF1D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 421a5eae8dd..bbd6dfd2701 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 @@ -33,78 +33,79 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetProjectedXF1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` > :class:`GetProjectedXF1D`\n" -"\n" -".. method:: __init__(integration_type=IntegrationType.MEAN)\n" -"\n" -" Builds a GetProjectedXF1D object.\n" -"\n" -" :arg integration_type: The integration method used to compute a single value\n" -" from a set of values. \n" -" :type integration_type: :class:`freestyle.types.IntegrationType`\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns the projected X 3D coordinate of an Interface1D.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: The projected X 3D coordinate of an Interface1D.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > " + ":class:`freestyle.types.UnaryFunction1DDouble` > :class:`GetProjectedXF1D`\n" + "\n" + ".. method:: __init__(integration_type=IntegrationType.MEAN)\n" + "\n" + " Builds a GetProjectedXF1D object.\n" + "\n" + " :arg integration_type: The integration method used to compute a single value\n" + " from a set of values. \n" + " :type integration_type: :class:`freestyle.types.IntegrationType`\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns the projected X 3D coordinate of an Interface1D.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: The projected X 3D coordinate of an Interface1D.\n" + " :rtype: float\n"; static int GetProjectedXF1D___init__(BPy_GetProjectedXF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration_type", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration_type", NULL}; + PyObject *obj = 0; - if (!PyArg_ParseTupleAndKeywords(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; + if (!PyArg_ParseTupleAndKeywords( + 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; } /*-----------------------BPy_GetProjectedXF1D type definition ------------------------------*/ PyTypeObject GetProjectedXF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "GetProjectedXF1D", /* tp_name */ - sizeof(BPy_GetProjectedXF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetProjectedXF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetProjectedXF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "GetProjectedXF1D", /* tp_name */ + sizeof(BPy_GetProjectedXF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetProjectedXF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetProjectedXF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.h index 4f66a3db389..febb3265f97 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject GetProjectedXF1D_Type; -#define BPy_GetProjectedXF1D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetProjectedXF1D_Type)) +#define BPy_GetProjectedXF1D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetProjectedXF1D_Type)) /*---------------------------Python BPy_GetProjectedXF1D structure definition----------*/ typedef struct { - BPy_UnaryFunction1DDouble py_uf1D_double; + BPy_UnaryFunction1DDouble py_uf1D_double; } BPy_GetProjectedXF1D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 4e45c29ac1a..8cfd958ba29 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 @@ -33,78 +33,79 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetProjectedYF1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` > :class:`GetProjectedYF1D`\n" -"\n" -".. method:: __init__(integration_type=IntegrationType.MEAN)\n" -"\n" -" Builds a GetProjectedYF1D object.\n" -"\n" -" :arg integration_type: The integration method used to compute a single value\n" -" from a set of values. \n" -" :type integration_type: :class:`freestyle.types.IntegrationType`\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns the projected Y 3D coordinate of an Interface1D.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: The projected Y 3D coordinate of an Interface1D.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > " + ":class:`freestyle.types.UnaryFunction1DDouble` > :class:`GetProjectedYF1D`\n" + "\n" + ".. method:: __init__(integration_type=IntegrationType.MEAN)\n" + "\n" + " Builds a GetProjectedYF1D object.\n" + "\n" + " :arg integration_type: The integration method used to compute a single value\n" + " from a set of values. \n" + " :type integration_type: :class:`freestyle.types.IntegrationType`\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns the projected Y 3D coordinate of an Interface1D.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: The projected Y 3D coordinate of an Interface1D.\n" + " :rtype: float\n"; static int GetProjectedYF1D___init__(BPy_GetProjectedYF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration_type", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration_type", NULL}; + PyObject *obj = 0; - if (!PyArg_ParseTupleAndKeywords(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; + if (!PyArg_ParseTupleAndKeywords( + 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; } /*-----------------------BPy_GetProjectedYF1D type definition ------------------------------*/ PyTypeObject GetProjectedYF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "GetProjectedYF1D", /* tp_name */ - sizeof(BPy_GetProjectedYF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetProjectedYF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetProjectedYF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "GetProjectedYF1D", /* tp_name */ + sizeof(BPy_GetProjectedYF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetProjectedYF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetProjectedYF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.h index 6869aa4a7fc..5a0a5f42cb0 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject GetProjectedYF1D_Type; -#define BPy_GetProjectedYF1D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetProjectedYF1D_Type)) +#define BPy_GetProjectedYF1D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetProjectedYF1D_Type)) /*---------------------------Python BPy_GetProjectedYF1D structure definition----------*/ typedef struct { - BPy_UnaryFunction1DDouble py_uf1D_double; + BPy_UnaryFunction1DDouble py_uf1D_double; } BPy_GetProjectedYF1D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 5f7ee3456e7..e5bd864fcfd 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 @@ -33,78 +33,79 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetProjectedZF1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` > :class:`GetProjectedZF1D`\n" -"\n" -".. method:: __init__(integration_type=IntegrationType.MEAN)\n" -"\n" -" Builds a GetProjectedZF1D object.\n" -"\n" -" :arg integration_type: The integration method used to compute a single value\n" -" from a set of values. \n" -" :type integration_type: :class:`freestyle.types.IntegrationType`\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns the projected Z 3D coordinate of an Interface1D.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: The projected Z 3D coordinate of an Interface1D.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > " + ":class:`freestyle.types.UnaryFunction1DDouble` > :class:`GetProjectedZF1D`\n" + "\n" + ".. method:: __init__(integration_type=IntegrationType.MEAN)\n" + "\n" + " Builds a GetProjectedZF1D object.\n" + "\n" + " :arg integration_type: The integration method used to compute a single value\n" + " from a set of values. \n" + " :type integration_type: :class:`freestyle.types.IntegrationType`\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns the projected Z 3D coordinate of an Interface1D.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: The projected Z 3D coordinate of an Interface1D.\n" + " :rtype: float\n"; static int GetProjectedZF1D___init__(BPy_GetProjectedZF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration_type", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration_type", NULL}; + PyObject *obj = 0; - if (!PyArg_ParseTupleAndKeywords(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; + if (!PyArg_ParseTupleAndKeywords( + 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; } /*-----------------------BPy_GetProjectedZF1D type definition ------------------------------*/ PyTypeObject GetProjectedZF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "GetProjectedZF1D", /* tp_name */ - sizeof(BPy_GetProjectedZF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetProjectedZF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetProjectedZF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "GetProjectedZF1D", /* tp_name */ + sizeof(BPy_GetProjectedZF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetProjectedZF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetProjectedZF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.h index d643aeccc4f..aeb42521d1f 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject GetProjectedZF1D_Type; -#define BPy_GetProjectedZF1D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetProjectedZF1D_Type)) +#define BPy_GetProjectedZF1D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetProjectedZF1D_Type)) /*---------------------------Python BPy_GetProjectedZF1D structure definition----------*/ typedef struct { - BPy_UnaryFunction1DDouble py_uf1D_double; + BPy_UnaryFunction1DDouble py_uf1D_double; } BPy_GetProjectedZF1D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 ad56182d065..a112dee15c7 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 @@ -33,92 +33,94 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetSteerableViewMapDensityF1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` > :class:`GetSteerableViewMapDensityF1D`\n" -"\n" -".. method:: __init__(level, integration_type=IntegrationType.MEAN, sampling=2.0)\n" -"\n" -" Builds a GetSteerableViewMapDensityF1D object.\n" -"\n" -" :arg level: The level of the pyramid from which the pixel must be\n" -" read.\n" -" :type level: int\n" -" :arg integration_type: The integration method used to compute a single value\n" -" from a set of values.\n" -" :type integration_type: :class:`freestyle.types.IntegrationType`\n" -" :arg sampling: The resolution used to sample the chain: the\n" -" corresponding 0D function is evaluated at each sample point and\n" -" the result is obtained by combining the resulting values into a\n" -" single one, following the method specified by integration_type.\n" -" :type sampling: float\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns the density of the ViewMap for a given Interface1D. The\n" -" density of each :class:`freestyle.types.FEdge` is evaluated in the\n" -" proper steerable :class:`freestyle.types.ViewMap` depending on its\n" -" orientation.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: The density of the ViewMap for a given Interface1D.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > " + ":class:`freestyle.types.UnaryFunction1DDouble` > :class:`GetSteerableViewMapDensityF1D`\n" + "\n" + ".. method:: __init__(level, integration_type=IntegrationType.MEAN, sampling=2.0)\n" + "\n" + " Builds a GetSteerableViewMapDensityF1D object.\n" + "\n" + " :arg level: The level of the pyramid from which the pixel must be\n" + " read.\n" + " :type level: int\n" + " :arg integration_type: The integration method used to compute a single value\n" + " from a set of values.\n" + " :type integration_type: :class:`freestyle.types.IntegrationType`\n" + " :arg sampling: The resolution used to sample the chain: the\n" + " corresponding 0D function is evaluated at each sample point and\n" + " the result is obtained by combining the resulting values into a\n" + " single one, following the method specified by integration_type.\n" + " :type sampling: float\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns the density of the ViewMap for a given Interface1D. The\n" + " density of each :class:`freestyle.types.FEdge` is evaluated in the\n" + " proper steerable :class:`freestyle.types.ViewMap` depending on its\n" + " orientation.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: The density of the ViewMap for a given Interface1D.\n" + " :rtype: float\n"; static int GetSteerableViewMapDensityF1D___init__(BPy_GetSteerableViewMapDensityF1D *self, - PyObject *args, PyObject *kwds) + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"level", "integration_type", "sampling", NULL}; - PyObject *obj = 0; - int i; - float f = 2.0; + static const char *kwlist[] = {"level", "integration_type", "sampling", NULL}; + PyObject *obj = 0; + int i; + float f = 2.0; - if (!PyArg_ParseTupleAndKeywords(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; + if (!PyArg_ParseTupleAndKeywords( + 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; } /*-----------------------BPy_GetSteerableViewMapDensityF1D type definition ------------------------------*/ PyTypeObject GetSteerableViewMapDensityF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "GetSteerableViewMapDensityF1D", /* tp_name */ - sizeof(BPy_GetSteerableViewMapDensityF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetSteerableViewMapDensityF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetSteerableViewMapDensityF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "GetSteerableViewMapDensityF1D", /* tp_name */ + sizeof(BPy_GetSteerableViewMapDensityF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetSteerableViewMapDensityF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetSteerableViewMapDensityF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.h index ce80107a6d9..c4881a79649 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.h @@ -32,13 +32,12 @@ extern "C" { extern PyTypeObject GetSteerableViewMapDensityF1D_Type; #define BPy_GetSteerableViewMapDensityF1D_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetSteerableViewMapDensityF1D_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetSteerableViewMapDensityF1D_Type)) /*---------------------------Python BPy_GetSteerableViewMapDensityF1D structure definition----------*/ typedef struct { - BPy_UnaryFunction1DDouble py_uf1D_double; + BPy_UnaryFunction1DDouble py_uf1D_double; } BPy_GetSteerableViewMapDensityF1D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 23eae370434..b2bb2947be7 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 @@ -33,91 +33,94 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetViewMapGradientNormF1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` > :class:`GetViewMapGradientNormF1D`\n" -"\n" -".. method:: __init__(level, integration_type=IntegrationType.MEAN, sampling=2.0)\n" -"\n" -" Builds a GetViewMapGradientNormF1D object.\n" -"\n" -" :arg level: The level of the pyramid from which the pixel must be\n" -" read.\n" -" :type level: int\n" -" :arg integration_type: The integration method used to compute a single value\n" -" from a set of values.\n" -" :type integration_type: :class:`freestyle.types.IntegrationType`\n" -" :arg sampling: The resolution used to sample the chain: the\n" -" corresponding 0D function is evaluated at each sample point and\n" -" the result is obtained by combining the resulting values into a\n" -" single one, following the method specified by integration_type.\n" -" :type sampling: float\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns the density of the ViewMap for a given Interface1D. The\n" -" density of each :class:`freestyle.types.FEdge` is evaluated in the\n" -" proper steerable :class:`freestyle.types.ViewMap` depending on its\n" -" orientation.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: The density of the ViewMap for a given Interface1D.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > " + ":class:`freestyle.types.UnaryFunction1DDouble` > :class:`GetViewMapGradientNormF1D`\n" + "\n" + ".. method:: __init__(level, integration_type=IntegrationType.MEAN, sampling=2.0)\n" + "\n" + " Builds a GetViewMapGradientNormF1D object.\n" + "\n" + " :arg level: The level of the pyramid from which the pixel must be\n" + " read.\n" + " :type level: int\n" + " :arg integration_type: The integration method used to compute a single value\n" + " from a set of values.\n" + " :type integration_type: :class:`freestyle.types.IntegrationType`\n" + " :arg sampling: The resolution used to sample the chain: the\n" + " corresponding 0D function is evaluated at each sample point and\n" + " the result is obtained by combining the resulting values into a\n" + " single one, following the method specified by integration_type.\n" + " :type sampling: float\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns the density of the ViewMap for a given Interface1D. The\n" + " density of each :class:`freestyle.types.FEdge` is evaluated in the\n" + " proper steerable :class:`freestyle.types.ViewMap` depending on its\n" + " orientation.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: The density of the ViewMap for a given Interface1D.\n" + " :rtype: float\n"; -static int GetViewMapGradientNormF1D___init__(BPy_GetViewMapGradientNormF1D *self, PyObject *args, PyObject *kwds) +static int GetViewMapGradientNormF1D___init__(BPy_GetViewMapGradientNormF1D *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"level", "integration_type", "sampling", NULL}; - PyObject *obj = 0; - int i; - float f = 2.0; + static const char *kwlist[] = {"level", "integration_type", "sampling", NULL}; + PyObject *obj = 0; + int i; + float f = 2.0; - if (!PyArg_ParseTupleAndKeywords(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; + if (!PyArg_ParseTupleAndKeywords( + 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; } /*-----------------------BPy_GetViewMapGradientNormF1D type definition ------------------------------*/ PyTypeObject GetViewMapGradientNormF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "GetViewMapGradientNormF1D", /* tp_name */ - sizeof(BPy_GetViewMapGradientNormF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetViewMapGradientNormF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetViewMapGradientNormF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "GetViewMapGradientNormF1D", /* tp_name */ + sizeof(BPy_GetViewMapGradientNormF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetViewMapGradientNormF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetViewMapGradientNormF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.h index 4d4f562c9d1..4f19b4ac67f 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.h @@ -32,15 +32,14 @@ extern "C" { extern PyTypeObject GetViewMapGradientNormF1D_Type; #define BPy_GetViewMapGradientNormF1D_Check(v) \ - (((PyObject *)v)->ob_type == PyObject_IsInstance((PyObject *)v, \ - (PyObject *)&GetViewMapGradientNormF1D_Type)) + (((PyObject *)v)->ob_type == \ + PyObject_IsInstance((PyObject *)v, (PyObject *)&GetViewMapGradientNormF1D_Type)) /*---------------------------Python BPy_GetViewMapGradientNormF1D structure definition----------*/ typedef struct { - BPy_UnaryFunction1DDouble py_uf1D_double; + BPy_UnaryFunction1DDouble py_uf1D_double; } BPy_GetViewMapGradientNormF1D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 f02b5cd4ad5..6a5e999ecf3 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 @@ -33,78 +33,79 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetXF1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` > :class:`GetXF1D`\n" -"\n" -".. method:: __init__(integration_type=IntegrationType.MEAN)\n" -"\n" -" Builds a GetXF1D object.\n" -"\n" -" :arg integration_type: The integration method used to compute a single value\n" -" from a set of values.\n" -" :type integration_type: :class:`freestyle.types.IntegrationType`\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns the X 3D coordinate of an Interface1D.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: The X 3D coordinate of the Interface1D.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > " + ":class:`freestyle.types.UnaryFunction1DDouble` > :class:`GetXF1D`\n" + "\n" + ".. method:: __init__(integration_type=IntegrationType.MEAN)\n" + "\n" + " Builds a GetXF1D object.\n" + "\n" + " :arg integration_type: The integration method used to compute a single value\n" + " from a set of values.\n" + " :type integration_type: :class:`freestyle.types.IntegrationType`\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns the X 3D coordinate of an Interface1D.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: The X 3D coordinate of the Interface1D.\n" + " :rtype: float\n"; static int GetXF1D___init__(BPy_GetXF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration_type", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration_type", NULL}; + PyObject *obj = 0; - if (!PyArg_ParseTupleAndKeywords(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; + if (!PyArg_ParseTupleAndKeywords( + 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; } /*-----------------------BPy_GetXF1D type definition ------------------------------*/ PyTypeObject GetXF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "GetXF1D", /* tp_name */ - sizeof(BPy_GetXF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetXF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetXF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "GetXF1D", /* tp_name */ + sizeof(BPy_GetXF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetXF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetXF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.h index 2e548a76cba..7db31882381 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.h @@ -35,10 +35,9 @@ extern PyTypeObject GetXF1D_Type; /*---------------------------Python BPy_GetXF1D structure definition----------*/ typedef struct { - BPy_UnaryFunction1DDouble py_uf1D_double; + BPy_UnaryFunction1DDouble py_uf1D_double; } BPy_GetXF1D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 2bb6011dc84..b7a1e2a3072 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 @@ -33,77 +33,78 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetYF1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` > :class:`GetYF1D`\n" -"\n" -".. method:: __init__(integration_type=IntegrationType.MEAN)\n" -"\n" -" Builds a GetYF1D object.\n" -"\n" -" :arg integration_type: The integration method used to compute a single value\n" -" from a set of values.\n" -" :type integration_type: :class:`freestyle.types.IntegrationType`\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns the Y 3D coordinate of an Interface1D.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: The Y 3D coordinate of the Interface1D.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > " + ":class:`freestyle.types.UnaryFunction1DDouble` > :class:`GetYF1D`\n" + "\n" + ".. method:: __init__(integration_type=IntegrationType.MEAN)\n" + "\n" + " Builds a GetYF1D object.\n" + "\n" + " :arg integration_type: The integration method used to compute a single value\n" + " from a set of values.\n" + " :type integration_type: :class:`freestyle.types.IntegrationType`\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns the Y 3D coordinate of an Interface1D.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: The Y 3D coordinate of the Interface1D.\n" + " :rtype: float\n"; static int GetYF1D___init__(BPy_GetYF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration_type", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration_type", NULL}; + PyObject *obj = 0; - if (!PyArg_ParseTupleAndKeywords(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; + if (!PyArg_ParseTupleAndKeywords( + 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; } /*-----------------------BPy_GetYF1D type definition ------------------------------*/ PyTypeObject GetYF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "GetYF1D", /* tp_name */ - sizeof(BPy_GetYF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetYF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetYF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "GetYF1D", /* tp_name */ + sizeof(BPy_GetYF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetYF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetYF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.h index eedec9929d3..3f70d64e200 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.h @@ -35,10 +35,9 @@ extern PyTypeObject GetYF1D_Type; /*---------------------------Python BPy_GetYF1D structure definition----------*/ typedef struct { - BPy_UnaryFunction1DDouble py_uf1D_double; + BPy_UnaryFunction1DDouble py_uf1D_double; } BPy_GetYF1D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 1c334c5089d..db42bdcc3eb 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 @@ -33,78 +33,79 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetZF1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` > :class:`GetZF1D`\n" -"\n" -".. method:: __init__(integration_type=IntegrationType.MEAN)\n" -"\n" -" Builds a GetZF1D object.\n" -"\n" -" :arg integration_type: The integration method used to compute a single value\n" -" from a set of values.\n" -" :type integration_type: :class:`freestyle.types.IntegrationType`\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns the Z 3D coordinate of an Interface1D.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: The Z 3D coordinate of the Interface1D.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > " + ":class:`freestyle.types.UnaryFunction1DDouble` > :class:`GetZF1D`\n" + "\n" + ".. method:: __init__(integration_type=IntegrationType.MEAN)\n" + "\n" + " Builds a GetZF1D object.\n" + "\n" + " :arg integration_type: The integration method used to compute a single value\n" + " from a set of values.\n" + " :type integration_type: :class:`freestyle.types.IntegrationType`\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns the Z 3D coordinate of an Interface1D.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: The Z 3D coordinate of the Interface1D.\n" + " :rtype: float\n"; static int GetZF1D___init__(BPy_GetZF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration_type", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration_type", NULL}; + PyObject *obj = 0; - if (!PyArg_ParseTupleAndKeywords(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; + if (!PyArg_ParseTupleAndKeywords( + 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; } /*-----------------------BPy_GetZF1D type definition ------------------------------*/ PyTypeObject GetZF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "GetZF1D", /* tp_name */ - sizeof(BPy_GetZF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetZF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetZF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "GetZF1D", /* tp_name */ + sizeof(BPy_GetZF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetZF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetZF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.h index b8c5107add7..b841bde2a5c 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.h @@ -35,10 +35,9 @@ extern PyTypeObject GetZF1D_Type; /*---------------------------Python BPy_GetZF1D structure definition----------*/ typedef struct { - BPy_UnaryFunction1DDouble py_uf1D_double; + BPy_UnaryFunction1DDouble py_uf1D_double; } BPy_GetZF1D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 992c620f5e9..8e139f5a627 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 @@ -33,86 +33,89 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char LocalAverageDepthF1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` > :class:`LocalAverageDepthF1D`\n" -"\n" -".. method:: __init__(sigma, integration_type=IntegrationType.MEAN)\n" -"\n" -" Builds a LocalAverageDepthF1D object.\n" -"\n" -" :arg sigma: The sigma used in DensityF0D and determining the window\n" -" size used in each density query.\n" -" :type sigma: float\n" -" :arg integration_type: The integration method used to compute a single value\n" -" from a set of values.\n" -" :type integration_type: :class:`freestyle.types.IntegrationType`\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns the average depth evaluated for an Interface1D. The average\n" -" depth is evaluated for a set of points along the Interface1D (using\n" -" the :class:`freestyle.functions.LocalAverageDepthF0D` functor) with a\n" -" user-defined sampling and then integrated into a single value using a\n" -" user-defined integration method.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: The average depth evaluated for the Interface1D.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > " + ":class:`freestyle.types.UnaryFunction1DDouble` > :class:`LocalAverageDepthF1D`\n" + "\n" + ".. method:: __init__(sigma, integration_type=IntegrationType.MEAN)\n" + "\n" + " Builds a LocalAverageDepthF1D object.\n" + "\n" + " :arg sigma: The sigma used in DensityF0D and determining the window\n" + " size used in each density query.\n" + " :type sigma: float\n" + " :arg integration_type: The integration method used to compute a single value\n" + " from a set of values.\n" + " :type integration_type: :class:`freestyle.types.IntegrationType`\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns the average depth evaluated for an Interface1D. The average\n" + " depth is evaluated for a set of points along the Interface1D (using\n" + " the :class:`freestyle.functions.LocalAverageDepthF0D` functor) with a\n" + " user-defined sampling and then integrated into a single value using a\n" + " user-defined integration method.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: The average depth evaluated for the Interface1D.\n" + " :rtype: float\n"; -static int LocalAverageDepthF1D___init__(BPy_LocalAverageDepthF1D *self, PyObject *args, PyObject *kwds) +static int LocalAverageDepthF1D___init__(BPy_LocalAverageDepthF1D *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"sigma", "integration_type", NULL}; - PyObject *obj = 0; - double d; + static const char *kwlist[] = {"sigma", "integration_type", NULL}; + PyObject *obj = 0; + double d; - if (!PyArg_ParseTupleAndKeywords(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; + if (!PyArg_ParseTupleAndKeywords( + 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; } /*-----------------------BPy_LocalAverageDepthF1D type definition ------------------------------*/ PyTypeObject LocalAverageDepthF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "LocalAverageDepthF1D", /* tp_name */ - sizeof(BPy_LocalAverageDepthF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - LocalAverageDepthF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)LocalAverageDepthF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "LocalAverageDepthF1D", /* tp_name */ + sizeof(BPy_LocalAverageDepthF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + LocalAverageDepthF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)LocalAverageDepthF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.h index 5bcb3130d70..258d028bfbd 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject LocalAverageDepthF1D_Type; -#define BPy_LocalAverageDepthF1D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&LocalAverageDepthF1D_Type)) +#define BPy_LocalAverageDepthF1D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&LocalAverageDepthF1D_Type)) /*---------------------------Python BPy_LocalAverageDepthF1D structure definition----------*/ typedef struct { - BPy_UnaryFunction1DDouble py_uf1D_double; + BPy_UnaryFunction1DDouble py_uf1D_double; } BPy_LocalAverageDepthF1D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 e0511734e75..1f5b262f71a 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 @@ -33,82 +33,83 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ZDiscontinuityF1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DDouble` > :class:`ZDiscontinuityF1D`\n" -"\n" -".. method:: __init__(integration_type=IntegrationType.MEAN)\n" -"\n" -" Builds a ZDiscontinuityF1D object.\n" -"\n" -" :arg integration_type: The integration method used to compute a single value\n" -" from a set of values.\n" -" :type integration_type: :class:`freestyle.types.IntegrationType`\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns a real value giving the distance between an Interface1D\n" -" and the shape that lies behind (occludee). This distance is\n" -" evaluated in the camera space and normalized between 0 and 1.\n" -" Therefore, if no object is occluded by the shape to which the\n" -" Interface1D belongs to, 1 is returned.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: The normalized distance between the Interface1D and the occludee.\n" -" :rtype: float\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > " + ":class:`freestyle.types.UnaryFunction1DDouble` > :class:`ZDiscontinuityF1D`\n" + "\n" + ".. method:: __init__(integration_type=IntegrationType.MEAN)\n" + "\n" + " Builds a ZDiscontinuityF1D object.\n" + "\n" + " :arg integration_type: The integration method used to compute a single value\n" + " from a set of values.\n" + " :type integration_type: :class:`freestyle.types.IntegrationType`\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns a real value giving the distance between an Interface1D\n" + " and the shape that lies behind (occludee). This distance is\n" + " evaluated in the camera space and normalized between 0 and 1.\n" + " Therefore, if no object is occluded by the shape to which the\n" + " Interface1D belongs to, 1 is returned.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: The normalized distance between the Interface1D and the occludee.\n" + " :rtype: float\n"; static int ZDiscontinuityF1D___init__(BPy_ZDiscontinuityF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"integration_type", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration_type", NULL}; + PyObject *obj = 0; - if (!PyArg_ParseTupleAndKeywords(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; + if (!PyArg_ParseTupleAndKeywords( + 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; } /*-----------------------BPy_ZDiscontinuityF1D type definition ------------------------------*/ PyTypeObject ZDiscontinuityF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ZDiscontinuityF1D", /* tp_name */ - sizeof(BPy_ZDiscontinuityF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ZDiscontinuityF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DDouble_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ZDiscontinuityF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "ZDiscontinuityF1D", /* tp_name */ + sizeof(BPy_ZDiscontinuityF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ZDiscontinuityF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DDouble_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ZDiscontinuityF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.h index 22d6fdac96d..c336591842b 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject ZDiscontinuityF1D_Type; -#define BPy_ZDiscontinuityF1D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&ZDiscontinuityF1D_Type)) +#define BPy_ZDiscontinuityF1D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&ZDiscontinuityF1D_Type)) /*---------------------------Python BPy_ZDiscontinuityF1D structure definition----------*/ typedef struct { - BPy_UnaryFunction1DDouble py_uf1D_double; + BPy_UnaryFunction1DDouble py_uf1D_double; } BPy_ZDiscontinuityF1D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 eccf788c631..f955c90842a 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 @@ -33,82 +33,85 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char QuantitativeInvisibilityF1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DUnsigned` > :class:`QuantitativeInvisibilityF1D`\n" -"\n" -".. method:: __init__(integration_type=IntegrationType.MEAN)\n" -"\n" -" Builds a QuantitativeInvisibilityF1D object.\n" -"\n" -" :arg integration_type: The integration method used to compute a single value\n" -" from a set of values.\n" -" :type integration_type: :class:`freestyle.types.IntegrationType`\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns the Quantitative Invisibility of an Interface1D element. If\n" -" the Interface1D is a :class:`freestyle.types.ViewEdge`, then there is\n" -" no ambiguity concerning the result. But, if the Interface1D results\n" -" of a chaining (chain, stroke), then it might be made of several 1D\n" -" elements of different Quantitative Invisibilities.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: The Quantitative Invisibility of the Interface1D.\n" -" :rtype: int\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > " + ":class:`freestyle.types.UnaryFunction1DUnsigned` > :class:`QuantitativeInvisibilityF1D`\n" + "\n" + ".. method:: __init__(integration_type=IntegrationType.MEAN)\n" + "\n" + " Builds a QuantitativeInvisibilityF1D object.\n" + "\n" + " :arg integration_type: The integration method used to compute a single value\n" + " from a set of values.\n" + " :type integration_type: :class:`freestyle.types.IntegrationType`\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns the Quantitative Invisibility of an Interface1D element. If\n" + " the Interface1D is a :class:`freestyle.types.ViewEdge`, then there is\n" + " no ambiguity concerning the result. But, if the Interface1D results\n" + " of a chaining (chain, stroke), then it might be made of several 1D\n" + " elements of different Quantitative Invisibilities.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: The Quantitative Invisibility of the Interface1D.\n" + " :rtype: int\n"; -static int QuantitativeInvisibilityF1D___init__(BPy_QuantitativeInvisibilityF1D *self, PyObject *args, PyObject *kwds) +static int QuantitativeInvisibilityF1D___init__(BPy_QuantitativeInvisibilityF1D *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"integration_type", NULL}; - PyObject *obj = 0; + static const char *kwlist[] = {"integration_type", NULL}; + PyObject *obj = 0; - if (!PyArg_ParseTupleAndKeywords(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; + if (!PyArg_ParseTupleAndKeywords( + 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; } /*-----------------------BPy_QuantitativeInvisibilityF1D type definition ------------------------------*/ PyTypeObject QuantitativeInvisibilityF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "QuantitativeInvisibilityF1D", /* tp_name */ - sizeof(BPy_QuantitativeInvisibilityF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - QuantitativeInvisibilityF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DUnsigned_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)QuantitativeInvisibilityF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "QuantitativeInvisibilityF1D", /* tp_name */ + sizeof(BPy_QuantitativeInvisibilityF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + QuantitativeInvisibilityF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DUnsigned_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)QuantitativeInvisibilityF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.h index edaeea2a2d9..35cd9e779bd 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.h @@ -32,14 +32,13 @@ extern "C" { extern PyTypeObject QuantitativeInvisibilityF1D_Type; #define BPy_QuantitativeInvisibilityF1D_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&QuantitativeInvisibilityF1D_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&QuantitativeInvisibilityF1D_Type)) /*---------------------------Python BPy_QuantitativeInvisibilityF1D structure definition----------*/ typedef struct { - BPy_UnaryFunction1DUnsigned py_uf1D_unsigned; + BPy_UnaryFunction1DUnsigned py_uf1D_unsigned; } BPy_QuantitativeInvisibilityF1D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 4b5fee581f7..0d7944de788 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 @@ -33,72 +33,72 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetOccludeeF1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DVectorViewShape` > :class:`GetOccludeeF1D`\n" -"\n" -".. method:: __init__()\n" -"\n" -" Builds a GetOccludeeF1D object.\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns a list of occluded shapes covered by this Interface1D.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: A list of occluded shapes covered by the Interface1D.\n" -" :rtype: list of :class:`freestyle.types.ViewShape` objects\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > " + ":class:`freestyle.types.UnaryFunction1DVectorViewShape` > :class:`GetOccludeeF1D`\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Builds a GetOccludeeF1D object.\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns a list of occluded shapes covered by this Interface1D.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: A list of occluded shapes covered by the Interface1D.\n" + " :rtype: list of :class:`freestyle.types.ViewShape` objects\n"; static int GetOccludeeF1D___init__(BPy_GetOccludeeF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->py_uf1D_vectorviewshape.uf1D_vectorviewshape = new Functions1D::GetOccludeeF1D(); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->py_uf1D_vectorviewshape.uf1D_vectorviewshape = new Functions1D::GetOccludeeF1D(); + return 0; } /*-----------------------BPy_GetOccludeeF1D type definition ------------------------------*/ PyTypeObject GetOccludeeF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "GetOccludeeF1D", /* tp_name */ - sizeof(BPy_GetOccludeeF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetOccludeeF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DVectorViewShape_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetOccludeeF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "GetOccludeeF1D", /* tp_name */ + sizeof(BPy_GetOccludeeF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetOccludeeF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DVectorViewShape_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetOccludeeF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.h index 6e619ffd42e..5a14b5dc35d 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject GetOccludeeF1D_Type; -#define BPy_GetOccludeeF1D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetOccludeeF1D_Type)) +#define BPy_GetOccludeeF1D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetOccludeeF1D_Type)) /*---------------------------Python BPy_GetOccludeeF1D structure definition----------*/ typedef struct { - BPy_UnaryFunction1DVectorViewShape py_uf1D_vectorviewshape; + BPy_UnaryFunction1DVectorViewShape py_uf1D_vectorviewshape; } BPy_GetOccludeeF1D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 a42064be52c..38651154ce7 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 @@ -33,72 +33,72 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetOccludersF1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DVectorViewShape` > :class:`GetOccludersF1D`\n" -"\n" -".. method:: __init__()\n" -"\n" -" Builds a GetOccludersF1D object.\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns a list of occluding shapes that cover this Interface1D.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: A list of occluding shapes that cover the Interface1D.\n" -" :rtype: list of :class:`freestyle.types.ViewShape` objects\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > " + ":class:`freestyle.types.UnaryFunction1DVectorViewShape` > :class:`GetOccludersF1D`\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Builds a GetOccludersF1D object.\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns a list of occluding shapes that cover this Interface1D.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: A list of occluding shapes that cover the Interface1D.\n" + " :rtype: list of :class:`freestyle.types.ViewShape` objects\n"; static int GetOccludersF1D___init__(BPy_GetOccludersF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->py_uf1D_vectorviewshape.uf1D_vectorviewshape = new Functions1D::GetOccludersF1D(); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->py_uf1D_vectorviewshape.uf1D_vectorviewshape = new Functions1D::GetOccludersF1D(); + return 0; } /*-----------------------BPy_GetOccludersF1D type definition ------------------------------*/ PyTypeObject GetOccludersF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "GetOccludersF1D", /* tp_name */ - sizeof(BPy_GetOccludersF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetOccludersF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DVectorViewShape_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetOccludersF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "GetOccludersF1D", /* tp_name */ + sizeof(BPy_GetOccludersF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetOccludersF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DVectorViewShape_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetOccludersF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.h index 93f1fef2167..29899d443a6 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject GetOccludersF1D_Type; -#define BPy_GetOccludersF1D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetOccludersF1D_Type)) +#define BPy_GetOccludersF1D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetOccludersF1D_Type)) /*---------------------------Python BPy_GetOccludersF1D structure definition----------*/ typedef struct { - BPy_UnaryFunction1DVectorViewShape py_uf1D_vectorviewshape; + BPy_UnaryFunction1DVectorViewShape py_uf1D_vectorviewshape; } BPy_GetOccludersF1D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 1ef8502dfbe..537e57c7106 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 @@ -33,72 +33,72 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char GetShapeF1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DVectorViewShape` > :class:`GetShapeF1D`\n" -"\n" -".. method:: __init__()\n" -"\n" -" Builds a GetShapeF1D object.\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns a list of shapes covered by this Interface1D.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: A list of shapes covered by the Interface1D.\n" -" :rtype: list of :class:`freestyle.types.ViewShape` objects\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > " + ":class:`freestyle.types.UnaryFunction1DVectorViewShape` > :class:`GetShapeF1D`\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Builds a GetShapeF1D object.\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns a list of shapes covered by this Interface1D.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: A list of shapes covered by the Interface1D.\n" + " :rtype: list of :class:`freestyle.types.ViewShape` objects\n"; static int GetShapeF1D___init__(BPy_GetShapeF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->py_uf1D_vectorviewshape.uf1D_vectorviewshape = new Functions1D::GetShapeF1D(); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->py_uf1D_vectorviewshape.uf1D_vectorviewshape = new Functions1D::GetShapeF1D(); + return 0; } /*-----------------------BPy_GetShapeF1D type definition ------------------------------*/ PyTypeObject GetShapeF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "GetShapeF1D", /* tp_name */ - sizeof(BPy_GetShapeF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - GetShapeF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DVectorViewShape_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)GetShapeF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "GetShapeF1D", /* tp_name */ + sizeof(BPy_GetShapeF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + GetShapeF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DVectorViewShape_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)GetShapeF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.h index 6f2ec2bec1d..b90f3df5831 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject GetShapeF1D_Type; -#define BPy_GetShapeF1D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetShapeF1D_Type)) +#define BPy_GetShapeF1D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&GetShapeF1D_Type)) /*---------------------------Python BPy_GetShapeF1D structure definition----------*/ typedef struct { - BPy_UnaryFunction1DVectorViewShape py_uf1D_vectorviewshape; + BPy_UnaryFunction1DVectorViewShape py_uf1D_vectorviewshape; } BPy_GetShapeF1D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 4f3a8c00cbd..da9d3301e5f 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 @@ -33,70 +33,72 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ChainingTimeStampF1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DVoid` > :class:`ChainingTimeStampF1D`\n" -"\n" -".. method:: __init__()\n" -"\n" -" Builds a ChainingTimeStampF1D object.\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Sets the chaining time stamp of the Interface1D.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > " + ":class:`freestyle.types.UnaryFunction1DVoid` > :class:`ChainingTimeStampF1D`\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Builds a ChainingTimeStampF1D object.\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Sets the chaining time stamp of the Interface1D.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n"; -static int ChainingTimeStampF1D___init__(BPy_ChainingTimeStampF1D *self, PyObject *args, PyObject *kwds) +static int ChainingTimeStampF1D___init__(BPy_ChainingTimeStampF1D *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->py_uf1D_void.uf1D_void = new Functions1D::ChainingTimeStampF1D(); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->py_uf1D_void.uf1D_void = new Functions1D::ChainingTimeStampF1D(); + return 0; } /*-----------------------BPy_ChainingTimeStampF1D type definition ------------------------------*/ PyTypeObject ChainingTimeStampF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ChainingTimeStampF1D", /* tp_name */ - sizeof(BPy_ChainingTimeStampF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ChainingTimeStampF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DVoid_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ChainingTimeStampF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "ChainingTimeStampF1D", /* tp_name */ + sizeof(BPy_ChainingTimeStampF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ChainingTimeStampF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DVoid_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ChainingTimeStampF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.h index 860cbd47e81..c6423ef434f 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject ChainingTimeStampF1D_Type; -#define BPy_ChainingTimeStampF1D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&ChainingTimeStampF1D_Type)) +#define BPy_ChainingTimeStampF1D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&ChainingTimeStampF1D_Type)) /*---------------------------Python BPy_ChainingTimeStampF1D structure definition----------*/ typedef struct { - BPy_UnaryFunction1DVoid py_uf1D_void; + BPy_UnaryFunction1DVoid py_uf1D_void; } BPy_ChainingTimeStampF1D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 55536d9aff8..3aa694a5739 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 @@ -33,71 +33,72 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char IncrementChainingTimeStampF1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DVoid` > :class:`IncrementChainingTimeStampF1D`\n" -"\n" -".. method:: __init__()\n" -"\n" -" Builds an IncrementChainingTimeStampF1D object.\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Increments the chaining time stamp of the Interface1D.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > " + ":class:`freestyle.types.UnaryFunction1DVoid` > :class:`IncrementChainingTimeStampF1D`\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Builds an IncrementChainingTimeStampF1D object.\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Increments the chaining time stamp of the Interface1D.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n"; static int IncrementChainingTimeStampF1D___init__(BPy_IncrementChainingTimeStampF1D *self, - PyObject *args, PyObject *kwds) + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->py_uf1D_void.uf1D_void = new Functions1D::IncrementChainingTimeStampF1D(); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->py_uf1D_void.uf1D_void = new Functions1D::IncrementChainingTimeStampF1D(); + return 0; } /*-----------------------BPy_IncrementChainingTimeStampF1D type definition ------------------------------*/ PyTypeObject IncrementChainingTimeStampF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "IncrementChainingTimeStampF1D", /* tp_name */ - sizeof(BPy_IncrementChainingTimeStampF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - IncrementChainingTimeStampF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DVoid_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)IncrementChainingTimeStampF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "IncrementChainingTimeStampF1D", /* tp_name */ + sizeof(BPy_IncrementChainingTimeStampF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + IncrementChainingTimeStampF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DVoid_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)IncrementChainingTimeStampF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.h index 4e27c628cef..3030528a49b 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.h @@ -32,14 +32,13 @@ extern "C" { extern PyTypeObject IncrementChainingTimeStampF1D_Type; #define BPy_IncrementChainingTimeStampF1D_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&IncrementChainingTimeStampF1D_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&IncrementChainingTimeStampF1D_Type)) /*---------------------------Python BPy_IncrementChainingTimeStampF1D structure definition----------*/ typedef struct { - BPy_UnaryFunction1DVoid py_uf1D_void; + BPy_UnaryFunction1DVoid py_uf1D_void; } BPy_IncrementChainingTimeStampF1D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus 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 d21aa97b591..eb53bca5874 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 @@ -33,70 +33,70 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char TimeStampF1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > :class:`freestyle.types.UnaryFunction1DVoid` > :class:`TimeStampF1D`\n" -"\n" -".. method:: __init__()\n" -"\n" -" Builds a TimeStampF1D object.\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns the time stamp of the Interface1D.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n"; + "Class hierarchy: :class:`freestyle.types.UnaryFunction1D` > " + ":class:`freestyle.types.UnaryFunction1DVoid` > :class:`TimeStampF1D`\n" + "\n" + ".. method:: __init__()\n" + "\n" + " Builds a TimeStampF1D object.\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns the time stamp of the Interface1D.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n"; static int TimeStampF1D___init__(BPy_TimeStampF1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->py_uf1D_void.uf1D_void = new Functions1D::TimeStampF1D(); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->py_uf1D_void.uf1D_void = new Functions1D::TimeStampF1D(); + return 0; } /*-----------------------BPy_TimeStampF1D type definition ------------------------------*/ PyTypeObject TimeStampF1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "TimeStampF1D", /* tp_name */ - sizeof(BPy_TimeStampF1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - TimeStampF1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryFunction1DVoid_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)TimeStampF1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "TimeStampF1D", /* tp_name */ + sizeof(BPy_TimeStampF1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + TimeStampF1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryFunction1DVoid_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)TimeStampF1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.h b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.h index c5c58f40080..4787f35cfc5 100644 --- a/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.h +++ b/source/blender/freestyle/intern/python/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.h @@ -31,14 +31,14 @@ extern "C" { extern PyTypeObject TimeStampF1D_Type; -#define BPy_TimeStampF1D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&TimeStampF1D_Type)) +#define BPy_TimeStampF1D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&TimeStampF1D_Type)) /*---------------------------Python BPy_TimeStampF1D structure definition----------*/ typedef struct { - BPy_UnaryFunction1DVoid py_uf1D_void; + BPy_UnaryFunction1DVoid py_uf1D_void; } BPy_TimeStampF1D; - /////////////////////////////////////////////////////////////////////////////////////////// #ifdef __cplusplus diff --git a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp index f2ba1f7aafb..8289d4b6386 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.cpp @@ -29,68 +29,67 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char FalseUP0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryPredicate0D` > :class:`FalseUP0D`\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Always returns false.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: False.\n" -" :rtype: bool\n"; + "Class hierarchy: :class:`freestyle.types.UnaryPredicate0D` > :class:`FalseUP0D`\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Always returns false.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: False.\n" + " :rtype: bool\n"; static int FalseUP0D___init__(BPy_FalseUP0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->py_up0D.up0D = new Predicates0D::FalseUP0D(); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->py_up0D.up0D = new Predicates0D::FalseUP0D(); + return 0; } /*-----------------------BPy_FalseUP0D type definition ------------------------------*/ PyTypeObject FalseUP0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "FalseUP0D", /* tp_name */ - sizeof(BPy_FalseUP0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - FalseUP0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryPredicate0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)FalseUP0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "FalseUP0D", /* tp_name */ + sizeof(BPy_FalseUP0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + FalseUP0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryPredicate0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)FalseUP0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.h b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.h index dbc395fc2f4..b947ccf5b95 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.h +++ b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_FalseUP0D.h @@ -35,7 +35,7 @@ extern PyTypeObject FalseUP0D_Type; /*---------------------------Python BPy_FalseUP0D structure definition----------*/ typedef struct { - BPy_UnaryPredicate0D py_up0D; + BPy_UnaryPredicate0D py_up0D; } BPy_FalseUP0D; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp index fd79c44da43..697e9bc2c92 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.cpp @@ -29,68 +29,67 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char TrueUP0D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryPredicate0D` > :class:`TrueUP0D`\n" -"\n" -".. method:: __call__(it)\n" -"\n" -" Always returns true.\n" -"\n" -" :arg it: An Interface0DIterator object.\n" -" :type it: :class:`freestyle.types.Interface0DIterator`\n" -" :return: True.\n" -" :rtype: bool\n"; + "Class hierarchy: :class:`freestyle.types.UnaryPredicate0D` > :class:`TrueUP0D`\n" + "\n" + ".. method:: __call__(it)\n" + "\n" + " Always returns true.\n" + "\n" + " :arg it: An Interface0DIterator object.\n" + " :type it: :class:`freestyle.types.Interface0DIterator`\n" + " :return: True.\n" + " :rtype: bool\n"; static int TrueUP0D___init__(BPy_TrueUP0D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->py_up0D.up0D = new Predicates0D::TrueUP0D(); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->py_up0D.up0D = new Predicates0D::TrueUP0D(); + return 0; } /*-----------------------BPy_TrueUP0D type definition ------------------------------*/ PyTypeObject TrueUP0D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "TrueUP0D", /* tp_name */ - sizeof(BPy_TrueUP0D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - TrueUP0D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryPredicate0D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)TrueUP0D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "TrueUP0D", /* tp_name */ + sizeof(BPy_TrueUP0D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + TrueUP0D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryPredicate0D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)TrueUP0D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.h b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.h index 9dd4a5ecd34..72acf363992 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.h +++ b/source/blender/freestyle/intern/python/UnaryPredicate0D/BPy_TrueUP0D.h @@ -35,7 +35,7 @@ extern PyTypeObject TrueUP0D_Type; /*---------------------------Python BPy_TrueUP0D structure definition----------*/ typedef struct { - BPy_UnaryPredicate0D py_up0D; + BPy_UnaryPredicate0D py_up0D; } BPy_TrueUP0D; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp index 5a20dd323f6..faf0c98641a 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.cpp @@ -29,69 +29,68 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ContourUP1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`ContourUP1D`\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns true if the Interface1D is a contour. An Interface1D is a\n" -" contour if it is borded by a different shape on each of its sides.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: True if the Interface1D is a contour, false otherwise.\n" -" :rtype: bool\n"; + "Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`ContourUP1D`\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns true if the Interface1D is a contour. An Interface1D is a\n" + " contour if it is borded by a different shape on each of its sides.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: True if the Interface1D is a contour, false otherwise.\n" + " :rtype: bool\n"; static int ContourUP1D___init__(BPy_ContourUP1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->py_up1D.up1D = new Predicates1D::ContourUP1D(); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->py_up1D.up1D = new Predicates1D::ContourUP1D(); + return 0; } /*-----------------------BPy_ContourUP1D type definition ------------------------------*/ PyTypeObject ContourUP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ContourUP1D", /* tp_name */ - sizeof(BPy_ContourUP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ContourUP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ContourUP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "ContourUP1D", /* tp_name */ + sizeof(BPy_ContourUP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ContourUP1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryPredicate1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ContourUP1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.h index 32f9080173f..de6c40fa8ac 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.h +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ContourUP1D.h @@ -31,11 +31,12 @@ extern "C" { extern PyTypeObject ContourUP1D_Type; -#define BPy_ContourUP1D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&ContourUP1D_Type)) +#define BPy_ContourUP1D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&ContourUP1D_Type)) /*---------------------------Python BPy_ContourUP1D structure definition----------*/ typedef struct { - BPy_UnaryPredicate1D py_up1D; + BPy_UnaryPredicate1D py_up1D; } BPy_ContourUP1D; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp index 75df852ddfa..065329847b3 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.cpp @@ -31,81 +31,82 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char DensityLowerThanUP1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`DensityLowerThanUP1D`\n" -"\n" -".. method:: __init__(threshold, sigma=2.0)\n" -"\n" -" Builds a DensityLowerThanUP1D object.\n" -"\n" -" :arg threshold: The value of the threshold density. Any Interface1D\n" -" having a density lower than this threshold will match.\n" -" :type threshold: float\n" -" :arg sigma: The sigma value defining the density evaluation window\n" -" size used in the :class:`freestyle.functions.DensityF0D` functor.\n" -" :type sigma: float\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns true if the density evaluated for the Interface1D is less\n" -" than a user-defined density value.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: True if the density is lower than a threshold.\n" -" :rtype: bool\n"; + "Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`DensityLowerThanUP1D`\n" + "\n" + ".. method:: __init__(threshold, sigma=2.0)\n" + "\n" + " Builds a DensityLowerThanUP1D object.\n" + "\n" + " :arg threshold: The value of the threshold density. Any Interface1D\n" + " having a density lower than this threshold will match.\n" + " :type threshold: float\n" + " :arg sigma: The sigma value defining the density evaluation window\n" + " size used in the :class:`freestyle.functions.DensityF0D` functor.\n" + " :type sigma: float\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns true if the density evaluated for the Interface1D is less\n" + " than a user-defined density value.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: True if the density is lower than a threshold.\n" + " :rtype: bool\n"; -static int DensityLowerThanUP1D___init__(BPy_DensityLowerThanUP1D *self, PyObject *args, PyObject *kwds) +static int DensityLowerThanUP1D___init__(BPy_DensityLowerThanUP1D *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"threshold", "sigma", NULL}; - double d1, d2 = 2.0; + static const char *kwlist[] = {"threshold", "sigma", NULL}; + double d1, d2 = 2.0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "d|d", (char **)kwlist, &d1, &d2)) - return -1; - self->py_up1D.up1D = new Predicates1D::DensityLowerThanUP1D(d1, d2); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "d|d", (char **)kwlist, &d1, &d2)) + return -1; + self->py_up1D.up1D = new Predicates1D::DensityLowerThanUP1D(d1, d2); + return 0; } /*-----------------------BPy_DensityLowerThanUP1D type definition ------------------------------*/ PyTypeObject DensityLowerThanUP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "DensityLowerThanUP1D", /* tp_name */ - sizeof(BPy_DensityLowerThanUP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - DensityLowerThanUP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)DensityLowerThanUP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "DensityLowerThanUP1D", /* tp_name */ + sizeof(BPy_DensityLowerThanUP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + DensityLowerThanUP1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryPredicate1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)DensityLowerThanUP1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.h index e8ea1daca19..fb02b63fa3d 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.h +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_DensityLowerThanUP1D.h @@ -31,11 +31,12 @@ extern "C" { extern PyTypeObject DensityLowerThanUP1D_Type; -#define BPy_DensityLowerThanUP1D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&DensityLowerThanUP1D_Type)) +#define BPy_DensityLowerThanUP1D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&DensityLowerThanUP1D_Type)) /*---------------------------Python BPy_DensityLowerThanUP1D structure definition----------*/ typedef struct { - BPy_UnaryPredicate1D py_up1D; + BPy_UnaryPredicate1D py_up1D; } BPy_DensityLowerThanUP1D; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp index ea885e74174..f3b6a71585f 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.cpp @@ -29,77 +29,79 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char EqualToChainingTimeStampUP1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`freestyle.types.EqualToChainingTimeStampUP1D`\n" -"\n" -".. method:: __init__(ts)\n" -"\n" -" Builds a EqualToChainingTimeStampUP1D object.\n" -"\n" -" :arg ts: A time stamp value.\n" -" :type ts: int\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns true if the Interface1D's time stamp is equal to a certain\n" -" user-defined value.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: True if the time stamp is equal to a user-defined value.\n" -" :rtype: bool\n"; + "Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > " + ":class:`freestyle.types.EqualToChainingTimeStampUP1D`\n" + "\n" + ".. method:: __init__(ts)\n" + "\n" + " Builds a EqualToChainingTimeStampUP1D object.\n" + "\n" + " :arg ts: A time stamp value.\n" + " :type ts: int\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns true if the Interface1D's time stamp is equal to a certain\n" + " user-defined value.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: True if the time stamp is equal to a user-defined value.\n" + " :rtype: bool\n"; -static int EqualToChainingTimeStampUP1D___init__(BPy_EqualToChainingTimeStampUP1D *self, PyObject *args, PyObject *kwds) +static int EqualToChainingTimeStampUP1D___init__(BPy_EqualToChainingTimeStampUP1D *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"ts", NULL}; - unsigned u; + static const char *kwlist[] = {"ts", NULL}; + unsigned u; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &u)) - return -1; - self->py_up1D.up1D = new Predicates1D::EqualToChainingTimeStampUP1D(u); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &u)) + return -1; + self->py_up1D.up1D = new Predicates1D::EqualToChainingTimeStampUP1D(u); + return 0; } /*-----------------------BPy_EqualToChainingTimeStampUP1D type definition ------------------------------*/ PyTypeObject EqualToChainingTimeStampUP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "EqualToChainingTimeStampUP1D", /* tp_name */ - sizeof(BPy_EqualToChainingTimeStampUP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - EqualToChainingTimeStampUP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)EqualToChainingTimeStampUP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "EqualToChainingTimeStampUP1D", /* tp_name */ + sizeof(BPy_EqualToChainingTimeStampUP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + EqualToChainingTimeStampUP1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryPredicate1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)EqualToChainingTimeStampUP1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.h index a542c53a88b..eab08c6588d 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.h +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToChainingTimeStampUP1D.h @@ -32,11 +32,11 @@ extern "C" { extern PyTypeObject EqualToChainingTimeStampUP1D_Type; #define BPy_EqualToChainingTimeStampUP1D_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&EqualToChainingTimeStampUP1D_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&EqualToChainingTimeStampUP1D_Type)) /*---------------------------Python BPy_EqualToChainingTimeStampUP1D structure definition----------*/ typedef struct { - BPy_UnaryPredicate1D py_up1D; + BPy_UnaryPredicate1D py_up1D; } BPy_EqualToChainingTimeStampUP1D; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp index 280e7088628..30b8e3fce95 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.cpp @@ -29,77 +29,78 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char EqualToTimeStampUP1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`EqualToTimeStampUP1D`\n" -"\n" -".. method:: __init__(ts)\n" -"\n" -" Builds a EqualToTimeStampUP1D object.\n" -"\n" -" :arg ts: A time stamp value.\n" -" :type ts: int\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns true if the Interface1D's time stamp is equal to a certain\n" -" user-defined value.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: True if the time stamp is equal to a user-defined value.\n" -" :rtype: bool\n"; + "Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`EqualToTimeStampUP1D`\n" + "\n" + ".. method:: __init__(ts)\n" + "\n" + " Builds a EqualToTimeStampUP1D object.\n" + "\n" + " :arg ts: A time stamp value.\n" + " :type ts: int\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns true if the Interface1D's time stamp is equal to a certain\n" + " user-defined value.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: True if the time stamp is equal to a user-defined value.\n" + " :rtype: bool\n"; -static int EqualToTimeStampUP1D___init__(BPy_EqualToTimeStampUP1D *self, PyObject *args, PyObject *kwds) +static int EqualToTimeStampUP1D___init__(BPy_EqualToTimeStampUP1D *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"ts", NULL}; - unsigned u; + static const char *kwlist[] = {"ts", NULL}; + unsigned u; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &u)) - return -1; - self->py_up1D.up1D = new Predicates1D::EqualToTimeStampUP1D(u); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "I", (char **)kwlist, &u)) + return -1; + self->py_up1D.up1D = new Predicates1D::EqualToTimeStampUP1D(u); + return 0; } /*-----------------------BPy_EqualToTimeStampUP1D type definition ------------------------------*/ PyTypeObject EqualToTimeStampUP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "EqualToTimeStampUP1D", /* tp_name */ - sizeof(BPy_EqualToTimeStampUP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - EqualToTimeStampUP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)EqualToTimeStampUP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "EqualToTimeStampUP1D", /* tp_name */ + sizeof(BPy_EqualToTimeStampUP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + EqualToTimeStampUP1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryPredicate1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)EqualToTimeStampUP1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.h index b27509e7205..13736242382 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.h +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_EqualToTimeStampUP1D.h @@ -31,11 +31,12 @@ extern "C" { extern PyTypeObject EqualToTimeStampUP1D_Type; -#define BPy_EqualToTimeStampUP1D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&EqualToTimeStampUP1D_Type)) +#define BPy_EqualToTimeStampUP1D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&EqualToTimeStampUP1D_Type)) /*---------------------------Python BPy_EqualToTimeStampUP1D structure definition----------*/ typedef struct { - BPy_UnaryPredicate1D py_up1D; + BPy_UnaryPredicate1D py_up1D; } BPy_EqualToTimeStampUP1D; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp index 3b00ab2dba8..8bd31209291 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.cpp @@ -29,71 +29,72 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ExternalContourUP1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`ExternalContourUP1D`\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns true if the Interface1D is an external contour. An\n" -" Interface1D is an external contour if it is borded by no shape on\n" -" one of its sides.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: True if the Interface1D is an external contour, false\n" -" otherwise.\n" -" :rtype: bool\n"; + "Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`ExternalContourUP1D`\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns true if the Interface1D is an external contour. An\n" + " Interface1D is an external contour if it is borded by no shape on\n" + " one of its sides.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: True if the Interface1D is an external contour, false\n" + " otherwise.\n" + " :rtype: bool\n"; -static int ExternalContourUP1D___init__(BPy_ExternalContourUP1D *self, PyObject *args, PyObject *kwds) +static int ExternalContourUP1D___init__(BPy_ExternalContourUP1D *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->py_up1D.up1D = new Predicates1D::ExternalContourUP1D(); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->py_up1D.up1D = new Predicates1D::ExternalContourUP1D(); + return 0; } /*-----------------------BPy_ExternalContourUP1D type definition ------------------------------*/ PyTypeObject ExternalContourUP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ExternalContourUP1D", /* tp_name */ - sizeof(BPy_ExternalContourUP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ExternalContourUP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ExternalContourUP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "ExternalContourUP1D", /* tp_name */ + sizeof(BPy_ExternalContourUP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ExternalContourUP1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryPredicate1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ExternalContourUP1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.h index 91140eb9670..4d2a22731fa 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.h +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ExternalContourUP1D.h @@ -31,11 +31,12 @@ extern "C" { extern PyTypeObject ExternalContourUP1D_Type; -#define BPy_ExternalContourUP1D_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&ExternalContourUP1D_Type)) +#define BPy_ExternalContourUP1D_Check(v) \ + (PyObject_IsInstance((PyObject *)v, (PyObject *)&ExternalContourUP1D_Type)) /*---------------------------Python BPy_ExternalContourUP1D structure definition----------*/ typedef struct { - BPy_UnaryPredicate1D py_up1D; + BPy_UnaryPredicate1D py_up1D; } BPy_ExternalContourUP1D; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp index a3a0d8c544c..b4db7e65090 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.cpp @@ -29,68 +29,67 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char FalseUP1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`FalseUP1D`\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Always returns false.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: False.\n" -" :rtype: bool\n"; + "Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`FalseUP1D`\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Always returns false.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: False.\n" + " :rtype: bool\n"; static int FalseUP1D___init__(BPy_FalseUP1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->py_up1D.up1D = new Predicates1D::FalseUP1D(); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->py_up1D.up1D = new Predicates1D::FalseUP1D(); + return 0; } /*-----------------------BPy_FalseUP1D type definition ------------------------------*/ PyTypeObject FalseUP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "FalseUP1D", /* tp_name */ - sizeof(BPy_FalseUP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - FalseUP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)FalseUP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "FalseUP1D", /* tp_name */ + sizeof(BPy_FalseUP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + FalseUP1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryPredicate1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)FalseUP1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.h index d138f9d7f9f..57255c2333f 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.h +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_FalseUP1D.h @@ -35,7 +35,7 @@ extern PyTypeObject FalseUP1D_Type; /*---------------------------Python BPy_FalseUP1D structure definition----------*/ typedef struct { - BPy_UnaryPredicate1D py_up1D; + BPy_UnaryPredicate1D py_up1D; } BPy_FalseUP1D; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp index eb4968484fc..885ecb16695 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.cpp @@ -29,81 +29,83 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char QuantitativeInvisibilityUP1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`QuantitativeInvisibilityUP1D`\n" -"\n" -".. method:: __init__(qi=0)\n" -"\n" -" Builds a QuantitativeInvisibilityUP1D object.\n" -"\n" -" :arg qi: The Quantitative Invisibility you want the Interface1D to\n" -" have.\n" -" :type qi: int\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns true if the Quantitative Invisibility evaluated at an\n" -" Interface1D, using the\n" -" :class:`freestyle.functions.QuantitativeInvisibilityF1D` functor,\n" -" equals a certain user-defined value.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: True if Quantitative Invisibility equals a user-defined\n" -" value.\n" -" :rtype: bool\n"; + "Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > " + ":class:`QuantitativeInvisibilityUP1D`\n" + "\n" + ".. method:: __init__(qi=0)\n" + "\n" + " Builds a QuantitativeInvisibilityUP1D object.\n" + "\n" + " :arg qi: The Quantitative Invisibility you want the Interface1D to\n" + " have.\n" + " :type qi: int\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns true if the Quantitative Invisibility evaluated at an\n" + " Interface1D, using the\n" + " :class:`freestyle.functions.QuantitativeInvisibilityF1D` functor,\n" + " equals a certain user-defined value.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: True if Quantitative Invisibility equals a user-defined\n" + " value.\n" + " :rtype: bool\n"; -static int QuantitativeInvisibilityUP1D___init__(BPy_QuantitativeInvisibilityUP1D *self, PyObject *args, PyObject *kwds) +static int QuantitativeInvisibilityUP1D___init__(BPy_QuantitativeInvisibilityUP1D *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"qi", NULL}; - int i = 0; + static const char *kwlist[] = {"qi", NULL}; + int i = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|i", (char **)kwlist, &i)) - return -1; - self->py_up1D.up1D = new Predicates1D::QuantitativeInvisibilityUP1D(i); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "|i", (char **)kwlist, &i)) + return -1; + self->py_up1D.up1D = new Predicates1D::QuantitativeInvisibilityUP1D(i); + return 0; } /*-----------------------BPy_QuantitativeInvisibilityUP1D type definition ------------------------------*/ PyTypeObject QuantitativeInvisibilityUP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "QuantitativeInvisibilityUP1D", /* tp_name */ - sizeof(BPy_QuantitativeInvisibilityUP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - QuantitativeInvisibilityUP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)QuantitativeInvisibilityUP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "QuantitativeInvisibilityUP1D", /* tp_name */ + sizeof(BPy_QuantitativeInvisibilityUP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + QuantitativeInvisibilityUP1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryPredicate1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)QuantitativeInvisibilityUP1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.h index bfd7302b0e1..879c6c5b7be 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.h +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_QuantitativeInvisibilityUP1D.h @@ -32,11 +32,11 @@ extern "C" { extern PyTypeObject QuantitativeInvisibilityUP1D_Type; #define BPy_QuantitativeInvisibilityUP1D_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&QuantitativeInvisibilityUP1D_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&QuantitativeInvisibilityUP1D_Type)) /*---------------------------Python BPy_QuantitativeInvisibilityUP1D structure definition----------*/ typedef struct { - BPy_UnaryPredicate1D py_up1D; + BPy_UnaryPredicate1D py_up1D; } BPy_QuantitativeInvisibilityUP1D; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp index adf44287582..54a6a70c3bf 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.cpp @@ -29,80 +29,79 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char ShapeUP1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`ShapeUP1D`\n" -"\n" -".. method:: __init__(first, second=0)\n" -"\n" -" Builds a ShapeUP1D object.\n" -"\n" -" :arg first: The first Id component.\n" -" :type first: int\n" -" :arg second: The second Id component.\n" -" :type second: int\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns true if the shape to which the Interface1D belongs to has the\n" -" same :class:`freestyle.types.Id` as the one specified by the user.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: True if Interface1D belongs to the shape of the\n" -" user-specified Id.\n" -" :rtype: bool\n"; + "Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`ShapeUP1D`\n" + "\n" + ".. method:: __init__(first, second=0)\n" + "\n" + " Builds a ShapeUP1D object.\n" + "\n" + " :arg first: The first Id component.\n" + " :type first: int\n" + " :arg second: The second Id component.\n" + " :type second: int\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns true if the shape to which the Interface1D belongs to has the\n" + " same :class:`freestyle.types.Id` as the one specified by the user.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: True if Interface1D belongs to the shape of the\n" + " user-specified Id.\n" + " :rtype: bool\n"; static int ShapeUP1D___init__(BPy_ShapeUP1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {"first", "second", NULL}; - unsigned u1, u2 = 0; + static const char *kwlist[] = {"first", "second", NULL}; + unsigned u1, u2 = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "I|I", (char **)kwlist, &u1, &u2)) - return -1; - self->py_up1D.up1D = new Predicates1D::ShapeUP1D(u1, u2); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "I|I", (char **)kwlist, &u1, &u2)) + return -1; + self->py_up1D.up1D = new Predicates1D::ShapeUP1D(u1, u2); + return 0; } /*-----------------------BPy_ShapeUP1D type definition ------------------------------*/ PyTypeObject ShapeUP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ShapeUP1D", /* tp_name */ - sizeof(BPy_ShapeUP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ShapeUP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ShapeUP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "ShapeUP1D", /* tp_name */ + sizeof(BPy_ShapeUP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + ShapeUP1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryPredicate1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)ShapeUP1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.h index 9cfeded4452..a48ed0aa0da 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.h +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D.h @@ -35,7 +35,7 @@ extern PyTypeObject ShapeUP1D_Type; /*---------------------------Python BPy_ShapeUP1D structure definition----------*/ typedef struct { - BPy_UnaryPredicate1D py_up1D; + BPy_UnaryPredicate1D py_up1D; } BPy_ShapeUP1D; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp index d1562dfa692..55c8c1ee889 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.cpp @@ -29,68 +29,67 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char TrueUP1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`TrueUP1D`\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Always returns true.\n" -"\n" -" :arg inter: An Interface1D object.\n" -" :type inter: :class:`freestyle.types.Interface1D`\n" -" :return: True.\n" -" :rtype: bool\n"; + "Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`TrueUP1D`\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Always returns true.\n" + "\n" + " :arg inter: An Interface1D object.\n" + " :type inter: :class:`freestyle.types.Interface1D`\n" + " :return: True.\n" + " :rtype: bool\n"; static int TrueUP1D___init__(BPy_TrueUP1D *self, PyObject *args, PyObject *kwds) { - static const char *kwlist[] = {NULL}; + static const char *kwlist[] = {NULL}; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->py_up1D.up1D = new Predicates1D::TrueUP1D(); - return 0; + if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) + return -1; + self->py_up1D.up1D = new Predicates1D::TrueUP1D(); + return 0; } /*-----------------------BPy_TrueUP1D type definition ------------------------------*/ PyTypeObject TrueUP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "TrueUP1D", /* tp_name */ - sizeof(BPy_TrueUP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - TrueUP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)TrueUP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "TrueUP1D", /* tp_name */ + sizeof(BPy_TrueUP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + TrueUP1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryPredicate1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)TrueUP1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.h index 5d4420a2ccd..49c3dcdacca 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.h +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_TrueUP1D.h @@ -35,7 +35,7 @@ extern PyTypeObject TrueUP1D_Type; /*---------------------------Python BPy_TrueUP1D structure definition----------*/ typedef struct { - BPy_UnaryPredicate1D py_up1D; + BPy_UnaryPredicate1D py_up1D; } BPy_TrueUP1D; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp index 26269c34dc7..4fc163dbd01 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.cpp @@ -29,77 +29,80 @@ extern "C" { //------------------------INSTANCE METHODS ---------------------------------- static char WithinImageBoundaryUP1D___doc__[] = -"Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > :class:`WithinImageBoundaryUP1D`\n" -"\n" -".. method:: __init__(xmin, ymin, xmax, ymax)\n" -"\n" -" Builds an WithinImageBoundaryUP1D object.\n" -"\n" -" :arg xmin: X lower bound of the image boundary.\n" -" :type xmin: float\n" -" :arg ymin: Y lower bound of the image boundary.\n" -" :type ymin: float\n" -" :arg xmax: X upper bound of the image boundary.\n" -" :type xmax: float\n" -" :arg ymax: Y upper bound of the image boundary.\n" -" :type ymax: float\n" -"\n" -".. method:: __call__(inter)\n" -"\n" -" Returns true if the Interface1D intersects with image boundary.\n"; + "Class hierarchy: :class:`freestyle.types.UnaryPredicate1D` > " + ":class:`WithinImageBoundaryUP1D`\n" + "\n" + ".. method:: __init__(xmin, ymin, xmax, ymax)\n" + "\n" + " Builds an WithinImageBoundaryUP1D object.\n" + "\n" + " :arg xmin: X lower bound of the image boundary.\n" + " :type xmin: float\n" + " :arg ymin: Y lower bound of the image boundary.\n" + " :type ymin: float\n" + " :arg xmax: X upper bound of the image boundary.\n" + " :type xmax: float\n" + " :arg ymax: Y upper bound of the image boundary.\n" + " :type ymax: float\n" + "\n" + ".. method:: __call__(inter)\n" + "\n" + " Returns true if the Interface1D intersects with image boundary.\n"; -static int WithinImageBoundaryUP1D___init__(BPy_WithinImageBoundaryUP1D *self, PyObject *args, PyObject *kwds) +static int WithinImageBoundaryUP1D___init__(BPy_WithinImageBoundaryUP1D *self, + PyObject *args, + PyObject *kwds) { - static const char *kwlist[] = {"xmin", "ymin", "xmax", "ymax", NULL}; - double xmin, ymin, xmax, ymax; + static const char *kwlist[] = {"xmin", "ymin", "xmax", "ymax", NULL}; + double xmin, ymin, xmax, ymax; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "dddd", (char **)kwlist, &xmin, &ymin, &xmax, &ymax)) - return -1; - self->py_up1D.up1D = new Predicates1D::WithinImageBoundaryUP1D(xmin, ymin, xmax, ymax); - return 0; + if (!PyArg_ParseTupleAndKeywords( + args, kwds, "dddd", (char **)kwlist, &xmin, &ymin, &xmax, &ymax)) + return -1; + self->py_up1D.up1D = new Predicates1D::WithinImageBoundaryUP1D(xmin, ymin, xmax, ymax); + return 0; } /*-----------------------BPy_TrueUP1D type definition ------------------------------*/ PyTypeObject WithinImageBoundaryUP1D_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "WithinImageBoundaryUP1D", /* tp_name */ - sizeof(BPy_WithinImageBoundaryUP1D), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - WithinImageBoundaryUP1D___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &UnaryPredicate1D_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)WithinImageBoundaryUP1D___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ + PyVarObject_HEAD_INIT(NULL, 0) "WithinImageBoundaryUP1D", /* tp_name */ + sizeof(BPy_WithinImageBoundaryUP1D), /* tp_basicsize */ + 0, /* tp_itemsize */ + 0, /* tp_dealloc */ + 0, /* tp_print */ + 0, /* tp_getattr */ + 0, /* tp_setattr */ + 0, /* tp_reserved */ + 0, /* tp_repr */ + 0, /* tp_as_number */ + 0, /* tp_as_sequence */ + 0, /* tp_as_mapping */ + 0, /* tp_hash */ + 0, /* tp_call */ + 0, /* tp_str */ + 0, /* tp_getattro */ + 0, /* tp_setattro */ + 0, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + WithinImageBoundaryUP1D___doc__, /* tp_doc */ + 0, /* tp_traverse */ + 0, /* tp_clear */ + 0, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + 0, /* tp_iter */ + 0, /* tp_iternext */ + 0, /* tp_methods */ + 0, /* tp_members */ + 0, /* tp_getset */ + &UnaryPredicate1D_Type, /* tp_base */ + 0, /* tp_dict */ + 0, /* tp_descr_get */ + 0, /* tp_descr_set */ + 0, /* tp_dictoffset */ + (initproc)WithinImageBoundaryUP1D___init__, /* tp_init */ + 0, /* tp_alloc */ + 0, /* tp_new */ }; /////////////////////////////////////////////////////////////////////////////////////////// diff --git a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.h b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.h index 39eb3f34b7f..2481beee78e 100644 --- a/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.h +++ b/source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_WithinImageBoundaryUP1D.h @@ -32,11 +32,11 @@ extern "C" { extern PyTypeObject WithinImageBoundaryUP1D_Type; #define BPy_WithinImageBoundaryUP1D_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&WithinImageBoundaryUP1D_Type)) + (PyObject_IsInstance((PyObject *)v, (PyObject *)&WithinImageBoundaryUP1D_Type)) /*---------------------------Python BPy_WithinImageBoundaryUP1D structure definition----------*/ typedef struct { - BPy_UnaryPredicate1D py_up1D; + BPy_UnaryPredicate1D py_up1D; } BPy_WithinImageBoundaryUP1D; /////////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3