Changeset 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 7,730 Lines • ▼ Show 20 Lines | BKE_pbvh_bmesh_detail_size_set(ss->pbvh, | ||||
| (ss->cache->radius / ss->cache->dyntopo_pixel_radius) * | (ss->cache->radius / ss->cache->dyntopo_pixel_radius) * | ||||
| (sd->detail_size * U.pixelsize) / 0.4f); | (sd->detail_size * U.pixelsize) / 0.4f); | ||||
| } | } | ||||
| if (SCULPT_stroke_is_dynamic_topology(ss, brush)) { | if (SCULPT_stroke_is_dynamic_topology(ss, brush)) { | ||||
| do_symmetrical_brush_actions(sd, ob, sculpt_topology_update, ups); | do_symmetrical_brush_actions(sd, ob, sculpt_topology_update, ups); | ||||
| } | } | ||||
| if (!ss->persistent_base && BKE_pbvh_type(ss->pbvh) != PBVH_BMESH) { | |||||
| SCULPT_persistent_base_store(ss); | |||||
sergey: It seems it was possible to store persistent base in any mode before, so why is the BMESH case… | |||||
Done Inline ActionsSee D9728. pablodp606: See D9728.
Even if dyntopo is technically supported using the API to get the persistent base… | |||||
Not Done Inline ActionsTo me this change is more something like: implicitly press "store persistent base" button if it was not pressed prior to the stroke start. If the dynamic topology does not work correct with persistent base, it should be explicitly disabled with clear communication to the artist. This will include generating an unsupported warning in the "store persistent base" operator. Having different behavior when the state was stored explicitly and implicitly is not something I find a correct thing to do. Also, all the non-trivial logic explanation should happen as a comment in the code. sergey: To me this change is more something like: implicitly press "store persistent base" button if it… | |||||
| } | |||||
| do_symmetrical_brush_actions(sd, ob, do_brush_action, ups); | do_symmetrical_brush_actions(sd, ob, do_brush_action, ups); | ||||
| sculpt_combine_proxies(sd, ob); | sculpt_combine_proxies(sd, ob); | ||||
| /* Hack to fix noise texture tearing mesh. */ | /* Hack to fix noise texture tearing mesh. */ | ||||
| sculpt_fix_noise_tear(sd, ob); | sculpt_fix_noise_tear(sd, ob); | ||||
| /* TODO(sergey): This is not really needed for the solid shading, | /* TODO(sergey): This is not really needed for the solid shading, | ||||
| * which does use pBVH drawing anyway, but texture and wireframe | * which does use pBVH drawing anyway, but texture and wireframe | ||||
| ▲ Show 20 Lines • Show All 203 Lines • ▼ Show 20 Lines | static void SCULPT_OT_brush_stroke(wmOperatorType *ot) | ||||
| RNA_def_boolean(ot->srna, | RNA_def_boolean(ot->srna, | ||||
| "ignore_background_click", | "ignore_background_click", | ||||
| 0, | 0, | ||||
| "Ignore Background Click", | "Ignore Background Click", | ||||
| "Clicks on the background do not start the stroke"); | "Clicks on the background do not start the stroke"); | ||||
| } | } | ||||
| /* Reset the copy of the mesh that is being sculpted on (currently just for the layer brush). */ | void SCULPT_persistent_base_store(SculptSession *ss) | ||||
| { | |||||
| const int totvert = SCULPT_vertex_count_get(ss); | |||||
| ss->persistent_base = MEM_malloc_arrayN( | |||||
| sizeof(SculptPersistentBase), totvert, "persistent base"); | |||||
| for (int i = 0; i < totvert; i++) { | |||||
| copy_v3_v3(ss->persistent_base[i].co, SCULPT_vertex_co_get(ss, i)); | |||||
| SCULPT_vertex_normal_get(ss, i, ss->persistent_base[i].no); | |||||
| ss->persistent_base[i].disp = 0.0f; | |||||
| } | |||||
| } | |||||
| /* Reset the copy of the mesh that is being sculpted on (currently just for the layer brush). */ | |||||
| static int sculpt_set_persistent_base_exec(bContext *C, wmOperator *UNUSED(op)) | static int sculpt_set_persistent_base_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| { | { | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); | Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); | ||||
| Object *ob = CTX_data_active_object(C); | Object *ob = CTX_data_active_object(C); | ||||
| SculptSession *ss = ob->sculpt; | SculptSession *ss = ob->sculpt; | ||||
| if (ss) { | if (ss) { | ||||
| SCULPT_vertex_random_access_ensure(ss); | SCULPT_vertex_random_access_ensure(ss); | ||||
| BKE_sculpt_update_object_for_edit(depsgraph, ob, false, false, false); | BKE_sculpt_update_object_for_edit(depsgraph, ob, false, false, false); | ||||
| MEM_SAFE_FREE(ss->persistent_base); | MEM_SAFE_FREE(ss->persistent_base); | ||||
| SCULPT_persistent_base_store(ss); | |||||
| const int totvert = SCULPT_vertex_count_get(ss); | |||||
| ss->persistent_base = MEM_mallocN(sizeof(SculptPersistentBase) * totvert, | |||||
| "layer persistent base"); | |||||
| for (int i = 0; i < totvert; i++) { | |||||
| copy_v3_v3(ss->persistent_base[i].co, SCULPT_vertex_co_get(ss, i)); | |||||
| SCULPT_vertex_normal_get(ss, i, ss->persistent_base[i].no); | |||||
| ss->persistent_base[i].disp = 0.0f; | |||||
| } | |||||
| } | } | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| static void SCULPT_OT_set_persistent_base(wmOperatorType *ot) | static void SCULPT_OT_set_persistent_base(wmOperatorType *ot) | ||||
| { | { | ||||
| /* Identifiers. */ | /* Identifiers. */ | ||||
| ▲ Show 20 Lines • Show All 1,641 Lines • Show Last 20 Lines | |||||
It seems it was possible to store persistent base in any mode before, so why is the BMESH case ignored?