[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [24741] trunk/blender/source/gameengine: BGE: Removing OB prefix from object names - This will break scripts !!!! ( also removing AC and ME :: internal changes only)
Dalai Felinto
dfelinto at gmail.com
Sun Nov 22 01:01:53 CET 2009
Revision: 24741
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=24741
Author: dfelinto
Date: 2009-11-22 01:01:52 +0100 (Sun, 22 Nov 2009)
Log Message:
-----------
BGE: Removing OB prefix from object names - This will break scripts !!!! (also removing AC and ME :: internal changes only)
How it works now:
whenever you have to read/write object names you can do it without the prefix "OB". (it's not hard at all to fix scripts)
How it was before:
It was a mess :)
We had an inconsistent API where sometimes you had to input "OBname" and other "name" directly to assign object as data (usually in actuators).
Justification for the change:
Talking with Campbell we had since a while ago this feeling that this should be changed any time we were going to deprecate the API. So in order to deliver Blender 2.5beta0 with a more close-to-the-final API we decided that today was a good day to implement that.
Remaining issues:
1) VideoTexture uses IM or MA to identify the output material/texture. I haven't touched that, but it does look a bit off. (i.e. I didn't changed any MA, IM naming)
2) I didn't see the code of dynamic mesh. It may need to be edited as well.
Modified Paths:
--------------
trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp
trunk/blender/source/gameengine/Converter/KX_ConvertActuators.cpp
trunk/blender/source/gameengine/Converter/KX_IpoConvert.cpp
trunk/blender/source/gameengine/GameLogic/SCA_LogicManager.cpp
trunk/blender/source/gameengine/PyDoc/GameTypes.py
Modified: trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp 2009-11-21 23:55:14 UTC (rev 24740)
+++ trunk/blender/source/gameengine/Converter/BL_BlenderDataConversion.cpp 2009-11-22 00:01:52 UTC (rev 24741)
@@ -774,7 +774,7 @@
}
}
- meshobj->SetName(mesh->id.name);
+ meshobj->SetName(mesh->id.name + 2);
meshobj->m_sharedvertex_map.resize(totvert);
RAS_IPolyMaterial* polymat = NULL;
STR_String imastr;
@@ -1977,7 +1977,7 @@
bAction *curAct;
for (curAct = (bAction*)maggie->action.first; curAct; curAct=(bAction*)curAct->id.next)
{
- logicmgr->RegisterActionName(curAct->id.name, curAct);
+ logicmgr->RegisterActionName(curAct->id.name + 2, curAct);
}
SetDefaultFaceType(blenderscene);
@@ -2053,9 +2053,8 @@
BL_ConvertProperties(blenderobject,gameobj,timemgr,kxscene,isInActiveLayer);
+ gameobj->SetName(blenderobject->id.name + 2);
- gameobj->SetName(blenderobject->id.name);
-
// update children/parent hierarchy
if ((blenderobject->parent != 0)&&(!converter->addInitFromFrame))
{
@@ -2245,7 +2244,7 @@
BL_ConvertProperties(blenderobject,gameobj,timemgr,kxscene,isInActiveLayer);
- gameobj->SetName(blenderobject->id.name);
+ gameobj->SetName(blenderobject->id.name + 2);
// update children/parent hierarchy
if ((blenderobject->parent != 0)&&(!converter->addInitFromFrame))
Modified: trunk/blender/source/gameengine/Converter/KX_ConvertActuators.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/KX_ConvertActuators.cpp 2009-11-21 23:55:14 UTC (rev 24740)
+++ trunk/blender/source/gameengine/Converter/KX_ConvertActuators.cpp 2009-11-22 00:01:52 UTC (rev 24741)
@@ -304,9 +304,6 @@
STR_String toPropName = (msgAct->toPropName
? (char*) msgAct->toPropName
: "");
- /* BGE Wants "OB" prefix */
- if (toPropName != "")
- toPropName = "OB" + toPropName;
/**
* Get the Message Subject to send.
Modified: trunk/blender/source/gameengine/Converter/KX_IpoConvert.cpp
===================================================================
--- trunk/blender/source/gameengine/Converter/KX_IpoConvert.cpp 2009-11-21 23:55:14 UTC (rev 24740)
+++ trunk/blender/source/gameengine/Converter/KX_IpoConvert.cpp 2009-11-22 00:01:52 UTC (rev 24741)
@@ -475,7 +475,7 @@
Material *mat = give_current_material(blenderobject, material_index);
STR_HashedString matname;
if(mat) {
- matname= mat->id.name;
+ matname= mat->id.name; // who is using this name? can we remove the MA here?
ConvertMaterialIpos(mat, matname.hash(), gameobj, converter);
}
}
Modified: trunk/blender/source/gameengine/GameLogic/SCA_LogicManager.cpp
===================================================================
--- trunk/blender/source/gameengine/GameLogic/SCA_LogicManager.cpp 2009-11-21 23:55:14 UTC (rev 24740)
+++ trunk/blender/source/gameengine/GameLogic/SCA_LogicManager.cpp 2009-11-22 00:01:52 UTC (rev 24741)
@@ -119,7 +119,7 @@
CValue* SCA_LogicManager::GetGameObjectByName(const STR_String& gameobjname)
{
- STR_HashedString mn = "OB"+gameobjname;
+ STR_HashedString mn = gameobjname;
CValue** gameptr = m_mapStringToGameObjects[mn];
if (gameptr)
@@ -252,7 +252,7 @@
void* SCA_LogicManager::GetActionByName (const STR_String& actname)
{
- STR_HashedString an = "AC"+actname;
+ STR_HashedString an = actname;
void** actptr = m_mapStringToActions[an];
if (actptr)
@@ -265,7 +265,7 @@
void* SCA_LogicManager::GetMeshByName(const STR_String& meshname)
{
- STR_HashedString mn = "ME"+meshname;
+ STR_HashedString mn = meshname;
void** meshptr = m_mapStringToMeshes[mn];
if (meshptr)
Modified: trunk/blender/source/gameengine/PyDoc/GameTypes.py
===================================================================
--- trunk/blender/source/gameengine/PyDoc/GameTypes.py 2009-11-21 23:55:14 UTC (rev 24740)
+++ trunk/blender/source/gameengine/PyDoc/GameTypes.py 2009-11-22 00:01:52 UTC (rev 24741)
@@ -991,7 +991,7 @@
C{val= clist[i]}
CListValue supports string lookups.
- C{val= scene.objects["OBCube"]}
+ C{val= scene.objects["Cube"]}
Other operations such as C{len(clist), list(clist), clist[0:10]} are also supported.
"""
@@ -1504,7 +1504,6 @@
- note: Calling ANY method or attribute on an object that has been removed from a scene will raise a SystemError, if an object may have been removed since last accessing it use the L{invalid} attribute to check.
@ivar name: The object's name. (read-only)
- - note: Currently (Blender 2.49) the prefix "OB" is added to all objects name. This may change in blender 2.5.
@type name: string.
@ivar mass: The object's mass
- note: The object must have a physics controller for the mass to be applied, otherwise the mass value will be returned as 0.0
@@ -3543,7 +3542,7 @@
This will genereate a warning in the console:
- C{ERROR: GameObject I{OBName} has a AddObjectActuator I{ActuatorName} without object (in 'nonactive' layer)}
+ C{ERROR: GameObject I{Name} has a AddObjectActuator I{ActuatorName} without object (in 'nonactive' layer)}
"""
#{Deprecated
def setObject(object):
@@ -3729,7 +3728,7 @@
This will generate a warning in the console:
- C{ERROR: GameObject I{OBName} ReplaceMeshActuator I{ActuatorName} without object}
+ C{ERROR: GameObject I{Name} ReplaceMeshActuator I{ActuatorName} without object}
@ivar mesh: L{KX_MeshProxy} or the name of the mesh that will replace the current one
Set to None to disable actuator
@@ -3782,7 +3781,7 @@
print obj.name
# get an object named 'Cube'
- obj = scene.objects["OBCube"]
+ obj = scene.objects["Cube"]
# get the first object in the scene.
obj = scene.objects[0]
@@ -3874,7 +3873,7 @@
This will generate a warning in the console:
- C{ERROR: GameObject I{OBName} has a SceneActuator I{ActuatorName} (SetScene) without scene}
+ C{ERROR: GameObject I{Name} has a SceneActuator I{ActuatorName} (SetScene) without scene}
@ivar scene: the name of the scene to change to/overlay/underlay/remove/suspend/resume
@type scene: string.
@@ -4181,7 +4180,7 @@
This will generate a warning in the console:
- C{ERROR: GameObject I{OBName} no object in EditObjectActuator I{ActuatorName}}
+ C{ERROR: GameObject I{Name} no object in EditObjectActuator I{ActuatorName}}
@ivar object: the object this actuator tracks.
@type object: KX_GameObject or None
More information about the Bf-blender-cvs
mailing list