Update of /cvsroot/pyode/pyode/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24327/src
Modified Files:
joints.pyx ode.pyx
Log Message:
Creating a Body now requires a World object. Empty Bodies are not allowed anymore. ode.environment now simply holds None instead of an empty Body. The attach() method now accepts None as well.
Index: ode.pyx
===================================================================
RCS file: /cvsroot/pyode/pyode/src/ode.pyx,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** ode.pyx 15 Nov 2004 20:16:03 -0000 1.11
--- ode.pyx 6 Jun 2005 12:55:52 -0000 1.12
***************
*** 228,230 ****
######################################################################
! environment = Body(None)
--- 228,231 ----
######################################################################
! #environment = Body(None)
! environment = None
Index: joints.pyx
===================================================================
RCS file: /cvsroot/pyode/pyode/src/joints.pyx,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** joints.pyx 5 May 2005 17:41:33 -0000 1.6
--- joints.pyx 6 Jun 2005 12:55:52 -0000 1.7
***************
*** 132,139 ****
"""attach(body1, body2)
! Attach the joint to some new bodies.
- TODO: What if there's only one body.
-
@param body1: First body
@param body2: Second body
--- 132,138 ----
"""attach(body1, body2)
! Attach the joint to some new bodies. A body can be attached
! to the environment by passing None as second body.
@param body1: First body
@param body2: Second body
***************
*** 141,148 ****
@type body2: Body
"""
self.body1 = body1
self.body2 = body2
! dJointAttach(self.jid, body1.bid, body2.bid)
# getBody
--- 140,158 ----
@type body2: Body
"""
+ cdef dBodyID id1, id2
+
+ if body1==None:
+ id1 = NULL
+ else:
+ id1 = body1.bid
+
+ if body2==None:
+ id2 = NULL
+ else:
+ id2 = body2.bid
self.body1 = body1
self.body2 = body2
! dJointAttach(self.jid, id1, id2)
# getBody
|