[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54826] branches/soc-2008-mxcurioni/ release/scripts/freestyle/style_modules: Freestyle Python API improvements - part 9.
Tamito Kajiyama
rd6t-kjym at asahi-net.or.jp
Mon Feb 25 00:43:41 CET 2013
Revision: 54826
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54826
Author: kjym3
Date: 2013-02-24 23:43:40 +0000 (Sun, 24 Feb 2013)
Log Message:
-----------
Freestyle Python API improvements - part 9.
* Fix for wild card import statements (e.g., "from Freestyle import *") was done.
Now import statements are either without using "from" or with all imported names
explicitly listed.
* GNU GPL header blocks were added to Python programs. Additional code clean-up
was also made.
* Removed freestyle_init.py and extra-lines.sml that were no longer used.
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/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/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/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
Removed Paths:
-------------
branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/extra-lines.sml
branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/freestyle_init.py
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 23:18:21 UTC (rev 54825)
+++ branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/ChainingIterators.py 2013-02-24 23:43:40 UTC (rev 54826)
@@ -1,14 +1,5 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
#
-# 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
@@ -20,12 +11,17 @@
# 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.
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
-#############################################################################
+# ##### END GPL LICENSE BLOCK #####
-from freestyle_init import *
+# Filename : ChainingIterators.py
+# Author : Stephane Grabli
+# Date : 04/08/2005
+# Purpose : Chaining Iterators to be used with chaining operators
+
+from Freestyle import AdjacencyIterator, ChainingIterator, ExternalContourUP1D, Nature, TVertex
from Freestyle import ContextFunctions as CF
## the natural chaining iterator
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 23:18:21 UTC (rev 54825)
+++ branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/Functions0D.py 2013-02-24 23:43:40 UTC (rev 54826)
@@ -1,6 +1,29 @@
-from freestyle_init import *
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+from Freestyle import Curvature2DAngleF0D, CurvePoint, ReadCompleteViewMapPixelF0D, \
+ ReadSteerableViewMapPixelF0D, UnaryFunction0DDouble, UnaryFunction0DMaterial, \
+ UnaryFunction0DVec2f
from Freestyle import ContextFunctions as CF
+import math
+import mathutils
+
class CurveMaterialF0D(UnaryFunction0DMaterial):
# A replacement of the built-in MaterialF0D for stroke creation.
# MaterialF0D does not work with Curves and Strokes.
@@ -53,23 +76,25 @@
def __init__(self, l):
UnaryFunction0DVec2f.__init__(self)
self._l = l
- self._step = pow(2,self._l)
+ self._step = math.pow(2,self._l)
def __call__(self, iter):
p = iter.object.point_2d
- 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])
+ 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 mathutils.Vector([gx, gy])
class pyViewMapGradientNormF0D(UnaryFunction0DDouble):
def __init__(self, l):
UnaryFunction0DDouble.__init__(self)
self._l = l
- self._step = pow(2,self._l)
+ self._step = math.pow(2,self._l)
def __call__(self, iter):
p = iter.object.point_2d
- 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])
+ 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 = mathutils.Vector([gx, gy])
return grad.length
-
-
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-24 23:18:21 UTC (rev 54825)
+++ branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/Functions1D.py 2013-02-24 23:43:40 UTC (rev 54826)
@@ -1,5 +1,23 @@
-from freestyle_init import *
-from Functions0D import *
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+from Freestyle import GetProjectedZF1D, IntegrationType, UnaryFunction1DDouble, integrate
+from Functions0D import pyDensityAnisotropyF0D, pyViewMapGradientNormF0D
import string
class pyGetInverseProjectedZF1D(UnaryFunction1DDouble):
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-24 23:18:21 UTC (rev 54825)
+++ branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/PredicatesB1D.py 2013-02-24 23:43:40 UTC (rev 54826)
@@ -1,7 +1,26 @@
-from freestyle_init import *
-from Functions1D import *
-from random import *
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+from Freestyle import BinaryPredicate1D, GetZF1D, IntegrationType, Nature, SameShapeIdBP1D, ZDiscontinuityF1D
+from Functions1D import pyViewMapGradientNormF1D
+
+import random
+
class pyZBP1D(BinaryPredicate1D):
def __call__(self, i1, i2):
func = GetZF1D()
@@ -42,8 +61,8 @@
class pyShuffleBP1D(BinaryPredicate1D):
def __init__(self):
BinaryPredicate1D.__init__(self)
- seed(1)
+ random.seed(1)
def __call__(self, inter1, inter2):
- r1 = uniform(0,1)
- r2 = uniform(0,1)
+ r1 = random.uniform(0,1)
+ r2 = random.uniform(0,1)
return (r1<r2)
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-24 23:18:21 UTC (rev 54825)
+++ branches/soc-2008-mxcurioni/release/scripts/freestyle/style_modules/PredicatesU0D.py 2013-02-24 23:43:40 UTC (rev 54826)
@@ -1,6 +1,24 @@
-from freestyle_init import *
-from Functions0D import *
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+from Freestyle import Curvature2DAngleF0D, Nature, QuantitativeInvisibilityF0D, UnaryPredicate0D
+from Functions0D import pyCurvilinearLengthF0D
+
class pyHigherCurvature2DAngleUP0D(UnaryPredicate0D):
def __init__(self,a):
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list