Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 8,126 Lines • ▼ Show 20 Lines | RNA_def_float(ot->srna, | ||||
| "Merge Distance", | "Merge Distance", | ||||
| "Distance within which symmetrical vertices are merged", | "Distance within which symmetrical vertices are merged", | ||||
| 0.0f, | 0.0f, | ||||
| 1.0f); | 1.0f); | ||||
| } | } | ||||
| /**** Toggle operator for turning sculpt mode on or off ****/ | /**** Toggle operator for turning sculpt mode on or off ****/ | ||||
| /** \warning Expects a fully evaluated depsgraph. */ | |||||
| static void sculpt_init_session(Depsgraph *depsgraph, Scene *scene, Object *ob) | static void sculpt_init_session(Depsgraph *depsgraph, Scene *scene, Object *ob) | ||||
| { | { | ||||
| /* Create persistent sculpt mode data. */ | /* Create persistent sculpt mode data. */ | ||||
| BKE_sculpt_toolsettings_data_ensure(scene); | BKE_sculpt_toolsettings_data_ensure(scene); | ||||
| ob->sculpt = MEM_callocN(sizeof(SculptSession), "sculpt session"); | ob->sculpt = MEM_callocN(sizeof(SculptSession), "sculpt session"); | ||||
| ob->sculpt->mode_type = OB_MODE_SCULPT; | ob->sculpt->mode_type = OB_MODE_SCULPT; | ||||
| BKE_sculpt_update_object_for_edit(depsgraph, ob, false, false, false); | BKE_sculpt_update_object_for_edit(depsgraph, ob, false, false, false); | ||||
| ▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | void ED_object_sculptmode_enter_ex(Main *bmain, | ||||
| ob->mode |= mode_flag; | ob->mode |= mode_flag; | ||||
| MultiresModifierData *mmd = BKE_sculpt_multires_active(scene, ob); | MultiresModifierData *mmd = BKE_sculpt_multires_active(scene, ob); | ||||
| const int flush_recalc = ed_object_sculptmode_flush_recalc_flag(scene, ob, mmd); | const int flush_recalc = ed_object_sculptmode_flush_recalc_flag(scene, ob, mmd); | ||||
| if (flush_recalc) { | if (flush_recalc) { | ||||
| DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY); | ||||
| BKE_scene_graph_evaluated_ensure(depsgraph, bmain); | |||||
| } | } | ||||
sergey: To follow old logic there needs to be evaluation here. Without such evaluation it seems that… | |||||
| /* Create sculpt mode session data. */ | /* Create sculpt mode session data. */ | ||||
| if (ob->sculpt) { | if (ob->sculpt) { | ||||
| BKE_sculptsession_free(ob); | BKE_sculptsession_free(ob); | ||||
| } | } | ||||
| /* Make sure derived final from original object does not reference possibly | |||||
| * freed memory. */ | |||||
| BKE_object_free_derived_caches(ob); | |||||
| /* Copy the current mesh visibility to the Face Sets. */ | /* Copy the current mesh visibility to the Face Sets. */ | ||||
| BKE_sculpt_face_sets_ensure_from_base_mesh_visibility(me); | BKE_sculpt_face_sets_ensure_from_base_mesh_visibility(me); | ||||
| sculpt_init_session(depsgraph, scene, ob); | sculpt_init_session(depsgraph, scene, ob); | ||||
| /* Mask layer is required. */ | /* Mask layer is required. */ | ||||
| if (mmd) { | if (mmd) { | ||||
| /* XXX, we could attempt to support adding mask data mid-sculpt mode (with multi-res) | /* XXX, we could attempt to support adding mask data mid-sculpt mode (with multi-res) | ||||
| ▲ Show 20 Lines • Show All 1,056 Lines • Show Last 20 Lines | |||||
To follow old logic there needs to be evaluation here. Without such evaluation it seems that sculpt session will be wrongly initialized if, say, multires sculpt level is different from viewport level.