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:
authorAntonio Vazquez <blendergit@gmail.com>2020-04-18 14:15:51 +0300
committerAntonio Vazquez <blendergit@gmail.com>2020-04-18 14:15:51 +0300
commitd809a0260ea7fe7a0fd7a9a5f235d817b6e3d9a4 (patch)
tree46557160d77ad381015c0fdb089459f6dc0dadd7 /source/blender/blenloader/intern/versioning_280.c
parent8fd9516a716cdbec4c939572dd419f9e28c1351a (diff)
GPencil: Fix duplicated default brushes and change settings
Removed old duplicated brushes and change the settings of some brushes.
Diffstat (limited to 'source/blender/blenloader/intern/versioning_280.c')
-rw-r--r--source/blender/blenloader/intern/versioning_280.c51
1 files changed, 50 insertions, 1 deletions
diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c
index 087fef9ee09..e5c066a0ffc 100644
--- a/source/blender/blenloader/intern/versioning_280.c
+++ b/source/blender/blenloader/intern/versioning_280.c
@@ -111,6 +111,35 @@
/* 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
@@ -1633,7 +1662,27 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports))
if (!MAIN_VERSION_ATLEAST(bmain, 282, 2)) {
/* Init all Vertex/Sculpt and Weight Paint brushes. */
- Brush *brush = BLI_findstring(&bmain->brushes, "Pencil", offsetof(ID, name) + 2);
+ Brush *brush;
+ /* Pen Soft brush. */
+ brush = (Brush *)rename_id_for_versioning(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");
+
+ /* Remove useless Fill Area.001 brush. */
+ brush = BLI_findstring(&bmain->brushes, "Fill Area.001", offsetof(ID, name) + 2);
+ if (brush) {
+ BKE_id_delete(bmain, brush);
+ }
+
+ brush = BLI_findstring(&bmain->brushes, "Pencil", offsetof(ID, name) + 2);
+
for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
ToolSettings *ts = scene->toolsettings;