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.
This commit is contained in:
@@ -33,7 +33,6 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TODO_LAYER_SYNC_FILTER /* syncing of filter_objects across all trees */
|
|
||||||
#define TODO_LAYER_OVERRIDE /* CollectionOverride */
|
#define TODO_LAYER_OVERRIDE /* CollectionOverride */
|
||||||
#define TODO_LAYER_OPERATORS /* collection mamanger and property panel operators */
|
#define TODO_LAYER_OPERATORS /* collection mamanger and property panel operators */
|
||||||
#define TODO_LAYER /* generic todo */
|
#define TODO_LAYER /* generic todo */
|
||||||
|
|||||||
@@ -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) {
|
for (LinkData *link = sc->objects.first; link; link = link->next) {
|
||||||
id_us_min(link->data);
|
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->objects);
|
||||||
BLI_freelistN(&sc->filter_objects);
|
|
||||||
|
|
||||||
for (SceneCollection *nsc = sc->scene_collections.first; nsc; nsc = nsc->next) {
|
for (SceneCollection *nsc = sc->scene_collections.first; nsc; nsc = nsc->next) {
|
||||||
collection_free(nsc, do_id_user);
|
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);
|
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;
|
for (SceneCollection *nsc_src = sc_src->scene_collections.first, *nsc_dst = sc_dst->scene_collections.first;
|
||||||
nsc_src;
|
nsc_src;
|
||||||
@@ -404,7 +393,6 @@ bool BKE_collection_object_remove(Main *bmain, ID *owner_id, SceneCollection *sc
|
|||||||
BLI_remlink(&sc->objects, link);
|
BLI_remlink(&sc->objects, link);
|
||||||
MEM_freeN(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);
|
BKE_layer_sync_object_unlink(owner_id, sc, ob);
|
||||||
|
|
||||||
if (GS(owner_id->name) == ID_SCE) {
|
if (GS(owner_id->name) == ID_SCE) {
|
||||||
|
|||||||
@@ -1042,9 +1042,7 @@ static void layer_collection_object_add(ViewLayer *view_layer, LayerCollection *
|
|||||||
{
|
{
|
||||||
Base *base = object_base_add(view_layer, ob);
|
Base *base = object_base_add(view_layer, ob);
|
||||||
|
|
||||||
/* Only add an object once - prevent SceneCollection->objects and
|
/* Only add an object once. */
|
||||||
* SceneCollection->filter_objects to add the same object. */
|
|
||||||
|
|
||||||
if (BLI_findptr(&lc->object_bases, base, offsetof(LinkData, data))) {
|
if (BLI_findptr(&lc->object_bases, base, offsetof(LinkData, data))) {
|
||||||
return;
|
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)
|
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->objects);
|
||||||
layer_collection_objects_populate(view_layer, lc, &sc->filter_objects);
|
|
||||||
|
|
||||||
for (SceneCollection *nsc = sc->scene_collections.first; nsc; nsc = nsc->next) {
|
for (SceneCollection *nsc = sc->scene_collections.first; nsc; nsc = nsc->next) {
|
||||||
layer_collection_add(view_layer, lc, nsc);
|
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
|
* 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)
|
void BKE_layer_sync_object_unlink(const ID *owner_id, SceneCollection *sc, Object *ob)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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) {
|
for (LinkData *link = sc->objects.first; link; link = link->next) {
|
||||||
CALLBACK_INVOKE_ID(link->data, IDWALK_CB_USER);
|
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
|
FOREACH_SCENE_COLLECTION_END
|
||||||
|
|
||||||
|
|||||||
@@ -5850,11 +5850,6 @@ static void lib_link_scene_collection(FileData *fd, Library *lib, SceneCollectio
|
|||||||
BLI_assert(link->data);
|
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) {
|
for (SceneCollection *nsc = sc->scene_collections.first; nsc; nsc = nsc->next) {
|
||||||
lib_link_scene_collection(fd, lib, nsc);
|
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)
|
static void direct_link_scene_collection(FileData *fd, SceneCollection *sc)
|
||||||
{
|
{
|
||||||
link_list(fd, &sc->objects);
|
link_list(fd, &sc->objects);
|
||||||
link_list(fd, &sc->filter_objects);
|
|
||||||
link_list(fd, &sc->scene_collections);
|
link_list(fd, &sc->scene_collections);
|
||||||
|
|
||||||
for (SceneCollection *nsc = sc->scene_collections.first; nsc; nsc = nsc->next) {
|
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);
|
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) {
|
for (SceneCollection *nsc= sc->scene_collections.first; nsc; nsc = nsc->next) {
|
||||||
expand_scene_collection(fd, mainvar, nsc);
|
expand_scene_collection(fd, mainvar, nsc);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2594,7 +2594,6 @@ static void write_scene_collection(WriteData *wd, SceneCollection *sc)
|
|||||||
writestruct(wd, DATA, SceneCollection, 1, sc);
|
writestruct(wd, DATA, SceneCollection, 1, sc);
|
||||||
|
|
||||||
writelist(wd, DATA, LinkData, &sc->objects);
|
writelist(wd, DATA, LinkData, &sc->objects);
|
||||||
writelist(wd, DATA, LinkData, &sc->filter_objects);
|
|
||||||
|
|
||||||
for (SceneCollection *nsc = sc->scene_collections.first; nsc; nsc = nsc->next) {
|
for (SceneCollection *nsc = sc->scene_collections.first; nsc; nsc = nsc->next) {
|
||||||
write_scene_collection(wd, nsc);
|
write_scene_collection(wd, nsc);
|
||||||
|
|||||||
@@ -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) {
|
for (SceneCollection *nsc = sc->scene_collections.first; nsc; nsc = nsc->next) {
|
||||||
single_object_users_scene_collection(bmain, scene, nsc, flag, copy_groups);
|
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);
|
libblock_relink_scene_collection(msc);
|
||||||
|
|
||||||
set_sca_new_poins();
|
set_sca_new_poins();
|
||||||
|
|
||||||
/* TODO redo filter */
|
|
||||||
TODO_LAYER_SYNC_FILTER
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* not an especially efficient function, only added so the single user
|
/* not an especially efficient function, only added so the single user
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ typedef struct LayerCollection {
|
|||||||
/* TODO(sergey): Get rid of this once we've got CoW in DEG, */
|
/* TODO(sergey): Get rid of this once we've got CoW in DEG, */
|
||||||
short flag_evaluated;
|
short flag_evaluated;
|
||||||
short pad[2];
|
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 overrides;
|
||||||
ListBase layer_collections; /* synced with collection->collections */
|
ListBase layer_collections; /* synced with collection->collections */
|
||||||
struct IDProperty *properties; /* overrides */
|
struct IDProperty *properties; /* overrides */
|
||||||
@@ -102,12 +102,10 @@ typedef struct ViewLayer {
|
|||||||
typedef struct SceneCollection {
|
typedef struct SceneCollection {
|
||||||
struct SceneCollection *next, *prev;
|
struct SceneCollection *next, *prev;
|
||||||
char name[64]; /* MAX_NAME */
|
char name[64]; /* MAX_NAME */
|
||||||
char filter[64]; /* MAX_NAME */
|
|
||||||
int active_object_index; /* for UI */
|
int active_object_index; /* for UI */
|
||||||
char type;
|
char type;
|
||||||
char pad[3];
|
char pad[3];
|
||||||
ListBase objects; /* (Object *)LinkData->data */
|
ListBase objects; /* (Object *)LinkData->data */
|
||||||
ListBase filter_objects; /* (Object *)LinkData->data */
|
|
||||||
ListBase scene_collections; /* nested collections */
|
ListBase scene_collections; /* nested collections */
|
||||||
} SceneCollection;
|
} SceneCollection;
|
||||||
|
|
||||||
|
|||||||
@@ -97,16 +97,6 @@ static void rna_SceneCollection_name_set(PointerRNA *ptr, const char *value)
|
|||||||
BKE_collection_rename(scene, sc, 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)
|
static PointerRNA rna_SceneCollection_objects_get(CollectionPropertyIterator *iter)
|
||||||
{
|
{
|
||||||
ListBaseIterator *internal = &iter->internal.listbase;
|
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_ui_text(prop, "Type", "Type of collection");
|
||||||
RNA_def_property_clear_flag(prop, PROP_EDITABLE);
|
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);
|
prop = RNA_def_property(srna, "collections", PROP_COLLECTION, PROP_NONE);
|
||||||
RNA_def_property_collection_sdna(prop, NULL, "scene_collections", NULL);
|
RNA_def_property_collection_sdna(prop, NULL, "scene_collections", NULL);
|
||||||
RNA_def_property_struct_type(prop, "SceneCollection");
|
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_property_ui_text(prop, "Objects", "All the objects directly added to this collection (not including sub-collection objects)");
|
||||||
rna_def_collection_objects(brna, prop);
|
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 */
|
/* Functions */
|
||||||
func = RNA_def_function(srna, "move_above", "rna_SceneCollection_move_above");
|
func = RNA_def_function(srna, "move_above", "rna_SceneCollection_move_above");
|
||||||
RNA_def_function_ui_description(func, "Move collection after another");
|
RNA_def_function_ui_description(func, "Move collection after another");
|
||||||
|
|||||||
Reference in New Issue
Block a user