[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15360] branches/apricot/source/gameengine : svn merge -r15355:HEAD https://svn.blender.org/svnroot/bf-blender/trunk /blender/

Campbell Barton ideasman42 at gmail.com
Thu Jun 26 14:43:19 CEST 2008


Revision: 15360
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15360
Author:   campbellbarton
Date:     2008-06-26 14:43:10 +0200 (Thu, 26 Jun 2008)

Log Message:
-----------
svn  merge  -r15355:HEAD https://svn.blender.org/svnroot/bf-blender/trunk/blender/

Modified Paths:
--------------
    branches/apricot/source/gameengine/Converter/BL_ActionActuator.cpp
    branches/apricot/source/gameengine/Expressions/Value.cpp
    branches/apricot/source/gameengine/Expressions/Value.h
    branches/apricot/source/gameengine/Ketsji/KX_GameObject.cpp
    branches/apricot/source/gameengine/Ketsji/KX_GameObject.h
    branches/apricot/source/gameengine/PyDoc/KX_GameObject.py

Modified: branches/apricot/source/gameengine/Converter/BL_ActionActuator.cpp
===================================================================
--- branches/apricot/source/gameengine/Converter/BL_ActionActuator.cpp	2008-06-26 12:39:06 UTC (rev 15359)
+++ branches/apricot/source/gameengine/Converter/BL_ActionActuator.cpp	2008-06-26 12:43:10 UTC (rev 15360)
@@ -350,7 +350,7 @@
 	}
 	
 	/* Set the property if its defined */
