[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54787] branches/soc-2008-mxcurioni: Fix for __repr__() depending on .getName() and .getExactTypeName().

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Sat Feb 23 13:17:41 CET 2013


Revision: 54787
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54787
Author:   kjym3
Date:     2013-02-23 12:17:40 +0000 (Sat, 23 Feb 2013)
Log Message:
-----------
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.

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/ChainingIterators.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/Functions0D.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/Functions1D.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/PredicatesB1D.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/PredicatesU0D.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/PredicatesU1D.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/logical_operators.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/long_anisotropically_dense.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/parameter_editor.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/shaders.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Iterator.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_UnaryPredicate0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_UnaryPredicate1D.cpp

Modified: branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/ChainingIterators.py
===================================================================
--- branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/ChainingIterators.py	2013-02-23 11:51:10 UTC (rev 54786)
+++ branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/ChainingIterators.py	2013-02-23 12:17:40 UTC (rev 54787)
@@ -35,8 +35,6 @@
 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 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 @@
 	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 @@
 		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 @@
 		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 @@
 		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 @@
 	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 @@
 		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 @@
 		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 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):

Modified: branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/Functions0D.py
===================================================================
--- branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/Functions0D.py	2013-02-23 11:51:10 UTC (rev 54786)
+++ branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/Functions0D.py	2013-02-23 12:17:40 UTC (rev 54787)
@@ -3,8 +3,6 @@
 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 @@
 		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 @@
 		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 @@
 		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 @@
 		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))

Modified: branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/Functions1D.py
===================================================================
--- branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/Functions1D.py	2013-02-23 11:51:10 UTC (rev 54786)
+++ branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/Functions1D.py	2013-02-23 12:17:40 UTC (rev 54787)
@@ -3,18 +3,12 @@
 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 @@
 		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 @@
 		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

Modified: branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/PredicatesB1D.py
===================================================================
--- branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/PredicatesB1D.py	2013-02-23 11:51:10 UTC (rev 54786)
+++ branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/PredicatesB1D.py	2013-02-23 12:17:40 UTC (rev 54787)
@@ -3,8 +3,6 @@
 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 @@
 	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 @@
 		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 @@
 	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 @@
 	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)

Modified: branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/PredicatesU0D.py
===================================================================
--- branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/PredicatesU0D.py	2013-02-23 11:51:10 UTC (rev 54786)
+++ branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/PredicatesU0D.py	2013-02-23 12:17:40 UTC (rev 54787)
@@ -5,8 +5,6 @@
 	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 @@
 		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 @@
 	def __init__(self,nature):
 		UnaryPredicate0D.__init__(self)
 		self._nature = nature
-	def getName(self):
-		return "pyVertexNatureUP0D"
 	def __call__(self, inter):
 		v = inter.object

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list