[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15861] branches/soc-2008-mxcurioni/source /blender/freestyle: soc-2008-mxcurioni: SWIG replacement is effective and the native Freestyle API renders a correct result for the test style module 'contour.py'.

Maxime Curioni maxime.curioni at gmail.com
Tue Jul 29 12:45:07 CEST 2008


Revision: 15861
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15861
Author:   mxcurioni
Date:     2008-07-29 12:45:06 +0200 (Tue, 29 Jul 2008)

Log Message:
-----------
soc-2008-mxcurioni: SWIG replacement is effective and the native Freestyle API renders a correct result for the test style module 'contour.py'. More testing needs to be done to make sure my work was correct.

To make it work, I had to:
- update Operators to include all of its methods in the Python API
- redefine the Freestyle modules as local classes, allowing predicates to support the __call__ method (I found out that Python does not allow modules to be callable). The API is defined in the new freestyle_init.py  file.
- remove all references to former Python Freestyle API (located in source/blender/freestyle/python/, under the Freestyle.py file) and replace it with the new API file.
- normalize all constants related to the Nature class
- redefine the logical_operators.py file so that AndUP1D, OrUP1D and NotUP1D would be subclasses of a UnaryPredicate1D subclass having a operator() implementation. Using UnaryPredicate1D as a superclass would somehow prevent calls to the operator(). For the time being, I chose ContourUP1D (even though it does not really matter which subclass it is, since the __call__ method is redefined in all of these classes). I will implement this classes in C++ to get rid of the problem altogether.
- turn off a few classes that somehow are not well recognized (Noise, Curve...). I will reenable them later once I understand what's going on.

Modified Paths:
--------------
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppConfig.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/api.cpp
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/ChainingIterators.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/Functions0D.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/Functions1D.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/PredicatesB1D.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/PredicatesU0D.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/PredicatesU1D.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/anisotropic_diffusion.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/apriori_and_causal_density.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/apriori_density.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/backbone_stretcher.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/blueprint_circles.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/blueprint_ellipses.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/blueprint_squares.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/cartoon.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/contour.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/curvature2d.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/external_contour.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/external_contour_sketchy.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/external_contour_smooth.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/haloing.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/ignore_small_occlusions.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/invisible_lines.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/japanese_bigbrush.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/logical_operators.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/long_anisotropically_dense.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/multiple_parameterization.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/nature.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/near_lines.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/occluded_by_specific_object.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/polygonalize.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/qi0.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/qi0_not_external_contour.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/qi1.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/qi2.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/sequentialsplit_sketchy.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/shaders.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/sketchy_multiple_parameterization.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/sketchy_topology_broken.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/sketchy_topology_preserved.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/split_at_highest_2d_curvatures.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/split_at_tvertices.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/stroke_texture.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/suggestive.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/thickness_fof_depth_discontinuity.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/tipremover.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/tvertex_remover.py
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/uniformpruning_zsort.py

Added Paths:
-----------
    branches/soc-2008-mxcurioni/source/blender/freestyle/style_modules_blender/freestyle_init.py

Removed Paths:
-------------
    branches/soc-2008-mxcurioni/source/blender/freestyle/python/Freestyle.py

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppConfig.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppConfig.cpp	2008-07-29 10:42:10 UTC (rev 15860)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/AppConfig.cpp	2008-07-29 10:45:06 UTC (rev 15861)
@@ -61,7 +61,7 @@
               string(PATH_SEP.c_str()) +
               _ProjectDir +
 				string(DIR_SEP.c_str()) +