-	if (m_framepropname) {
+	if (m_framepropname[0] != '\0') {
 		CValue* propowner = GetParent();
 		CValue* oldprop = propowner->GetProperty(m_framepropname);
 		CValue* newval = new CFloatValue(m_localtime);

Modified: branches/apricot/source/gameengine/Expressions/Value.cpp
===================================================================
--- branches/apricot/source/gameengine/Expressions/Value.cpp	2008-06-26 12:39:06 UTC (rev 15359)
+++ branches/apricot/source/gameengine/Expressions/Value.cpp	2008-06-26 12:43:10 UTC (rev 15360)
@@ -520,11 +520,6 @@
 	
 }
 
-
-
-
-
-
 double*		CValue::GetVector3(bool bGetTransformedVec)
 {
 	assertd(false); // don;t get vector from me
@@ -775,6 +770,25 @@
 	//PyObjectPlus::_setattr(attr,value);
 	return 0;
 };
+
+PyObject*	CValue::ConvertKeysToPython( void )
+{
+	PyObject *pylist = PyList_New( 0 );
+	PyObject *pystr;
+	
+	if (m_pNamedPropertyArray)
+	{
+		for ( std::map<STR_String,CValue*>::iterator it = m_pNamedPropertyArray->begin();
+		!(it == m_pNamedPropertyArray->end());it++)
+		{
+			pystr = PyString_FromString( (*it).first );
+			PyList_Append(pylist, pystr);
+			Py_DECREF( pystr );
+		}
+	}
+	return pylist;
+}
+
 /*
 PyObject*	CValue::PyMake(PyObject* ignored,PyObject* args)
 {

Modified: branches/apricot/source/gameengine/Expressions/Value.h
===================================================================
--- branches/apricot/source/gameengine/Expressions/Value.h	2008-06-26 12:39:06 UTC (rev 15359)
+++ branches/apricot/source/gameengine/Expressions/Value.h	2008-06-26 12:43:10 UTC (rev 15360)
@@ -253,6 +253,8 @@
 	virtual int				_delattr(const STR_String& attr);
 	virtual int				_setattr(const STR_String& attr,PyObject* value);
 	
+	virtual PyObject* ConvertKeysToPython( void );
+	
 	KX_PYMETHOD(CValue,GetName);
 
 #else

Modified: branches/apricot/source/gameengine/Ketsji/KX_GameObject.cpp
===================================================================
--- branches/apricot/source/gameengine/Ketsji/KX_GameObject.cpp	2008-06-26 12:39:06 UTC (rev 15359)
+++ branches/apricot/source/gameengine/Ketsji/KX_GameObject.cpp	2008-06-26 12:43:10 UTC (rev 15360)
@@ -803,6 +803,7 @@
 
 PyMethodDef KX_GameObject::Methods[] = {
 	{"setVisible",(PyCFunction) KX_GameObject::sPySetVisible, METH_VARARGS},  
+	{"getVisible",(PyCFunction) KX_GameObject::sPyGetVisible, METH_VARARGS},  
 	{"alignAxisToVect",(PyCFunction) KX_GameObject::sPyAlignAxisToVect, METH_VARARGS},
 	{"setPosition", (PyCFunction) KX_GameObject::sPySetPosition, METH_VARARGS},
 	{"getPosition", (PyCFunction) KX_GameObject::sPyGetPosition, METH_VARARGS},
@@ -823,6 +824,7 @@
 	{"removeParent", (PyCFunction)KX_GameObject::sPyRemoveParent,METH_VARARGS},
 	{"getMesh", (PyCFunction)KX_GameObject::sPyGetMesh,METH_VARARGS},
 	{"getPhysicsId", (PyCFunction)KX_GameObject::sPyGetPhysicsId,METH_VARARGS},
+	{"getPropertyNames", (PyCFunction)KX_GameObject::sPyGetPropertyNames,METH_VARARGS},
 	KX_PYMETHODTABLE(KX_GameObject, getDistanceTo),
 	KX_PYMETHODTABLE(KX_GameObject, rayCastTo),
 	KX_PYMETHODTABLE(KX_GameObject, rayCast),
@@ -1095,6 +1097,12 @@
 	
 }
 
+PyObject* KX_GameObject::PyGetVisible(PyObject* self,
+									  PyObject* args,
+									  PyObject* kwds)
+{
+	return PyInt_FromLong(m_bVisible);	
+}
 
 
 PyObject* KX_GameObject::PyGetVelocity(PyObject* self, 
@@ -1383,6 +1391,13 @@
 	return PyInt_FromLong((long)physid);
 }
 
+PyObject* KX_GameObject::PyGetPropertyNames(PyObject* self,
+											   PyObject* args,
+											   PyObject* kwds)
+{
+	return ConvertKeysToPython();
+}
+
 KX_PYMETHODDEF_DOC(KX_GameObject, getDistanceTo,
 "getDistanceTo(other): get distance to another point/KX_GameObject")
 {

Modified: branches/apricot/source/gameengine/Ketsji/KX_GameObject.h
===================================================================
--- branches/apricot/source/gameengine/Ketsji/KX_GameObject.h	2008-06-26 12:39:06 UTC (rev 15359)
+++ branches/apricot/source/gameengine/Ketsji/KX_GameObject.h	2008-06-26 12:43:10 UTC (rev 15360)
@@ -718,6 +718,7 @@
 	KX_PYMETHOD(KX_GameObject,GetReactionForce);
 	KX_PYMETHOD(KX_GameObject,GetOrientation);
 	KX_PYMETHOD(KX_GameObject,SetOrientation);
+	KX_PYMETHOD(KX_GameObject,GetVisible);
 	KX_PYMETHOD(KX_GameObject,SetVisible);
 	KX_PYMETHOD(KX_GameObject,AlignAxisToVect);
 	KX_PYMETHOD(KX_GameObject,SuspendDynamics);
@@ -731,9 +732,11 @@
 	KX_PYMETHOD(KX_GameObject,SetParent);
 	KX_PYMETHOD(KX_GameObject,RemoveParent);
 	KX_PYMETHOD(KX_GameObject,GetPhysicsId);
+	KX_PYMETHOD(KX_GameObject,GetPropertyNames);
 	KX_PYMETHOD_DOC(KX_GameObject,rayCastTo);
 	KX_PYMETHOD_DOC(KX_GameObject,rayCast);
 	KX_PYMETHOD_DOC(KX_GameObject,getDistanceTo);
+	
 private :
 
 	/**	

Modified: branches/apricot/source/gameengine/PyDoc/KX_GameObject.py
===================================================================
--- branches/apricot/source/gameengine/PyDoc/KX_GameObject.py	2008-06-26 12:39:06 UTC (rev 15359)
+++ branches/apricot/source/gameengine/PyDoc/KX_GameObject.py	2008-06-26 12:43:10 UTC (rev 15360)
@@ -25,7 +25,12 @@
 	@ivar timeOffset: adjust the slowparent delay at runtime.
 	@type timeOffset: float
 	"""
-	
+	def getVisible(visible):
+		"""
+		Gets the game object's visible flag.
+		
+		@type visible: boolean
+		"""	
 	def setVisible(visible):
 		"""
 		Sets the game object's visible flag.
@@ -176,6 +181,12 @@
 		"""
 		Returns the user data object associated with this game object's physics controller.
 		"""
+	def getPropertyNames():
+		"""
+		Gets a list of all property names.
+		@rtype: list
+		@return: All property names for this object.
+		"""
 	def getDistanceTo(other):
 		"""
 		Returns the distance to another object or point.
@@ -216,7 +227,7 @@
 		If is casted from/to object center or explicit [x,y,z] points.
 		The ray does not have X-Ray capability: the first object hit (other than self object) stops the ray
 		If a property was specified and the first object hit does not have that property, there is no hit
-		The	ray ignores collision-free objects
+		The	ray ignores collision-free objects and faces that dont have the collision flag enabled, you can however use ghost objects.
 
 		@param to: [x,y,z] or object to which the ray is casted
 		@type to: L{KX_GameObject} or 3-tuple





More information about the Bf-blender-cvs mailing list