Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt_filter_color.c
| Show First 20 Lines • Show All 216 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| Object *ob = CTX_data_active_object(C); | Object *ob = CTX_data_active_object(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; | ||||
| const int mode = RNA_enum_get(op->ptr, "type"); | const int mode = 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_undo_push_end(); | SCULPT_undo_push_end(C); | ||||
| SCULPT_filter_cache_free(ss); | SCULPT_filter_cache_free(ss); | ||||
| SCULPT_flush_update_done(C, ob, SCULPT_UPDATE_COLOR); | SCULPT_flush_update_done(C, ob, SCULPT_UPDATE_COLOR); | ||||
| 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 51 Lines • ▼ Show 20 Lines | static int sculpt_color_filter_invoke(bContext *C, wmOperator *op, const wmEvent *event) | ||||
| if (BKE_pbvh_type(pbvh) != PBVH_FACES) { | if (BKE_pbvh_type(pbvh) != PBVH_FACES) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| if (!ss->vcol) { | if (!ss->vcol) { | ||||
| return OPERATOR_CANCELLED; | return OPERATOR_CANCELLED; | ||||
| } | } | ||||
| SCULPT_undo_push_begin("color filter"); | SCULPT_undo_push_begin(C, "color filter"); | ||||
| BKE_sculpt_color_layer_create_if_needed(ob); | BKE_sculpt_color_layer_create_if_needed(ob); | ||||
| /* CTX_data_ensure_evaluated_depsgraph should be used at the end to include the updates of | /* CTX_data_ensure_evaluated_depsgraph should be used at the end to include the updates of | ||||
| * earlier steps modifying the data. */ | * earlier steps modifying the data. */ | ||||
| Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); | ||||
| const bool needs_topology_info = mode == COLOR_FILTER_SMOOTH || use_automasking; | const bool needs_topology_info = mode == COLOR_FILTER_SMOOTH || use_automasking; | ||||
| BKE_sculpt_update_object_for_edit(depsgraph, ob, needs_topology_info, false, true); | BKE_sculpt_update_object_for_edit(depsgraph, ob, needs_topology_info, false, true); | ||||
| Show All 37 Lines | |||||