diff options
author | Jacques Lucke <jacques@blender.org> | 2022-03-21 20:54:31 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2022-03-21 20:59:03 +0300 |
commit | a58be397e2bfbefa0324dbe861b018dd2784ee0d (patch) | |
tree | 4ad14d927e10974e95d3be0a32436888a5260a91 /source/blender/makesdna | |
parent | f8d19ec5a3d8c14d0c71464867ad1af10ee50eb5 (diff) |
Curves: new Add brush
This adds a new Add brush for the new curves object type in sculpt mode.
The brush is used to insert new curves (typically hair) on the surface object.
Supported features:
* Add single curve exactly at the cursor position when `Add Amount` is 1.
* Front faces only.
* Independent interpolate shape and interpolate length settings.
* Smooth and flat shading affects curve shape interpolation.
* Spherical and projection brush.
This also adds the `surface_triangle_index` and `surface_triangle_coordinate`
attributes. Those store information about what position on the surface each
added curve is attached to:
* `surface_triangle_index` (`int`): Index of the internal triangle that a curve
is attached to. `-1` when the curve is not attached to the surface.
* `surface_triangle_coordinate` (`float2`): First two numbers of a barycentric
coordinate that reference a specific position within the triangle.
Ref T96444.
Differential Revision: https://developer.blender.org/D14340
Diffstat (limited to 'source/blender/makesdna')
-rw-r--r-- | source/blender/makesdna/DNA_brush_enums.h | 5 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_brush_types.h | 7 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 14 |
3 files changed, 22 insertions, 4 deletions
diff --git a/source/blender/makesdna/DNA_brush_enums.h b/source/blender/makesdna/DNA_brush_enums.h index 90763dae600..783e79898ce 100644 --- a/source/blender/makesdna/DNA_brush_enums.h +++ b/source/blender/makesdna/DNA_brush_enums.h @@ -460,8 +460,9 @@ typedef enum eBrushCurvesSculptTool { CURVES_SCULPT_TOOL_COMB = 0, CURVES_SCULPT_TOOL_DELETE = 1, CURVES_SCULPT_TOOL_SNAKE_HOOK = 2, - CURVES_SCULPT_TOOL_TEST1 = 3, - CURVES_SCULPT_TOOL_TEST2 = 4, + CURVES_SCULPT_TOOL_ADD = 3, + CURVES_SCULPT_TOOL_TEST1 = 4, + CURVES_SCULPT_TOOL_TEST2 = 5, } eBrushCurvesSculptTool; /** When #BRUSH_ACCUMULATE is used */ diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h index 78e3a64e07e..564f34b1f72 100644 --- a/source/blender/makesdna/DNA_brush_types.h +++ b/source/blender/makesdna/DNA_brush_types.h @@ -137,6 +137,11 @@ typedef struct BrushGpencilSettings { struct Material *material; } BrushGpencilSettings; +typedef struct BrushCurvesSculptSettings { + /* Number of curves added by the add brush. */ + int add_amount; +} BrushCurvesSculptSettings; + typedef struct Brush { ID id; @@ -360,7 +365,7 @@ typedef struct Brush { float mask_stencil_dimension[2]; struct BrushGpencilSettings *gpencil_settings; - + struct BrushCurvesSculptSettings *curves_sculpt_settings; } Brush; /* Struct to hold palette colors for sorting. */ diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index ebc5ebe758f..be8f9f938a3 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -993,11 +993,23 @@ typedef struct Sculpt { struct Object *gravity_object; } Sculpt; +typedef enum CurvesSculptFlag { + CURVES_SCULPT_FLAG_INTERPOLATE_LENGTH = (1 << 0), + CURVES_SCULPT_FLAG_INTERPOLATE_SHAPE = (1 << 1), +} CurvesSculptFlag; + typedef struct CurvesSculpt { Paint paint; /** Minimum distance between newly added curves on a surface. */ float distance; - char _pad1[4]; + + /** CurvesSculptFlag. */ + uint32_t flag; + + /** Length of newly added curves when it is not interpolated from other curves. */ + float curve_length; + + char _pad[4]; } CurvesSculpt; typedef struct UvSculpt { |