Commits

German Larrain committed 8364d68

model.collision.base: replaced 'get_inner_object' method with 'inner_object' property in Space and Geom.

Comments (0)

Files changed (6)

ars/model/collision/adapters.py

 
 	def attach_body(self, body):
 		super(OdeGeom, self).attach_body(body)
-		self._inner_object.setBody(body.get_inner_object())
+		self._inner_object.setBody(body.inner_object)
 
 	#===========================================================================
 	# GETTERS AND SETTERS
 	def __init__(self, space, length):
 		OdeGeom.__init__(self)
 		base.Ray.__init__(self, space, length)
-		self._inner_object = ode.GeomRay(space.get_inner_object(), length)
+		self._inner_object = ode.GeomRay(space.inner_object, length)
 		self._inner_object.outer_object = self # it is the encapsulating object
 
 	def get_length(self):
 
 		tm_data = ode.TriMeshData()
 		tm_data.build(vertices, faces)
-		self._inner_object = ode.GeomTriMesh(tm_data, space.get_inner_object())
+		self._inner_object = ode.GeomTriMesh(tm_data, space.inner_object)
 		self._inner_object.setPosition(center)
 
 class OdeBasicShape(OdeGeom):
 		OdeBasicShape.__init__(self)
 		base.Box.__init__(self, space, size)
 
-		self._inner_object = ode.GeomBox(space.get_inner_object(), lengths=size)
+		self._inner_object = ode.GeomBox(space.inner_object, lengths=size)
 
 class Sphere(OdeBasicShape, base.Sphere):
 	"""Spherical shape"""
 		OdeBasicShape.__init__(self)
 		base.Sphere.__init__(self, space, radius)
 
-		self._inner_object = ode.GeomSphere(space.get_inner_object(), radius)
+		self._inner_object = ode.GeomSphere(space.inner_object, radius)
 
 class Capsule(OdeBasicShape, base.Capsule):
 	"""Capsule shape, aligned along the Z-axis by default"""
 		base.Capsule.__init__(self, space, length, radius)
 
 		self._inner_object = ode.GeomCCylinder(
-			space.get_inner_object(), radius, length)
+			space.inner_object, radius, length)
 
 class Cylinder(OdeBasicShape, base.Cylinder):
 	"""Cylinder shape, aligned along the Z-axis by default"""
 		base.Cylinder.__init__(self, space, length, radius)
 
 		self._inner_object = ode.GeomCylinder(
-			space.get_inner_object(), radius, length)
+			space.inner_object, radius, length)
 
 class Plane(OdeBasicShape, base.Plane):
 	"""Plane, different from a box"""
 		base.Plane.__init__(self, space, normal, dist)
 
 		self._inner_object = ode.GeomPlane(
-			space.get_inner_object(), normal, dist)
+			space.inner_object, normal, dist)
 
 class Cone(OdeBasicShape, base.Cone):
 	"""Cone"""

ars/model/collision/base.py

 	def __init__(self):
 		self._inner_object = None
 
-	def get_inner_object(self):
+	@property
+	def inner_object(self):
 		return self._inner_object
 
 	@abstractmethod
 	#===========================================================================
 	# GETTERS AND SETTERS
 	#===========================================================================
-	def get_inner_object(self):
+	@property
+	def inner_object(self):
 		return self._inner_object
 
 	def get_attached_body(self):

ars/model/contrib/ragdoll.py

 
 	def add_fixed_joint(self, body1, body2):
 		joint = ode.FixedJoint(self.world)
-		joint.attach(body1.get_inner_object(), body2.get_inner_object())
+		joint.attach(body1.inner_object, body2.inner_object)
 		joint.setFixed()
 
 		joint.style = "fixed"
 		anchor = mut.add3(anchor, self.offset)
 
 		joint = ode.HingeJoint(self.world)
-		joint.attach(body1.get_inner_object(), body2.get_inner_object())
+		joint.attach(body1.inner_object, body2.inner_object)
 		joint.setAnchor(anchor)
 		joint.setAxis(axis)
 		joint.setParam(ode.ParamLoStop, loStop)
 		anchor = mut.add3(anchor, self.offset)
 
 		joint = ode.UniversalJoint(self.world)
-		joint.attach(body1.get_inner_object(), body2.get_inner_object())
+		joint.attach(body1.inner_object, body2.inner_object)
 		joint.setAnchor(anchor)
 		joint.setAxis1(axis1)
 		joint.setAxis2(axis2)
 
 		# create the joint
 		joint = ode.BallJoint(self.world)
-		joint.attach(body1.get_inner_object(), body2.get_inner_object())
+		joint.attach(body1.inner_object, body2.inner_object)
 		joint.setAnchor(anchor)
 
 		#=======================================================================

ars/model/physics/adapters.py

 
 	@staticmethod
 	def create_plane_geom(space, normal, dist):
-		return ode.GeomPlane(space.get_inner_object(), normal, dist)
+		return ode.GeomPlane(space.inner_object, normal, dist)
 
 
 class OdeBody:

ars/model/physics/base.py

 # GETTERS AND SETTERS
 #===============================================================================
 
-	def get_inner_object(self):
+	@property
+	def inner_object(self):
 		return self._inner_object
 
 	def get_attached_geom(self):

ars/model/robot/joints.py

 	def __init__(self, world, body1, body2):
 		try:
 			inner_joint = ode.FixedJoint(world)
-			inner_joint.attach(body1.get_inner_object(), body2.get_inner_object())
+			inner_joint.attach(body1.inner_object, body2.inner_object)
 			inner_joint.setFixed()
 
 			super(Fixed, self).__init__(world, inner_joint, body1, body2)
 
 		try:
 			inner_joint = ode.HingeJoint(world)
-			inner_joint.attach(body1.get_inner_object(), body2.get_inner_object())
+			inner_joint.attach(body1.inner_object, body2.inner_object)
 			inner_joint.setAnchor(anchor)
 			inner_joint.setAxis(axis) # see contrib.Ragdoll.addHingeJoint for possible modification
 
 
 		try:
 			inner_joint = ode.UniversalJoint(world)
-			inner_joint.attach(body1.get_inner_object(), body2.get_inner_object())
+			inner_joint.attach(body1.inner_object, body2.inner_object)
 			inner_joint.setAnchor(anchor)
 			inner_joint.setAxis1(axis1) # see contrib.Ragdoll.addHingeJoint for possible modification
 			inner_joint.setAxis2(axis2)
 
 		try:
 			inner_joint = ode.BallJoint(world)
-			inner_joint.attach(body1.get_inner_object(), body2.get_inner_object())
+			inner_joint.attach(body1.inner_object, body2.inner_object)
 			inner_joint.setAnchor(anchor)
 
 			super(BallSocket, self).__init__(world, inner_joint, body1, body2)