Author: ArcRiley Date: 2007-07-05 01:13:57 -0400 (Thu, 05 Jul 2007) New Revision: 354
Added: trunk/pysoy/src/_datatypes/ trunk/pysoy/src/_datatypes/FaceList.pxi trunk/pysoy/src/_datatypes/soy._internals.pxd trunk/pysoy/src/_datatypes/soy._internals.pyx Removed: trunk/pysoy/src/_datatypes/Children.pxi trunk/pysoy/src/_datatypes/FaceList.pxi trunk/pysoy/src/_datatypes/soy._internals.pxd trunk/pysoy/src/_datatypes/soy._internals.pyx trunk/pysoy/src/_internals/BoneList.pxi trunk/pysoy/src/_internals/FaceList.pxi trunk/pysoy/src/_internals/VertexList.pxi Modified: trunk/pysoy/src/_internals/soy._internals.pxd trunk/pysoy/src/_internals/soy._internals.pyx Log: Splitting these Copied: trunk/pysoy/src/_datatypes (from rev 347, trunk/pysoy/src/_internals) Deleted: trunk/pysoy/src/_datatypes/Children.pxi =================================================================== --- trunk/pysoy/src/_internals/Children.pxi 2007-07-04 20:32:03 UTC (rev 347) +++ trunk/pysoy/src/_datatypes/Children.pxi 2007-07-05 05:13:57 UTC (rev 354) @@ -1,105 +0,0 @@ -# PySoy _internals.Children class -# -# Copyright (C) 2006,2007 Team PySoy -# -# 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 3 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, see http://www.gnu.org/licenses -# -# $Id$ - -cdef class Children : - '''PySoy Children - - This is a thread-safe C array of Python objects for "Parent" classes. - It's append, index, and remove methods are identical to Python lists. - The up, down, top, bottom, and move methods move an object in the array. - The lock and unlock methods control the mutex. - ''' - - def __new__(self) : - self.size = 1 - self.current = 0 - self.list = <void **>py.PyMem_Malloc(sizeof(void *)) - self.mutex = py.PyThread_allocate_lock() - - cdef void lock(self) : - py.PyThread_acquire_lock(self.mutex,1) - - cdef int trylock(self) : - return py.PyThread_acquire_lock(self.mutex,0) - - cdef void unlock(self) : - py.PyThread_release_lock(self.mutex) - - cdef void append(self, void *child) : - if self.size == self.current : - self.size = self.size * 2 - self.list = <void **>py.PyMem_Realloc(self.list, - sizeof(void *)*(self.size)) - self.list[self.current] = <void *>child - self.current = self.current + 1 - - cdef int index(self, void *child) : - cdef int i - for i from 0 <= i < self.current : - if self.list[i] == child : - return i - return -1 - - cdef void swap(self, int first, int second) : - cdef void *sibling - sibling = self.list[first] - self.list[first] = self.list[second] - self.list[second] = sibling - - cdef void down(self, void *child) : - cdef int index - index = self.index(child) - if index > 0 : - self.swap(index, index-1) - - cdef void up(self, void *child) : - cdef int index - index = self.index(child) - if index == -1 : - return - if index < self.current-1 : - self.swap(index, index+1) - - cdef void top(self, void *child) : - cdef int index - index = self.index(child) - if index == -1 : - return - if index < self.current-1 : - self.swap(index, self.current-1) - - cdef void bottom(self, void *child) : - cdef int index - index = self.index(child) - if index > 0 : - self.swap(index, 0) - - cdef void remove(self, void *child) : - cdef int i - cdef int index - index = self.index(child) - if index == -1 : - return - for i from index <= i < (self.current-1) : - self.list[i] = self.list[i+1] - self.current = self.current - 1 - - def __dealloc__(self) : - py.PyMem_Free(self.list) - py.PyThread_free_lock(self.mutex) Deleted: trunk/pysoy/src/_datatypes/FaceList.pxi =================================================================== --- trunk/pysoy/src/_internals/FaceList.pxi 2007-07-04 20:32:03 UTC (rev 347) +++ trunk/pysoy/src/_datatypes/FaceList.pxi 2007-07-05 05:13:57 UTC (rev 354) @@ -1,60 +0,0 @@ -# PySoy _internals.FaceList class -# -# Copyright (C) 2007 Team PySoy -# -# 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 3 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, see http://www.gnu.org/licenses -# -# $Id$ - -# This class is not intended to be stored or transfered on it's own but -# rather as part of it's parent Mesh. Parent must be in __new__ as -# it's parent holds the data this class works on. - -cdef class FaceList : - '''PySoy FaceList - - This is a list-like container class for the faces of a soy.bodies.Mesh - ''' - def __new__(self, mesh) : - if not isinstance(mesh, soy.bodies._bodies.Mesh) : - raise TypeError('argument must be of type soy.bodies.Mesh') - self._mesh = mesh - - def __len__(self) : - return (<soy.bodies._bodies.Mesh> self._mesh)._nface - - def __str__(self) : - return '<FaceList with %d faces>' % self.__len__() - - def __repr__(self) : - return self.__str__() - - def __getitem__(self, index) : - return soy.atoms.Face(self._mesh, index) - - def append(self, item) : - cdef soy.bodies._bodies.Mesh _mesh - - if not isinstance(item, soy.atoms.Face) : - raise TypeError('may only add instances of soy.atoms.Face to this list') - if (<soy.atoms.Face> item)._index != -1 : - raise TypeError('this Face is already part of a Mesh, try .clone()') - _mesh = <soy.bodies._bodies.Mesh> self._mesh - _mesh._cface.lock() - _mesh._allocFaces(_mesh._nface + 1) - (<soy.atoms.Face> item)._addList(_mesh, _mesh._nface) - (<soy.atoms.Face> item)._setList() - _mesh._nface = _mesh._nface + 1 - _mesh._cface.unlock() - Copied: trunk/pysoy/src/_datatypes/FaceList.pxi (from rev 353, trunk/pysoy/src/_internals/FaceList.pxi) =================================================================== --- trunk/pysoy/src/_datatypes/FaceList.pxi (rev 0) +++ trunk/pysoy/src/_datatypes/FaceList.pxi 2007-07-05 05:13:57 UTC (rev 354) @@ -0,0 +1,63 @@ +# PySoy _internals.FaceList class +# +# Copyright (C) 2007 Team PySoy +# +# 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 3 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, see http://www.gnu.org/licenses +# +# $Id$ + +cimport soy.atoms +cimport soy.bodies._bodies + +cdef class FaceList : + '''PySoy FaceList + + This is a list-like container class for the faces of a soy.bodies.Mesh + ''' + # This class is not intended to be stored or transfered on it's own but + # rather as part of it's parent Mesh. Parent must be in __new__ as + # it's parent holds the data this class works on. + + def __new__(self, mesh) : + if not isinstance(mesh, soy.bodies._bodies.Mesh) : + raise TypeError('argument must be of type soy.bodies.Mesh') + self._mesh = mesh + + def __len__(self) : + return (<soy.bodies._bodies.Mesh> self._mesh)._nface + + def __str__(self) : + return '<FaceList with %d faces>' % self.__len__() + + def __repr__(self) : + return self.__str__() + + def __getitem__(self, index) : + return soy.atoms.Face(self._mesh, index) + + def append(self, item) : + cdef soy.bodies._bodies.Mesh _mesh + + if not isinstance(item, soy.atoms.Face) : + raise TypeError('may only add instances of soy.atoms.Face to this list') + if (<soy.atoms.Face> item)._index != -1 : + raise TypeError('this Face is already part of a Mesh, try .clone()') + _mesh = <soy.bodies._bodies.Mesh> self._mesh + _mesh._cface.lock() + _mesh._allocFaces(_mesh._nface + 1) + (<soy.atoms.Face> item)._addList(_mesh, _mesh._nface) + (<soy.atoms.Face> item)._setList() + _mesh._nface = _mesh._nface + 1 + _mesh._cface.unlock() + Deleted: trunk/pysoy/src/_datatypes/soy._internals.pxd =================================================================== --- trunk/pysoy/src/_internals/soy._internals.pxd 2007-07-04 20:32:03 UTC (rev 347) +++ trunk/pysoy/src/_datatypes/soy._internals.pxd 2007-07-05 05:13:57 UTC (rev 354) @@ -1,42 +0,0 @@ -# PySoy _internals Declarations -# -# Copyright (C) 2006,2007 Team PySoy -# -# 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 3 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, see http://www.gnu.org/licenses -# -# $Id$ - -cdef class Children : - cdef int size - cdef int current - cdef void **list - cdef void *mutex - cdef void lock ( self ) - cdef int trylock ( self ) - cdef void unlock ( self ) - cdef void append ( self, void* ) - cdef int index ( self, void* ) - cdef void swap ( self, int, int ) - cdef void up ( self, void* ) - cdef void down ( self, void* ) - cdef void top ( self, void* ) - cdef void bottom ( self, void* ) - cdef void remove ( self, void* ) - - -cdef class VertexList : - cdef object _mesh - -cdef class FaceList : - cdef object _mesh Copied: trunk/pysoy/src/_datatypes/soy._internals.pxd (from rev 353, trunk/pysoy/src/_internals/soy._internals.pxd) =================================================================== --- trunk/pysoy/src/_datatypes/soy._internals.pxd (rev 0) +++ trunk/pysoy/src/_datatypes/soy._internals.pxd 2007-07-05 05:13:57 UTC (rev 354) @@ -0,0 +1,49 @@ +# PySoy _internals Declarations +# +# Copyright (C) 2006,2007 Team PySoy +# +# 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 3 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, see http://www.gnu.org/licenses +# +# $Id$ + +cdef class Children : + cdef int size + cdef int current + cdef void **list + cdef void *mutex + cdef void lock ( self ) + cdef int trylock ( self ) + cdef void unlock ( self ) + cdef void append ( self, void* ) + cdef int index ( self, void* ) + cdef void swap ( self, int, int ) + cdef void up ( self, void* ) + cdef void down ( self, void* ) + cdef void top ( self, void* ) + cdef void bottom ( self, void* ) + cdef void remove ( self, void* ) + + +cdef class FaceList : + cdef object _mesh + + +cdef class Loadable : + cdef int _load(self, void *data) + cdef int _save(self, void *data) + + +cdef class VertexList : + cdef object _mesh + Deleted: trunk/pysoy/src/_datatypes/soy._internals.pyx =================================================================== --- trunk/pysoy/src/_internals/soy._internals.pyx 2007-07-04 20:32:03 UTC (rev 347) +++ trunk/pysoy/src/_datatypes/soy._internals.pyx 2007-07-05 05:13:57 UTC (rev 354) @@ -1,35 +0,0 @@ -'''PySoy _internals - -This module is for use by PySoy internals only. No public interface is -available, in fact, you may very well break something by experimenting. - -If you're curious use help() on these to see what these classes do. -''' -__credits__ = '''Copyright (C) 2006,2007 PySoy Group - - 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 3 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, see http://www.gnu.org/licenses -''' -__author__ = '''Maintained by ArcRiley''' -__date__ = 'Last change on '+ \ - '$Date$'[7:-20]+ \ - 'by '+'$Author$'[9:-2] -__version__ = 'Trunk (r'+'$Rev$'[6:-2]+')' - -cimport py -cimport soy.atoms -cimport soy.bodies._bodies - -include "Children.pxi" -include "FaceList.pxi" -include "VertexList.pxi" Copied: trunk/pysoy/src/_datatypes/soy._internals.pyx (from rev 353, trunk/pysoy/src/_internals/soy._internals.pyx) =================================================================== --- trunk/pysoy/src/_datatypes/soy._internals.pyx (rev 0) +++ trunk/pysoy/src/_datatypes/soy._internals.pyx 2007-07-05 05:13:57 UTC (rev 354) @@ -0,0 +1,32 @@ +'''PySoy _internals + +This module is for use by PySoy internals only. No public interface is +available, in fact, you may very well break something by experimenting. + +If you're curious use help() on these to see what these classes do. +''' +__credits__ = '''Copyright (C) 2006,2007 PySoy Group + + 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 3 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, see http://www.gnu.org/licenses +''' +__author__ = '''Maintained by ArcRiley''' +__date__ = 'Last change on '+ \ + '$Date$'[7:-20]+ \ + 'by '+'$Author$'[9:-2] +__version__ = 'Trunk (r'+'$Rev$'[6:-2]+')' + +include "Children.pxi" +include "Loadable.pxi" +include "FaceList.pxi" +include "VertexList.pxi" Deleted: trunk/pysoy/src/_internals/BoneList.pxi =================================================================== --- trunk/pysoy/src/_internals/BoneList.pxi 2007-07-05 05:11:45 UTC (rev 353) +++ trunk/pysoy/src/_internals/BoneList.pxi 2007-07-05 05:13:57 UTC (rev 354) @@ -1,38 +0,0 @@ -# PySoy _internals.Vertex class -# -# Copyright (C) 2007 Team PySoy -# -# 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 3 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, see http://www.gnu.org/licenses -# -# $Id$ - -cimport soy.bodies._bodies - -cdef class BoneList : - '''PySoy BoneList - - This is a list-like container class for bones. - ''' - - # This class is not intended to be stored or transfered on it's own but - # rather as part of it's parent Mesh. Parent must be in __new__ as - # otherwise it's parent holds the real data. - - def __new__(self, parent) : - if not isinstance(parent, soy.bodies._bodies.Mesh) : - raise TypeError('argument must be of type soy.bodies.Mesh') - self._mesh = <void *>parent - - def __len__(self) : - return (<soy.bodies._bodies.Mesh>self._mesh)._nvert Deleted: trunk/pysoy/src/_internals/FaceList.pxi =================================================================== --- trunk/pysoy/src/_internals/FaceList.pxi 2007-07-05 05:11:45 UTC (rev 353) +++ trunk/pysoy/src/_internals/FaceList.pxi 2007-07-05 05:13:57 UTC (rev 354) @@ -1,63 +0,0 @@ -# PySoy _internals.FaceList class -# -# Copyright (C) 2007 Team PySoy -# -# 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 3 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, see http://www.gnu.org/licenses -# -# $Id$ - -cimport soy.atoms -cimport soy.bodies._bodies - -cdef class FaceList : - '''PySoy FaceList - - This is a list-like container class for the faces of a soy.bodies.Mesh - ''' - # This class is not intended to be stored or transfered on it's own but - # rather as part of it's parent Mesh. Parent must be in __new__ as - # it's parent holds the data this class works on. - - def __new__(self, mesh) : - if not isinstance(mesh, soy.bodies._bodies.Mesh) : - raise TypeError('argument must be of type soy.bodies.Mesh') - self._mesh = mesh - - def __len__(self) : - return (<soy.bodies._bodies.Mesh> self._mesh)._nface - - def __str__(self) : - return '<FaceList with %d faces>' % self.__len__() - - def __repr__(self) : - return self.__str__() - - def __getitem__(self, index) : - return soy.atoms.Face(self._mesh, index) - - def append(self, item) : - cdef soy.bodies._bodies.Mesh _mesh - - if not isinstance(item, soy.atoms.Face) : - raise TypeError('may only add instances of soy.atoms.Face to this list') - if (<soy.atoms.Face> item)._index != -1 : - raise TypeError('this Face is already part of a Mesh, try .clone()') - _mesh = <soy.bodies._bodies.Mesh> self._mesh - _mesh._cface.lock() - _mesh._allocFaces(_mesh._nface + 1) - (<soy.atoms.Face> item)._addList(_mesh, _mesh._nface) - (<soy.atoms.Face> item)._setList() - _mesh._nface = _mesh._nface + 1 - _mesh._cface.unlock() - Deleted: trunk/pysoy/src/_internals/VertexList.pxi =================================================================== --- trunk/pysoy/src/_internals/VertexList.pxi 2007-07-05 05:11:45 UTC (rev 353) +++ trunk/pysoy/src/_internals/VertexList.pxi 2007-07-05 05:13:57 UTC (rev 354) @@ -1,59 +0,0 @@ -# PySoy _internals.VertexList class -# -# Copyright (C) 2007 Team PySoy -# -# 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 3 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, see http://www.gnu.org/licenses -# -# $Id$ - -# This class is not intended to be stored or transfered on it's own but -# rather as part of it's parent Mesh. Parent must be in __new__ as -# it's parent holds the data this class works on. - -cdef class VertexList : - '''PySoy VertexList - - This is a list-like container class for shared vertices. - ''' - def __new__(self, parent) : - if not isinstance(parent, soy.bodies._bodies.Mesh) : - raise TypeError('argument must be of type soy.bodies.Mesh') - self._mesh = parent - - def __len__(self) : - return (<soy.bodies._bodies.Mesh> self._mesh)._nvert - - def __str__(self) : - return '<VertexList with %d verticies>' % self.__len__() - - def __repr__(self) : - return self.__str__() - - def __getitem__(self, index) : - return soy.atoms.Vertex(self._mesh, index) - - def append(self, item) : - cdef soy.bodies._bodies.Mesh _mesh - if not isinstance(item, soy.atoms.Vertex) : - raise TypeError('may only add instances of soy.atoms.Vertex to this list') - if (<soy.atoms.Vertex> item)._index != -1 : - raise TypeError('this Vertex is already part of a Mesh, try using .clone') - _mesh = <soy.bodies._bodies.Mesh> self._mesh - _mesh._cvert.lock() - _mesh._allocVerts(_mesh._nvert + 1) - (<soy.atoms.Vertex> item)._addList(_mesh, _mesh._nvert) - (<soy.atoms.Vertex> item)._setList() - _mesh._nvert = _mesh._nvert + 1 - _mesh._cvert.unlock() - Modified: trunk/pysoy/src/_internals/soy._internals.pxd =================================================================== --- trunk/pysoy/src/_internals/soy._internals.pxd 2007-07-05 05:11:45 UTC (rev 353) +++ trunk/pysoy/src/_internals/soy._internals.pxd 2007-07-05 05:13:57 UTC (rev 354) @@ -34,16 +34,6 @@ cdef void bottom ( self, void* ) cdef void remove ( self, void* ) - -cdef class FaceList : - cdef object _mesh - - cdef class Loadable : cdef int _load(self, void *data) cdef int _save(self, void *data) - - -cdef class VertexList : - cdef object _mesh - Modified: trunk/pysoy/src/_internals/soy._internals.pyx =================================================================== --- trunk/pysoy/src/_internals/soy._internals.pyx 2007-07-05 05:11:45 UTC (rev 353) +++ trunk/pysoy/src/_internals/soy._internals.pyx 2007-07-05 05:13:57 UTC (rev 354) @@ -28,5 +28,3 @@ include "Children.pxi" include "Loadable.pxi" -include "FaceList.pxi" -include "VertexList.pxi" _______________________________________________ PySoy-SVN mailing list [email protected] http://www.pysoy.org/mailman/listinfo/pysoy-svn
