Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt_dyntopo.c
| Show First 20 Lines • Show All 285 Lines • ▼ Show 20 Lines | void sculpt_dynamic_topology_disable_with_undo(Main *bmain, | ||||
| Scene *scene, | Scene *scene, | ||||
| Object *ob) | Object *ob) | ||||
| { | { | ||||
| SculptSession *ss = ob->sculpt; | SculptSession *ss = ob->sculpt; | ||||
| if (ss->bm != NULL) { | if (ss->bm != NULL) { | ||||
| /* May be false in background mode. */ | /* May be false in background mode. */ | ||||
| const bool use_undo = G.background ? (ED_undo_stack_get() != NULL) : true; | const bool use_undo = G.background ? (ED_undo_stack_get() != NULL) : true; | ||||
| if (use_undo) { | if (use_undo) { | ||||
| SCULPT_undo_push_begin("Dynamic topology disable"); | SCULPT_undo_push_begin(ob, "Dynamic topology disable"); | ||||
| SCULPT_undo_push_node(ob, NULL, SCULPT_UNDO_DYNTOPO_END); | SCULPT_undo_push_node(ob, NULL, SCULPT_UNDO_DYNTOPO_END); | ||||
| } | } | ||||
| SCULPT_dynamic_topology_disable_ex(bmain, depsgraph, scene, ob, NULL); | SCULPT_dynamic_topology_disable_ex(bmain, depsgraph, scene, ob, NULL); | ||||
| if (use_undo) { | if (use_undo) { | ||||
| SCULPT_undo_push_end(); | SCULPT_undo_push_end(); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| static void sculpt_dynamic_topology_enable_with_undo(Main *bmain, | static void sculpt_dynamic_topology_enable_with_undo(Main *bmain, | ||||
| Depsgraph *depsgraph, | Depsgraph *depsgraph, | ||||
| Scene *scene, | Scene *scene, | ||||
| Object *ob) | Object *ob) | ||||
| { | { | ||||
| SculptSession *ss = ob->sculpt; | SculptSession *ss = ob->sculpt; | ||||
| if (ss->bm == NULL) { | if (ss->bm == NULL) { | ||||
| /* May be false in background mode. */ | /* May be false in background mode. */ | ||||
| const bool use_undo = G.background ? (ED_undo_stack_get() != NULL) : true; | const bool use_undo = G.background ? (ED_undo_stack_get() != NULL) : true; | ||||
| if (use_undo) { | if (use_undo) { | ||||
| SCULPT_undo_push_begin("Dynamic topology enable"); | SCULPT_undo_push_begin(ob, "Dynamic topology enable"); | ||||
| } | } | ||||
| SCULPT_dynamic_topology_enable_ex(bmain, depsgraph, scene, ob); | SCULPT_dynamic_topology_enable_ex(bmain, depsgraph, scene, ob); | ||||
| if (use_undo) { | if (use_undo) { | ||||
| SCULPT_undo_push_node(ob, NULL, SCULPT_UNDO_DYNTOPO_BEGIN); | SCULPT_undo_push_node(ob, NULL, SCULPT_UNDO_DYNTOPO_BEGIN); | ||||
| SCULPT_undo_push_end(); | SCULPT_undo_push_end(); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 133 Lines • Show Last 20 Lines | |||||