diff options
author | Campbell Barton <ideasman42@gmail.com> | 2009-05-14 04:10:25 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2009-05-14 04:10:25 +0400 |
commit | 5f78efe19cdea2f508fff41a1723477489d7ac03 (patch) | |
tree | 47cc2fa81374e58aabce488c3837146ebf90499e /source/gameengine/Converter | |
parent | 240aa6d34d561ac6156eda50ece90130903a2df0 (diff) |
print warnings when python attributes and methods conflict with game properties.
Diffstat (limited to 'source/gameengine/Converter')
-rw-r--r-- | source/gameengine/Converter/KX_ConvertProperties.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source/gameengine/Converter/KX_ConvertProperties.cpp b/source/gameengine/Converter/KX_ConvertProperties.cpp index dfbc6f0c48d..e9984ee0525 100644 --- a/source/gameengine/Converter/KX_ConvertProperties.cpp +++ b/source/gameengine/Converter/KX_ConvertProperties.cpp @@ -129,6 +129,22 @@ void BL_ConvertProperties(Object* object,KX_GameObject* gameobj,SCA_TimeEventMan // 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; } |