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:
Diffstat (limited to 'source/blender/blenloader/intern/versioning_280.c')
-rw-r--r--source/blender/blenloader/intern/versioning_280.c67
1 files changed, 19 insertions, 48 deletions
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index af05c4b902f..9d65488e8d4 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -111,40 +111,13 @@
#include "BLO_readfile.h"
#include "readfile.h"
+#include "versioning_common.h"
+
#include "MEM_guardedalloc.h"
/* Make preferences read-only, use versioning_userdef.c. */
#define U (*((const UserDef *)&U))
-/**
- * Rename if the ID doesn't exist.
- */
-static ID *rename_id_for_versioning(Main *bmain,
- const short id_type,
- const char *name_src,
- const char *name_dst)
-{
- /* We can ignore libraries */
- ListBase *lb = which_libbase(bmain, id_type);
- ID *id = NULL;
- LISTBASE_FOREACH (ID *, idtest, lb) {
- if (idtest->lib == NULL) {
- if (STREQ(idtest->name + 2, name_src)) {
- id = idtest;
- }
- if (STREQ(idtest->name + 2, name_dst)) {
- return NULL;
- }
- }
- }
- if (id != NULL) {
- BLI_strncpy(id->name + 2, name_dst, sizeof(id->name) - 2);
- /* We know it's unique, this just sorts. */
- BLI_libblock_ensure_unique_name(bmain, id->name);
- }
- return id;
-}
-
static bScreen *screen_parent_find(const bScreen *screen)
{
/* Can avoid lookup if screen state isn't maximized/full
@@ -348,7 +321,7 @@ static void do_version_layer_collection_post(ViewLayer *view_layer,
lc->flag |= LAYER_COLLECTION_EXCLUDE;
}
if (enabled && !selectable) {
- lc->collection->flag |= COLLECTION_RESTRICT_SELECT;
+ lc->collection->flag |= COLLECTION_HIDE_SELECT;
}
}
@@ -477,7 +450,7 @@ static void do_version_layers_to_collections(Main *bmain, Scene *scene)
collections[layer] = collection;
if (!(scene->lay & (1 << layer))) {
- collection->flag |= COLLECTION_RESTRICT_VIEWPORT | COLLECTION_RESTRICT_RENDER;
+ collection->flag |= COLLECTION_HIDE_VIEWPORT | COLLECTION_HIDE_RENDER;
}
}
@@ -1225,7 +1198,7 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports))
/* Add fake user for all existing groups. */
id_fake_user_set(&collection->id);
- if (collection->flag & (COLLECTION_RESTRICT_VIEWPORT | COLLECTION_RESTRICT_RENDER)) {
+ if (collection->flag & (COLLECTION_HIDE_VIEWPORT | COLLECTION_HIDE_RENDER)) {
continue;
}
@@ -1256,8 +1229,7 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports))
char name[MAX_ID_NAME];
BLI_snprintf(name, sizeof(name), DATA_("Hidden %d"), coll_idx + 1);
*collection_hidden = BKE_collection_add(bmain, collection, name);
- (*collection_hidden)->flag |= COLLECTION_RESTRICT_VIEWPORT |
- COLLECTION_RESTRICT_RENDER;
+ (*collection_hidden)->flag |= COLLECTION_HIDE_VIEWPORT | COLLECTION_HIDE_RENDER;
}
BKE_collection_object_add(bmain, *collection_hidden, ob);
@@ -1679,32 +1651,32 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports))
Brush *brush;
Material *ma;
/* Pen Soft brush. */
- brush = (Brush *)rename_id_for_versioning(bmain, ID_BR, "Draw Soft", "Pencil Soft");
+ brush = (Brush *)do_versions_rename_id(bmain, ID_BR, "Draw Soft", "Pencil Soft");
if (brush) {
brush->gpencil_settings->icon_id = GP_BRUSH_ICON_PEN;
}
- rename_id_for_versioning(bmain, ID_BR, "Draw Pencil", "Pencil");
- rename_id_for_versioning(bmain, ID_BR, "Draw Pen", "Pen");
- rename_id_for_versioning(bmain, ID_BR, "Draw Ink", "Ink Pen");
- rename_id_for_versioning(bmain, ID_BR, "Draw Noise", "Ink Pen Rough");
- rename_id_for_versioning(bmain, ID_BR, "Draw Marker", "Marker Bold");
- rename_id_for_versioning(bmain, ID_BR, "Draw Block", "Marker Chisel");
+ do_versions_rename_id(bmain, ID_BR, "Draw Pencil", "Pencil");
+ do_versions_rename_id(bmain, ID_BR, "Draw Pen", "Pen");
+ do_versions_rename_id(bmain, ID_BR, "Draw Ink", "Ink Pen");
+ do_versions_rename_id(bmain, ID_BR, "Draw Noise", "Ink Pen Rough");
+ do_versions_rename_id(bmain, ID_BR, "Draw Marker", "Marker Bold");
+ do_versions_rename_id(bmain, ID_BR, "Draw Block", "Marker Chisel");
ma = BLI_findstring(&bmain->materials, "Black", offsetof(ID, name) + 2);
if (ma && ma->gp_style) {
- rename_id_for_versioning(bmain, ID_MA, "Black", "Solid Stroke");
+ do_versions_rename_id(bmain, ID_MA, "Black", "Solid Stroke");
}
ma = BLI_findstring(&bmain->materials, "Red", offsetof(ID, name) + 2);
if (ma && ma->gp_style) {
- rename_id_for_versioning(bmain, ID_MA, "Red", "Squares Stroke");
+ do_versions_rename_id(bmain, ID_MA, "Red", "Squares Stroke");
}
ma = BLI_findstring(&bmain->materials, "Grey", offsetof(ID, name) + 2);
if (ma && ma->gp_style) {
- rename_id_for_versioning(bmain, ID_MA, "Grey", "Solid Fill");
+ do_versions_rename_id(bmain, ID_MA, "Grey", "Solid Fill");
}
ma = BLI_findstring(&bmain->materials, "Black Dots", offsetof(ID, name) + 2);
if (ma && ma->gp_style) {
- rename_id_for_versioning(bmain, ID_MA, "Black Dots", "Dots Stroke");
+ do_versions_rename_id(bmain, ID_MA, "Black Dots", "Dots Stroke");
}
brush = BLI_findstring(&bmain->brushes, "Pencil", offsetof(ID, name) + 2);
@@ -4110,9 +4082,8 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 280, 75)) {
for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
if (scene->master_collection != NULL) {
- scene->master_collection->flag &= ~(COLLECTION_RESTRICT_VIEWPORT |
- COLLECTION_RESTRICT_SELECT |
- COLLECTION_RESTRICT_RENDER);
+ scene->master_collection->flag &= ~(COLLECTION_HIDE_VIEWPORT | COLLECTION_HIDE_SELECT |
+ COLLECTION_HIDE_RENDER);
}
UnitSettings *unit = &scene->unit;