Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/gpencil_utils.c
| Show First 20 Lines • Show All 1,774 Lines • ▼ Show 20 Lines | else { | ||||
| } | } | ||||
| /* Convert the 3D offset distance to a brush radius. */ | /* Convert the 3D offset distance to a brush radius. */ | ||||
| radius = (1 / distance) * 2.0f * gpd->pixfactor * (brush_size / 64); | radius = (1 / distance) * 2.0f * gpd->pixfactor * (brush_size / 64); | ||||
| } | } | ||||
| return radius; | return radius; | ||||
| } | } | ||||
| float ED_gpencil_radial_control_scale(struct bContext *C, | |||||
| struct Brush *brush, | |||||
| float initial_value, | |||||
| const int mval[2]) | |||||
| { | |||||
| float scale_fac = 1.0f; | |||||
| if ((brush && brush->gpencil_settings) && (brush->gpencil_tool == GPAINT_TOOL_DRAW)) { | |||||
| float cursor_radius = ED_gpencil_cursor_radius(C, mval[0], mval[1]); | |||||
| scale_fac = max_ff(cursor_radius, 1.0f) / max_ff(initial_value, 1.0f); | |||||
| } | |||||
| return scale_fac; | |||||
| } | |||||
| /** | /** | ||||
| * Helper callback for drawing the cursor itself. | * Helper callback for drawing the cursor itself. | ||||
| */ | */ | ||||
| static void gpencil_brush_cursor_draw(bContext *C, int x, int y, void *customdata) | static void gpencil_brush_cursor_draw(bContext *C, int x, int y, void *customdata) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| ToolSettings *ts = scene->toolsettings; | ToolSettings *ts = scene->toolsettings; | ||||
| Object *ob = CTX_data_active_object(C); | Object *ob = CTX_data_active_object(C); | ||||
| ▲ Show 20 Lines • Show All 1,602 Lines • Show Last 20 Lines | |||||