diff options
author | Hans Goudey <h.goudey@me.com> | 2020-06-24 18:50:01 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-06-24 18:50:01 +0300 |
commit | baff05ad1c156ca477375c440e2c5b92cad214e9 (patch) | |
tree | b89d9d5a9e9611247d964d5e9b0ccd098bf88c2d /source/blender/makesdna/DNA_curveprofile_types.h | |
parent | ec7510b458528eb8dcdf2c538a2b805813940447 (diff) |
UI: Add Free Handle Types to CurveProfile Widget
Under the hood the CurveProfile widget (used for bevel custom profiles)
uses a bezier curve, but right now though it only supports two of the
bezier curve handle types, vector and auto. This patch adds support for
free handles and adds all of the logic for editing them.
This is the first step to the ability to import and export curve objects
in the widget.
There's some code cleanup in curveprofile.c. Movement for handles and
control points is abstracted to functions there rather than happening
in interface_handlers.c.
An "Apply Preset" button is also added, which solves a confusing issue
where you apply a preset, then change the number of samples and the
preset doesn't change. The button makes it clear that the preset needs
to be reapplied.
Reviewed By: Severin
Differential Revision: https://developer.blender.org/D6470
Diffstat (limited to 'source/blender/makesdna/DNA_curveprofile_types.h')
-rw-r--r-- | source/blender/makesdna/DNA_curveprofile_types.h | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/source/blender/makesdna/DNA_curveprofile_types.h b/source/blender/makesdna/DNA_curveprofile_types.h index 63e1049b636..ca00f783905 100644 --- a/source/blender/makesdna/DNA_curveprofile_types.h +++ b/source/blender/makesdna/DNA_curveprofile_types.h @@ -43,13 +43,22 @@ typedef struct CurveProfilePoint { float x, y; /** Flag selection state and others. */ short flag; - /** Flags for both handle's type (eBezTriple_Handle). */ + /** Flags for both handle's type (eBezTriple_Handle auto, vect, free, and aligned supported). */ char h1, h2; + /** Handle locations, keep together. + * \note For now the two handle types are set to the same type in RNA. */ + float h1_loc[2]; + float h2_loc[2]; + char _pad[4]; + /** Runtime pointer to the point's profile for updating the curve with no direct reference. */ + struct CurveProfile *profile; } CurveProfilePoint; /** #CurveProfilePoint.flag */ enum { PROF_SELECT = (1 << 0), + PROF_H1_SELECT = (1 << 1), + PROF_H2_SELECT = (1 << 2), }; /** Defines a profile. */ @@ -76,10 +85,11 @@ typedef struct CurveProfile { /** #CurveProfile.flag */ enum { - PROF_USE_CLIP = (1 << 0), /* Keep control points inside bounding rectangle. */ - /* PROF_SYMMETRY_MODE = (1 << 1), */ /* Unused for now. */ - PROF_SAMPLE_STRAIGHT_EDGES = (1 << 2), /* Sample extra points on straight edges. */ - PROF_SAMPLE_EVEN_LENGTHS = (1 << 3), /* Put segments evenly spaced along the path. */ + PROF_USE_CLIP = (1 << 0), /* Keep control points inside bounding rectangle. */ + /* PROF_SYMMETRY_MODE = (1 << 1), Unused for now. */ + PROF_SAMPLE_STRAIGHT_EDGES = (1 << 2), /* Sample extra points on straight edges. */ + PROF_SAMPLE_EVEN_LENGTHS = (1 << 3), /* Put segments evenly spaced along the path. */ + PROF_DIRTY_PRESET = (1 << 4), /* Marks when the dynamic preset has been changed. */ }; typedef enum eCurveProfilePresets { |