Collections/Layer cleanup: Remove all reference to filter objects
authorDalai Felinto <dfelinto@gmail.com>
Mon, 22 Jan 2018 14:33:57 +0000 (12:33 -0200)
committerDalai Felinto <dfelinto@gmail.com>
Mon, 22 Jan 2018 14:43:19 +0000 (12:43 -0200)
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
source/blender/blenkernel/intern/collection.c
source/blender/blenkernel/intern/layer.c
source/blender/blenkernel/intern/library_query.c
source/blender/blenloader/intern/readfile.c
source/blender/blenloader/intern/writefile.c
source/blender/editors/object/object_relations.c
source/blender/makesdna/DNA_layer_types.h
source/blender/makesrna/intern/rna_layer.c

index 77f760a78433c954538f617e2f38de752900122c..b605b208f66183724d71d092eafaf0ee7052cbe3 100644 (file)
@@ -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 */
index edd29f793ecc4f2233003c4c52f80493c353bcec..ca77969ccaae554db68b266883bbed8335b2bf59 100644 (file)
@@ -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) {
index c63cefbcd8c3fb83ba74b2187ec02f47dc6d84eb..9922f772e28123541e3df1b969e60f72ba038626 100644 (file)
@@ -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)
 {
index 317f743acf16238d36ee9bbed31b0ba2e30fafe5..6c5931263d8be1219e513dd50ad7f912749e7623 100644 (file)
@@ -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
 
index 87f8b568023a6bc258473eec507ea627334ce90f..2cb799d39b90225f506740a82ff51498883af1e5 100644 (file)
@@ -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);
        }
index dffbb88f7082c5e3521886355fc5dce750f81f56..80d77870614099bbcf3dd3e6b998fc9e6ebb5ed3 100644 (file)
@@ -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);
index 1bf605408f15a897990d6a736b257e6b84edd11b..589b54cd3c0fb1b0fe4deea8bb9c8f41c3cd28f4 100644 (file)
@@ -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
index ff81e04c5a107df2cbf25ebb13bbcaa6dc1abff0..806c1ca76fcd5ca7cf83ef304a80da9d1ed8817b 100644 (file)
@@ -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;
 
index 184c5f5c63686f776e4839d9e221a8bb4d62e17a..47f5d037d092449725f18333fa3880772474cc2a 100644 (file)
@@ -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");