[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54804] branches/soc-2008-mxcurioni: Freestyle Python API improvements - part 8.

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Sun Feb 24 03:39:39 CET 2013


Revision: 54804
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54804
Author:   kjym3
Date:     2013-02-24 02:39:38 +0000 (Sun, 24 Feb 2013)
Log Message:
-----------
Freestyle Python API improvements - part 8.

* Proper handling of keyword arguments was implemented in Operators and ContextFunctions,
as well as in methods of Interface0D, Interface1D, Iterator, their subclasses, Noise and
IntegrationType.

* Operators' methods and functions in the ContextFunctions module were renamed from
CamelCase to lower cases + underscores.  Style modules were updated accordingly.

* Additional code clean-up was also made.

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/anisotropic_diffusion.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/apriori_and_causal_density.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/apriori_density.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/backbone_stretcher.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/blueprint_circles.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/blueprint_ellipses.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/blueprint_squares.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/cartoon.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/contour.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/curvature2d.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/external_contour.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/external_contour_sketchy.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/external_contour_smooth.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/haloing.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/ignore_small_occlusions.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/invisible_lines.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/japanese_bigbrush.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/long_anisotropically_dense.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/multiple_parameterization.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/nature.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/near_lines.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/occluded_by_specific_object.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/parameter_editor.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/polygonalize.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/qi0.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/qi0_not_external_contour.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/qi1.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/qi2.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/sequentialsplit_sketchy.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/shaders.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/sketchy_multiple_parameterization.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/sketchy_topology_broken.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/sketchy_topology_preserved.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/split_at_highest_2d_curvatures.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/split_at_tvertices.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/stroke_texture.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/suggestive.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/thickness_fof_depth_discontinuity.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/tipremover.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/tvertex_remover.py
    branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/uniformpruning_zsort.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_ContextFunctions.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_FrsNoise.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_IntegrationType.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Interface0D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Interface1D.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_Operators.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_SShape.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_StrokeAttribute.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_ViewMap.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/BPy_ViewShape.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface0D/BPy_SVertex.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface0D/BPy_ViewVertex.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface0D/ViewVertex/BPy_TVertex.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/BPy_FrsCurve.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Interface1D/Curve/BPy_Chain.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/python/Iterator/BPy_ChainingIterator.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-24 02:32:56 UTC (rev 54803)
+++ branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/ChainingIterators.py	2013-02-24 02:39:38 UTC (rev 54804)
@@ -26,6 +26,7 @@
 #############################################################################
 
 from freestyle_init import *
+from Freestyle import ContextFunctions as CF
 
 ## the natural chaining iterator
 ## It follows the edges of same nature following the topology of
@@ -155,7 +156,7 @@
 		while not it.is_end:
 			ve = it.object
 			if self._isExternalContour(ve):
-				if ve.time_stamp == GetTimeStampCF():
+				if ve.time_stamp == CF.get_time_stamp():
 					winner = ve
 			it.increment()
 		
@@ -178,10 +179,10 @@
 class pySketchyChainSilhouetteIterator(ChainingIterator):
 	def __init__(self, nRounds=3,stayInSelection=True):
 		ChainingIterator.__init__(self, stayInSelection, False, None, True)
-		self._timeStamp = GetTimeStampCF()+nRounds
+		self._timeStamp = CF.get_time_stamp()+nRounds
 		self._nRounds = nRounds
 	def init(self):
-		self._timeStamp = GetTimeStampCF()+self._nRounds
+		self._timeStamp = CF.get_time_stamp()+self._nRounds
 	def traverse(self, iter):
 		winner = None
 		it = AdjacencyIterator(iter)
@@ -235,10 +236,10 @@
 class pySketchyChainingIterator(ChainingIterator):
 	def __init__(self, nRounds=3, stayInSelection=True):
 		ChainingIterator.__init__(self, stayInSelection, False, None, True)
