[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [20191] trunk/blender/source/gameengine/ Converter/KX_ConvertProperties.cpp: print warnings when python attributes and methods conflict with game properties .
Campbell Barton
ideasman42 at gmail.com
Thu May 14 02:10:25 CEST 2009
Revision: 20191
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=20191
Author: campbellbarton
Date: 2009-05-14 02:10:25 +0200 (Thu, 14 May 2009)
Log Message:
-----------
print warnings when python attributes and methods conflict with game properties.
Modified Paths:
--------------
trunk/blender/source/gameengine/Converter/KX_ConvertProperties.cpp
Modified: trunk/blender/source/gameengine/Converter/KX_ConvertProperties.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/KX_ConvertProperties.cpp 2009-05-13 23:28:53 UTC (rev 20190)
+++ trunk/blender/source/gameengine/Converter/KX_ConvertProperties.cpp 2009-05-14 00:10:25 UTC (rev 20191)
@@ -129,6 +129,22 @@
// done with propval, release it
propval->Release();
}
+
+
+ /* Warn if we double up on attributes, this isnt quite right since it wont find inherited attributes however there arnt many */
+ for(PyAttributeDef *attrdef = KX_GameObject::Attributes; attrdef->m_name; attrdef++) {
+ if(strcmp(prop->name, attrdef->m_name)==0) {
+ printf("Warning! user defined property name \"%s\" is also a python attribute for object \"%s\"\n\tUse ob[\"%s\"] syntax to avoid conflict\n", prop->name, object->id.name+2, prop->name);
+ break;
+ }
+ }
+ for(PyMethodDef *methdef = KX_GameObject::Methods; methdef->ml_name; methdef++) {
+ if(strcmp(prop->name, methdef->ml_name)==0) {
+ printf("Warning! user defined property name \"%s\" is also a python method for object \"%s\"\n\tUse ob[\"%s\"] syntax to avoid conflict\n", prop->name, object->id.name+2, prop->name);
+ break;
+ }
+ }
+ /* end warning check */
prop = prop->next;
}
More information about the Bf-blender-cvs
mailing list