-              "style_modules" +
+              "style_modules_blender" +
               string(DIR_SEP.c_str()) ;
     if (getenv("PYTHONPATH")) {
       _PythonPath += string(PATH_SEP.c_str()) + string(getenv("PYTHONPATH"));

Modified: branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/api.cpp
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/api.cpp	2008-07-29 10:42:10 UTC (rev 15860)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/intern/app_blender/api.cpp	2008-07-29 10:45:06 UTC (rev 15861)
@@ -114,7 +114,7 @@
 		
 		// add style module
 		string style_module = pathconfig->getProjectDir() + 
-								Config::DIR_SEP + "style_modules" + 
+								Config::DIR_SEP + "style_modules_blender" + 
 								Config::DIR_SEP + "contour.py";
 		controller->InsertStyleModule( 0, const_cast<char *>(style_module.c_str()) 	 );
 		controller->toggleLayer(0, true);

Deleted: branches/soc-2008-mxcurioni/source/blender/freestyle/python/Freestyle.py
===================================================================
--- branches/soc-2008-mxcurioni/source/blender/freestyle/python/Freestyle.py	2008-07-29 10:42:10 UTC (rev 15860)
+++ branches/soc-2008-mxcurioni/source/blender/freestyle/python/Freestyle.py	2008-07-29 10:45:06 UTC (rev 15861)
@@ -1,4972 +0,0 @@
-# This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.35
-#
-# Don't modify this file, modify the SWIG interface instead.
-# This file is compatible with both classic and new-style classes.
-
-import _Freestyle
-import new
-new_instancemethod = new.instancemethod
-try:
-    _swig_property = property
-except NameError:
-    pass # Python < 2.2 doesn't have 'property'.
-def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
-    if (name == "thisown"): return self.this.own(value)
-    if (name == "this"):
-        if type(value).__name__ == 'PySwigObject':
-            self.__dict__[name] = value
-            return
-    method = class_type.__swig_setmethods__.get(name,None)
-    if method: return method(self,value)
-    if (not static) or hasattr(self,name):
-        self.__dict__[name] = value
-    else:
-        raise AttributeError("You cannot add attributes to %s" % self)
-
-def _swig_setattr(self,class_type,name,value):
-    return _swig_setattr_nondynamic(self,class_type,name,value,0)
-
-def _swig_getattr(self,class_type,name):
-    if (name == "thisown"): return self.this.own()
-    method = class_type.__swig_getmethods__.get(name,None)
-    if method: return method(self)
-    raise AttributeError,name
-
-def _swig_repr(self):
-    try: strthis = "proxy of " + self.this.__repr__()
-    except: strthis = ""
-    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
-
-import types
-try:
-    _object = types.ObjectType
-    _newclass = 1
-except AttributeError:
-    class _object : pass
-    _newclass = 0
-del types
-
-
-try:
-    import weakref
-    weakref_proxy = weakref.proxy
-except:
-    weakref_proxy = lambda x: x
-
-
-class PySwigIterator(_object):
-    __swig_setmethods__ = {}
-    __setattr__ = lambda self, name, value: _swig_setattr(self, PySwigIterator, name, value)
-    __swig_getmethods__ = {}
-    __getattr__ = lambda self, name: _swig_getattr(self, PySwigIterator, name)
-    def __init__(self, *args, **kwargs): raise AttributeError, "No constructor defined"
-    __repr__ = _swig_repr
-    __swig_destroy__ = _Freestyle.delete_PySwigIterator
-    __del__ = lambda self : None;
-    def value(*args): return _Freestyle.PySwigIterator_value(*args)
-    def incr(*args): return _Freestyle.PySwigIterator_incr(*args)
-    def decr(*args): return _Freestyle.PySwigIterator_decr(*args)
-    def distance(*args): return _Freestyle.PySwigIterator_distance(*args)
-    def equal(*args): return _Freestyle.PySwigIterator_equal(*args)
-    def copy(*args): return _Freestyle.PySwigIterator_copy(*args)
-    def next(*args): return _Freestyle.PySwigIterator_next(*args)
-    def previous(*args): return _Freestyle.PySwigIterator_previous(*args)
-    def advance(*args): return _Freestyle.PySwigIterator_advance(*args)
-    def __eq__(*args): return _Freestyle.PySwigIterator___eq__(*args)
-    def __ne__(*args): return _Freestyle.PySwigIterator___ne__(*args)
-    def __iadd__(*args): return _Freestyle.PySwigIterator___iadd__(*args)
-    def __isub__(*args): return _Freestyle.PySwigIterator___isub__(*args)
-    def __add__(*args): return _Freestyle.PySwigIterator___add__(*args)
-    def __sub__(*args): return _Freestyle.PySwigIterator___sub__(*args)
-    def __iter__(self): return self
-PySwigIterator_swigregister = _Freestyle.PySwigIterator_swigregister
-PySwigIterator_swigregister(PySwigIterator)
-
-class vectorInt(_object):
-    __swig_setmethods__ = {}
-    __setattr__ = lambda self, name, value: _swig_setattr(self, vectorInt, name, value)
-    __swig_getmethods__ = {}
-    __getattr__ = lambda self, name: _swig_getattr(self, vectorInt, name)
-    __repr__ = _swig_repr
-    def iterator(*args): return _Freestyle.vectorInt_iterator(*args)
-    def __iter__(self): return self.iterator()
-    def __nonzero__(*args): return _Freestyle.vectorInt___nonzero__(*args)
-    def __len__(*args): return _Freestyle.vectorInt___len__(*args)
-    def pop(*args): return _Freestyle.vectorInt_pop(*args)
-    def __getslice__(*args): return _Freestyle.vectorInt___getslice__(*args)
-    def __setslice__(*args): return _Freestyle.vectorInt___setslice__(*args)
-    def __delslice__(*args): return _Freestyle.vectorInt___delslice__(*args)
-    def __delitem__(*args): return _Freestyle.vectorInt___delitem__(*args)
-    def __getitem__(*args): return _Freestyle.vectorInt___getitem__(*args)
-    def __setitem__(*args): return _Freestyle.vectorInt___setitem__(*args)
-    def append(*args): return _Freestyle.vectorInt_append(*args)
-    def empty(*args): return _Freestyle.vectorInt_empty(*args)
-    def size(*args): return _Freestyle.vectorInt_size(*args)
-    def clear(*args): return _Freestyle.vectorInt_clear(*args)
-    def swap(*args): return _Freestyle.vectorInt_swap(*args)
-    def get_allocator(*args): return _Freestyle.vectorInt_get_allocator(*args)
-    def begin(*args): return _Freestyle.vectorInt_begin(*args)
-    def end(*args): return _Freestyle.vectorInt_end(*args)
-    def rbegin(*args): return _Freestyle.vectorInt_rbegin(*args)
-    def rend(*args): return _Freestyle.vectorInt_rend(*args)
-    def pop_back(*args): return _Freestyle.vectorInt_pop_back(*args)
-    def erase(*args): return _Freestyle.vectorInt_erase(*args)
-    def __init__(self, *args): 
-        this = _Freestyle.new_vectorInt(*args)
-        try: self.this.append(this)
-        except: self.this = this
-    def push_back(*args): return _Freestyle.vectorInt_push_back(*args)
-    def front(*args): return _Freestyle.vectorInt_front(*args)
-    def back(*args): return _Freestyle.vectorInt_back(*args)
-    def assign(*args): return _Freestyle.vectorInt_assign(*args)
-    def resize(*args): return _Freestyle.vectorInt_resize(*args)
-    def insert(*args): return _Freestyle.vectorInt_insert(*args)
-    def reserve(*args): return _Freestyle.vectorInt_reserve(*args)
-    def capacity(*args): return _Freestyle.vectorInt_capacity(*args)
-    __swig_destroy__ = _Freestyle.delete_vectorInt
-    __del__ = lambda self : None;
-vectorInt_swigregister = _Freestyle.vectorInt_swigregister
-vectorInt_swigregister(vectorInt)
-
-class Id(_object):
-    __swig_setmethods__ = {}
-    __setattr__ = lambda self, name, value: _swig_setattr(self, Id, name, value)
-    __swig_getmethods__ = {}
-    __getattr__ = lambda self, name: _swig_getattr(self, Id, name)
-    __repr__ = _swig_repr
-    def __init__(self, *args): 
-        this = _Freestyle.new_Id(*args)
-        try: self.this.append(this)
-        except: self.this = this
-    def getFirst(*args): return _Freestyle.Id_getFirst(*args)
-    def getSecond(*args): return _Freestyle.Id_getSecond(*args)
-    def setFirst(*args): return _Freestyle.Id_setFirst(*args)
-    def setSecond(*args): return _Freestyle.Id_setSecond(*args)
-    def __eq__(*args): return _Freestyle.Id___eq__(*args)
-    def __ne__(*args): return _Freestyle.Id___ne__(*args)
-    def __lt__(*args): return _Freestyle.Id___lt__(*args)
-    __swig_destroy__ = _Freestyle.delete_Id
-    __del__ = lambda self : None;
-Id_swigregister = _Freestyle.Id_swigregister
-Id_swigregister(Id)
-
-class Vec_2u(_object):
-    __swig_setmethods__ = {}
-    __setattr__ = lambda self, name, value: _swig_setattr(self, Vec_2u, name, value)
-    __swig_getmethods__ = {}
-    __getattr__ = lambda self, name: _swig_getattr(self, Vec_2u, name)
-    __repr__ = _swig_repr
-    def __init__(self, *args): 
-        this = _Freestyle.new_Vec_2u(*args)
-        try: self.this.append(this)
-        except: self.this = this
-    __swig_destroy__ = _Freestyle.delete_Vec_2u
-    __del__ = lambda self : None;
-    __swig_getmethods__["dim"] = lambda x: _Freestyle.Vec_2u_dim
-    if _newclass:dim = staticmethod(_Freestyle.Vec_2u_dim)
-    def norm(*args): return _Freestyle.Vec_2u_norm(*args)
-    def squareNorm(*args): return _Freestyle.Vec_2u_squareNorm(*args)
-    def normalize(*args): return _Freestyle.Vec_2u_normalize(*args)
-    def normalizeSafe(*args): return _Freestyle.Vec_2u_normalizeSafe(*args)
-    def __add__(*args): return _Freestyle.Vec_2u___add__(*args)
-    def __sub__(*args): return _Freestyle.Vec_2u___sub__(*args)
-    def __div__(*args): return _Freestyle.Vec_2u___div__(*args)
-    def __mul__(*args): return _Freestyle.Vec_2u___mul__(*args)
-    def __eq__(*args): return _Freestyle.Vec_2u___eq__(*args)
-    def __ne__(*args): return _Freestyle.Vec_2u___ne__(*args)
-    def __lt__(*args): return _Freestyle.Vec_2u___lt__(*args)

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list