Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Bolsee <benoit.bolsee@online.be>2008-07-18 23:56:56 +0400
committerBenoit Bolsee <benoit.bolsee@online.be>2008-07-18 23:56:56 +0400
commit5e2ee191877d1073a20da32c52d9e97cfab8f5c8 (patch)
treea9e07ed9c74ea52334f2059e2511a15f84888776 /source/gameengine/Ketsji/KX_Scene.h
parenta397b4b82fb9c658bb9e034e96692b9e5af5819a (diff)
BGE patch: support for partial hierarchy in dupligroup instantiation; removal of links that point to inactive objects during group instantiation.
This situation corresponds to a group containing only a portion of a parent hierarchy (the Apricot team needed that to avoid logic duplication). The BGE will instantiate only the children that are in the group so that it follows the 3D view more closely. As a result, the logic links to the objects in the portion of the hierarchy that was not replicated will point to inactive objects (if the groups are stored in inactive layers as they should be). To keep the logic system consistent, these links are automatically removed. This last part of the patch is a general fix that could go in 2.47 but as this situation does not normally occurs in pre-2.47 games, it is not needed.
Diffstat (limited to 'source/gameengine/Ketsji/KX_Scene.h')
-rw-r--r--source/gameengine/Ketsji/KX_Scene.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/gameengine/Ketsji/KX_Scene.h b/source/gameengine/Ketsji/KX_Scene.h
index 374545f9a90..80a2abe287a 100644
--- a/source/gameengine/Ketsji/KX_Scene.h
+++ b/source/gameengine/Ketsji/KX_Scene.h
@@ -216,6 +216,16 @@ protected:
*/
std::vector<KX_GameObject*> m_logicHierarchicalGameObjects;
+ /**
+ * This temporary variable will contain the list of
+ * object that can be added during group instantiation.
+ * objects outside this list will not be added (can
+ * happen with children that are outside the group).
+ * Used in AddReplicaObject. If the list is empty, it
+ * means don't care.
+ */
+ std::set<CValue*> m_groupGameObjects;
+
/**
* Pointer to system variable passed in in constructor
* only used in constructor so we do not need to keep it
@@ -292,6 +302,11 @@ public:
*/
void UpdateParents(double curtime);
void DupliGroupRecurse(CValue* gameobj, int level);
+ bool IsObjectInGroup(CValue* gameobj)
+ {
+ return (m_groupGameObjects.empty() ||
+ m_groupGameObjects.find(gameobj) != m_groupGameObjects.end());
+ }
SCA_IObject* AddReplicaObject(CValue* gameobj,
CValue* locationobj,
int lifespan=0);