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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2018-04-30 16:57:22 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2018-05-18 14:34:24 +0300
commit17bd5c9d4b1e9377b896c13043e24eaa7e979714 (patch)
tree60ca4e4118c01d88ccc04919d4f7ed46014875c1 /source/blender/makesrna
parent70aec3732d0f03138d6477fd04c81dfd9fd21256 (diff)
Collections and groups unification
OVERVIEW * In 2.7 terminology, all layers and groups are now collection datablocks. * These collections are nestable, linkable, instanceable, overrideable, .. which opens up new ways to set up scenes and link + override data. * Viewport/render visibility and selectability are now a part of the collection and shared across all view layers and linkable. * View layers define which subset of the scene collection hierarchy is excluded for each. For many workflows one view layer can be used, these are more of an advanced feature now. OUTLINER * The outliner now has a "View Layer" display mode instead of "Collections", which can display the collections and/or objects in the view layer. * In this display mode, collections can be excluded with the right click menu. These will then be greyed out and their objects will be excluded. * To view collections not linked to any scene, the "Blender File" display mode can be used, with the new filtering option to just see Colleciton datablocks. * The outliner right click menus for collections and objects were reorganized. * Drag and drop still needs to be improved. Like before, dragging the icon or text gives different results, we'll unify this later. LINKING AND OVERRIDES * Collections can now be linked into the scene without creating an instance, with the link/append operator or from the collections view in the outliner. * Collections can get static overrides with the right click menu in the outliner, but this is rather unreliable and not clearly communicated at the moment. * We still need to improve the make override operator to turn collection instances into collections with overrides directly in the scene. PERFORMANCE * We tried to make performance not worse than before and improve it in some cases. The main thing that's still a bit slower is multiple scenes, we have to change the layer syncing to only updated affected scenes. * Collections keep a list of their parent collections for faster incremental updates in syncing and caching. * View layer bases are now in a object -> base hash to avoid quadratic time lookups internally and in API functions like visible_get(). VERSIONING * Compatibility with 2.7 files should be improved due to the new visibility controls. Of course users may not want to set up their scenes differently now to avoid having separate layers and groups. * Compatibility with 2.8 is mostly there, and was tested on Eevee demo and Hero files. There's a few things which are know to be not quite compatible, like nested layer collections inside groups. * The versioning code for 2.8 files is quite complicated, and isolated behind #ifdef so it can be removed at the end of the release cycle. KNOWN ISSUES * The G-key group operators in the 3D viewport were left mostly as is, they need to be modified still to fit better. * Same for the groups panel in the object properties. This needs to be updated still, or perhaps replaced by something better. * Collections must all have a unique name. Less restrictive namespacing is to be done later, we'll have to see how important this is as all objects within the collections must also have a unique name anyway. * Full scene copy and delete scene are exactly doing the right thing yet. Differential Revision: https://developer.blender.org/D3383 https://code.blender.org/2018/05/collections-and-groups/
Diffstat (limited to 'source/blender/makesrna')
-rw-r--r--source/blender/makesrna/RNA_access.h4
-rw-r--r--source/blender/makesrna/RNA_enum_types.h7
-rw-r--r--source/blender/makesrna/intern/makesrna.c30
-rw-r--r--source/blender/makesrna/intern/rna_ID.c6
-rw-r--r--source/blender/makesrna/intern/rna_action.c12
-rw-r--r--source/blender/makesrna/intern/rna_context.c11
-rw-r--r--source/blender/makesrna/intern/rna_dynamicpaint.c4
-rw-r--r--source/blender/makesrna/intern/rna_group.c208
-rw-r--r--source/blender/makesrna/intern/rna_internal.h4
-rw-r--r--source/blender/makesrna/intern/rna_layer.c600
-rw-r--r--source/blender/makesrna/intern/rna_lightprobe.c3
-rw-r--r--source/blender/makesrna/intern/rna_main.c6
-rw-r--r--source/blender/makesrna/intern/rna_main_api.c40
-rw-r--r--source/blender/makesrna/intern/rna_object.c19
-rw-r--r--source/blender/makesrna/intern/rna_object_force.c6
-rw-r--r--source/blender/makesrna/intern/rna_particle.c7
-rw-r--r--source/blender/makesrna/intern/rna_rigidbody.c10
-rw-r--r--source/blender/makesrna/intern/rna_scene.c22
-rw-r--r--source/blender/makesrna/intern/rna_smoke.c12
-rw-r--r--source/blender/makesrna/intern/rna_space.c33
20 files changed, 309 insertions, 735 deletions
diff --git a/source/blender/makesrna/RNA_access.h b/source/blender/makesrna/RNA_access.h
index 0461389ce21..4744b2e33df 100644
--- a/source/blender/makesrna/RNA_access.h
+++ b/source/blender/makesrna/RNA_access.h
@@ -109,6 +109,7 @@ extern StructRNA RNA_ClothCollisionSettings;
extern StructRNA RNA_ClothModifier;
extern StructRNA RNA_ClothSettings;
extern StructRNA RNA_CloudsTexture;
+extern StructRNA RNA_Collection;
extern StructRNA RNA_CollectionEngineSettings;
extern StructRNA RNA_CollectionProperty;
extern StructRNA RNA_CollisionModifier;
@@ -279,7 +280,6 @@ extern StructRNA RNA_GPencilSculptBrush;
extern StructRNA RNA_GaussianBlurSequence;
extern StructRNA RNA_GlowSequence;
extern StructRNA RNA_GreasePencil;
-extern StructRNA RNA_Group;
extern StructRNA RNA_Header;
extern StructRNA RNA_HemiLamp;
extern StructRNA RNA_Histogram;
@@ -504,9 +504,9 @@ extern StructRNA RNA_RigidBodyJointConstraint;
extern StructRNA RNA_SPHFluidSettings;
extern StructRNA RNA_Scene;
extern StructRNA RNA_SceneEEVEE;
+extern StructRNA RNA_SceneObjects;
extern StructRNA RNA_SceneRenderLayer;
extern StructRNA RNA_SceneSequence;
-extern StructRNA RNA_SceneObjects;
extern StructRNA RNA_Scopes;
extern StructRNA RNA_Screen;
extern StructRNA RNA_ScrewModifier;
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index 6ebdb845b03..bb09fe585ba 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -63,9 +63,6 @@ extern const EnumPropertyItem rna_enum_constraint_type_items[];
extern const EnumPropertyItem rna_enum_boidrule_type_items[];
extern const EnumPropertyItem rna_enum_sequence_modifier_type_items[];
-extern const EnumPropertyItem rna_enum_collection_type_items[];
-extern const EnumPropertyItem rna_enum_layer_collection_mode_settings_type_items[];
-
extern const EnumPropertyItem rna_enum_modifier_triangulate_quad_method_items[];
extern const EnumPropertyItem rna_enum_modifier_triangulate_ngon_method_items[];
@@ -236,8 +233,8 @@ const EnumPropertyItem *rna_Actuator_type_itemf(struct bContext *C, struct Point
* in the linked list can add more for different types as needed */
const EnumPropertyItem *RNA_action_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free);
// EnumPropertyItem *RNA_action_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free);
-const EnumPropertyItem *RNA_group_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free);
-const EnumPropertyItem *RNA_group_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free);
+const EnumPropertyItem *RNA_collection_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free);
+const EnumPropertyItem *RNA_collection_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free);
const EnumPropertyItem *RNA_image_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free);
const EnumPropertyItem *RNA_image_local_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free);
const EnumPropertyItem *RNA_scene_itemf(struct bContext *C, struct PointerRNA *ptr, struct PropertyRNA *prop, bool *r_free);
diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c
index 4daf8b6a965..183db621642 100644
--- a/source/blender/makesrna/intern/makesrna.c
+++ b/source/blender/makesrna/intern/makesrna.c
@@ -905,7 +905,7 @@ static char *rna_def_property_set_func(FILE *f, StructRNA *srna, PropertyRNA *pr
}
else {
PointerPropertyRNA *pprop = (PointerPropertyRNA *)dp->prop;
- StructRNA *type = rna_find_struct((const char *)pprop->type);
+ StructRNA *type = (pprop->type) ? rna_find_struct((const char *)pprop->type) : NULL;
if (type && (type->flag & STRUCT_ID)) {
fprintf(f, " if (value.data)\n");
fprintf(f, " id_lib_extern((ID *)value.data);\n\n");
@@ -2458,12 +2458,24 @@ static void rna_auto_types(void)
for (ds = DefRNA.structs.first; ds; ds = ds->cont.next) {
/* DNA name for Screen is patched in 2.5, we do the reverse here .. */
- if (ds->dnaname && STREQ(ds->dnaname, "Screen"))
- ds->dnaname = "bScreen";
+ if (ds->dnaname) {
+ if (STREQ(ds->dnaname, "Screen"))
+ ds->dnaname = "bScreen";
+ if (STREQ(ds->dnaname, "Group"))
+ ds->dnaname = "Collection";
+ if (STREQ(ds->dnaname, "GroupObject"))
+ ds->dnaname = "CollectionObject";
+ }
for (dp = ds->cont.properties.first; dp; dp = dp->next) {
- if (dp->dnastructname && STREQ(dp->dnastructname, "Screen"))
- dp->dnastructname = "bScreen";
+ if (dp->dnastructname) {
+ if (STREQ(dp->dnastructname, "Screen"))
+ dp->dnastructname = "bScreen";
+ if (STREQ(dp->dnastructname, "Group"))
+ dp->dnastructname = "Collection";
+ if (STREQ(dp->dnastructname, "GroupObject"))
+ dp->dnastructname = "CollectionObject";
+ }
if (dp->dnatype) {
if (dp->prop->type == PROP_POINTER) {
@@ -3368,7 +3380,7 @@ static RNAProcessItem PROCESS_ITEMS[] = {
{"rna_fcurve.c", "rna_fcurve_api.c", RNA_def_fcurve},
{"rna_fluidsim.c", NULL, RNA_def_fluidsim},
{"rna_gpencil.c", NULL, RNA_def_gpencil},
- {"rna_group.c", NULL, RNA_def_group},
+ {"rna_group.c", NULL, RNA_def_collections},
{"rna_image.c", "rna_image_api.c", RNA_def_image},
{"rna_key.c", NULL, RNA_def_key},
{"rna_lamp.c", NULL, RNA_def_lamp},
@@ -3726,7 +3738,7 @@ static const char *cpp_classes = ""
" COLLECTION_PROPERTY_LENGTH_##has_length(sname, identifier) \\\n"
" COLLECTION_PROPERTY_LOOKUP_INT_##has_lookup_int(sname, identifier) \\\n"
" COLLECTION_PROPERTY_LOOKUP_STRING_##has_lookup_string(sname, identifier) \\\n"
-" Collection<sname, type, sname##_##identifier##_begin, \\\n"
+" CollectionRef<sname, type, sname##_##identifier##_begin, \\\n"
" sname##_##identifier##_next, sname##_##identifier##_end, \\\n"
" sname##_##identifier##_length_wrap, \\\n"
" sname##_##identifier##_lookup_int_wrap, sname##_##identifier##_lookup_string_wrap, collection_funcs> identifier;\n"
@@ -3823,9 +3835,9 @@ static const char *cpp_classes = ""
"template<typename Tp, typename T, TBeginFunc Tbegin, TNextFunc Tnext, TEndFunc Tend,\n"
" TLengthFunc Tlength, TLookupIntFunc Tlookup_int, TLookupStringFunc Tlookup_string,\n"
" typename Tcollection_funcs>\n"
-"class Collection : public Tcollection_funcs {\n"
+"class CollectionRef : public Tcollection_funcs {\n"
"public:\n"
-" Collection(const PointerRNA &p) : Tcollection_funcs(p), ptr(p) {}\n"
+" CollectionRef(const PointerRNA &p) : Tcollection_funcs(p), ptr(p) {}\n"
"\n"
" void begin(CollectionIterator<T, Tbegin, Tnext, Tend>& iter)\n"
" { iter.begin(ptr); }\n"
diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c
index 5143a39db92..952d27fa18d 100644
--- a/source/blender/makesrna/intern/rna_ID.c
+++ b/source/blender/makesrna/intern/rna_ID.c
@@ -58,7 +58,7 @@ const EnumPropertyItem rna_enum_id_type_items[] = {
{ID_CU, "CURVE", ICON_CURVE_DATA, "Curve", ""},
{ID_VF, "FONT", ICON_FONT_DATA, "Font", ""},
{ID_GD, "GREASEPENCIL", ICON_GREASEPENCIL, "Grease Pencil", ""},
- {ID_GR, "GROUP", ICON_GROUP, "Group", ""},
+ {ID_GR, "COLLECTION", ICON_GROUP, "Collection", ""},
{ID_IM, "IMAGE", ICON_IMAGE_DATA, "Image", ""},
{ID_KE, "KEY", ICON_SHAPEKEY_DATA, "Key", ""},
{ID_LA, "LAMP", ICON_LAMP_DATA, "Lamp", ""},
@@ -179,7 +179,7 @@ short RNA_type_to_ID_code(const StructRNA *type)
if (base_type == &RNA_Camera) return ID_CA;
if (base_type == &RNA_Curve) return ID_CU;
if (base_type == &RNA_GreasePencil) return ID_GD;
- if (base_type == &RNA_Group) return ID_GR;
+ if (base_type == &RNA_Collection) return ID_GR;
if (base_type == &RNA_Image) return ID_IM;
if (base_type == &RNA_Key) return ID_KE;
if (base_type == &RNA_Lamp) return ID_LA;
@@ -223,7 +223,7 @@ StructRNA *ID_code_to_RNA_type(short idcode)
case ID_CF: return &RNA_CacheFile;
case ID_CU: return &RNA_Curve;
case ID_GD: return &RNA_GreasePencil;
- case ID_GR: return &RNA_Group;
+ case ID_GR: return &RNA_Collection;
case ID_IM: return &RNA_Image;
case ID_KE: return &RNA_Key;
case ID_LA: return &RNA_Lamp;
diff --git a/source/blender/makesrna/intern/rna_action.c b/source/blender/makesrna/intern/rna_action.c
index d398ce95a52..b06038a50e4 100644
--- a/source/blender/makesrna/intern/rna_action.c
+++ b/source/blender/makesrna/intern/rna_action.c
@@ -325,18 +325,18 @@ static void rna_def_dopesheet(BlenderRNA *brna)
RNA_def_property_ui_icon(prop, ICON_HELP, 0); /* XXX: this doesn't quite fit */
RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
- /* Object Group Filtering Settings */
- prop = RNA_def_property(srna, "show_only_group_objects", PROP_BOOLEAN, PROP_NONE);
+ /* Object Collection Filtering Settings */
+ prop = RNA_def_property(srna, "show_only_collection_objects", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "filterflag", ADS_FILTER_ONLYOBGROUP);
- RNA_def_property_ui_text(prop, "Only Objects in Group",
- "Only include channels from objects in the specified group");
+ RNA_def_property_ui_text(prop, "Only Objects in Collection",
+ "Only include channels from objects in the specified collection");
RNA_def_property_ui_icon(prop, ICON_GROUP, 0);
RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
- prop = RNA_def_property(srna, "filter_group", PROP_POINTER, PROP_NONE);
+ prop = RNA_def_property(srna, "filter_collection", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "filter_grp");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Filtering Group", "Group that included object should be a member of");
+ RNA_def_property_ui_text(prop, "Filtering Collection", "Collection that included object should be a member of");
RNA_def_property_update(prop, NC_ANIMATION | ND_ANIMCHAN | NA_EDITED, NULL);
/* FCurve Display Name Search Settings */
diff --git a/source/blender/makesrna/intern/rna_context.c b/source/blender/makesrna/intern/rna_context.c
index c8d7cb1fcdc..706dc6a3cd7 100644
--- a/source/blender/makesrna/intern/rna_context.c
+++ b/source/blender/makesrna/intern/rna_context.c
@@ -171,11 +171,10 @@ static int rna_Context_engine_length(PointerRNA *ptr)
return strlen(engine_type->idname);
}
-static PointerRNA rna_Context_scene_collection_get(PointerRNA *ptr)
+static PointerRNA rna_Context_collection_get(PointerRNA *ptr)
{
bContext *C = (bContext *)ptr->data;
- ptr->id.data = CTX_data_scene(C);
- return rna_pointer_inherit_refine(ptr, &RNA_SceneCollection, CTX_data_scene_collection(C));
+ return rna_pointer_inherit_refine(ptr, &RNA_Collection, CTX_data_collection(C));
}
static PointerRNA rna_Context_layer_collection_get(PointerRNA *ptr)
@@ -287,10 +286,10 @@ void RNA_def_context(BlenderRNA *brna)
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
RNA_def_property_string_funcs(prop, "rna_Context_engine_get", "rna_Context_engine_length", NULL);
- prop = RNA_def_property(srna, "scene_collection", PROP_POINTER, PROP_NONE);
+ prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_struct_type(prop, "SceneCollection");
- RNA_def_property_pointer_funcs(prop, "rna_Context_scene_collection_get", NULL, NULL, NULL);
+ RNA_def_property_struct_type(prop, "Collection");
+ RNA_def_property_pointer_funcs(prop, "rna_Context_collection_get", NULL, NULL, NULL);
prop = RNA_def_property(srna, "layer_collection", PROP_POINTER, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c
index aeb845ddcf7..0358efff266 100644
--- a/source/blender/makesrna/intern/rna_dynamicpaint.c
+++ b/source/blender/makesrna/intern/rna_dynamicpaint.c
@@ -425,9 +425,9 @@ static void rna_def_canvas_surface(BlenderRNA *brna)
RNA_def_struct_name_property(srna, prop);
prop = RNA_def_property(srna, "brush_group", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Group");
+ RNA_def_property_struct_type(prop, "Collection");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Brush Group", "Only use brush objects from this group");
+ RNA_def_property_ui_text(prop, "Brush Collection", "Only use brush objects from this collection");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_DynamicPaint_reset_dependency");
diff --git a/source/blender/makesrna/intern/rna_group.c b/source/blender/makesrna/intern/rna_group.c
index bf64bb1181f..0f62d8d20d8 100644
--- a/source/blender/makesrna/intern/rna_group.c
+++ b/source/blender/makesrna/intern/rna_group.c
@@ -41,11 +41,21 @@
#include "DNA_scene_types.h"
#include "DNA_object_types.h"
-#include "BKE_group.h"
+#include "DEG_depsgraph.h"
+
+#include "BKE_collection.h"
+#include "BKE_layer.h"
#include "WM_api.h"
-static PointerRNA rna_Group_objects_get(CollectionPropertyIterator *iter)
+static void rna_Collection_all_objects_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+{
+ Collection *collection = (Collection *)ptr->data;
+ ListBase collection_objects = BKE_collection_object_cache_get(collection);
+ rna_iterator_listbase_begin(iter, &collection_objects, NULL);
+}
+
+static PointerRNA rna_Collection_all_objects_get(CollectionPropertyIterator *iter)
{
ListBaseIterator *internal = &iter->internal.listbase;
@@ -54,89 +64,209 @@ static PointerRNA rna_Group_objects_get(CollectionPropertyIterator *iter)
return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, base->object);
}
-static void rna_Group_objects_link(Group *group, ReportList *reports, Object *object)
+static void rna_Collection_objects_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+{
+ Collection *collection = (Collection *)ptr->data;
+ rna_iterator_listbase_begin(iter, &collection->gobject, NULL);
+}
+
+static PointerRNA rna_Collection_objects_get(CollectionPropertyIterator *iter)
{
- if (!BKE_group_object_add(group, object)) {
- BKE_reportf(reports, RPT_ERROR, "Object '%s' already in group '%s'", object->id.name + 2, group->id.name + 2);
+ ListBaseIterator *internal = &iter->internal.listbase;
+
+ /* we are actually iterating a ObjectBase list, so override get */
+ CollectionObject *cob = (CollectionObject *)internal->link;
+ return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, cob->ob);
+}
+
+static void rna_Collection_objects_link(Collection *collection, Main *bmain, ReportList *reports, Object *object)
+{
+ if (!BKE_collection_object_add(bmain, collection, object)) {
+ BKE_reportf(reports, RPT_ERROR, "Object '%s' already in collection '%s'", object->id.name + 2, collection->id.name + 2);
return;
}
WM_main_add_notifier(NC_OBJECT | ND_DRAW, &object->id);
}
-static void rna_Group_objects_unlink(Group *group, ReportList *reports, Object *object)
+static void rna_Collection_objects_unlink(Collection *collection, Main *bmain, ReportList *reports, Object *object)
{
- if (!BKE_group_object_unlink(group, object)) {
- BKE_reportf(reports, RPT_ERROR, "Object '%s' not in group '%s'", object->id.name + 2, group->id.name + 2);
+ if (!BKE_collection_object_remove(bmain, collection, object, false)) {
+ BKE_reportf(reports, RPT_ERROR, "Object '%s' not in collection '%s'", object->id.name + 2, collection->id.name + 2);
return;
}
WM_main_add_notifier(NC_OBJECT | ND_DRAW, &object->id);
}
+static void rna_Collection_children_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+{
+ Collection *collection = (Collection *)ptr->data;
+ rna_iterator_listbase_begin(iter, &collection->children, NULL);
+}
+
+static PointerRNA rna_Collection_children_get(CollectionPropertyIterator *iter)
+{
+ ListBaseIterator *internal = &iter->internal.listbase;
+
+ /* we are actually iterating a CollectionBase list, so override get */
+ CollectionChild *child = (CollectionChild *)internal->link;
+ return rna_pointer_inherit_refine(&iter->parent, &RNA_Collection, child->collection);
+}
+
+static void rna_Collection_children_link(Collection *collection, Main *bmain, ReportList *reports, Collection *child)
+{
+ if (!BKE_collection_child_add(bmain, collection, child)) {
+ BKE_reportf(reports, RPT_ERROR, "Collection '%s' already in collection '%s'", child->id.name + 2, collection->id.name + 2);
+ return;
+ }
+
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, &child->id);
+}
+
+static void rna_Collection_children_unlink(Collection *collection, Main *bmain, ReportList *reports, Collection *child)
+{
+ if (!BKE_collection_child_remove(bmain, collection, child)) {
+ BKE_reportf(reports, RPT_ERROR, "Collection '%s' not in collection '%s'", child->id.name + 2, collection->id.name + 2);
+ return;
+ }
+
+ WM_main_add_notifier(NC_OBJECT | ND_DRAW, &child->id);
+}
+
+static void rna_Collection_flag_update(Main *bmain, Scene *scene, PointerRNA *ptr)
+{
+ Collection *collection = (Collection *)ptr->data;
+ BKE_collection_object_cache_free(collection);
+ BKE_main_collection_sync(bmain);
+ WM_main_add_notifier(NC_SCENE | ND_OB_SELECT, scene);
+}
+
#else
-/* group.objects */
-static void rna_def_group_objects(BlenderRNA *brna, PropertyRNA *cprop)
+/* collection.objects */
+static void rna_def_collection_objects(BlenderRNA *brna, PropertyRNA *cprop)
{
StructRNA *srna;
-/* PropertyRNA *prop; */
-
FunctionRNA *func;
PropertyRNA *parm;
- RNA_def_property_srna(cprop, "GroupObjects");
- srna = RNA_def_struct(brna, "GroupObjects", NULL);
- RNA_def_struct_sdna(srna, "Group");
- RNA_def_struct_ui_text(srna, "Group Objects", "Collection of group objects");
+ RNA_def_property_srna(cprop, "CollectionObjects");
+ srna = RNA_def_struct(brna, "CollectionObjects", NULL);
+ RNA_def_struct_sdna(srna, "Collection");
+ RNA_def_struct_ui_text(srna, "Collection Objects", "Collection of collection objects");
/* add object */
- func = RNA_def_function(srna, "link", "rna_Group_objects_link");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- RNA_def_function_ui_description(func, "Add this object to a group");
- /* object to add */
+ func = RNA_def_function(srna, "link", "rna_Collection_objects_link");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_MAIN);
+ RNA_def_function_ui_description(func, "Add this object to a collection");
parm = RNA_def_pointer(func, "object", "Object", "", "Object to add");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
/* remove object */
- func = RNA_def_function(srna, "unlink", "rna_Group_objects_unlink");
- RNA_def_function_ui_description(func, "Remove this object to a group");
- RNA_def_function_flag(func, FUNC_USE_REPORTS);
- /* object to remove */
+ func = RNA_def_function(srna, "unlink", "rna_Collection_objects_unlink");
+ RNA_def_function_ui_description(func, "Remove this object from a collection");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_MAIN);
parm = RNA_def_pointer(func, "object", "Object", "", "Object to remove");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
}
+/* collection.children */
+static void rna_def_collection_children(BlenderRNA *brna, PropertyRNA *cprop)
+{
+ StructRNA *srna;
+ FunctionRNA *func;
+ PropertyRNA *parm;
-void RNA_def_group(BlenderRNA *brna)
+ RNA_def_property_srna(cprop, "CollectionChildren");
+ srna = RNA_def_struct(brna, "CollectionChildren", NULL);
+ RNA_def_struct_sdna(srna, "Collection");
+ RNA_def_struct_ui_text(srna, "Collection Children", "Collection of child collections");
+
+ /* add child */
+ func = RNA_def_function(srna, "link", "rna_Collection_children_link");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_MAIN);
+ RNA_def_function_ui_description(func, "Add this collection as child of this collection");
+ parm = RNA_def_pointer(func, "child", "Collection", "", "Collection to add");
+ RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+
+ /* remove child */
+ func = RNA_def_function(srna, "unlink", "rna_Collection_children_unlink");
+ RNA_def_function_ui_description(func, "Remove this child collection from a collection");
+ RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_MAIN);
+ parm = RNA_def_pointer(func, "child", "Collection", "", "Collection to remove");
+ RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
+}
+
+
+void RNA_def_collections(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
- srna = RNA_def_struct(brna, "Group", "ID");
- RNA_def_struct_ui_text(srna, "Group", "Group of Object data-blocks");
+ srna = RNA_def_struct(brna, "Collection", "ID");
+ RNA_def_struct_sdna(srna, "Group"); /* it is actually Collection but for 2.8 the dna is patched! */
+ RNA_def_struct_ui_text(srna, "Collection", "Collection of Object data-blocks");
RNA_def_struct_ui_icon(srna, ICON_GROUP);
- /* this is done on save/load in readfile.c, removed if no objects are in the group */
+ /* this is done on save/load in readfile.c, removed if no objects are in the collection and not in a scene */
RNA_def_struct_clear_flag(srna, STRUCT_ID_REFCOUNT);
prop = RNA_def_property(srna, "dupli_offset", PROP_FLOAT, PROP_TRANSLATION);
RNA_def_property_float_sdna(prop, NULL, "dupli_ofs");
- RNA_def_property_ui_text(prop, "Dupli Offset", "Offset from the origin to use when instancing as DupliGroup");
+ RNA_def_property_ui_text(prop, "Dupli Offset", "Offset from the origin to use when instancing");
RNA_def_property_ui_range(prop, -10000.0, 10000.0, 10, RNA_TRANSLATION_PREC_DEFAULT);
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "view_layer->object_bases", NULL);
RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_ui_text(prop, "Objects", "A collection of this groups objects");
- RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_Group_objects_get", NULL, NULL, NULL, NULL);
- rna_def_group_objects(brna, prop);
-
- prop = RNA_def_property(srna, "view_layer", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "ViewLayer");
- RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "View Layer", "Group internal view layer");
+ RNA_def_property_ui_text(prop, "Objects", "Objects that are directly in this collection");
+ RNA_def_property_collection_funcs(prop, "rna_Collection_objects_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_Collection_objects_get",
+ NULL, NULL, NULL, NULL);
+ rna_def_collection_objects(brna, prop);
+
+ prop = RNA_def_property(srna, "all_objects", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Object");
+ RNA_def_property_ui_text(prop, "All Objects", "Objects that are in this collection and its child collections");
+ RNA_def_property_collection_funcs(prop, "rna_Collection_all_objects_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_Collection_all_objects_get",
+ NULL, NULL, NULL, NULL);
+
+ prop = RNA_def_property(srna, "children", PROP_COLLECTION, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Collection");
+ RNA_def_property_ui_text(prop, "Children", "Collections that are immediate children of this collection");
+ RNA_def_property_collection_funcs(prop, "rna_Collection_children_begin",
+ "rna_iterator_listbase_next",
+ "rna_iterator_listbase_end",
+ "rna_Collection_children_get",
+ NULL, NULL, NULL, NULL);
+ rna_def_collection_children(brna, prop);
+
+ /* Flags */
+ prop = RNA_def_property(srna, "hide_select", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_RESTRICT_SELECT);
+ RNA_def_property_flag(prop, PROP_OVERRIDABLE_STATIC);
+ RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 1);
+ RNA_def_property_ui_text(prop, "Restrict Select", "Disable collection object selection in the 3D viewport");
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_flag_update");
+
+ prop = RNA_def_property(srna, "hide_viewport", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_RESTRICT_VIEW);
+ RNA_def_property_flag(prop, PROP_OVERRIDABLE_STATIC);
+ RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1);
+ RNA_def_property_ui_text(prop, "Restrict Viewport", "Hide collection objects in the 3D viewport");
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_flag_update");
+
+ prop = RNA_def_property(srna, "hide_render", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_RESTRICT_RENDER);
+ RNA_def_property_flag(prop, PROP_OVERRIDABLE_STATIC);
+ RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
+ RNA_def_property_ui_text(prop, "Restrict Render", "Hide collection objects in renders");
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_Collection_flag_update");
}
#endif
diff --git a/source/blender/makesrna/intern/rna_internal.h b/source/blender/makesrna/intern/rna_internal.h
index ce16cb69bbd..a1b4e0a7006 100644
--- a/source/blender/makesrna/intern/rna_internal.h
+++ b/source/blender/makesrna/intern/rna_internal.h
@@ -142,6 +142,7 @@ void RNA_def_brush(struct BlenderRNA *brna);
void RNA_def_cachefile(struct BlenderRNA *brna);
void RNA_def_camera(struct BlenderRNA *brna);
void RNA_def_cloth(struct BlenderRNA *brna);
+void RNA_def_collections(struct BlenderRNA *brna);
void RNA_def_color(struct BlenderRNA *brna);
void RNA_def_constraint(struct BlenderRNA *brna);
void RNA_def_context(struct BlenderRNA *brna);
@@ -152,7 +153,6 @@ void RNA_def_dynamic_paint(struct BlenderRNA *brna);
void RNA_def_fluidsim(struct BlenderRNA *brna);
void RNA_def_fcurve(struct BlenderRNA *brna);
void RNA_def_gpencil(struct BlenderRNA *brna);
-void RNA_def_group(struct BlenderRNA *brna);
void RNA_def_image(struct BlenderRNA *brna);
void RNA_def_key(struct BlenderRNA *brna);
void RNA_def_lamp(struct BlenderRNA *brna);
@@ -364,7 +364,7 @@ void RNA_def_main_fonts(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_brushes(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop);
-void RNA_def_main_groups(BlenderRNA *brna, PropertyRNA *cprop);
+void RNA_def_main_collections(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_texts(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_speakers(BlenderRNA *brna, PropertyRNA *cprop);
void RNA_def_main_sounds(BlenderRNA *brna, PropertyRNA *cprop);
diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c
index e6e90f4f05d..61bf5ceab8e 100644
--- a/source/blender/makesrna/intern/rna_layer.c
+++ b/source/blender/makesrna/intern/rna_layer.c
@@ -47,12 +47,6 @@
#include "rna_internal.h"
-const EnumPropertyItem rna_enum_collection_type_items[] = {
- {COLLECTION_TYPE_NONE, "NONE", 0, "Normal", ""},
- {COLLECTION_TYPE_GROUP_INTERNAL, "GROUP_INTERNAL", 0, "Group Internal", ""},
- {0, NULL, 0, NULL, NULL}
-};
-
#ifdef RNA_RUNTIME
#include "DNA_group_types.h"
@@ -69,324 +63,13 @@ const EnumPropertyItem rna_enum_collection_type_items[] = {
#include "DEG_depsgraph_build.h"
#include "DEG_depsgraph_query.h"
-static StructRNA *rna_SceneCollection_refine(PointerRNA *ptr)
-{
- SceneCollection *scene_collection = (SceneCollection *)ptr->data;
- switch (scene_collection->type) {
- case COLLECTION_TYPE_GROUP_INTERNAL:
- case COLLECTION_TYPE_NONE:
- return &RNA_SceneCollection;
- default:
- BLI_assert(!"Collection type not fully implemented");
- break;
- }
- return &RNA_SceneCollection;
-}
-
-static void rna_SceneCollection_name_set(PointerRNA *ptr, const char *value)
-{
- Scene *scene = (Scene *)ptr->id.data;
- SceneCollection *sc = (SceneCollection *)ptr->data;
- BKE_collection_rename(&scene->id, sc, value);
-}
-
-static PointerRNA rna_SceneCollection_objects_get(CollectionPropertyIterator *iter)
-{
- ListBaseIterator *internal = &iter->internal.listbase;
-
- /* we are actually iterating a LinkData list */
- return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, ((LinkData *)internal->link)->data);
-}
-
-static int rna_SceneCollection_move_above(ID *id, SceneCollection *sc_src, Main *bmain, SceneCollection *sc_dst)
-{
- if (!BKE_collection_move_above(id, sc_dst, sc_src)) {
- return 0;
- }
-
- DEG_relations_tag_update(bmain);
- WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
-
- return 1;
-}
-
-static int rna_SceneCollection_move_below(ID *id, SceneCollection *sc_src, Main *bmain, SceneCollection *sc_dst)
-{
- if (!BKE_collection_move_below(id, sc_dst, sc_src)) {
- return 0;
- }
-
- DEG_relations_tag_update(bmain);
- WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
-
- return 1;
-}
-
-static int rna_SceneCollection_move_into(ID *id, SceneCollection *sc_src, Main *bmain, SceneCollection *sc_dst)
-{
- if (!BKE_collection_move_into(id, sc_dst, sc_src)) {
- return 0;
- }
-
- DEG_relations_tag_update(bmain);
- WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
-
- return 1;
-}
-
-static SceneCollection *rna_SceneCollection_duplicate(
- ID *id, SceneCollection *scene_collection, Main *bmain, bContext *C, ReportList *reports)
-{
- if (scene_collection == BKE_collection_master(id)) {
- BKE_report(reports, RPT_ERROR, "The master collection can't be duplicated");
- return NULL;
- }
-
- SceneCollection *scene_collection_new = BKE_collection_duplicate(id, scene_collection);
-
- DEG_relations_tag_update(bmain);
- /* Don't use id here, since the layer collection may come from a group. */
- WM_event_add_notifier(C, NC_SCENE | ND_LAYER, CTX_data_scene(C));
-
- return scene_collection_new;
-}
-
-static SceneCollection *rna_SceneCollection_new(
- ID *id, SceneCollection *sc_parent, Main *bmain, const char *name)
-{
- SceneCollection *sc = BKE_collection_add(id, sc_parent, COLLECTION_TYPE_NONE, name);
-
- DEG_relations_tag_update(bmain);
- WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
-
- return sc;
-}
-
-static void rna_SceneCollection_remove(
- ID *id, SceneCollection *sc_parent, Main *bmain, ReportList *reports, PointerRNA *sc_ptr)
-{
- SceneCollection *sc = sc_ptr->data;
-
- const int index = BLI_findindex(&sc_parent->scene_collections, sc);
- if (index == -1) {
- BKE_reportf(reports, RPT_ERROR, "Collection '%s' is not a sub-collection of '%s'",
- sc->name, sc_parent->name);
- return;
- }
-
- if (!BKE_collection_remove(id, sc)) {
- BKE_reportf(reports, RPT_ERROR, "Collection '%s' could not be removed from collection '%s'",
- sc->name, sc_parent->name);
- return;
- }
-
- RNA_POINTER_INVALIDATE(sc_ptr);
-
- DEG_relations_tag_update(bmain);
- WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
-}
-
-static int rna_SceneCollection_objects_active_index_get(PointerRNA *ptr)
-{
- SceneCollection *sc = (SceneCollection *)ptr->data;
- return sc->active_object_index;
-}
-
-static void rna_SceneCollection_objects_active_index_set(PointerRNA *ptr, int value)
-{
- SceneCollection *sc = (SceneCollection *)ptr->data;
- sc->active_object_index = value;
-}
-
-static void rna_SceneCollection_objects_active_index_range(
- PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
-{
- SceneCollection *sc = (SceneCollection *)ptr->data;
- *min = 0;
- *max = max_ii(0, BLI_listbase_count(&sc->objects) - 1);
-}
-
-void rna_SceneCollection_object_link(
- ID *id, SceneCollection *sc, Main *bmain, ReportList *reports, Object *ob)
-{
- Scene *scene = (Scene *)id;
-
- if (BLI_findptr(&sc->objects, ob, offsetof(LinkData, data))) {
- BKE_reportf(reports, RPT_ERROR, "Object '%s' is already in collection '%s'", ob->id.name + 2, sc->name);
- return;
- }
-
- BKE_collection_object_add(&scene->id, sc, ob);
-
- /* TODO(sergey): Only update relations for the current scene. */
- DEG_relations_tag_update(bmain);
-
- /* TODO(sergey): Use proper flag for tagging here. */
- DEG_id_tag_update(&scene->id, 0);
-
- DEG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
-
- WM_main_add_notifier(NC_SCENE | ND_LAYER | ND_OB_ACTIVE, scene);
-}
-
-static void rna_SceneCollection_object_unlink(
- ID *id, SceneCollection *sc, Main *bmain, ReportList *reports, Object *ob)
-{
- Scene *scene = (Scene *)id;
-
- if (!BLI_findptr(&sc->objects, ob, offsetof(LinkData, data))) {
- BKE_reportf(reports, RPT_ERROR, "Object '%s' is not in collection '%s'", ob->id.name + 2, sc->name);
- return;
- }
-
- BKE_collection_object_remove(bmain, &scene->id, sc, ob, false);
-
- /* needed otherwise the depgraph will contain freed objects which can crash, see [#20958] */
- DEG_relations_tag_update(bmain);
-
- WM_main_add_notifier(NC_SCENE | ND_LAYER | ND_OB_ACTIVE, scene);
-}
-
/***********************************/
-static void rna_LayerCollection_name_get(PointerRNA *ptr, char *value)
-{
- SceneCollection *sc = ((LayerCollection *)ptr->data)->scene_collection;
- strcpy(value, sc->name);
-}
-
-static int rna_LayerCollection_name_length(PointerRNA *ptr)
-{
- SceneCollection *sc = ((LayerCollection *)ptr->data)->scene_collection;
- return strnlen(sc->name, sizeof(sc->name));
-}
-
-static void rna_LayerCollection_name_set(PointerRNA *ptr, const char *value)
-{
- ID *owner_id = (ID *)ptr->id.data;
- SceneCollection *sc = ((LayerCollection *)ptr->data)->scene_collection;
- BKE_collection_rename(owner_id, sc, value);
-}
-
-static PointerRNA rna_LayerCollection_objects_get(CollectionPropertyIterator *iter)
-{
- ListBaseIterator *internal = &iter->internal.listbase;
- Base *base = ((LinkData *)internal->link)->data;
- return rna_pointer_inherit_refine(&iter->parent, &RNA_Object, base->object);
-}
-
-static int rna_LayerCollection_move_above(ID *id, LayerCollection *lc_src, Main *bmain, LayerCollection *lc_dst)
-{
- if (!BKE_layer_collection_move_above(id, lc_dst, lc_src)) {
- return 0;
- }
-
- DEG_relations_tag_update(bmain);
- WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
-
- return 1;
-}
-
-static int rna_LayerCollection_move_below(ID *id, LayerCollection *lc_src, Main *bmain, LayerCollection *lc_dst)
-{
- if (!BKE_layer_collection_move_below(id, lc_dst, lc_src)) {
- return 0;
- }
-
- DEG_relations_tag_update(bmain);
- WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
-
- return 1;
-}
-
-static int rna_LayerCollection_move_into(ID *id, LayerCollection *lc_src, Main *bmain, LayerCollection *lc_dst)
-{
- if (!BKE_layer_collection_move_into(id, lc_dst, lc_src)) {
- return 0;
- }
-
- DEG_relations_tag_update(bmain);
- WM_main_add_notifier(NC_SCENE | ND_LAYER, NULL);
-
- return 1;
-}
-
-static void rna_LayerCollection_flag_update(bContext *C, PointerRNA *ptr)
-{
- ID *id = ptr->id.data;
- /* TODO(sergey): Use proper flag for tagging here. */
- DEG_id_tag_update(id, 0);
- WM_event_add_notifier(C, NC_SCENE | ND_OB_SELECT, CTX_data_scene(C));
-}
-
-static Group *rna_LayerCollection_create_group(
- ID *id, LayerCollection *layer_collection, Main *bmain, bContext *C, ReportList *reports)
-{
- Group *group;
- Scene *scene = (Scene *)id;
- SceneCollection *scene_collection = layer_collection->scene_collection;
-
- /* The master collection can't be converted. */
- if (scene_collection == BKE_collection_master(&scene->id)) {
- BKE_report(reports, RPT_ERROR, "The master collection can't be converted to group");
- return NULL;
- }
-
- group = BKE_collection_group_create(bmain, scene, layer_collection);
- if (group == NULL) {
- BKE_reportf(reports, RPT_ERROR, "Failed to convert collection %s", scene_collection->name);
- return NULL;
- }
-
- DEG_relations_tag_update(bmain);
- /* TODO(sergey): Use proper flag for tagging here. */
- DEG_id_tag_update(&scene->id, 0);
- WM_event_add_notifier(C, NC_SCENE | ND_LAYER, scene);
- return group;
-}
-
-static LayerCollection *rna_LayerCollection_duplicate(
- ID *id, LayerCollection *layer_collection, Main *bmain, bContext *C, ReportList *reports)
-{
- if (layer_collection->scene_collection == BKE_collection_master(id)) {
- BKE_report(reports, RPT_ERROR, "The master collection can't be duplicated");
- return NULL;
- }
-
- LayerCollection *layer_collection_new = BKE_layer_collection_duplicate(id, layer_collection);
-
- DEG_relations_tag_update(bmain);
- /* Don't use id here, since the layer collection may come from a group. */
- WM_event_add_notifier(C, NC_SCENE | ND_LAYER, CTX_data_scene(C));
-
- return layer_collection_new;
-}
-
-static int rna_LayerCollections_active_collection_index_get(PointerRNA *ptr)
-{
- ViewLayer *view_layer = (ViewLayer *)ptr->data;
- return view_layer->active_collection;
-}
-
-static void rna_LayerCollections_active_collection_index_set(PointerRNA *ptr, int value)
-{
- ViewLayer *view_layer = (ViewLayer *)ptr->data;
- int num_collections = BKE_layer_collection_count(view_layer);
- view_layer->active_collection = min_ff(value, num_collections - 1);
-}
-
-static void rna_LayerCollections_active_collection_index_range(
- PointerRNA *ptr, int *min, int *max, int *UNUSED(softmin), int *UNUSED(softmax))
-{
- ViewLayer *view_layer = (ViewLayer *)ptr->data;
- *min = 0;
- *max = max_ii(0, BKE_layer_collection_count(view_layer) - 1);
-}
static PointerRNA rna_LayerCollections_active_collection_get(PointerRNA *ptr)
{
ViewLayer *view_layer = (ViewLayer *)ptr->data;
- LayerCollection *lc = BKE_layer_collection_get_active(view_layer);
+ LayerCollection *lc = view_layer->active_collection;
return rna_pointer_inherit_refine(ptr, &RNA_LayerCollection, lc);
}
@@ -395,40 +78,7 @@ static void rna_LayerCollections_active_collection_set(PointerRNA *ptr, PointerR
ViewLayer *view_layer = (ViewLayer *)ptr->data;
LayerCollection *lc = (LayerCollection *)value.data;
const int index = BKE_layer_collection_findindex(view_layer, lc);
- if (index != -1) view_layer->active_collection = index;
-}
-
-LayerCollection * rna_ViewLayer_collection_link(
- ID *id, ViewLayer *view_layer, Main *bmain, SceneCollection *sc)
-{
- Scene *scene = (Scene *)id;
- LayerCollection *lc = BKE_collection_link(view_layer, sc);
-
- DEG_relations_tag_update(bmain);
- /* TODO(sergey): Use proper flag for tagging here. */
- DEG_id_tag_update(id, 0);
- WM_main_add_notifier(NC_SCENE | ND_LAYER, scene);
-
- return lc;
-}
-
-static void rna_ViewLayer_collection_unlink(
- ID *id, ViewLayer *view_layer, Main *bmain, ReportList *reports, LayerCollection *lc)
-{
- Scene *scene = (Scene *)id;
-
- if (BLI_findindex(&view_layer->layer_collections, lc) == -1) {
- BKE_reportf(reports, RPT_ERROR, "Layer collection '%s' is not in '%s'",
- lc->scene_collection->name, view_layer->name);
- return;
- }
-
- BKE_collection_unlink(view_layer, lc);
-
- DEG_relations_tag_update(bmain);
- /* TODO(sergey): Use proper flag for tagging here. */
- DEG_id_tag_update(id, 0);
- WM_main_add_notifier(NC_SCENE | ND_LAYER | ND_OB_ACTIVE, scene);
+ if (index != -1) BKE_layer_collection_activate(view_layer, lc);
}
static PointerRNA rna_LayerObjects_active_object_get(PointerRNA *ptr)
@@ -538,250 +188,59 @@ static void rna_ObjectBase_select_update(Main *UNUSED(bmain), Scene *UNUSED(scen
ED_object_base_select(base, mode);
}
-#else
-
-static void rna_def_scene_collections(BlenderRNA *brna, PropertyRNA *cprop)
+static void rna_LayerCollection_use_update(Main *bmain, Scene *UNUSED(scene), PointerRNA *ptr)
{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
-
- RNA_def_property_srna(cprop, "SceneCollections");
- srna = RNA_def_struct(brna, "SceneCollections", NULL);
- RNA_def_struct_sdna(srna, "SceneCollection");
- RNA_def_struct_ui_text(srna, "Scene Collection", "Collection of scene collections");
-
- func = RNA_def_function(srna, "new", "rna_SceneCollection_new");
- RNA_def_function_ui_description(func, "Add a collection to scene");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
- parm = RNA_def_string(func, "name", NULL, 0, "", "New name for the collection (not unique)");
- parm = RNA_def_pointer(func, "result", "SceneCollection", "", "Newly created collection");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "remove", "rna_SceneCollection_remove");
- RNA_def_function_ui_description(func, "Remove a collection and move its objects to the master collection");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "collection", "SceneCollection", "", "Collection to remove");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
- RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
-}
+ Scene *scene = (Scene *)ptr->id.data;
+ LayerCollection *lc = (LayerCollection*)ptr->data;
+ ViewLayer *view_layer = BKE_view_layer_find_from_collection(scene, lc);
-static void rna_def_collection_objects(BlenderRNA *brna, PropertyRNA *cprop)
-{
- StructRNA *srna;
- FunctionRNA *func;
- PropertyRNA *parm;
- PropertyRNA *prop;
+ BKE_layer_collection_sync(scene, view_layer);
- RNA_def_property_srna(cprop, "CollectionObjects");
- srna = RNA_def_struct(brna, "CollectionObjects", NULL);
- RNA_def_struct_sdna(srna, "SceneCollection");
- RNA_def_struct_ui_text(srna, "Collection Objects", "Objects of a collection");
-
- prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_funcs(prop, "rna_SceneCollection_objects_active_index_get",
- "rna_SceneCollection_objects_active_index_set",
- "rna_SceneCollection_objects_active_index_range");
- RNA_def_property_ui_text(prop, "Active Object Index", "Active index in collection objects array");
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL);
-
- func = RNA_def_function(srna, "link", "rna_SceneCollection_object_link");
- RNA_def_function_ui_description(func, "Link an object to collection");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "object", "Object", "", "Object to add to collection");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
-
- func = RNA_def_function(srna, "unlink", "rna_SceneCollection_object_unlink");
- RNA_def_function_ui_description(func, "Unlink object from collection");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "object", "Object", "", "Object to remove from collection");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
+ /* TODO(sergey): Use proper flag for tagging here. */
+ DEG_id_tag_update(&scene->id, 0);
+ DEG_relations_tag_update(bmain);
+ WM_main_add_notifier(NC_SCENE | ND_LAYER_CONTENT, NULL);
}
-static void rna_def_scene_collection(BlenderRNA *brna)
-{
- StructRNA *srna;
- PropertyRNA *prop;
-
- FunctionRNA *func;
- PropertyRNA *parm;
-
- srna = RNA_def_struct(brna, "SceneCollection", NULL);
- RNA_def_struct_ui_text(srna, "Scene Collection", "Collection");
- RNA_def_struct_ui_icon(srna, ICON_COLLAPSEMENU);
- RNA_def_struct_refine_func(srna, "rna_SceneCollection_refine");
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SceneCollection_name_set");
- RNA_def_property_ui_text(prop, "Name", "Collection name");
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL);
-
- prop = RNA_def_property(srna, "type", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, rna_enum_collection_type_items);
- RNA_def_property_ui_text(prop, "Type", "Type of collection");
- RNA_def_property_clear_flag(prop, PROP_EDITABLE);
-
- prop = RNA_def_property(srna, "collections", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "scene_collections", NULL);
- RNA_def_property_struct_type(prop, "SceneCollection");
- RNA_def_property_ui_text(prop, "SceneCollections", "");
- rna_def_scene_collections(brna, prop);
-
- prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "objects", NULL);
- RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_SceneCollection_objects_get", NULL, NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Objects", "All the objects directly added to this collection (not including sub-collection objects)");
- rna_def_collection_objects(brna, prop);
-
- /* Functions */
- func = RNA_def_function(srna, "move_above", "rna_SceneCollection_move_above");
- RNA_def_function_ui_description(func, "Move collection after another");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
- parm = RNA_def_pointer(func, "sc_dst", "SceneCollection", "Collection", "Reference collection above which the collection will move");
- parm = RNA_def_boolean(func, "result", false, "Result", "Whether the operation succeded");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "move_below", "rna_SceneCollection_move_below");
- RNA_def_function_ui_description(func, "Move collection before another");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
- parm = RNA_def_pointer(func, "sc_dst", "SceneCollection", "Collection", "Reference collection below which the collection will move");
- parm = RNA_def_boolean(func, "result", false, "Result", "Whether the operation succeded");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "move_into", "rna_SceneCollection_move_into");
- RNA_def_function_ui_description(func, "Move collection into another");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
- parm = RNA_def_pointer(func, "sc_dst", "SceneCollection", "Collection", "Collection to insert into");
- parm = RNA_def_boolean(func, "result", false, "Result", "Whether the operation succeded");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "duplicate", "rna_SceneCollection_duplicate");
- RNA_def_function_ui_description(func, "Create a copy of the collection");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "result", "SceneCollection", "", "Newly created collection");
- RNA_def_function_return(func, parm);
-}
+#else
static void rna_def_layer_collection(BlenderRNA *brna)
{
StructRNA *srna;
PropertyRNA *prop;
- FunctionRNA *func;
- PropertyRNA *parm;
-
srna = RNA_def_struct(brna, "LayerCollection", NULL);
RNA_def_struct_ui_text(srna, "Layer Collection", "Layer collection");
- RNA_def_struct_ui_icon(srna, ICON_COLLAPSEMENU);
-
- prop = RNA_def_property(srna, "name", PROP_STRING, PROP_NONE);
- RNA_def_property_string_funcs(prop, "rna_LayerCollection_name_get", "rna_LayerCollection_name_length", "rna_LayerCollection_name_set");
- RNA_def_property_ui_text(prop, "Name", "Collection name");
- RNA_def_struct_name_property(srna, prop);
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL);
+ RNA_def_struct_ui_icon(srna, ICON_GROUP);
prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "scene_collection");
- RNA_def_property_struct_type(prop, "SceneCollection");
+ RNA_def_property_clear_flag(prop, PROP_EDITABLE | PROP_ANIMATABLE);
+ RNA_def_property_struct_type(prop, "Collection");
RNA_def_property_ui_text(prop, "Collection", "Collection this layer collection is wrapping");
- prop = RNA_def_property(srna, "collections", PROP_COLLECTION, PROP_NONE);
+ prop = RNA_def_property(srna, "children", PROP_COLLECTION, PROP_NONE);
RNA_def_property_collection_sdna(prop, NULL, "layer_collections", NULL);
RNA_def_property_struct_type(prop, "LayerCollection");
- RNA_def_property_ui_text(prop, "Layer Collections", "");
+ RNA_def_property_ui_text(prop, "Children", "Child layer collections");
- prop = RNA_def_property(srna, "objects", PROP_COLLECTION, PROP_NONE);
- RNA_def_property_collection_sdna(prop, NULL, "object_bases", NULL);
- RNA_def_property_struct_type(prop, "Object");
- RNA_def_property_collection_funcs(prop, NULL, NULL, NULL, "rna_LayerCollection_objects_get", NULL, NULL, NULL, NULL);
- RNA_def_property_ui_text(prop, "Objects", "All the objects directly or indirectly added to this collection (not including sub-collection objects)");
-
- /* Functions */
- func = RNA_def_function(srna, "move_above", "rna_LayerCollection_move_above");
- RNA_def_function_ui_description(func, "Move collection after another");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
- parm = RNA_def_pointer(func, "lc_dst", "LayerCollection", "Collection", "Reference collection above which the collection will move");
- parm = RNA_def_boolean(func, "result", false, "Result", "Whether the operation succeded");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "move_below", "rna_LayerCollection_move_below");
- RNA_def_function_ui_description(func, "Move collection before another");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
- parm = RNA_def_pointer(func, "lc_dst", "LayerCollection", "Collection", "Reference collection below which the collection will move");
- parm = RNA_def_boolean(func, "result", false, "Result", "Whether the operation succeded");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "move_into", "rna_LayerCollection_move_into");
- RNA_def_function_ui_description(func, "Move collection into another");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
- parm = RNA_def_pointer(func, "lc_dst", "LayerCollection", "Collection", "Collection to insert into");
- parm = RNA_def_boolean(func, "result", false, "Result", "Whether the operation succeded");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "create_group", "rna_LayerCollection_create_group");
- RNA_def_function_ui_description(func, "Enable or disable a collection");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "result", "Group", "", "Newly created Group");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "duplicate", "rna_LayerCollection_duplicate");
- RNA_def_function_ui_description(func, "Create a copy of the collection");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_CONTEXT | FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "result", "LayerCollection", "", "Newly created collection");
- RNA_def_function_return(func, parm);
-
- /* Flags */
- prop = RNA_def_property(srna, "selectable", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_SELECTABLE);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_icon(prop, ICON_RESTRICT_SELECT_OFF, 1);
- RNA_def_property_ui_text(prop, "Selectable", "Restrict selection");
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_flag_update");
-
- prop = RNA_def_property(srna, "visible_viewport", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_VIEWPORT);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_icon(prop, ICON_RESTRICT_VIEW_OFF, 1);
- RNA_def_property_ui_text(prop, "Viewport Visibility", "");
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_flag_update");
-
- prop = RNA_def_property(srna, "visible_render", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_sdna(prop, NULL, "flag", COLLECTION_RENDER);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_icon(prop, ICON_RESTRICT_RENDER_OFF, 1);
- RNA_def_property_ui_text(prop, "Render Visibility", "Control");
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_flag_update");
-
- prop = RNA_def_property(srna, "enabled", PROP_BOOLEAN, PROP_NONE);
- RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", COLLECTION_DISABLED);
- RNA_def_property_flag(prop, PROP_CONTEXT_UPDATE);
- RNA_def_property_ui_text(prop, "Enabled", "Enable or disable collection");
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, "rna_LayerCollection_flag_update");
+ prop = RNA_def_property(srna, "exclude", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", LAYER_COLLECTION_EXCLUDE);
+ RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+ RNA_def_property_ui_text(prop, "Exclude", "Exclude collection from view layer");
+ RNA_def_property_update(prop, NC_SCENE | ND_LAYER, "rna_LayerCollection_use_update");
}
static void rna_def_layer_collections(BlenderRNA *brna, PropertyRNA *cprop)
{
StructRNA *srna;
- FunctionRNA *func;
PropertyRNA *prop;
- PropertyRNA *parm;
RNA_def_property_srna(cprop, "LayerCollections");
srna = RNA_def_struct(brna, "LayerCollections", NULL);
RNA_def_struct_sdna(srna, "ViewLayer");
RNA_def_struct_ui_text(srna, "Layer Collections", "Collections of render layer");
- prop = RNA_def_property(srna, "active_index", PROP_INT, PROP_UNSIGNED);
- RNA_def_property_int_sdna(prop, NULL, "active_collection");
- RNA_def_property_int_funcs(prop, "rna_LayerCollections_active_collection_index_get",
- "rna_LayerCollections_active_collection_index_set",
- "rna_LayerCollections_active_collection_index_range");
- RNA_def_property_ui_text(prop, "Active Collection Index", "Active index in layer collection array");
- RNA_def_property_update(prop, NC_SCENE | ND_LAYER, NULL);
-
prop = RNA_def_property(srna, "active", PROP_POINTER, PROP_NONE);
RNA_def_property_struct_type(prop, "LayerCollection");
RNA_def_property_pointer_funcs(prop, "rna_LayerCollections_active_collection_get",
@@ -789,20 +248,6 @@ static void rna_def_layer_collections(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL);
RNA_def_property_ui_text(prop, "Active Layer Collection", "Active Layer Collection");
RNA_def_property_update(prop, NC_SCENE | ND_LAYER, NULL);
-
- func = RNA_def_function(srna, "link", "rna_ViewLayer_collection_link");
- RNA_def_function_ui_description(func, "Link a collection to render layer");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN);
- parm = RNA_def_pointer(func, "scene_collection", "SceneCollection", "", "Collection to add to render layer");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
- parm = RNA_def_pointer(func, "result", "LayerCollection", "", "Newly created layer collection");
- RNA_def_function_return(func, parm);
-
- func = RNA_def_function(srna, "unlink", "rna_ViewLayer_collection_unlink");
- RNA_def_function_ui_description(func, "Unlink a collection from render layer");
- RNA_def_function_flag(func, FUNC_USE_SELF_ID | FUNC_USE_MAIN | FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "layer_collection", "LayerCollection", "", "Layer collection to remove from render layer");
- RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED);
}
static void rna_def_layer_objects(BlenderRNA *brna, PropertyRNA *cprop)
@@ -919,7 +364,6 @@ void RNA_def_view_layer(BlenderRNA *brna)
/* Nested Data */
/* *** Non-Animated *** */
RNA_define_animate_sdna(false);
- rna_def_scene_collection(brna);
rna_def_layer_collection(brna);
rna_def_object_base(brna);
RNA_define_animate_sdna(true);
diff --git a/source/blender/makesrna/intern/rna_lightprobe.c b/source/blender/makesrna/intern/rna_lightprobe.c
index df43e7ebe02..d4b94bfb3be 100644
--- a/source/blender/makesrna/intern/rna_lightprobe.c
+++ b/source/blender/makesrna/intern/rna_lightprobe.c
@@ -188,9 +188,10 @@ static void rna_def_lightprobe(BlenderRNA *brna)
RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
prop = RNA_def_property(srna, "visibility_group", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Collection");
RNA_def_property_pointer_sdna(prop, NULL, "visibility_grp");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Visibility Group", "Restrict objects visible for this probe");
+ RNA_def_property_ui_text(prop, "Visibility Collection", "Restrict objects visible for this probe");
RNA_def_property_update(prop, NC_MATERIAL | ND_SHADING, "rna_LightProbe_recalc");
prop = RNA_def_property(srna, "invert_visibility_group", PROP_BOOLEAN, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_main.c b/source/blender/makesrna/intern/rna_main.c
index 6479826b7b3..d727b896223 100644
--- a/source/blender/makesrna/intern/rna_main.c
+++ b/source/blender/makesrna/intern/rna_main.c
@@ -209,10 +209,10 @@ static void rna_Main_sound_begin(CollectionPropertyIterator *iter, PointerRNA *p
rna_iterator_listbase_begin(iter, &bmain->sound, NULL);
}
-static void rna_Main_group_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
+static void rna_Main_collection_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
{
Main *bmain = (Main *)ptr->data;
- rna_iterator_listbase_begin(iter, &bmain->group, NULL);
+ rna_iterator_listbase_begin(iter, &bmain->collection, NULL);
}
static void rna_Main_armature_begin(CollectionPropertyIterator *iter, PointerRNA *ptr)
@@ -365,7 +365,7 @@ void RNA_def_main(BlenderRNA *brna)
{"textures", "Texture", "rna_Main_tex_begin", "Textures", "Texture data-blocks", RNA_def_main_textures},
{"brushes", "Brush", "rna_Main_brush_begin", "Brushes", "Brush data-blocks", RNA_def_main_brushes},
{"worlds", "World", "rna_Main_world_begin", "Worlds", "World data-blocks", RNA_def_main_worlds},
- {"groups", "Group", "rna_Main_group_begin", "Groups", "Group data-blocks", RNA_def_main_groups},
+ {"collections", "Collection", "rna_Main_collection_begin", "Collections", "Collection data-blocks", RNA_def_main_collections},
{"shape_keys", "Key", "rna_Main_key_begin", "Shape Keys", "Shape Key data-blocks", NULL},
{"texts", "Text", "rna_Main_text_begin", "Texts", "Text data-blocks", RNA_def_main_texts},
{"speakers", "Speaker", "rna_Main_speaker_begin", "Speakers", "Speaker data-blocks", RNA_def_main_speakers},
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index 41970a69c6c..56035f8239c 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -51,6 +51,7 @@
#include "BKE_main.h"
#include "BKE_camera.h"
+#include "BKE_collection.h"
#include "BKE_curve.h"
#include "BKE_DerivedMesh.h"
#include "BKE_displist.h"
@@ -69,7 +70,6 @@
#include "BKE_sound.h"
#include "BKE_text.h"
#include "BKE_action.h"
-#include "BKE_group.h"
#include "BKE_brush.h"
#include "BKE_lattice.h"
#include "BKE_mball.h"
@@ -443,12 +443,12 @@ static World *rna_Main_worlds_new(Main *bmain, const char *name)
return world;
}
-static Group *rna_Main_groups_new(Main *bmain, const char *name)
+static Collection *rna_Main_collections_new(Main *bmain, const char *name)
{
char safe_name[MAX_ID_NAME - 2];
rna_idname_validate(name, safe_name);
- return BKE_group_add(bmain, safe_name);
+ return BKE_collection_add(bmain, NULL, safe_name);
}
static Speaker *rna_Main_speakers_new(Main *bmain, const char *name)
@@ -618,7 +618,7 @@ RNA_MAIN_ID_TAG_FUNCS_DEF(fonts, vfont, ID_VF)
RNA_MAIN_ID_TAG_FUNCS_DEF(textures, tex, ID_TE)
RNA_MAIN_ID_TAG_FUNCS_DEF(brushes, brush, ID_BR)
RNA_MAIN_ID_TAG_FUNCS_DEF(worlds, world, ID_WO)
-RNA_MAIN_ID_TAG_FUNCS_DEF(groups, group, ID_GR)
+RNA_MAIN_ID_TAG_FUNCS_DEF(collections, collection, ID_GR)
//RNA_MAIN_ID_TAG_FUNCS_DEF(shape_keys, key, ID_KE)
RNA_MAIN_ID_TAG_FUNCS_DEF(texts, text, ID_TXT)
RNA_MAIN_ID_TAG_FUNCS_DEF(speakers, speaker, ID_SPK)
@@ -1272,7 +1272,7 @@ void RNA_def_main_textures(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_property_srna(cprop, "BlendDataTextures");
srna = RNA_def_struct(brna, "BlendDataTextures", NULL);
RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Textures", "Collection of groups");
+ RNA_def_struct_ui_text(srna, "Main Textures", "Collection of textures");
func = RNA_def_function(srna, "new", "rna_Main_textures_new");
RNA_def_function_ui_description(func, "Add a new texture to the main database");
@@ -1387,45 +1387,45 @@ void RNA_def_main_worlds(BlenderRNA *brna, PropertyRNA *cprop)
RNA_def_property_boolean_funcs(prop, "rna_Main_worlds_is_updated_get", NULL);
}
-void RNA_def_main_groups(BlenderRNA *brna, PropertyRNA *cprop)
+void RNA_def_main_collections(BlenderRNA *brna, PropertyRNA *cprop)
{
StructRNA *srna;
FunctionRNA *func;
PropertyRNA *parm;
PropertyRNA *prop;
- RNA_def_property_srna(cprop, "BlendDataGroups");
- srna = RNA_def_struct(brna, "BlendDataGroups", NULL);
+ RNA_def_property_srna(cprop, "BlendDataCollections");
+ srna = RNA_def_struct(brna, "BlendDataCollections", NULL);
RNA_def_struct_sdna(srna, "Main");
- RNA_def_struct_ui_text(srna, "Main Groups", "Collection of groups");
+ RNA_def_struct_ui_text(srna, "Main Collections", "Collection of collections");
- func = RNA_def_function(srna, "new", "rna_Main_groups_new");
- RNA_def_function_ui_description(func, "Add a new group to the main database");
- parm = RNA_def_string(func, "name", "Group", 0, "", "New name for the data-block");
+ func = RNA_def_function(srna, "new", "rna_Main_collections_new");
+ RNA_def_function_ui_description(func, "Add a new collection to the main database");
+ parm = RNA_def_string(func, "name", "Collection", 0, "", "New name for the data-block");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
/* return type */
- parm = RNA_def_pointer(func, "group", "Group", "", "New group data-block");
+ parm = RNA_def_pointer(func, "collection", "Collection", "", "New collection data-block");
RNA_def_function_return(func, parm);
func = RNA_def_function(srna, "remove", "rna_Main_ID_remove");
- RNA_def_function_ui_description(func, "Remove a group from the current blendfile");
+ RNA_def_function_ui_description(func, "Remove a collection from the current blendfile");
RNA_def_function_flag(func, FUNC_USE_REPORTS);
- parm = RNA_def_pointer(func, "group", "Group", "", "Group to remove");
+ parm = RNA_def_pointer(func, "collection", "Collection", "", "Collection to remove");
RNA_def_parameter_flags(parm, PROP_NEVER_NULL, PARM_REQUIRED | PARM_RNAPTR);
RNA_def_parameter_clear_flags(parm, PROP_THICK_WRAP, 0);
- RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this group before deleting it");
+ RNA_def_boolean(func, "do_unlink", true, "", "Unlink all usages of this collection before deleting it");
RNA_def_boolean(func, "do_id_user", true, "",
- "Decrement user counter of all datablocks used by this group");
+ "Decrement user counter of all datablocks used by this collection");
RNA_def_boolean(func, "do_ui_user", true, "",
- "Make sure interface does not reference this group");
+ "Make sure interface does not reference this collection");
- func = RNA_def_function(srna, "tag", "rna_Main_groups_tag");
+ func = RNA_def_function(srna, "tag", "rna_Main_collections_tag");
parm = RNA_def_boolean(func, "value", 0, "Value", "");
RNA_def_parameter_flags(parm, 0, PARM_REQUIRED);
prop = RNA_def_property(srna, "is_updated", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
- RNA_def_property_boolean_funcs(prop, "rna_Main_groups_is_updated_get", NULL);
+ RNA_def_property_boolean_funcs(prop, "rna_Main_collections_is_updated_get", NULL);
}
void RNA_def_main_speakers(BlenderRNA *brna, PropertyRNA *cprop)
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index f48bd5dc52e..d9074aed29e 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -42,10 +42,10 @@
#include "BLI_listbase.h"
#include "BKE_camera.h"
+#include "BKE_collection.h"
#include "BKE_paint.h"
#include "BKE_editlattice.h"
#include "BKE_editmesh.h"
-#include "BKE_group.h" /* needed for BKE_group_object_exists() */
#include "BKE_object_deform.h"
#include "BKE_object_facemap.h"
@@ -103,11 +103,11 @@ static const EnumPropertyItem parent_type_items[] = {
{OB_DUPLIVERTS, "VERTS", 0, "Verts", "Duplicate child objects on all vertices"}, \
{OB_DUPLIFACES, "FACES", 0, "Faces", "Duplicate child objects on all faces"}
-#define DUPLI_ITEM_GROUP \
- {OB_DUPLIGROUP, "GROUP", 0, "Group", "Enable group instancing"}
+#define DUPLI_ITEM_COLLECTION \
+ {OB_DUPLICOLLECTION, "COLLECTION", 0, "Collection", "Enable collection instancing"}
static const EnumPropertyItem dupli_items[] = {
DUPLI_ITEMS_SHARED,
- DUPLI_ITEM_GROUP,
+ DUPLI_ITEM_COLLECTION,
{0, NULL, 0, NULL, NULL}
};
#ifdef RNA_RUNTIME
@@ -117,7 +117,7 @@ static EnumPropertyItem dupli_items_nogroup[] = {
};
#endif
#undef DUPLI_ITEMS_SHARED
-#undef DUPLI_ITEM_GROUP
+#undef DUPLI_ITEM_COLLECTION
const EnumPropertyItem rna_enum_metaelem_type_items[] = {
{MB_BALL, "BALL", ICON_META_BALL, "Ball", ""},
@@ -474,12 +474,12 @@ static const EnumPropertyItem *rna_Object_dupli_type_itemf(
static void rna_Object_dup_group_set(PointerRNA *ptr, PointerRNA value)
{
Object *ob = (Object *)ptr->data;
- Group *grp = (Group *)value.data;
+ Collection *grp = (Collection *)value.data;
/* must not let this be set if the object belongs in this group already,
* thus causing a cycle/infinite-recursion leading to crashes on load [#25298]
*/
- if (BKE_group_object_exists(grp, ob) == 0) {
+ if (BKE_collection_has_object_recursive(grp, ob) == 0) {
if (ob->type == OB_EMPTY) {
id_us_min(&ob->dup_group->id);
ob->dup_group = grp;
@@ -1979,7 +1979,7 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Proxy", "Library object this proxy object controls");
prop = RNA_def_property(srna, "proxy_group", PROP_POINTER, PROP_NONE);
- RNA_def_property_ui_text(prop, "Proxy Group", "Library group duplicator object this proxy object controls");
+ RNA_def_property_ui_text(prop, "Proxy Collection", "Library collection duplicator object this proxy object controls");
/* materials */
prop = RNA_def_property(srna, "material_slots", PROP_COLLECTION, PROP_NONE);
@@ -2354,10 +2354,11 @@ static void rna_def_object(BlenderRNA *brna)
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_internal_update");
prop = RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Collection");
RNA_def_property_pointer_sdna(prop, NULL, "dup_group");
RNA_def_property_flag(prop, PROP_EDITABLE);
RNA_def_property_pointer_funcs(prop, NULL, "rna_Object_dup_group_set", NULL, NULL);
- RNA_def_property_ui_text(prop, "Dupli Group", "Instance an existing group");
+ RNA_def_property_ui_text(prop, "Dupli Collection", "Instance an existing collection");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, "rna_Object_dependency_update");
prop = RNA_def_property(srna, "dupli_frames_start", PROP_INT, PROP_NONE | PROP_UNIT_TIME);
diff --git a/source/blender/makesrna/intern/rna_object_force.c b/source/blender/makesrna/intern/rna_object_force.c
index 3a61accfad3..4c09f7cf4cf 100644
--- a/source/blender/makesrna/intern/rna_object_force.c
+++ b/source/blender/makesrna/intern/rna_object_force.c
@@ -976,8 +976,9 @@ static void rna_def_effector_weight(BlenderRNA *brna)
/* General */
prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Collection");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Effector Group", "Limit effectors to this Group");
+ RNA_def_property_ui_text(prop, "Effector Collection", "Limit effectors to this collection");
RNA_def_property_update(prop, 0, "rna_EffectorWeight_dependency_update");
prop = RNA_def_property(srna, "gravity", PROP_FLOAT, PROP_NONE);
@@ -1762,8 +1763,9 @@ static void rna_def_softbody(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_softbody_update");
prop = RNA_def_property(srna, "collision_group", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Collection");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Collision Group", "Limit colliders to this Group");
+ RNA_def_property_ui_text(prop, "Collision Collection", "Limit colliders to this collection");
RNA_def_property_update(prop, 0, "rna_softbody_dependency_update");
prop = RNA_def_property(srna, "effector_weights", PROP_POINTER, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index 2991d7a4860..cbd87fb0666 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -2731,8 +2731,9 @@ static void rna_def_particle_settings(BlenderRNA *brna)
RNA_def_property_update(prop, 0, "rna_Particle_reset");
prop = RNA_def_property(srna, "collision_group", PROP_POINTER, PROP_NONE);
+ RNA_def_property_struct_type(prop, "Collection");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Collision Group", "Limit colliders to this Group");
+ RNA_def_property_ui_text(prop, "Collision Collection", "Limit colliders to this collection");
RNA_def_property_update(prop, 0, "rna_Particle_reset_dependency");
/* global physical properties */
@@ -3044,9 +3045,9 @@ static void rna_def_particle_settings(BlenderRNA *brna)
/* draw objects & groups */
prop = RNA_def_property(srna, "dupli_group", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "dup_group");
- RNA_def_property_struct_type(prop, "Group");
+ RNA_def_property_struct_type(prop, "Collection");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Dupli Group", "Show Objects in this Group in place of particles");
+ RNA_def_property_ui_text(prop, "Dupli Collection", "Show Objects in this collection in place of particles");
RNA_def_property_update(prop, 0, "rna_Particle_redo");
prop = RNA_def_property(srna, "dupli_weights", PROP_COLLECTION, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_rigidbody.c b/source/blender/makesrna/intern/rna_rigidbody.c
index d252c04742f..0a8a99d779a 100644
--- a/source/blender/makesrna/intern/rna_rigidbody.c
+++ b/source/blender/makesrna/intern/rna_rigidbody.c
@@ -740,15 +740,15 @@ static void rna_def_rigidbody_world(BlenderRNA *brna)
/* groups */
prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Group");
+ RNA_def_property_struct_type(prop, "Collection");
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_ui_text(prop, "Group", "Group containing objects participating in this simulation");
+ RNA_def_property_ui_text(prop, "Collection", "Collection containing objects participating in this simulation");
RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset");
prop = RNA_def_property(srna, "constraints", PROP_POINTER, PROP_NONE);
- RNA_def_property_struct_type(prop, "Group");
+ RNA_def_property_struct_type(prop, "Collection");
RNA_def_property_flag(prop, PROP_EDITABLE | PROP_ID_SELF_CHECK);
- RNA_def_property_ui_text(prop, "Constraints", "Group containing rigid body constraint objects");
+ RNA_def_property_ui_text(prop, "Constraints", "Collection containing rigid body constraint objects");
RNA_def_property_update(prop, NC_SCENE, "rna_RigidBodyWorld_reset");
/* booleans */
@@ -999,7 +999,7 @@ static void rna_def_rigidbody_object(BlenderRNA *brna)
RNA_def_property_boolean_sdna(prop, NULL, "col_groups", 1);
RNA_def_property_array(prop, 20);
RNA_def_property_boolean_funcs(prop, NULL, "rna_RigidBodyOb_collision_groups_set");
- RNA_def_property_ui_text(prop, "Collision Groups", "Collision Groups Rigid Body belongs to");
+ RNA_def_property_ui_text(prop, "Collision Collections", "Collision collections rigid body belongs to");
RNA_def_property_update(prop, NC_OBJECT | ND_POINTCACHE, "rna_RigidBodyOb_reset");
RNA_def_property_flag(prop, PROP_LIB_EXCEPTION);
}
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 9331049780b..0fb44959515 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -1614,10 +1614,10 @@ static void object_simplify_update(Object *ob)
psys->recalc |= PSYS_RECALC_CHILD;
if (ob->dup_group) {
- GroupObject *gob;
+ CollectionObject *cob;
- for (gob = ob->dup_group->gobject.first; gob; gob = gob->next)
- object_simplify_update(gob->ob);
+ for (cob = ob->dup_group->gobject.first; cob; cob = cob->next)
+ object_simplify_update(cob->ob);
}
}
@@ -3645,16 +3645,16 @@ void rna_def_freestyle_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "group", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "group");
- RNA_def_property_struct_type(prop, "Group");
+ RNA_def_property_struct_type(prop, "Collection");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Group", "A group of objects based on which feature edges are selected");
+ RNA_def_property_ui_text(prop, "Collection", "A collection of objects based on which feature edges are selected");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
prop = RNA_def_property(srna, "group_negation", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_bitflag_sdna(prop, NULL, "flags");
RNA_def_property_enum_items(prop, group_negation_items);
- RNA_def_property_ui_text(prop, "Group Negation",
- "Specify either inclusion or exclusion of feature edges belonging to a group of objects");
+ RNA_def_property_ui_text(prop, "Collection Negation",
+ "Specify either inclusion or exclusion of feature edges belonging to a collection of objects");
RNA_def_property_update(prop, NC_SCENE | ND_RENDER_OPTIONS, "rna_Scene_freestyle_update");
prop = RNA_def_property(srna, "face_mark_negation", PROP_ENUM, PROP_NONE);
@@ -6609,11 +6609,11 @@ void RNA_def_scene(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "View Layers", "");
rna_def_view_layers(brna, prop);
- prop = RNA_def_property(srna, "master_collection", PROP_POINTER, PROP_NONE);
+ prop = RNA_def_property(srna, "collection", PROP_POINTER, PROP_NONE);
RNA_def_property_flag(prop, PROP_NEVER_NULL);
- RNA_def_property_pointer_sdna(prop, NULL, "collection");
- RNA_def_property_struct_type(prop, "SceneCollection");
- RNA_def_property_ui_text(prop, "Master Collection", "Collection that contains all other collections");
+ RNA_def_property_pointer_sdna(prop, NULL, "master_collection");
+ RNA_def_property_struct_type(prop, "Collection");
+ RNA_def_property_ui_text(prop, "Collection", "Scene master collection that objects and other collections in the scene");
/* Scene Display */
prop = RNA_def_property(srna, "display", PROP_POINTER, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_smoke.c b/source/blender/makesrna/intern/rna_smoke.c
index d5580ae35ad..af4ecb6dd7d 100644
--- a/source/blender/makesrna/intern/rna_smoke.c
+++ b/source/blender/makesrna/intern/rna_smoke.c
@@ -578,23 +578,23 @@ static void rna_def_smoke_domain_settings(BlenderRNA *brna)
prop = RNA_def_property(srna, "collision_group", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "coll_group");
- RNA_def_property_struct_type(prop, "Group");
+ RNA_def_property_struct_type(prop, "Collection");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Collision Group", "Limit collisions to this group");
+ RNA_def_property_ui_text(prop, "Collision Collection", "Limit collisions to this collection");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset_dependency");
prop = RNA_def_property(srna, "fluid_group", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "fluid_group");
- RNA_def_property_struct_type(prop, "Group");
+ RNA_def_property_struct_type(prop, "Collection");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Fluid Group", "Limit fluid objects to this group");
+ RNA_def_property_ui_text(prop, "Fluid Collection", "Limit fluid objects to this collection");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset_dependency");
prop = RNA_def_property(srna, "effector_group", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "eff_group");
- RNA_def_property_struct_type(prop, "Group");
+ RNA_def_property_struct_type(prop, "Collection");
RNA_def_property_flag(prop, PROP_EDITABLE);
- RNA_def_property_ui_text(prop, "Effector Group", "Limit effectors to this group");
+ RNA_def_property_ui_text(prop, "Effector Collection", "Limit effectors to this collection");
RNA_def_property_update(prop, NC_OBJECT | ND_MODIFIER, "rna_Smoke_reset_dependency");
prop = RNA_def_property(srna, "strength", PROP_FLOAT, PROP_NONE);
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 29a204963cb..e34989be5af 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -237,7 +237,6 @@ static const EnumPropertyItem buttons_context_items[] = {
{BCONTEXT_SCENE, "SCENE", ICON_SCENE_DATA, "Scene", "Scene"},
{BCONTEXT_RENDER, "RENDER", ICON_SCENE, "Render", "Render"},
{BCONTEXT_VIEW_LAYER, "VIEW_LAYER", ICON_RENDER_RESULT, "View Layer", "View layer"},
- {BCONTEXT_COLLECTION, "COLLECTION", ICON_COLLAPSEMENU, "Collection", "Collection"},
{BCONTEXT_WORLD, "WORLD", ICON_WORLD, "World", "World"},
{BCONTEXT_OBJECT, "OBJECT", ICON_OBJECT_DATA, "Object", "Object"},
{BCONTEXT_CONSTRAINT, "CONSTRAINT", ICON_CONSTRAINT, "Constraints", "Object constraints"},
@@ -253,12 +252,6 @@ static const EnumPropertyItem buttons_context_items[] = {
{0, NULL, 0, NULL, NULL}
};
-static const EnumPropertyItem buttons_collection_context_items[] = {
- {SB_COLLECTION_CTX_VIEW_LAYER, "VIEW_LAYER", ICON_RENDER_RESULT, "", "Show material textures"},
- {SB_COLLECTION_CTX_GROUP, "GROUP", ICON_GROUP, "", "Show world textures"},
- {0, NULL, 0, NULL, NULL}
-};
-
static const EnumPropertyItem fileselectparams_recursion_level_items[] = {
{0, "NONE", 0, "None", "Only list current directory's content, with no recursion"},
{1, "BLEND", 0, "Blend File", "List .blend files' content"},
@@ -1141,10 +1134,6 @@ static const EnumPropertyItem *rna_SpaceProperties_context_itemf(
RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_WORKSPACE);
}
- if (sbuts->pathflag & (1 << BCONTEXT_COLLECTION)) {
- RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_COLLECTION);
- }
-
if (sbuts->pathflag & (1 << BCONTEXT_OBJECT)) {
RNA_enum_items_add_value(&item, &totitem, buttons_context_items, BCONTEXT_OBJECT);
}
@@ -2092,9 +2081,8 @@ static void rna_def_space_outliner(BlenderRNA *brna)
PropertyRNA *prop;
static const EnumPropertyItem display_mode_items[] = {
- {SO_COLLECTIONS, "COLLECTIONS", 0, "Collections", "Display collections in the view layer"},
{SO_SCENES, "SCENES", 0, "Scenes", "Display scenes and their view layers, collections and objects"},
- {SO_GROUPS, "GROUPS", 0, "Groups", "Display groups and their data-blocks"},
+ {SO_VIEW_LAYER, "VIEW_LAYER", 0, "View Layer", "Display collections and objects in the view layer"},
{SO_SEQUENCE, "SEQUENCE", 0, "Sequence", "Display sequence data-blocks"},
{SO_LIBRARIES, "LIBRARIES", 0, "Blender File", "Display data of current file and linked libraries"},
{SO_DATA_API, "DATA_API", 0, "Data API", "Display low level Blender data and its properties"},
@@ -2104,11 +2092,10 @@ static void rna_def_space_outliner(BlenderRNA *brna)
};
static const EnumPropertyItem filter_state_items[] = {
- {SO_FILTER_OB_NONE, "NONE", 0, "No Objects", "Don't show objects"},
- {SO_FILTER_OB_ALL, "ALL", 0, "All Objects", "Show visible objects"},
- {SO_FILTER_OB_VISIBLE, "VISIBLE", 0, "Visible Objects", "Show visible objects"},
- {SO_FILTER_OB_SELECTED, "SELECTED", 0, "Selected Objects", "Show selected objects"},
- {SO_FILTER_OB_ACTIVE, "ACTIVE", 0, "Active Object", "Show only the active object"},
+ {SO_FILTER_OB_ALL, "ALL", 0, "All", "Show all objects in the view layer"},
+ {SO_FILTER_OB_VISIBLE, "VISIBLE", 0, "Visible", "Show visible objects"},
+ {SO_FILTER_OB_SELECTED, "SELECTED", 0, "Selected", "Show selected objects"},
+ {SO_FILTER_OB_ACTIVE, "ACTIVE", 0, "Active", "Show only the active object"},
{0, NULL, 0, NULL, NULL}
};
@@ -2158,6 +2145,11 @@ static void rna_def_space_outliner(BlenderRNA *brna)
RNA_def_property_ui_icon(prop, ICON_VIEWZOOM, 0);
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
+ prop = RNA_def_property(srna, "use_filter_object", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OBJECT);
+ RNA_def_property_ui_text(prop, "Filter Objects", "Show objects");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_OUTLINER, NULL);
+
prop = RNA_def_property(srna, "use_filter_object_content", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "filter", SO_FILTER_NO_OB_CONTENT);
RNA_def_property_ui_text(prop, "Show Object Contents", "Show what is inside the objects elements");
@@ -2949,11 +2941,6 @@ static void rna_def_space_buttons(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Align", "Arrangement of the panels");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_PROPERTIES, NULL);
- prop = RNA_def_property(srna, "collection_context", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_items(prop, buttons_collection_context_items);
- RNA_def_property_ui_text(prop, "Collection Context", "Which collection we want to show");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_PROPERTIES, NULL);
-
/* pinned data */
prop = RNA_def_property(srna, "pin_id", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "pinid");