-		self._timeStamp = GetTimeStampCF()+nRounds
+		self._timeStamp = CF.get_time_stamp()+nRounds
 		self._nRounds = nRounds
 	def init(self):
-		self._timeStamp = GetTimeStampCF()+self._nRounds
+		self._timeStamp = CF.get_time_stamp()+self._nRounds
 	def traverse(self, iter):
 		winner = None
 		it = AdjacencyIterator(iter)
@@ -309,7 +310,7 @@
 					break
 		if winner is not None:
 			# check whether this edge was part of the selection
-			if winner.time_stamp != GetTimeStampCF():
+			if winner.time_stamp != CF.get_time_stamp():
 				#print("---", winner.id.first, winner.id.second)
 				# if not, let's check whether it's short enough with
 				# respect to the chain made without staying in the selection
@@ -348,7 +349,7 @@
 				_cit.current_edge = winner
 				_cit.orientation = winnerOrientation
 				_cit.init()
-				while _cit.is_end == 0 and _cit.object.time_stamp != GetTimeStampCF():
+				while _cit.is_end == 0 and _cit.object.time_stamp != CF.get_time_stamp():
 					ve = _cit.object
 					#print("-------- --------", ve.id.first, ve.id.second)
 					connexl = connexl + ve.length_2d
@@ -406,7 +407,7 @@
 					break
 		if winner is not None:
 			# check whether this edge was part of the selection
-			if winner.time_stamp != GetTimeStampCF():
+			if winner.time_stamp != CF.get_time_stamp():
 				#print("---", winner.id.first, winner.id.second)
 				# nw let's compute the length of this connex non selected part:
 				connexl = 0
@@ -415,7 +416,7 @@
 				_cit.current_edge = winner
 				_cit.orientation = winnerOrientation
 				_cit.init()
-				while _cit.is_end == 0 and _cit.object.time_stamp != GetTimeStampCF():
+				while _cit.is_end == 0 and _cit.object.time_stamp != CF.get_time_stamp():
 					ve = _cit.object
 					#print("-------- --------", ve.id.first, ve.id.second)
 					connexl = connexl + ve.length_2d
@@ -479,7 +480,7 @@
 					break
 		if winner is not None:
 			# check whether this edge was part of the selection
-			if winner.time_stamp != GetTimeStampCF():
+			if winner.time_stamp != CF.get_time_stamp():
 				#print("---", winner.id.first, winner.id.second)
 				# if not, let's check whether it's short enough with
 				# respect to the chain made without staying in the selection
@@ -518,7 +519,7 @@
 				_cit.current_edge = winner
 				_cit.orientation = winnerOrientation
 				_cit.init()
-				while _cit.is_end == 0 and _cit.object.time_stamp != GetTimeStampCF():
+				while _cit.is_end == 0 and _cit.object.time_stamp != CF.get_time_stamp():
 					ve = _cit.object
 					#print("-------- --------", ve.id.first, ve.id.second)
 					connexl = connexl + ve.length_2d

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-24 02:32:56 UTC (rev 54803)
+++ branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/Functions0D.py	2013-02-24 02:39:38 UTC (rev 54804)
@@ -1,4 +1,5 @@
 from freestyle_init import *
+from Freestyle import ContextFunctions as CF
 
 class CurveMaterialF0D(UnaryFunction0DMaterial):
 	# A replacement of the built-in MaterialF0D for stroke creation.
@@ -55,8 +56,8 @@
 		self._step = pow(2,self._l)
 	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))
-		gy = ReadCompleteViewMapPixelCF(self._l, int(p.x), int(p.y+self._step))- ReadCompleteViewMapPixelCF(self._l, int(p.x), int(p.y))
+		gx = CF.read_complete_view_map_pixel(self._l, int(p.x+self._step), int(p.y))- CF.read_complete_view_map_pixel(self._l, int(p.x), int(p.y))
+		gy = CF.read_complete_view_map_pixel(self._l, int(p.x), int(p.y+self._step))- CF.read_complete_view_map_pixel(self._l, int(p.x), int(p.y))
 		return Vector([gx, gy])
 
 class pyViewMapGradientNormF0D(UnaryFunction0DDouble):
