Skip to content

Commit

Permalink
UPBGE: Remove blender group object in KX_GameObject.
Browse files Browse the repository at this point in the history
The blender group object member in KX_GameObject (m_blenderGroupObject)
was a redundant information has it is similar to
m_dupliGroupObject->GetBlenderObject().

This member is removed and its usage is replaced by calling function
GetBlenderObject of the dupli game object.
  • Loading branch information
panzergame committed Dec 10, 2017
1 parent a82e220 commit 71dcfe6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 25 deletions.
1 change: 0 additions & 1 deletion source/gameengine/Ketsji/KX_GameObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ KX_GameObject::KX_GameObject(
m_currentLodLevel(0),
m_meshUser(nullptr),
m_blenderObject(nullptr),
m_blenderGroupObject(nullptr),
m_bIsNegativeScaling(false),
m_objectColor(mt::one4),
m_bVisible(true),
Expand Down
11 changes: 0 additions & 11 deletions source/gameengine/Ketsji/KX_GameObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ class KX_GameObject : public SCA_IObject, public mt::SimdClassAllocator
short m_currentLodLevel;
RAS_MeshUser *m_meshUser;
struct Object* m_blenderObject;
struct Object* m_blenderGroupObject;

bool m_bIsNegativeScaling;
mt::vec4 m_objectColor;
Expand Down Expand Up @@ -548,16 +547,6 @@ class KX_GameObject : public SCA_IObject, public mt::SimdClassAllocator
m_blenderObject = obj;
}

struct Object* GetBlenderGroupObject( )
{
return m_blenderGroupObject;
}

void SetBlenderGroupObject(struct Object* obj)
{
m_blenderGroupObject = obj;
}

bool IsDupliGroup()
{
return (m_blenderObject &&
Expand Down
20 changes: 8 additions & 12 deletions source/gameengine/Ketsji/KX_Scene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -716,8 +716,6 @@ void KX_Scene::DupliGroupRecurse(KX_GameObject *groupobj, int level)
continue;
}

gameobj->SetBlenderGroupObject(blgroupobj);

if ((blenderobj->lay & group->layer) == 0) {
// Object is not visible in the 3D view, will not be instantiated.
continue;
Expand All @@ -739,8 +737,15 @@ void KX_Scene::DupliGroupRecurse(KX_GameObject *groupobj, int level)
// Add to 'rootparent' list (this is the list of top hierarchy objects, updated each frame).
m_parentlist->Add(CM_AddRef(replica));

/* Set references for dupli-group
* groupobj holds a list of all objects, that belongs to this group. */
groupobj->AddInstanceObjects(replica);

// Every object gets the reference to its dupli-group object.
replica->SetDupliGroupObject(groupobj);

// Recurse replication into children nodes.
const NodeList children = gameobj->GetSGNode()->GetSGChildren();
const NodeList& children = gameobj->GetSGNode()->GetSGChildren();

replica->GetSGNode()->ClearSGChildren();
for (SG_Node *orgnode : children) {
Expand Down Expand Up @@ -808,15 +813,6 @@ void KX_Scene::DupliGroupRecurse(KX_GameObject *groupobj, int level)
// Can't instantiate group immediately as it destroys m_logicHierarchicalGameObjects.
duplilist.push_back(gameobj);
}

if (gameobj->GetBlenderGroupObject() == blgroupobj) {
/* Set references for dupli-group
* groupobj holds a list of all objects, that belongs to this group. */
groupobj->AddInstanceObjects(gameobj);

// Every object gets the reference to its dupli-group object.
gameobj->SetDupliGroupObject(groupobj);
}
}

for (KX_GameObject *gameobj : duplilist) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ GPULamp *RAS_OpenGLLight::GetGPULamp()
{
KX_LightObject *kxlight = (KX_LightObject *)m_light;

return GPU_lamp_from_blender(kxlight->GetScene()->GetBlenderScene(), kxlight->GetBlenderObject(), kxlight->GetBlenderGroupObject());
KX_GameObject *groupObj = kxlight->GetDupliGroupObject();
Object *blenderGroup = groupObj ? groupObj->GetBlenderObject() : nullptr;
return GPU_lamp_from_blender(kxlight->GetScene()->GetBlenderScene(), kxlight->GetBlenderObject(), blenderGroup);
}

bool RAS_OpenGLLight::HasShadowBuffer()
Expand Down

0 comments on commit 71dcfe6

Please sign in to comment.