Fix for __repr__() depending on .getName() and .getExactTypeName().
API users no longer need to define them in user-defined Functions, Predicates and StrokeShaders. Also removed all .getName() and .getExactTypeName() definitions in pre-defined Functions, Predicates and StrokeShaders subclasses.
This commit is contained in:
@@ -35,8 +35,6 @@ from freestyle_init import *
|
||||
class pyChainSilhouetteIterator(ChainingIterator):
|
||||
def __init__(self, stayInSelection=True):
|
||||
ChainingIterator.__init__(self, stayInSelection, True, None, True)
|
||||
def getExactTypeName(self):
|
||||
return "pyChainSilhouetteIterator"
|
||||
def init(self):
|
||||
pass
|
||||
def traverse(self, iter):
|
||||
@@ -87,8 +85,6 @@ class pyChainSilhouetteIterator(ChainingIterator):
|
||||
class pyChainSilhouetteGenericIterator(ChainingIterator):
|
||||
def __init__(self, stayInSelection=True, stayInUnvisited=True):
|
||||
ChainingIterator.__init__(self, stayInSelection, stayInUnvisited, None, True)
|
||||
def getExactTypeName(self):
|
||||
return "pyChainSilhouetteGenericIterator"
|
||||
def init(self):
|
||||
pass
|
||||
def traverse(self, iter):
|
||||
@@ -137,8 +133,6 @@ class pyExternalContourChainingIterator(ChainingIterator):
|
||||
def __init__(self):
|
||||
ChainingIterator.__init__(self, False, True, None, True)
|
||||
self._isExternalContour = ExternalContourUP1D()
|
||||
def getExactTypeName(self):
|
||||
return "pyExternalContourIterator"
|
||||
def init(self):
|
||||
self._nEdges = 0
|
||||
self._isInSelection = 1
|
||||
@@ -186,8 +180,6 @@ class pySketchyChainSilhouetteIterator(ChainingIterator):
|
||||
ChainingIterator.__init__(self, stayInSelection, False, None, True)
|
||||
self._timeStamp = GetTimeStampCF()+nRounds
|
||||
self._nRounds = nRounds
|
||||
def getExactTypeName(self):
|
||||
return "pySketchyChainSilhouetteIterator"
|
||||
def init(self):
|
||||
self._timeStamp = GetTimeStampCF()+self._nRounds
|
||||
def traverse(self, iter):
|
||||
@@ -245,8 +237,6 @@ class pySketchyChainingIterator(ChainingIterator):
|
||||
ChainingIterator.__init__(self, stayInSelection, False, None, True)
|
||||
self._timeStamp = GetTimeStampCF()+nRounds
|
||||
self._nRounds = nRounds
|
||||
def getExactTypeName(self):
|
||||
return "pySketchyChainingIterator"
|
||||
def init(self):
|
||||
self._timeStamp = GetTimeStampCF()+self._nRounds
|
||||
def traverse(self, iter):
|
||||
@@ -275,8 +265,6 @@ class pyFillOcclusionsRelativeChainingIterator(ChainingIterator):
|
||||
ChainingIterator.__init__(self, False, True, None, True)
|
||||
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
|
||||
@@ -377,8 +365,6 @@ class pyFillOcclusionsAbsoluteChainingIterator(ChainingIterator):
|
||||
def __init__(self, length):
|
||||
ChainingIterator.__init__(self, False, True, None, True)
|
||||
self._length = float(length)
|
||||
def getExactTypeName(self):
|
||||
return "pySmallFillOcclusionsChainingIterator"
|
||||
def init(self):
|
||||
pass
|
||||
def traverse(self, iter):
|
||||
@@ -449,8 +435,6 @@ class pyFillOcclusionsAbsoluteAndRelativeChainingIterator(ChainingIterator):
|
||||
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
|
||||
@@ -554,8 +538,6 @@ class pyFillQi0AbsoluteAndRelativeChainingIterator(ChainingIterator):
|
||||
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
|
||||
@@ -657,8 +639,6 @@ class pyFillQi0AbsoluteAndRelativeChainingIterator(ChainingIterator):
|
||||
class pyNoIdChainSilhouetteIterator(ChainingIterator):
|
||||
def __init__(self, stayInSelection=True):
|
||||
ChainingIterator.__init__(self, stayInSelection, True, None, True)
|
||||
def getExactTypeName(self):
|
||||
return "pyChainSilhouetteIterator"
|
||||
def init(self):
|
||||
pass
|
||||
def traverse(self, iter):
|
||||
|
||||
@@ -3,8 +3,6 @@ from freestyle_init import *
|
||||
class CurveMaterialF0D(UnaryFunction0DMaterial):
|
||||
# A replacement of the built-in MaterialF0D for stroke creation.
|
||||
# MaterialF0D does not work with Curves and Strokes.
|
||||
def getName(self):
|
||||
return "CurveMaterialF0D"
|
||||
def __call__(self, inter):
|
||||
cp = inter.object
|
||||
assert(isinstance(cp, CurvePoint))
|
||||
@@ -13,18 +11,12 @@ class CurveMaterialF0D(UnaryFunction0DMaterial):
|
||||
return fe.material if fe.is_smooth else fe.material_left
|
||||
|
||||
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):
|
||||
cp = inter.object
|
||||
assert(isinstance(cp, CurvePoint))
|
||||
@@ -39,8 +31,6 @@ class pyDensityAnisotropyF0D(UnaryFunction0DDouble):
|
||||
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)
|
||||
@@ -63,8 +53,6 @@ class pyViewMapGradientVectorF0D(UnaryFunction0DVec2f):
|
||||
UnaryFunction0DVec2f.__init__(self)
|
||||
self._l = l
|
||||
self._step = pow(2,self._l)
|
||||
def getName(self):
|
||||
return "pyViewMapGradientVectorF0D"
|
||||
def __call__(self, iter):
|
||||
p = iter.object.point_2d
|
||||
gx = ReadCompleteViewMapPixelCF(self._l, int(p.x+self._step), int(p.y))- ReadCompleteViewMapPixelCF(self._l, int(p.x), int(p.y))
|
||||
@@ -76,8 +64,6 @@ class pyViewMapGradientNormF0D(UnaryFunction0DDouble):
|
||||
UnaryFunction0DDouble.__init__(self)
|
||||
self._l = l
|
||||
self._step = pow(2,self._l)
|
||||
def getName(self):
|
||||
return "pyViewMapGradientNormF0D"
|
||||
def __call__(self, iter):
|
||||
p = iter.object.point_2d
|
||||
gx = ReadCompleteViewMapPixelCF(self._l, int(p.x+self._step), int(p.y))- ReadCompleteViewMapPixelCF(self._l, int(p.x), int(p.y))
|
||||
|
||||
@@ -3,18 +3,12 @@ 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)
|
||||
@@ -26,8 +20,6 @@ class pyDensityAnisotropyF1D(UnaryFunction1DDouble):
|
||||
self._func = pyDensityAnisotropyF0D(level)
|
||||
self._integration = integrationType
|
||||
self._sampling = sampling
|
||||
def getName(self):
|
||||
return "pyDensityAnisotropyF1D"
|
||||
def __call__(self, inter):
|
||||
v = integrate(self._func, inter.pointsBegin(self._sampling), inter.pointsEnd(self._sampling), self._integration)
|
||||
return v
|
||||
@@ -38,8 +30,6 @@ class pyViewMapGradientNormF1D(UnaryFunction1DDouble):
|
||||
self._func = pyViewMapGradientNormF0D(l)
|
||||
self._integration = integrationType
|
||||
self._sampling = sampling
|
||||
def getName(self):
|
||||
return "pyViewMapGradientNormF1D"
|
||||
def __call__(self, inter):
|
||||
v = integrate(self._func, inter.pointsBegin(self._sampling), inter.pointsEnd(self._sampling), self._integration)
|
||||
return v
|
||||
|
||||
@@ -3,8 +3,6 @@ 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))
|
||||
@@ -13,20 +11,14 @@ 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.length_2d > i2.length_2d)
|
||||
|
||||
class pySilhouetteFirstBP1D(BinaryPredicate1D):
|
||||
def getName(self):
|
||||
return "SilhouetteFirstBP1D"
|
||||
def __call__(self, inter1, inter2):
|
||||
bpred = SameShapeIdBP1D()
|
||||
if (bpred(inter1, inter2) != 1):
|
||||
@@ -36,8 +28,6 @@ class pySilhouetteFirstBP1D(BinaryPredicate1D):
|
||||
return (inter1.nature == inter2.nature)
|
||||
|
||||
class pyNatureBP1D(BinaryPredicate1D):
|
||||
def getName(self):
|
||||
return "NatureBP1D"
|
||||
def __call__(self, inter1, inter2):
|
||||
return (inter1.nature & inter2.nature)
|
||||
|
||||
@@ -45,8 +35,6 @@ 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))
|
||||
@@ -55,8 +43,6 @@ 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)
|
||||
|
||||
@@ -5,8 +5,6 @@ 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)
|
||||
@@ -17,8 +15,6 @@ class pyUEqualsUP0D(UnaryPredicate0D):
|
||||
UnaryPredicate0D.__init__(self)
|
||||
self._u = u
|
||||
self._w = w
|
||||
def getName(self):
|
||||
return "UEqualsUP0D"
|
||||
def __call__(self, inter):
|
||||
func = pyCurvilinearLengthF0D()
|
||||
u = func(inter)
|
||||
@@ -28,8 +24,6 @@ class pyVertexNatureUP0D(UnaryPredicate0D):
|
||||
def __init__(self,nature):
|
||||
UnaryPredicate0D.__init__(self)
|
||||
self._nature = nature
|
||||
def getName(self):
|
||||
return "pyVertexNatureUP0D"
|
||||
def __call__(self, inter):
|
||||
v = inter.object
|
||||
return (v.nature & self._nature) != 0
|
||||
@@ -41,8 +35,6 @@ class pyBackTVertexUP0D(UnaryPredicate0D):
|
||||
def __init__(self):
|
||||
UnaryPredicate0D.__init__(self)
|
||||
self._getQI = QuantitativeInvisibilityF0D()
|
||||
def getName(self):
|
||||
return "pyBackTVertexUP0D"
|
||||
def __call__(self, iter):
|
||||
if (iter.object.nature & Nature.T_VERTEX) == 0:
|
||||
return 0
|
||||
@@ -58,8 +50,6 @@ class pyParameterUP0DGoodOne(UnaryPredicate0D):
|
||||
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
|
||||
@@ -72,8 +62,6 @@ class pyParameterUP0D(UnaryPredicate0D):
|
||||
self._m = pmin
|
||||
self._M = pmax
|
||||
#self.getCurvilinearAbscissa = GetCurvilinearAbscissaF0D()
|
||||
def getName(self):
|
||||
return "pyCurvilinearAbscissaHigherThanUP0D"
|
||||
def __call__(self, inter):
|
||||
func = Curvature2DAngleF0D()
|
||||
c = func(inter)
|
||||
|
||||
@@ -17,8 +17,6 @@ class pyHigherLengthUP1D(UnaryPredicate1D):
|
||||
def __init__(self,l):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self._l = l
|
||||
def getName(self):
|
||||
return "HigherLengthUP1D"
|
||||
def __call__(self, inter):
|
||||
return (inter.length_2d > self._l)
|
||||
|
||||
@@ -27,8 +25,6 @@ class pyNatureUP1D(UnaryPredicate1D):
|
||||
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
|
||||
@@ -39,8 +35,6 @@ class pyHigherNumberOfTurnsUP1D(UnaryPredicate1D):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self._n = n
|
||||
self._a = a
|
||||
def getName(self):
|
||||
return "HigherNumberOfTurnsUP1D"
|
||||
def __call__(self, inter):
|
||||
count = 0
|
||||
func = Curvature2DAngleF0D()
|
||||
@@ -60,8 +54,6 @@ class pyDensityUP1D(UnaryPredicate1D):
|
||||
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
|
||||
@@ -73,8 +65,6 @@ class pyLowSteerableViewMapDensityUP1D(UnaryPredicate1D):
|
||||
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)
|
||||
@@ -90,8 +80,6 @@ class pyLowDirectionalViewMapDensityUP1D(UnaryPredicate1D):
|
||||
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)
|
||||
@@ -107,8 +95,6 @@ class pyHighSteerableViewMapDensityUP1D(UnaryPredicate1D):
|
||||
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:
|
||||
@@ -123,8 +109,6 @@ class pyHighDirectionalViewMapDensityUP1D(UnaryPredicate1D):
|
||||
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)
|
||||
@@ -140,12 +124,10 @@ class pyHighViewMapDensityUP1D(UnaryPredicate1D):
|
||||
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())
|
||||
#print(func.name)
|
||||
#print(inter.name)
|
||||
v= self._func(inter)
|
||||
if v > self._threshold:
|
||||
return 1
|
||||
@@ -160,8 +142,6 @@ class pyDensityFunctorUP1D(UnaryPredicate1D):
|
||||
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)
|
||||
@@ -175,8 +155,6 @@ class pyZSmallerUP1D(UnaryPredicate1D):
|
||||
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:
|
||||
@@ -187,8 +165,6 @@ 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)
|
||||
@@ -226,8 +202,6 @@ 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)
|
||||
@@ -241,8 +215,6 @@ class pyIsOccludedByItselfUP1D(UnaryPredicate1D):
|
||||
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)
|
||||
@@ -257,8 +229,6 @@ class pyIsOccludedByIdListUP1D(UnaryPredicate1D):
|
||||
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:
|
||||
@@ -274,8 +244,6 @@ class pyShapeIdListUP1D(UnaryPredicate1D):
|
||||
self._funcs = []
|
||||
for _id in idlist :
|
||||
self._funcs.append(ShapeUP1D(_id.first, _id.second))
|
||||
def getName(self):
|
||||
return "pyShapeIdUP1D"
|
||||
def __call__(self, inter):
|
||||
for func in self._funcs :
|
||||
if func(inter) == 1:
|
||||
@@ -287,8 +255,6 @@ 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)
|
||||
@@ -302,8 +268,6 @@ class pyHighDensityAnisotropyUP1D(UnaryPredicate1D):
|
||||
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)
|
||||
|
||||
@@ -312,8 +276,6 @@ class pyHighViewMapGradientNormUP1D(UnaryPredicate1D):
|
||||
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)
|
||||
@@ -331,8 +293,6 @@ class pyDensityVariableSigmaUP1D(UnaryPredicate1D):
|
||||
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
|
||||
|
||||
@@ -5,10 +5,6 @@ class AndUP1D(UnaryPredicate1D):
|
||||
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)
|
||||
|
||||
@@ -17,10 +13,6 @@ class OrUP1D(UnaryPredicate1D):
|
||||
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)
|
||||
|
||||
@@ -28,9 +20,5 @@ 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
|
||||
|
||||
@@ -50,10 +50,6 @@ class pyDensityUP1D(UnaryPredicate1D):
|
||||
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)
|
||||
|
||||
@@ -134,8 +134,7 @@ class ThicknessBlenderMixIn(ThicknessModifierMixIn):
|
||||
return outer, inner
|
||||
|
||||
class BaseColorShader(ConstantColorShader):
|
||||
def getName(self):
|
||||
return "BaseColorShader"
|
||||
pass
|
||||
|
||||
class BaseThicknessShader(StrokeShader, ThicknessModifierMixIn):
|
||||
def __init__(self, thickness, position, ratio):
|
||||
@@ -155,8 +154,6 @@ class BaseThicknessShader(StrokeShader, ThicknessModifierMixIn):
|
||||
self.__inner = thickness * (1 - ratio)
|
||||
else:
|
||||
raise ValueError("unknown thickness position: " + self.position)
|
||||
def getName(self):
|
||||
return "BaseThicknessShader"
|
||||
def shade(self, stroke):
|
||||
it = stroke.stroke_vertices_begin()
|
||||
while not it.is_end:
|
||||
@@ -180,8 +177,6 @@ def iter_t2d_along_stroke(stroke):
|
||||
it.increment()
|
||||
|
||||
class ColorAlongStrokeShader(ColorRampModifier):
|
||||
def getName(self):
|
||||
return "ColorAlongStrokeShader"
|
||||
def shade(self, stroke):
|
||||
for it, t in iter_t2d_along_stroke(stroke):
|
||||
sv = it.object
|
||||
@@ -190,8 +185,6 @@ class ColorAlongStrokeShader(ColorRampModifier):
|
||||
sv.attribute.color = self.blend_ramp(a, b)
|
||||
|
||||
class AlphaAlongStrokeShader(CurveMappingModifier):
|
||||
def getName(self):
|
||||
return "AlphaAlongStrokeShader"
|
||||
def shade(self, stroke):
|
||||
for it, t in iter_t2d_along_stroke(stroke):
|
||||
sv = it.object
|
||||
@@ -206,8 +199,6 @@ class ThicknessAlongStrokeShader(ThicknessBlenderMixIn, CurveMappingModifier):
|
||||
CurveMappingModifier.__init__(self, blend, influence, mapping, invert, curve)
|
||||
self.__value_min = value_min
|
||||
self.__value_max = value_max
|
||||
def getName(self):
|
||||
return "ThicknessAlongStrokeShader"
|
||||
def shade(self, stroke):
|
||||
for it, t in iter_t2d_along_stroke(stroke):
|
||||
sv = it.object
|
||||
@@ -238,8 +229,6 @@ class ColorDistanceFromCameraShader(ColorRampModifier):
|
||||
ColorRampModifier.__init__(self, blend, influence, ramp)
|
||||
self.__range_min = range_min
|
||||
self.__range_max = range_max
|
||||
def getName(self):
|
||||
return "ColorDistanceFromCameraShader"
|
||||
def shade(self, stroke):
|
||||
for it, t in iter_distance_from_camera(stroke, self.__range_min, self.__range_max):
|
||||
sv = it.object
|
||||
@@ -252,8 +241,6 @@ class AlphaDistanceFromCameraShader(CurveMappingModifier):
|
||||
CurveMappingModifier.__init__(self, blend, influence, mapping, invert, curve)
|
||||
self.__range_min = range_min
|
||||
self.__range_max = range_max
|
||||
def getName(self):
|
||||
return "AlphaDistanceFromCameraShader"
|
||||
def shade(self, stroke):
|
||||
for it, t in iter_distance_from_camera(stroke, self.__range_min, self.__range_max):
|
||||
sv = it.object
|
||||
@@ -270,8 +257,6 @@ class ThicknessDistanceFromCameraShader(ThicknessBlenderMixIn, CurveMappingModif
|
||||
self.__range_max = range_max
|
||||
self.__value_min = value_min
|
||||
self.__value_max = value_max
|
||||
def getName(self):
|
||||
return "ThicknessDistanceFromCameraShader"
|
||||
def shade(self, stroke):
|
||||
for it, t in iter_distance_from_camera(stroke, self.__range_min, self.__range_max):
|
||||
sv = it.object
|
||||
@@ -307,8 +292,6 @@ class ColorDistanceFromObjectShader(ColorRampModifier):
|
||||
self.__target = target
|
||||
self.__range_min = range_min
|
||||
self.__range_max = range_max
|
||||
def getName(self):
|
||||
return "ColorDistanceFromObjectShader"
|
||||
def shade(self, stroke):
|
||||
if self.__target is None:
|
||||
return
|
||||
@@ -324,8 +307,6 @@ class AlphaDistanceFromObjectShader(CurveMappingModifier):
|
||||
self.__target = target
|
||||
self.__range_min = range_min
|
||||
self.__range_max = range_max
|
||||
def getName(self):
|
||||
return "AlphaDistanceFromObjectShader"
|
||||
def shade(self, stroke):
|
||||
if self.__target is None:
|
||||
return
|
||||
@@ -345,8 +326,6 @@ class ThicknessDistanceFromObjectShader(ThicknessBlenderMixIn, CurveMappingModif
|
||||
self.__range_max = range_max
|
||||
self.__value_min = value_min
|
||||
self.__value_max = value_max
|
||||
def getName(self):
|
||||
return "ThicknessDistanceFromObjectShader"
|
||||
def shade(self, stroke):
|
||||
if self.__target is None:
|
||||
return
|
||||
@@ -418,8 +397,6 @@ class ColorMaterialShader(ColorRampModifier):
|
||||
ColorRampModifier.__init__(self, blend, influence, ramp)
|
||||
self.__material_attr = material_attr
|
||||
self.__use_ramp = use_ramp
|
||||
def getName(self):
|
||||
return "ColorMaterialShader"
|
||||
def shade(self, stroke):
|
||||
if self.__material_attr in ["DIFF", "SPEC"] and not self.__use_ramp:
|
||||
for it, b in iter_material_color(stroke, self.__material_attr):
|
||||
@@ -437,8 +414,6 @@ class AlphaMaterialShader(CurveMappingModifier):
|
||||
def __init__(self, blend, influence, mapping, invert, curve, material_attr):
|
||||
CurveMappingModifier.__init__(self, blend, influence, mapping, invert, curve)
|
||||
self.__material_attr = material_attr
|
||||
def getName(self):
|
||||
return "AlphaMaterialShader"
|
||||
def shade(self, stroke):
|
||||
for it, t in iter_material_value(stroke, self.__material_attr):
|
||||
sv = it.object
|
||||
@@ -454,8 +429,6 @@ class ThicknessMaterialShader(ThicknessBlenderMixIn, CurveMappingModifier):
|
||||
self.__material_attr = material_attr
|
||||
self.__value_min = value_min
|
||||
self.__value_max = value_max
|
||||
def getName(self):
|
||||
return "ThicknessMaterialShader"
|
||||
def shade(self, stroke):
|
||||
for it, t in iter_material_value(stroke, self.__material_attr):
|
||||
sv = it.object
|
||||
@@ -510,8 +483,6 @@ class SinusDisplacementShader(StrokeShader):
|
||||
self._amplitude = amplitude
|
||||
self._phase = phase / wavelength * 2 * math.pi
|
||||
self._getNormal = Normal2DF0D()
|
||||
def getName(self):
|
||||
return "SinusDisplacementShader"
|
||||
def shade(self, stroke):
|
||||
for it, distance in iter_distance_along_stroke(stroke):
|
||||
v = it.object
|
||||
@@ -528,8 +499,6 @@ class PerlinNoise1DShader(StrokeShader):
|
||||
self.__amp = amp
|
||||
self.__oct = oct
|
||||
self.__dir = Vector([cos(angle), sin(angle)])
|
||||
def getName(self):
|
||||
return "PerlinNoise1DShader"
|
||||
def shade(self, stroke):
|
||||
length = stroke.length_2d
|
||||
it = stroke.stroke_vertices_begin()
|
||||
@@ -548,8 +517,6 @@ class PerlinNoise2DShader(StrokeShader):
|
||||
self.__amp = amp
|
||||
self.__oct = oct
|
||||
self.__dir = Vector([cos(angle), sin(angle)])
|
||||
def getName(self):
|
||||
return "PerlinNoise2DShader"
|
||||
def shade(self, stroke):
|
||||
it = stroke.stroke_vertices_begin()
|
||||
while not it.is_end:
|
||||
@@ -567,8 +534,6 @@ class Offset2DShader(StrokeShader):
|
||||
self.__end = end
|
||||
self.__xy = Vector([x, y])
|
||||
self.__getNormal = Normal2DF0D()
|
||||
def getName(self):
|
||||
return "Offset2DShader"
|
||||
def shade(self, stroke):
|
||||
it = stroke.stroke_vertices_begin()
|
||||
while not it.is_end:
|
||||
@@ -591,8 +556,6 @@ class Transform2DShader(StrokeShader):
|
||||
self.__pivot_u = pivot_u
|
||||
self.__pivot_x = pivot_x
|
||||
self.__pivot_y = pivot_y
|
||||
def getName(self):
|
||||
return "Transform2DShader"
|
||||
def shade(self, stroke):
|
||||
# determine the pivot of scaling and rotation operations
|
||||
if self.__pivot == "START":
|
||||
@@ -655,8 +618,6 @@ class QuantitativeInvisibilityRangeUP1D(UnaryPredicate1D):
|
||||
self.__getQI = QuantitativeInvisibilityF1D()
|
||||
self.__qi_start = qi_start
|
||||
self.__qi_end = qi_end
|
||||
def getName(self):
|
||||
return "QuantitativeInvisibilityRangeUP1D"
|
||||
def __call__(self, inter):
|
||||
qi = self.__getQI(inter)
|
||||
return self.__qi_start <= qi <= self.__qi_end
|
||||
@@ -674,8 +635,6 @@ class ObjectNamesUP1D(UnaryPredicate1D):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self._names = names
|
||||
self._negative = negative
|
||||
def getName(self):
|
||||
return "ObjectNamesUP1D"
|
||||
def __call__(self, viewEdge):
|
||||
found = viewEdge.viewshape.name in self._names
|
||||
if self._negative:
|
||||
@@ -840,8 +799,6 @@ class DashedLineShader(StrokeShader):
|
||||
def __init__(self, pattern):
|
||||
StrokeShader.__init__(self)
|
||||
self._pattern = pattern
|
||||
def getName(self):
|
||||
return "DashedLineShader"
|
||||
def shade(self, stroke):
|
||||
index = 0 # pattern index
|
||||
start = 0.0 # 2D curvilinear length
|
||||
@@ -869,8 +826,6 @@ class AngleLargerThanBP1D(BinaryPredicate1D):
|
||||
def __init__(self, angle):
|
||||
BinaryPredicate1D.__init__(self)
|
||||
self._angle = angle
|
||||
def getName(self):
|
||||
return "AngleLargerThanBP1D"
|
||||
def __call__(self, i1, i2):
|
||||
sv1a = i1.first_fedge.first_svertex.point_2d
|
||||
sv1b = i1.last_fedge.second_svertex.point_2d
|
||||
@@ -901,8 +856,6 @@ class AndBP1D(BinaryPredicate1D):
|
||||
BinaryPredicate1D.__init__(self)
|
||||
self.__pred1 = pred1
|
||||
self.__pred2 = pred2
|
||||
def getName(self):
|
||||
return "AndBP1D"
|
||||
def __call__(self, i1, i2):
|
||||
return self.__pred1(i1, i2) and self.__pred2(i1, i2)
|
||||
|
||||
@@ -913,8 +866,6 @@ class LengthThresholdUP1D(UnaryPredicate1D):
|
||||
UnaryPredicate1D.__init__(self)
|
||||
self._min_length = min_length
|
||||
self._max_length = max_length
|
||||
def getName(self):
|
||||
return "LengthThresholdUP1D"
|
||||
def __call__(self, inter):
|
||||
length = inter.length_2d
|
||||
if self._min_length is not None and length < self._min_length:
|
||||
@@ -952,8 +903,6 @@ class FaceMarkOneUP1D(UnaryPredicate1D):
|
||||
# predicates for splitting
|
||||
|
||||
class MaterialBoundaryUP0D(UnaryPredicate0D):
|
||||
def getName(self):
|
||||
return "MaterialBoundaryUP0D"
|
||||
def __call__(self, it):
|
||||
if it.is_begin:
|
||||
return False
|
||||
@@ -975,8 +924,6 @@ class Curvature2DAngleThresholdUP0D(UnaryPredicate0D):
|
||||
self._min_angle = min_angle
|
||||
self._max_angle = max_angle
|
||||
self._func = Curvature2DAngleF0D()
|
||||
def getName(self):
|
||||
return "Curvature2DAngleThresholdUP0D"
|
||||
def __call__(self, inter):
|
||||
angle = math.pi - self._func(inter)
|
||||
if self._min_angle is not None and angle < self._min_angle:
|
||||
@@ -990,8 +937,6 @@ class Length2DThresholdUP0D(UnaryPredicate0D):
|
||||
UnaryPredicate0D.__init__(self)
|
||||
self._length_limit = length_limit
|
||||
self._t = 0.0
|
||||
def getName(self):
|
||||
return "Length2DThresholdUP0D"
|
||||
def __call__(self, inter):
|
||||
t = inter.t # curvilinear abscissa
|
||||
if t < self._t:
|
||||
|
||||
@@ -16,8 +16,6 @@ class pyDepthDiscontinuityThicknessShader(StrokeShader):
|
||||
self.__min = float(min)
|
||||
self.__max = float(max)
|
||||
self.__func = ZDiscontinuityF0D()
|
||||
def getName(self):
|
||||
return "pyDepthDiscontinuityThicknessShader"
|
||||
def shade(self, stroke):
|
||||
z_min=0.0
|
||||
z_max=1.0
|
||||
@@ -34,8 +32,6 @@ class pyConstantThicknessShader(StrokeShader):
|
||||
def __init__(self, thickness):
|
||||
StrokeShader.__init__(self)
|
||||
self._thickness = thickness
|
||||
def getName(self):
|
||||
return "pyConstantThicknessShader"
|
||||
def shade(self, stroke):
|
||||
it = stroke.stroke_vertices_begin()
|
||||
while not it.is_end:
|
||||
@@ -47,8 +43,6 @@ class pyFXSThicknessShader(StrokeShader):
|
||||
def __init__(self, thickness):
|
||||
StrokeShader.__init__(self)
|
||||
self._thickness = thickness
|
||||
def getName(self):
|
||||
return "pyFXSThicknessShader"
|
||||
def shade(self, stroke):
|
||||
it = stroke.stroke_vertices_begin()
|
||||
while not it.is_end:
|
||||
@@ -64,8 +58,6 @@ class pyFXSVaryingThicknessWithDensityShader(StrokeShader):
|
||||
self.threshold_max= threshold_max
|
||||
self._thicknessMin = thicknessMin
|
||||
self._thicknessMax = thicknessMax
|
||||
def getName(self):
|
||||
return "pyVaryingThicknessWithDensityShader"
|
||||
def shade(self, stroke):
|
||||
n = stroke.stroke_vertices_size()
|
||||
i = 0
|
||||
@@ -88,8 +80,6 @@ class pyIncreasingThicknessShader(StrokeShader):
|
||||
StrokeShader.__init__(self)
|
||||
self._thicknessMin = thicknessMin
|
||||
self._thicknessMax = thicknessMax
|
||||
def getName(self):
|
||||
return "pyIncreasingThicknessShader"
|
||||
def shade(self, stroke):
|
||||
n = stroke.stroke_vertices_size()
|
||||
i = 0
|
||||
@@ -110,8 +100,6 @@ class pyConstrainedIncreasingThicknessShader(StrokeShader):
|
||||
self._thicknessMin = thicknessMin
|
||||
self._thicknessMax = thicknessMax
|
||||
self._ratio = ratio
|
||||
def getName(self):
|
||||
return "pyConstrainedIncreasingThicknessShader"
|
||||
def shade(self, stroke):
|
||||
slength = stroke.length_2d
|
||||
tmp = self._ratio*slength
|
||||
@@ -141,8 +129,6 @@ class pyDecreasingThicknessShader(StrokeShader):
|
||||
StrokeShader.__init__(self)
|
||||
self._thicknessMin = thicknessMin
|
||||
self._thicknessMax = thicknessMax
|
||||
def getName(self):
|
||||
return "pyDecreasingThicknessShader"
|
||||
def shade(self, stroke):
|
||||
l = stroke.length_2d
|
||||
tMax = self._thicknessMax
|
||||
@@ -171,8 +157,6 @@ class pyNonLinearVaryingThicknessShader(StrokeShader):
|
||||
self._thicknessMin = thicknessMiddle
|
||||
self._thicknessMax = thicknessExtremity
|
||||
self._exponent = exponent
|
||||
def getName(self):
|
||||
return "pyNonLinearVaryingThicknessShader"
|
||||
def shade(self, stroke):
|
||||
n = stroke.stroke_vertices_size()
|
||||
i = 0
|
||||
@@ -195,8 +179,6 @@ class pySLERPThicknessShader(StrokeShader):
|
||||
self._thicknessMin = thicknessMin
|
||||
self._thicknessMax = thicknessMax
|
||||
self._omega = omega
|
||||
def getName(self):
|
||||
return "pySLERPThicknessShader"
|
||||
def shade(self, stroke):
|
||||
slength = stroke.length_2d
|
||||
tmp = 0.33*slength
|
||||
@@ -221,8 +203,6 @@ class pyTVertexThickenerShader(StrokeShader): ## FIXME
|
||||
StrokeShader.__init__(self)
|
||||
self._a = a
|
||||
self._n = n
|
||||
def getName(self):
|
||||
return "pyTVertexThickenerShader"
|
||||
def shade(self, stroke):
|
||||
it = stroke.stroke_vertices_begin()
|
||||
predTVertex = pyVertexNatureUP0D(Nature.T_VERTEX)
|
||||
@@ -273,8 +253,6 @@ class pyImportance2DThicknessShader(StrokeShader):
|
||||
self._w = float(w)
|
||||
self._kmin = float(kmin)
|
||||
self._kmax = float(kmax)
|
||||
def getName(self):
|
||||
return "pyImportanceThicknessShader"
|
||||
def shade(self, stroke):
|
||||
origin = Vector([self._x, self._y])
|
||||
it = stroke.stroke_vertices_begin()
|
||||
@@ -300,8 +278,6 @@ class pyImportance3DThicknessShader(StrokeShader):
|
||||
self._w = float(w)
|
||||
self._kmin = float(kmin)
|
||||
self._kmax = float(kmax)
|
||||
def getName(self):
|
||||
return "pyImportance3DThicknessShader"
|
||||
def shade(self, stroke):
|
||||
origin = Vector([self._x, self._y, self._z])
|
||||
it = stroke.stroke_vertices_begin()
|
||||
@@ -324,8 +300,6 @@ class pyZDependingThicknessShader(StrokeShader):
|
||||
self.__min = min
|
||||
self.__max = max
|
||||
self.__func = GetProjectedZF0D()
|
||||
def getName(self):
|
||||
return "pyZDependingThicknessShader"
|
||||
def shade(self, stroke):
|
||||
it = stroke.stroke_vertices_begin()
|
||||
z_min = 1
|
||||
@@ -356,8 +330,6 @@ class pyConstantColorShader(StrokeShader):
|
||||
self._g = g
|
||||
self._b = b
|
||||
self._a = a
|
||||
def getName(self):
|
||||
return "pyConstantColorShader"
|
||||
def shade(self, stroke):
|
||||
it = stroke.stroke_vertices_begin()
|
||||
while not it.is_end:
|
||||
@@ -372,8 +344,6 @@ class pyIncreasingColorShader(StrokeShader):
|
||||
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.stroke_vertices_size() - 1
|
||||
inc = 0
|
||||
@@ -395,8 +365,6 @@ class pyInterpolateColorShader(StrokeShader):
|
||||
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.stroke_vertices_size() - 1
|
||||
inc = 0
|
||||
@@ -416,8 +384,6 @@ 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.stroke_vertices_begin()
|
||||
func = MaterialF0D()
|
||||
@@ -477,8 +443,6 @@ class pyRandomColorShader(StrokeShader):
|
||||
def __init__(self, s=1):
|
||||
StrokeShader.__init__(self)
|
||||
seed(s)
|
||||
def getName(self):
|
||||
return "pyRandomColorShader"
|
||||
def shade(self, stroke):
|
||||
## pick a random color
|
||||
c0 = float(uniform(15,75))/100.0
|
||||
@@ -491,8 +455,6 @@ class pyRandomColorShader(StrokeShader):
|
||||
it.increment()
|
||||
|
||||
class py2DCurvatureColorShader(StrokeShader):
|
||||
def getName(self):
|
||||
return "py2DCurvatureColorShader"
|
||||
def shade(self, stroke):
|
||||
it = stroke.stroke_vertices_begin()
|
||||
func = Curvature2DAngleF0D()
|
||||
@@ -523,8 +485,6 @@ 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))
|
||||
stroke.update_length()
|
||||
@@ -533,8 +493,6 @@ class pyBackboneStretcherShader(StrokeShader):
|
||||
def __init__(self, l):
|
||||
StrokeShader.__init__(self)
|
||||
self._l = l
|
||||
def getName(self):
|
||||
return "pyBackboneStretcherShader"
|
||||
def shade(self, stroke):
|
||||
it0 = stroke.stroke_vertices_begin()
|
||||
it1 = StrokeVertexIterator(it0)
|
||||
@@ -565,8 +523,6 @@ class pyLengthDependingBackboneStretcherShader(StrokeShader):
|
||||
def __init__(self, l):
|
||||
StrokeShader.__init__(self)
|
||||
self._l = l
|
||||
def getName(self):
|
||||
return "pyBackboneStretcherShader"
|
||||
def shade(self, stroke):
|
||||
l = stroke.length_2d
|
||||
stretch = self._l*l
|
||||
@@ -598,9 +554,6 @@ class pyLengthDependingBackboneStretcherShader(StrokeShader):
|
||||
|
||||
## 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.stroke_vertices_begin() ## get the first vertex
|
||||
itlast = stroke.stroke_vertices_end() ##
|
||||
@@ -629,8 +582,6 @@ class pyBackboneStretcherNoCuspShader(StrokeShader):
|
||||
def __init__(self, l):
|
||||
StrokeShader.__init__(self)
|
||||
self._l = l
|
||||
def getName(self):
|
||||
return "pyBackboneStretcherNoCuspShader"
|
||||
def shade(self, stroke):
|
||||
it0 = stroke.stroke_vertices_begin()
|
||||
it1 = StrokeVertexIterator(it0)
|
||||
@@ -670,8 +621,6 @@ class pyDiffusion2Shader(StrokeShader):
|
||||
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.stroke_vertices_begin()
|
||||
@@ -687,8 +636,6 @@ class pyTipRemoverShader(StrokeShader):
|
||||
def __init__(self, l):
|
||||
StrokeShader.__init__(self)
|
||||
self._l = l
|
||||
def getName(self):
|
||||
return "pyTipRemoverShader"
|
||||
def shade(self, stroke):
|
||||
originalSize = stroke.stroke_vertices_size()
|
||||
if originalSize < 4:
|
||||
@@ -719,8 +666,6 @@ class pyTipRemoverShader(StrokeShader):
|
||||
stroke.update_length()
|
||||
|
||||
class pyTVertexRemoverShader(StrokeShader):
|
||||
def getName(self):
|
||||
return "pyTVertexRemoverShader"
|
||||
def shade(self, stroke):
|
||||
if stroke.stroke_vertices_size() <= 3:
|
||||
return
|
||||
@@ -739,8 +684,6 @@ class pyExtremitiesOrientationShader(StrokeShader):
|
||||
StrokeShader.__init__(self)
|
||||
self._v1 = Vector([x1,y1])
|
||||
self._v2 = Vector([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)
|
||||
@@ -750,8 +693,6 @@ def get_fedge(it1, it2):
|
||||
return it1.get_fedge(it2)
|
||||
|
||||
class pyHLRShader(StrokeShader):
|
||||
def getName(self):
|
||||
return "pyHLRShader"
|
||||
def shade(self, stroke):
|
||||
originalSize = stroke.stroke_vertices_size()
|
||||
if originalSize < 4:
|
||||
@@ -783,8 +724,6 @@ 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):
|
||||
@@ -860,13 +799,11 @@ class pySinusDisplacementShader(StrokeShader):
|
||||
self._f = f
|
||||
self._a = a
|
||||
self._getNormal = Normal2DF0D()
|
||||
def getName(self):
|
||||
return "pySinusDisplacementShader"
|
||||
def shade(self, stroke):
|
||||
it = stroke.stroke_vertices_begin()
|
||||
while not it.is_end:
|
||||
v = it.object
|
||||
#print(self._getNormal.getName())
|
||||
#print(self._getNormal.name)
|
||||
n = self._getNormal(Interface0DIterator(it))
|
||||
p = v.point
|
||||
u = v.u
|
||||
@@ -885,8 +822,6 @@ class pyPerlinNoise1DShader(StrokeShader):
|
||||
self.__freq = freq
|
||||
self.__amp = amp
|
||||
self.__oct = oct
|
||||
def getName(self):
|
||||
return "pyPerlinNoise1DShader"
|
||||
def shade(self, stroke):
|
||||
it = stroke.stroke_vertices_begin()
|
||||
while not it.is_end:
|
||||
@@ -904,8 +839,6 @@ class pyPerlinNoise2DShader(StrokeShader):
|
||||
self.__freq = freq
|
||||
self.__amp = amp
|
||||
self.__oct = oct
|
||||
def getName(self):
|
||||
return "pyPerlinNoise2DShader"
|
||||
def shade(self, stroke):
|
||||
it = stroke.stroke_vertices_begin()
|
||||
while not it.is_end:
|
||||
@@ -922,8 +855,6 @@ class pyBluePrintCirclesShader(StrokeShader):
|
||||
self.__turns = turns
|
||||
self.__random_center = random_center
|
||||
self.__random_radius = random_radius
|
||||
def getName(self):
|
||||
return "pyBluePrintCirclesShader"
|
||||
def shade(self, stroke):
|
||||
it = stroke.stroke_vertices_begin()
|
||||
if it.is_end:
|
||||
@@ -986,8 +917,6 @@ class pyBluePrintEllipsesShader(StrokeShader):
|
||||
self.__turns = turns
|
||||
self.__random_center = random_center
|
||||
self.__random_radius = random_radius
|
||||
def getName(self):
|
||||
return "pyBluePrintEllipsesShader"
|
||||
def shade(self, stroke):
|
||||
it = stroke.stroke_vertices_begin()
|
||||
if it.is_end:
|
||||
@@ -1046,8 +975,6 @@ class pyBluePrintSquaresShader(StrokeShader):
|
||||
self.__turns = turns
|
||||
self.__bb_len = bb_len
|
||||
self.__bb_rand = bb_rand
|
||||
def getName(self):
|
||||
return "pyBluePrintSquaresShader"
|
||||
def shade(self, stroke):
|
||||
it = stroke.stroke_vertices_begin()
|
||||
if it.is_end:
|
||||
@@ -1144,8 +1071,6 @@ class pyBluePrintDirectedSquaresShader(StrokeShader):
|
||||
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 = Vector([0, 0])
|
||||
@@ -1241,8 +1166,6 @@ class pyModulateAlphaShader(StrokeShader):
|
||||
StrokeShader.__init__(self)
|
||||
self.__min = min
|
||||
self.__max = max
|
||||
def getName(self):
|
||||
return "pyModulateAlphaShader"
|
||||
def shade(self, stroke):
|
||||
it = stroke.stroke_vertices_begin()
|
||||
while not it.is_end:
|
||||
@@ -1258,8 +1181,6 @@ class pyModulateAlphaShader(StrokeShader):
|
||||
|
||||
## various
|
||||
class pyDummyShader(StrokeShader):
|
||||
def getName(self):
|
||||
return "pyDummyShader"
|
||||
def shade(self, stroke):
|
||||
it = stroke.stroke_vertices_begin()
|
||||
while not it.is_end:
|
||||
@@ -1270,8 +1191,6 @@ class pyDummyShader(StrokeShader):
|
||||
it.increment()
|
||||
|
||||
class pyDebugShader(StrokeShader):
|
||||
def getName(self):
|
||||
return "pyDebugShader"
|
||||
def shade(self, stroke):
|
||||
fe = GetSelectedFEdgeCF()
|
||||
id1 = fe.first_svertex.id
|
||||
|
||||
@@ -110,7 +110,7 @@ static void Iterator_dealloc(BPy_Iterator* self)
|
||||
|
||||
static PyObject * Iterator_repr(BPy_Iterator* self)
|
||||
{
|
||||
return PyUnicode_FromFormat("type: %s - address: %p", self->it->getExactTypeName().c_str(), self->it);
|
||||
return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->it);
|
||||
}
|
||||
|
||||
PyDoc_STRVAR(Iterator_increment_doc,
|
||||
|
||||
@@ -197,7 +197,7 @@ static void StrokeShader___dealloc__(BPy_StrokeShader* self)
|
||||
|
||||
static PyObject * StrokeShader___repr__(BPy_StrokeShader* self)
|
||||
{
|
||||
return PyUnicode_FromFormat("type: %s - address: %p", self->ss->getName().c_str(), self->ss);
|
||||
return PyUnicode_FromFormat("type: %s - address: %p", Py_TYPE(self)->tp_name, self->ss);
|
||||
}
|
||||
|
||||
static char StrokeShader_shade___doc__[] =
|
||||
|
||||
@@ -93,8 +93,8 @@ static PyObject * UnaryPredicate0D___call__(BPy_UnaryPredicate0D *self, PyObject
|
||||
Interface0DIterator *if0D_it = ((BPy_Interface0DIterator *)py_if0D_it)->if0D_it;
|
||||
|
||||
if (!if0D_it) {
|
||||
string msg(self->up0D->getName() + " has no Interface0DIterator");
|
||||
PyErr_SetString(PyExc_RuntimeError, msg.c_str());
|
||||
string class_name(Py_TYPE(self)->tp_name);
|
||||
PyErr_SetString(PyExc_RuntimeError, (class_name + " has no Interface0DIterator").c_str());
|
||||
return NULL;
|
||||
}
|
||||
if (typeid(*(self->up0D)) == typeid(UnaryPredicate0D)) {
|
||||
|
||||
@@ -141,8 +141,8 @@ static PyObject * UnaryPredicate1D___call__(BPy_UnaryPredicate1D *self, PyObject
|
||||
Interface1D *if1D = ((BPy_Interface1D *)py_if1D)->if1D;
|
||||
|
||||
if (!if1D) {
|
||||
string msg(self->up1D->getName() + " has no Interface0DIterator");
|
||||
PyErr_SetString(PyExc_RuntimeError, msg.c_str());
|
||||
string class_name(Py_TYPE(self)->tp_name);
|
||||
PyErr_SetString(PyExc_RuntimeError, (class_name + " has no Interface1D").c_str());
|
||||
return NULL;
|
||||
}
|
||||
if (typeid(*(self->up1D)) == typeid(UnaryPredicate1D)) {
|
||||
|
||||
Reference in New Issue
Block a user