@@ -66,8 +67,8 @@
 		self._step = pow(2,self._l)
 	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))
-		gy = ReadCompleteViewMapPixelCF(self._l, int(p.x), int(p.y+self._step))- ReadCompleteViewMapPixelCF(self._l, int(p.x), int(p.y))
+		gx = CF.read_complete_view_map_pixel(self._l, int(p.x+self._step), int(p.y))- CF.read_complete_view_map_pixel(self._l, int(p.x), int(p.y))
+		gy = CF.read_complete_view_map_pixel(self._l, int(p.x), int(p.y+self._step))- CF.read_complete_view_map_pixel(self._l, int(p.x), int(p.y))
 		grad = Vector([gx, gy])
 		return grad.length
 

Modified: branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/anisotropic_diffusion.py
===================================================================
--- branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/anisotropic_diffusion.py	2013-02-24 02:32:56 UTC (rev 54803)
+++ branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/anisotropic_diffusion.py	2013-02-24 02:39:38 UTC (rev 54804)
@@ -36,7 +36,7 @@
 upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D())
 Operators.select( upred )
 bpred = TrueBP1D()
-Operators.bidirectionalChain(ChainPredicateIterator(upred, bpred), NotUP1D(upred) )
+Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(upred) )
 shaders_list = [
     ConstantThicknessShader(4),
     StrokeTextureShader("smoothAlpha.bmp", Stroke.OPAQUE_MEDIUM, False),

Modified: branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/apriori_and_causal_density.py
===================================================================
--- branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/apriori_and_causal_density.py	2013-02-24 02:32:56 UTC (rev 54803)
+++ branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/apriori_and_causal_density.py	2013-02-24 02:39:38 UTC (rev 54804)
@@ -37,7 +37,7 @@
 upred = AndUP1D(QuantitativeInvisibilityUP1D(0), pyHighViewMapDensityUP1D(0.3, IntegrationType.LAST))
 Operators.select(upred)
 bpred = TrueBP1D()
-Operators.bidirectionalChain(ChainPredicateIterator(upred, bpred), NotUP1D(QuantitativeInvisibilityUP1D(0)))
+Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(QuantitativeInvisibilityUP1D(0)))
 shaders_list = 	[
 		ConstantThicknessShader(2), 
 		ConstantColorShader(0.0, 0.0, 0.0,1)

Modified: branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/apriori_density.py
===================================================================
--- branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/apriori_density.py	2013-02-24 02:32:56 UTC (rev 54803)
+++ branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/apriori_density.py	2013-02-24 02:39:38 UTC (rev 54804)
@@ -35,7 +35,7 @@
 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)))
+Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(QuantitativeInvisibilityUP1D(0)))
 shaders_list = 	[
 		ConstantThicknessShader(2), 
 		ConstantColorShader(0.0, 0.0, 0.0,1)

Modified: branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/backbone_stretcher.py
===================================================================
--- branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/backbone_stretcher.py	2013-02-24 02:32:56 UTC (rev 54803)
+++ branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/backbone_stretcher.py	2013-02-24 02:39:38 UTC (rev 54804)
@@ -31,6 +31,6 @@
 from shaders import *
 
 Operators.select(QuantitativeInvisibilityUP1D(0))
-Operators.bidirectionalChain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
+Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0)))
 shaders_list = [TextureAssignerShader(4), ConstantColorShader(0.5, 0.5, 0.5), BackboneStretcherShader(20)]
 Operators.create(TrueUP1D(), shaders_list)

Modified: branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/blueprint_circles.py
===================================================================
--- branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/blueprint_circles.py	2013-02-24 02:32:56 UTC (rev 54803)
+++ branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/blueprint_circles.py	2013-02-24 02:39:38 UTC (rev 54804)
@@ -34,7 +34,7 @@

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list