Fix duplicate ID's being created when appending/linking
This removes grease pencil brush creation/dat-block delete on load, since this causes duplicate data-blocks. Add assert to prevent this happening in the future since the error is isn't obvious.
This commit is contained in:
@@ -159,6 +159,8 @@ static bScreen *screen_parent_find(const bScreen *screen)
|
||||
|
||||
static void do_version_workspaces_create_from_screens(Main *bmain)
|
||||
{
|
||||
bmain->is_locked_for_linking = false;
|
||||
|
||||
for (bScreen *screen = bmain->screens.first; screen; screen = screen->id.next) {
|
||||
const bScreen *screen_parent = screen_parent_find(screen);
|
||||
WorkSpace *workspace;
|
||||
@@ -180,6 +182,8 @@ static void do_version_workspaces_create_from_screens(Main *bmain)
|
||||
}
|
||||
BKE_workspace_layout_add(bmain, workspace, screen, screen->id.name + 2);
|
||||
}
|
||||
|
||||
bmain->is_locked_for_linking = true;
|
||||
}
|
||||
|
||||
static void do_version_area_change_space_to_space_action(ScrArea *area, const Scene *scene)
|
||||
@@ -1694,21 +1698,11 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports))
|
||||
rename_id_for_versioning(bmain, ID_MA, "Black Dots", "Dots Stroke");
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
BKE_brush_gpencil_vertex_presets(bmain, ts);
|
||||
BKE_brush_gpencil_sculpt_presets(bmain, ts);
|
||||
BKE_brush_gpencil_weight_presets(bmain, ts);
|
||||
|
||||
/* Ensure new Paint modes. */
|
||||
BKE_paint_ensure_from_paintmode(scene, PAINT_MODE_GPENCIL);
|
||||
BKE_paint_ensure_from_paintmode(scene, PAINT_MODE_VERTEX_GPENCIL);
|
||||
@@ -1722,8 +1716,6 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports))
|
||||
/* Enable cursor by default. */
|
||||
paint->flags |= PAINT_SHOW_BRUSH;
|
||||
}
|
||||
/* Ensure Palette by default. */
|
||||
BKE_gpencil_palette_ensure(bmain, scene);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1737,11 +1729,6 @@ void do_versions_after_linking_280(Main *bmain, ReportList *UNUSED(reports))
|
||||
|
||||
/* Reset all grease pencil brushes. */
|
||||
LISTBASE_FOREACH (Scene *, scene, &bmain->scenes) {
|
||||
BKE_brush_gpencil_paint_presets(bmain, scene->toolsettings);
|
||||
BKE_brush_gpencil_sculpt_presets(bmain, scene->toolsettings);
|
||||
BKE_brush_gpencil_weight_presets(bmain, scene->toolsettings);
|
||||
BKE_brush_gpencil_vertex_presets(bmain, scene->toolsettings);
|
||||
|
||||
/* Ensure new Paint modes. */
|
||||
BKE_paint_ensure_from_paintmode(scene, PAINT_MODE_VERTEX_GPENCIL);
|
||||
BKE_paint_ensure_from_paintmode(scene, PAINT_MODE_SCULPT_GPENCIL);
|
||||
|
||||
Reference in New Issue
Block a user