soc-2008-mxcurioni: finished porting the Freestyle API. All of the original classes, except EdgeModifier and TimestampModifier (which aren't even ported via SWIG), are available under the Blender.Freestyle module. Testing of the porting will now begin to make sure the SWIG-less system works as the original.
Quite a few modifications were made to finish the API: - Freestyle's SConscript was modified to catch all files within the intern/python directory, allowing integration of future shaders implemented in C++. - the Operators class was ported, with a special care of making its methods static (using the METH_STATIC flag in the tp_methods method definitions) - all of the type-checking functions [ BPy_[class name]_Check(obj) ] were changed to allow subclasses to be seen as that type too: instead on looking at the ob_type value, the PyObject_IsInstance function is used. - all of the iterators can now retrieve the object pointed to by the operator, using the getObject() method. A directedViewEdge pair is returned as a list of the two elements in the pair. - all of the style modules were copied to a style_modules_blender/ folder and were modified to use Freestyle as a Blender's submodule. IntegrationType and MediumType was also integrated (for example, changing MEAN to IntegrationType.MEAN). Testing now begins. If everything works correctly, I'll move on to lib3ds removal right away.
This commit is contained in:
@@ -9,7 +9,7 @@ incs = ''
|
||||
incs += '../blenkernel ../blenlib ../imbuf ../makesdna ../python '
|
||||
incs += '../render/extern/include ../render/intern/include ../include ../src'
|
||||
incs += ' #/extern/freestyle/lib3ds'
|
||||
incs += ' ' + env['BF_PYTHON_INC']
|
||||
incs += ' ' + env['BF_PYTHON_INC']
|
||||
incs += ' ' + env['BF_LIB3DS_INC']
|
||||
incs += ' ' + env['BF_PNG_INC']
|
||||
|
||||
@@ -58,145 +58,10 @@ app_sources = env.Glob(prefix + '/*.cpp')
|
||||
|
||||
# Python
|
||||
prefix = 'intern/python'
|
||||
# python_sources = env.Glob(prefix + '/*.cpp')
|
||||
python_sources = [
|
||||
prefix + '/BPy_Freestyle.cpp',
|
||||
prefix + '/BPy_Convert.cpp',
|
||||
prefix + '/BPy_BBox.cpp',
|
||||
prefix + '/BPy_BinaryPredicate0D.cpp',
|
||||
prefix + '/BPy_BinaryPredicate1D.cpp',
|
||||
prefix + '/BPy_FrsMaterial.cpp',
|
||||
prefix + '/BPy_Id.cpp',
|
||||
prefix + '/BPy_IntegrationType.cpp',
|
||||
prefix + '/BPy_Interface0D.cpp',
|
||||
prefix + '/Interface0D/BPy_CurvePoint.cpp',
|
||||
prefix + '/Interface0D/CurvePoint/BPy_StrokeVertex.cpp',
|
||||
prefix + '/Interface0D/BPy_SVertex.cpp',
|
||||
prefix + '/Interface0D/BPy_ViewVertex.cpp',
|
||||
prefix + '/Interface0D/ViewVertex/BPy_NonTVertex.cpp',
|
||||
prefix + '/Interface0D/ViewVertex/BPy_TVertex.cpp',
|
||||
prefix + '/BPy_Interface1D.cpp',
|
||||
prefix + '/Interface1D/BPy_Curve.cpp',
|
||||
prefix + '/Interface1D/Curve/BPy_Chain.cpp',
|
||||
prefix + '/Interface1D/BPy_FEdge.cpp',
|
||||
prefix + '/Interface1D/FEdge/BPy_FEdgeSharp.cpp',
|
||||
prefix + '/Interface1D/FEdge/BPy_FEdgeSmooth.cpp',
|
||||
prefix + '/Interface1D/BPy_Stroke.cpp',
|
||||
prefix + '/Interface1D/BPy_ViewEdge.cpp',
|
||||
prefix + '/BPy_Iterator.cpp',
|
||||
prefix + '/Iterator/BPy_AdjacencyIterator.cpp',
|
||||
prefix + '/Iterator/BPy_Interface0DIterator.cpp',
|
||||
prefix + '/Iterator/BPy_CurvePointIterator.cpp',
|
||||
prefix + '/Iterator/BPy_StrokeVertexIterator.cpp',
|
||||
prefix + '/Iterator/BPy_SVertexIterator.cpp',
|
||||
prefix + '/Iterator/BPy_orientedViewEdgeIterator.cpp',
|
||||
prefix + '/Iterator/BPy_ViewEdgeIterator.cpp',
|
||||
prefix + '/Iterator/BPy_ChainingIterator.cpp',
|
||||
prefix + '/Iterator/BPy_ChainPredicateIterator.cpp',
|
||||
prefix + '/Iterator/BPy_ChainSilhouetteIterator.cpp',
|
||||
prefix + '/BPy_MediumType.cpp',
|
||||
prefix + '/BPy_Nature.cpp',
|
||||
prefix + '/BPy_Noise.cpp',
|
||||
prefix + '/BPy_SShape.cpp',
|
||||
prefix + '/BPy_StrokeAttribute.cpp',
|
||||
prefix + '/BPy_StrokeShader.cpp',
|
||||
prefix + '/StrokeShader/BPy_BackboneStretcherShader.cpp',
|
||||
prefix + '/StrokeShader/BPy_BezierCurveShader.cpp',
|
||||
prefix + '/StrokeShader/BPy_CalligraphicShader.cpp',
|
||||
prefix + '/StrokeShader/BPy_ColorNoiseShader.cpp',
|
||||
prefix + '/StrokeShader/BPy_ColorVariationPatternShader.cpp',
|
||||
prefix + '/StrokeShader/BPy_ConstantColorShader.cpp',
|
||||
prefix + '/StrokeShader/BPy_ConstantThicknessShader.cpp',
|
||||
prefix + '/StrokeShader/BPy_ConstrainedIncreasingThicknessShader.cpp',
|
||||
prefix + '/StrokeShader/BPy_fstreamShader.cpp',
|
||||
prefix + '/StrokeShader/BPy_GuidingLinesShader.cpp',
|
||||
prefix + '/StrokeShader/BPy_IncreasingColorShader.cpp',
|
||||
prefix + '/StrokeShader/BPy_IncreasingThicknessShader.cpp',
|
||||
prefix + '/StrokeShader/BPy_PolygonalizationShader.cpp',
|
||||
prefix + '/StrokeShader/BPy_SamplingShader.cpp',
|
||||
prefix + '/StrokeShader/BPy_SpatialNoiseShader.cpp',
|
||||
prefix + '/StrokeShader/BPy_streamShader.cpp',
|
||||
prefix + '/StrokeShader/BPy_StrokeTextureShader.cpp',
|
||||
prefix + '/StrokeShader/BPy_TextureAssignerShader.cpp',
|
||||
prefix + '/StrokeShader/BPy_ThicknessNoiseShader.cpp',
|
||||
prefix + '/StrokeShader/BPy_ThicknessVariationPatternShader.cpp',
|
||||
prefix + '/StrokeShader/BPy_TipRemoverShader.cpp',
|
||||
prefix + '/BPy_UnaryFunction0D.cpp',
|
||||
prefix + '/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp',
|
||||
prefix + '/UnaryFunction0D/UnaryFunction0D_double/BPy_Curvature2DAngleF0D.cpp',
|
||||
prefix + '/UnaryFunction0D/UnaryFunction0D_double/BPy_DensityF0D.cpp',
|
||||
prefix + '/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedXF0D.cpp',
|
||||
prefix + '/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedYF0D.cpp',
|
||||
prefix + '/UnaryFunction0D/UnaryFunction0D_double/BPy_GetProjectedZF0D.cpp',
|
||||
prefix + '/UnaryFunction0D/UnaryFunction0D_double/BPy_GetXF0D.cpp',
|
||||
prefix + '/UnaryFunction0D/UnaryFunction0D_double/BPy_GetYF0D.cpp',
|
||||
prefix + '/UnaryFunction0D/UnaryFunction0D_double/BPy_GetZF0D.cpp',
|
||||
prefix + '/UnaryFunction0D/UnaryFunction0D_double/BPy_LocalAverageDepthF0D.cpp',
|
||||
prefix + '/UnaryFunction0D/UnaryFunction0D_double/BPy_ZDiscontinuityF0D.cpp',
|
||||
prefix + '/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp',
|
||||
prefix + '/UnaryFunction0D/UnaryFunction0D_Nature_EdgeNature/BPy_CurveNatureF0D.cpp',
|
||||
prefix + '/UnaryFunction0D/BPy_UnaryFunction0DFloat.cpp',
|
||||
prefix + '/UnaryFunction0D/UnaryFunction0D_float/BPy_GetCurvilinearAbscissaF0D.cpp',
|
||||
prefix + '/UnaryFunction0D/UnaryFunction0D_float/BPy_GetParameterF0D.cpp',
|
||||
prefix + '/UnaryFunction0D/UnaryFunction0D_float/BPy_GetViewMapGradientNormF0D.cpp',
|
||||
prefix + '/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadCompleteViewMapPixelF0D.cpp',
|
||||
prefix + '/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadMapPixelF0D.cpp',
|
||||
prefix + '/UnaryFunction0D/UnaryFunction0D_float/BPy_ReadSteerableViewMapPixelF0D.cpp',
|
||||
prefix + '/UnaryFunction0D/BPy_UnaryFunction0DId.cpp',
|
||||
prefix + '/UnaryFunction0D/UnaryFunction0D_Id/BPy_ShapeIdF0D.cpp',
|
||||
prefix + '/UnaryFunction0D/BPy_UnaryFunction0DMaterial.cpp',
|
||||
prefix + '/UnaryFunction0D/UnaryFunction0D_Material/BPy_MaterialF0D.cpp',
|
||||
prefix + '/UnaryFunction0D/BPy_UnaryFunction0DUnsigned.cpp',
|
||||
prefix + '/UnaryFunction0D/UnaryFunction0D_unsigned_int/BPy_QuantitativeInvisibilityF0D.cpp',
|
||||
prefix + '/UnaryFunction0D/BPy_UnaryFunction0DVec2f.cpp',
|
||||
prefix + '/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_Normal2DF0D.cpp',
|
||||
prefix + '/UnaryFunction0D/UnaryFunction0D_Vec2f/BPy_VertexOrientation2DF0D.cpp',
|
||||
prefix + '/UnaryFunction0D/BPy_UnaryFunction0DVec3f.cpp',
|
||||
prefix + '/UnaryFunction0D/UnaryFunction0D_Vec3f/BPy_VertexOrientation3DF0D.cpp',
|
||||
prefix + '/UnaryFunction0D/BPy_UnaryFunction0DVectorViewShape.cpp',
|
||||
prefix + '/UnaryFunction0D/UnaryFunction0D_vector_ViewShape/BPy_GetOccludersF0D.cpp',
|
||||
prefix + '/UnaryFunction0D/BPy_UnaryFunction0DViewShape.cpp',
|
||||
prefix + '/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetOccludeeF0D.cpp',
|
||||
prefix + '/UnaryFunction0D/UnaryFunction0D_ViewShape/BPy_GetShapeF0D.cpp',
|
||||
prefix + '/BPy_UnaryFunction1D.cpp',
|
||||
prefix + '/UnaryFunction1D/BPy_UnaryFunction1DDouble.cpp',
|
||||
prefix + '/UnaryFunction1D/UnaryFunction1D_double/BPy_Curvature2DAngleF1D.cpp',
|
||||
prefix + '/UnaryFunction1D/UnaryFunction1D_double/BPy_DensityF1D.cpp',
|
||||
prefix + '/UnaryFunction1D/UnaryFunction1D_double/BPy_GetCompleteViewMapDensityF1D.cpp',
|
||||
prefix + '/UnaryFunction1D/UnaryFunction1D_double/BPy_GetDirectionalViewMapDensityF1D.cpp',
|
||||
prefix + '/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedXF1D.cpp',
|
||||
prefix + '/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedYF1D.cpp',
|
||||
prefix + '/UnaryFunction1D/UnaryFunction1D_double/BPy_GetProjectedZF1D.cpp',
|
||||
prefix + '/UnaryFunction1D/UnaryFunction1D_double/BPy_GetSteerableViewMapDensityF1D.cpp',
|
||||
prefix + '/UnaryFunction1D/UnaryFunction1D_double/BPy_GetViewMapGradientNormF1D.cpp',
|
||||
prefix + '/UnaryFunction1D/UnaryFunction1D_double/BPy_GetXF1D.cpp',
|
||||
prefix + '/UnaryFunction1D/UnaryFunction1D_double/BPy_GetYF1D.cpp',
|
||||
prefix + '/UnaryFunction1D/UnaryFunction1D_double/BPy_GetZF1D.cpp',
|
||||
prefix + '/UnaryFunction1D/UnaryFunction1D_double/BPy_LocalAverageDepthF1D.cpp',
|
||||
prefix + '/UnaryFunction1D/UnaryFunction1D_double/BPy_ZDiscontinuityF1D.cpp',
|
||||
prefix + '/UnaryFunction1D/BPy_UnaryFunction1DEdgeNature.cpp',
|
||||
prefix + '/UnaryFunction1D/UnaryFunction1D_Nature_EdgeNature/BPy_CurveNatureF1D.cpp',
|
||||
prefix + '/UnaryFunction1D/BPy_UnaryFunction1DFloat.cpp',
|
||||
prefix + '/UnaryFunction1D/BPy_UnaryFunction1DUnsigned.cpp',
|
||||
prefix + '/UnaryFunction1D/UnaryFunction1D_unsigned_int/BPy_QuantitativeInvisibilityF1D.cpp',
|
||||
prefix + '/UnaryFunction1D/BPy_UnaryFunction1DVec2f.cpp',
|
||||
prefix + '/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Normal2DF1D.cpp',
|
||||
prefix + '/UnaryFunction1D/UnaryFunction1D_Vec2f/BPy_Orientation2DF1D.cpp',
|
||||
prefix + '/UnaryFunction1D/BPy_UnaryFunction1DVec3f.cpp',
|
||||
prefix + '/UnaryFunction1D/UnaryFunction1D_Vec3f/BPy_Orientation3DF1D.cpp',
|
||||
prefix + '/UnaryFunction1D/BPy_UnaryFunction1DVectorViewShape.cpp',
|
||||
prefix + '/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludeeF1D.cpp',
|
||||
prefix + '/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetOccludersF1D.cpp',
|
||||
prefix + '/UnaryFunction1D/UnaryFunction1D_vector_ViewShape/BPy_GetShapeF1D.cpp',
|
||||
prefix + '/UnaryFunction1D/BPy_UnaryFunction1DVoid.cpp',
|
||||
prefix + '/UnaryFunction1D/UnaryFunction1D_void/BPy_ChainingTimeStampF1D.cpp',
|
||||
prefix + '/UnaryFunction1D/UnaryFunction1D_void/BPy_IncrementChainingTimeStampF1D.cpp',
|
||||
prefix + '/UnaryFunction1D/UnaryFunction1D_void/BPy_TimeStampF1D.cpp',
|
||||
prefix + '/BPy_UnaryPredicate0D.cpp',
|
||||
prefix + '/BPy_UnaryPredicate1D.cpp',
|
||||
prefix + '/BPy_ViewMap.cpp',
|
||||
prefix + '/BPy_ViewShape.cpp'
|
||||
]
|
||||
python_sources = env.Glob(prefix + '/*.cpp') \
|
||||
+ env.Glob(prefix + '/*/*.cpp') \
|
||||
+ env.Glob(prefix + '/*/*/*.cpp') \
|
||||
+ env.Glob(prefix + '/*/*/*/*.cpp')
|
||||
|
||||
sources = system_sources + image_sources + geometry_sources + scene_graph_sources \
|
||||
+ winged_edge_sources + view_map_sources + stroke_sources + rendering_sources \
|
||||
|
||||
@@ -15,7 +15,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject BBox_Type;
|
||||
|
||||
#define BPy_BBox_Check(v) (( (PyObject *) v)->ob_type == &BBox_Type)
|
||||
#define BPy_BBox_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &BBox_Type) )
|
||||
|
||||
/*---------------------------Python BPy_BBox structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject BinaryPredicate0D_Type;
|
||||
|
||||
#define BPy_BinaryPredicate0D_Check(v) (( (PyObject *) v)->ob_type == &BinaryPredicate0D_Type)
|
||||
#define BPy_BinaryPredicate0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &BinaryPredicate0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_BinaryPredicate0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject BinaryPredicate1D_Type;
|
||||
|
||||
#define BPy_BinaryPredicate1D_Check(v) (( (PyObject *) v)->ob_type == &BinaryPredicate1D_Type)
|
||||
#define BPy_BinaryPredicate1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &BinaryPredicate1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_BinaryPredicate1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -5,20 +5,29 @@
|
||||
#include "BPy_Id.h"
|
||||
#include "BPy_IntegrationType.h"
|
||||
#include "BPy_Interface0D.h"
|
||||
#include "Interface0D/BPy_CurvePoint.cpp"
|
||||
#include "Interface0D/CurvePoint/BPy_StrokeVertex.h"
|
||||
#include "Interface0D/BPy_SVertex.h"
|
||||
#include "Interface0D/BPy_ViewVertex.h"
|
||||
#include "Interface1D/BPy_FEdge.h"
|
||||
#include "Interface1D/BPy_ViewEdge.h"
|
||||
#include "Iterator/BPy_Interface0DIterator.h"
|
||||
#include "Iterator/BPy_orientedViewEdgeIterator.h"
|
||||
#include "Iterator/BPy_StrokeVertexIterator.h"
|
||||
#include "BPy_Nature.h"
|
||||
#include "BPy_MediumType.h"
|
||||
#include "BPy_SShape.h"
|
||||
#include "BPy_StrokeAttribute.h"
|
||||
#include "BPy_ViewShape.h"
|
||||
|
||||
#include "Iterator/BPy_AdjacencyIterator.h"
|
||||
#include "Iterator/BPy_ChainPredicateIterator.h"
|
||||
#include "Iterator/BPy_ChainSilhouetteIterator.h"
|
||||
#include "Iterator/BPy_ChainingIterator.h"
|
||||
#include "Iterator/BPy_CurvePointIterator.h"
|
||||
#include "Iterator/BPy_Interface0DIterator.h"
|
||||
#include "Iterator/BPy_SVertexIterator.h"
|
||||
#include "Iterator/BPy_StrokeVertexIterator.h"
|
||||
#include "Iterator/BPy_ViewEdgeIterator.h"
|
||||
#include "Iterator/BPy_orientedViewEdgeIterator.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -161,27 +170,6 @@ PyObject * BPy_ViewShape_from_ViewShape( ViewShape& vs ) {
|
||||
return py_vs;
|
||||
}
|
||||
|
||||
PyObject * BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator( ViewVertexInternal::orientedViewEdgeIterator& 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 );
|
||||
|
||||
return py_ove_it;
|
||||
}
|
||||
|
||||
PyObject * BPy_Interface0DIterator_from_Interface0DIterator( Interface0DIterator& 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 );
|
||||
|
||||
return py_if0D_it;
|
||||
}
|
||||
|
||||
PyObject * BPy_StrokeVertexIterator_from_StrokeVertexIterator( StrokeInternal::StrokeVertexIterator& 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 );
|
||||
|
||||
return py_sv_it;
|
||||
}
|
||||
|
||||
PyObject * BPy_FrsMaterial_from_Material( Material& m ){
|
||||
PyObject *py_m = FrsMaterial_Type.tp_new( &FrsMaterial_Type, 0, 0 );
|
||||
((BPy_FrsMaterial*) py_m)->m = new Material( m );
|
||||
@@ -200,6 +188,27 @@ PyObject * BPy_IntegrationType_from_IntegrationType( int i ) {
|
||||
return py_it;
|
||||
}
|
||||
|
||||
PyObject * BPy_CurvePoint_from_CurvePoint( CurvePoint& cp ) {
|
||||
PyObject *py_cp = CurvePoint_Type.tp_new( &CurvePoint_Type, 0, 0 );
|
||||
((BPy_CurvePoint*) py_cp)->cp = new CurvePoint( cp );
|
||||
|
||||
return py_cp;
|
||||
}
|
||||
|
||||
PyObject * BPy_directedViewEdge_from_directedViewEdge( ViewVertex::directedViewEdge& dve ) {
|
||||
PyObject *py_dve = PyList_New(2);
|
||||
|
||||
PyList_SetItem( py_dve, 0, BPy_ViewEdge_from_ViewEdge(*(dve.first)) );
|
||||
PyList_SetItem( py_dve, 1, PyBool_from_bool(dve.second) );
|
||||
|
||||
return py_dve;
|
||||
}
|
||||
|
||||
|
||||
//==============================
|
||||
// Constants
|
||||
//==============================
|
||||
|
||||
IntegrationType IntegrationType_from_BPy_IntegrationType( PyObject* obj ) {
|
||||
return static_cast<IntegrationType>( PyInt_AsLong(obj) );
|
||||
}
|
||||
@@ -208,6 +217,83 @@ Stroke::MediumType MediumType_from_BPy_MediumType( PyObject* obj ) {
|
||||
return static_cast<Stroke::MediumType>( PyInt_AsLong(obj) );
|
||||
}
|
||||
|
||||
//==============================
|
||||
// Iterators
|
||||
//==============================
|
||||
|
||||
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 );
|
||||
|
||||
return py_a_it;
|
||||
}
|
||||
|
||||
PyObject * BPy_Interface0DIterator_from_Interface0DIterator( Interface0DIterator& 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 );
|
||||
|
||||
return py_if0D_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 );
|
||||
|
||||
return py_cp_it;
|
||||
}
|
||||
|
||||
PyObject * BPy_StrokeVertexIterator_from_StrokeVertexIterator( StrokeInternal::StrokeVertexIterator& 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 );
|
||||
|
||||
return py_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 );
|
||||
|
||||
return py_sv_it;
|
||||
}
|
||||
|
||||
PyObject * BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator( ViewVertexInternal::orientedViewEdgeIterator& 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 );
|
||||
|
||||
return py_ove_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 );
|
||||
|
||||
return py_ve_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 );
|
||||
|
||||
return py_c_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 );
|
||||
|
||||
return py_cp_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 );
|
||||
|
||||
return py_cs_it;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -26,20 +26,24 @@ using namespace Geometry;
|
||||
// NonTVertex, TVertex, ViewEdge, ViewMap, ViewShape, ViewVertex
|
||||
#include "../view_map/ViewMap.h"
|
||||
|
||||
// CurvePoint, Curve
|
||||
#include "../stroke/Curve.h"
|
||||
|
||||
//====== ITERATORS
|
||||
|
||||
// AdjacencyIterator, ChainingIterator, ChainSilhouetteIterator, ChainPredicateIterator
|
||||
#include "../stroke/ChainingIterators.h"
|
||||
|
||||
// ViewVertexInternal::orientedViewEdgeIterator
|
||||
// ViewEdgeInternal::SVertexIterator
|
||||
// ViewEdgeInternal::ViewEdgeIterator
|
||||
#include "../view_map/ViewMapIterators.h"
|
||||
//##################### IMPORTANT #####################
|
||||
// Do not use the following namespaces within this file :
|
||||
// - ViewVertexInternal
|
||||
// - ViewEdgeInternal
|
||||
//##########################################################
|
||||
|
||||
// StrokeInternal::StrokeVertexIterator
|
||||
#include "../stroke/StrokeIterators.h"
|
||||
|
||||
|
||||
// CurveInternal::CurvePointIterator
|
||||
#include "../stroke/CurveIterators.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -62,6 +66,8 @@ IntegrationType IntegrationType_from_BPy_IntegrationType( PyObject* obj );
|
||||
Stroke::MediumType MediumType_from_BPy_MediumType( PyObject* obj );
|
||||
|
||||
PyObject * BPy_BBox_from_BBox( 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_Id_from_Id( Id& id );
|
||||
PyObject * BPy_Interface0D_from_Interface0D( Interface0D& if0D );
|
||||
@@ -77,9 +83,19 @@ PyObject * BPy_ViewVertex_from_ViewVertex_ptr( ViewVertex *vv );
|
||||
PyObject * BPy_ViewEdge_from_ViewEdge( ViewEdge& ve );
|
||||
PyObject * BPy_ViewShape_from_ViewShape( ViewShape& vs );
|
||||
|
||||
PyObject * BPy_AdjacencyIterator_from_AdjacencyIterator( AdjacencyIterator& a_it );
|
||||
PyObject * BPy_Interface0DIterator_from_Interface0DIterator( Interface0DIterator& if0D_it );
|
||||
PyObject * BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator( ViewVertexInternal::orientedViewEdgeIterator& ove_it );
|
||||
PyObject * BPy_CurvePointIterator_from_CurvePointIterator( CurveInternal::CurvePointIterator& cp_it );
|
||||
PyObject * BPy_StrokeVertexIterator_from_StrokeVertexIterator( StrokeInternal::StrokeVertexIterator& sv_it);
|
||||
PyObject * BPy_SVertexIterator_from_SVertexIterator( ViewEdgeInternal::SVertexIterator& sv_it );
|
||||
PyObject * BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator( ViewVertexInternal::orientedViewEdgeIterator& ove_it );
|
||||
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 );
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "BPy_Iterator.h"
|
||||
#include "BPy_MediumType.h"
|
||||
#include "BPy_Nature.h"
|
||||
#include "BPy_Operators.h"
|
||||
#include "BPy_Noise.h"
|
||||
#include "BPy_SShape.h"
|
||||
#include "BPy_StrokeAttribute.h"
|
||||
@@ -152,6 +153,7 @@ PyObject *Freestyle_Init( void )
|
||||
Interface0D_Init( module );
|
||||
Interface1D_Init( module );
|
||||
Iterator_Init( module );
|
||||
Operators_Init( module );
|
||||
Noise_Init( module );
|
||||
SShape_Init( module );
|
||||
StrokeAttribute_Init( module );
|
||||
|
||||
@@ -11,7 +11,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject Freestyle_Type;
|
||||
|
||||
#define BPy_Freestyle_Check(v) (( (PyObject *) v)->ob_type == &Freestyle_Type)
|
||||
#define BPy_Freestyle_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &Freestyle_Type) )
|
||||
|
||||
/*---------------------------Python BPy_Freestyle structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject FrsMaterial_Type;
|
||||
|
||||
#define BPy_FrsMaterial_Check(v) (( (PyObject *) v)->ob_type == &FrsMaterial_Type)
|
||||
#define BPy_FrsMaterial_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &FrsMaterial_Type) )
|
||||
|
||||
/*---------------------------Python BPy_FrsMaterial structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -16,7 +16,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject Id_Type;
|
||||
|
||||
#define BPy_Id_Check(v) (( (PyObject *) v)->ob_type == &Id_Type)
|
||||
#define BPy_Id_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &Id_Type) )
|
||||
|
||||
/*---------------------------Python BPy_Id structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject IntegrationType_Type;
|
||||
|
||||
#define BPy_IntegrationType_Check(v) (( (PyObject *) v)->ob_type == &IntegrationType_Type)
|
||||
#define BPy_IntegrationType_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &IntegrationType_Type) )
|
||||
|
||||
/*---------------------------Python BPy_IntegrationType structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject Interface0D_Type;
|
||||
|
||||
#define BPy_Interface0D_Check(v) (( (PyObject *) v)->ob_type == &Interface0D_Type)
|
||||
#define BPy_Interface0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &Interface0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_Interface0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject Interface1D_Type;
|
||||
|
||||
#define BPy_Interface1D_Check(v) (( (PyObject *) v)->ob_type == &Interface1D_Type)
|
||||
#define BPy_Interface1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &Interface1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_Interface1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -227,6 +227,12 @@ PyObject * Iterator_isEnd(BPy_Iterator* self) {
|
||||
return PyBool_from_bool( self->it->isEnd() );
|
||||
}
|
||||
|
||||
//%rename(getObject) Interface0DIterator::operator*
|
||||
PyObject * Iterator_getObject(BPy_Iterator* self) {
|
||||
return PyBool_from_bool( self->it->isEnd() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject Iterator_Type;
|
||||
|
||||
#define BPy_Iterator_Check(v) (( (PyObject *) v)->ob_type == &Iterator_Type)
|
||||
#define BPy_Iterator_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &Iterator_Type) )
|
||||
|
||||
/*---------------------------Python BPy_Iterator structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject MediumType_Type;
|
||||
|
||||
#define BPy_MediumType_Check(v) (( (PyObject *) v)->ob_type == &MediumType_Type)
|
||||
#define BPy_MediumType_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &MediumType_Type) )
|
||||
|
||||
/*---------------------------Python BPy_MediumType structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject Nature_Type;
|
||||
|
||||
#define BPy_Nature_Check(v) (( (PyObject *) v)->ob_type == &Nature_Type)
|
||||
#define BPy_Nature_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &Nature_Type) )
|
||||
|
||||
/*---------------------------Python BPy_Nature structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject Noise_Type;
|
||||
|
||||
#define BPy_Noise_Check(v) (( (PyObject *) v)->ob_type == &Noise_Type)
|
||||
#define BPy_Noise_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &Noise_Type) )
|
||||
|
||||
/*---------------------------Python BPy_Noise structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -1,57 +1,304 @@
|
||||
PyObject *Operators_select(PyObject *self , PyObject *args) {
|
||||
#include "BPy_Operators.h"
|
||||
|
||||
#include "BPy_BinaryPredicate1D.h"
|
||||
#include "BPy_UnaryPredicate0D.h"
|
||||
#include "BPy_UnaryPredicate1D.h"
|
||||
#include "UnaryFunction0D/BPy_UnaryFunction0DDouble.h"
|
||||
#include "UnaryFunction1D/BPy_UnaryFunction1DVoid.h"
|
||||
#include "Iterator/BPy_ViewEdgeIterator.h"
|
||||
#include "Iterator/BPy_ChainingIterator.h"
|
||||
#include "BPy_StrokeShader.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/*--------------- Python API function prototypes for Operators instance -----------*/
|
||||
static void Operators___dealloc__(BPy_Operators *self);
|
||||
|
||||
static PyObject * Operators_select(BPy_Operators* self, PyObject *args);
|
||||
|
||||
/*----------------------Operators instance definitions ----------------------------*/
|
||||
static PyMethodDef BPy_Operators_methods[] = {
|
||||
{"select", ( PyCFunction ) Operators_select, METH_VARARGS | METH_STATIC, "(UnaryPredicate1D up1D )Selects the ViewEdges of the ViewMap verifying a specified condition. "},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
/*-----------------------BPy_Operators type definition ------------------------------*/
|
||||
|
||||
PyTypeObject Operators_Type = {
|
||||
PyObject_HEAD_INIT( NULL )
|
||||
0, /* ob_size */
|
||||
"Operators", /* tp_name */
|
||||
sizeof( BPy_Operators ), /* tp_basicsize */
|
||||
0, /* tp_itemsize */
|
||||
|
||||
/* methods */
|
||||
(destructor)Operators___dealloc__, /* tp_dealloc */
|
||||
NULL, /* printfunc tp_print; */
|
||||
NULL, /* getattrfunc tp_getattr; */
|
||||
NULL, /* setattrfunc tp_setattr; */
|
||||
NULL, /* tp_compare */
|
||||
NULL, /* tp_repr */
|
||||
|
||||
/* Method suites for standard classes */
|
||||
|
||||
NULL, /* PyNumberMethods *tp_as_number; */
|
||||
NULL, /* PySequenceMethods *tp_as_sequence; */
|
||||
NULL, /* PyMappingMethods *tp_as_mapping; */
|
||||
|
||||
/* More standard operations (here for binary compatibility) */
|
||||
|
||||
NULL, /* hashfunc tp_hash; */
|
||||
NULL, /* ternaryfunc tp_call; */
|
||||
NULL, /* reprfunc tp_str; */
|
||||
NULL, /* getattrofunc tp_getattro; */
|
||||
NULL, /* setattrofunc tp_setattro; */
|
||||
|
||||
/* Functions to access object as input/output buffer */
|
||||
NULL, /* PyBufferProcs *tp_as_buffer; */
|
||||
|
||||
/*** Flags to define presence of optional/expanded features ***/
|
||||
Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* long tp_flags; */
|
||||
|
||||
NULL, /* char *tp_doc; Documentation string */
|
||||
/*** Assigned meaning in release 2.0 ***/
|
||||
/* call function for all accessible objects */
|
||||
NULL, /* traverseproc tp_traverse; */
|
||||
|
||||
/* delete references to contained objects */
|
||||
NULL, /* inquiry tp_clear; */
|
||||
|
||||
/*** Assigned meaning in release 2.1 ***/
|
||||
/*** rich comparisons ***/
|
||||
NULL, /* richcmpfunc tp_richcompare; */
|
||||
|
||||
/*** weak reference enabler ***/
|
||||
0, /* long tp_weaklistoffset; */
|
||||
|
||||
/*** Added in release 2.2 ***/
|
||||
/* Operatorss */
|
||||
NULL, /* getiterfunc tp_iter; */
|
||||
NULL, /* iternextfunc tp_iternext; */
|
||||
|
||||
/*** Attribute descriptor and subclassing stuff ***/
|
||||
BPy_Operators_methods, /* struct PyMethodDef *tp_methods; */
|
||||
NULL, /* struct PyMemberDef *tp_members; */
|
||||
NULL, /* struct PyGetSetDef *tp_getset; */
|
||||
NULL, /* struct _typeobject *tp_base; */
|
||||
NULL, /* PyObject *tp_dict; */
|
||||
NULL, /* descrgetfunc tp_descr_get; */
|
||||
NULL, /* descrsetfunc tp_descr_set; */
|
||||
0, /* long tp_dictoffset; */
|
||||
NULL, /* initproc tp_init; */
|
||||
NULL, /* allocfunc tp_alloc; */
|
||||
PyType_GenericNew, /* newfunc tp_new; */
|
||||
|
||||
/* Low-level free-memory routine */
|
||||
NULL, /* freefunc tp_free; */
|
||||
|
||||
/* For PyObject_IS_GC */
|
||||
NULL, /* inquiry tp_is_gc; */
|
||||
NULL, /* PyObject *tp_bases; */
|
||||
|
||||
/* method resolution order */
|
||||
NULL, /* PyObject *tp_mro; */
|
||||
NULL, /* PyObject *tp_cache; */
|
||||
NULL, /* PyObject *tp_subclasses; */
|
||||
NULL, /* PyObject *tp_weaklist; */
|
||||
NULL
|
||||
};
|
||||
|
||||
//-------------------MODULE INITIALIZATION--------------------------------
|
||||
PyMODINIT_FUNC Operators_Init( PyObject *module )
|
||||
{
|
||||
if( module == NULL )
|
||||
return;
|
||||
|
||||
if( PyType_Ready( &Operators_Type ) < 0 )
|
||||
return;
|
||||
Py_INCREF( &Operators_Type );
|
||||
PyModule_AddObject(module, "Operators", (PyObject *)&Operators_Type);
|
||||
|
||||
}
|
||||
|
||||
//------------------------INSTANCE METHODS ----------------------------------
|
||||
|
||||
PyObject *Operators_chain(PyObject *self, PyObject *args) {
|
||||
void Operators___dealloc__(BPy_Operators* self)
|
||||
{
|
||||
self->ob_type->tp_free((PyObject*)self);
|
||||
}
|
||||
|
||||
PyObject * Operators_select(BPy_Operators* self, PyObject *args)
|
||||
{
|
||||
PyObject *obj = 0;
|
||||
|
||||
PyObject *Operators_bidirectionalChain(PyObject *self, PyObject *args) {
|
||||
if(!( PyArg_ParseTuple(args, "O", &obj) &&
|
||||
BPy_UnaryPredicate1D_Check(obj) && ((BPy_UnaryPredicate1D *) obj)->up1D )) {
|
||||
cout << "ERROR: Operators_select" << endl;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
Operators::select(*( ((BPy_UnaryPredicate1D *) obj)->up1D ));
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
PyObject * Operators_chain(BPy_Operators* self, PyObject *args)
|
||||
{
|
||||
PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0;
|
||||
|
||||
PyObject *Operators_sequentialSplit(PyObject *self, PyObject *args) {
|
||||
if(!( PyArg_ParseTuple(args, "OO|O", &obj1, &obj2, &obj3) &&
|
||||
BPy_ViewEdgeIterator_Check(obj1) && ((BPy_ViewEdgeIterator *) obj1)->ve_it &&
|
||||
BPy_UnaryPredicate1D_Check(obj2) && ((BPy_UnaryPredicate1D *) obj2)->up1D )) {
|
||||
cout << "ERROR: Operators_chain" << endl;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
if( !obj3 ) {
|
||||
|
||||
Operators::chain( *( ((BPy_ViewEdgeIterator *) obj1)->ve_it ),
|
||||
*( ((BPy_UnaryPredicate1D *) obj2)->up1D ) );
|
||||
|
||||
} else if( BPy_UnaryFunction1DVoid_Check(obj3) && ((BPy_UnaryFunction1DVoid *) obj3)->uf1D_void ) {
|
||||
|
||||
Operators::chain( *( ((BPy_ViewEdgeIterator *) obj1)->ve_it ),
|
||||
*( ((BPy_UnaryPredicate1D *) obj2)->up1D ),
|
||||
*( ((BPy_UnaryFunction1DVoid *) obj3)->uf1D_void ) );
|
||||
|
||||
}
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
PyObject * Operators_bidirectionalChain(BPy_Operators* self, PyObject *args)
|
||||
{
|
||||
PyObject *obj1 = 0, *obj2 = 0;
|
||||
|
||||
PyObject *Operators_recursiveSplit(PyObject *self, PyObject *args) {
|
||||
if(!( PyArg_ParseTuple(args, "O|O", &obj1, &obj2) &&
|
||||
BPy_ChainingIterator_Check(obj1) && ((BPy_ChainingIterator *) obj1)->c_it )) {
|
||||
cout << "ERROR: Operators_bidirectionalChain" << endl;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
if( !obj2 ) {
|
||||
|
||||
Operators::bidirectionalChain( *( ((BPy_ChainingIterator *) obj1)->c_it ) );
|
||||
|
||||
} else if( BPy_UnaryPredicate1D_Check(obj2) && ((BPy_UnaryPredicate1D *) obj2)->up1D ) {
|
||||
|
||||
Operators::bidirectionalChain( *( ((BPy_ChainingIterator *) obj1)->c_it ),
|
||||
*( ((BPy_UnaryPredicate1D *) obj2)->up1D ) );
|
||||
|
||||
}
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
PyObject * Operators_sequentialSplit(BPy_Operators* self, PyObject *args)
|
||||
{
|
||||
PyObject *obj1 = 0, *obj2 = 0;
|
||||
float f3 = 0.0;
|
||||
|
||||
PyObject *Operators_sort(PyObject *self , PyObject *args) {
|
||||
if(!( PyArg_ParseTuple(args, "O|Of", &obj1, &obj2, &f3) &&
|
||||
BPy_UnaryPredicate0D_Check(obj1) && ((BPy_UnaryPredicate0D *) obj1)->up0D )) {
|
||||
cout << "ERROR: Operators_sequentialSplit" << endl;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
if( obj2 && BPy_UnaryPredicate0D_Check(obj2) ) {
|
||||
|
||||
Operators::sequentialSplit( *( ((BPy_UnaryPredicate0D *) obj1)->up0D ),
|
||||
*( ((BPy_UnaryPredicate0D *) obj2)->up0D ),
|
||||
f3 );
|
||||
|
||||
} else {
|
||||
|
||||
float f = ( obj2 && PyFloat_Check(obj2) ) ? PyFloat_AsDouble(obj2) : 0.0;
|
||||
|
||||
Operators::sequentialSplit( *( ((BPy_UnaryPredicate0D *) obj1)->up0D ), f );
|
||||
|
||||
}
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
PyObject * Operators_recursiveSplit(BPy_Operators* self, PyObject *args)
|
||||
{
|
||||
PyObject *obj1 = 0, *obj2 = 0, *obj3 = 0;
|
||||
float f4 = 0.0;
|
||||
|
||||
PyObject *Operators_create(PyObject *self , PyObject *args) {
|
||||
if(!( PyArg_ParseTuple(args, "OO|Of", &obj1, &obj2, &obj3, &f4) &&
|
||||
BPy_UnaryFunction0DDouble_Check(obj1) && ((BPy_UnaryFunction0DDouble *) obj1)->uf0D_double )) {
|
||||
cout << "ERROR: Operators_recursiveSplit" << endl;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
if( BPy_UnaryPredicate1D_Check(obj2) && ((BPy_UnaryPredicate1D *) obj2)->up1D ) {
|
||||
|
||||
float f = ( obj3 && PyFloat_Check(obj3) ) ? PyFloat_AsDouble(obj3) : 0.0;
|
||||
|
||||
Operators::recursiveSplit( *( ((BPy_UnaryFunction0DDouble *) obj1)->uf0D_double ),
|
||||
*( ((BPy_UnaryPredicate1D *) obj2)->up1D ),
|
||||
f );
|
||||
|
||||
} else if( BPy_UnaryPredicate0D_Check(obj2) && ((BPy_UnaryPredicate0D *) obj2)->up0D &&
|
||||
BPy_UnaryPredicate1D_Check(obj3) && ((BPy_UnaryPredicate1D *) obj3)->up1D ) {
|
||||
|
||||
Operators::recursiveSplit( *( ((BPy_UnaryFunction0DDouble *) obj1)->uf0D_double ),
|
||||
*( ((BPy_UnaryPredicate0D *) obj2)->up0D ),
|
||||
*( ((BPy_UnaryPredicate1D *) obj3)->up1D ),
|
||||
f4 );
|
||||
|
||||
}
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
PyObject * Operators_sort(BPy_Operators* self, PyObject *args)
|
||||
{
|
||||
PyObject *obj = 0;
|
||||
|
||||
PyObject *Operators_getViewEdgeFromIndex(PyObject *self , PyObject *args) {
|
||||
if(!( PyArg_ParseTuple(args, "O", &obj) &&
|
||||
BPy_BinaryPredicate1D_Check(obj) && ((BPy_BinaryPredicate1D *) obj)->bp1D )) {
|
||||
cout << "ERROR: Operators_sort" << endl;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
Operators::sort(*( ((BPy_BinaryPredicate1D *) obj)->bp1D ));
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
PyObject * Operators_create(BPy_Operators* self, PyObject *args)
|
||||
{
|
||||
PyObject *obj1 = 0, *obj2 = 0;
|
||||
|
||||
PyObject *Operators_getChainFromIndex(PyObject *self , PyObject *args) {
|
||||
if(!( PyArg_ParseTuple(args, "OO", &obj1, &obj2) &&
|
||||
BPy_UnaryPredicate1D_Check(obj1) && ((BPy_UnaryPredicate1D *) obj1)->up1D &&
|
||||
PyList_Check(obj2) && PyList_Size(obj2) > 0 )) {
|
||||
cout << "ERROR: Operators_create" << endl;
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
vector<StrokeShader *> shaders;
|
||||
for( int i = 0; i < PyList_Size(obj2); i++) {
|
||||
PyObject *py_ss = PyList_GetItem(obj2,i);
|
||||
if( BPy_StrokeShader_Check(py_ss) )
|
||||
shaders.push_back( ((BPy_StrokeShader *) py_ss)->ss );
|
||||
}
|
||||
|
||||
Operators::create( *( ((BPy_UnaryPredicate1D *) obj1)->up1D ), shaders);
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
PyObject *Operators_getStrokeFromIndex(PyObject *self , PyObject *args) {
|
||||
}
|
||||
|
||||
|
||||
PyObject *Operators_getViewEdgesSize(PyObject *self , PyObject *args) {
|
||||
}
|
||||
|
||||
|
||||
PyObject *Operators_getChainsSize(PyObject *self , PyObject *args) {
|
||||
}
|
||||
|
||||
|
||||
PyObject *Operators_getStrokesSize(PyObject *self , PyObject *args) {
|
||||
}
|
||||
|
||||
|
||||
PyObject *delete_Operators(PyObject *self , PyObject *args) {
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
34
source/blender/freestyle/intern/python/BPy_Operators.h
Normal file
34
source/blender/freestyle/intern/python/BPy_Operators.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef FREESTYLE_PYTHON_OPERATORS_H
|
||||
#define FREESTYLE_PYTHON_OPERATORS_H
|
||||
|
||||
#include "../stroke/Operators.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <Python.h>
|
||||
|
||||
extern PyTypeObject Operators_Type;
|
||||
|
||||
#define BPy_Operators_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &Operators_Type) )
|
||||
|
||||
/*---------------------------Python BPy_Operators structure definition----------*/
|
||||
typedef struct {
|
||||
PyObject_HEAD
|
||||
} BPy_Operators;
|
||||
|
||||
/*---------------------------Python BPy_Operators visible prototypes-----------*/
|
||||
|
||||
PyMODINIT_FUNC Operators_Init( PyObject *module );
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* FREESTYLE_PYTHON_OPERATORS_H */
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject SShape_Type;
|
||||
|
||||
#define BPy_SShape_Check(v) (( (PyObject *) v)->ob_type == &SShape_Type)
|
||||
#define BPy_SShape_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &SShape_Type) )
|
||||
|
||||
/*---------------------------Python BPy_SShape structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject StrokeAttribute_Type;
|
||||
|
||||
#define BPy_StrokeAttribute_Check(v) (( (PyObject *) v)->ob_type == &StrokeAttribute_Type)
|
||||
#define BPy_StrokeAttribute_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &StrokeAttribute_Type) )
|
||||
|
||||
/*---------------------------Python BPy_StrokeAttribute structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -18,7 +18,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject StrokeShader_Type;
|
||||
|
||||
#define BPy_StrokeShader_Check(v) (( (PyObject *) v)->ob_type == &StrokeShader_Type)
|
||||
#define BPy_StrokeShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &StrokeShader_Type) )
|
||||
|
||||
/*---------------------------Python BPy_StrokeShader structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject UnaryFunction0D_Type;
|
||||
|
||||
#define BPy_UnaryFunction0D_Check(v) (( (PyObject *) v)->ob_type == &UnaryFunction0D_Type)
|
||||
#define BPy_UnaryFunction0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_UnaryFunction0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject UnaryFunction1D_Type;
|
||||
|
||||
#define BPy_UnaryFunction1D_Check(v) (( (PyObject *) v)->ob_type == &UnaryFunction1D_Type)
|
||||
#define BPy_UnaryFunction1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_UnaryFunction1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject UnaryPredicate0D_Type;
|
||||
|
||||
#define BPy_UnaryPredicate0D_Check(v) (( (PyObject *) v)->ob_type == &UnaryPredicate0D_Type)
|
||||
#define BPy_UnaryPredicate0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryPredicate0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_UnaryPredicate0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject UnaryPredicate1D_Type;
|
||||
|
||||
#define BPy_UnaryPredicate1D_Check(v) (( (PyObject *) v)->ob_type == &UnaryPredicate1D_Type)
|
||||
#define BPy_UnaryPredicate1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryPredicate1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_UnaryPredicate1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject ViewMap_Type;
|
||||
|
||||
#define BPy_ViewMap_Check(v) (( (PyObject *) v)->ob_type == &ViewMap_Type)
|
||||
#define BPy_ViewMap_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ViewMap_Type) )
|
||||
|
||||
/*---------------------------Python BPy_ViewMap structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject ViewShape_Type;
|
||||
|
||||
#define BPy_ViewShape_Check(v) (( (PyObject *) v)->ob_type == &ViewShape_Type)
|
||||
#define BPy_ViewShape_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ViewShape_Type) )
|
||||
|
||||
/*---------------------------Python BPy_ViewShape structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject FalseBP1D_Type;
|
||||
|
||||
#define BPy_FalseBP1D_Check(v) (( (PyObject *) v)->ob_type == &FalseBP1D_Type)
|
||||
#define BPy_FalseBP1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &FalseBP1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_FalseBP1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject Length2DBP1D_Type;
|
||||
|
||||
#define BPy_Length2DBP1D_Check(v) (( (PyObject *) v)->ob_type == &Length2DBP1D_Type)
|
||||
#define BPy_Length2DBP1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &Length2DBP1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_Length2DBP1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject SameShapeIdBP1D_Type;
|
||||
|
||||
#define BPy_SameShapeIdBP1D_Check(v) (( (PyObject *) v)->ob_type == &SameShapeIdBP1D_Type)
|
||||
#define BPy_SameShapeIdBP1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &SameShapeIdBP1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_SameShapeIdBP1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject TrueBP1D_Type;
|
||||
|
||||
#define BPy_TrueBP1D_Check(v) (( (PyObject *) v)->ob_type == &TrueBP1D_Type)
|
||||
#define BPy_TrueBP1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &TrueBP1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_TrueBP1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject ViewMapGradientNormBP1D_Type;
|
||||
|
||||
#define BPy_ViewMapGradientNormBP1D_Check(v) (( (PyObject *) v)->ob_type == &ViewMapGradientNormBP1D_Type)
|
||||
#define BPy_ViewMapGradientNormBP1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ViewMapGradientNormBP1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_ViewMapGradientNormBP1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -14,7 +14,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject CurvePoint_Type;
|
||||
|
||||
#define BPy_CurvePoint_Check(v) (( (PyObject *) v)->ob_type == &CurvePoint_Type)
|
||||
#define BPy_CurvePoint_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &CurvePoint_Type) )
|
||||
|
||||
/*---------------------------Python BPy_CurvePoint structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -15,7 +15,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject SVertex_Type;
|
||||
|
||||
#define BPy_SVertex_Check(v) (( (PyObject *) v)->ob_type == &SVertex_Type)
|
||||
#define BPy_SVertex_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &SVertex_Type) )
|
||||
|
||||
/*---------------------------Python BPy_SVertex structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -14,7 +14,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject ViewVertex_Type;
|
||||
|
||||
#define BPy_ViewVertex_Check(v) (( (PyObject *) v)->ob_type == &ViewVertex_Type)
|
||||
#define BPy_ViewVertex_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ViewVertex_Type) )
|
||||
|
||||
/*---------------------------Python BPy_ViewVertex structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -14,7 +14,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject StrokeVertex_Type;
|
||||
|
||||
#define BPy_StrokeVertex_Check(v) (( (PyObject *) v)->ob_type == &StrokeVertex_Type)
|
||||
#define BPy_StrokeVertex_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &StrokeVertex_Type) )
|
||||
|
||||
/*---------------------------Python BPy_StrokeVertex structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -14,7 +14,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject NonTVertex_Type;
|
||||
|
||||
#define BPy_NonTVertex_Check(v) (( (PyObject *) v)->ob_type == &NonTVertex_Type)
|
||||
#define BPy_NonTVertex_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &NonTVertex_Type) )
|
||||
|
||||
/*---------------------------Python BPy_NonTVertex structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -14,7 +14,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject TVertex_Type;
|
||||
|
||||
#define BPy_TVertex_Check(v) (( (PyObject *) v)->ob_type == &TVertex_Type)
|
||||
#define BPy_TVertex_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &TVertex_Type) )
|
||||
|
||||
/*---------------------------Python BPy_TVertex structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -14,7 +14,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject Curve_Type;
|
||||
|
||||
#define BPy_Curve_Check(v) (( (PyObject *) v)->ob_type == &Curve_Type)
|
||||
#define BPy_Curve_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &Curve_Type) )
|
||||
|
||||
/*---------------------------Python BPy_Curve structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -14,7 +14,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject FEdge_Type;
|
||||
|
||||
#define BPy_FEdge_Check(v) (( (PyObject *) v)->ob_type == &FEdge_Type)
|
||||
#define BPy_FEdge_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &FEdge_Type) )
|
||||
|
||||
/*---------------------------Python BPy_FEdge structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -15,7 +15,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject ViewEdge_Type;
|
||||
|
||||
#define BPy_ViewEdge_Check(v) (( (PyObject *) v)->ob_type == &ViewEdge_Type)
|
||||
#define BPy_ViewEdge_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ViewEdge_Type) )
|
||||
|
||||
/*---------------------------Python BPy_ViewEdge structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -14,7 +14,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject Chain_Type;
|
||||
|
||||
#define BPy_Chain_Check(v) (( (PyObject *) v)->ob_type == &Chain_Type)
|
||||
#define BPy_Chain_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &Chain_Type) )
|
||||
|
||||
/*---------------------------Python BPy_Chain structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -14,7 +14,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject FEdgeSharp_Type;
|
||||
|
||||
#define BPy_FEdgeSharp_Check(v) (( (PyObject *) v)->ob_type == &FEdgeSharp_Type)
|
||||
#define BPy_FEdgeSharp_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &FEdgeSharp_Type) )
|
||||
|
||||
/*---------------------------Python BPy_FEdgeSharp structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -14,7 +14,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject FEdgeSmooth_Type;
|
||||
|
||||
#define BPy_FEdgeSmooth_Check(v) (( (PyObject *) v)->ob_type == &FEdgeSmooth_Type)
|
||||
#define BPy_FEdgeSmooth_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &FEdgeSmooth_Type) )
|
||||
|
||||
/*---------------------------Python BPy_FEdgeSmooth structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -12,8 +12,11 @@ extern "C" {
|
||||
/*--------------- Python API function prototypes for AdjacencyIterator instance -----------*/
|
||||
static int AdjacencyIterator___init__(BPy_AdjacencyIterator *self, PyObject *args);
|
||||
|
||||
static PyObject * AdjacencyIterator_getObject(BPy_AdjacencyIterator *self);
|
||||
|
||||
/*----------------------AdjacencyIterator instance definitions ----------------------------*/
|
||||
static PyMethodDef BPy_AdjacencyIterator_methods[] = {
|
||||
{"getObject", ( PyCFunction ) AdjacencyIterator_getObject, METH_NOARGS, "() Get object referenced by the iterator"},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
@@ -135,6 +138,16 @@ int AdjacencyIterator___init__(BPy_AdjacencyIterator *self, PyObject *args )
|
||||
|
||||
}
|
||||
|
||||
PyObject * AdjacencyIterator_getObject(BPy_AdjacencyIterator *self) {
|
||||
|
||||
ViewEdge *ve = self->a_it->operator*();
|
||||
if( ve )
|
||||
return BPy_ViewEdge_from_ViewEdge( *ve );
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -15,7 +15,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject AdjacencyIterator_Type;
|
||||
|
||||
#define BPy_AdjacencyIterator_Check(v) (( (PyObject *) v)->ob_type == &AdjacencyIterator_Type)
|
||||
#define BPy_AdjacencyIterator_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &AdjacencyIterator_Type) )
|
||||
|
||||
/*---------------------------Python BPy_AdjacencyIterator structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -16,7 +16,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject ChainPredicateIterator_Type;
|
||||
|
||||
#define BPy_ChainPredicateIterator_Check(v) (( (PyObject *) v)->ob_type == &ChainPredicateIterator_Type)
|
||||
#define BPy_ChainPredicateIterator_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ChainPredicateIterator_Type) )
|
||||
|
||||
/*---------------------------Python BPy_ChainPredicateIterator structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -16,7 +16,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject ChainSilhouetteIterator_Type;
|
||||
|
||||
#define BPy_ChainSilhouetteIterator_Check(v) (( (PyObject *) v)->ob_type == &ChainSilhouetteIterator_Type)
|
||||
#define BPy_ChainSilhouetteIterator_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ChainSilhouetteIterator_Type) )
|
||||
|
||||
/*---------------------------Python BPy_ChainSilhouetteIterator structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -18,12 +18,15 @@ static PyObject * ChainingIterator_traverse( BPy_ChainingIterator *self, PyObjec
|
||||
static PyObject * ChainingIterator_getVertex( BPy_ChainingIterator *self );
|
||||
static PyObject * ChainingIterator_isIncrementing( BPy_ChainingIterator *self );
|
||||
|
||||
static PyObject * ChainingIterator_getObject( BPy_ChainingIterator *self);
|
||||
|
||||
/*----------------------ChainingIterator instance definitions ----------------------------*/
|
||||
static PyMethodDef BPy_ChainingIterator_methods[] = {
|
||||
{"init", ( PyCFunction ) ChainingIterator_init, METH_NOARGS, "() Inits the iterator context. This method is called each time a new chain is started. It can be used to reset some history information that you might want to keep."},
|
||||
{"traverse", ( PyCFunction ) ChainingIterator_traverse, METH_VARARGS, "(AdjacencyIterator ai) This method iterates over the potential next ViewEdges and returns the one that will be followed next. Returns the next ViewEdge to follow or 0 when the end of the chain is reached. "},
|
||||
{"getVertex", ( PyCFunction ) ChainingIterator_getVertex, METH_NOARGS, "() Returns the vertex which is the next crossing "},
|
||||
{"isIncrementing", ( PyCFunction ) ChainingIterator_isIncrementing, METH_NOARGS, "() Returns true if the current iteration is an incrementation."},
|
||||
{"getObject", ( PyCFunction ) ChainingIterator_getObject, METH_NOARGS, "() Get object referenced by the iterator"},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
@@ -171,7 +174,14 @@ PyObject *ChainingIterator_isIncrementing( BPy_ChainingIterator *self ) {
|
||||
return PyBool_from_bool( self->c_it->isIncrementing() );
|
||||
}
|
||||
|
||||
PyObject * ChainingIterator_getObject( BPy_ChainingIterator *self) {
|
||||
|
||||
ViewEdge *ve = self->c_it->operator*();
|
||||
if( ve )
|
||||
return BPy_ViewEdge_from_ViewEdge( *ve );
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject ChainingIterator_Type;
|
||||
|
||||
#define BPy_ChainingIterator_Check(v) (( (PyObject *) v)->ob_type == &ChainingIterator_Type)
|
||||
#define BPy_ChainingIterator_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ChainingIterator_Type) )
|
||||
|
||||
/*---------------------------Python BPy_ChainingIterator structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "BPy_CurvePointIterator.h"
|
||||
|
||||
#include "../BPy_Convert.h"
|
||||
#include "BPy_Interface0DIterator.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -14,12 +15,14 @@ static PyObject * CurvePointIterator_t( BPy_CurvePointIterator *self );
|
||||
static PyObject * CurvePointIterator_u( BPy_CurvePointIterator *self );
|
||||
static PyObject * CurvePointIterator_castToInterface0DIterator( BPy_CurvePointIterator *self );
|
||||
|
||||
static PyObject * CurvePointIterator_getObject(BPy_CurvePointIterator *self);
|
||||
|
||||
/*----------------------CurvePointIterator instance definitions ----------------------------*/
|
||||
static PyMethodDef BPy_CurvePointIterator_methods[] = {
|
||||
{"t", ( PyCFunction ) CurvePointIterator_t, METH_NOARGS, "( )Returns the curvilinear abscissa."},
|
||||
{"u", ( PyCFunction ) CurvePointIterator_u, METH_NOARGS, "( )Returns the point parameter in the curve 0<=u<=1."},
|
||||
{"castToInterface0DIterator", ( PyCFunction ) CurvePointIterator_castToInterface0DIterator, METH_NOARGS, "() Casts this CurvePointIterator into an Interface0DIterator. Useful for any call to a function of the type UnaryFunction0D."},
|
||||
{"getObject", ( PyCFunction ) CurvePointIterator_getObject, METH_NOARGS, "() Get object referenced by the iterator"},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
@@ -153,6 +156,10 @@ PyObject * CurvePointIterator_castToInterface0DIterator( BPy_CurvePointIterator
|
||||
return py_if0D_it;
|
||||
}
|
||||
|
||||
PyObject * CurvePointIterator_getObject(BPy_CurvePointIterator *self) {
|
||||
return BPy_CurvePoint_from_CurvePoint( self->cp_it->operator*() );
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject CurvePointIterator_Type;
|
||||
|
||||
#define BPy_CurvePointIterator_Check(v) (( (PyObject *) v)->ob_type == &CurvePointIterator_Type)
|
||||
#define BPy_CurvePointIterator_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &CurvePointIterator_Type) )
|
||||
|
||||
/*---------------------------Python BPy_CurvePointIterator structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "BPy_Interface0DIterator.h"
|
||||
|
||||
#include "../BPy_Convert.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -12,10 +14,13 @@ static int Interface0DIterator___init__(BPy_Interface0DIterator *self, PyObject
|
||||
static PyObject * Interface0DIterator_t( BPy_Interface0DIterator *self );
|
||||
static PyObject * Interface0DIterator_u( BPy_Interface0DIterator *self );
|
||||
|
||||
static PyObject * Interface0DIterator_getObject(BPy_Interface0DIterator *self);
|
||||
|
||||
/*----------------------Interface0DIterator instance definitions ----------------------------*/
|
||||
static PyMethodDef BPy_Interface0DIterator_methods[] = {
|
||||
{"t", ( PyCFunction ) Interface0DIterator_t, METH_NOARGS, "( )Returns the curvilinear abscissa."},
|
||||
{"u", ( PyCFunction ) Interface0DIterator_u, METH_NOARGS, "( )Returns the point parameter in the curve 0<=u<=1."},
|
||||
{"getObject", ( PyCFunction ) Interface0DIterator_getObject, METH_NOARGS, "() Get object referenced by the iterator"},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
@@ -130,6 +135,11 @@ PyObject * Interface0DIterator_u( BPy_Interface0DIterator *self ) {
|
||||
return PyFloat_FromDouble( self->if0D_it->u() );
|
||||
}
|
||||
|
||||
PyObject * Interface0DIterator_getObject(BPy_Interface0DIterator *self) {
|
||||
return BPy_Interface0D_from_Interface0D( self->if0D_it->operator*() );
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -15,7 +15,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject Interface0DIterator_Type;
|
||||
|
||||
#define BPy_Interface0DIterator_Check(v) (( (PyObject *) v)->ob_type == &Interface0DIterator_Type)
|
||||
#define BPy_Interface0DIterator_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &Interface0DIterator_Type) )
|
||||
|
||||
/*---------------------------Python BPy_Interface0DIterator structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "BPy_SVertexIterator.h"
|
||||
|
||||
#include "../BPy_Convert.h"
|
||||
#include "../Interface0D/BPy_SVertex.h"
|
||||
#include "../Interface1D/BPy_FEdge.h"
|
||||
|
||||
@@ -15,10 +16,13 @@ static int SVertexIterator___init__(BPy_SVertexIterator *self, PyObject *args);
|
||||
static PyObject * SVertexIterator_t( BPy_SVertexIterator *self );
|
||||
static PyObject * SVertexIterator_u( BPy_SVertexIterator *self );
|
||||
|
||||
static PyObject * SVertexIterator_getObject( BPy_SVertexIterator *self);
|
||||
|
||||
/*----------------------SVertexIterator instance definitions ----------------------------*/
|
||||
static PyMethodDef BPy_SVertexIterator_methods[] = {
|
||||
{"t", ( PyCFunction ) SVertexIterator_t, METH_NOARGS, "( )Returns the curvilinear abscissa."},
|
||||
{"u", ( PyCFunction ) SVertexIterator_u, METH_NOARGS, "( )Returns the point parameter in the curve 0<=u<=1."},
|
||||
{"getObject", ( PyCFunction ) SVertexIterator_getObject, METH_NOARGS, "() Get object referenced by the iterator"},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
@@ -155,6 +159,11 @@ PyObject * SVertexIterator_u( BPy_SVertexIterator *self ) {
|
||||
return PyFloat_FromDouble( self->sv_it->u() );
|
||||
}
|
||||
|
||||
PyObject * SVertexIterator_getObject( BPy_SVertexIterator *self) {
|
||||
return BPy_SVertex_from_SVertex( self->sv_it->operator*() );
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -16,7 +16,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject SVertexIterator_Type;
|
||||
|
||||
#define BPy_SVertexIterator_Check(v) (( (PyObject *) v)->ob_type == &SVertexIterator_Type)
|
||||
#define BPy_SVertexIterator_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &SVertexIterator_Type) )
|
||||
|
||||
/*---------------------------Python BPy_SVertexIterator structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "BPy_StrokeVertexIterator.h"
|
||||
|
||||
#include "../BPy_Convert.h"
|
||||
#include "BPy_Interface0DIterator.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -14,11 +15,15 @@ static PyObject * StrokeVertexIterator_t( BPy_StrokeVertexIterator *self );
|
||||
static PyObject * StrokeVertexIterator_u( BPy_StrokeVertexIterator *self );
|
||||
static PyObject * StrokeVertexIterator_castToInterface0DIterator( BPy_StrokeVertexIterator *self );
|
||||
|
||||
static PyObject * StrokeVertexIterator_getObject( BPy_StrokeVertexIterator *self);
|
||||
|
||||
|
||||
/*----------------------StrokeVertexIterator instance definitions ----------------------------*/
|
||||
static PyMethodDef BPy_StrokeVertexIterator_methods[] = {
|
||||
{"t", ( PyCFunction ) StrokeVertexIterator_t, METH_NOARGS, "( )Returns the curvilinear abscissa."},
|
||||
{"u", ( PyCFunction ) StrokeVertexIterator_u, METH_NOARGS, "( )Returns the point parameter in the curve 0<=u<=1."},
|
||||
{"castToInterface0DIterator", ( PyCFunction ) StrokeVertexIterator_castToInterface0DIterator, METH_NOARGS, "() Casts this StrokeVertexIterator into an Interface0DIterator. Useful for any call to a function of the type UnaryFunction0D."},
|
||||
{"getObject", ( PyCFunction ) StrokeVertexIterator_getObject, METH_NOARGS, "() Get object referenced by the iterator"},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
@@ -149,6 +154,10 @@ PyObject * StrokeVertexIterator_castToInterface0DIterator( BPy_StrokeVertexItera
|
||||
return py_if0D_it;
|
||||
}
|
||||
|
||||
PyObject * StrokeVertexIterator_getObject( BPy_StrokeVertexIterator *self) {
|
||||
return BPy_StrokeVertex_from_StrokeVertex( self->sv_it->operator*() );
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject StrokeVertexIterator_Type;
|
||||
|
||||
#define BPy_StrokeVertexIterator_Check(v) (( (PyObject *) v)->ob_type == &StrokeVertexIterator_Type)
|
||||
#define BPy_StrokeVertexIterator_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &StrokeVertexIterator_Type) )
|
||||
|
||||
/*---------------------------Python BPy_StrokeVertexIterator structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -21,6 +21,9 @@ static PyObject * ViewEdgeIterator_getOrientation( BPy_ViewEdgeIterator *self );
|
||||
static PyObject * ViewEdgeIterator_setOrientation( BPy_ViewEdgeIterator *self, PyObject *args );
|
||||
static PyObject * ViewEdgeIterator_changeOrientation( BPy_ViewEdgeIterator *self );
|
||||
|
||||
static PyObject * ViewEdgeIterator_getObject(BPy_ViewEdgeIterator *self);
|
||||
|
||||
|
||||
/*----------------------ViewEdgeIterator instance definitions ----------------------------*/
|
||||
static PyMethodDef BPy_ViewEdgeIterator_methods[] = {
|
||||
{"getCurrentEdge", ( PyCFunction ) ViewEdgeIterator_getCurrentEdge, METH_NOARGS, "() Returns the current pointed ViewEdge."},
|
||||
@@ -30,6 +33,7 @@ static PyMethodDef BPy_ViewEdgeIterator_methods[] = {
|
||||
{"getOrientation", ( PyCFunction ) ViewEdgeIterator_getOrientation, METH_NOARGS, "() Gets the orientation of the pointed ViewEdge in the iteration. "},
|
||||
{"setOrientation", ( PyCFunction ) ViewEdgeIterator_setOrientation, METH_VARARGS, "(bool b) Sets the orientation of the pointed ViewEdge in the iteration. "},
|
||||
{"changeOrientation", ( PyCFunction ) ViewEdgeIterator_changeOrientation, METH_NOARGS, "() Changes the current orientation."},
|
||||
{"getObject", ( PyCFunction ) ViewEdgeIterator_getObject, METH_NOARGS, "() Get object referenced by the iterator"},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
@@ -208,6 +212,14 @@ PyObject *ViewEdgeIterator_changeOrientation( BPy_ViewEdgeIterator *self ) {
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
PyObject * ViewEdgeIterator_getObject( BPy_ViewEdgeIterator *self) {
|
||||
|
||||
ViewEdge *ve = self->ve_it->operator*();
|
||||
if( ve )
|
||||
return BPy_ViewEdge_from_ViewEdge( *ve );
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -16,7 +16,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject ViewEdgeIterator_Type;
|
||||
|
||||
#define BPy_ViewEdgeIterator_Check(v) (( (PyObject *) v)->ob_type == &ViewEdgeIterator_Type)
|
||||
#define BPy_ViewEdgeIterator_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ViewEdgeIterator_Type) )
|
||||
|
||||
/*---------------------------Python BPy_ViewEdgeIterator structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#include "BPy_orientedViewEdgeIterator.h"
|
||||
|
||||
#include "../BPy_Convert.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -9,8 +11,12 @@ extern "C" {
|
||||
/*--------------- Python API function prototypes for orientedViewEdgeIterator instance -----------*/
|
||||
static int orientedViewEdgeIterator___init__(BPy_orientedViewEdgeIterator *self, PyObject *args);
|
||||
|
||||
static PyObject * orientedViewEdgeIterator_getObject(BPy_orientedViewEdgeIterator *self);
|
||||
|
||||
|
||||
/*----------------------orientedViewEdgeIterator instance definitions ----------------------------*/
|
||||
static PyMethodDef BPy_orientedViewEdgeIterator_methods[] = {
|
||||
{"getObject", ( PyCFunction ) orientedViewEdgeIterator_getObject, METH_NOARGS, "() Get object referenced by the iterator"},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
@@ -99,9 +105,6 @@ PyTypeObject orientedViewEdgeIterator_Type = {
|
||||
NULL
|
||||
};
|
||||
|
||||
//-------------------MODULE INITIALIZATION--------------------------------
|
||||
|
||||
|
||||
//------------------------INSTANCE METHODS ----------------------------------
|
||||
|
||||
int orientedViewEdgeIterator___init__(BPy_orientedViewEdgeIterator *self, PyObject *args )
|
||||
@@ -121,6 +124,10 @@ int orientedViewEdgeIterator___init__(BPy_orientedViewEdgeIterator *self, PyObje
|
||||
return 0;
|
||||
}
|
||||
|
||||
PyObject * orientedViewEdgeIterator_getObject( BPy_orientedViewEdgeIterator *self) {
|
||||
return BPy_directedViewEdge_from_directedViewEdge( self->ove_it->operator*() );
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -16,7 +16,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject orientedViewEdgeIterator_Type;
|
||||
|
||||
#define BPy_orientedViewEdgeIterator_Check(v) (( (PyObject *) v)->ob_type == &orientedViewEdgeIterator_Type)
|
||||
#define BPy_orientedViewEdgeIterator_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &orientedViewEdgeIterator_Type) )
|
||||
|
||||
/*---------------------------Python BPy_orientedViewEdgeIterator structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject BackboneStretcherShader_Type;
|
||||
|
||||
#define BPy_BackboneStretcherShader_Check(v) (( (PyObject *) v)->ob_type == &BackboneStretcherShader_Type)
|
||||
#define BPy_BackboneStretcherShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &BackboneStretcherShader_Type) )
|
||||
|
||||
/*---------------------------Python BPy_BackboneStretcherShader structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject BezierCurveShader_Type;
|
||||
|
||||
#define BPy_BezierCurveShader_Check(v) (( (PyObject *) v)->ob_type == &BezierCurveShader_Type)
|
||||
#define BPy_BezierCurveShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &BezierCurveShader_Type) )
|
||||
|
||||
/*---------------------------Python BPy_BezierCurveShader structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject CalligraphicShader_Type;
|
||||
|
||||
#define BPy_CalligraphicShader_Check(v) (( (PyObject *) v)->ob_type == &CalligraphicShader_Type)
|
||||
#define BPy_CalligraphicShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &CalligraphicShader_Type)
|
||||
|
||||
/*---------------------------Python BPy_CalligraphicShader structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject ColorNoiseShader_Type;
|
||||
|
||||
#define BPy_ColorNoiseShader_Check(v) (( (PyObject *) v)->ob_type == &ColorNoiseShader_Type)
|
||||
#define BPy_ColorNoiseShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ColorNoiseShader_Type) )
|
||||
|
||||
/*---------------------------Python BPy_ColorNoiseShader structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject ColorVariationPatternShader_Type;
|
||||
|
||||
#define BPy_ColorVariationPatternShader_Check(v) (( (PyObject *) v)->ob_type == &ColorVariationPatternShader_Type)
|
||||
#define BPy_ColorVariationPatternShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ColorVariationPatternShader_Type) )
|
||||
|
||||
/*---------------------------Python BPy_ColorVariationPatternShader structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject ConstantColorShader_Type;
|
||||
|
||||
#define BPy_ConstantColorShader_Check(v) (( (PyObject *) v)->ob_type == &ConstantColorShader_Type)
|
||||
#define BPy_ConstantColorShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ConstantColorShader_Type) )
|
||||
|
||||
/*---------------------------Python BPy_ConstantColorShader structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject ConstantThicknessShader_Type;
|
||||
|
||||
#define BPy_ConstantThicknessShader_Check(v) (( (PyObject *) v)->ob_type == &ConstantThicknessShader_Type)
|
||||
#define BPy_ConstantThicknessShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ConstantThicknessShader_Type) )
|
||||
|
||||
/*---------------------------Python BPy_ConstantThicknessShader structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject ConstrainedIncreasingThicknessShader_Type;
|
||||
|
||||
#define BPy_ConstrainedIncreasingThicknessShader_Check(v) (( (PyObject *) v)->ob_type == &ConstrainedIncreasingThicknessShader_Type)
|
||||
#define BPy_ConstrainedIncreasingThicknessShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ConstrainedIncreasingThicknessShader_Type) )
|
||||
|
||||
/*---------------------------Python BPy_ConstrainedIncreasingThicknessShader structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject GuidingLinesShader_Type;
|
||||
|
||||
#define BPy_GuidingLinesShader_Check(v) (( (PyObject *) v)->ob_type == &GuidingLinesShader_Type)
|
||||
#define BPy_GuidingLinesShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GuidingLinesShader_Type) )
|
||||
|
||||
/*---------------------------Python BPy_GuidingLinesShader structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject IncreasingColorShader_Type;
|
||||
|
||||
#define BPy_IncreasingColorShader_Check(v) (( (PyObject *) v)->ob_type == &IncreasingColorShader_Type)
|
||||
#define BPy_IncreasingColorShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &IncreasingColorShader_Type) )
|
||||
|
||||
/*---------------------------Python BPy_IncreasingColorShader structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject IncreasingThicknessShader_Type;
|
||||
|
||||
#define BPy_IncreasingThicknessShader_Check(v) (( (PyObject *) v)->ob_type == &IncreasingThicknessShader_Type)
|
||||
#define BPy_IncreasingThicknessShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &IncreasingThicknessShader_Type) )
|
||||
|
||||
/*---------------------------Python BPy_IncreasingThicknessShader structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject PolygonalizationShader_Type;
|
||||
|
||||
#define BPy_PolygonalizationShader_Check(v) (( (PyObject *) v)->ob_type == &PolygonalizationShader_Type)
|
||||
#define BPy_PolygonalizationShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &PolygonalizationShader_Type) )
|
||||
|
||||
/*---------------------------Python BPy_PolygonalizationShader structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject SamplingShader_Type;
|
||||
|
||||
#define BPy_SamplingShader_Check(v) (( (PyObject *) v)->ob_type == &SamplingShader_Type)
|
||||
#define BPy_SamplingShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &SamplingShader_Type) )
|
||||
|
||||
/*---------------------------Python BPy_SamplingShader structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject SpatialNoiseShader_Type;
|
||||
|
||||
#define BPy_SpatialNoiseShader_Check(v) (( (PyObject *) v)->ob_type == &SpatialNoiseShader_Type)
|
||||
#define BPy_SpatialNoiseShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &SpatialNoiseShader_Type) )
|
||||
|
||||
/*---------------------------Python BPy_SpatialNoiseShader structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject StrokeTextureShader_Type;
|
||||
|
||||
#define BPy_StrokeTextureShader_Check(v) (( (PyObject *) v)->ob_type == &StrokeTextureShader_Type)
|
||||
#define BPy_StrokeTextureShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &StrokeTextureShader_Type) )
|
||||
|
||||
/*---------------------------Python BPy_StrokeTextureShader structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject TextureAssignerShader_Type;
|
||||
|
||||
#define BPy_TextureAssignerShader_Check(v) (( (PyObject *) v)->ob_type == &TextureAssignerShader_Type)
|
||||
#define BPy_TextureAssignerShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &TextureAssignerShader_Type) )
|
||||
|
||||
/*---------------------------Python BPy_TextureAssignerShader structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject ThicknessNoiseShader_Type;
|
||||
|
||||
#define BPy_ThicknessNoiseShader_Check(v) (( (PyObject *) v)->ob_type == &ThicknessNoiseShader_Type)
|
||||
#define BPy_ThicknessNoiseShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ThicknessNoiseShader_Type) )
|
||||
|
||||
/*---------------------------Python BPy_ThicknessNoiseShader structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject ThicknessVariationPatternShader_Type;
|
||||
|
||||
#define BPy_ThicknessVariationPatternShader_Check(v) (( (PyObject *) v)->ob_type == &ThicknessVariationPatternShader_Type)
|
||||
#define BPy_ThicknessVariationPatternShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ThicknessVariationPatternShader_Type) )
|
||||
|
||||
/*---------------------------Python BPy_ThicknessVariationPatternShader structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject TipRemoverShader_Type;
|
||||
|
||||
#define BPy_TipRemoverShader_Check(v) (( (PyObject *) v)->ob_type == &TipRemoverShader_Type)
|
||||
#define BPy_TipRemoverShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &TipRemoverShader_Type) )
|
||||
|
||||
/*---------------------------Python BPy_TipRemoverShader structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject fstreamShader_Type;
|
||||
|
||||
#define BPy_fstreamShader_Check(v) (( (PyObject *) v)->ob_type == &fstreamShader_Type)
|
||||
#define BPy_fstreamShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &fstreamShader_Type) )
|
||||
|
||||
/*---------------------------Python BPy_fstreamShader structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject streamShader_Type;
|
||||
|
||||
#define BPy_streamShader_Check(v) (( (PyObject *) v)->ob_type == &streamShader_Type)
|
||||
#define BPy_streamShader_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &streamShader_Type) )
|
||||
|
||||
/*---------------------------Python BPy_streamShader structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject UnaryFunction0DDouble_Type;
|
||||
|
||||
#define BPy_UnaryFunction0DDouble_Check(v) (( (PyObject *) v)->ob_type == &UnaryFunction0DDouble_Type)
|
||||
#define BPy_UnaryFunction0DDouble_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction0DDouble_Type) )
|
||||
|
||||
/*---------------------------Python BPy_UnaryFunction0DDouble structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -15,7 +15,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject UnaryFunction0DEdgeNature_Type;
|
||||
|
||||
#define BPy_UnaryFunction0DEdgeNature_Check(v) (( (PyObject *) v)->ob_type == &UnaryFunction0DEdgeNature_Type)
|
||||
#define BPy_UnaryFunction0DEdgeNature_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction0DEdgeNature_Type) )
|
||||
|
||||
/*---------------------------Python BPy_UnaryFunction0DEdgeNature structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject UnaryFunction0DFloat_Type;
|
||||
|
||||
#define BPy_UnaryFunction0DFloat_Check(v) (( (PyObject *) v)->ob_type == &UnaryFunction0DFloat_Type)
|
||||
#define BPy_UnaryFunction0DFloat_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction0DFloat_Type) )
|
||||
|
||||
/*---------------------------Python BPy_UnaryFunction0DFloat structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -15,7 +15,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject UnaryFunction0DId_Type;
|
||||
|
||||
#define BPy_UnaryFunction0DId_Check(v) (( (PyObject *) v)->ob_type == &UnaryFunction0DId_Type)
|
||||
#define BPy_UnaryFunction0DId_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction0DId_Type) )
|
||||
|
||||
/*---------------------------Python BPy_UnaryFunction0DId structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -15,7 +15,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject UnaryFunction0DMaterial_Type;
|
||||
|
||||
#define BPy_UnaryFunction0DMaterial_Check(v) (( (PyObject *) v)->ob_type == &UnaryFunction0DMaterial_Type)
|
||||
#define BPy_UnaryFunction0DMaterial_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction0DMaterial_Type) )
|
||||
|
||||
/*---------------------------Python BPy_UnaryFunction0DMaterial structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject UnaryFunction0DUnsigned_Type;
|
||||
|
||||
#define BPy_UnaryFunction0DUnsigned_Check(v) (( (PyObject *) v)->ob_type == &UnaryFunction0DUnsigned_Type)
|
||||
#define BPy_UnaryFunction0DUnsigned_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction0DUnsigned_Type) )
|
||||
|
||||
/*---------------------------Python BPy_UnaryFunction0DUnsigned structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -16,7 +16,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject UnaryFunction0DVec2f_Type;
|
||||
|
||||
#define BPy_UnaryFunction0DVec2f_Check(v) (( (PyObject *) v)->ob_type == &UnaryFunction0DVec2f_Type)
|
||||
#define BPy_UnaryFunction0DVec2f_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction0DVec2f_Type) )
|
||||
|
||||
/*---------------------------Python BPy_UnaryFunction0DVec2f structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -16,7 +16,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject UnaryFunction0DVec3f_Type;
|
||||
|
||||
#define BPy_UnaryFunction0DVec3f_Check(v) (( (PyObject *) v)->ob_type == &UnaryFunction0DVec3f_Type)
|
||||
#define BPy_UnaryFunction0DVec3f_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction0DVec3f_Type) )
|
||||
|
||||
/*---------------------------Python BPy_UnaryFunction0DVec3f structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -16,7 +16,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject UnaryFunction0DVectorViewShape_Type;
|
||||
|
||||
#define BPy_UnaryFunction0DVectorViewShape_Check(v) (( (PyObject *) v)->ob_type == &UnaryFunction0DVectorViewShape_Type)
|
||||
#define BPy_UnaryFunction0DVectorViewShape_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction0DVectorViewShape_Type) )
|
||||
|
||||
/*---------------------------Python BPy_UnaryFunction0DVectorViewShape structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -15,7 +15,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject UnaryFunction0DViewShape_Type;
|
||||
|
||||
#define BPy_UnaryFunction0DViewShape_Check(v) (( (PyObject *) v)->ob_type == &UnaryFunction0DViewShape_Type)
|
||||
#define BPy_UnaryFunction0DViewShape_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction0DViewShape_Type) )
|
||||
|
||||
/*---------------------------Python BPy_UnaryFunction0DViewShape structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject ShapeIdF0D_Type;
|
||||
|
||||
#define BPy_ShapeIdF0D_Check(v) (( (PyObject *) v)->ob_type == &ShapeIdF0D_Type)
|
||||
#define BPy_ShapeIdF0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ShapeIdF0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_ShapeIdF0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject MaterialF0D_Type;
|
||||
|
||||
#define BPy_MaterialF0D_Check(v) (( (PyObject *) v)->ob_type == &MaterialF0D_Type)
|
||||
#define BPy_MaterialF0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &MaterialF0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_MaterialF0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject CurveNatureF0D_Type;
|
||||
|
||||
#define BPy_CurveNatureF0D_Check(v) (( (PyObject *) v)->ob_type == &CurveNatureF0D_Type)
|
||||
#define BPy_CurveNatureF0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &CurveNatureF0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_CurveNatureF0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject Normal2DF0D_Type;
|
||||
|
||||
#define BPy_Normal2DF0D_Check(v) (( (PyObject *) v)->ob_type == &Normal2DF0D_Type)
|
||||
#define BPy_Normal2DF0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &Normal2DF0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_Normal2DF0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject VertexOrientation2DF0D_Type;
|
||||
|
||||
#define BPy_VertexOrientation2DF0D_Check(v) (( (PyObject *) v)->ob_type == &VertexOrientation2DF0D_Type)
|
||||
#define BPy_VertexOrientation2DF0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &VertexOrientation2DF0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_VertexOrientation2DF0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject VertexOrientation3DF0D_Type;
|
||||
|
||||
#define BPy_VertexOrientation3DF0D_Check(v) (( (PyObject *) v)->ob_type == &VertexOrientation3DF0D_Type)
|
||||
#define BPy_VertexOrientation3DF0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &VertexOrientation3DF0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_VertexOrientation3DF0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject GetOccludeeF0D_Type;
|
||||
|
||||
#define BPy_GetOccludeeF0D_Check(v) (( (PyObject *) v)->ob_type == &GetOccludeeF0D_Type)
|
||||
#define BPy_GetOccludeeF0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetOccludeeF0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_GetOccludeeF0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject GetShapeF0D_Type;
|
||||
|
||||
#define BPy_GetShapeF0D_Check(v) (( (PyObject *) v)->ob_type == &GetShapeF0D_Type)
|
||||
#define BPy_GetShapeF0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetShapeF0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_GetShapeF0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject Curvature2DAngleF0D_Type;
|
||||
|
||||
#define BPy_Curvature2DAngleF0D_Check(v) (( (PyObject *) v)->ob_type == &Curvature2DAngleF0D_Type)
|
||||
#define BPy_Curvature2DAngleF0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &Curvature2DAngleF0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_Curvature2DAngleF0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject DensityF0D_Type;
|
||||
|
||||
#define BPy_DensityF0D_Check(v) (( (PyObject *) v)->ob_type == &DensityF0D_Type)
|
||||
#define BPy_DensityF0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &DensityF0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_DensityF0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject GetProjectedXF0D_Type;
|
||||
|
||||
#define BPy_GetProjectedXF0D_Check(v) (( (PyObject *) v)->ob_type == &GetProjectedXF0D_Type)
|
||||
#define BPy_GetProjectedXF0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetProjectedXF0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_GetProjectedXF0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject GetProjectedYF0D_Type;
|
||||
|
||||
#define BPy_GetProjectedYF0D_Check(v) (( (PyObject *) v)->ob_type == &GetProjectedYF0D_Type)
|
||||
#define BPy_GetProjectedYF0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetProjectedYF0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_GetProjectedYF0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject GetProjectedZF0D_Type;
|
||||
|
||||
#define BPy_GetProjectedZF0D_Check(v) (( (PyObject *) v)->ob_type == &GetProjectedZF0D_Type)
|
||||
#define BPy_GetProjectedZF0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetProjectedZF0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_GetProjectedZF0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject GetXF0D_Type;
|
||||
|
||||
#define BPy_GetXF0D_Check(v) (( (PyObject *) v)->ob_type == &GetXF0D_Type)
|
||||
#define BPy_GetXF0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetXF0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_GetXF0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject GetYF0D_Type;
|
||||
|
||||
#define BPy_GetYF0D_Check(v) (( (PyObject *) v)->ob_type == &GetYF0D_Type)
|
||||
#define BPy_GetYF0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetYF0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_GetYF0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject GetZF0D_Type;
|
||||
|
||||
#define BPy_GetZF0D_Check(v) (( (PyObject *) v)->ob_type == &GetZF0D_Type)
|
||||
#define BPy_GetZF0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetZF0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_GetZF0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject LocalAverageDepthF0D_Type;
|
||||
|
||||
#define BPy_LocalAverageDepthF0D_Check(v) (( (PyObject *) v)->ob_type == &LocalAverageDepthF0D_Type)
|
||||
#define BPy_LocalAverageDepthF0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &LocalAverageDepthF0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_LocalAverageDepthF0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject ZDiscontinuityF0D_Type;
|
||||
|
||||
#define BPy_ZDiscontinuityF0D_Check(v) (( (PyObject *) v)->ob_type == &ZDiscontinuityF0D_Type)
|
||||
#define BPy_ZDiscontinuityF0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ZDiscontinuityF0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_ZDiscontinuityF0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject GetCurvilinearAbscissaF0D_Type;
|
||||
|
||||
#define BPy_GetCurvilinearAbscissaF0D_Check(v) (( (PyObject *) v)->ob_type == &GetCurvilinearAbscissaF0D_Type)
|
||||
#define BPy_GetCurvilinearAbscissaF0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetCurvilinearAbscissaF0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_GetCurvilinearAbscissaF0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject GetParameterF0D_Type;
|
||||
|
||||
#define BPy_GetParameterF0D_Check(v) (( (PyObject *) v)->ob_type == &GetParameterF0D_Type)
|
||||
#define BPy_GetParameterF0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetParameterF0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_GetParameterF0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject GetViewMapGradientNormF0D_Type;
|
||||
|
||||
#define BPy_GetViewMapGradientNormF0D_Check(v) (( (PyObject *) v)->ob_type == &GetViewMapGradientNormF0D_Type)
|
||||
#define BPy_GetViewMapGradientNormF0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetViewMapGradientNormF0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_GetViewMapGradientNormF0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject ReadCompleteViewMapPixelF0D_Type;
|
||||
|
||||
#define BPy_ReadCompleteViewMapPixelF0D_Check(v) (( (PyObject *) v)->ob_type == &ReadCompleteViewMapPixelF0D_Type)
|
||||
#define BPy_ReadCompleteViewMapPixelF0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ReadCompleteViewMapPixelF0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_ReadCompleteViewMapPixelF0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject ReadMapPixelF0D_Type;
|
||||
|
||||
#define BPy_ReadMapPixelF0D_Check(v) (( (PyObject *) v)->ob_type == &ReadMapPixelF0D_Type)
|
||||
#define BPy_ReadMapPixelF0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ReadMapPixelF0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_ReadMapPixelF0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject ReadSteerableViewMapPixelF0D_Type;
|
||||
|
||||
#define BPy_ReadSteerableViewMapPixelF0D_Check(v) (( (PyObject *) v)->ob_type == &ReadSteerableViewMapPixelF0D_Type)
|
||||
#define BPy_ReadSteerableViewMapPixelF0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ReadSteerableViewMapPixelF0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_ReadSteerableViewMapPixelF0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject QuantitativeInvisibilityF0D_Type;
|
||||
|
||||
#define BPy_QuantitativeInvisibilityF0D_Check(v) (( (PyObject *) v)->ob_type == &QuantitativeInvisibilityF0D_Type)
|
||||
#define BPy_QuantitativeInvisibilityF0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &QuantitativeInvisibilityF0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_QuantitativeInvisibilityF0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject GetOccludersF0D_Type;
|
||||
|
||||
#define BPy_GetOccludersF0D_Check(v) (( (PyObject *) v)->ob_type == &GetOccludersF0D_Type)
|
||||
#define BPy_GetOccludersF0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetOccludersF0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_GetOccludersF0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject UnaryFunction1DDouble_Type;
|
||||
|
||||
#define BPy_UnaryFunction1DDouble_Check(v) (( (PyObject *) v)->ob_type == &UnaryFunction1DDouble_Type)
|
||||
#define BPy_UnaryFunction1DDouble_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction1DDouble_Type) )
|
||||
|
||||
/*---------------------------Python BPy_UnaryFunction1DDouble structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -15,7 +15,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject UnaryFunction1DEdgeNature_Type;
|
||||
|
||||
#define BPy_UnaryFunction1DEdgeNature_Check(v) (( (PyObject *) v)->ob_type == &UnaryFunction1DEdgeNature_Type)
|
||||
#define BPy_UnaryFunction1DEdgeNature_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction1DEdgeNature_Type) )
|
||||
|
||||
/*---------------------------Python BPy_UnaryFunction1DEdgeNature structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject UnaryFunction1DFloat_Type;
|
||||
|
||||
#define BPy_UnaryFunction1DFloat_Check(v) (( (PyObject *) v)->ob_type == &UnaryFunction1DFloat_Type)
|
||||
#define BPy_UnaryFunction1DFloat_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction1DFloat_Type) )
|
||||
|
||||
/*---------------------------Python BPy_UnaryFunction1DFloat structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject UnaryFunction1DUnsigned_Type;
|
||||
|
||||
#define BPy_UnaryFunction1DUnsigned_Check(v) (( (PyObject *) v)->ob_type == &UnaryFunction1DUnsigned_Type)
|
||||
#define BPy_UnaryFunction1DUnsigned_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction1DUnsigned_Type) )
|
||||
|
||||
/*---------------------------Python BPy_UnaryFunction1DUnsigned structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -16,7 +16,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject UnaryFunction1DVec2f_Type;
|
||||
|
||||
#define BPy_UnaryFunction1DVec2f_Check(v) (( (PyObject *) v)->ob_type == &UnaryFunction1DVec2f_Type)
|
||||
#define BPy_UnaryFunction1DVec2f_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction1DVec2f_Type) )
|
||||
|
||||
/*---------------------------Python BPy_UnaryFunction1DVec2f structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -16,7 +16,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject UnaryFunction1DVec3f_Type;
|
||||
|
||||
#define BPy_UnaryFunction1DVec3f_Check(v) (( (PyObject *) v)->ob_type == &UnaryFunction1DVec3f_Type)
|
||||
#define BPy_UnaryFunction1DVec3f_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction1DVec3f_Type) )
|
||||
|
||||
/*---------------------------Python BPy_UnaryFunction1DVec3f structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -16,7 +16,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject UnaryFunction1DVectorViewShape_Type;
|
||||
|
||||
#define BPy_UnaryFunction1DVectorViewShape_Check(v) (( (PyObject *) v)->ob_type == &UnaryFunction1DVectorViewShape_Type)
|
||||
#define BPy_UnaryFunction1DVectorViewShape_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction1DVectorViewShape_Type) )
|
||||
|
||||
/*---------------------------Python BPy_UnaryFunction1DVectorViewShape structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject UnaryFunction1DVoid_Type;
|
||||
|
||||
#define BPy_UnaryFunction1DVoid_Check(v) (( (PyObject *) v)->ob_type == &UnaryFunction1DVoid_Type)
|
||||
#define BPy_UnaryFunction1DVoid_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &UnaryFunction1DVoid_Type) )
|
||||
|
||||
/*---------------------------Python BPy_UnaryFunction1DVoid structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject CurveNatureF1D_Type;
|
||||
|
||||
#define BPy_CurveNatureF1D_Check(v) (( (PyObject *) v)->ob_type == &CurveNatureF1D_Type)
|
||||
#define BPy_CurveNatureF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &CurveNatureF1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_CurveNatureF1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject Normal2DF1D_Type;
|
||||
|
||||
#define BPy_Normal2DF1D_Check(v) (( (PyObject *) v)->ob_type == &Normal2DF1D_Type)
|
||||
#define BPy_Normal2DF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &Normal2DF1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_Normal2DF1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject Orientation2DF1D_Type;
|
||||
|
||||
#define BPy_Orientation2DF1D_Check(v) (( (PyObject *) v)->ob_type == &Orientation2DF1D_Type)
|
||||
#define BPy_Orientation2DF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &Orientation2DF1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_Orientation2DF1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject Orientation3DF1D_Type;
|
||||
|
||||
#define BPy_Orientation3DF1D_Check(v) (( (PyObject *) v)->ob_type == &Orientation3DF1D_Type)
|
||||
#define BPy_Orientation3DF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &Orientation3DF1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_Orientation3DF1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject Curvature2DAngleF1D_Type;
|
||||
|
||||
#define BPy_Curvature2DAngleF1D_Check(v) (( (PyObject *) v)->ob_type == &Curvature2DAngleF1D_Type)
|
||||
#define BPy_Curvature2DAngleF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &Curvature2DAngleF1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_Curvature2DAngleF1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject DensityF1D_Type;
|
||||
|
||||
#define BPy_DensityF1D_Check(v) (( (PyObject *) v)->ob_type == &DensityF1D_Type)
|
||||
#define BPy_DensityF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &DensityF1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_DensityF1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject GetCompleteViewMapDensityF1D_Type;
|
||||
|
||||
#define BPy_GetCompleteViewMapDensityF1D_Check(v) (( (PyObject *) v)->ob_type == &GetCompleteViewMapDensityF1D_Type)
|
||||
#define BPy_GetCompleteViewMapDensityF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetCompleteViewMapDensityF1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_GetCompleteViewMapDensityF1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject GetDirectionalViewMapDensityF1D_Type;
|
||||
|
||||
#define BPy_GetDirectionalViewMapDensityF1D_Check(v) (( (PyObject *) v)->ob_type == &GetDirectionalViewMapDensityF1D_Type)
|
||||
#define BPy_GetDirectionalViewMapDensityF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetDirectionalViewMapDensityF1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_GetDirectionalViewMapDensityF1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject GetProjectedXF1D_Type;
|
||||
|
||||
#define BPy_GetProjectedXF1D_Check(v) (( (PyObject *) v)->ob_type == &GetProjectedXF1D_Type)
|
||||
#define BPy_GetProjectedXF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetProjectedXF1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_GetProjectedXF1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject GetProjectedYF1D_Type;
|
||||
|
||||
#define BPy_GetProjectedYF1D_Check(v) (( (PyObject *) v)->ob_type == &GetProjectedYF1D_Type)
|
||||
#define BPy_GetProjectedYF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetProjectedYF1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_GetProjectedYF1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject GetProjectedZF1D_Type;
|
||||
|
||||
#define BPy_GetProjectedZF1D_Check(v) (( (PyObject *) v)->ob_type == &GetProjectedZF1D_Type)
|
||||
#define BPy_GetProjectedZF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetProjectedZF1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_GetProjectedZF1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,8 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject GetSteerableViewMapDensityF1D_Type;
|
||||
|
||||
#define BPy_GetSteerableViewMapDensityF1D_Check(v) (( (PyObject *) v)->ob_type == &GetSteerableViewMapDensityF1D_Type)
|
||||
|
||||
#define BPy_GetSteerableViewMapDensityF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetSteerableViewMapDensityF1D_Type) )
|
||||
/*---------------------------Python BPy_GetSteerableViewMapDensityF1D structure definition----------*/
|
||||
typedef struct {
|
||||
BPy_UnaryFunction1DDouble py_uf1D_double;
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject GetViewMapGradientNormF1D_Type;
|
||||
|
||||
#define BPy_GetViewMapGradientNormF1D_Check(v) (( (PyObject *) v)->ob_type == &GetViewMapGradientNormF1D_Type)
|
||||
#define BPy_GetViewMapGradientNormF1D_Check(v) ( ((PyObject *) v)->ob_type == PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetViewMapGradientNormF1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_GetViewMapGradientNormF1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject GetXF1D_Type;
|
||||
|
||||
#define BPy_GetXF1D_Check(v) (( (PyObject *) v)->ob_type == &GetXF1D_Type)
|
||||
#define BPy_GetXF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetXF1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_GetXF1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject GetYF1D_Type;
|
||||
|
||||
#define BPy_GetYF1D_Check(v) (( (PyObject *) v)->ob_type == &GetYF1D_Type)
|
||||
#define BPy_GetYF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetYF1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_GetYF1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject GetZF1D_Type;
|
||||
|
||||
#define BPy_GetZF1D_Check(v) (( (PyObject *) v)->ob_type == &GetZF1D_Type)
|
||||
#define BPy_GetZF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetZF1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_GetZF1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject LocalAverageDepthF1D_Type;
|
||||
|
||||
#define BPy_LocalAverageDepthF1D_Check(v) (( (PyObject *) v)->ob_type == &LocalAverageDepthF1D_Type)
|
||||
#define BPy_LocalAverageDepthF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &LocalAverageDepthF1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_LocalAverageDepthF1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject ZDiscontinuityF1D_Type;
|
||||
|
||||
#define BPy_ZDiscontinuityF1D_Check(v) (( (PyObject *) v)->ob_type == &ZDiscontinuityF1D_Type)
|
||||
#define BPy_ZDiscontinuityF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ZDiscontinuityF1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_ZDiscontinuityF1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject QuantitativeInvisibilityF1D_Type;
|
||||
|
||||
#define BPy_QuantitativeInvisibilityF1D_Check(v) (( (PyObject *) v)->ob_type == &QuantitativeInvisibilityF1D_Type)
|
||||
#define BPy_QuantitativeInvisibilityF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &QuantitativeInvisibilityF1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_QuantitativeInvisibilityF1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject GetOccludeeF1D_Type;
|
||||
|
||||
#define BPy_GetOccludeeF1D_Check(v) (( (PyObject *) v)->ob_type == &GetOccludeeF1D_Type)
|
||||
#define BPy_GetOccludeeF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetOccludeeF1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_GetOccludeeF1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject GetOccludersF1D_Type;
|
||||
|
||||
#define BPy_GetOccludersF1D_Check(v) (( (PyObject *) v)->ob_type == &GetOccludersF1D_Type)
|
||||
#define BPy_GetOccludersF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetOccludersF1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_GetOccludersF1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject GetShapeF1D_Type;
|
||||
|
||||
#define BPy_GetShapeF1D_Check(v) (( (PyObject *) v)->ob_type == &GetShapeF1D_Type)
|
||||
#define BPy_GetShapeF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &GetShapeF1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_GetShapeF1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject ChainingTimeStampF1D_Type;
|
||||
|
||||
#define BPy_ChainingTimeStampF1D_Check(v) (( (PyObject *) v)->ob_type == &ChainingTimeStampF1D_Type)
|
||||
#define BPy_ChainingTimeStampF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ChainingTimeStampF1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_ChainingTimeStampF1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject IncrementChainingTimeStampF1D_Type;
|
||||
|
||||
#define BPy_IncrementChainingTimeStampF1D_Check(v) (( (PyObject *) v)->ob_type == &IncrementChainingTimeStampF1D_Type)
|
||||
#define BPy_IncrementChainingTimeStampF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &IncrementChainingTimeStampF1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_IncrementChainingTimeStampF1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject TimeStampF1D_Type;
|
||||
|
||||
#define BPy_TimeStampF1D_Check(v) (( (PyObject *) v)->ob_type == &TimeStampF1D_Type)
|
||||
#define BPy_TimeStampF1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &TimeStampF1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_TimeStampF1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject FalseUP0D_Type;
|
||||
|
||||
#define BPy_FalseUP0D_Check(v) (( (PyObject *) v)->ob_type == &FalseUP0D_Type)
|
||||
#define BPy_FalseUP0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &FalseUP0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_FalseUP0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject TrueUP0D_Type;
|
||||
|
||||
#define BPy_TrueUP0D_Check(v) (( (PyObject *) v)->ob_type == &TrueUP0D_Type)
|
||||
#define BPy_TrueUP0D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &TrueUP0D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_TrueUP0D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject ContourUP1D_Type;
|
||||
|
||||
#define BPy_ContourUP1D_Check(v) (( (PyObject *) v)->ob_type == &ContourUP1D_Type)
|
||||
#define BPy_ContourUP1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ContourUP1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_ContourUP1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject DensityLowerThanUP1D_Type;
|
||||
|
||||
#define BPy_DensityLowerThanUP1D_Check(v) (( (PyObject *) v)->ob_type == &DensityLowerThanUP1D_Type)
|
||||
#define BPy_DensityLowerThanUP1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &DensityLowerThanUP1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_DensityLowerThanUP1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject EqualToChainingTimeStampUP1D_Type;
|
||||
|
||||
#define BPy_EqualToChainingTimeStampUP1D_Check(v) (( (PyObject *) v)->ob_type == &EqualToChainingTimeStampUP1D_Type)
|
||||
#define BPy_EqualToChainingTimeStampUP1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &EqualToChainingTimeStampUP1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_EqualToChainingTimeStampUP1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject EqualToTimeStampUP1D_Type;
|
||||
|
||||
#define BPy_EqualToTimeStampUP1D_Check(v) (( (PyObject *) v)->ob_type == &EqualToTimeStampUP1D_Type)
|
||||
#define BPy_EqualToTimeStampUP1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &EqualToTimeStampUP1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_EqualToTimeStampUP1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject ExternalContourUP1D_Type;
|
||||
|
||||
#define BPy_ExternalContourUP1D_Check(v) (( (PyObject *) v)->ob_type == &ExternalContourUP1D_Type)
|
||||
#define BPy_ExternalContourUP1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ExternalContourUP1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_ExternalContourUP1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject FalseUP1D_Type;
|
||||
|
||||
#define BPy_FalseUP1D_Check(v) (( (PyObject *) v)->ob_type == &FalseUP1D_Type)
|
||||
#define BPy_FalseUP1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &FalseUP1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_FalseUP1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject QuantitativeInvisibilityUP1D_Type;
|
||||
|
||||
#define BPy_QuantitativeInvisibilityUP1D_Check(v) (( (PyObject *) v)->ob_type == &QuantitativeInvisibilityUP1D_Type)
|
||||
#define BPy_QuantitativeInvisibilityUP1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &QuantitativeInvisibilityUP1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_QuantitativeInvisibilityUP1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject ShapeUP1D_Type;
|
||||
|
||||
#define BPy_ShapeUP1D_Check(v) (( (PyObject *) v)->ob_type == &ShapeUP1D_Type)
|
||||
#define BPy_ShapeUP1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &ShapeUP1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_ShapeUP1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
@@ -13,7 +13,7 @@ extern "C" {
|
||||
|
||||
extern PyTypeObject TrueUP1D_Type;
|
||||
|
||||
#define BPy_TrueUP1D_Check(v) (( (PyObject *) v)->ob_type == &TrueUP1D_Type)
|
||||
#define BPy_TrueUP1D_Check(v) ( PyObject_IsInstance( (PyObject *) v, (PyObject *) &TrueUP1D_Type) )
|
||||
|
||||
/*---------------------------Python BPy_TrueUP1D structure definition----------*/
|
||||
typedef struct {
|
||||
|
||||
731
source/blender/freestyle/style_modules_blender/ChainingIterators.py
Executable file
731
source/blender/freestyle/style_modules_blender/ChainingIterators.py
Executable file
@@ -0,0 +1,731 @@
|
||||
#
|
||||
# Filename : ChainingIterators.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Chaining Iterators to be used with chaining operators
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
|
||||
## the natural chaining iterator
|
||||
## It follows the edges of same nature following the topology of
|
||||
## objects with preseance on silhouettes, then borders,
|
||||
## then suggestive contours, then everything else. It doesn't chain the same ViewEdge twice
|
||||
## You can specify whether to stay in the selection or not.
|
||||
class pyChainSilhouetteIterator(ChainingIterator):
|
||||
def __init__(self, stayInSelection=1):
|
||||
ChainingIterator.__init__(self, stayInSelection, 1,None,1)
|
||||
def getExactTypeName(self):
|
||||
return "pyChainSilhouetteIterator"
|
||||
def traverse(self, iter):
|
||||
winner = None
|
||||
it = AdjacencyIterator(iter)
|
||||
nextVertex = self.getVertex()
|
||||
if(nextVertex.getNature() & T_VERTEX != 0):
|
||||
tvertex = nextVertex.castToTVertex()
|
||||
mateVE = tvertex.mate(self.getCurrentEdge())
|
||||
while(it.isEnd() == 0):
|
||||
ve = it.getObject()
|
||||
if(ve.getId() == mateVE.getId() ):
|
||||
winner = ve
|
||||
break
|
||||
it.increment()
|
||||
else:
|
||||
## case of NonTVertex
|
||||
natures = [SILHOUETTE,BORDER,CREASE,SUGGESTIVE_CONTOUR,VALLEY,RIDGE]
|
||||
for i in range(len(natures)):
|
||||
currentNature = self.getCurrentEdge().getNature()
|
||||
if(natures[i] & currentNature):
|
||||
count=0
|
||||
while(it.isEnd() == 0):
|
||||
visitNext = 0
|
||||
oNature = it.getObject().getNature()
|
||||
if(oNature & natures[i] != 0):
|
||||
if(natures[i] != oNature):
|
||||
for j in range(i):
|
||||
if(natures[j] & oNature != 0):
|
||||
visitNext = 1
|
||||
break
|
||||
if(visitNext != 0):
|
||||
break
|
||||
count = count+1
|
||||
winner = it.getObject()
|
||||
it.increment()
|
||||
if(count != 1):
|
||||
winner = None
|
||||
break
|
||||
return winner
|
||||
|
||||
## the natural chaining iterator
|
||||
## It follows the edges of same nature on the same
|
||||
## objects with preseance on silhouettes, then borders,
|
||||
## then suggestive contours, then everything else. It doesn't chain the same ViewEdge twice
|
||||
## You can specify whether to stay in the selection or not.
|
||||
## You can specify whether to chain iterate over edges that were
|
||||
## already visited or not.
|
||||
class pyChainSilhouetteGenericIterator(ChainingIterator):
|
||||
def __init__(self, stayInSelection=1, stayInUnvisited=1):
|
||||
ChainingIterator.__init__(self, stayInSelection, stayInUnvisited,None,1)
|
||||
def getExactTypeName(self):
|
||||
return "pyChainSilhouetteGenericIterator"
|
||||
def traverse(self, iter):
|
||||
winner = None
|
||||
it = AdjacencyIterator(iter)
|
||||
nextVertex = self.getVertex()
|
||||
if(nextVertex.getNature() & T_VERTEX != 0):
|
||||
tvertex = nextVertex.castToTVertex()
|
||||
mateVE = tvertex.mate(self.getCurrentEdge())
|
||||
while(it.isEnd() == 0):
|
||||
ve = it.getObject()
|
||||
if(ve.getId() == mateVE.getId() ):
|
||||
winner = ve
|
||||
break
|
||||
it.increment()
|
||||
else:
|
||||
## case of NonTVertex
|
||||
natures = [SILHOUETTE,BORDER,CREASE,SUGGESTIVE_CONTOUR,VALLEY,RIDGE]
|
||||
for i in range(len(natures)):
|
||||
currentNature = self.getCurrentEdge().getNature()
|
||||
if(natures[i] & currentNature):
|
||||
count=0
|
||||
while(it.isEnd() == 0):
|
||||
visitNext = 0
|
||||
oNature = it.getObject().getNature()
|
||||
ve = it.getObject()
|
||||
if(ve.getId() == self.getCurrentEdge().getId()):
|
||||
it.increment()
|
||||
continue
|
||||
if(oNature & natures[i] != 0):
|
||||
if(natures[i] != oNature):
|
||||
for j in range(i):
|
||||
if(natures[j] & oNature != 0):
|
||||
visitNext = 1
|
||||
break
|
||||
if(visitNext != 0):
|
||||
break
|
||||
count = count+1
|
||||
winner = ve
|
||||
it.increment()
|
||||
if(count != 1):
|
||||
winner = None
|
||||
break
|
||||
return winner
|
||||
|
||||
class pyExternalContourChainingIterator(ChainingIterator):
|
||||
def __init__(self):
|
||||
ChainingIterator.__init__(self, 0, 1,None,1)
|
||||
self._isExternalContour = ExternalContourUP1D()
|
||||
|
||||
def getExactTypeName(self):
|
||||
return "pyExternalContourIterator"
|
||||
|
||||
def init(self):
|
||||
self._nEdges = 0
|
||||
self._isInSelection = 1
|
||||
|
||||
def checkViewEdge(self, ve, orientation):
|
||||
if(orientation != 0):
|
||||
vertex = ve.B()
|
||||
else:
|
||||
vertex = ve.A()
|
||||
it = AdjacencyIterator(vertex,1,1)
|
||||
while(it.isEnd() == 0):
|
||||
ave = it.getObject()
|
||||
if(self._isExternalContour(ave)):
|
||||
return 1
|
||||
it.increment()
|
||||
print "pyExternlContourChainingIterator : didn't find next edge"
|
||||
return 0
|
||||
def traverse(self, iter):
|
||||
winner = None
|
||||
it = AdjacencyIterator(iter)
|
||||
while(it.isEnd() == 0):
|
||||
ve = it.getObject()
|
||||
if(self._isExternalContour(ve)):
|
||||
if (ve.getTimeStamp() == GetTimeStampCF()):
|
||||
winner = ve
|
||||
it.increment()
|
||||
|
||||
self._nEdges = self._nEdges+1
|
||||
if(winner == None):
|
||||
orient = 1
|
||||
it = AdjacencyIterator(iter)
|
||||
while(it.isEnd() == 0):
|
||||
ve = it.getObject()
|
||||
if(it.isIncoming() != 0):
|
||||
orient = 0
|
||||
good = self.checkViewEdge(ve,orient)
|
||||
if(good != 0):
|
||||
winner = ve
|
||||
it.increment()
|
||||
return winner
|
||||
|
||||
## the natural chaining iterator
|
||||
## with a sketchy multiple touch
|
||||
class pySketchyChainSilhouetteIterator(ChainingIterator):
|
||||
def __init__(self, nRounds=3,stayInSelection=1):
|
||||
ChainingIterator.__init__(self, stayInSelection, 0,None,1)
|
||||
self._timeStamp = GetTimeStampCF()+nRounds
|
||||
self._nRounds = nRounds
|
||||
def getExactTypeName(self):
|
||||
return "pySketchyChainSilhouetteIterator"
|
||||
def init(self):
|
||||
self._timeStamp = GetTimeStampCF()+self._nRounds
|
||||
def traverse(self, iter):
|
||||
winner = None
|
||||
it = AdjacencyIterator(iter)
|
||||
nextVertex = self.getVertex()
|
||||
if(nextVertex.getNature() & T_VERTEX != 0):
|
||||
tvertex = nextVertex.castToTVertex()
|
||||
mateVE = tvertex.mate(self.getCurrentEdge())
|
||||
while(it.isEnd() == 0):
|
||||
ve = it.getObject()
|
||||
if(ve.getId() == mateVE.getId() ):
|
||||
winner = ve
|
||||
break
|
||||
it.increment()
|
||||
else:
|
||||
## case of NonTVertex
|
||||
natures = [SILHOUETTE,BORDER,CREASE,SUGGESTIVE_CONTOUR,VALLEY,RIDGE]
|
||||
for i in range(len(natures)):
|
||||
currentNature = self.getCurrentEdge().getNature()
|
||||
if(natures[i] & currentNature):
|
||||
count=0
|
||||
while(it.isEnd() == 0):
|
||||
visitNext = 0
|
||||
oNature = it.getObject().getNature()
|
||||
ve = it.getObject()
|
||||
if(ve.getId() == self.getCurrentEdge().getId()):
|
||||
it.increment()
|
||||
continue
|
||||
if(oNature & natures[i] != 0):
|
||||
if(natures[i] != oNature):
|
||||
for j in range(i):
|
||||
if(natures[j] & oNature != 0):
|
||||
visitNext = 1
|
||||
break
|
||||
if(visitNext != 0):
|
||||
break
|
||||
count = count+1
|
||||
winner = ve
|
||||
it.increment()
|
||||
if(count != 1):
|
||||
winner = None
|
||||
break
|
||||
if(winner == None):
|
||||
winner = self.getCurrentEdge()
|
||||
if(winner.getChainingTimeStamp() == self._timeStamp):
|
||||
winner = None
|
||||
return winner
|
||||
|
||||
|
||||
# Chaining iterator designed for sketchy style.
|
||||
# can chain several times the same ViewEdge
|
||||
# in order to produce multiple strokes per ViewEdge.
|
||||
class pySketchyChainingIterator(ChainingIterator):
|
||||
def __init__(self, nRounds=3, stayInSelection=1):
|
||||
ChainingIterator.__init__(self, stayInSelection, 0,None,1)
|
||||
self._timeStamp = GetTimeStampCF()+nRounds
|
||||
self._nRounds = nRounds
|
||||
def getExactTypeName(self):
|
||||
return "pySketchyChainingIterator"
|
||||
|
||||
def init(self):
|
||||
self._timeStamp = GetTimeStampCF()+self._nRounds
|
||||
|
||||
def traverse(self, iter):
|
||||
winner = None
|
||||
it = AdjacencyIterator(iter)
|
||||
while(it.isEnd() == 0):
|
||||
ve = it.getObject()
|
||||
if(ve.getId() == self.getCurrentEdge().getId()):
|
||||
it.increment()
|
||||
continue
|
||||
winner = ve
|
||||
it.increment()
|
||||
if(winner == None):
|
||||
winner = self.getCurrentEdge()
|
||||
if(winner.getChainingTimeStamp() == self._timeStamp):
|
||||
return None
|
||||
return winner
|
||||
|
||||
|
||||
## Chaining iterator that fills small occlusions
|
||||
## percent
|
||||
## The max length of the occluded part
|
||||
## expressed in % of the total chain length
|
||||
class pyFillOcclusionsRelativeChainingIterator(ChainingIterator):
|
||||
def __init__(self, percent):
|
||||
ChainingIterator.__init__(self, 0, 1,None,1)
|
||||
self._length = 0
|
||||
self._percent = float(percent)
|
||||
def getExactTypeName(self):
|
||||
return "pyFillOcclusionsChainingIterator"
|
||||
def init(self):
|
||||
# each time we're evaluating a chain length
|
||||
# we try to do it once. Thus we reinit
|
||||
# the chain length here:
|
||||
self._length = 0
|
||||
def traverse(self, iter):
|
||||
winner = None
|
||||
winnerOrientation = 0
|
||||
print self.getCurrentEdge().getId().getFirst(), self.getCurrentEdge().getId().getSecond()
|
||||
it = AdjacencyIterator(iter)
|
||||
nextVertex = self.getVertex()
|
||||
if(nextVertex.getNature() & T_VERTEX != 0):
|
||||
tvertex = nextVertex.castToTVertex()
|
||||
mateVE = tvertex.mate(self.getCurrentEdge())
|
||||
while(it.isEnd() == 0):
|
||||
ve = it.getObject()
|
||||
if(ve.getId() == mateVE.getId() ):
|
||||
winner = ve
|
||||
if(it.isIncoming() == 0):
|
||||
winnerOrientation = 1
|
||||
else:
|
||||
winnerOrientation = 0
|
||||
break
|
||||
it.increment()
|
||||
else:
|
||||
## case of NonTVertex
|
||||
natures = [SILHOUETTE,BORDER,CREASE,SUGGESTIVE_CONTOUR,VALLEY,RIDGE]
|
||||
for nat in natures:
|
||||
if(self.getCurrentEdge().getNature() & nat != 0):
|
||||
count=0
|
||||
while(it.isEnd() == 0):
|
||||
ve = it.getObject()
|
||||
if(ve.getNature() & nat != 0):
|
||||
count = count+1
|
||||
winner = ve
|
||||
if(it.isIncoming() == 0):
|
||||
winnerOrientation = 1
|
||||
else:
|
||||
winnerOrientation = 0
|
||||
it.increment()
|
||||
if(count != 1):
|
||||
winner = None
|
||||
break
|
||||
if(winner != None):
|
||||
# check whether this edge was part of the selection
|
||||
if(winner.getTimeStamp() != GetTimeStampCF()):
|
||||
#print "---", winner.getId().getFirst(), winner.getId().getSecond()
|
||||
# if not, let's check whether it's short enough with
|
||||
# respect to the chain made without staying in the selection
|
||||
#------------------------------------------------------------
|
||||
# Did we compute the prospective chain length already ?
|
||||
if(self._length == 0):
|
||||
#if not, let's do it
|
||||
_it = pyChainSilhouetteGenericIterator(0,0)
|
||||
_it.setBegin(winner)
|
||||
_it.setCurrentEdge(winner)
|
||||
_it.setOrientation(winnerOrientation)
|
||||
_it.init()
|
||||
while(_it.isEnd() == 0):
|
||||
ve = _it.getObject()
|
||||
#print "--------", ve.getId().getFirst(), ve.getId().getSecond()
|
||||
self._length = self._length + ve.getLength2D()
|
||||
_it.increment()
|
||||
if(_it.isBegin() != 0):
|
||||
break;
|
||||
_it.setBegin(winner)
|
||||
_it.setCurrentEdge(winner)
|
||||
_it.setOrientation(winnerOrientation)
|
||||
if(_it.isBegin() == 0):
|
||||
_it.decrement()
|
||||
while ((_it.isEnd() == 0) and (_it.isBegin() == 0)):
|
||||
ve = _it.getObject()
|
||||
#print "--------", ve.getId().getFirst(), ve.getId().getSecond()
|
||||
self._length = self._length + ve.getLength2D()
|
||||
_it.decrement()
|
||||
|
||||
# let's do the comparison:
|
||||
# nw let's compute the length of this connex non selected part:
|
||||
connexl = 0
|
||||
_cit = pyChainSilhouetteGenericIterator(0,0)
|
||||
_cit.setBegin(winner)
|
||||
_cit.setCurrentEdge(winner)
|
||||
_cit.setOrientation(winnerOrientation)
|
||||
_cit.init()
|
||||
while((_cit.isEnd() == 0) and (_cit.getObject().getTimeStamp() != GetTimeStampCF())):
|
||||
ve = _cit.getObject()
|
||||
#print "-------- --------", ve.getId().getFirst(), ve.getId().getSecond()
|
||||
connexl = connexl + ve.getLength2D()
|
||||
_cit.increment()
|
||||
if(connexl > self._percent * self._length):
|
||||
winner = None
|
||||
return winner
|
||||
|
||||
## Chaining iterator that fills small occlusions
|
||||
## size
|
||||
## The max length of the occluded part
|
||||
## expressed in pixels
|
||||
class pyFillOcclusionsAbsoluteChainingIterator(ChainingIterator):
|
||||
def __init__(self, length):
|
||||
ChainingIterator.__init__(self, 0, 1,None,1)
|
||||
self._length = float(length)
|
||||
def getExactTypeName(self):
|
||||
return "pySmallFillOcclusionsChainingIterator"
|
||||
def traverse(self, iter):
|
||||
winner = None
|
||||
winnerOrientation = 0
|
||||
#print self.getCurrentEdge().getId().getFirst(), self.getCurrentEdge().getId().getSecond()
|
||||
it = AdjacencyIterator(iter)
|
||||
nextVertex = self.getVertex()
|
||||
if(nextVertex.getNature() & T_VERTEX != 0):
|
||||
tvertex = nextVertex.castToTVertex()
|
||||
mateVE = tvertex.mate(self.getCurrentEdge())
|
||||
while(it.isEnd() == 0):
|
||||
ve = it.getObject()
|
||||
if(ve.getId() == mateVE.getId() ):
|
||||
winner = ve
|
||||
if(it.isIncoming() == 0):
|
||||
winnerOrientation = 1
|
||||
else:
|
||||
winnerOrientation = 0
|
||||
break
|
||||
it.increment()
|
||||
else:
|
||||
## case of NonTVertex
|
||||
natures = [SILHOUETTE,BORDER,CREASE,SUGGESTIVE_CONTOUR,VALLEY,RIDGE]
|
||||
for nat in natures:
|
||||
if(self.getCurrentEdge().getNature() & nat != 0):
|
||||
count=0
|
||||
while(it.isEnd() == 0):
|
||||
ve = it.getObject()
|
||||
if(ve.getNature() & nat != 0):
|
||||
count = count+1
|
||||
winner = ve
|
||||
if(it.isIncoming() == 0):
|
||||
winnerOrientation = 1
|
||||
else:
|
||||
winnerOrientation = 0
|
||||
it.increment()
|
||||
if(count != 1):
|
||||
winner = None
|
||||
break
|
||||
if(winner != None):
|
||||
# check whether this edge was part of the selection
|
||||
if(winner.getTimeStamp() != GetTimeStampCF()):
|
||||
#print "---", winner.getId().getFirst(), winner.getId().getSecond()
|
||||
# nw let's compute the length of this connex non selected part:
|
||||
connexl = 0
|
||||
_cit = pyChainSilhouetteGenericIterator(0,0)
|
||||
_cit.setBegin(winner)
|
||||
_cit.setCurrentEdge(winner)
|
||||
_cit.setOrientation(winnerOrientation)
|
||||
_cit.init()
|
||||
while((_cit.isEnd() == 0) and (_cit.getObject().getTimeStamp() != GetTimeStampCF())):
|
||||
ve = _cit.getObject()
|
||||
#print "-------- --------", ve.getId().getFirst(), ve.getId().getSecond()
|
||||
connexl = connexl + ve.getLength2D()
|
||||
_cit.increment()
|
||||
if(connexl > self._length):
|
||||
winner = None
|
||||
return winner
|
||||
|
||||
|
||||
## Chaining iterator that fills small occlusions
|
||||
## percent
|
||||
## The max length of the occluded part
|
||||
## expressed in % of the total chain length
|
||||
class pyFillOcclusionsAbsoluteAndRelativeChainingIterator(ChainingIterator):
|
||||
def __init__(self, percent, l):
|
||||
ChainingIterator.__init__(self, 0, 1,None,1)
|
||||
self._length = 0
|
||||
self._absLength = l
|
||||
self._percent = float(percent)
|
||||
def getExactTypeName(self):
|
||||
return "pyFillOcclusionsChainingIterator"
|
||||
def init(self):
|
||||
# each time we're evaluating a chain length
|
||||
# we try to do it once. Thus we reinit
|
||||
# the chain length here:
|
||||
self._length = 0
|
||||
def traverse(self, iter):
|
||||
winner = None
|
||||
winnerOrientation = 0
|
||||
print self.getCurrentEdge().getId().getFirst(), self.getCurrentEdge().getId().getSecond()
|
||||
it = AdjacencyIterator(iter)
|
||||
nextVertex = self.getVertex()
|
||||
if(nextVertex.getNature() & T_VERTEX != 0):
|
||||
tvertex = nextVertex.castToTVertex()
|
||||
mateVE = tvertex.mate(self.getCurrentEdge())
|
||||
while(it.isEnd() == 0):
|
||||
ve = it.getObject()
|
||||
if(ve.getId() == mateVE.getId() ):
|
||||
winner = ve
|
||||
if(it.isIncoming() == 0):
|
||||
winnerOrientation = 1
|
||||
else:
|
||||
winnerOrientation = 0
|
||||
break
|
||||
it.increment()
|
||||
else:
|
||||
## case of NonTVertex
|
||||
natures = [SILHOUETTE,BORDER,CREASE,SUGGESTIVE_CONTOUR,VALLEY,RIDGE]
|
||||
for nat in natures:
|
||||
if(self.getCurrentEdge().getNature() & nat != 0):
|
||||
count=0
|
||||
while(it.isEnd() == 0):
|
||||
ve = it.getObject()
|
||||
if(ve.getNature() & nat != 0):
|
||||
count = count+1
|
||||
winner = ve
|
||||
if(it.isIncoming() == 0):
|
||||
winnerOrientation = 1
|
||||
else:
|
||||
winnerOrientation = 0
|
||||
it.increment()
|
||||
if(count != 1):
|
||||
winner = None
|
||||
break
|
||||
if(winner != None):
|
||||
# check whether this edge was part of the selection
|
||||
if(winner.getTimeStamp() != GetTimeStampCF()):
|
||||
#print "---", winner.getId().getFirst(), winner.getId().getSecond()
|
||||
# if not, let's check whether it's short enough with
|
||||
# respect to the chain made without staying in the selection
|
||||
#------------------------------------------------------------
|
||||
# Did we compute the prospective chain length already ?
|
||||
if(self._length == 0):
|
||||
#if not, let's do it
|
||||
_it = pyChainSilhouetteGenericIterator(0,0)
|
||||
_it.setBegin(winner)
|
||||
_it.setCurrentEdge(winner)
|
||||
_it.setOrientation(winnerOrientation)
|
||||
_it.init()
|
||||
while(_it.isEnd() == 0):
|
||||
ve = _it.getObject()
|
||||
#print "--------", ve.getId().getFirst(), ve.getId().getSecond()
|
||||
self._length = self._length + ve.getLength2D()
|
||||
_it.increment()
|
||||
if(_it.isBegin() != 0):
|
||||
break;
|
||||
_it.setBegin(winner)
|
||||
_it.setCurrentEdge(winner)
|
||||
_it.setOrientation(winnerOrientation)
|
||||
if(_it.isBegin() == 0):
|
||||
_it.decrement()
|
||||
while ((_it.isEnd() == 0) and (_it.isBegin() == 0)):
|
||||
ve = _it.getObject()
|
||||
#print "--------", ve.getId().getFirst(), ve.getId().getSecond()
|
||||
self._length = self._length + ve.getLength2D()
|
||||
_it.decrement()
|
||||
|
||||
# let's do the comparison:
|
||||
# nw let's compute the length of this connex non selected part:
|
||||
connexl = 0
|
||||
_cit = pyChainSilhouetteGenericIterator(0,0)
|
||||
_cit.setBegin(winner)
|
||||
_cit.setCurrentEdge(winner)
|
||||
_cit.setOrientation(winnerOrientation)
|
||||
_cit.init()
|
||||
while((_cit.isEnd() == 0) and (_cit.getObject().getTimeStamp() != GetTimeStampCF())):
|
||||
ve = _cit.getObject()
|
||||
#print "-------- --------", ve.getId().getFirst(), ve.getId().getSecond()
|
||||
connexl = connexl + ve.getLength2D()
|
||||
_cit.increment()
|
||||
if((connexl > self._percent * self._length) or (connexl > self._absLength)):
|
||||
winner = None
|
||||
return winner
|
||||
|
||||
## Chaining iterator that fills small occlusions without caring about the
|
||||
## actual selection
|
||||
## percent
|
||||
## The max length of the occluded part
|
||||
## expressed in % of the total chain length
|
||||
class pyFillQi0AbsoluteAndRelativeChainingIterator(ChainingIterator):
|
||||
def __init__(self, percent, l):
|
||||
ChainingIterator.__init__(self, 0, 1,None,1)
|
||||
self._length = 0
|
||||
self._absLength = l
|
||||
self._percent = float(percent)
|
||||
def getExactTypeName(self):
|
||||
return "pyFillOcclusionsChainingIterator"
|
||||
def init(self):
|
||||
# each time we're evaluating a chain length
|
||||
# we try to do it once. Thus we reinit
|
||||
# the chain length here:
|
||||
self._length = 0
|
||||
def traverse(self, iter):
|
||||
winner = None
|
||||
winnerOrientation = 0
|
||||
print self.getCurrentEdge().getId().getFirst(), self.getCurrentEdge().getId().getSecond()
|
||||
it = AdjacencyIterator(iter)
|
||||
nextVertex = self.getVertex()
|
||||
if(nextVertex.getNature() & T_VERTEX != 0):
|
||||
tvertex = nextVertex.castToTVertex()
|
||||
mateVE = tvertex.mate(self.getCurrentEdge())
|
||||
while(it.isEnd() == 0):
|
||||
ve = it.getObject()
|
||||
if(ve.getId() == mateVE.getId() ):
|
||||
winner = ve
|
||||
if(it.isIncoming() == 0):
|
||||
winnerOrientation = 1
|
||||
else:
|
||||
winnerOrientation = 0
|
||||
break
|
||||
it.increment()
|
||||
else:
|
||||
## case of NonTVertex
|
||||
natures = [SILHOUETTE,BORDER,CREASE,SUGGESTIVE_CONTOUR,VALLEY,RIDGE]
|
||||
for nat in natures:
|
||||
if(self.getCurrentEdge().getNature() & nat != 0):
|
||||
count=0
|
||||
while(it.isEnd() == 0):
|
||||
ve = it.getObject()
|
||||
if(ve.getNature() & nat != 0):
|
||||
count = count+1
|
||||
winner = ve
|
||||
if(it.isIncoming() == 0):
|
||||
winnerOrientation = 1
|
||||
else:
|
||||
winnerOrientation = 0
|
||||
it.increment()
|
||||
if(count != 1):
|
||||
winner = None
|
||||
break
|
||||
if(winner != None):
|
||||
# check whether this edge was part of the selection
|
||||
if(winner.qi() != 0):
|
||||
#print "---", winner.getId().getFirst(), winner.getId().getSecond()
|
||||
# if not, let's check whether it's short enough with
|
||||
# respect to the chain made without staying in the selection
|
||||
#------------------------------------------------------------
|
||||
# Did we compute the prospective chain length already ?
|
||||
if(self._length == 0):
|
||||
#if not, let's do it
|
||||
_it = pyChainSilhouetteGenericIterator(0,0)
|
||||
_it.setBegin(winner)
|
||||
_it.setCurrentEdge(winner)
|
||||
_it.setOrientation(winnerOrientation)
|
||||
_it.init()
|
||||
while(_it.isEnd() == 0):
|
||||
ve = _it.getObject()
|
||||
#print "--------", ve.getId().getFirst(), ve.getId().getSecond()
|
||||
self._length = self._length + ve.getLength2D()
|
||||
_it.increment()
|
||||
if(_it.isBegin() != 0):
|
||||
break;
|
||||
_it.setBegin(winner)
|
||||
_it.setCurrentEdge(winner)
|
||||
_it.setOrientation(winnerOrientation)
|
||||
if(_it.isBegin() == 0):
|
||||
_it.decrement()
|
||||
while ((_it.isEnd() == 0) and (_it.isBegin() == 0)):
|
||||
ve = _it.getObject()
|
||||
#print "--------", ve.getId().getFirst(), ve.getId().getSecond()
|
||||
self._length = self._length + ve.getLength2D()
|
||||
_it.decrement()
|
||||
|
||||
# let's do the comparison:
|
||||
# nw let's compute the length of this connex non selected part:
|
||||
connexl = 0
|
||||
_cit = pyChainSilhouetteGenericIterator(0,0)
|
||||
_cit.setBegin(winner)
|
||||
_cit.setCurrentEdge(winner)
|
||||
_cit.setOrientation(winnerOrientation)
|
||||
_cit.init()
|
||||
while((_cit.isEnd() == 0) and (_cit.getObject().qi() != 0)):
|
||||
ve = _cit.getObject()
|
||||
#print "-------- --------", ve.getId().getFirst(), ve.getId().getSecond()
|
||||
connexl = connexl + ve.getLength2D()
|
||||
_cit.increment()
|
||||
if((connexl > self._percent * self._length) or (connexl > self._absLength)):
|
||||
winner = None
|
||||
return winner
|
||||
|
||||
|
||||
## the natural chaining iterator
|
||||
## It follows the edges of same nature on the same
|
||||
## objects with preseance on silhouettes, then borders,
|
||||
## then suggestive contours, then everything else. It doesn't chain the same ViewEdge twice
|
||||
## You can specify whether to stay in the selection or not.
|
||||
class pyNoIdChainSilhouetteIterator(ChainingIterator):
|
||||
def __init__(self, stayInSelection=1):
|
||||
ChainingIterator.__init__(self, stayInSelection, 1,None,1)
|
||||
def getExactTypeName(self):
|
||||
return "pyChainSilhouetteIterator"
|
||||
def traverse(self, iter):
|
||||
winner = None
|
||||
it = AdjacencyIterator(iter)
|
||||
nextVertex = self.getVertex()
|
||||
if(nextVertex.getNature() & T_VERTEX != 0):
|
||||
tvertex = nextVertex.castToTVertex()
|
||||
mateVE = tvertex.mate(self.getCurrentEdge())
|
||||
while(it.isEnd() == 0):
|
||||
ve = it.getObject()
|
||||
feB = self.getCurrentEdge().fedgeB()
|
||||
feA = ve.fedgeA()
|
||||
vB = feB.vertexB()
|
||||
vA = feA.vertexA()
|
||||
if vA.getId().getFirst() == vB.getId().getFirst():
|
||||
winner = ve
|
||||
break
|
||||
feA = self.getCurrentEdge().fedgeA()
|
||||
feB = ve.fedgeB()
|
||||
vB = feB.vertexB()
|
||||
vA = feA.vertexA()
|
||||
if vA.getId().getFirst() == vB.getId().getFirst():
|
||||
winner = ve
|
||||
break
|
||||
feA = self.getCurrentEdge().fedgeB()
|
||||
feB = ve.fedgeB()
|
||||
vB = feB.vertexB()
|
||||
vA = feA.vertexB()
|
||||
if vA.getId().getFirst() == vB.getId().getFirst():
|
||||
winner = ve
|
||||
break
|
||||
feA = self.getCurrentEdge().fedgeA()
|
||||
feB = ve.fedgeA()
|
||||
vB = feB.vertexA()
|
||||
vA = feA.vertexA()
|
||||
if vA.getId().getFirst() == vB.getId().getFirst():
|
||||
winner = ve
|
||||
break
|
||||
it.increment()
|
||||
else:
|
||||
## case of NonTVertex
|
||||
natures = [SILHOUETTE,BORDER,CREASE,SUGGESTIVE_CONTOUR,VALLEY,RIDGE]
|
||||
for i in range(len(natures)):
|
||||
currentNature = self.getCurrentEdge().getNature()
|
||||
if(natures[i] & currentNature):
|
||||
count=0
|
||||
while(it.isEnd() == 0):
|
||||
visitNext = 0
|
||||
oNature = it.getObject().getNature()
|
||||
if(oNature & natures[i] != 0):
|
||||
if(natures[i] != oNature):
|
||||
for j in range(i):
|
||||
if(natures[j] & oNature != 0):
|
||||
visitNext = 1
|
||||
break
|
||||
if(visitNext != 0):
|
||||
break
|
||||
count = count+1
|
||||
winner = it.getObject()
|
||||
it.increment()
|
||||
if(count != 1):
|
||||
winner = None
|
||||
break
|
||||
return winner
|
||||
|
||||
81
source/blender/freestyle/style_modules_blender/Functions0D.py
Executable file
81
source/blender/freestyle/style_modules_blender/Functions0D.py
Executable file
@@ -0,0 +1,81 @@
|
||||
from Blender.Freestyle import *
|
||||
|
||||
|
||||
class pyInverseCurvature2DAngleF0D(UnaryFunction0DDouble):
|
||||
def getName(self):
|
||||
return "InverseCurvature2DAngleF0D"
|
||||
|
||||
def __call__(self, inter):
|
||||
func = Curvature2DAngleF0D()
|
||||
c = func(inter)
|
||||
return (3.1415 - c)
|
||||
|
||||
class pyCurvilinearLengthF0D(UnaryFunction0DDouble):
|
||||
def getName(self):
|
||||
return "CurvilinearLengthF0D"
|
||||
|
||||
def __call__(self, inter):
|
||||
i0d = inter.getObject()
|
||||
s = i0d.getExactTypeName()
|
||||
if (string.find(s, "CurvePoint") == -1):
|
||||
print "CurvilinearLengthF0D: not implemented yet for %s" % (s)
|
||||
return -1
|
||||
cp = castToCurvePoint(i0d)
|
||||
return cp.t2d()
|
||||
|
||||
## estimate anisotropy of density
|
||||
class pyDensityAnisotropyF0D(UnaryFunction0DDouble):
|
||||
def __init__(self,level):
|
||||
UnaryFunction0DDouble.__init__(self)
|
||||
self.IsoDensity = ReadCompleteViewMapPixelF0D(level)
|
||||
self.d0Density = ReadSteerableViewMapPixelF0D(0, level)
|
||||
self.d1Density = ReadSteerableViewMapPixelF0D(1, level)
|
||||
self.d2Density = ReadSteerableViewMapPixelF0D(2, level)
|
||||
self.d3Density = ReadSteerableViewMapPixelF0D(3, level)
|
||||
def getName(self):
|
||||
return "pyDensityAnisotropyF0D"
|
||||
def __call__(self, inter):
|
||||
c_iso = self.IsoDensity(inter)
|
||||
c_0 = self.d0Density(inter)
|
||||
c_1 = self.d1Density(inter)
|
||||
c_2 = self.d2Density(inter)
|
||||
c_3 = self.d3Density(inter)
|
||||
cMax = max( max(c_0,c_1), max(c_2,c_3))
|
||||
cMin = min( min(c_0,c_1), min(c_2,c_3))
|
||||
if ( c_iso == 0 ):
|
||||
v = 0
|
||||
else:
|
||||
v = (cMax-cMin)/c_iso
|
||||
return (v)
|
||||
|
||||
## Returns the gradient vector for a pixel
|
||||
## l
|
||||
## the level at which one wants to compute the gradient
|
||||
class pyViewMapGradientVectorF0D(UnaryFunction0DVec2f):
|
||||
def __init__(self, l):
|
||||
UnaryFunction0DVec2f.__init__(self)
|
||||
self._l = l
|
||||
self._step = pow(2,self._l)
|
||||
def getName(self):
|
||||
return "pyViewMapGradientVectorF0D"
|
||||
def __call__(self, iter):
|
||||
p = iter.getObject().getPoint2D()
|
||||
gx = ReadCompleteViewMapPixelCF(self._l, int(p.x()+self._step), int(p.y()))- ReadCompleteViewMapPixelCF(self._l, int(p.x()), int(p.y()))
|
||||
gy = ReadCompleteViewMapPixelCF(self._l, int(p.x()), int(p.y()+self._step))- ReadCompleteViewMapPixelCF(self._l, int(p.x()), int(p.y()))
|
||||
return Vec2f(gx, gy)
|
||||
|
||||
class pyViewMapGradientNormF0D(UnaryFunction0DDouble):
|
||||
def __init__(self, l):
|
||||
UnaryFunction0DDouble.__init__(self)
|
||||
self._l = l
|
||||
self._step = pow(2,self._l)
|
||||
def getName(self):
|
||||
return "pyViewMapGradientNormF0D"
|
||||
def __call__(self, iter):
|
||||
p = iter.getObject().getPoint2D()
|
||||
gx = ReadCompleteViewMapPixelCF(self._l, int(p.x()+self._step), int(p.y()))- ReadCompleteViewMapPixelCF(self._l, int(p.x()), int(p.y()))
|
||||
gy = ReadCompleteViewMapPixelCF(self._l, int(p.x()), int(p.y()+self._step))- ReadCompleteViewMapPixelCF(self._l, int(p.x()), int(p.y()))
|
||||
grad = Vec2f(gx, gy)
|
||||
return grad.norm()
|
||||
|
||||
|
||||
45
source/blender/freestyle/style_modules_blender/Functions1D.py
Executable file
45
source/blender/freestyle/style_modules_blender/Functions1D.py
Executable file
@@ -0,0 +1,45 @@
|
||||
from Blender.Freestyle import *
|
||||
from Functions0D import *
|
||||
import string
|
||||
|
||||
class pyGetInverseProjectedZF1D(UnaryFunction1DDouble):
|
||||
def getName(self):
|
||||
return "pyGetInverseProjectedZF1D"
|
||||
|
||||
def __call__(self, inter):
|
||||
func = GetProjectedZF1D()
|
||||
z = func(inter)
|
||||
return (1.0 - z)
|
||||
|
||||
class pyGetSquareInverseProjectedZF1D(UnaryFunction1DDouble):
|
||||
def getName(self):
|
||||
return "pyGetInverseProjectedZF1D"
|
||||
|
||||
def __call__(self, inter):
|
||||
func = GetProjectedZF1D()
|
||||
z = func(inter)
|
||||
return (1.0 - z*z)
|
||||
|
||||
class pyDensityAnisotropyF1D(UnaryFunction1DDouble):
|
||||
def __init__(self,level, integrationType=IntegrationType.MEAN, sampling=2.0):
|
||||
UnaryFunction1DDouble.__init__(self, integrationType)
|
||||
self._func = pyDensityAnisotropyF0D(level)
|
||||
self._integration = integrationType
|
||||
self._sampling = sampling
|
||||
def getName(self):
|
||||
return "pyDensityAnisotropyF1D"
|
||||
def __call__(self, inter):
|
||||
v = integrateDouble(self._func, inter.pointsBegin(self._sampling), inter.pointsEnd(self._sampling), self._integration)
|
||||
return v
|
||||
|
||||
class pyViewMapGradientNormF1D(UnaryFunction1DDouble):
|
||||
def __init__(self,l, integrationType, sampling=2.0):
|
||||
UnaryFunction1DDouble.__init__(self, integrationType)
|
||||
self._func = pyViewMapGradientNormF0D(l)
|
||||
self._integration = integrationType
|
||||
self._sampling = sampling
|
||||
def getName(self):
|
||||
return "pyViewMapGradientNormF1D"
|
||||
def __call__(self, inter):
|
||||
v = integrateDouble(self._func, inter.pointsBegin(self._sampling), inter.pointsEnd(self._sampling), self._integration)
|
||||
return v
|
||||
70
source/blender/freestyle/style_modules_blender/PredicatesB1D.py
Executable file
70
source/blender/freestyle/style_modules_blender/PredicatesB1D.py
Executable file
@@ -0,0 +1,70 @@
|
||||
from Blender.Freestyle import *
|
||||
from Functions1D import *
|
||||
from random import *
|
||||
|
||||
class pyZBP1D(BinaryPredicate1D):
|
||||
def getName(self):
|
||||
return "pyZBP1D"
|
||||
|
||||
def __call__(self, i1, i2):
|
||||
func = GetZF1D()
|
||||
return (func(i1) > func(i2))
|
||||
|
||||
class pyZDiscontinuityBP1D(BinaryPredicate1D):
|
||||
def __init__(self, iType = IntegrationType.MEAN):
|
||||
BinaryPredicate1D.__init__(self)
|
||||
self._GetZDiscontinuity = ZDiscontinuityF1D(iType)
|
||||
|
||||
def getName(self):
|
||||
return "pyZDiscontinuityBP1D"
|
||||
|
||||
def __call__(self, i1, i2):
|
||||
return (self._GetZDiscontinuity(i1) > self._GetZDiscontinuity(i2))
|
||||
|
||||
class pyLengthBP1D(BinaryPredicate1D):
|
||||
def getName(self):
|
||||
return "LengthBP1D"
|
||||
|
||||
def __call__(self, i1, i2):
|
||||
return (i1.getLength2D() > i2.getLength2D())
|
||||
|
||||
class pySilhouetteFirstBP1D(BinaryPredicate1D):
|
||||
def getName(self):
|
||||
return "SilhouetteFirstBP1D"
|
||||
|
||||
def __call__(self, inter1, inter2):
|
||||
bpred = SameShapeIdBP1D()
|
||||
if (bpred(inter1, inter2) != 1):
|
||||
return 0
|
||||
if (inter1.getNature() & SILHOUETTE):
|
||||
return (inter2.getNature() & SILHOUETTE)
|
||||
return (inter1.getNature() == inter2.getNature())
|
||||
|
||||
class pyNatureBP1D(BinaryPredicate1D):
|
||||
def getName(self):
|
||||
return "NatureBP1D"
|
||||
|
||||
def __call__(self, inter1, inter2):
|
||||
return (inter1.getNature() & inter2.getNature())
|
||||
|
||||
class pyViewMapGradientNormBP1D(BinaryPredicate1D):
|
||||
def __init__(self,l, sampling=2.0):
|
||||
BinaryPredicate1D.__init__(self)
|
||||
self._GetGradient = pyViewMapGradientNormF1D(l, IntegrationType.MEAN)
|
||||
def getName(self):
|
||||
return "pyViewMapGradientNormBP1D"
|
||||
def __call__(self, i1,i2):
|
||||
print "compare gradient"
|
||||
return (self._GetGradient(i1) > self._GetGradient(i2))
|
||||
|
||||
class pyShuffleBP1D(BinaryPredicate1D):
|
||||
def __init__(self):
|
||||
BinaryPredicate1D.__init__(self)
|
||||
seed(1)
|
||||
def getName(self):
|
||||
return "pyNearAndContourFirstBP1D"
|
||||
|
||||
def __call__(self, inter1, inter2):
|
||||
r1 = uniform(0,1)
|
||||
r2 = uniform(0,1)
|
||||
return (r1<r2)
|
||||
103
source/blender/freestyle/style_modules_blender/PredicatesU0D.py
Executable file
103
source/blender/freestyle/style_modules_blender/PredicatesU0D.py
Executable file
@@ -0,0 +1,103 @@
|
||||
from Blender.Freestyle import *
|
||||
from Functions0D import *
|
||||
|
||||
class pyHigherCurvature2DAngleUP0D(UnaryPredicate0D):
|
||||
def __init__(self,a):
|
||||
UnaryPredicate0D.__init__(self)
|
||||
self._a = a
|
||||
|
||||
def getName(self):
|
||||
return "HigherCurvature2DAngleUP0D"
|
||||
|
||||
def __call__(self, inter):
|
||||
func = Curvature2DAngleF0D()
|
||||
a = func(inter)
|
||||
return ( a > self._a)
|
||||
|
||||
class pyUEqualsUP0D(UnaryPredicate0D):
|
||||
def __init__(self,u, w):
|
||||
UnaryPredicate0D.__init__(self)
|
||||
self._u = u
|
||||
self._w = w
|
||||
|
||||
def getName(self):
|
||||
return "UEqualsUP0D"
|
||||
|
||||
def __call__(self, inter):
|
||||
func = pyCurvilinearLengthF0D()
|
||||
u = func(inter)
|
||||
return ( ( u > (self._u-self._w) ) and ( u < (self._u+self._w) ) )
|
||||
|
||||
class pyVertexNatureUP0D(UnaryPredicate0D):
|
||||
def __init__(self,nature):
|
||||
UnaryPredicate0D.__init__(self)
|
||||
self._nature = nature
|
||||
|
||||
def getName(self):
|
||||
return "pyVertexNatureUP0D"
|
||||
|
||||
def __call__(self, inter):
|
||||
v = inter.getObject()
|
||||
nat = v.getNature()
|
||||
if(nat & self._nature):
|
||||
return 1;
|
||||
return 0
|
||||
|
||||
## check whether an Interface0DIterator
|
||||
## is a TVertex and is the one that is
|
||||
## hidden (inferred from the context)
|
||||
class pyBackTVertexUP0D(UnaryPredicate0D):
|
||||
def __init__(self):
|
||||
UnaryPredicate0D.__init__(self)
|
||||
self._getQI = QuantitativeInvisibilityF0D()
|
||||
def getName(self):
|
||||
return "pyBackTVertexUP0D"
|
||||
def __call__(self, iter):
|
||||
v = iter.getObject()
|
||||
nat = v.getNature()
|
||||
if(nat & T_VERTEX == 0):
|
||||
return 0
|
||||
next = iter
|
||||
if(next.isEnd()):
|
||||
return 0
|
||||
if(self._getQI(next) != 0):
|
||||
return 1
|
||||
return 0
|
||||
|
||||
class pyParameterUP0DGoodOne(UnaryPredicate0D):
|
||||
def __init__(self,pmin,pmax):
|
||||
UnaryPredicate0D.__init__(self)
|
||||
self._m = pmin
|
||||
self._M = pmax
|
||||
#self.getCurvilinearAbscissa = GetCurvilinearAbscissaF0D()
|
||||
|
||||
def getName(self):
|
||||
return "pyCurvilinearAbscissaHigherThanUP0D"
|
||||
|
||||
def __call__(self, inter):
|
||||
#s = self.getCurvilinearAbscissa(inter)
|
||||
u = inter.u()
|
||||
#print u
|
||||
return ((u>=self._m) and (u<=self._M))
|
||||
|
||||
class pyParameterUP0D(UnaryPredicate0D):
|
||||
def __init__(self,pmin,pmax):
|
||||
UnaryPredicate0D.__init__(self)
|
||||
self._m = pmin
|
||||
self._M = pmax
|
||||
#self.getCurvilinearAbscissa = GetCurvilinearAbscissaF0D()
|
||||
|
||||
def getName(self):
|
||||
return "pyCurvilinearAbscissaHigherThanUP0D"
|
||||
|
||||
def __call__(self, inter):
|
||||
func = Curvature2DAngleF0D()
|
||||
c = func(inter)
|
||||
b1 = (c>0.1)
|
||||
#s = self.getCurvilinearAbscissa(inter)
|
||||
u = inter.u()
|
||||
#print u
|
||||
b = ((u>=self._m) and (u<=self._M))
|
||||
return b and b1
|
||||
|
||||
|
||||
381
source/blender/freestyle/style_modules_blender/PredicatesU1D.py
Executable file
381
source/blender/freestyle/style_modules_blender/PredicatesU1D.py
Executable file
@@ -0,0 +1,381 @@
|
||||
from Blender.Freestyle import *
|
||||
from Functions1D import *
|
||||
|
||||
count = 0
|
||||
class pyNFirstUP1D(UnaryPredicate1D):
|
||||
def __init__(self, n):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self.__n = n
|
||||
def __call__(self, inter):
|
||||
global count
|
||||
count = count + 1
|
||||
if count <= self.__n:
|
||||
return 1
|
||||
return 0
|
||||
|
||||
class pyHigherLengthUP1D(UnaryPredicate1D):
|
||||
def __init__(self,l):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self._l = l
|
||||
|
||||
def getName(self):
|
||||
return "HigherLengthUP1D"
|
||||
|
||||
def __call__(self, inter):
|
||||
return (inter.getLength2D() > self._l)
|
||||
|
||||
class pyNatureUP1D(UnaryPredicate1D):
|
||||
def __init__(self,nature):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self._nature = nature
|
||||
self._getNature = CurveNatureF1D()
|
||||
|
||||
def getName(self):
|
||||
return "pyNatureUP1D"
|
||||
|
||||
def __call__(self, inter):
|
||||
if(self._getNature(inter) & self._nature):
|
||||
return 1
|
||||
return 0
|
||||
|
||||
class pyHigherNumberOfTurnsUP1D(UnaryPredicate1D):
|
||||
def __init__(self,n,a):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self._n = n
|
||||
self._a = a
|
||||
|
||||
def getName(self):
|
||||
return "HigherNumberOfTurnsUP1D"
|
||||
|
||||
def __call__(self, inter):
|
||||
count = 0
|
||||
func = Curvature2DAngleF0D()
|
||||
it = inter.verticesBegin()
|
||||
while(it.isEnd() == 0):
|
||||
if(func(it) > self._a):
|
||||
count = count+1
|
||||
if(count > self._n):
|
||||
return 1
|
||||
it.increment()
|
||||
return 0
|
||||
|
||||
class pyDensityUP1D(UnaryPredicate1D):
|
||||
def __init__(self,wsize,threshold, integration = IntegrationType.MEAN, sampling=2.0):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self._wsize = wsize
|
||||
self._threshold = threshold
|
||||
self._integration = integration
|
||||
self._func = DensityF1D(self._wsize, self._integration, sampling)
|
||||
|
||||
def getName(self):
|
||||
return "pyDensityUP1D"
|
||||
|
||||
def __call__(self, inter):
|
||||
if(self._func(inter) < self._threshold):
|
||||
return 1
|
||||
return 0
|
||||
|
||||
class pyLowSteerableViewMapDensityUP1D(UnaryPredicate1D):
|
||||
def __init__(self,threshold, level,integration = IntegrationType.MEAN):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self._threshold = threshold
|
||||
self._level = level
|
||||
self._integration = integration
|
||||
|
||||
def getName(self):
|
||||
return "pyLowSteerableViewMapDensityUP1D"
|
||||
|
||||
def __call__(self, inter):
|
||||
func = GetSteerableViewMapDensityF1D(self._level, self._integration)
|
||||
v = func(inter)
|
||||
print v
|
||||
if(v < self._threshold):
|
||||
return 1
|
||||
return 0
|
||||
|
||||
class pyLowDirectionalViewMapDensityUP1D(UnaryPredicate1D):
|
||||
def __init__(self,threshold, orientation, level,integration = IntegrationType.MEAN):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self._threshold = threshold
|
||||
self._orientation = orientation
|
||||
self._level = level
|
||||
self._integration = integration
|
||||
|
||||
def getName(self):
|
||||
return "pyLowDirectionalViewMapDensityUP1D"
|
||||
|
||||
def __call__(self, inter):
|
||||
func = GetDirectionalViewMapDensityF1D(self._orientation, self._level, self._integration)
|
||||
v = func(inter)
|
||||
#print v
|
||||
if(v < self._threshold):
|
||||
return 1
|
||||
return 0
|
||||
|
||||
class pyHighSteerableViewMapDensityUP1D(UnaryPredicate1D):
|
||||
def __init__(self,threshold, level,integration = IntegrationType.MEAN):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self._threshold = threshold
|
||||
self._level = level
|
||||
self._integration = integration
|
||||
self._func = GetSteerableViewMapDensityF1D(self._level, self._integration)
|
||||
def getName(self):
|
||||
return "pyHighSteerableViewMapDensityUP1D"
|
||||
|
||||
def __call__(self, inter):
|
||||
|
||||
v = self._func(inter)
|
||||
if(v > self._threshold):
|
||||
return 1
|
||||
return 0
|
||||
|
||||
class pyHighDirectionalViewMapDensityUP1D(UnaryPredicate1D):
|
||||
def __init__(self,threshold, orientation, level,integration = IntegrationType.MEAN, sampling=2.0):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self._threshold = threshold
|
||||
self._orientation = orientation
|
||||
self._level = level
|
||||
self._integration = integration
|
||||
self._sampling = sampling
|
||||
def getName(self):
|
||||
return "pyLowDirectionalViewMapDensityUP1D"
|
||||
|
||||
def __call__(self, inter):
|
||||
func = GetDirectionalViewMapDensityF1D(self._orientation, self._level, self._integration, self._sampling)
|
||||
v = func(inter)
|
||||
if(v > self._threshold):
|
||||
return 1
|
||||
return 0
|
||||
|
||||
class pyHighViewMapDensityUP1D(UnaryPredicate1D):
|
||||
def __init__(self,threshold, level,integration = IntegrationType.MEAN, sampling=2.0):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self._threshold = threshold
|
||||
self._level = level
|
||||
self._integration = integration
|
||||
self._sampling = sampling
|
||||
self._func = GetCompleteViewMapDensityF1D(self._level, self._integration, self._sampling) # 2.0 is the smpling
|
||||
|
||||
def getName(self):
|
||||
return "pyHighViewMapDensityUP1D"
|
||||
|
||||
def __call__(self, inter):
|
||||
#print "toto"
|
||||
#print func.getName()
|
||||
#print inter.getExactTypeName()
|
||||
v= self._func(inter)
|
||||
if(v > self._threshold):
|
||||
return 1
|
||||
return 0
|
||||
|
||||
class pyDensityFunctorUP1D(UnaryPredicate1D):
|
||||
def __init__(self,wsize,threshold, functor, funcmin=0.0, funcmax=1.0, integration = IntegrationType.MEAN):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self._wsize = wsize
|
||||
self._threshold = float(threshold)
|
||||
self._functor = functor
|
||||
self._funcmin = float(funcmin)
|
||||
self._funcmax = float(funcmax)
|
||||
self._integration = integration
|
||||
|
||||
def getName(self):
|
||||
return "pyDensityFunctorUP1D"
|
||||
|
||||
def __call__(self, inter):
|
||||
func = DensityF1D(self._wsize, self._integration)
|
||||
res = self._functor(inter)
|
||||
k = (res-self._funcmin)/(self._funcmax-self._funcmin)
|
||||
if(func(inter) < self._threshold*k):
|
||||
return 1
|
||||
return 0
|
||||
|
||||
class pyZSmallerUP1D(UnaryPredicate1D):
|
||||
def __init__(self,z, integration=IntegrationType.MEAN):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self._z = z
|
||||
self._integration = integration
|
||||
def getName(self):
|
||||
return "pyZSmallerUP1D"
|
||||
|
||||
def __call__(self, inter):
|
||||
func = GetProjectedZF1D(self._integration)
|
||||
if(func(inter) < self._z):
|
||||
return 1
|
||||
return 0
|
||||
|
||||
class pyIsOccludedByUP1D(UnaryPredicate1D):
|
||||
def __init__(self,id):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self._id = id
|
||||
def getName(self):
|
||||
return "pyIsOccludedByUP1D"
|
||||
def __call__(self, inter):
|
||||
func = GetShapeF1D()
|
||||
shapes = func(inter)
|
||||
for s in shapes:
|
||||
if(s.getId() == self._id):
|
||||
return 0
|
||||
it = inter.verticesBegin()
|
||||
itlast = inter.verticesEnd()
|
||||
itlast.decrement()
|
||||
v = it.getObject()
|
||||
vlast = itlast.getObject()
|
||||
tvertex = v.castToTVertex()
|
||||
if(tvertex != None):
|
||||
#print "TVertex: [ ", tvertex.getId().getFirst(), ",", tvertex.getId().getSecond()," ]"
|
||||
eit = tvertex.edgesBegin()
|
||||
while(eit.isEnd() == 0):
|
||||
ve = eit.getObject().first
|
||||
if(ve.shape_id() == self._id):
|
||||
return 1
|
||||
#print "-------", ve.getId().getFirst(), "-", ve.getId().getSecond()
|
||||
eit.increment()
|
||||
tvertex = vlast.castToTVertex()
|
||||
if(tvertex != None):
|
||||
#print "TVertex: [ ", tvertex.getId().getFirst(), ",", tvertex.getId().getSecond()," ]"
|
||||
eit = tvertex.edgesBegin()
|
||||
while(eit.isEnd() == 0):
|
||||
ve = eit.getObject().first
|
||||
if(ve.shape_id() == self._id):
|
||||
return 1
|
||||
#print "-------", ve.getId().getFirst(), "-", ve.getId().getSecond()
|
||||
eit.increment()
|
||||
return 0
|
||||
|
||||
class pyIsInOccludersListUP1D(UnaryPredicate1D):
|
||||
def __init__(self,id):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self._id = id
|
||||
def getName(self):
|
||||
return "pyIsInOccludersListUP1D"
|
||||
def __call__(self, inter):
|
||||
func = GetOccludersF1D()
|
||||
occluders = func(inter)
|
||||
for a in occluders:
|
||||
if(a.getId() == self._id):
|
||||
return 1
|
||||
return 0
|
||||
|
||||
class pyIsOccludedByItselfUP1D(UnaryPredicate1D):
|
||||
def __init__(self):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self.__func1 = GetOccludersF1D()
|
||||
self.__func2 = GetShapeF1D()
|
||||
def getName(self):
|
||||
return "pyIsOccludedByItselfUP1D"
|
||||
def __call__(self, inter):
|
||||
lst1 = self.__func1(inter)
|
||||
lst2 = self.__func2(inter)
|
||||
for vs1 in lst1:
|
||||
for vs2 in lst2:
|
||||
if vs1.getId() == vs2.getId():
|
||||
return 1
|
||||
return 0
|
||||
|
||||
class pyIsOccludedByIdListUP1D(UnaryPredicate1D):
|
||||
def __init__(self, idlist):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self._idlist = idlist
|
||||
self.__func1 = GetOccludersF1D()
|
||||
def getName(self):
|
||||
return "pyIsOccludedByIdListUP1D"
|
||||
def __call__(self, inter):
|
||||
lst1 = self.__func1(inter)
|
||||
for vs1 in lst1:
|
||||
for id in self._idlist:
|
||||
if vs1.getId() == id:
|
||||
return 1
|
||||
return 0
|
||||
|
||||
class pyShapeIdListUP1D(UnaryPredicate1D):
|
||||
def __init__(self,idlist):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self._idlist = idlist
|
||||
self._funcs = []
|
||||
for id in idlist :
|
||||
self._funcs.append(ShapeUP1D(id.getFirst(), id.getSecond()))
|
||||
|
||||
def getName(self):
|
||||
return "pyShapeIdUP1D"
|
||||
def __call__(self, inter):
|
||||
for func in self._funcs :
|
||||
if(func(inter) == 1) :
|
||||
return 1
|
||||
return 0
|
||||
|
||||
## deprecated
|
||||
class pyShapeIdUP1D(UnaryPredicate1D):
|
||||
def __init__(self,id):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self._id = id
|
||||
def getName(self):
|
||||
return "pyShapeIdUP1D"
|
||||
def __call__(self, inter):
|
||||
func = GetShapeF1D()
|
||||
shapes = func(inter)
|
||||
for a in shapes:
|
||||
if(a.getId() == self._id):
|
||||
return 1
|
||||
return 0
|
||||
|
||||
class pyHighDensityAnisotropyUP1D(UnaryPredicate1D):
|
||||
def __init__(self,threshold, level, sampling=2.0):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self._l = threshold
|
||||
self.func = pyDensityAnisotropyF1D(level, IntegrationType.MEAN, sampling)
|
||||
def getName(self):
|
||||
return "pyHighDensityAnisotropyUP1D"
|
||||
def __call__(self, inter):
|
||||
return (self.func(inter) > self._l)
|
||||
|
||||
class pyHighViewMapGradientNormUP1D(UnaryPredicate1D):
|
||||
def __init__(self,threshold, l, sampling=2.0):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self._threshold = threshold
|
||||
self._GetGradient = pyViewMapGradientNormF1D(l, IntegrationType.MEAN)
|
||||
def getName(self):
|
||||
return "pyHighViewMapGradientNormUP1D"
|
||||
def __call__(self, inter):
|
||||
gn = self._GetGradient(inter)
|
||||
#print gn
|
||||
return (gn > self._threshold)
|
||||
|
||||
class pyDensityVariableSigmaUP1D(UnaryPredicate1D):
|
||||
def __init__(self,functor, sigmaMin,sigmaMax, lmin, lmax, tmin, tmax, integration = IntegrationType.MEAN, sampling=2.0):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self._functor = functor
|
||||
self._sigmaMin = float(sigmaMin)
|
||||
self._sigmaMax = float(sigmaMax)
|
||||
self._lmin = float(lmin)
|
||||
self._lmax = float(lmax)
|
||||
self._tmin = tmin
|
||||
self._tmax = tmax
|
||||
self._integration = integration
|
||||
self._sampling = sampling
|
||||
|
||||
def getName(self):
|
||||
return "pyDensityUP1D"
|
||||
|
||||
def __call__(self, inter):
|
||||
sigma = (self._sigmaMax-self._sigmaMin)/(self._lmax-self._lmin)*(self._functor(inter)-self._lmin) + self._sigmaMin
|
||||
t = (self._tmax-self._tmin)/(self._lmax-self._lmin)*(self._functor(inter)-self._lmin) + self._tmin
|
||||
if(sigma<self._sigmaMin):
|
||||
sigma = self._sigmaMin
|
||||
self._func = DensityF1D(sigma, self._integration, self._sampling)
|
||||
d = self._func(inter)
|
||||
if(d<t):
|
||||
return 1
|
||||
return 0
|
||||
|
||||
class pyClosedCurveUP1D(UnaryPredicate1D):
|
||||
def __call__(self, inter):
|
||||
it = inter.verticesBegin()
|
||||
itlast = inter.verticesEnd()
|
||||
itlast.decrement()
|
||||
vlast = itlast.getObject()
|
||||
v = it.getObject()
|
||||
print v.getId().getFirst(), v.getId().getSecond()
|
||||
print vlast.getId().getFirst(), vlast.getId().getSecond()
|
||||
if(v.getId() == vlast.getId()):
|
||||
return 1
|
||||
return 0
|
||||
75
source/blender/freestyle/style_modules_blender/anisotropic_diffusion.py
Executable file
75
source/blender/freestyle/style_modules_blender/anisotropic_diffusion.py
Executable file
@@ -0,0 +1,75 @@
|
||||
#
|
||||
# Filename : anisotropic_diffusion.py
|
||||
# Author : Fredo Durand
|
||||
# Date : 12/08/2004
|
||||
# Purpose : Smoothes lines using an anisotropic diffusion scheme
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from shaders import *
|
||||
from vector import *
|
||||
from PredicatesU0D import *
|
||||
from math import *
|
||||
|
||||
## thickness modifiers
|
||||
|
||||
normalInfo=Normal2DF0D()
|
||||
curvatureInfo=Curvature2DAngleF0D()
|
||||
|
||||
def edgestopping(x, sigma):
|
||||
return exp(- x*x/(2*sigma*sigma))
|
||||
|
||||
class pyDiffusion2Shader(StrokeShader):
|
||||
def __init__(self, lambda1, nbIter):
|
||||
StrokeShader.__init__(self)
|
||||
self._lambda = lambda1
|
||||
self._nbIter = nbIter
|
||||
def getName(self):
|
||||
return "pyDiffusionShader"
|
||||
def shade(self, stroke):
|
||||
for i in range (1, self._nbIter):
|
||||
it = stroke.strokeVerticesBegin()
|
||||
while it.isEnd() == 0:
|
||||
v=it.getObject()
|
||||
p1 = v.getPoint()
|
||||
p2 = normalInfo(it.castToInterface0DIterator())*self._lambda*curvatureInfo(it.castToInterface0DIterator())
|
||||
v.setPoint(p1+p2)
|
||||
it.increment()
|
||||
|
||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D())
|
||||
Operators.select( upred )
|
||||
bpred = TrueBP1D();
|
||||
Operators.bidirectionalChain(ChainPredicateIterator(upred, bpred), NotUP1D(upred) )
|
||||
shaders_list = [
|
||||
ConstantThicknessShader(4),
|
||||
StrokeTextureShader("smoothAlpha.bmp", Stroke.OPAQUE_MEDIUM, 0),
|
||||
SamplingShader(2),
|
||||
pyDiffusion2Shader(-0.03, 30),
|
||||
IncreasingColorShader(1.0,0.0,0.0,1, 0, 1, 0, 1)
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
||||
|
||||
|
||||
45
source/blender/freestyle/style_modules_blender/apriori_and_causal_density.py
Executable file
45
source/blender/freestyle/style_modules_blender/apriori_and_causal_density.py
Executable file
@@ -0,0 +1,45 @@
|
||||
#
|
||||
# Filename : apriori_and_causal_density.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Selects the lines with high a priori density and
|
||||
# subjects them to the causal density so as to avoid
|
||||
# cluttering
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from PredicatesU1D import *
|
||||
from shaders import *
|
||||
|
||||
Operators.select(AndUP1D(QuantitativeInvisibilityUP1D(0), pyHighViewMapDensityUP1D(0.3,4) ) )
|
||||
bpred = TrueBP1D()
|
||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), pyHighViewMapDensityUP1D(0.3,4))
|
||||
Operators.bidirectionalChain(ChainPredicateIterator(upred, bpred), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
shaders_list = [
|
||||
ConstantThicknessShader(2),
|
||||
ConstantColorShader(0.0, 0.0, 0.0,1)
|
||||
]
|
||||
Operators.create(pyDensityUP1D(1,0.1, IntegrationType.MEAN), shaders_list)
|
||||
43
source/blender/freestyle/style_modules_blender/apriori_density.py
Executable file
43
source/blender/freestyle/style_modules_blender/apriori_density.py
Executable file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# Filename : apriori_density.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws lines having a high a priori density
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from PredicatesU1D import *
|
||||
from shaders import *
|
||||
|
||||
Operators.select(AndUP1D(QuantitativeInvisibilityUP1D(0), pyHighViewMapDensityUP1D(0.1,5)))
|
||||
bpred = TrueBP1D()
|
||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), pyHighViewMapDensityUP1D(0.0007,5))
|
||||
Operators.bidirectionalChain(ChainPredicateIterator(upred, bpred), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
shaders_list = [
|
||||
ConstantThicknessShader(2),
|
||||
ConstantColorShader(0.0, 0.0, 0.0,1)
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
36
source/blender/freestyle/style_modules_blender/backbone_stretcher.py
Executable file
36
source/blender/freestyle/style_modules_blender/backbone_stretcher.py
Executable file
@@ -0,0 +1,36 @@
|
||||
#
|
||||
# Filename : backbone_stretcher.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Stretches the geometry of visible lines
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from shaders import *
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
shaders_list = [TextureAssignerShader(4), ConstantColorShader(0.5, 0.5, 0.5), BackboneStretcherShader(20)]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
46
source/blender/freestyle/style_modules_blender/blueprint_circles.py
Executable file
46
source/blender/freestyle/style_modules_blender/blueprint_circles.py
Executable file
@@ -0,0 +1,46 @@
|
||||
#
|
||||
# Filename : blueprint_circles.py
|
||||
# Author : Emmanuel Turquin
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Produces a blueprint using circular contour strokes
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from PredicatesU1D import *
|
||||
from shaders import *
|
||||
|
||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D())
|
||||
bpred = SameShapeIdBP1D()
|
||||
Operators.select(upred)
|
||||
Operators.bidirectionalChain(ChainPredicateIterator(upred,bpred), NotUP1D(upred))
|
||||
Operators.select(pyHigherLengthUP1D(200))
|
||||
shaders_list = [
|
||||
ConstantThicknessShader(5),
|
||||
pyBluePrintCirclesShader(3),
|
||||
pyPerlinNoise1DShader(0.1, 15, 8),
|
||||
TextureAssignerShader(4),
|
||||
IncreasingColorShader(0.8, 0.8, 0.3, 0.4, 0.3, 0.3, 0.3, 0.1)
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
46
source/blender/freestyle/style_modules_blender/blueprint_ellipses.py
Executable file
46
source/blender/freestyle/style_modules_blender/blueprint_ellipses.py
Executable file
@@ -0,0 +1,46 @@
|
||||
#
|
||||
# Filename : blueprint_ellipses.py
|
||||
# Author : Emmanuel Turquin
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Produces a blueprint using elliptic contour strokes
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from PredicatesU1D import *
|
||||
from shaders import *
|
||||
|
||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D())
|
||||
bpred = SameShapeIdBP1D()
|
||||
Operators.select(upred)
|
||||
Operators.bidirectionalChain(ChainPredicateIterator(upred,bpred), NotUP1D(upred))
|
||||
Operators.select(pyHigherLengthUP1D(200))
|
||||
shaders_list = [
|
||||
ConstantThicknessShader(5),
|
||||
pyBluePrintEllipsesShader(3),
|
||||
pyPerlinNoise1DShader(0.1, 10, 8),
|
||||
TextureAssignerShader(4),
|
||||
IncreasingColorShader(0.6, 0.3, 0.3, 0.7, 0.3, 0.3, 0.3, 0.1)
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
45
source/blender/freestyle/style_modules_blender/blueprint_squares.py
Executable file
45
source/blender/freestyle/style_modules_blender/blueprint_squares.py
Executable file
@@ -0,0 +1,45 @@
|
||||
# Filename : blueprint_squares.py
|
||||
# Author : Emmanuel Turquin
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Produces a blueprint using square contour strokes
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from PredicatesU1D import *
|
||||
from shaders import *
|
||||
|
||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D())
|
||||
bpred = SameShapeIdBP1D()
|
||||
Operators.select(upred)
|
||||
Operators.bidirectionalChain(ChainPredicateIterator(upred,bpred), NotUP1D(upred))
|
||||
Operators.select(pyHigherLengthUP1D(200))
|
||||
shaders_list = [
|
||||
ConstantThicknessShader(8),
|
||||
pyBluePrintSquaresShader(2, 20),
|
||||
pyPerlinNoise1DShader(0.07, 10, 8),
|
||||
TextureAssignerShader(4),
|
||||
IncreasingColorShader(0.6, 0.3, 0.3, 0.7, 0.6, 0.3, 0.3, 0.3),
|
||||
ConstantThicknessShader(4)
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
42
source/blender/freestyle/style_modules_blender/cartoon.py
Executable file
42
source/blender/freestyle/style_modules_blender/cartoon.py
Executable file
@@ -0,0 +1,42 @@
|
||||
#
|
||||
# Filename : cartoon.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws colored lines. The color is automatically
|
||||
# infered from each object's material in a cartoon-like
|
||||
# fashion.
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from shaders import *
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
shaders_list = [
|
||||
BezierCurveShader(3),
|
||||
ConstantThicknessShader(4),
|
||||
pyMaterialColorShader(0.8)
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
42
source/blender/freestyle/style_modules_blender/contour.py
Executable file
42
source/blender/freestyle/style_modules_blender/contour.py
Executable file
@@ -0,0 +1,42 @@
|
||||
#
|
||||
# Filename : contour.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws each object's visible contour
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from PredicatesU1D import *
|
||||
from shaders import *
|
||||
|
||||
Operators.select(AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D() ) )
|
||||
bpred = SameShapeIdBP1D();
|
||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D())
|
||||
Operators.bidirectionalChain(ChainPredicateIterator(upred, bpred), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
shaders_list = [
|
||||
ConstantThicknessShader(5.0),
|
||||
IncreasingColorShader(0.8,0,0,1,0.1,0,0,1)
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
60
source/blender/freestyle/style_modules_blender/curvature2d.py
Executable file
60
source/blender/freestyle/style_modules_blender/curvature2d.py
Executable file
@@ -0,0 +1,60 @@
|
||||
#
|
||||
# Filename : curvature2d.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : The stroke points are colored in gray levels and depending
|
||||
# on the 2d curvature value
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from shaders import *
|
||||
|
||||
class py2DCurvatureColorShader(StrokeShader):
|
||||
def getName(self):
|
||||
return "py2DCurvatureColorShader"
|
||||
|
||||
def shade(self, stroke):
|
||||
it = stroke.strokeVerticesBegin()
|
||||
it_end = stroke.strokeVerticesEnd()
|
||||
func = Curvature2DAngleF0D()
|
||||
while it.isEnd() == 0:
|
||||
it0D = it.castToInterface0DIterator()
|
||||
sv = it.getObject()
|
||||
att = sv.attribute()
|
||||
c = func(it0D)
|
||||
if (c<0):
|
||||
print "negative 2D curvature"
|
||||
color = 10.0 * c/3.1415
|
||||
att.setColor(color,color,color);
|
||||
it.increment()
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
shaders_list = [
|
||||
StrokeTextureShader("smoothAlpha.bmp", Stroke.OPAQUE_MEDIUM, 0),
|
||||
ConstantThicknessShader(5),
|
||||
py2DCurvatureColorShader()
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
43
source/blender/freestyle/style_modules_blender/external_contour.py
Executable file
43
source/blender/freestyle/style_modules_blender/external_contour.py
Executable file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# Filename : external_contour.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws the external contour of the scene
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from PredicatesU1D import *
|
||||
from ChainingIterators import *
|
||||
from shaders import *
|
||||
|
||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D())
|
||||
Operators.select(upred )
|
||||
bpred = TrueBP1D();
|
||||
Operators.bidirectionalChain(ChainPredicateIterator(upred, bpred), NotUP1D(upred))
|
||||
shaders_list = [
|
||||
ConstantThicknessShader(3),
|
||||
ConstantColorShader(0.0, 0.0, 0.0,1)
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
48
source/blender/freestyle/style_modules_blender/external_contour_sketchy.py
Executable file
48
source/blender/freestyle/style_modules_blender/external_contour_sketchy.py
Executable file
@@ -0,0 +1,48 @@
|
||||
#
|
||||
# Filename : external_contour_sketchy.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws the external contour of the scene using a sketchy
|
||||
# chaining iterator (in particular each ViewEdge can be drawn
|
||||
# several times
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from ChainingIterators import *
|
||||
from shaders import *
|
||||
|
||||
|
||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D())
|
||||
Operators.select(upred)
|
||||
Operators.bidirectionalChain(pySketchyChainingIterator(), NotUP1D(upred))
|
||||
shaders_list = [
|
||||
SamplingShader(4),
|
||||
SpatialNoiseShader(10, 150, 2, 1, 1),
|
||||
IncreasingThicknessShader(4, 10),
|
||||
SmoothingShader(400, 0.1, 0, 0.2, 0, 0, 0, 1),
|
||||
IncreasingColorShader(1,0,0,1,0,1,0,1),
|
||||
TextureAssignerShader(4)
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
44
source/blender/freestyle/style_modules_blender/external_contour_smooth.py
Executable file
44
source/blender/freestyle/style_modules_blender/external_contour_smooth.py
Executable file
@@ -0,0 +1,44 @@
|
||||
#
|
||||
# Filename : external_contour_smooth.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws a smooth external contour
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from PredicatesU1D import *
|
||||
from shaders import *
|
||||
from ChainingIterators import *
|
||||
|
||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D())
|
||||
Operators.select(upred)
|
||||
bpred = TrueBP1D();
|
||||
Operators.bidirectionalChain(ChainPredicateIterator(upred, bpred), NotUP1D(upred))
|
||||
shaders_list = [
|
||||
SamplingShader(2),
|
||||
IncreasingThicknessShader(4,20),
|
||||
IncreasingColorShader(1.0, 0.0, 0.5,1, 0.5,1, 0.3, 1),
|
||||
SmoothingShader(100, 0.05, 0, 0.2, 0, 0, 0, 1)
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
3
source/blender/freestyle/style_modules_blender/extra-lines.sml
Executable file
3
source/blender/freestyle/style_modules_blender/extra-lines.sml
Executable file
@@ -0,0 +1,3 @@
|
||||
1suggestive.py
|
||||
1ridges.py
|
||||
1nor_suggestive_or_ridges.py
|
||||
50
source/blender/freestyle/style_modules_blender/haloing.py
Executable file
50
source/blender/freestyle/style_modules_blender/haloing.py
Executable file
@@ -0,0 +1,50 @@
|
||||
#
|
||||
# Filename : haloing.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : This style module selects the lines that
|
||||
# are connected (in the image) to a specific
|
||||
# object and trims them in order to produce
|
||||
# a haloing effect around the target shape
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from PredicatesU1D import *
|
||||
from PredicatesB1D import *
|
||||
from shaders import *
|
||||
|
||||
# id corresponds to the id of the target object
|
||||
# (accessed by SHIFT+click)
|
||||
id = Id(3,0)
|
||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0) , pyIsOccludedByUP1D(id))
|
||||
Operators.select(upred)
|
||||
Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(upred))
|
||||
shaders_list = [
|
||||
IncreasingThicknessShader(3, 5),
|
||||
IncreasingColorShader(1,0,0, 1,0,1,0,1),
|
||||
SamplingShader(1.0),
|
||||
pyTVertexRemoverShader(),
|
||||
TipRemoverShader(3.0)
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
41
source/blender/freestyle/style_modules_blender/ignore_small_occlusions.py
Executable file
41
source/blender/freestyle/style_modules_blender/ignore_small_occlusions.py
Executable file
@@ -0,0 +1,41 @@
|
||||
#
|
||||
# Filename : ignore_small_oclusions.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : The strokes are drawn through small occlusions
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from ChainingIterators import *
|
||||
from shaders import *
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
#Operators.bidirectionalChain(pyFillOcclusionsChainingIterator(0.1))
|
||||
Operators.bidirectionalChain(pyFillOcclusionsAbsoluteChainingIterator(12))
|
||||
shaders_list = [
|
||||
SamplingShader(5.0),
|
||||
ConstantThicknessShader(3),
|
||||
ConstantColorShader(0.0,0.0,0.0),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
42
source/blender/freestyle/style_modules_blender/invisible_lines.py
Executable file
42
source/blender/freestyle/style_modules_blender/invisible_lines.py
Executable file
@@ -0,0 +1,42 @@
|
||||
#
|
||||
# Filename : invisible_lines.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws all lines whose Quantitative Invisibility
|
||||
# is different from 0
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from ChainingIterators import *
|
||||
from shaders import *
|
||||
|
||||
upred = NotUP1D(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.select(upred)
|
||||
Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(upred))
|
||||
shaders_list = [
|
||||
SamplingShader(5.0),
|
||||
ConstantThicknessShader(3.0),
|
||||
ConstantColorShader(0.7,0.7,0.7)
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
59
source/blender/freestyle/style_modules_blender/japanese_bigbrush.py
Executable file
59
source/blender/freestyle/style_modules_blender/japanese_bigbrush.py
Executable file
@@ -0,0 +1,59 @@
|
||||
#
|
||||
# Filename : japanese_bigbrush.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Simulates a big brush fr oriental painting
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from PredicatesU1D import *
|
||||
from PredicatesB1D import *
|
||||
from Functions0D import *
|
||||
from shaders import *
|
||||
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectionalChain(ChainSilhouetteIterator(),NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
## Splits strokes at points of highest 2D curavture
|
||||
## when there are too many abrupt turns in it
|
||||
func = pyInverseCurvature2DAngleF0D()
|
||||
Operators.recursiveSplit(func, pyParameterUP0D(0.2,0.8), NotUP1D(pyHigherNumberOfTurnsUP1D(3, 0.5)), 2)
|
||||
## Keeps only long enough strokes
|
||||
Operators.select(pyHigherLengthUP1D(100))
|
||||
## Sorts so as to draw the longest strokes first
|
||||
## (this will be done using the causal density)
|
||||
Operators.sort(pyLengthBP1D())
|
||||
shaders_list = [
|
||||
pySamplingShader(10),
|
||||
BezierCurveShader(30),
|
||||
SamplingShader(50),
|
||||
pyNonLinearVaryingThicknessShader(4,25, 0.6),
|
||||
TextureAssignerShader(6),
|
||||
ConstantColorShader(0.2, 0.2, 0.2,1.0),
|
||||
TipRemoverShader(10)
|
||||
]
|
||||
## Use the causal density to avoid cluttering
|
||||
Operators.create(pyDensityUP1D(8,0.4, IntegrationType.MEAN), shaders_list)
|
||||
|
||||
|
||||
36
source/blender/freestyle/style_modules_blender/logical_operators.py
Executable file
36
source/blender/freestyle/style_modules_blender/logical_operators.py
Executable file
@@ -0,0 +1,36 @@
|
||||
from Blender.Freestyle import *
|
||||
|
||||
class AndUP1D(UnaryPredicate1D):
|
||||
def __init__(self, pred1, pred2):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self.__pred1 = pred1
|
||||
self.__pred2 = pred2
|
||||
|
||||
def getName(self):
|
||||
return "AndUP1D"
|
||||
|
||||
def __call__(self, inter):
|
||||
return self.__pred1(inter) and self.__pred2(inter)
|
||||
|
||||
class OrUP1D(UnaryPredicate1D):
|
||||
def __init__(self, pred1, pred2):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self.__pred1 = pred1
|
||||
self.__pred2 = pred2
|
||||
|
||||
def getName(self):
|
||||
return "OrUP1D"
|
||||
|
||||
def __call__(self, inter):
|
||||
return self.__pred1(inter) or self.__pred2(inter)
|
||||
|
||||
class NotUP1D(UnaryPredicate1D):
|
||||
def __init__(self, pred):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self.__pred = pred
|
||||
|
||||
def getName(self):
|
||||
return "NotUP1D"
|
||||
|
||||
def __call__(self, inter):
|
||||
return self.__pred(inter) == 0
|
||||
81
source/blender/freestyle/style_modules_blender/long_anisotropically_dense.py
Executable file
81
source/blender/freestyle/style_modules_blender/long_anisotropically_dense.py
Executable file
@@ -0,0 +1,81 @@
|
||||
#
|
||||
# Filename : long_anisotropically_dense.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Selects the lines that are long and have a high anisotropic
|
||||
# a priori density and uses causal density
|
||||
# to draw without cluttering. Ideally, half of the
|
||||
# selected lines are culled using the causal density.
|
||||
#
|
||||
# ********************* WARNING *************************************
|
||||
# ******** The Directional a priori density maps must ******
|
||||
# ******** have been computed prior to using this style module ******
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from PredicatesU1D import *
|
||||
from PredicatesU0D import *
|
||||
from PredicatesB1D import *
|
||||
from Functions0D import *
|
||||
from Functions1D import *
|
||||
from shaders import *
|
||||
|
||||
## custom density predicate
|
||||
class pyDensityUP1D(UnaryPredicate1D):
|
||||
def __init__(self,wsize,threshold, integration = IntegrationType.MEAN, sampling=2.0):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self._wsize = wsize
|
||||
self._threshold = threshold
|
||||
self._integration = integration
|
||||
self._func = DensityF1D(self._wsize, self._integration, sampling)
|
||||
self._func2 = DensityF1D(self._wsize, IntegrationType.MAX, sampling)
|
||||
|
||||
def getName(self):
|
||||
return "pyDensityUP1D"
|
||||
|
||||
def __call__(self, inter):
|
||||
c = self._func(inter)
|
||||
m = self._func2(inter)
|
||||
if(c < self._threshold):
|
||||
return 1
|
||||
if( m > 4* c ):
|
||||
if ( c < 1.5*self._threshold ):
|
||||
return 1
|
||||
return 0
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectionalChain(ChainSilhouetteIterator(),NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
Operators.select(pyHigherLengthUP1D(40))
|
||||
## selects lines having a high anisotropic a priori density
|
||||
Operators.select(pyHighDensityAnisotropyUP1D(0.3,4))
|
||||
Operators.sort(pyLengthBP1D())
|
||||
shaders_list = [
|
||||
SamplingShader(2.0),
|
||||
ConstantThicknessShader(2),
|
||||
ConstantColorShader(0.2,0.2,0.25,1),
|
||||
]
|
||||
## uniform culling
|
||||
Operators.create(pyDensityUP1D(3.0,2.0e-2, IntegrationType.MEAN, 0.1), shaders_list)
|
||||
|
||||
|
||||
51
source/blender/freestyle/style_modules_blender/multiple_parameterization.py
Executable file
51
source/blender/freestyle/style_modules_blender/multiple_parameterization.py
Executable file
@@ -0,0 +1,51 @@
|
||||
#
|
||||
# Filename : multiple_parameterization.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : The thickness and the color of the strokes vary continuously
|
||||
# independently from occlusions although only
|
||||
# visible lines are actually drawn. This is equivalent
|
||||
# to assigning the thickness using a parameterization covering
|
||||
# the complete silhouette (visible+invisible) and drawing
|
||||
# the strokes using a second parameterization that only
|
||||
# covers the visible portions.
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from ChainingIterators import *
|
||||
from shaders import *
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
## Chain following the same nature, but without the restriction
|
||||
## of staying inside the selection (0).
|
||||
Operators.bidirectionalChain(ChainSilhouetteIterator(0))
|
||||
shaders_list = [
|
||||
SamplingShader(20),
|
||||
IncreasingThicknessShader(1.5, 30),
|
||||
ConstantColorShader(0.0,0.0,0.0),
|
||||
IncreasingColorShader(1,0,0,1,0,1,0,1),
|
||||
TextureAssignerShader(-1),
|
||||
pyHLRShader() ## this shader draws only visible portions
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
43
source/blender/freestyle/style_modules_blender/nature.py
Executable file
43
source/blender/freestyle/style_modules_blender/nature.py
Executable file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# Filename : nature.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Uses the NatureUP1D predicate to select the lines
|
||||
# of a given type (among SILHOUETTE, CREASE, SUGGESTIVE_CONTOURS,
|
||||
# BORDERS).
|
||||
# The suggestive contours must have been enabled in the
|
||||
# options dialog to appear in the View Map.
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from shaders import *
|
||||
|
||||
Operators.select(pyNatureUP1D(SILHOUETTE))
|
||||
Operators.bidirectionalChain(ChainSilhouetteIterator(),NotUP1D( pyNatureUP1D( SILHOUETTE) ) )
|
||||
shaders_list = [
|
||||
IncreasingThicknessShader(3, 10),
|
||||
IncreasingColorShader(0.0,0.0,0.0, 1, 0.8,0,0,1)
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
44
source/blender/freestyle/style_modules_blender/near_lines.py
Executable file
44
source/blender/freestyle/style_modules_blender/near_lines.py
Executable file
@@ -0,0 +1,44 @@
|
||||
#
|
||||
# Filename : near_lines.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws the lines that are "closer" than a threshold
|
||||
# (between 0 and 1)
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from PredicatesU1D import *
|
||||
from shaders import *
|
||||
|
||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), pyZSmallerUP1D(0.5, IntegrationType.MEAN))
|
||||
Operators.select(upred)
|
||||
Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(upred))
|
||||
shaders_list = [
|
||||
TextureAssignerShader(-1),
|
||||
ConstantThicknessShader(5),
|
||||
ConstantColorShader(0.0, 0.0, 0.0)
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
@@ -0,0 +1,45 @@
|
||||
#
|
||||
# Filename : occluded_by_specific_object.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws only the lines that are occluded by a given object
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from PredicatesU1D import *
|
||||
from shaders import *
|
||||
|
||||
## the id of the occluder (use SHIFT+click on the ViewMap to
|
||||
## retrieve ids)
|
||||
id = Id(3,0)
|
||||
upred = AndUP1D(NotUP1D(QuantitativeInvisibilityUP1D(0)),
|
||||
pyIsInOccludersListUP1D(id))
|
||||
Operators.select(upred)
|
||||
Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(upred))
|
||||
shaders_list = [
|
||||
SamplingShader(5),
|
||||
ConstantThicknessShader(3),
|
||||
ConstantColorShader(0.3,0.3,0.3,1)
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
40
source/blender/freestyle/style_modules_blender/polygonalize.py
Executable file
40
source/blender/freestyle/style_modules_blender/polygonalize.py
Executable file
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# Filename : polygonalize.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Make the strokes more "polygonal"
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from ChainingIterators import *
|
||||
from shaders import *
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectionalChain(ChainSilhouetteIterator(),NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
shaders_list = [
|
||||
SamplingShader(2.0),
|
||||
ConstantThicknessShader(3),
|
||||
ConstantColorShader(0.0,0.0,0.0),
|
||||
PolygonalizationShader(8)
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
41
source/blender/freestyle/style_modules_blender/qi0.py
Executable file
41
source/blender/freestyle/style_modules_blender/qi0.py
Executable file
@@ -0,0 +1,41 @@
|
||||
#
|
||||
# Filename : qi0.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws the visible lines (chaining follows same nature lines)
|
||||
# (most basic style module)
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from ChainingIterators import *
|
||||
from shaders import *
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
shaders_list = [
|
||||
SamplingShader(5.0),
|
||||
ConstantThicknessShader(4.0),
|
||||
ConstantColorShader(0.0,0.0,0.0)
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
43
source/blender/freestyle/style_modules_blender/qi0_not_external_contour.py
Executable file
43
source/blender/freestyle/style_modules_blender/qi0_not_external_contour.py
Executable file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# Filename : qi0_not_external_contour.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws the visible lines (chaining follows same nature lines)
|
||||
# that do not belong to the external contour of the scene
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
|
||||
upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D())
|
||||
Operators.select(upred)
|
||||
Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(upred))
|
||||
shaders_list = [
|
||||
SamplingShader(4),
|
||||
SpatialNoiseShader(4, 150, 2, 1, 1),
|
||||
IncreasingThicknessShader(2, 5),
|
||||
BackboneStretcherShader(20),
|
||||
IncreasingColorShader(1,0,0,1,0,1,0,1),
|
||||
TextureAssignerShader(4)
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
42
source/blender/freestyle/style_modules_blender/qi1.py
Executable file
42
source/blender/freestyle/style_modules_blender/qi1.py
Executable file
@@ -0,0 +1,42 @@
|
||||
#
|
||||
# Filename : qi1.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws lines hidden by one surface.
|
||||
# *** Quantitative Invisibility must have been
|
||||
# enabled in the options dialog to use this style module ****
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from shaders import *
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(1))
|
||||
Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(1)))
|
||||
shaders_list = [
|
||||
SamplingShader(5.0),
|
||||
ConstantThicknessShader(3),
|
||||
ConstantColorShader(0.5,0.5,0.5, 1)
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
42
source/blender/freestyle/style_modules_blender/qi2.py
Executable file
42
source/blender/freestyle/style_modules_blender/qi2.py
Executable file
@@ -0,0 +1,42 @@
|
||||
#
|
||||
# Filename : qi2.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws lines hidden by two surfaces.
|
||||
# *** Quantitative Invisibility must have been
|
||||
# enabled in the options dialog to use this style module ****
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from shaders import *
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(2))
|
||||
Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(2)))
|
||||
shaders_list = [
|
||||
SamplingShader(10),
|
||||
ConstantThicknessShader(1.5),
|
||||
ConstantColorShader(0.7,0.7,0.7, 1)
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
68
source/blender/freestyle/style_modules_blender/sequentialsplit_sketchy.py
Executable file
68
source/blender/freestyle/style_modules_blender/sequentialsplit_sketchy.py
Executable file
@@ -0,0 +1,68 @@
|
||||
#
|
||||
# Filename : sequentialsplit_sketchy.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Use the sequential split with two different
|
||||
# predicates to specify respectively the starting and
|
||||
# the stopping extremities for strokes
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from PredicatesU1D import *
|
||||
from PredicatesU0D import *
|
||||
from Functions0D import *
|
||||
|
||||
## Predicate to tell whether a TVertex
|
||||
## corresponds to a change from 0 to 1 or not.
|
||||
class pyBackTVertexUP0D(UnaryPredicate0D):
|
||||
def __init__(self):
|
||||
UnaryPredicate0D.__init__(self)
|
||||
self._getQI = QuantitativeInvisibilityF0D()
|
||||
def getName(self):
|
||||
return "pyBackTVertexUP0D"
|
||||
def __call__(self, iter):
|
||||
v = iter.getObject()
|
||||
nat = v.getNature()
|
||||
if(nat & T_VERTEX == 0):
|
||||
return 0
|
||||
if(self._getQI(iter) != 0):
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
||||
upred = QuantitativeInvisibilityUP1D(0)
|
||||
Operators.select(upred)
|
||||
Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(upred))
|
||||
## starting and stopping predicates:
|
||||
start = pyVertexNatureUP0D(NON_T_VERTEX)
|
||||
stop = pyBackTVertexUP0D()
|
||||
Operators.sequentialSplit(start, stop, 10)
|
||||
shaders_list = [
|
||||
SpatialNoiseShader(7, 120, 2, 1, 1),
|
||||
IncreasingThicknessShader(5, 8),
|
||||
ConstantColorShader(0.2, 0.2, 0.2, 1),
|
||||
TextureAssignerShader(4)
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
||||
1288
source/blender/freestyle/style_modules_blender/shaders.py
Executable file
1288
source/blender/freestyle/style_modules_blender/shaders.py
Executable file
@@ -0,0 +1,1288 @@
|
||||
from Blender.Freestyle import *
|
||||
from PredicatesU0D import *
|
||||
from PredicatesB1D import *
|
||||
from PredicatesU1D import *
|
||||
from logical_operators import *
|
||||
from ChainingIterators import *
|
||||
from random import *
|
||||
from math import *
|
||||
from vector import *
|
||||
|
||||
## thickness modifiers
|
||||
######################
|
||||
|
||||
class pyDepthDiscontinuityThicknessShader(StrokeShader):
|
||||
def __init__(self, min, max):
|
||||
StrokeShader.__init__(self)
|
||||
self.__min = float(min)
|
||||
self.__max = float(max)
|
||||
self.__func = ZDiscontinuityF0D()
|
||||
def getName(self):
|
||||
return "pyDepthDiscontinuityThicknessShader"
|
||||
def shade(self, stroke):
|
||||
it = stroke.strokeVerticesBegin()
|
||||
z_min=0.0
|
||||
z_max=1.0
|
||||
a = (self.__max - self.__min)/(z_max-z_min)
|
||||
b = (self.__min*z_max-self.__max*z_min)/(z_max-z_min)
|
||||
it = stroke.strokeVerticesBegin()
|
||||
while it.isEnd() == 0:
|
||||
z = self.__func(it.castToInterface0DIterator())
|
||||
thickness = a*z+b
|
||||
it.getObject().attribute().setThickness(thickness, thickness)
|
||||
it.increment()
|
||||
|
||||
class pyConstantThicknessShader(StrokeShader):
|
||||
def __init__(self, thickness):
|
||||
StrokeShader.__init__(self)
|
||||
self._thickness = thickness
|
||||
|
||||
def getName(self):
|
||||
return "pyConstantThicknessShader"
|
||||
def shade(self, stroke):
|
||||
it = stroke.strokeVerticesBegin()
|
||||
it_end = stroke.strokeVerticesEnd()
|
||||
while it.isEnd() == 0:
|
||||
att = it.getObject().attribute()
|
||||
t = self._thickness/2.0
|
||||
att.setThickness(t, t)
|
||||
it.increment()
|
||||
|
||||
class pyFXSThicknessShader(StrokeShader):
|
||||
def __init__(self, thickness):
|
||||
StrokeShader.__init__(self)
|
||||
self._thickness = thickness
|
||||
|
||||
def getName(self):
|
||||
return "pyFXSThicknessShader"
|
||||
def shade(self, stroke):
|
||||
it = stroke.strokeVerticesBegin()
|
||||
it_end = stroke.strokeVerticesEnd()
|
||||
while it.isEnd() == 0:
|
||||
att = it.getObject().attribute()
|
||||
t = self._thickness/2.0
|
||||
att.setThickness(t, t)
|
||||
it.increment()
|
||||
|
||||
class pyFXSVaryingThicknessWithDensityShader(StrokeShader):
|
||||
def __init__(self, wsize, threshold_min, threshold_max, thicknessMin, thicknessMax):
|
||||
StrokeShader.__init__(self)
|
||||
self.wsize= wsize
|
||||
self.threshold_min= threshold_min
|
||||
self.threshold_max= threshold_max
|
||||
self._thicknessMin = thicknessMin
|
||||
self._thicknessMax = thicknessMax
|
||||
|
||||
def getName(self):
|
||||
return "pyVaryingThicknessWithDensityShader"
|
||||
def shade(self, stroke):
|
||||
n = stroke.strokeVerticesSize()
|
||||
i = 0
|
||||
it = stroke.strokeVerticesBegin()
|
||||
it_end = stroke.strokeVerticesEnd()
|
||||
func = DensityF0D(self.wsize)
|
||||
while it.isEnd() == 0:
|
||||
att = it.getObject().attribute()
|
||||
toto = it.castToInterface0DIterator()
|
||||
c= func(toto)
|
||||
if (c < self.threshold_min ):
|
||||
c = self.threshold_min
|
||||
if (c > self.threshold_max ):
|
||||
c = self.threshold_max
|
||||
## t = (c - self.threshold_min)/(self.threshold_max - self.threshold_min)*(self._thicknessMax-self._thicknessMin) + self._thicknessMin
|
||||
t = (self.threshold_max - c )/(self.threshold_max - self.threshold_min)*(self._thicknessMax-self._thicknessMin) + self._thicknessMin
|
||||
att.setThickness(t/2.0, t/2.0)
|
||||
i = i+1
|
||||
it.increment()
|
||||
class pyIncreasingThicknessShader(StrokeShader):
|
||||
def __init__(self, thicknessMin, thicknessMax):
|
||||
StrokeShader.__init__(self)
|
||||
self._thicknessMin = thicknessMin
|
||||
self._thicknessMax = thicknessMax
|
||||
|
||||
def getName(self):
|
||||
return "pyIncreasingThicknessShader"
|
||||
def shade(self, stroke):
|
||||
n = stroke.strokeVerticesSize()
|
||||
i = 0
|
||||
it = stroke.strokeVerticesBegin()
|
||||
it_end = stroke.strokeVerticesEnd()
|
||||
while it.isEnd() == 0:
|
||||
att = it.getObject().attribute()
|
||||
c = float(i)/float(n)
|
||||
if(i < float(n)/2.0):
|
||||
t = (1.0 - c)*self._thicknessMin + c * self._thicknessMax
|
||||
else:
|
||||
t = (1.0 - c)*self._thicknessMax + c * self._thicknessMin
|
||||
att.setThickness(t/2.0, t/2.0)
|
||||
i = i+1
|
||||
it.increment()
|
||||
|
||||
class pyConstrainedIncreasingThicknessShader(StrokeShader):
|
||||
def __init__(self, thicknessMin, thicknessMax, ratio):
|
||||
StrokeShader.__init__(self)
|
||||
self._thicknessMin = thicknessMin
|
||||
self._thicknessMax = thicknessMax
|
||||
self._ratio = ratio
|
||||
|
||||
def getName(self):
|
||||
return "pyConstrainedIncreasingThicknessShader"
|
||||
def shade(self, stroke):
|
||||
slength = stroke.getLength2D()
|
||||
tmp = self._ratio*slength
|
||||
maxT = 0.0
|
||||
if(tmp < self._thicknessMax):
|
||||
maxT = tmp
|
||||
else:
|
||||
maxT = self._thicknessMax
|
||||
n = stroke.strokeVerticesSize()
|
||||
i = 0
|
||||
it = stroke.strokeVerticesBegin()
|
||||
it_end = stroke.strokeVerticesEnd()
|
||||
while it.isEnd() == 0:
|
||||
att = it.getObject().attribute()
|
||||
c = float(i)/float(n)
|
||||
if(i < float(n)/2.0):
|
||||
t = (1.0 - c)*self._thicknessMin + c * maxT
|
||||
else:
|
||||
t = (1.0 - c)*maxT + c * self._thicknessMin
|
||||
att.setThickness(t/2.0, t/2.0)
|
||||
if(i == n-1):
|
||||
att.setThickness(self._thicknessMin/2.0, self._thicknessMin/2.0)
|
||||
i = i+1
|
||||
it.increment()
|
||||
|
||||
class pyDecreasingThicknessShader(StrokeShader):
|
||||
def __init__(self, thicknessMax, thicknessMin):
|
||||
StrokeShader.__init__(self)
|
||||
self._thicknessMin = thicknessMin
|
||||
self._thicknessMax = thicknessMax
|
||||
|
||||
def getName(self):
|
||||
return "pyDecreasingThicknessShader"
|
||||
def shade(self, stroke):
|
||||
l = stroke.getLength2D()
|
||||
tMax = self._thicknessMax
|
||||
if(self._thicknessMax > 0.33*l):
|
||||
tMax = 0.33*l
|
||||
tMin = self._thicknessMin
|
||||
if(self._thicknessMin > 0.1*l):
|
||||
tMin = 0.1*l
|
||||
n = stroke.strokeVerticesSize()
|
||||
i = 0
|
||||
it = stroke.strokeVerticesBegin()
|
||||
it_end = stroke.strokeVerticesEnd()
|
||||
while it.isEnd() == 0:
|
||||
att = it.getObject().attribute()
|
||||
c = float(i)/float(n)
|
||||
t = (1.0 - c)*tMax +c*tMin
|
||||
att.setThickness(t/2.0, t/2.0)
|
||||
i = i+1
|
||||
it.increment()
|
||||
|
||||
def smoothC( a, exp ):
|
||||
c = pow(float(a),exp)*pow(2.0,exp)
|
||||
return c
|
||||
|
||||
class pyNonLinearVaryingThicknessShader(StrokeShader):
|
||||
def __init__(self, thicknessExtremity, thicknessMiddle, exponent):
|
||||
StrokeShader.__init__(self)
|
||||
self._thicknessMin = thicknessMiddle
|
||||
self._thicknessMax = thicknessExtremity
|
||||
self._exponent = exponent
|
||||
|
||||
def getName(self):
|
||||
return "pyNonLinearVaryingThicknessShader"
|
||||
def shade(self, stroke):
|
||||
n = stroke.strokeVerticesSize()
|
||||
i = 0
|
||||
it = stroke.strokeVerticesBegin()
|
||||
it_end = stroke.strokeVerticesEnd()
|
||||
while it.isEnd() == 0:
|
||||
att = it.getObject().attribute()
|
||||
if(i < float(n)/2.0):
|
||||
c = float(i)/float(n)
|
||||
else:
|
||||
c = float(n-i)/float(n)
|
||||
c = smoothC(c, self._exponent)
|
||||
t = (1.0 - c)*self._thicknessMax + c * self._thicknessMin
|
||||
att.setThickness(t/2.0, t/2.0)
|
||||
i = i+1
|
||||
it.increment()
|
||||
|
||||
## Spherical linear interpolation (cos)
|
||||
class pySLERPThicknessShader(StrokeShader):
|
||||
def __init__(self, thicknessMin, thicknessMax, omega=1.2):
|
||||
StrokeShader.__init__(self)
|
||||
self._thicknessMin = thicknessMin
|
||||
self._thicknessMax = thicknessMax
|
||||
self._omega = omega
|
||||
|
||||
def getName(self):
|
||||
return "pySLERPThicknessShader"
|
||||
def shade(self, stroke):
|
||||
slength = stroke.getLength2D()
|
||||
tmp = 0.33*slength
|
||||
maxT = self._thicknessMax
|
||||
if(tmp < self._thicknessMax):
|
||||
maxT = tmp
|
||||
|
||||
n = stroke.strokeVerticesSize()
|
||||
i = 0
|
||||
it = stroke.strokeVerticesBegin()
|
||||
it_end = stroke.strokeVerticesEnd()
|
||||
while it.isEnd() == 0:
|
||||
att = it.getObject().attribute()
|
||||
c = float(i)/float(n)
|
||||
if(i < float(n)/2.0):
|
||||
t = sin((1-c)*self._omega)/sinh(self._omega)*self._thicknessMin + sin(c*self._omega)/sinh(self._omega) * maxT
|
||||
else:
|
||||
t = sin((1-c)*self._omega)/sinh(self._omega)*maxT + sin(c*self._omega)/sinh(self._omega) * self._thicknessMin
|
||||
att.setThickness(t/2.0, t/2.0)
|
||||
i = i+1
|
||||
it.increment()
|
||||
|
||||
class pyTVertexThickenerShader(StrokeShader): ## FIXME
|
||||
def __init__(self, a=1.5, n=3):
|
||||
StrokeShader.__init__(self)
|
||||
self._a = a
|
||||
self._n = n
|
||||
|
||||
def getName(self):
|
||||
return "pyTVertexThickenerShader"
|
||||
|
||||
def shade(self, stroke):
|
||||
it = stroke.strokeVerticesBegin()
|
||||
predTVertex = pyVertexNatureUP0D(T_VERTEX)
|
||||
while it.isEnd() == 0:
|
||||
if(predTVertex(it) == 1):
|
||||
it2 = StrokeVertexIterator(it)
|
||||
it2.increment()
|
||||
if not(it.isBegin() or it2.isEnd()):
|
||||
it.increment()
|
||||
continue
|
||||
n = self._n
|
||||
a = self._a
|
||||
if(it.isBegin()):
|
||||
it3 = StrokeVertexIterator(it)
|
||||
count = 0
|
||||
while (it3.isEnd() == 0 and count < n):
|
||||
att = it3.getObject().attribute()
|
||||
tr = att.getThicknessR();
|
||||
tl = att.getThicknessL();
|
||||
r = (a-1.0)/float(n-1)*(float(n)/float(count+1) - 1) + 1
|
||||
#r = (1.0-a)/float(n-1)*count + a
|
||||
att.setThickness(r*tr, r*tl)
|
||||
it3.increment()
|
||||
count = count + 1
|
||||
if(it2.isEnd()):
|
||||
it4 = StrokeVertexIterator(it)
|
||||
count = 0
|
||||
while (it4.isBegin() == 0 and count < n):
|
||||
att = it4.getObject().attribute()
|
||||
tr = att.getThicknessR();
|
||||
tl = att.getThicknessL();
|
||||
r = (a-1.0)/float(n-1)*(float(n)/float(count+1) - 1) + 1
|
||||
#r = (1.0-a)/float(n-1)*count + a
|
||||
att.setThickness(r*tr, r*tl)
|
||||
it4.decrement()
|
||||
count = count + 1
|
||||
if ((it4.isBegin() == 1)):
|
||||
att = it4.getObject().attribute()
|
||||
tr = att.getThicknessR();
|
||||
tl = att.getThicknessL();
|
||||
r = (a-1.0)/float(n-1)*(float(n)/float(count+1) - 1) + 1
|
||||
#r = (1.0-a)/float(n-1)*count + a
|
||||
att.setThickness(r*tr, r*tl)
|
||||
it.increment()
|
||||
|
||||
class pyImportance2DThicknessShader(StrokeShader):
|
||||
def __init__(self, x, y, w, kmin, kmax):
|
||||
StrokeShader.__init__(self)
|
||||
self._x = x
|
||||
self._y = y
|
||||
self._w = float(w)
|
||||
self._kmin = float(kmin)
|
||||
self._kmax = float(kmax)
|
||||
|
||||
def getName(self):
|
||||
return "pyImportanceThicknessShader"
|
||||
def shade(self, stroke):
|
||||
origin = Vec2(self._x, self._y)
|
||||
it = stroke.strokeVerticesBegin()
|
||||
while it.isEnd() == 0:
|
||||
v = it.getObject()
|
||||
p = Vec2(v.getProjectedX(), v.getProjectedY())
|
||||
d = (p-origin).length()
|
||||
if(d>self._w):
|
||||
k = self._kmin
|
||||
else:
|
||||
k = (self._kmax*(self._w-d) + self._kmin*d)/self._w
|
||||
att = v.attribute()
|
||||
tr = att.getThicknessR()
|
||||
tl = att.getThicknessL()
|
||||
att.setThickness(k*tr/2.0, k*tl/2.0)
|
||||
it.increment()
|
||||
|
||||
class pyImportance3DThicknessShader(StrokeShader):
|
||||
def __init__(self, x, y, z, w, kmin, kmax):
|
||||
StrokeShader.__init__(self)
|
||||
self._x = x
|
||||
self._y = y
|
||||
self._z = z
|
||||
self._w = float(w)
|
||||
self._kmin = float(kmin)
|
||||
self._kmax = float(kmax)
|
||||
|
||||
def getName(self):
|
||||
return "pyImportance3DThicknessShader"
|
||||
def shade(self, stroke):
|
||||
origin = Vec3(self._x, self._y, self._z)
|
||||
it = stroke.strokeVerticesBegin()
|
||||
while it.isEnd() == 0:
|
||||
v = it.getObject()
|
||||
p = Vec3(v.getX(), v.getY(), v.getZ())
|
||||
d = (p-origin).length()
|
||||
if(d>self._w):
|
||||
k = self._kmin
|
||||
else:
|
||||
k = (self._kmax*(self._w-d) + self._kmin*d)/self._w
|
||||
att = v.attribute()
|
||||
tr = att.getThicknessR()
|
||||
tl = att.getThicknessL()
|
||||
att.setThickness(k*tr/2.0, k*tl/2.0)
|
||||
it.increment()
|
||||
|
||||
class pyZDependingThicknessShader(StrokeShader):
|
||||
def __init__(self, min, max):
|
||||
StrokeShader.__init__(self)
|
||||
self.__min = min
|
||||
self.__max = max
|
||||
self.__func = GetProjectedZF0D()
|
||||
def getName(self):
|
||||
return "pyZDependingThicknessShader"
|
||||
def shade(self, stroke):
|
||||
it = stroke.strokeVerticesBegin()
|
||||
z_min = 1
|
||||
z_max = 0
|
||||
while it.isEnd() == 0:
|
||||
z = self.__func(it.castToInterface0DIterator())
|
||||
if z < z_min:
|
||||
z_min = z
|
||||
elif z > z_max:
|
||||
z_max = z
|
||||
it.increment()
|
||||
z_diff = 1 / (z_max - z_min)
|
||||
it = stroke.strokeVerticesBegin()
|
||||
while it.isEnd() == 0:
|
||||
z = (self.__func(it.castToInterface0DIterator()) - z_min) * z_diff
|
||||
thickness = (1 - z) * self.__max + z * self.__min
|
||||
it.getObject().attribute().setThickness(thickness, thickness)
|
||||
it.increment()
|
||||
|
||||
|
||||
## color modifiers
|
||||
##################
|
||||
|
||||
class pyConstantColorShader(StrokeShader):
|
||||
def __init__(self,r,g,b, a = 1):
|
||||
StrokeShader.__init__(self)
|
||||
self._r = r
|
||||
self._g = g
|
||||
self._b = b
|
||||
self._a = a
|
||||
def getName(self):
|
||||
return "pyConstantColorShader"
|
||||
def shade(self, stroke):
|
||||
it = stroke.strokeVerticesBegin()
|
||||
it_end = stroke.strokeVerticesEnd()
|
||||
while it.isEnd() == 0:
|
||||
att = it.getObject().attribute()
|
||||
att.setColor(self._r, self._g, self._b)
|
||||
att.setAlpha(self._a)
|
||||
it.increment()
|
||||
|
||||
#c1->c2
|
||||
class pyIncreasingColorShader(StrokeShader):
|
||||
def __init__(self,r1,g1,b1,a1, r2,g2,b2,a2):
|
||||
StrokeShader.__init__(self)
|
||||
self._c1 = [r1,g1,b1,a1]
|
||||
self._c2 = [r2,g2,b2,a2]
|
||||
def getName(self):
|
||||
return "pyIncreasingColorShader"
|
||||
def shade(self, stroke):
|
||||
n = stroke.strokeVerticesSize() - 1
|
||||
inc = 0
|
||||
it = stroke.strokeVerticesBegin()
|
||||
it_end = stroke.strokeVerticesEnd()
|
||||
while it.isEnd() == 0:
|
||||
att = it.getObject().attribute()
|
||||
c = float(inc)/float(n)
|
||||
|
||||
att.setColor( (1-c)*self._c1[0] + c*self._c2[0],
|
||||
(1-c)*self._c1[1] + c*self._c2[1],
|
||||
(1-c)*self._c1[2] + c*self._c2[2],)
|
||||
att.setAlpha((1-c)*self._c1[3] + c*self._c2[3],)
|
||||
inc = inc+1
|
||||
it.increment()
|
||||
|
||||
# c1->c2->c1
|
||||
class pyInterpolateColorShader(StrokeShader):
|
||||
def __init__(self,r1,g1,b1,a1, r2,g2,b2,a2):
|
||||
StrokeShader.__init__(self)
|
||||
self._c1 = [r1,g1,b1,a1]
|
||||
self._c2 = [r2,g2,b2,a2]
|
||||
def getName(self):
|
||||
return "pyInterpolateColorShader"
|
||||
def shade(self, stroke):
|
||||
n = stroke.strokeVerticesSize() - 1
|
||||
inc = 0
|
||||
it = stroke.strokeVerticesBegin()
|
||||
it_end = stroke.strokeVerticesEnd()
|
||||
while it.isEnd() == 0:
|
||||
att = it.getObject().attribute()
|
||||
u = float(inc)/float(n)
|
||||
c = 1-2*(fabs(u-0.5))
|
||||
att.setColor( (1-c)*self._c1[0] + c*self._c2[0],
|
||||
(1-c)*self._c1[1] + c*self._c2[1],
|
||||
(1-c)*self._c1[2] + c*self._c2[2],)
|
||||
att.setAlpha((1-c)*self._c1[3] + c*self._c2[3],)
|
||||
inc = inc+1
|
||||
it.increment()
|
||||
|
||||
class pyMaterialColorShader(StrokeShader):
|
||||
def __init__(self, threshold=50):
|
||||
StrokeShader.__init__(self)
|
||||
self._threshold = threshold
|
||||
|
||||
def getName(self):
|
||||
return "pyMaterialColorShader"
|
||||
|
||||
def shade(self, stroke):
|
||||
it = stroke.strokeVerticesBegin()
|
||||
it_end = stroke.strokeVerticesEnd()
|
||||
func = MaterialF0D()
|
||||
xn = 0.312713
|
||||
yn = 0.329016
|
||||
Yn = 1.0
|
||||
un = 4.* xn/ ( -2.*xn + 12.*yn + 3. )
|
||||
vn= 9.* yn/ ( -2.*xn + 12.*yn +3. )
|
||||
while it.isEnd() == 0:
|
||||
toto = it.castToInterface0DIterator()
|
||||
mat = func(toto)
|
||||
|
||||
r = mat.diffuseR()
|
||||
g = mat.diffuseG()
|
||||
b = mat.diffuseB()
|
||||
|
||||
X = 0.412453*r + 0.35758 *g + 0.180423*b
|
||||
Y = 0.212671*r + 0.71516 *g + 0.072169*b
|
||||
Z = 0.019334*r + 0.119193*g + 0.950227*b
|
||||
|
||||
if((X == 0) and (Y == 0) and (Z == 0)):
|
||||
X = 0.01
|
||||
Y = 0.01
|
||||
Z = 0.01
|
||||
u = 4.*X / (X + 15.*Y + 3.*Z)
|
||||
v = 9.*Y / (X + 15.*Y + 3.*Z)
|
||||
|
||||
L= 116. * math.pow((Y/Yn),(1./3.)) -16
|
||||
U = 13. * L * (u - un)
|
||||
V = 13. * L * (v - vn)
|
||||
|
||||
if (L > self._threshold):
|
||||
L = L/1.3
|
||||
U = U+10
|
||||
else:
|
||||
L = L +2.5*(100-L)/5.
|
||||
U = U/3.0
|
||||
V = V/3.0
|
||||
u = U / (13. * L) + un
|
||||
v = V / (13. * L) + vn
|
||||
|
||||
Y = Yn * math.pow( ((L+16.)/116.), 3.)
|
||||
X = -9. * Y * u / ((u - 4.)* v - u * v)
|
||||
Z = (9. * Y - 15*v*Y - v*X) /( 3. * v)
|
||||
|
||||
r = 3.240479 * X - 1.53715 * Y - 0.498535 * Z
|
||||
g = -0.969256 * X + 1.875991 * Y + 0.041556 * Z
|
||||
b = 0.055648 * X - 0.204043 * Y + 1.057311 * Z
|
||||
|
||||
att = it.getObject().attribute()
|
||||
att.setColor(r, g, b)
|
||||
it.increment()
|
||||
|
||||
class pyRandomColorShader(StrokeShader):
|
||||
def getName(self):
|
||||
return "pyRandomColorShader"
|
||||
def __init__(self, s=1):
|
||||
StrokeShader.__init__(self)
|
||||
seed(s)
|
||||
def shade(self, stroke):
|
||||
## pick a random color
|
||||
c0 = float(uniform(15,75))/100.0
|
||||
c1 = float(uniform(15,75))/100.0
|
||||
c2 = float(uniform(15,75))/100.0
|
||||
print c0, c1, c2
|
||||
it = stroke.strokeVerticesBegin()
|
||||
while(it.isEnd() == 0):
|
||||
it.getObject().attribute().setColor(c0,c1,c2)
|
||||
it.increment()
|
||||
|
||||
class py2DCurvatureColorShader(StrokeShader):
|
||||
def getName(self):
|
||||
return "py2DCurvatureColorShader"
|
||||
|
||||
def shade(self, stroke):
|
||||
it = stroke.strokeVerticesBegin()
|
||||
it_end = stroke.strokeVerticesEnd()
|
||||
func = Curvature2DAngleF0D()
|
||||
while it.isEnd() == 0:
|
||||
toto = it.castToInterface0DIterator()
|
||||
sv = it.getObject()
|
||||
att = sv.attribute()
|
||||
c = func(toto)
|
||||
if (c<0):
|
||||
print "negative 2D curvature"
|
||||
color = 10.0 * c/3.1415
|
||||
print color
|
||||
att.setColor(color,color,color);
|
||||
it.increment()
|
||||
|
||||
class pyTimeColorShader(StrokeShader):
|
||||
def __init__(self, step=0.01):
|
||||
StrokeShader.__init__(self)
|
||||
self._t = 0
|
||||
self._step = step
|
||||
def shade(self, stroke):
|
||||
c = self._t*1.0
|
||||
it = stroke.strokeVerticesBegin()
|
||||
it_end = stroke.strokeVerticesEnd()
|
||||
while it.isEnd() == 0:
|
||||
att = it.getObject().attribute()
|
||||
att.setColor(c,c,c)
|
||||
it.increment()
|
||||
self._t = self._t+self._step
|
||||
|
||||
## geometry modifiers
|
||||
|
||||
class pySamplingShader(StrokeShader):
|
||||
def __init__(self, sampling):
|
||||
StrokeShader.__init__(self)
|
||||
self._sampling = sampling
|
||||
def getName(self):
|
||||
return "pySamplingShader"
|
||||
def shade(self, stroke):
|
||||
stroke.Resample(float(self._sampling))
|
||||
|
||||
class pyBackboneStretcherShader(StrokeShader):
|
||||
def __init__(self, l):
|
||||
StrokeShader.__init__(self)
|
||||
self._l = l
|
||||
def getName(self):
|
||||
return "pyBackboneStretcherShader"
|
||||
def shade(self, stroke):
|
||||
it0 = stroke.strokeVerticesBegin()
|
||||
it1 = StrokeVertexIterator(it0)
|
||||
it1.increment()
|
||||
itn = stroke.strokeVerticesEnd()
|
||||
itn.decrement()
|
||||
itn_1 = StrokeVertexIterator(itn)
|
||||
itn_1.decrement()
|
||||
v0 = it0.getObject()
|
||||
v1 = it1.getObject()
|
||||
vn_1 = itn_1.getObject()
|
||||
vn = itn.getObject()
|
||||
p0 = Vec2f(v0.getProjectedX(), v0.getProjectedY())
|
||||
pn = Vec2f(vn.getProjectedX(), vn.getProjectedY())
|
||||
p1 = Vec2f(v1.getProjectedX(), v1.getProjectedY())
|
||||
pn_1 = Vec2f(vn_1.getProjectedX(), vn_1.getProjectedY())
|
||||
d1 = p0-p1
|
||||
d1 = d1/d1.norm()
|
||||
dn = pn-pn_1
|
||||
dn = dn/dn.norm()
|
||||
newFirst = p0+d1*float(self._l)
|
||||
newLast = pn+dn*float(self._l)
|
||||
v0.setPoint(newFirst)
|
||||
vn.setPoint(newLast)
|
||||
|
||||
class pyLengthDependingBackboneStretcherShader(StrokeShader):
|
||||
def __init__(self, l):
|
||||
StrokeShader.__init__(self)
|
||||
self._l = l
|
||||
def getName(self):
|
||||
return "pyBackboneStretcherShader"
|
||||
def shade(self, stroke):
|
||||
l = stroke.getLength2D()
|
||||
stretch = self._l*l
|
||||
it0 = stroke.strokeVerticesBegin()
|
||||
it1 = StrokeVertexIterator(it0)
|
||||
it1.increment()
|
||||
itn = stroke.strokeVerticesEnd()
|
||||
itn.decrement()
|
||||
itn_1 = StrokeVertexIterator(itn)
|
||||
itn_1.decrement()
|
||||
v0 = it0.getObject()
|
||||
v1 = it1.getObject()
|
||||
vn_1 = itn_1.getObject()
|
||||
vn = itn.getObject()
|
||||
p0 = Vec2f(v0.getProjectedX(), v0.getProjectedY())
|
||||
pn = Vec2f(vn.getProjectedX(), vn.getProjectedY())
|
||||
p1 = Vec2f(v1.getProjectedX(), v1.getProjectedY())
|
||||
pn_1 = Vec2f(vn_1.getProjectedX(), vn_1.getProjectedY())
|
||||
d1 = p0-p1
|
||||
d1 = d1/d1.norm()
|
||||
dn = pn-pn_1
|
||||
dn = dn/dn.norm()
|
||||
newFirst = p0+d1*float(stretch)
|
||||
newLast = pn+dn*float(stretch)
|
||||
v0.setPoint(newFirst)
|
||||
vn.setPoint(newLast)
|
||||
|
||||
|
||||
## Shader to replace a stroke by its corresponding tangent
|
||||
class pyGuidingLineShader(StrokeShader):
|
||||
def getName(self):
|
||||
return "pyGuidingLineShader"
|
||||
## shading method
|
||||
def shade(self, stroke):
|
||||
it = stroke.strokeVerticesBegin() ## get the first vertex
|
||||
itlast = stroke.strokeVerticesEnd() ##
|
||||
itlast.decrement() ## get the last one
|
||||
t = itlast.getObject().getPoint() - it.getObject().getPoint() ## tangent direction
|
||||
itmiddle = StrokeVertexIterator(it) ##
|
||||
while(itmiddle.getObject().u()<0.5): ## look for the stroke middle vertex
|
||||
itmiddle.increment() ##
|
||||
it = StrokeVertexIterator(itmiddle)
|
||||
it.increment()
|
||||
while(it.isEnd() == 0): ## position all the vertices along the tangent for the right part
|
||||
it.getObject().setPoint(itmiddle.getObject().getPoint() \
|
||||
+t*(it.getObject().u()-itmiddle.getObject().u()))
|
||||
it.increment()
|
||||
it = StrokeVertexIterator(itmiddle)
|
||||
it.decrement()
|
||||
while(it.isBegin() == 0): ## position all the vertices along the tangent for the left part
|
||||
it.getObject().setPoint(itmiddle.getObject().getPoint() \
|
||||
-t*(itmiddle.getObject().u()-it.getObject().u()))
|
||||
it.decrement()
|
||||
it.getObject().setPoint(itmiddle.getObject().getPoint()-t*(itmiddle.getObject().u())) ## first vertex
|
||||
|
||||
|
||||
class pyBackboneStretcherNoCuspShader(StrokeShader):
|
||||
def __init__(self, l):
|
||||
StrokeShader.__init__(self)
|
||||
self._l = l
|
||||
def getName(self):
|
||||
return "pyBackboneStretcherNoCuspShader"
|
||||
def shade(self, stroke):
|
||||
it0 = stroke.strokeVerticesBegin()
|
||||
it1 = StrokeVertexIterator(it0)
|
||||
it1.increment()
|
||||
itn = stroke.strokeVerticesEnd()
|
||||
itn.decrement()
|
||||
itn_1 = StrokeVertexIterator(itn)
|
||||
itn_1.decrement()
|
||||
v0 = it0.getObject()
|
||||
v1 = it1.getObject()
|
||||
if((v0.getNature() & CUSP == 0) and (v1.getNature() & CUSP == 0)):
|
||||
p0 = v0.getPoint()
|
||||
p1 = v1.getPoint()
|
||||
d1 = p0-p1
|
||||
d1 = d1/d1.norm()
|
||||
newFirst = p0+d1*float(self._l)
|
||||
v0.setPoint(newFirst)
|
||||
vn_1 = itn_1.getObject()
|
||||
vn = itn.getObject()
|
||||
if((vn.getNature() & CUSP == 0) and (vn_1.getNature() & CUSP == 0)):
|
||||
pn = vn.getPoint()
|
||||
pn_1 = vn_1.getPoint()
|
||||
dn = pn-pn_1
|
||||
dn = dn/dn.norm()
|
||||
newLast = pn+dn*float(self._l)
|
||||
vn.setPoint(newLast)
|
||||
|
||||
normalInfo=Normal2DF0D()
|
||||
curvatureInfo=Curvature2DAngleF0D()
|
||||
|
||||
def edgestopping(x, sigma):
|
||||
return exp(- x*x/(2*sigma*sigma))
|
||||
|
||||
class pyDiffusion2Shader(StrokeShader):
|
||||
def __init__(self, lambda1, nbIter):
|
||||
StrokeShader.__init__(self)
|
||||
self._lambda = lambda1
|
||||
self._nbIter = nbIter
|
||||
self._normalInfo = Normal2DF0D()
|
||||
self._curvatureInfo = Curvature2DAngleF0D()
|
||||
def getName(self):
|
||||
return "pyDiffusionShader"
|
||||
def shade(self, stroke):
|
||||
for i in range (1, self._nbIter):
|
||||
it = stroke.strokeVerticesBegin()
|
||||
while it.isEnd() == 0:
|
||||
v=it.getObject()
|
||||
p1 = v.getPoint()
|
||||
p2 = self._normalInfo(it.castToInterface0DIterator())*self._lambda*self._curvatureInfo(it.castToInterface0DIterator())
|
||||
v.setPoint(p1+p2)
|
||||
it.increment()
|
||||
|
||||
class pyTipRemoverShader(StrokeShader):
|
||||
def __init__(self, l):
|
||||
StrokeShader.__init__(self)
|
||||
self._l = l
|
||||
def getName(self):
|
||||
return "pyTipRemoverShader"
|
||||
def shade(self, stroke):
|
||||
originalSize = stroke.strokeVerticesSize()
|
||||
if(originalSize<4):
|
||||
return
|
||||
verticesToRemove = []
|
||||
oldAttributes = []
|
||||
it = stroke.strokeVerticesBegin()
|
||||
while(it.isEnd() == 0):
|
||||
v = it.getObject()
|
||||
if((v.curvilinearAbscissa() < self._l) or (v.strokeLength()-v.curvilinearAbscissa() < self._l)):
|
||||
verticesToRemove.append(v)
|
||||
oldAttributes.append(StrokeAttribute(v.attribute()))
|
||||
it.increment()
|
||||
if(originalSize-len(verticesToRemove) < 2):
|
||||
return
|
||||
for sv in verticesToRemove:
|
||||
stroke.RemoveVertex(sv)
|
||||
stroke.Resample(originalSize)
|
||||
if(stroke.strokeVerticesSize() != originalSize):
|
||||
print "pyTipRemover: Warning: resampling problem"
|
||||
it = stroke.strokeVerticesBegin()
|
||||
for a in oldAttributes:
|
||||
if(it.isEnd() == 1):
|
||||
break
|
||||
v = it.getObject()
|
||||
v.setAttribute(a)
|
||||
it.increment()
|
||||
|
||||
class pyTVertexRemoverShader(StrokeShader):
|
||||
def getName(self):
|
||||
return "pyTVertexRemoverShader"
|
||||
def shade(self, stroke):
|
||||
if(stroke.strokeVerticesSize() <= 3 ):
|
||||
return
|
||||
predTVertex = pyVertexNatureUP0D(T_VERTEX)
|
||||
it = stroke.strokeVerticesBegin()
|
||||
itlast = stroke.strokeVerticesEnd()
|
||||
itlast.decrement()
|
||||
if(predTVertex(it) == 1):
|
||||
stroke.RemoveVertex(it.getObject())
|
||||
if(predTVertex(itlast) == 1):
|
||||
stroke.RemoveVertex(itlast.getObject())
|
||||
|
||||
class pyExtremitiesOrientationShader(StrokeShader):
|
||||
def __init__(self, x1,y1,x2=0,y2=0):
|
||||
StrokeShader.__init__(self)
|
||||
self._v1 = Vec2(x1,y1)
|
||||
self._v2 = Vec2(x2,y2)
|
||||
def getName(self):
|
||||
return "pyExtremitiesOrientationShader"
|
||||
def shade(self, stroke):
|
||||
print self._v1.x(),self._v1.y()
|
||||
stroke.setBeginningOrientation(self._v1.x(),self._v1.y())
|
||||
stroke.setEndingOrientation(self._v2.x(),self._v2.y())
|
||||
|
||||
class pyHLRShader(StrokeShader):
|
||||
def getName(self):
|
||||
return "pyHLRShader"
|
||||
def shade(self, stroke):
|
||||
originalSize = stroke.strokeVerticesSize()
|
||||
if(originalSize<4):
|
||||
return
|
||||
it = stroke.strokeVerticesBegin()
|
||||
invisible = 0
|
||||
it2 = StrokeVertexIterator(it)
|
||||
it2.increment()
|
||||
fe = getFEdge(it.getObject(), it2.getObject())
|
||||
if(fe.qi() != 0):
|
||||
invisible = 1
|
||||
while(it2.isEnd() == 0):
|
||||
v = it.getObject()
|
||||
vnext = it2.getObject()
|
||||
if(v.getNature() & VIEW_VERTEX):
|
||||
#if(v.getNature() & T_VERTEX):
|
||||
fe = getFEdge(v,vnext)
|
||||
qi = fe.qi()
|
||||
if(qi != 0):
|
||||
invisible = 1
|
||||
else:
|
||||
invisible = 0
|
||||
if(invisible == 1):
|
||||
v.attribute().setVisible(0)
|
||||
it.increment()
|
||||
it2.increment()
|
||||
|
||||
class pyTVertexOrientationShader(StrokeShader):
|
||||
def __init__(self):
|
||||
StrokeShader.__init__(self)
|
||||
self._Get2dDirection = Orientation2DF1D()
|
||||
def getName(self):
|
||||
return "pyTVertexOrientationShader"
|
||||
## finds the TVertex orientation from the TVertex and
|
||||
## the previous or next edge
|
||||
def findOrientation(self, tv, ve):
|
||||
mateVE = tv.mate(ve)
|
||||
if((ve.qi() != 0) or (mateVE.qi() != 0)):
|
||||
ait = AdjacencyIterator(tv,1,0)
|
||||
winner = None
|
||||
incoming = 1
|
||||
while(ait.isEnd() == 0):
|
||||
ave = ait.getObject()
|
||||
if((ave.getId() != ve.getId()) and (ave.getId() != mateVE.getId())):
|
||||
winner = ait.getObject()
|
||||
if(ait.isIncoming() == 0):
|
||||
incoming = 0
|
||||
break
|
||||
ait.increment()
|
||||
if(winner != None):
|
||||
if(incoming != 0):
|
||||
direction = self._Get2dDirection(winner.fedgeB())
|
||||
else:
|
||||
direction = self._Get2dDirection(winner.fedgeA())
|
||||
return direction
|
||||
def shade(self, stroke):
|
||||
it = stroke.strokeVerticesBegin()
|
||||
it2 = StrokeVertexIterator(it)
|
||||
it2.increment()
|
||||
## case where the first vertex is a TVertex
|
||||
v = it.getObject()
|
||||
if(v.getNature() & T_VERTEX):
|
||||
tv = v.castToTVertex()
|
||||
ve = getFEdge(v, it2.getObject()).viewedge()
|
||||
if(tv != None):
|
||||
dir = self.findOrientation(tv, ve)
|
||||
#print dir.x(), dir.y()
|
||||
v.attribute().setAttributeVec2f("orientation", dir)
|
||||
while(it2.isEnd() == 0):
|
||||
vprevious = it.getObject()
|
||||
v = it2.getObject()
|
||||
if(v.getNature() & T_VERTEX):
|
||||
tv = v.castToTVertex()
|
||||
ve = getFEdge(vprevious, v).viewedge()
|
||||
if(tv != None):
|
||||
dir = self.findOrientation(tv, ve)
|
||||
#print dir.x(), dir.y()
|
||||
v.attribute().setAttributeVec2f("orientation", dir)
|
||||
it.increment()
|
||||
it2.increment()
|
||||
## case where the last vertex is a TVertex
|
||||
v = it.getObject()
|
||||
if(v.getNature() & T_VERTEX):
|
||||
itPrevious = StrokeVertexIterator(it)
|
||||
itPrevious.decrement()
|
||||
tv = v.castToTVertex()
|
||||
ve = getFEdge(itPrevious.getObject(), v).viewedge()
|
||||
if(tv != None):
|
||||
dir = self.findOrientation(tv, ve)
|
||||
#print dir.x(), dir.y()
|
||||
v.attribute().setAttributeVec2f("orientation", dir)
|
||||
|
||||
class pySinusDisplacementShader(StrokeShader):
|
||||
def __init__(self, f, a):
|
||||
StrokeShader.__init__(self)
|
||||
self._f = f
|
||||
self._a = a
|
||||
self._getNormal = Normal2DF0D()
|
||||
|
||||
def getName(self):
|
||||
return "pySinusDisplacementShader"
|
||||
def shade(self, stroke):
|
||||
it = stroke.strokeVerticesBegin()
|
||||
while it.isEnd() == 0:
|
||||
v = it.getObject()
|
||||
#print self._getNormal.getName()
|
||||
n = self._getNormal(it.castToInterface0DIterator())
|
||||
p = v.getPoint()
|
||||
u = v.u()
|
||||
a = self._a*(1-2*(fabs(u-0.5)))
|
||||
n = n*a*cos(self._f*u*6.28)
|
||||
#print n.x(), n.y()
|
||||
v.setPoint(p+n)
|
||||
#v.setPoint(v.getPoint()+n*a*cos(f*v.u()))
|
||||
it.increment()
|
||||
|
||||
class pyPerlinNoise1DShader(StrokeShader):
|
||||
def __init__(self, freq = 10, amp = 10, oct = 4):
|
||||
StrokeShader.__init__(self)
|
||||
self.__noise = Noise()
|
||||
self.__freq = freq
|
||||
self.__amp = amp
|
||||
self.__oct = oct
|
||||
def getName(self):
|
||||
return "pyPerlinNoise1DShader"
|
||||
def shade(self, stroke):
|
||||
i = randint(0, 50)
|
||||
it = stroke.strokeVerticesBegin()
|
||||
while it.isEnd() == 0:
|
||||
v = it.getObject()
|
||||
nres = self.__noise.turbulence1(i, self.__freq, self.__amp, self.__oct)
|
||||
v.setPoint(v.getProjectedX() + nres, v.getProjectedY() + nres)
|
||||
i = i+1
|
||||
it.increment()
|
||||
|
||||
class pyPerlinNoise2DShader(StrokeShader):
|
||||
def __init__(self, freq = 10, amp = 10, oct = 4):
|
||||
StrokeShader.__init__(self)
|
||||
self.__noise = Noise()
|
||||
self.__freq = freq
|
||||
self.__amp = amp
|
||||
self.__oct = oct
|
||||
def getName(self):
|
||||
return "pyPerlinNoise2DShader"
|
||||
def shade(self, stroke):
|
||||
it = stroke.strokeVerticesBegin()
|
||||
while it.isEnd() == 0:
|
||||
v = it.getObject()
|
||||
vec = Vec2f(v.getProjectedX(), v.getProjectedY())
|
||||
nres = self.__noise.turbulence2(vec, self.__freq, self.__amp, self.__oct)
|
||||
v.setPoint(v.getProjectedX() + nres, v.getProjectedY() + nres)
|
||||
it.increment()
|
||||
|
||||
class pyBluePrintCirclesShader(StrokeShader):
|
||||
def __init__(self, turns = 1):
|
||||
StrokeShader.__init__(self)
|
||||
self.__turns = turns
|
||||
def getName(self):
|
||||
return "pyBluePrintCirclesShader"
|
||||
def shade(self, stroke):
|
||||
p_min = Vec2f(10000, 10000)
|
||||
p_max = Vec2f(0, 0)
|
||||
it = stroke.strokeVerticesBegin()
|
||||
while it.isEnd() == 0:
|
||||
p = it.getObject().getPoint()
|
||||
if (p.x() < p_min.x()):
|
||||
p_min.setX(p.x())
|
||||
if (p.x() > p_max.x()):
|
||||
p_max.setX(p.x())
|
||||
if (p.y() < p_min.y()):
|
||||
p_min.setY(p.y())
|
||||
if (p.y() > p_max.y()):
|
||||
p_max.setY(p.y())
|
||||
it.increment()
|
||||
stroke.Resample(32 * self.__turns)
|
||||
sv_nb = stroke.strokeVerticesSize()
|
||||
# print "min :", p_min.x(), p_min.y() # DEBUG
|
||||
# print "mean :", p_sum.x(), p_sum.y() # DEBUG
|
||||
# print "max :", p_max.x(), p_max.y() # DEBUG
|
||||
# print "----------------------" # DEBUG
|
||||
#######################################################
|
||||
sv_nb = sv_nb / self.__turns
|
||||
center = (p_min + p_max) / 2
|
||||
radius = (center.x() - p_min.x() + center.y() - p_min.y()) / 2
|
||||
p_new = Vec2f()
|
||||
#######################################################
|
||||
it = stroke.strokeVerticesBegin()
|
||||
for j in range(self.__turns):
|
||||
radius = radius + randint(-3, 3)
|
||||
center_x = center.x() + randint(-5, 5)
|
||||
center_y = center.y() + randint(-5, 5)
|
||||
center.setX(center_x)
|
||||
center.setY(center_y)
|
||||
i = 0
|
||||
while i < sv_nb:
|
||||
p_new.setX(center.x() + radius * cos(2 * pi * float(i) / float(sv_nb - 1)))
|
||||
p_new.setY(center.y() + radius * sin(2 * pi * float(i) / float(sv_nb - 1)))
|
||||
it.getObject().setPoint(p_new.x(), p_new.y())
|
||||
i = i + 1
|
||||
it.increment()
|
||||
while it.isEnd() == 0:
|
||||
stroke.RemoveVertex(it.getObject())
|
||||
it.increment()
|
||||
|
||||
|
||||
class pyBluePrintEllipsesShader(StrokeShader):
|
||||
def __init__(self, turns = 1):
|
||||
StrokeShader.__init__(self)
|
||||
self.__turns = turns
|
||||
def getName(self):
|
||||
return "pyBluePrintEllipsesShader"
|
||||
def shade(self, stroke):
|
||||
p_min = Vec2f(10000, 10000)
|
||||
p_max = Vec2f(0, 0)
|
||||
it = stroke.strokeVerticesBegin()
|
||||
while it.isEnd() == 0:
|
||||
p = it.getObject().getPoint()
|
||||
if (p.x() < p_min.x()):
|
||||
p_min.setX(p.x())
|
||||
if (p.x() > p_max.x()):
|
||||
p_max.setX(p.x())
|
||||
if (p.y() < p_min.y()):
|
||||
p_min.setY(p.y())
|
||||
if (p.y() > p_max.y()):
|
||||
p_max.setY(p.y())
|
||||
it.increment()
|
||||
stroke.Resample(32 * self.__turns)
|
||||
sv_nb = stroke.strokeVerticesSize()
|
||||
# print "min :", p_min.x(), p_min.y() # DEBUG
|
||||
# print "mean :", p_sum.x(), p_sum.y() # DEBUG
|
||||
# print "max :", p_max.x(), p_max.y() # DEBUG
|
||||
# print "----------------------" # DEBUG
|
||||
#######################################################
|
||||
sv_nb = sv_nb / self.__turns
|
||||
center = (p_min + p_max) / 2
|
||||
radius_x = center.x() - p_min.x()
|
||||
radius_y = center.y() - p_min.y()
|
||||
p_new = Vec2f()
|
||||
#######################################################
|
||||
it = stroke.strokeVerticesBegin()
|
||||
for j in range(self.__turns):
|
||||
radius_x = radius_x + randint(-3, 3)
|
||||
radius_y = radius_y + randint(-3, 3)
|
||||
center_x = center.x() + randint(-5, 5)
|
||||
center_y = center.y() + randint(-5, 5)
|
||||
center.setX(center_x)
|
||||
center.setY(center_y)
|
||||
i = 0
|
||||
while i < sv_nb:
|
||||
p_new.setX(center.x() + radius_x * cos(2 * pi * float(i) / float(sv_nb - 1)))
|
||||
p_new.setY(center.y() + radius_y * sin(2 * pi * float(i) / float(sv_nb - 1)))
|
||||
it.getObject().setPoint(p_new.x(), p_new.y())
|
||||
i = i + 1
|
||||
it.increment()
|
||||
while it.isEnd() == 0:
|
||||
stroke.RemoveVertex(it.getObject())
|
||||
it.increment()
|
||||
|
||||
|
||||
class pyBluePrintSquaresShader(StrokeShader):
|
||||
def __init__(self, turns = 1, bb_len = 10):
|
||||
StrokeShader.__init__(self)
|
||||
self.__turns = turns
|
||||
self.__bb_len = bb_len
|
||||
def getName(self):
|
||||
return "pyBluePrintSquaresShader"
|
||||
def shade(self, stroke):
|
||||
p_min = Vec2f(10000, 10000)
|
||||
p_max = Vec2f(0, 0)
|
||||
it = stroke.strokeVerticesBegin()
|
||||
while it.isEnd() == 0:
|
||||
p = it.getObject().getPoint()
|
||||
if (p.x() < p_min.x()):
|
||||
p_min.setX(p.x())
|
||||
if (p.x() > p_max.x()):
|
||||
p_max.setX(p.x())
|
||||
if (p.y() < p_min.y()):
|
||||
p_min.setY(p.y())
|
||||
if (p.y() > p_max.y()):
|
||||
p_max.setY(p.y())
|
||||
it.increment()
|
||||
stroke.Resample(32 * self.__turns)
|
||||
sv_nb = stroke.strokeVerticesSize()
|
||||
#######################################################
|
||||
sv_nb = sv_nb / self.__turns
|
||||
first = sv_nb / 4
|
||||
second = 2 * first
|
||||
third = 3 * first
|
||||
fourth = sv_nb
|
||||
vec_first = Vec2f(p_max.x() - p_min.x() + 2 * self.__bb_len, 0)
|
||||
vec_second = Vec2f(0, p_max.y() - p_min.y() + 2 * self.__bb_len)
|
||||
vec_third = vec_first * -1
|
||||
vec_fourth = vec_second * -1
|
||||
p_first = Vec2f(p_min.x() - self.__bb_len, p_min.y())
|
||||
p_second = Vec2f(p_max.x(), p_min.y() - self.__bb_len)
|
||||
p_third = Vec2f(p_max.x() + self.__bb_len, p_max.y())
|
||||
p_fourth = Vec2f(p_min.x(), p_max.y() + self.__bb_len)
|
||||
#######################################################
|
||||
it = stroke.strokeVerticesBegin()
|
||||
visible = 1
|
||||
for j in range(self.__turns):
|
||||
i = 0
|
||||
while i < sv_nb:
|
||||
if i < first:
|
||||
p_new = p_first + vec_first * float(i)/float(first - 1)
|
||||
if i == first - 1:
|
||||
visible = 0
|
||||
elif i < second:
|
||||
p_new = p_second + vec_second * float(i - first)/float(second - first - 1)
|
||||
if i == second - 1:
|
||||
visible = 0
|
||||
elif i < third:
|
||||
p_new = p_third + vec_third * float(i - second)/float(third - second - 1)
|
||||
if i == third - 1:
|
||||
visible = 0
|
||||
else:
|
||||
p_new = p_fourth + vec_fourth * float(i - third)/float(fourth - third - 1)
|
||||
if i == fourth - 1:
|
||||
visible = 0
|
||||
it.getObject().setPoint(p_new.x(), p_new.y())
|
||||
it.getObject().attribute().setVisible(visible)
|
||||
if visible == 0:
|
||||
visible = 1
|
||||
i = i + 1
|
||||
it.increment()
|
||||
while it.isEnd() == 0:
|
||||
stroke.RemoveVertex(it.getObject())
|
||||
it.increment()
|
||||
|
||||
|
||||
class pyBluePrintDirectedSquaresShader(StrokeShader):
|
||||
def __init__(self, turns = 1, bb_len = 10, mult = 1):
|
||||
StrokeShader.__init__(self)
|
||||
self.__mult = mult
|
||||
self.__turns = turns
|
||||
self.__bb_len = 1 + float(bb_len) / 100
|
||||
def getName(self):
|
||||
return "pyBluePrintDirectedSquaresShader"
|
||||
def shade(self, stroke):
|
||||
stroke.Resample(32 * self.__turns)
|
||||
p_mean = Vec2f(0, 0)
|
||||
p_min = Vec2f(10000, 10000)
|
||||
p_max = Vec2f(0, 0)
|
||||
it = stroke.strokeVerticesBegin()
|
||||
while it.isEnd() == 0:
|
||||
p = it.getObject().getPoint()
|
||||
p_mean = p_mean + p
|
||||
## if (p.x() < p_min.x()):
|
||||
## p_min.setX(p.x())
|
||||
## if (p.x() > p_max.x()):
|
||||
## p_max.setX(p.x())
|
||||
## if (p.y() < p_min.y()):
|
||||
## p_min.setY(p.y())
|
||||
## if (p.y() > p_max.y()):
|
||||
## p_max.setY(p.y())
|
||||
it.increment()
|
||||
sv_nb = stroke.strokeVerticesSize()
|
||||
p_mean = p_mean / sv_nb
|
||||
p_var_xx = 0
|
||||
p_var_yy = 0
|
||||
p_var_xy = 0
|
||||
it = stroke.strokeVerticesBegin()
|
||||
while it.isEnd() == 0:
|
||||
p = it.getObject().getPoint()
|
||||
p_var_xx = p_var_xx + pow(p.x() - p_mean.x(), 2)
|
||||
p_var_yy = p_var_yy + pow(p.y() - p_mean.y(), 2)
|
||||
p_var_xy = p_var_xy + (p.x() - p_mean.x()) * (p.y() - p_mean.y())
|
||||
it.increment()
|
||||
p_var_xx = p_var_xx / sv_nb
|
||||
p_var_yy = p_var_yy / sv_nb
|
||||
p_var_xy = p_var_xy / sv_nb
|
||||
## print p_var_xx, p_var_yy, p_var_xy
|
||||
trace = p_var_xx + p_var_yy
|
||||
det = p_var_xx * p_var_yy - p_var_xy * p_var_xy
|
||||
sqrt_coeff = sqrt(trace * trace - 4 * det)
|
||||
lambda1 = (trace + sqrt_coeff) / 2
|
||||
lambda2 = (trace - sqrt_coeff) / 2
|
||||
## print lambda1, lambda2
|
||||
theta = atan(2 * p_var_xy / (p_var_xx - p_var_yy)) / 2
|
||||
## print theta
|
||||
if p_var_yy > p_var_xx:
|
||||
e1 = Vec2f(cos(theta + pi / 2), sin(theta + pi / 2)) * sqrt(lambda1) * self.__mult
|
||||
e2 = Vec2f(cos(theta + pi), sin(theta + pi)) * sqrt(lambda2) * self.__mult
|
||||
else:
|
||||
e1 = Vec2f(cos(theta), sin(theta)) * sqrt(lambda1) * self.__mult
|
||||
e2 = Vec2f(cos(theta + pi / 2), sin(theta + pi / 2)) * sqrt(lambda2) * self.__mult
|
||||
#######################################################
|
||||
sv_nb = sv_nb / self.__turns
|
||||
first = sv_nb / 4
|
||||
second = 2 * first
|
||||
third = 3 * first
|
||||
fourth = sv_nb
|
||||
bb_len1 = self.__bb_len
|
||||
bb_len2 = 1 + (bb_len1 - 1) * sqrt(lambda1 / lambda2)
|
||||
p_first = p_mean - e1 - e2 * bb_len2
|
||||
p_second = p_mean - e1 * bb_len1 + e2
|
||||
p_third = p_mean + e1 + e2 * bb_len2
|
||||
p_fourth = p_mean + e1 * bb_len1 - e2
|
||||
vec_first = e2 * bb_len2 * 2
|
||||
vec_second = e1 * bb_len1 * 2
|
||||
vec_third = vec_first * -1
|
||||
vec_fourth = vec_second * -1
|
||||
#######################################################
|
||||
it = stroke.strokeVerticesBegin()
|
||||
visible = 1
|
||||
for j in range(self.__turns):
|
||||
i = 0
|
||||
while i < sv_nb:
|
||||
if i < first:
|
||||
p_new = p_first + vec_first * float(i)/float(first - 1)
|
||||
if i == first - 1:
|
||||
visible = 0
|
||||
elif i < second:
|
||||
p_new = p_second + vec_second * float(i - first)/float(second - first - 1)
|
||||
if i == second - 1:
|
||||
visible = 0
|
||||
elif i < third:
|
||||
p_new = p_third + vec_third * float(i - second)/float(third - second - 1)
|
||||
if i == third - 1:
|
||||
visible = 0
|
||||
else:
|
||||
p_new = p_fourth + vec_fourth * float(i - third)/float(fourth - third - 1)
|
||||
if i == fourth - 1:
|
||||
visible = 0
|
||||
it.getObject().setPoint(p_new.x(), p_new.y())
|
||||
it.getObject().attribute().setVisible(visible)
|
||||
if visible == 0:
|
||||
visible = 1
|
||||
i = i + 1
|
||||
it.increment()
|
||||
while it.isEnd() == 0:
|
||||
stroke.RemoveVertex(it.getObject())
|
||||
it.increment()
|
||||
|
||||
class pyModulateAlphaShader(StrokeShader):
|
||||
def __init__(self, min = 0, max = 1):
|
||||
StrokeShader.__init__(self)
|
||||
self.__min = min
|
||||
self.__max = max
|
||||
def getName(self):
|
||||
return "pyModulateAlphaShader"
|
||||
def shade(self, stroke):
|
||||
it = stroke.strokeVerticesBegin()
|
||||
while it.isEnd() == 0:
|
||||
alpha = it.getObject().attribute().getAlpha()
|
||||
p = it.getObject().getPoint()
|
||||
alpha = alpha * p.y() / 400
|
||||
if alpha < self.__min:
|
||||
alpha = self.__min
|
||||
elif alpha > self.__max:
|
||||
alpha = self.__max
|
||||
it.getObject().attribute().setAlpha(alpha)
|
||||
it.increment()
|
||||
|
||||
|
||||
## various
|
||||
class pyDummyShader(StrokeShader):
|
||||
def getName(self):
|
||||
return "pyDummyShader"
|
||||
def shade(self, stroke):
|
||||
it = stroke.strokeVerticesBegin()
|
||||
it_end = stroke.strokeVerticesEnd()
|
||||
while it.isEnd() == 0:
|
||||
toto = it.castToInterface0DIterator()
|
||||
att = it.getObject().attribute()
|
||||
att.setColor(0.3, 0.4, 0.4)
|
||||
att.setThickness(0, 5)
|
||||
it.increment()
|
||||
|
||||
class pyDebugShader(StrokeShader):
|
||||
def getName(self):
|
||||
return "pyDebugShader"
|
||||
|
||||
def shade(self, stroke):
|
||||
fe = GetSelectedFEdgeCF()
|
||||
id1=fe.vertexA().getId()
|
||||
id2=fe.vertexB().getId()
|
||||
#print id1.getFirst(), id1.getSecond()
|
||||
#print id2.getFirst(), id2.getSecond()
|
||||
it = stroke.strokeVerticesBegin()
|
||||
found = 0
|
||||
foundfirst = 0
|
||||
foundsecond = 0
|
||||
while it.isEnd() == 0:
|
||||
cp = it.getObject()
|
||||
if((cp.A().getId() == id1) or (cp.B().getId() == id1)):
|
||||
foundfirst = 1
|
||||
if((cp.A().getId() == id2) or (cp.B().getId() == id2)):
|
||||
foundsecond = 1
|
||||
if((foundfirst != 0) and (foundsecond != 0)):
|
||||
found = 1
|
||||
break
|
||||
it.increment()
|
||||
if(found != 0):
|
||||
print "The selected Stroke id is: ", stroke.getId().getFirst(), stroke.getId().getSecond()
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
#
|
||||
# Filename : sketchy_multiple_parameterization.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Builds sketchy strokes whose topology relies on a
|
||||
# parameterization that covers the complete lines (visible+invisible)
|
||||
# whereas only the visible portions are actually drawn
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from ChainingIterators import *
|
||||
from shaders import *
|
||||
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
## 0: don't restrict to selection
|
||||
Operators.bidirectionalChain(pySketchyChainSilhouetteIterator(3,0))
|
||||
shaders_list = [
|
||||
SamplingShader(2),
|
||||
SpatialNoiseShader(15, 120, 2, 1, 1),
|
||||
IncreasingThicknessShader(5, 30),
|
||||
SmoothingShader(100, 0.05, 0, 0.2, 0, 0, 0, 1),
|
||||
IncreasingColorShader(0,0.2,0,1,0.2,0.7,0.2,1),
|
||||
TextureAssignerShader(6),
|
||||
pyHLRShader()
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
89
source/blender/freestyle/style_modules_blender/sketchy_topology_broken.py
Executable file
89
source/blender/freestyle/style_modules_blender/sketchy_topology_broken.py
Executable file
@@ -0,0 +1,89 @@
|
||||
#
|
||||
# Filename : sketchy_topology_broken.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : The topology of the strokes is, first, built
|
||||
# independantly from the 3D topology of objects,
|
||||
# and, second, so as to chain several times the same ViewEdge.
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from ChainingIterators import *
|
||||
from shaders import *
|
||||
|
||||
## Backbone stretcher that leaves cusps intact to avoid cracks
|
||||
class pyBackboneStretcherNoCuspShader(StrokeShader):
|
||||
def __init__(self, l):
|
||||
StrokeShader.__init__(self)
|
||||
self._l = l
|
||||
def getName(self):
|
||||
return "pyBackboneStretcherNoCuspShader"
|
||||
def shade(self, stroke):
|
||||
it0 = stroke.strokeVerticesBegin()
|
||||
it1 = StrokeVertexIterator(it0)
|
||||
it1.increment()
|
||||
itn = stroke.strokeVerticesEnd()
|
||||
itn.decrement()
|
||||
itn_1 = StrokeVertexIterator(itn)
|
||||
itn_1.decrement()
|
||||
v0 = it0.getObject()
|
||||
v1 = it1.getObject()
|
||||
if((v0.getNature() & CUSP == 0) and (v1.getNature() & CUSP == 0)):
|
||||
p0 = v0.getPoint()
|
||||
p1 = v1.getPoint()
|
||||
d1 = p0-p1
|
||||
d1 = d1/d1.norm()
|
||||
newFirst = p0+d1*float(self._l)
|
||||
v0.setPoint(newFirst)
|
||||
else:
|
||||
print "got a v0 cusp"
|
||||
vn_1 = itn_1.getObject()
|
||||
vn = itn.getObject()
|
||||
if((vn.getNature() & CUSP == 0) and (vn_1.getNature() & CUSP == 0)):
|
||||
pn = vn.getPoint()
|
||||
pn_1 = vn_1.getPoint()
|
||||
dn = pn-pn_1
|
||||
dn = dn/dn.norm()
|
||||
newLast = pn+dn*float(self._l)
|
||||
vn.setPoint(newLast)
|
||||
else:
|
||||
print "got a vn cusp"
|
||||
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
## Chain 3 times each ViewEdge indpendantly from the
|
||||
## initial objects topology
|
||||
Operators.bidirectionalChain(pySketchyChainingIterator(3))
|
||||
shaders_list = [
|
||||
SamplingShader(4),
|
||||
SpatialNoiseShader(6, 120, 2, 1, 1),
|
||||
IncreasingThicknessShader(4, 10),
|
||||
SmoothingShader(100, 0.1, 0, 0.2, 0, 0, 0, 1),
|
||||
pyBackboneStretcherNoCuspShader(20),
|
||||
#ConstantColorShader(0.0,0.0,0.0)
|
||||
IncreasingColorShader(0.2,0.2,0.2,1,0.5,0.5,0.5,1),
|
||||
#IncreasingColorShader(1,0,0,1,0,1,0,1),
|
||||
TextureAssignerShader(4)
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
49
source/blender/freestyle/style_modules_blender/sketchy_topology_preserved.py
Executable file
49
source/blender/freestyle/style_modules_blender/sketchy_topology_preserved.py
Executable file
@@ -0,0 +1,49 @@
|
||||
#
|
||||
# Filename : sketchy_topology_preserved.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : The topology of the strokes is built
|
||||
# so as to chain several times the same ViewEdge.
|
||||
# The topology of the objects is preserved
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from ChainingIterators import *
|
||||
from PredicatesU1D import *
|
||||
from shaders import *
|
||||
|
||||
upred = QuantitativeInvisibilityUP1D(0)
|
||||
Operators.select(upred)
|
||||
Operators.bidirectionalChain(pySketchyChainSilhouetteIterator(3,1))
|
||||
shaders_list = [
|
||||
SamplingShader(4),
|
||||
SpatialNoiseShader(20, 220, 2, 1, 1),
|
||||
IncreasingThicknessShader(4, 8),
|
||||
SmoothingShader(300, 0.05, 0, 0.2, 0, 0, 0, 0.5),
|
||||
ConstantColorShader(0.6,0.2,0.0),
|
||||
TextureAssignerShader(4),
|
||||
]
|
||||
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
#
|
||||
# Filename : split_at_highest_2d_curvature.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws the visible lines (chaining follows same nature lines)
|
||||
# (most basic style module)
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from PredicatesU1D import *
|
||||
from Functions0D import *
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
func = pyInverseCurvature2DAngleF0D()
|
||||
Operators.recursiveSplit(func, pyParameterUP0D(0.4,0.6), NotUP1D(pyHigherLengthUP1D(100)), 2)
|
||||
shaders_list = [ConstantThicknessShader(10), IncreasingColorShader(1,0,0,1,0,1,0,1), TextureAssignerShader(3)]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
||||
42
source/blender/freestyle/style_modules_blender/split_at_tvertices.py
Executable file
42
source/blender/freestyle/style_modules_blender/split_at_tvertices.py
Executable file
@@ -0,0 +1,42 @@
|
||||
#
|
||||
# Filename : split_at_tvertices.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws strokes that starts and stops at Tvertices (visible or not)
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from PredicatesU1D import *
|
||||
from PredicatesU0D import *
|
||||
from Functions0D import *
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
start = pyVertexNatureUP0D(T_VERTEX)
|
||||
## use the same predicate to decide where to start and where to stop
|
||||
## the strokes:
|
||||
Operators.sequentialSplit(start, start, 10)
|
||||
shaders_list = [ConstantThicknessShader(5), IncreasingColorShader(1,0,0,1,0,1,0,1), TextureAssignerShader(3)]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
|
||||
43
source/blender/freestyle/style_modules_blender/stroke_texture.py
Executable file
43
source/blender/freestyle/style_modules_blender/stroke_texture.py
Executable file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# Filename : stroke_texture.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws textured strokes (illustrate the StrokeTextureShader shader)
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from shaders import *
|
||||
from ChainingIterators import *
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
shaders_list = [
|
||||
SamplingShader(3),
|
||||
BezierCurveShader(4),
|
||||
StrokeTextureShader("washbrushAlpha.bmp", Stroke.DRY_MEDIUM, 1),
|
||||
ConstantThicknessShader(40),
|
||||
ConstantColorShader(0,0,0,1),
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
43
source/blender/freestyle/style_modules_blender/suggestive.py
Executable file
43
source/blender/freestyle/style_modules_blender/suggestive.py
Executable file
@@ -0,0 +1,43 @@
|
||||
#
|
||||
# Filename : suggestive.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Draws the suggestive contours.
|
||||
# ***** The suggestive contours must be enabled
|
||||
# in the options dialog *****
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from PredicatesU1D import *
|
||||
from shaders import *
|
||||
|
||||
upred = AndUP1D(pyNatureUP1D(SUGGESTIVE_CONTOUR), QuantitativeInvisibilityUP1D(0))
|
||||
Operators.select(upred)
|
||||
Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(upred))
|
||||
shaders_list = [
|
||||
IncreasingThicknessShader(1, 3),
|
||||
ConstantColorShader(0.2,0.2,0.2, 1)
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
@@ -0,0 +1,62 @@
|
||||
#
|
||||
# Filename : thickness_fof_depth_discontinuity.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Assigns to strokes a thickness that depends on the depth discontinuity
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from ChainingIterators import *
|
||||
from shaders import *
|
||||
|
||||
class pyDepthDiscontinuityThicknessShader(StrokeShader):
|
||||
def __init__(self, min, max):
|
||||
StrokeShader.__init__(self)
|
||||
self.__min = float(min)
|
||||
self.__max = float(max)
|
||||
self.__func = ZDiscontinuityF0D()
|
||||
def getName(self):
|
||||
return "pyDepthDiscontinuityThicknessShader"
|
||||
def shade(self, stroke):
|
||||
it = stroke.strokeVerticesBegin()
|
||||
z_min=0.0
|
||||
z_max=1.0
|
||||
a = (self.__max - self.__min)/(z_max-z_min)
|
||||
b = (self.__min*z_max-self.__max*z_min)/(z_max-z_min)
|
||||
it = stroke.strokeVerticesBegin()
|
||||
while it.isEnd() == 0:
|
||||
z = self.__func(it.castToInterface0DIterator())
|
||||
thickness = a*z+b
|
||||
it.getObject().attribute().setThickness(thickness, thickness)
|
||||
it.increment()
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
shaders_list = [
|
||||
SamplingShader(1),
|
||||
ConstantThicknessShader(3),
|
||||
ConstantColorShader(0.0,0.0,0.0),
|
||||
pyDepthDiscontinuityThicknessShader(0.8, 6)
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
42
source/blender/freestyle/style_modules_blender/tipremover.py
Executable file
42
source/blender/freestyle/style_modules_blender/tipremover.py
Executable file
@@ -0,0 +1,42 @@
|
||||
#
|
||||
# Filename : tipremover.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Removes strokes extremities
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from ChainingIterators import *
|
||||
from shaders import *
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
shaders_list = [
|
||||
SamplingShader(5),
|
||||
ConstantThicknessShader(3),
|
||||
ConstantColorShader(0,0,0),
|
||||
TipRemoverShader(20)
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
42
source/blender/freestyle/style_modules_blender/tvertex_remover.py
Executable file
42
source/blender/freestyle/style_modules_blender/tvertex_remover.py
Executable file
@@ -0,0 +1,42 @@
|
||||
#
|
||||
# Filename : tvertex_remover.py
|
||||
# Author : Stephane Grabli
|
||||
# Date : 04/08/2005
|
||||
# Purpose : Removes TVertices
|
||||
#
|
||||
#############################################################################
|
||||
#
|
||||
# Copyright (C) : Please refer to the COPYRIGHT file distributed
|
||||
# with this source distribution.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
#############################################################################
|
||||
|
||||
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from PredicatesB1D import *
|
||||
from shaders import *
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
|
||||
shaders_list = [
|
||||
IncreasingThicknessShader(3, 5),
|
||||
ConstantColorShader(0.2,0.2,0.2, 1),
|
||||
SamplingShader(10.0),
|
||||
pyTVertexRemoverShader()
|
||||
]
|
||||
Operators.create(TrueUP1D(), shaders_list)
|
||||
40
source/blender/freestyle/style_modules_blender/uniformpruning_zsort.py
Executable file
40
source/blender/freestyle/style_modules_blender/uniformpruning_zsort.py
Executable file
@@ -0,0 +1,40 @@
|
||||
from Blender.Freestyle import *
|
||||
from logical_operators import *
|
||||
from PredicatesU1D import *
|
||||
from PredicatesU0D import *
|
||||
from PredicatesB1D import *
|
||||
from Functions0D import *
|
||||
from Functions1D import *
|
||||
from shaders import *
|
||||
|
||||
class pyDensityUP1D(UnaryPredicate1D):
|
||||
def __init__(self,wsize,threshold, integration = IntegrationType.MEAN, sampling=2.0):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self._wsize = wsize
|
||||
self._threshold = threshold
|
||||
self._integration = integration
|
||||
self._func = DensityF1D(self._wsize, self._integration, sampling)
|
||||
|
||||
def getName(self):
|
||||
return "pyDensityUP1D"
|
||||
|
||||
def __call__(self, inter):
|
||||
d = self._func(inter)
|
||||
print "For Chain ", inter.getId().getFirst(), inter.getId().getSecond(), "density is ", d
|
||||
if(d < self._threshold):
|
||||
return 1
|
||||
return 0
|
||||
|
||||
Operators.select(QuantitativeInvisibilityUP1D(0))
|
||||
Operators.bidirectionalChain(ChainSilhouetteIterator())
|
||||
#Operators.sequentialSplit(pyVertexNatureUP0D(VIEW_VERTEX), 2)
|
||||
Operators.sort(pyZBP1D())
|
||||
shaders_list = [
|
||||
StrokeTextureShader("smoothAlpha.bmp", Stroke.OPAQUE_MEDIUM, 0),
|
||||
ConstantThicknessShader(3),
|
||||
SamplingShader(5.0),
|
||||
ConstantColorShader(0,0,0,1)
|
||||
]
|
||||
Operators.create(pyDensityUP1D(2,0.05, IntegrationType.MEAN,4), shaders_list)
|
||||
#Operators.create(pyDensityFunctorUP1D(8,0.03, pyGetInverseProjectedZF1D(), 0,1, IntegrationType.MEAN), shaders_list)
|
||||
|
||||
241
source/blender/freestyle/style_modules_blender/vector.py
Executable file
241
source/blender/freestyle/style_modules_blender/vector.py
Executable file
@@ -0,0 +1,241 @@
|
||||
# This module defines 3d geometrical vectors with the standard
|
||||
# operations on them.
|
||||
#
|
||||
# Written by: Konrad Hinsen
|
||||
# Last revision: 1996-1-26
|
||||
#
|
||||
|
||||
"""This module defines three-dimensional geometrical vectors. Vectors support
|
||||
the usual mathematical operations (v1, v2: vectors, s: scalar):
|
||||
v1+v2 addition
|
||||
v1-v2 subtraction
|
||||
v1*v2 scalar product
|
||||
s*v1 multiplication with a scalar
|
||||
v1/s division by a scalar
|
||||
v1.cross(v2) cross product
|
||||
v1.length() length
|
||||
v1.normal() normal vector in direction of v1
|
||||
v1.angle(v2) angle between two vectors
|
||||
v1.x(), v1[0] first element
|
||||
v1.y(), v1[1] second element
|
||||
v1.z(), v1[2] third element
|
||||
|
||||
The module offers the following items for export:
|
||||
Vec3D(x,y,z) the constructor for vectors
|
||||
isVector(x) a type check function
|
||||
ex, ey, ez unit vectors along the x-, y-, and z-axes (predefined constants)
|
||||
|
||||
Note: vector elements can be any kind of numbers on which the operations
|
||||
addition, subtraction, multiplication, division, comparison, sqrt, and acos
|
||||
are defined. Integer elements are treated as floating point elements.
|
||||
"""
|
||||
|
||||
import math, types
|
||||
|
||||
class Vec3:
|
||||
|
||||
isVec3 = 1
|
||||
|
||||
def __init__(self, x=0., y=0., z=0.):
|
||||
self.data = [x,y,z]
|
||||
|
||||
def __repr__(self):
|
||||
return 'Vec3(%s,%s,%s)' % (`self.data[0]`,\
|
||||
`self.data[1]`,`self.data[2]`)
|
||||
|
||||
def __str__(self):
|
||||
return `self.data`
|
||||
|
||||
def __add__(self, other):
|
||||
return Vec3(self.data[0]+other.data[0],\
|
||||
self.data[1]+other.data[1],self.data[2]+other.data[2])
|
||||
__radd__ = __add__
|
||||
|
||||
def __neg__(self):
|
||||
return Vec3(-self.data[0], -self.data[1], -self.data[2])
|
||||
|
||||
def __sub__(self, other):
|
||||
return Vec3(self.data[0]-other.data[0],\
|
||||
self.data[1]-other.data[1],self.data[2]-other.data[2])
|
||||
|
||||
def __rsub__(self, other):
|
||||
return Vec3(other.data[0]-self.data[0],\
|
||||
other.data[1]-self.data[1],other.data[2]-self.data[2])
|
||||
|
||||
def __mul__(self, other):
|
||||
if isVec3(other):
|
||||
return reduce(lambda a,b: a+b,
|
||||
map(lambda a,b: a*b, self.data, other.data))
|
||||
else:
|
||||
return Vec3(self.data[0]*other, self.data[1]*other,
|
||||
self.data[2]*other)
|
||||
|
||||
def __rmul__(self, other):
|
||||
if isVec3(other):
|
||||
return reduce(lambda a,b: a+b,
|
||||
map(lambda a,b: a*b, self.data, other.data))
|
||||
else:
|
||||
return Vec3(other*self.data[0], other*self.data[1],
|
||||
other*self.data[2])
|
||||
|
||||
def __div__(self, other):
|
||||
if isVec3(other):
|
||||
raise TypeError, "Can't divide by a vector"
|
||||
else:
|
||||
return Vec3(_div(self.data[0],other), _div(self.data[1],other),
|
||||
_div(self.data[2],other))
|
||||
|
||||
def __rdiv__(self, other):
|
||||
raise TypeError, "Can't divide by a vector"
|
||||
|
||||
def __cmp__(self, other):
|
||||
return cmp(self.data[0],other.data[0]) \
|
||||
or cmp(self.data[1],other.data[1]) \
|
||||
or cmp(self.data[2],other.data[2])
|
||||
|
||||
def __getitem__(self, index):
|
||||
return self.data[index]
|
||||
|
||||
def x(self):
|
||||
return self.data[0]
|
||||
def y(self):
|
||||
return self.data[1]
|
||||
def z(self):
|
||||
return self.data[2]
|
||||
|
||||
def length(self):
|
||||
return math.sqrt(self*self)
|
||||
|
||||
def normal(self):
|
||||
len = self.length()
|
||||
if len == 0:
|
||||
raise ZeroDivisionError, "Can't normalize a zero-length vector"
|
||||
return self/len
|
||||
|
||||
def cross(self, other):
|
||||
if not isVec3(other):
|
||||
raise TypeError, "Cross product with non-vector"
|
||||
return Vec3(self.data[1]*other.data[2]-self.data[2]*other.data[1],
|
||||
self.data[2]*other.data[0]-self.data[0]*other.data[2],
|
||||
self.data[0]*other.data[1]-self.data[1]*other.data[0])
|
||||
|
||||
def angle(self, other):
|
||||
if not isVec3(other):
|
||||
raise TypeError, "Angle between vector and non-vector"
|
||||
cosa = (self*other)/(self.length()*other.length())
|
||||
cosa = max(-1.,min(1.,cosa))
|
||||
return math.acos(cosa)
|
||||
|
||||
|
||||
class Vec2:
|
||||
|
||||
isVec2 = 1
|
||||
|
||||
def __init__(self, x=0., y=0.):
|
||||
self.data = [x,y]
|
||||
|
||||
def __repr__(self):
|
||||
return 'Vec2(%s,%s,%s)' % (`self.data[0]`,\
|
||||
`self.data[1]`)
|
||||
|
||||
def __str__(self):
|
||||
return `self.data`
|
||||
|
||||
def __add__(self, other):
|
||||
return Vec2(self.data[0]+other.data[0],\
|
||||
self.data[1]+other.data[1])
|
||||
__radd__ = __add__
|
||||
|
||||
def __neg__(self):
|
||||
return Vec2(-self.data[0], -self.data[1])
|
||||
|
||||
def __sub__(self, other):
|
||||
return Vec2(self.data[0]-other.data[0],\
|
||||
self.data[1]-other.data[1])
|
||||
|
||||
def __rsub__(self, other):
|
||||
return Vec2(other.data[0]-self.data[0],\
|
||||
other.data[1]-self.data[1])
|
||||
|
||||
def __mul__(self, other):
|
||||
if isVec2(other):
|
||||
return reduce(lambda a,b: a+b,
|
||||
map(lambda a,b: a*b, self.data, other.data))
|
||||
else:
|
||||
return Vec2(self.data[0]*other, self.data[1]*other)
|
||||
|
||||
def __rmul__(self, other):
|
||||
if isVec2(other):
|
||||
return reduce(lambda a,b: a+b,
|
||||
map(lambda a,b: a*b, self.data, other.data))
|
||||
else:
|
||||
return Vec2(other*self.data[0], other*self.data[1])
|
||||
|
||||
def __div__(self, other):
|
||||
if isVec2(other):
|
||||
raise TypeError, "Can't divide by a vector"
|
||||
else:
|
||||
return Vec2(_div(self.data[0],other), _div(self.data[1],other))
|
||||
|
||||
def __rdiv__(self, other):
|
||||
raise TypeError, "Can't divide by a vector"
|
||||
|
||||
def __cmp__(self, other):
|
||||
return cmp(self.data[0],other.data[0]) \
|
||||
or cmp(self.data[1],other.data[1])
|
||||
|
||||
def __getitem__(self, index):
|
||||
return self.data[index]
|
||||
|
||||
def x(self):
|
||||
return self.data[0]
|
||||
def y(self):
|
||||
return self.data[1]
|
||||
|
||||
def length(self):
|
||||
return math.sqrt(self*self)
|
||||
|
||||
def normal(self):
|
||||
len = self.length()
|
||||
if len == 0:
|
||||
raise ZeroDivisionError, "Can't normalize a zero-length vector"
|
||||
return self/len
|
||||
|
||||
#def cross(self, other):
|
||||
# if not isVec2(other):
|
||||
# raise TypeError, "Cross product with non-vector"
|
||||
# return Vec2(self.data[1]*other.data[2]-self.data[2]*other.data[1],
|
||||
# self.data[2]*other.data[0]-self.data[0]*other.data[2],
|
||||
# self.data[0]*other.data[1]-self.data[1]*other.data[0])
|
||||
|
||||
def angle(self, other):
|
||||
if not isVec2(other):
|
||||
raise TypeError, "Angle between vector and non-vector"
|
||||
cosa = (self*other)/(self.length()*other.length())
|
||||
cosa = max(-1.,min(1.,cosa))
|
||||
return math.acos(cosa)
|
||||
|
||||
|
||||
|
||||
# Type check
|
||||
|
||||
def isVec3(x):
|
||||
return hasattr(x,'isVec3')
|
||||
|
||||
def isVec2(x):
|
||||
return hasattr(x,'isVec2')
|
||||
|
||||
# "Correct" division for arbitrary number types
|
||||
|
||||
def _div(a,b):
|
||||
if type(a) == types.IntType and type(b) == types.IntType:
|
||||
return float(a)/float(b)
|
||||
else:
|
||||
return a/b
|
||||
|
||||
|
||||
# Some useful constants
|
||||
|
||||
ex = Vec3(1.,0.,0.)
|
||||
ey = Vec3(0.,1.,0.)
|
||||
ez = Vec3(0.,0.,1.)
|
||||
Reference in New Issue
Block a user