[Bf-blender-cvs] [3e5332b] master: BGE: fixed nomenclature of KX_Scene::addObject and KX_Scene::AddReplicaObject
Sybren A. Stüvel
noreply at git.blender.org
Mon Apr 6 17:13:25 CEST 2015
Commit: 3e5332bb959c686cb5bc5b6007d96088d5d1bc23
Author: Sybren A. Stüvel
Date: Mon Apr 6 17:11:36 2015 +0200
Branches: master
https://developer.blender.org/rB3e5332bb959c686cb5bc5b6007d96088d5d1bc23
BGE: fixed nomenclature of KX_Scene::addObject and KX_Scene::AddReplicaObject
KX_Scene::addObject: Changed the parameter "other" to "reference", as "other" doesn't mean anything.
KX_Scene::AddReplicaObject: Changed the parameter "parentobject" to "referenceobject", as the parameter did NOT contain a parent object in any way.
Now both functions use the same kind of name for the same thing.
Thanks to panzergame / Porteries Tristan.
===================================================================
M doc/python_api/rst/bge_types/bge.types.KX_Scene.rst
M source/gameengine/Ketsji/KX_Scene.cpp
===================================================================
diff --git a/doc/python_api/rst/bge_types/bge.types.KX_Scene.rst b/doc/python_api/rst/bge_types/bge.types.KX_Scene.rst
index 255ff95..a613505 100644
--- a/doc/python_api/rst/bge_types/bge.types.KX_Scene.rst
+++ b/doc/python_api/rst/bge_types/bge.types.KX_Scene.rst
@@ -131,14 +131,14 @@ base class --- :class:`PyObjectPlus`
:type: Vector((gx, gy, gz))
- .. method:: addObject(object, other, time=0)
+ .. method:: addObject(object, reference, time=0)
Adds an object to the scene like the Add Object Actuator would.
- :arg object: The object to add
+ :arg object: The (name of the) object to add.
:type object: :class:`KX_GameObject` or string
- :arg other: The object's center to use when adding the object
- :type other: :class:`KX_GameObject` or string
+ :arg reference: The (name of the) object which position, orientation, and scale to copy.
+ :type reference: :class:`KX_GameObject` or string
:arg time: The lifetime of the added object, in frames. A time of 0 means the object will last forever.
:type time: integer
:return: The newly added object.
diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp
index 193a72e..fc61d2b 100644
--- a/source/gameengine/Ketsji/KX_Scene.cpp
+++ b/source/gameengine/Ketsji/KX_Scene.cpp
@@ -869,7 +869,7 @@ void KX_Scene::DupliGroupRecurse(CValue* obj, int level)
SCA_IObject* KX_Scene::AddReplicaObject(class CValue* originalobject,
- class CValue* parentobject,
+ class CValue* referenceobject,
int lifespan)
{
@@ -878,7 +878,7 @@ SCA_IObject* KX_Scene::AddReplicaObject(class CValue* originalobject,
m_groupGameObjects.clear();
KX_GameObject* originalobj = (KX_GameObject*) originalobject;
- KX_GameObject* parentobj = (KX_GameObject*) parentobject;
+ KX_GameObject* referenceobj = (KX_GameObject*) referenceobject;
m_ueberExecutionPriority++;
@@ -916,14 +916,14 @@ SCA_IObject* KX_Scene::AddReplicaObject(class CValue* originalobject,
// At this stage all the objects in the hierarchy have been duplicated,
// we can update the scenegraph, we need it for the duplication of logic
- MT_Point3 newpos = ((KX_GameObject*) parentobject)->NodeGetWorldPosition();
+ MT_Point3 newpos = referenceobj->NodeGetWorldPosition();
replica->NodeSetLocalPosition(newpos);
- MT_Matrix3x3 newori = ((KX_GameObject*) parentobject)->NodeGetWorldOrientation();
+ MT_Matrix3x3 newori = referenceobj->NodeGetWorldOrientation();
replica->NodeSetLocalOrientation(newori);
// get the rootnode's scale
- MT_Vector3 newscale = parentobj->GetSGNode()->GetRootSGParent()->GetLocalScale();
+ MT_Vector3 newscale = referenceobj->GetSGNode()->GetRootSGParent()->GetLocalScale();
// set the replica's relative scale with the rootnode's scale
replica->NodeSetRelativeScale(newscale);
@@ -946,12 +946,12 @@ SCA_IObject* KX_Scene::AddReplicaObject(class CValue* originalobject,
// this will also relink the actuators in the hierarchy
(*git)->Relink(&m_map_gameobject_to_replica);
// add the object in the layer of the parent
- (*git)->SetLayer(parentobj->GetLayer());
+ (*git)->SetLayer(referenceobj->GetLayer());
// If the object was a light, we need to update it's RAS_LightObject as well
if ((*git)->GetGameObjectType()==SCA_IObject::OBJ_LIGHT)
{
KX_LightObject* lightobj = static_cast<KX_LightObject*>(*git);
- lightobj->SetLayer(parentobj->GetLayer());
+ lightobj->SetLayer(referenceobj->GetLayer());
}
}
More information about the Bf-blender-cvs
mailing list