Squashed commit of the following:

commit 7aa5e65dcbda862dcb17ecfc6727eb241a12c316
Merge: c08a9ec19f 7c9e493da55
Author: Joseph Eagar <joeedh@gmail.com>
Date:   Sun Apr 16 15:11:53 2023 -0700

    Merge branch 'main' of https://projects.blender.org/ChengduLittleA/blender into ChengduLittleA-main

commit 7c9e493da55a4adbfa2415b711e6d0daa2720ad9
Author: YimingWu <xp8110@outlook.com>
Date:   Fri Mar 31 17:46:32 2023 +0800

    Fix #106358: Handles null evaluated object when entering sculpting workspace.

    The setup where everything in the scene is invisible/not enabled could
    trigger a crash when switched to sculpting workspace, triggered when
    opening the file.

    This patch handles such situation.
This commit is contained in:
Joseph Eagar
2023-04-16 15:14:11 -07:00
parent c08a9ec19f
commit 4563a47ac5
2 changed files with 10 additions and 0 deletions

View File

@@ -1672,6 +1672,11 @@ static void sculpt_update_object(
BLI_assert(me_eval != nullptr);
/* This is for handling a newly opened file with no object visible, causing me_eval==NULL. */
if (me_eval == nullptr) {
return;
}
ss->depsgraph = depsgraph;
ss->deform_modifiers_active = sculpt_modifiers_active(scene, sd, ob);

View File

@@ -313,6 +313,11 @@ void SCULPT_ensure_valid_pivot(const Object *ob, Scene *scene)
UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings;
const SculptSession *ss = ob->sculpt;
/* Account for the case where no objects are evaluated. */
if (!ss->pbvh) {
return;
}
/* No valid pivot? Use bounding box center. */
if (ups->average_stroke_counter == 0 || !ups->last_stroke_valid) {
float location[3], max[3];