From 76289613910073ab4a2273d96e1b92999ed838b1 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Mon, 22 Jan 2018 12:33:57 -0200 Subject: Collections/Layer cleanup: Remove all reference to filter objects This was not implemented yet. So it's a bit pointless to have all this placeholder code around without any functionality coming out of it. --- source/blender/blenkernel/BKE_layer.h | 1 - source/blender/blenkernel/intern/collection.c | 12 ------------ source/blender/blenkernel/intern/layer.c | 6 +----- source/blender/blenkernel/intern/library_query.c | 4 ---- source/blender/blenloader/intern/readfile.c | 10 ---------- source/blender/blenloader/intern/writefile.c | 1 - source/blender/editors/object/object_relations.c | 6 ------ source/blender/makesdna/DNA_layer_types.h | 4 +--- source/blender/makesrna/intern/rna_layer.c | 21 --------------------- 9 files changed, 2 insertions(+), 63 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/BKE_layer.h b/source/blender/blenkernel/BKE_layer.h index 77f760a7843..b605b208f66 100644 --- a/source/blender/blenkernel/BKE_layer.h +++ b/source/blender/blenkernel/BKE_layer.h @@ -33,7 +33,6 @@ extern "C" { #endif -#define TODO_LAYER_SYNC_FILTER /* syncing of filter_objects across all trees */ #define TODO_LAYER_OVERRIDE /* CollectionOverride */ #define TODO_LAYER_OPERATORS /* collection mamanger and property panel operators */ #define TODO_LAYER /* generic todo */ diff --git a/source/blender/blenkernel/intern/collection.c b/source/blender/blenkernel/intern/collection.c index edd29f793ec..ca77969ccaa 100644 --- a/source/blender/blenkernel/intern/collection.c +++ b/source/blender/blenkernel/intern/collection.c @@ -117,13 +117,9 @@ static void collection_free(SceneCollection *sc, const bool do_id_user) for (LinkData *link = sc->objects.first; link; link = link->next) { id_us_min(link->data); } - for (LinkData *link = sc->filter_objects.first; link; link = link->next) { - id_us_min(link->data); - } } BLI_freelistN(&sc->objects); - BLI_freelistN(&sc->filter_objects); for (SceneCollection *nsc = sc->scene_collections.first; nsc; nsc = nsc->next) { collection_free(nsc, do_id_user); @@ -265,13 +261,6 @@ void BKE_collection_copy_data(SceneCollection *sc_dst, SceneCollection *sc_src, } } - BLI_duplicatelist(&sc_dst->filter_objects, &sc_src->filter_objects); - if ((flag & LIB_ID_CREATE_NO_USER_REFCOUNT) == 0) { - for (LinkData *link = sc_dst->filter_objects.first; link; link = link->next) { - id_us_plus(link->data); - } - } - BLI_duplicatelist(&sc_dst->scene_collections, &sc_src->scene_collections); for (SceneCollection *nsc_src = sc_src->scene_collections.first, *nsc_dst = sc_dst->scene_collections.first; nsc_src; @@ -404,7 +393,6 @@ bool BKE_collection_object_remove(Main *bmain, ID *owner_id, SceneCollection *sc BLI_remlink(&sc->objects, link); MEM_freeN(link); - TODO_LAYER_SYNC_FILTER; /* need to remove all instances of ob in scene collections -> filter_objects */ BKE_layer_sync_object_unlink(owner_id, sc, ob); if (GS(owner_id->name) == ID_SCE) { diff --git a/source/blender/blenkernel/intern/layer.c b/source/blender/blenkernel/intern/layer.c index c63cefbcd8c..9922f772e28 100644 --- a/source/blender/blenkernel/intern/layer.c +++ b/source/blender/blenkernel/intern/layer.c @@ -1042,9 +1042,7 @@ static void layer_collection_object_add(ViewLayer *view_layer, LayerCollection * { Base *base = object_base_add(view_layer, ob); - /* Only add an object once - prevent SceneCollection->objects and - * SceneCollection->filter_objects to add the same object. */ - + /* Only add an object once. */ if (BLI_findptr(&lc->object_bases, base, offsetof(LinkData, data))) { return; } @@ -1085,7 +1083,6 @@ static void layer_collection_objects_populate(ViewLayer *view_layer, LayerCollec static void layer_collection_populate(ViewLayer *view_layer, LayerCollection *lc, SceneCollection *sc) { layer_collection_objects_populate(view_layer, lc, &sc->objects); - layer_collection_objects_populate(view_layer, lc, &sc->filter_objects); for (SceneCollection *nsc = sc->scene_collections.first; nsc; nsc = nsc->next) { layer_collection_add(view_layer, lc, nsc); @@ -1195,7 +1192,6 @@ void BKE_layer_sync_object_link(const ID *owner_id, SceneCollection *sc, Object /** * Remove the equivalent object base to all layers that have this collection - * also remove all reference to ob in the filter_objects */ void BKE_layer_sync_object_unlink(const ID *owner_id, SceneCollection *sc, Object *ob) { diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c index 317f743acf1..6c5931263d8 100644 --- a/source/blender/blenkernel/intern/library_query.c +++ b/source/blender/blenkernel/intern/library_query.c @@ -449,10 +449,6 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call for (LinkData *link = sc->objects.first; link; link = link->next) { CALLBACK_INVOKE_ID(link->data, IDWALK_CB_USER); } - - for (LinkData *link = sc->filter_objects.first; link; link = link->next) { - CALLBACK_INVOKE_ID(link->data, IDWALK_CB_USER); - } } FOREACH_SCENE_COLLECTION_END diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 87f8b568023..2cb799d39b9 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -5850,11 +5850,6 @@ static void lib_link_scene_collection(FileData *fd, Library *lib, SceneCollectio BLI_assert(link->data); } - for (LinkData *link = sc->filter_objects.first; link; link = link->next) { - link->data = newlibadr_us(fd, lib, link->data); - BLI_assert(link->data); - } - for (SceneCollection *nsc = sc->scene_collections.first; nsc; nsc = nsc->next) { lib_link_scene_collection(fd, lib, nsc); } @@ -6139,7 +6134,6 @@ static void direct_link_view_settings(FileData *fd, ColorManagedViewSettings *vi static void direct_link_scene_collection(FileData *fd, SceneCollection *sc) { link_list(fd, &sc->objects); - link_list(fd, &sc->filter_objects); link_list(fd, &sc->scene_collections); for (SceneCollection *nsc = sc->scene_collections.first; nsc; nsc = nsc->next) { @@ -9917,10 +9911,6 @@ static void expand_scene_collection(FileData *fd, Main *mainvar, SceneCollection expand_doit(fd, mainvar, link->data); } - for (LinkData *link = sc->filter_objects.first; link; link = link->next) { - expand_doit(fd, mainvar, link->data); - } - for (SceneCollection *nsc= sc->scene_collections.first; nsc; nsc = nsc->next) { expand_scene_collection(fd, mainvar, nsc); } diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index dffbb88f708..80d77870614 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2594,7 +2594,6 @@ static void write_scene_collection(WriteData *wd, SceneCollection *sc) writestruct(wd, DATA, SceneCollection, 1, sc); writelist(wd, DATA, LinkData, &sc->objects); - writelist(wd, DATA, LinkData, &sc->filter_objects); for (SceneCollection *nsc = sc->scene_collections.first; nsc; nsc = nsc->next) { write_scene_collection(wd, nsc); diff --git a/source/blender/editors/object/object_relations.c b/source/blender/editors/object/object_relations.c index 1bf605408f1..589b54cd3c0 100644 --- a/source/blender/editors/object/object_relations.c +++ b/source/blender/editors/object/object_relations.c @@ -1678,9 +1678,6 @@ static void single_object_users_scene_collection(Main *bmain, Scene *scene, Scen } } - /* we reset filter objects because they should be regenerated after this */ - BLI_freelistN(&sc->filter_objects); - for (SceneCollection *nsc = sc->scene_collections.first; nsc; nsc = nsc->next) { single_object_users_scene_collection(bmain, scene, nsc, flag, copy_groups); } @@ -1740,9 +1737,6 @@ static void single_object_users(Main *bmain, Scene *scene, View3D *v3d, const in libblock_relink_scene_collection(msc); set_sca_new_poins(); - - /* TODO redo filter */ - TODO_LAYER_SYNC_FILTER } /* not an especially efficient function, only added so the single user diff --git a/source/blender/makesdna/DNA_layer_types.h b/source/blender/makesdna/DNA_layer_types.h index ff81e04c5a1..806c1ca76fc 100644 --- a/source/blender/makesdna/DNA_layer_types.h +++ b/source/blender/makesdna/DNA_layer_types.h @@ -65,7 +65,7 @@ typedef struct LayerCollection { /* TODO(sergey): Get rid of this once we've got CoW in DEG, */ short flag_evaluated; short pad[2]; - ListBase object_bases; /* (ObjectBase *)LinkData->data - synced with collection->objects and collection->filter_objects */ + ListBase object_bases; /* (ObjectBase *)LinkData->data - synced with collection->objects */ ListBase overrides; ListBase layer_collections; /* synced with collection->collections */ struct IDProperty *properties; /* overrides */ @@ -102,12 +102,10 @@ typedef struct ViewLayer { typedef struct SceneCollection { struct SceneCollection *next, *prev; char name[64]; /* MAX_NAME */ - char filter[64]; /* MAX_NAME */ int active_object_index; /* for UI */ char type; char pad[3]; ListBase objects; /* (Object *)LinkData->data */ - ListBase filter_objects; /* (Object *)LinkData->data */ ListBase scene_collections; /* nested collections */ } SceneCollection; diff --git a/source/blender/makesrna/intern/rna_layer.c b/source/blender/makesrna/intern/rna_layer.c index 184c5f5c636..47f5d037d09 100644 --- a/source/blender/makesrna/intern/rna_layer.c +++ b/source/blender/makesrna/intern/rna_layer.c @@ -97,16 +97,6 @@ static void rna_SceneCollection_name_set(PointerRNA *ptr, const char *value) BKE_collection_rename(scene, sc, value); } -static void rna_SceneCollection_filter_set(PointerRNA *ptr, const char *value) -{ - Scene *scene = (Scene *)ptr->id.data; - SceneCollection *sc = (SceneCollection *)ptr->data; - BLI_strncpy_utf8(sc->filter, value, sizeof(sc->filter)); - - TODO_LAYER_SYNC_FILTER; - (void)scene; -} - static PointerRNA rna_SceneCollection_objects_get(CollectionPropertyIterator *iter) { ListBaseIterator *internal = &iter->internal.listbase; @@ -1055,11 +1045,6 @@ static void rna_def_scene_collection(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Type", "Type of collection"); RNA_def_property_clear_flag(prop, PROP_EDITABLE); - prop = RNA_def_property(srna, "filter", PROP_STRING, PROP_NONE); - RNA_def_property_string_funcs(prop, NULL, NULL, "rna_SceneCollection_filter_set"); - RNA_def_property_ui_text(prop, "Filter", "Filter to dynamically include objects based on their names (e.g., CHAR_*)"); - RNA_def_property_update(prop, NC_SCENE | ND_LAYER_CONTENT, NULL); - 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"); @@ -1073,12 +1058,6 @@ static void rna_def_scene_collection(BlenderRNA *brna) 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); - prop = RNA_def_property(srna, "filters_objects", PROP_COLLECTION, PROP_NONE); - RNA_def_property_collection_sdna(prop, NULL, "filter_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, "Filter Objects", "All the objects dynamically added to this collection via the filter"); - /* Functions */ func = RNA_def_function(srna, "move_above", "rna_SceneCollection_move_above"); RNA_def_function_ui_description(func, "Move collection after another"); -- cgit v1.2.3