Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt_cloth.c
| Show First 20 Lines • Show All 1,471 Lines • ▼ Show 20 Lines | static int sculpt_cloth_filter_modal(bContext *C, wmOperator *op, const wmEvent *event) | ||||
| Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); | Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C); | ||||
| SculptSession *ss = ob->sculpt; | SculptSession *ss = ob->sculpt; | ||||
| Sculpt *sd = CTX_data_tool_settings(C)->sculpt; | Sculpt *sd = CTX_data_tool_settings(C)->sculpt; | ||||
| int filter_type = RNA_enum_get(op->ptr, "type"); | int filter_type = RNA_enum_get(op->ptr, "type"); | ||||
| float filter_strength = RNA_float_get(op->ptr, "strength"); | float filter_strength = RNA_float_get(op->ptr, "strength"); | ||||
| if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { | if (event->type == LEFTMOUSE && event->val == KM_RELEASE) { | ||||
| SCULPT_filter_cache_free(ss); | SCULPT_filter_cache_free(ss); | ||||
| SCULPT_undo_push_end(); | SCULPT_undo_push_end(C); | ||||
| SCULPT_flush_update_done(C, ob, SCULPT_UPDATE_COORDS); | SCULPT_flush_update_done(C, ob, SCULPT_UPDATE_COORDS); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| } | } | ||||
| if (event->type != MOUSEMOVE) { | if (event->type != MOUSEMOVE) { | ||||
| return OPERATOR_RUNNING_MODAL; | return OPERATOR_RUNNING_MODAL; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 54 Lines • ▼ Show 20 Lines | static int sculpt_cloth_filter_invoke(bContext *C, wmOperator *op, const wmEvent *event) | ||||
| mouse[1] = event->mval[1]; | mouse[1] = event->mval[1]; | ||||
| SCULPT_cursor_geometry_info_update(C, &sgi, mouse, false); | SCULPT_cursor_geometry_info_update(C, &sgi, mouse, false); | ||||
| SCULPT_vertex_random_access_ensure(ss); | SCULPT_vertex_random_access_ensure(ss); | ||||
| /* Needs mask data to be available as it is used when solving the constraints. */ | /* Needs mask data to be available as it is used when solving the constraints. */ | ||||
| BKE_sculpt_update_object_for_edit(depsgraph, ob, true, true, false); | BKE_sculpt_update_object_for_edit(depsgraph, ob, true, true, false); | ||||
| SCULPT_undo_push_begin("Cloth filter"); | SCULPT_undo_push_begin(C, "Cloth filter"); | ||||
| SCULPT_filter_cache_init(C, ob, sd, SCULPT_UNDO_COORDS); | SCULPT_filter_cache_init(C, ob, sd, SCULPT_UNDO_COORDS); | ||||
| ss->filter_cache->automasking = SCULPT_automasking_cache_init(sd, NULL, ob); | ss->filter_cache->automasking = SCULPT_automasking_cache_init(sd, NULL, ob); | ||||
| const float cloth_mass = RNA_float_get(op->ptr, "cloth_mass"); | const float cloth_mass = RNA_float_get(op->ptr, "cloth_mass"); | ||||
| const float cloth_damping = RNA_float_get(op->ptr, "cloth_damping"); | const float cloth_damping = RNA_float_get(op->ptr, "cloth_damping"); | ||||
| const bool use_collisions = RNA_boolean_get(op->ptr, "use_collisions"); | const bool use_collisions = RNA_boolean_get(op->ptr, "use_collisions"); | ||||
| ss->filter_cache->cloth_sim = SCULPT_cloth_brush_simulation_create( | ss->filter_cache->cloth_sim = SCULPT_cloth_brush_simulation_create( | ||||
| ▲ Show 20 Lines • Show All 104 Lines • Show Last 20 Lines | |||||