Changeset View
Standalone View
source/blender/editors/sculpt_paint/sculpt_undo.c
| Show First 20 Lines • Show All 1,471 Lines • ▼ Show 20 Lines | static void sculpt_undosys_step_decode( | ||||
| struct bContext *C, struct Main *bmain, UndoStep *us_p, int dir, bool UNUSED(is_final)) | struct bContext *C, struct Main *bmain, UndoStep *us_p, int dir, bool UNUSED(is_final)) | ||||
| { | { | ||||
| Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
| /* Ensure sculpt mode. */ | /* Ensure sculpt mode. */ | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| ViewLayer *view_layer = CTX_data_view_layer(C); | ViewLayer *view_layer = CTX_data_view_layer(C); | ||||
| /* Sculpt needs evaluated state. */ | |||||
| BKE_scene_view_layer_graph_evaluated_ensure(bmain, scene, view_layer); | |||||
| Object *ob = OBACT(view_layer); | Object *ob = OBACT(view_layer); | ||||
| if (ob && (ob->type == OB_MESH)) { | if (ob && (ob->type == OB_MESH)) { | ||||
| if (ob->mode & OB_MODE_SCULPT) { | if (ob->mode & OB_MODE_SCULPT) { | ||||
| /* Pass. */ | /* Pass. */ | ||||
| } | } | ||||
| else { | else { | ||||
| ED_object_mode_generic_exit(bmain, depsgraph, scene, ob); | ED_object_mode_generic_exit(bmain, depsgraph, scene, ob); | ||||
| /* Sculpt needs evaluated state. | |||||
| * Note: needs to be done here, as #ED_object_mode_generic_exit will usually invalidate | |||||
| * (some) evaluated data. */ | |||||
| BKE_scene_view_layer_graph_evaluated_ensure(bmain, scene, view_layer); | |||||
mont29: Will replace with `BKE_scene_graph_evaluated_ensure` infact, we already have our depsgraph here. | |||||
| BLI_assert(depsgraph == CTX_data_ensure_evaluated_depsgraph(C)); | |||||
sergeyUnsubmitted Not Done Inline ActionsDoes the ED_object_mode_generic_exit require evaluated despgraph? If so, it needs to be commented as such. Otherwise move the Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); line next to the ED_object_sculptmode_enter_ex call. Not sure what is the point of assert here, but you probably was looking into CTX_data_depsgraph_pointer. sergey: Does the `ED_object_mode_generic_exit` require evaluated despgraph? If so, it needs to be… | |||||
mont29AuthorUnsubmitted Done Inline ActionsIt seems ED_object_mode_generic_exit does not need an evaluated depsgraph. It seems to be only used when leaving sculpt mode, which may end up calling SCULPT_dynamic_topology_disable_ex, which forces update of the depsgraph. This logic sounds very weird and not valid to me either, be this should be addressed in another patch anyway. But an evaluated depsgraph is also need at the end of this function, when calling the sculpt_undosys_step_decode_undo/_redo functions. This whole sculpt code seems to be doing very unsafe things with depsgraph. mont29: It seems `ED_object_mode_generic_exit` does not need an evaluated depsgraph. It seems to be… | |||||
mont29AuthorUnsubmitted Done Inline ActionsWill remove, not really needed indeed. mont29: Will remove, not really needed indeed. | |||||
| Mesh *me = ob->data; | Mesh *me = ob->data; | ||||
| /* Don't add sculpt topology undo steps when reading back undo state. | /* Don't add sculpt topology undo steps when reading back undo state. | ||||
| * The undo steps must enter/exit for us. */ | * The undo steps must enter/exit for us. */ | ||||
| me->flag &= ~ME_SCULPT_DYNAMIC_TOPOLOGY; | me->flag &= ~ME_SCULPT_DYNAMIC_TOPOLOGY; | ||||
| ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, true, NULL); | ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, true, NULL); | ||||
| } | } | ||||
| if (ob->sculpt) { | if (ob->sculpt) { | ||||
| ▲ Show 20 Lines • Show All 164 Lines • Show Last 20 Lines | |||||
Will replace with BKE_scene_graph_evaluated_ensure infact, we already have our depsgraph here...