Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt.c
| Show First 20 Lines • Show All 6,046 Lines • ▼ Show 20 Lines | static void SCULPT_OT_sample_detail_size(wmOperatorType *ot) | ||||
| ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; | ||||
| RNA_def_int_array(ot->srna, "location", 2, NULL, 0, SHRT_MAX, | RNA_def_int_array(ot->srna, "location", 2, NULL, 0, SHRT_MAX, | ||||
| "Location", "Screen Coordinates of sampling", 0, SHRT_MAX); | "Location", "Screen Coordinates of sampling", 0, SHRT_MAX); | ||||
| } | } | ||||
| /* Dynamic-topology detail size | |||||
| * | |||||
| * This should be improved further, perhaps by showing a triangle | |||||
| * grid rather than brush alpha */ | |||||
| static void set_brush_rc_props(PointerRNA *ptr, const char *prop) | |||||
| { | |||||
| char *path = BLI_sprintfN("tool_settings.sculpt.brush.%s", prop); | |||||
| RNA_string_set(ptr, "data_path_primary", path); | |||||
| MEM_freeN(path); | |||||
| } | |||||
| static int sculpt_set_detail_size_exec(bContext *C, wmOperator *UNUSED(op)) | static int sculpt_set_detail_size_exec(bContext *C, wmOperator *UNUSED(op)) | ||||
| { | { | ||||
| Sculpt *sd = CTX_data_tool_settings(C)->sculpt; | Sculpt *sd = CTX_data_tool_settings(C)->sculpt; | ||||
| PointerRNA props_ptr; | PointerRNA props_ptr; | ||||
| wmOperatorType *ot = WM_operatortype_find("WM_OT_radial_control", true); | wmOperatorType *ot = WM_operatortype_find("WM_OT_radial_control", true); | ||||
| WM_operator_properties_create_ptr(&props_ptr, ot); | WM_operator_properties_create_ptr(&props_ptr, ot); | ||||
| if (sd->flags & (SCULPT_DYNTOPO_DETAIL_CONSTANT | SCULPT_DYNTOPO_DETAIL_MANUAL)) { | if (sd->flags & (SCULPT_DYNTOPO_DETAIL_CONSTANT | SCULPT_DYNTOPO_DETAIL_MANUAL)) { | ||||
| set_brush_rc_props(&props_ptr, "sculpt", "constant_detail_resolution", NULL, 0); | set_brush_rc_props(&props_ptr, "constant_detail_resolution"); | ||||
| RNA_string_set(&props_ptr, "data_path_primary", "tool_settings.sculpt.constant_detail_resolution"); | RNA_string_set(&props_ptr, "data_path_primary", "tool_settings.sculpt.constant_detail_resolution"); | ||||
| } | } | ||||
| else if (sd->flags & SCULPT_DYNTOPO_DETAIL_BRUSH) { | else if (sd->flags & SCULPT_DYNTOPO_DETAIL_BRUSH) { | ||||
| set_brush_rc_props(&props_ptr, "sculpt", "constant_detail_resolution", NULL, 0); | set_brush_rc_props(&props_ptr, "constant_detail_resolution"); | ||||
| RNA_string_set(&props_ptr, "data_path_primary", "tool_settings.sculpt.detail_percent"); | RNA_string_set(&props_ptr, "data_path_primary", "tool_settings.sculpt.detail_percent"); | ||||
| } | } | ||||
| else { | else { | ||||
| set_brush_rc_props(&props_ptr, "sculpt", "detail_size", NULL, 0); | set_brush_rc_props(&props_ptr, "detail_size"); | ||||
| RNA_string_set(&props_ptr, "data_path_primary", "tool_settings.sculpt.detail_size"); | RNA_string_set(&props_ptr, "data_path_primary", "tool_settings.sculpt.detail_size"); | ||||
| } | } | ||||
| WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr); | WM_operator_name_call_ptr(C, ot, WM_OP_INVOKE_DEFAULT, &props_ptr); | ||||
| WM_operator_properties_free(&props_ptr); | WM_operator_properties_free(&props_ptr); | ||||
| return OPERATOR_FINISHED; | return OPERATOR_FINISHED; | ||||
| Show All 28 Lines | |||||