From be9e469ead227aee8d4c29b98a125cf599c5c8bb Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Fri, 1 Dec 2017 11:24:21 -0200 Subject: Groups and collection: initial integration Since we are ditching layers from Blender (2.8) we need a replacement to control groups visibility. This commit introduces collections as the building blocks for groups, allowing users to control visibility as well as overrides for groups. Features ======== * Groups now have collections This way you can change the visibility of a collection inside a group, and add overrides which are part of the group and are prioritized over other overrides. * Outliner Groups can inspect their collections, change visibility, and add/remove members. To change an override of a group collection, you need to select an instance of the group, and then you can choose "group" in the collection properties editor to edit this group active collection instead of the view layer one. * Dupli groups overrides We can now have multiple instances of the same group with an original "override" and different overrides depending on the collection the instanced object is part of. Technical ========= * Layers We use the same api for groups and scene as much as possible. Reviewers: sergey (depsgraph), mont29 (read/write and user count) Differential Revision: https://developer.blender.org/D2892 --- source/gameengine/Converter/BL_BlenderDataConversion.cpp | 6 +++--- source/gameengine/Ketsji/KX_Scene.cpp | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'source/gameengine') diff --git a/source/gameengine/Converter/BL_BlenderDataConversion.cpp b/source/gameengine/Converter/BL_BlenderDataConversion.cpp index ad9855586ee..acd425e788a 100644 --- a/source/gameengine/Converter/BL_BlenderDataConversion.cpp +++ b/source/gameengine/Converter/BL_BlenderDataConversion.cpp @@ -147,6 +147,7 @@ extern "C" { #include "BKE_customdata.h" #include "BKE_cdderivedmesh.h" #include "BKE_DerivedMesh.h" +#include "BKE_group.h" #include "BKE_layer.h" #include "BKE_material.h" /* give_current_material */ #include "BKE_image.h" @@ -2052,10 +2053,8 @@ void BL_ConvertBlenderObjects(struct Main* maggie, for (git=tempglist.begin(); git!=tempglist.end(); git++) { Group* group = *git; - GroupObject* go; - for (go=(GroupObject*)group->gobject.first; go; go=(GroupObject*)go->next) + FOREACH_GROUP_OBJECT(group, blenderobject) { - Object* blenderobject = go->ob; if (converter->FindGameObject(blenderobject) == NULL) { allblobj.insert(blenderobject); @@ -2090,6 +2089,7 @@ void BL_ConvertBlenderObjects(struct Main* maggie, } } } + FOREACH_GROUP_OBJECT_END } } } diff --git a/source/gameengine/Ketsji/KX_Scene.cpp b/source/gameengine/Ketsji/KX_Scene.cpp index b3061087344..48b50d24975 100644 --- a/source/gameengine/Ketsji/KX_Scene.cpp +++ b/source/gameengine/Ketsji/KX_Scene.cpp @@ -105,6 +105,7 @@ #include "KX_Light.h" +#include "BKE_group.h" #include "BLI_task.h" static void *KX_SceneReplicationFunc(SG_IObject* node,void* gameobj,void* scene) @@ -720,7 +721,6 @@ void KX_Scene::DupliGroupRecurse(CValue* obj, int level) KX_GameObject* gameobj; Object* blgroupobj = groupobj->GetBlenderObject(); Group* group; - GroupObject *go; vector duplilist; if (!groupobj->GetSGNode() || @@ -738,9 +738,9 @@ void KX_Scene::DupliGroupRecurse(CValue* obj, int level) m_groupGameObjects.clear(); group = blgroupobj->dup_group; - for (go=(GroupObject*)group->gobject.first; go; go=(GroupObject*)go->next) + FOREACH_GROUP_BASE(group, base) { - Object* blenderobj = go->ob; + Object *blenderobj = base->object; if (blgroupobj == blenderobj) // this check is also in group_duplilist() continue; @@ -755,13 +755,13 @@ void KX_Scene::DupliGroupRecurse(CValue* obj, int level) gameobj->SetBlenderGroupObject(blgroupobj); - if ((blenderobj->lay & group->layer)==0) - { + if ((base->flag & BASE_VISIBLED) == 0) { // object is not visible in the 3D view, will not be instantiated continue; } m_groupGameObjects.insert(gameobj); } + FOREACH_GROUP_BASE_END set::iterator oit; for (oit=m_groupGameObjects.begin(); oit != m_groupGameObjects.end(); oit++) -- cgit v1.2.3