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:
authorPablo Dobarro <pablodp606@gmail.com>2020-02-19 21:07:16 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-02-19 21:08:08 +0300
commit2df040ed58fb9e80ae69f50262bb702f50f0d71f (patch)
treeae65352721f8d727b98080e06c08f5ec5978f163 /source/blender/blenloader/intern/readfile.c
parent888d180164004d121511609da044ea86c3aa9cb0 (diff)
Fix T54270: Reset last_hit and last_location when reading the file
It does not make sense to read those values when loading a file and they can crash the cursor if they contain invalid coordinates. Reviewed By: brecht Maniphest Tasks: T54270 Differential Revision: https://developer.blender.org/D6754
Diffstat (limited to 'source/blender/blenloader/intern/readfile.c')
-rw-r--r--source/blender/blenloader/intern/readfile.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 2d87d9f12ff..acc73d1fafe 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -6603,6 +6603,13 @@ static void direct_link_scene(FileData *fd, Scene *sce)
sce->toolsettings = newdataadr(fd, sce->toolsettings);
if (sce->toolsettings) {
+
+ /* Reset last_location and last_hit, so they are not remembered across sessions. In some files
+ * these are also NaN, which could lead to crashes in painting. */
+ struct UnifiedPaintSettings *ups = &sce->toolsettings->unified_paint_settings;
+ zero_v3(ups->last_location);
+ ups->last_hit = 0;
+
direct_link_paint_helper(fd, sce, (Paint **)&sce->toolsettings->sculpt);
direct_link_paint_helper(fd, sce, (Paint **)&sce->toolsettings->vpaint);
direct_link_paint_helper(fd, sce, (Paint **)&sce->toolsettings->wpaint);