Author: JonNeal Date: 2008-03-28 17:49:25 -0400 (Fri, 28 Mar 2008) New Revision: 1212
Modified: trunk/pysoy/src/_datatypes/AudioDeviceTuple.pxi trunk/pysoy/src/_datatypes/BoneList.pxi trunk/pysoy/src/_internals/AsyncQueue.pxi trunk/pysoy/src/_internals/Loadable.pxi trunk/pysoy/src/_internals/LoopThread.pxi trunk/pysoy/src/_internals/Loopable.pxi trunk/pysoy/src/_internals/PointerSet.pxi trunk/pysoy/src/colors/Color.pxi trunk/pysoy/src/controllers/Controller.pxi trunk/pysoy/src/controllers/Keyboard.pxi trunk/pysoy/src/controllers/Keyboard2.pxi trunk/pysoy/src/controllers/Window.pxi trunk/pysoy/src/fields/Buoyancy.pxi trunk/pysoy/src/fields/Field.pxi trunk/pysoy/src/fields/Monopole.pxi trunk/pysoy/src/fields/Shockwave.pxi trunk/pysoy/src/fields/Wind.pxi trunk/pysoy/src/joints/Ball.pxi trunk/pysoy/src/joints/Fixed.pxi trunk/pysoy/src/joints/Hinge.pxi trunk/pysoy/src/joints/Hinge2.pxi trunk/pysoy/src/joints/Joint.pxi trunk/pysoy/src/joints/Piston.pxi trunk/pysoy/src/joints/Slider.pxi trunk/pysoy/src/joints/Universal.pxi trunk/pysoy/src/models/Liquid.pxi trunk/pysoy/src/models/Mesh.pxi trunk/pysoy/src/models/Model.pxi trunk/pysoy/src/models/Shape.pxi trunk/pysoy/src/models/Sun.pxi trunk/pysoy/src/scenes/Scene.pxi trunk/pysoy/src/shapes/Box.pxi trunk/pysoy/src/shapes/Capsule.pxi trunk/pysoy/src/shapes/Ray.pxi trunk/pysoy/src/shapes/Shape.pxi trunk/pysoy/src/shapes/Sphere.pxi trunk/pysoy/src/textures/Video.pxi trunk/pysoy/src/transports/File.pxi trunk/pysoy/src/transports/Transport.pxi trunk/pysoy/src/widgets/Canvas.pxi trunk/pysoy/src/widgets/Container.pxi trunk/pysoy/src/widgets/Projector.pxi trunk/pysoy/src/widgets/StackX.pxi trunk/pysoy/src/widgets/StackY.pxi trunk/pysoy/src/widgets/StackZ.pxi trunk/pysoy/src/widgets/Widget.pxi trunk/pysoy/src/windows/Window-x11.pxi Log: Ticket #950: Cleaned up all files to comply with organisation standards, soy._core and NormalizationCubeMap ommited. Modified: trunk/pysoy/src/_datatypes/AudioDeviceTuple.pxi =================================================================== --- trunk/pysoy/src/_datatypes/AudioDeviceTuple.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/_datatypes/AudioDeviceTuple.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -55,6 +55,12 @@ class. You may only create your own instances of this class by creating a slice of one of those two classes. ''' + + ############################################################################ + # + # Python functions + # + def __cinit__(self) : self._slice = slice(None) @@ -122,9 +128,12 @@ return '(%s)' % _string[:-1] else : return '(%s)' % _string[:-2] - - - # C Functions + + ############################################################################ + # + # C functions + # + cdef int _get(self, char* _devices, int _index) : cdef int _i, _l, _n cdef object _range Modified: trunk/pysoy/src/_datatypes/BoneList.pxi =================================================================== --- trunk/pysoy/src/_datatypes/BoneList.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/_datatypes/BoneList.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -26,7 +26,12 @@ # 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 __cinit__ as # otherwise it's parent holds the real data. - + + ############################################################################ + # + # Python functions + # + def __cinit__(self, parent) : if not isinstance(parent, soy.models.Mesh) : raise TypeError('argument must be of type soy.models.Mesh') Modified: trunk/pysoy/src/_internals/AsyncQueue.pxi =================================================================== --- trunk/pysoy/src/_internals/AsyncQueue.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/_internals/AsyncQueue.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -25,12 +25,22 @@ wrapped to allow ease of use by other PySoy classes. ''' + ############################################################################ + # + # Python functions + # + def __cinit__(self) : self._asyncqueue = glib.g_async_queue_new() def __dealloc__(self) : glib.g_async_queue_unref(self._asyncqueue) + ############################################################################ + # + # C functions + # + cdef void _push(self, void* data) : glib.g_async_queue_push(self._asyncqueue, data) Modified: trunk/pysoy/src/_internals/Loadable.pxi =================================================================== --- trunk/pysoy/src/_internals/Loadable.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/_internals/Loadable.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -24,9 +24,20 @@ This should be inherited by any PySoy class which can be loaded or saved. ''' + + ############################################################################ + # + # Python functions + # + def __cinit__(self, source=None, *args, **keywords) : self._source = source + ############################################################################ + # + # C functions + # + cdef int _load(self, void* _data, int _size) : return 0 Modified: trunk/pysoy/src/_internals/LoopThread.pxi =================================================================== --- trunk/pysoy/src/_internals/LoopThread.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/_internals/LoopThread.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -28,6 +28,11 @@ the most ms it would like to pass before it's called again. ''' + ############################################################################ + # + # Python functions + # + def __cinit__(self, name) : assert type(name)==str, 'name must be a string' self._name = name @@ -73,7 +78,11 @@ def setDaemon(self, daemonic) : assert False, "cannot set daemon status of LoopThread" - + ############################################################################ + # + # C functions + # + cdef void _loop(self) : cdef int _i, _t, _most # Modified: trunk/pysoy/src/_internals/Loopable.pxi =================================================================== --- trunk/pysoy/src/_internals/Loopable.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/_internals/Loopable.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -22,5 +22,11 @@ This should be inherited by any PySoy class which LoopThread uses. ''' + + ############################################################################ + # + # C functions + # + cdef int _loop(self) : return 1000 Modified: trunk/pysoy/src/_internals/PointerSet.pxi =================================================================== --- trunk/pysoy/src/_internals/PointerSet.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/_internals/PointerSet.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -22,12 +22,23 @@ Uses GLib HashTables. ''' + + ############################################################################ + # + # Python functions + # + def __cinit__(self) : self._hashtable = glib.g_hash_table_new(glib.g_direct_hash, glib.g_direct_equal) def __dealloc__(self) : glib.g_hash_table_destroy(self._hashtable) + ############################################################################ + # + # C functions + # + cdef void _insert(self, void* key) : glib.g_hash_table_insert(self._hashtable, key, NULL) Modified: trunk/pysoy/src/colors/Color.pxi =================================================================== --- trunk/pysoy/src/colors/Color.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/colors/Color.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -28,6 +28,12 @@ #00FFAABB, #000000, #000, #FFFF, (1.0), (1.0, .75, .65, 1.0), (178, 211, 83, 255), (255, 34) ''' + + ########################################################################## + # + # Python Functions + # + def __cinit__(self, value) : if type(value) == str or type(value) == unicode : if value[0] == '#' : @@ -209,6 +215,10 @@ else : return "soy.colors.Color('%s') %s" % (_parts[0], _parts[1]) + ############################################################################ + # + # Properties + # property hex : '''Color hex Modified: trunk/pysoy/src/controllers/Controller.pxi =================================================================== --- trunk/pysoy/src/controllers/Controller.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/controllers/Controller.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -22,9 +22,20 @@ This is the base Controller class which all controllers must inherit. ''' + + ############################################################################ + # + # Python functions + # + def __repr__(self) : return '<Controller>' + ############################################################################ + # + # C functions + # + cdef void _coreEventKeyDown(self, unsigned char _cde, unsigned char _sym) : return Modified: trunk/pysoy/src/controllers/Keyboard.pxi =================================================================== --- trunk/pysoy/src/controllers/Keyboard.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/controllers/Keyboard.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -33,6 +33,12 @@ See soy.controllers.Controller for how to program controllers. ''' + + ############################################################################ + # + # Python functions + # + def __cinit__(self, window, *args, **kw) : if not isinstance(window, soy._core.Window) : raise TypeError('first argument must be of type soy.Window') @@ -94,6 +100,10 @@ self._acts_keycde[key] = <void*> value py.Py_INCREF(<soy.actions.Action> self._acts_keycde[key]) + ############################################################################ + # + # C functions + # cdef void _coreEventKeyDown(self, unsigned char _cde, unsigned char _sym) : if self._acts_keycde[_cde] : Modified: trunk/pysoy/src/controllers/Keyboard2.pxi =================================================================== --- trunk/pysoy/src/controllers/Keyboard2.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/controllers/Keyboard2.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -14,6 +14,12 @@ See soy.controllers.Controller for how to program controllers. ''' + + ############################################################################ + # + # Python functions + # + def __cinit__(self, window, *args, **kw) : if not isinstance(window, soy._core.Window) : raise TypeError('first argument must be of type soy.Window') @@ -102,8 +108,13 @@ py.Py_DECREF(<soy.actions.Action> self._acts_keycde_up[key]) self._acts_keycde_up[key] = <void*> value2 py.Py_INCREF(<soy.actions.Action> self._acts_keycde_up[key]) + + ############################################################################ + # + # C functions + # + - cdef void _coreEventKeyDown(self, unsigned char _cde, unsigned char _sym) : if self._acts_keycde_down[_cde] : (<soy.actions.Action> self._acts_keycde_down[_cde])._perform(1) Modified: trunk/pysoy/src/controllers/Window.pxi =================================================================== --- trunk/pysoy/src/controllers/Window.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/controllers/Window.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -26,7 +26,13 @@ 'close' See soy.controllers.Controller for how to program controllers. - ''' + ''' + + ############################################################################ + # + # Python functions + # + def __cinit__(self, window, *args, **kw) : if not isinstance(window, soy._core.Window) : raise TypeError('first argument must be of type soy.Window') @@ -69,8 +75,12 @@ py.Py_INCREF(<object> self._acts_close) else : raise KeyError('%s unsupported, see help(soy.controllers.Window)' % key) - - + + ############################################################################ + # + # C functions + # + cdef void _coreEventWinClose(self) : if self._acts_close : (<soy.actions.Action> self._acts_close)._perform(0) Modified: trunk/pysoy/src/fields/Buoyancy.pxi =================================================================== --- trunk/pysoy/src/fields/Buoyancy.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/fields/Buoyancy.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -22,11 +22,21 @@ Adjusts the mass Monopole works based on ''' - + + ############################################################################ + # + # Python functions + # + def __cinit__(self, *args, **keywords) : self._affected = soy._internals.Children() self._density = 0 - + + ############################################################################ + # + # C functions + # + cdef void _give(self, int _ccycle) : cdef int _i cdef soy.bodies.Body _otherBody @@ -65,7 +75,12 @@ * self._density) self._affected._append(<void*> other) return 1 - + + ############################################################################ + # + # Properties + # + property density : '''Buoyancy Density Modified: trunk/pysoy/src/fields/Field.pxi =================================================================== --- trunk/pysoy/src/fields/Field.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/fields/Field.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -23,7 +23,12 @@ Fields are optionally visible generic objects in 3d space that apply forces and other changes to other bodies. ''' - + + ############################################################################ + # + # C functions + # + cdef int _apply(self) : cdef int _i, _r cdef soy.scenes.Scene _scene Modified: trunk/pysoy/src/fields/Monopole.pxi =================================================================== --- trunk/pysoy/src/fields/Monopole.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/fields/Monopole.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -23,11 +23,21 @@ Monopoles are invisible fields that either attract or repulse other bodies in the entire scene based on an inverse square law. ''' - + + ############################################################################ + # + # Python functions + # + def __cinit__(self, soy.scenes.Scene parent, *args, **keywords) : self._multiplier = 0 self._affected = soy._internals.Children() - + + ############################################################################ + # + # C functions + # + cdef int _exert(self, soy.bodies.Body other) : self._affected._append(<void*> other) return 0 @@ -64,8 +74,12 @@ _other)._bodyID, f * xd / d, f * yd / d, f * zd /d) self._affected._iterDone() self._affected._empty() - - + + ############################################################################ + # + # Properties + # + property multiplier : '''Monopole's multiplier Modified: trunk/pysoy/src/fields/Shockwave.pxi =================================================================== --- trunk/pysoy/src/fields/Shockwave.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/fields/Shockwave.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -22,13 +22,32 @@ Models an constant-rate expanding shockwave ''' - + + ############################################################################ + # + # Python functions + # + def __cinit__(self, *args, **keywords) : self._space = ode.dHashSpaceCreate(NULL) def __dealloc__(self) : ode.dSpaceDestroy (self._space) + + def activate(self) : + if (self._t0 != 0) : + raise RuntimeError('Multiple use shockwaves are not yet available') + self._t0 = (<soy.scenes.Scene> self._scene)._time + self._inner = 0 + self._outer = 0 + self.shape = soy.shapes.Sphere(0) + stdio.printf("activate done\n") + ############################################################################ + # + # C functions + # + cdef int _exert(self, soy.bodies.Body other) : cdef float depth, force, dx, dy, dz, d stdio.printf("begin exert\n") @@ -75,16 +94,12 @@ ode.dGeomSphereSetRadius((<soy.shapes.Shape> self._shape)._geomID, 0) self._t0 = 0 stdio.printf("give complete\n") - - def activate(self) : - if (self._t0 != 0) : - raise RuntimeError('Multiple use shockwaves are not yet available') - self._t0 = (<soy.scenes.Scene> self._scene)._time - self._inner = 0 - self._outer = 0 - self.shape = soy.shapes.Sphere(0) - stdio.printf("activate done\n") + ############################################################################ + # + # Python functions + # + property velocity : '''Shockwave Velocity Modified: trunk/pysoy/src/fields/Wind.pxi =================================================================== --- trunk/pysoy/src/fields/Wind.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/fields/Wind.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -23,9 +23,19 @@ Affects bodies according to their tags 'cd' and 'cpx','cpy','cpz' ''' + ############################################################################ + # + # Python functions + # + def __cinit__(self, soy.scenes.Scene parent, *args, **keywords) : return + ############################################################################ + # + # C functions + # + # TODO incomplete: needs area measurements rather than assumptions cdef int _exert(self, soy.bodies.Body other) : cdef float dx, dy, dz, d2, r, f @@ -43,6 +53,11 @@ ode.dBodyAddForce((<soy.bodies.Body> other)._bodyID, r * dx, r * dy, r * dz) return 1 + ############################################################################ + # + # Properties + # + property vector : '''Wind Vector Modified: trunk/pysoy/src/joints/Ball.pxi =================================================================== --- trunk/pysoy/src/joints/Ball.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/joints/Ball.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -22,6 +22,12 @@ a "ball and socket" joint ''' + + ############################################################################ + # + # Python functions + # + def __init__(self, parent, body1, body2, position) : self._scene._stepLock() self._jointID = ode.dJointCreateBall(self._scene._worldID, NULL) @@ -30,6 +36,11 @@ self._scene._joints._append(<void*> self) self._scene._stepUnlock() + ############################################################################ + # + # Properties + # + property position : '''Ball.position Modified: trunk/pysoy/src/joints/Fixed.pxi =================================================================== --- trunk/pysoy/src/joints/Fixed.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/joints/Fixed.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -22,6 +22,12 @@ This is a fixed joint ''' + + ############################################################################ + # + # Python functions + # + def __init__(self, parent, body1, body2) : self._scene._stepLock() self._jointID = ode.dJointCreateFixed(self._scene._worldID, NULL) Modified: trunk/pysoy/src/joints/Hinge.pxi =================================================================== --- trunk/pysoy/src/joints/Hinge.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/joints/Hinge.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -22,6 +22,12 @@ a hinge joint ''' + + ############################################################################ + # + # Python functions + # + def __init__(self, parent, body1, body2, position, axis) : self._scene._stepLock() self._jointID = ode.dJointCreateHinge(self._scene._worldID, NULL) @@ -30,7 +36,15 @@ self.axis = axis self._scene._joints._append(<void*> self) self._scene._stepUnlock() - + + def addTorque(self, torque) : + ode.dJointAddHingeTorque(self._jointID, torque) + + ############################################################################ + # + # Properties + # + property position : '''Hinge.position @@ -96,5 +110,3 @@ def __get__(self) : return ode.dJointGetHingeParam(self._jointID, ode.dParamBounce) - def addTorque(self, torque) : - ode.dJointAddHingeTorque(self._jointID, torque) Modified: trunk/pysoy/src/joints/Hinge2.pxi =================================================================== --- trunk/pysoy/src/joints/Hinge2.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/joints/Hinge2.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -22,6 +22,12 @@ a double hinge joint ''' + + ############################################################################ + # + # Python functions + # + def __init__(self, parent, body1, body2, position, axis1, axis2) : self._scene._stepLock() self._jointID = ode.dJointCreateHinge2(self._scene._worldID, NULL) @@ -32,6 +38,14 @@ self._scene._joints._append(<void*> self) self._scene._stepUnlock() + def addTorque(self, torque1, torque2) : + ode.dJointAddHinge2Torques(self._jointID, torque1, torque2) + + ############################################################################ + # + # Properties + # + property position : '''Hinge2.position @@ -109,6 +123,3 @@ def __get__(self) : return ode.dJointGetHinge2Param(self._jointID, ode.dParamBounce) - def addTorque(self, torque1, torque2) : - ode.dJointAddHinge2Torques(self._jointID, torque1, torque2) - Modified: trunk/pysoy/src/joints/Joint.pxi =================================================================== --- trunk/pysoy/src/joints/Joint.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/joints/Joint.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -23,6 +23,11 @@ This is the "Null" joint which all other joints inherit from ''' + ############################################################################ + # + # Python functions + # + def __cinit__(self, soy.scenes.Scene parent, soy.bodies.Body body1, soy.bodies.Body body2, *args, **keywords) : Modified: trunk/pysoy/src/joints/Piston.pxi =================================================================== --- trunk/pysoy/src/joints/Piston.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/joints/Piston.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -22,6 +22,12 @@ a piston joint aka prismatic&rotoide ''' + + ############################################################################ + # + # Python functions + # + def __init__(self, parent, body1, body2, position, axis1, axis2) : self._scene._stepLock() self._jointID = ode.dJointCreatePR(self._scene._worldID, NULL) @@ -32,6 +38,14 @@ self._scene._joints._append(<void*> self) self._scene._stepUnlock() + def addTorque(self, torque) : + ode.dJointAddPRTorque(self._jointID, torque) + + ############################################################################ + # + # Properties + # + property position : '''Piston.position @@ -110,6 +124,3 @@ def __get__(self) : return ode.dJointGetPRParam(self._jointID, ode.dParamBounce) - def addTorque(self, torque) : - ode.dJointAddPRTorque(self._jointID, torque) - Modified: trunk/pysoy/src/joints/Slider.pxi =================================================================== --- trunk/pysoy/src/joints/Slider.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/joints/Slider.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -22,6 +22,12 @@ a slider joint ''' + + ############################################################################ + # + # Python functions + # + def __init__(self, parent, body1, body2, axis) : self._scene._stepLock() self._jointID = ode.dJointCreateSlider(self._scene._worldID, NULL) @@ -29,6 +35,14 @@ self.axis = axis self._scene._joints._append(<void*> self) self._scene._stepUnlock() + + def addForce(self, force) : + ode.dJointAddSliderForce(self._jointID, force) + + ############################################################################ + # + # Properties + # property axis : '''Slider.axis @@ -83,7 +97,3 @@ def __get__(self) : return ode.dJointGetSliderParam(self._jointID, ode.dParamBounce) - def addForce(self, force) : - ode.dJointAddSliderForce(self._jointID, force) - - Modified: trunk/pysoy/src/joints/Universal.pxi =================================================================== --- trunk/pysoy/src/joints/Universal.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/joints/Universal.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -22,6 +22,12 @@ a universal joint ''' + + ############################################################################ + # + # Python functions + # + def __init__(self, parent, body1, body2, position, axis1, axis2) : self._scene._stepLock() self._jointID = ode.dJointCreateUniversal(self._scene._worldID, NULL) @@ -32,6 +38,14 @@ self._scene._joints._append(<void*> self) self._scene._stepUnlock() + def addTorque(self, torque1, torque2) : + ode.dJointAddUniversalTorques(self._jointID, torque1, torque2) + + ############################################################################ + # + # Properties + # + property position : '''Universal.position @@ -109,7 +123,4 @@ ode.dJointSetUniversalParam(self._jointID, ode.dParamBounce, bounce) def __get__(self) : return ode.dJointGetUniversalParam(self._jointID, ode.dParamBounce) - - def addTorque(self, torque1, torque2) : - ode.dJointAddUniversalTorques(self._jointID, torque1, torque2) - + Modified: trunk/pysoy/src/models/Liquid.pxi =================================================================== --- trunk/pysoy/src/models/Liquid.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/models/Liquid.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -22,8 +22,12 @@ This models class renders a liquid with volumetric fog ''' - - + + ############################################################################ + # + # Python functions + # + def __cinit__(self, size=(1,1,1), color=None, material=None) : self._size[0] = size[0] self._size[1] = size[1] Modified: trunk/pysoy/src/models/Mesh.pxi =================================================================== --- trunk/pysoy/src/models/Mesh.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/models/Mesh.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -70,7 +70,11 @@ # internal order is changed (Face/Vertex removed, Face changes its Material, # various order-based optimization routines run, etc). - + ############################################################################ + # + # Python functions + # + def __cinit__(self, *args, **keywords) : self._mutex = py.PyThread_allocate_lock() self._mates = soy._datatypes.MaterialList(self) Modified: trunk/pysoy/src/models/Model.pxi =================================================================== --- trunk/pysoy/src/models/Model.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/models/Model.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -24,6 +24,12 @@ See dir(soy.models) for a list of other models. ''' + + ############################################################################ + # + # Python functions + # + def __cinit__(self, *args, **keywords) : self._mutex = py.PyThread_allocate_lock() Modified: trunk/pysoy/src/models/Shape.pxi =================================================================== --- trunk/pysoy/src/models/Shape.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/models/Shape.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -23,7 +23,11 @@ This mesh renders the shape of the body it belongs to. ''' - + ############################################################################ + # + # Python functions + # + def __cinit__(self, material=None, *args, **keywords) : self.material = material Modified: trunk/pysoy/src/models/Sun.pxi =================================================================== --- trunk/pysoy/src/models/Sun.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/models/Sun.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -22,7 +22,12 @@ This models class renders a sun. ''' - + + ############################################################################ + # + # Python functions + # + def __cinit__(self, **kwargs ) : if kwargs.has_key('centerMat') : self._centerMat = kwargs['centerMat'] Modified: trunk/pysoy/src/scenes/Scene.pxi =================================================================== --- trunk/pysoy/src/scenes/Scene.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/scenes/Scene.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -29,6 +29,11 @@ different worlds cannot collide. Worlds also apply gravity to bodies. ''' + ############################################################################ + # + # Python functions + # + def __cinit__(self, *args, **kw) : from soy.colors import gray self._worldID = ode.dWorldCreate() @@ -72,7 +77,11 @@ return '<Scene with %s>' % ', '.join(report) - + ############################################################################ + # + # C functions + # + cdef int _loop(self) : cdef int _i, _steps self._updateTime() @@ -261,6 +270,11 @@ ode.dJointAttach(_j, _b1, _b2) ''' + ############################################################################ + # + # Properties + # + property gravity : '''Scene gravity Modified: trunk/pysoy/src/shapes/Box.pxi =================================================================== --- trunk/pysoy/src/shapes/Box.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/shapes/Box.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -23,11 +23,21 @@ A rectangular prism shape. ''' + ############################################################################ + # + # Python functions + # + def __cinit__(self, float lx, float ly, float lz) : self._geomID = ode.dCreateBox(NULL, lx, ly, lz) ode.dGeomSetCategoryBits(self._geomID, 2) # GeomBody ode.dGeomSetData(self._geomID, <void*> self) + ############################################################################ + # + # C functions + # + cdef float _pointDepth(self, float x, float y, float z) : return <float> ode.dGeomBoxPointDepth(self._geomID, x, y, z) @@ -44,6 +54,11 @@ cdef int _finite(self) : return 1 + ############################################################################ + # + # Properties + # + property dimensions : '''Box's dimensions Modified: trunk/pysoy/src/shapes/Capsule.pxi =================================================================== --- trunk/pysoy/src/shapes/Capsule.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/shapes/Capsule.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -23,10 +23,20 @@ A capped cylinder shape. ''' + ############################################################################ + # + # Python functions + # + def __cinit__(self, float radius, float length) : self._geomID = ode.dCreateCapsule(NULL, radius, length) ode.dGeomSetData(self._geomID, <void*> self) + ############################################################################ + # + # C functions + # + cdef float _pointDepth(self, float x, float y, float z) : return <float> ode.dGeomCapsulePointDepth(self._geomID, x, y, z) @@ -43,6 +53,11 @@ cdef int _finite(self) : return 1 + ############################################################################ + # + # Properties + # + property radius : '''Capsule's radius Modified: trunk/pysoy/src/shapes/Ray.pxi =================================================================== --- trunk/pysoy/src/shapes/Ray.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/shapes/Ray.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -23,16 +23,31 @@ A line or line segment in 3d space. ''' + ############################################################################ + # + # Python functions + # + def __cinit__(self, float length) : self._geomID = ode.dCreateRay(NULL, length) ode.dGeomSetData(self._geomID, <void*> self) + ############################################################################ + # + # C functions + # + cdef float _radius(self) : return 0 cdef int _finite(self) : return 0 + ############################################################################ + # + # Properties + # + property length : '''Ray's length Modified: trunk/pysoy/src/shapes/Shape.pxi =================================================================== --- trunk/pysoy/src/shapes/Shape.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/shapes/Shape.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -24,9 +24,19 @@ contains the properties required to determine surface behaviour. ''' + ############################################################################ + # + # Python functions + # + def __cinit__(self, *args, **kw) : self._geomID = NULL + ############################################################################ + # + # C functions + # + cdef float _pointDepth(self, float x, float y, float z) : return 0 Modified: trunk/pysoy/src/shapes/Sphere.pxi =================================================================== --- trunk/pysoy/src/shapes/Sphere.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/shapes/Sphere.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -23,10 +23,20 @@ A spherical shape class. ''' + ############################################################################ + # + # Python functions + # + def __cinit__(self, float radius) : self._geomID = ode.dCreateSphere(NULL, radius) ode.dGeomSetData(self._geomID, <void*> self) + ############################################################################ + # + # C functions + # + cdef float _pointDepth(self, float x, float y, float z) : return <float> ode.dGeomSpherePointDepth(self._geomID, x, y, z) @@ -39,6 +49,11 @@ cdef int _finite(self) : return 1 + ############################################################################ + # + # Properties + # + property radius : '''Sphere's radius Modified: trunk/pysoy/src/textures/Video.pxi =================================================================== --- trunk/pysoy/src/textures/Video.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/textures/Video.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -24,6 +24,11 @@ Renders an Ogg Theora stream to a texture ''' + ############################################################################ + # + # C functions + # + cdef int _load(self, void* _data, int _size) : cdef int x, y, _cx, _cy, _tx, _ty, _yl, _yc cdef int _py, _pu, _pv, _pr, _pg, _pb @@ -146,7 +151,11 @@ return 1 return 0 - + ############################################################################ + # + # Properties + # + property offset : def __get__(self) : return self._frameTime Modified: trunk/pysoy/src/transports/File.pxi =================================================================== --- trunk/pysoy/src/transports/File.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/transports/File.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -22,6 +22,12 @@ This class handles loading and saving .soy and .ogg files to disk. ''' + + ############################################################################ + # + # C functions + # + cdef int _open(self, path) : self._file = stdio.fopen(path, 'rb') if self._file : Modified: trunk/pysoy/src/transports/Transport.pxi =================================================================== --- trunk/pysoy/src/transports/Transport.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/transports/Transport.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -173,11 +173,11 @@ cdef void _close(self) : return - ############################################################################ # # Ogg functions # + cdef void _oggHead(self) : cdef int _i, _sn cdef unsigned int _m @@ -255,11 +255,11 @@ return 0 return 1 - ############################################################################ # # Soy functions # + cdef void _soyHead(self) : cdef unsigned int _i, _nobj cdef unsigned char _l Modified: trunk/pysoy/src/widgets/Canvas.pxi =================================================================== --- trunk/pysoy/src/widgets/Canvas.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/widgets/Canvas.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -32,6 +32,12 @@ See also Widget,Projector,Window ''' + + ############################################################################ + # + # Python functions + # + def __cinit__(self, parent=None, margin=None, aspect=-1.0, texture=None, *args, **keywords) : @@ -54,23 +60,11 @@ if aspect < 0.0 : self._aspect = (<soy.textures.Texture> self._texture)._aspect - property texture : - '''Canvas texture - - This is the texture to render on the canvas. Default is None. - ''' - def __get__(self) : - if self._texture : - return self._texture - return None - def __set__(self, value) : - if isinstance(value, soy.textures.Texture) or value == None : - self._texture = value - else : - raise TypeError('that is not a texture') - def __del__(self) : - self._texture = None - + ############################################################################ + # + # C functions + # + cdef void _render(self) : if not self._texture : return @@ -106,3 +100,26 @@ gl.glDisable(gl.GL_BLEND) (<soy.textures.Texture> self._texture)._disable() + + ############################################################################ + # + # Properties + # + + property texture : + '''Canvas texture + + This is the texture to render on the canvas. Default is None. + ''' + def __get__(self) : + if self._texture : + return self._texture + return None + def __set__(self, value) : + if isinstance(value, soy.textures.Texture) or value == None : + self._texture = value + else : + raise TypeError('that is not a texture') + def __del__(self) : + self._texture = None + Modified: trunk/pysoy/src/widgets/Container.pxi =================================================================== --- trunk/pysoy/src/widgets/Container.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/widgets/Container.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -23,6 +23,12 @@ Container is the base class for any widget that 'contains' other widgets. This is NOT meant to be used directly. ''' + + ############################################################################ + # + # Python functions + # + def __cinit__(self, parent=None, margin=None, aspect=-1.0, *args, **keywords) : self._widgets = soy._internals.Children() @@ -40,6 +46,11 @@ self._width, self._height) self._widgets._iterDone() + ############################################################################ + # + # C functions + # + cdef void _render(self): cdef int _i self._widgets._iterStart() Modified: trunk/pysoy/src/widgets/Projector.pxi =================================================================== --- trunk/pysoy/src/widgets/Projector.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/widgets/Projector.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -28,6 +28,12 @@ See also soy.Widget, soy.Camera, soy.Screen ''' + + ############################################################################ + # + # Python functions + # + def __cinit__(self, parent=None, margin=None, aspect=-1.0, camera=None, *args, **keywords) : @@ -39,7 +45,11 @@ self._znear = 1.0 self._zfar = 100.0 - + ############################################################################ + # + # C functions + # + cdef void _render(self) : cdef float _aspect if not self._connected : @@ -56,7 +66,11 @@ gl.glLoadIdentity() self._camera._project() - + ############################################################################ + # + # Properties + # + property camera : '''Projection Camera Modified: trunk/pysoy/src/widgets/StackX.pxi =================================================================== --- trunk/pysoy/src/widgets/StackX.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/widgets/StackX.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -22,6 +22,12 @@ This stacking widget packs children horizontally without overlap. ''' + + ############################################################################ + # + # C functions + # + cdef void _resize(self, int _x, int _y, int _width, int _height) : cdef int _i, _part Widget._resize(self, _x, _y, _width, _height) Modified: trunk/pysoy/src/widgets/StackY.pxi =================================================================== --- trunk/pysoy/src/widgets/StackY.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/widgets/StackY.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -22,6 +22,12 @@ This stacking widget packs children vertically without overlap. ''' + + ############################################################################ + # + # C functions + # + cdef void _resize(self, int _x, int _y, int _width, int _height) : cdef int _i, _part Widget._resize(self, _x, _y, _width, _height) Modified: trunk/pysoy/src/widgets/StackZ.pxi =================================================================== --- trunk/pysoy/src/widgets/StackZ.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/widgets/StackZ.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -24,6 +24,11 @@ identical to how a soy.Window stacks top-level widgets. Z widget indexing. ''' + ############################################################################ + # + # C functions + # + cdef void _resize(self, int _x, int _y, int _width, int _height) : cdef int _i Widget._resize(self, _x, _y, _width, _height) Modified: trunk/pysoy/src/widgets/Widget.pxi =================================================================== --- trunk/pysoy/src/widgets/Widget.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/widgets/Widget.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -33,6 +33,12 @@ -soy.Widget.StackY -soy.Widget.StackZ ''' + + ############################################################################ + # + # Python functions + # + def __cinit__(self, parent=None, margin=None, aspect=-1.0, *args, **keywords) : if not self._setMargin(margin) : @@ -77,7 +83,11 @@ else : return '<%s>' % (_name) - + ############################################################################ + # + # C functions + # + cdef int _setMargin(self, object margin) : if not margin : margin = (0, 0, 0, 0) @@ -146,7 +156,11 @@ self._width = _mr - _ml self._height = _mt - _mb - + ############################################################################ + # + # Properties + # + property margin : '''Widget's margin Modified: trunk/pysoy/src/windows/Window-x11.pxi =================================================================== --- trunk/pysoy/src/windows/Window-x11.pxi 2008-03-26 18:30:23 UTC (rev 1211) +++ trunk/pysoy/src/windows/Window-x11.pxi 2008-03-28 21:49:25 UTC (rev 1212) @@ -40,6 +40,11 @@ Each instance of this class is a separate window. ''' + ############################################################################ + # + # Python functions + # + def __cinit__(self, screen, title='', icon=None, background=None, splash=False, position=(0,0), size=(320,240), *args, **kw) : if not isinstance(screen, Screen) : @@ -69,12 +74,26 @@ _windows.remove(<void*>self) _windows.unlock() + def __repr__(self) : + report = [] + if self._widgets.current == 1 : + report.append('1 widget') + elif self._widgets.current > 1 : + report.append('%d widgets' % self._widgets.current) + + if report == [] : return '<Empty Window>' + else : return '<Window with %s>' % ', '.join(report) + + ############################################################################ + # + # C functions + # + cdef void _openedWait(self, int _op) : # Use with care while self._opened < _op : soy._internals._sleep(100) - cdef void _create(self, int _x, int _y, int _width, int _height) : # # Since the CoreLoop thread must handle X traffic, we set self._opened @@ -315,7 +334,11 @@ (<soy.controllers.Controller> self._controllers.list[_i])._coreEventWinClose() self._controllers.unlock() - + ############################################################################ + # + # Properties + # + property title: '''Window's title string @@ -440,12 +463,3 @@ self._height = value[1] _windows.unlock() - def __repr__(self) : - report = [] - if self._widgets.current == 1 : - report.append('1 widget') - elif self._widgets.current > 1 : - report.append('%d widgets' % self._widgets.current) - - if report == [] : return '<Empty Window>' - else : return '<Window with %s>' % ', '.join(report) _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn