Fix T84260: NURBS edit mode lines not showing
When in edit mode, the edit lines for de-selected surfaces did not show up. The bug was caused by the is_gpencil bool which reused another flag. Both grease pencil and nurbs surfaces use the edit_curve_handle shader. A dedicated flag was added to make sure the is_gpencil bool is set correctly. Reviewed By: fclem Maniphest Tasks: T84260 Differential Revision: https://developer.blender.org/D9985
This commit is contained in:
parent
c6e5b3f42d
commit
09c1cb8a17
@ -53,9 +53,8 @@ void main()
|
||||
bool edge_selected = (((vertFlag[1] | vertFlag[0]) & VERT_SELECTED) != 0);
|
||||
bool handle_selected = (showCurveHandles &&
|
||||
(((vertFlag[1] | vertFlag[0]) & VERT_SELECTED_BEZT_HANDLE) != 0));
|
||||
/* It reuses freestyle flag because the flag is 8 bits and all are already used and this
|
||||
* flag is not used in this context. */
|
||||
bool is_gpencil = ((vertFlag[1] & EDGE_FREESTYLE) != 0);
|
||||
|
||||
bool is_gpencil = ((vertFlag[1] & VERT_GPENCIL_BEZT_HANDLE) != 0);
|
||||
|
||||
/* If handle type is only selected and the edge is not selected, don't show. */
|
||||
if ((curveHandleDisplay != CURVE_HANDLE_ALL) && (!handle_selected)) {
|
||||
|
@ -230,6 +230,8 @@ enum {
|
||||
VFLAG_EDGE_SHARP = 1 << 6,
|
||||
VFLAG_EDGE_FREESTYLE = 1 << 7,
|
||||
/* Beware to not go over 1 << 7 (it's a byte flag). */
|
||||
/* NOTE: Grease pencil edit curve use another type of data format that allows for this value. */
|
||||
VFLAG_VERT_GPENCIL_BEZT_HANDLE = 1 << 30,
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -211,7 +211,7 @@ static GPUVertFormat *gpencil_edit_stroke_format(void)
|
||||
/* MUST match the format below. */
|
||||
typedef struct gpEditCurveVert {
|
||||
float pos[3];
|
||||
int data;
|
||||
uint32_t data;
|
||||
} gpEditCurveVert;
|
||||
|
||||
static GPUVertFormat *gpencil_edit_curve_format(void)
|
||||
@ -220,7 +220,7 @@ static GPUVertFormat *gpencil_edit_curve_format(void)
|
||||
if (format.attr_len == 0) {
|
||||
/* initialize vertex formats */
|
||||
GPU_vertformat_attr_add(&format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
|
||||
GPU_vertformat_attr_add(&format, "data", GPU_COMP_U8, 1, GPU_FETCH_INT);
|
||||
GPU_vertformat_attr_add(&format, "data", GPU_COMP_U32, 1, GPU_FETCH_INT);
|
||||
}
|
||||
return &format;
|
||||
}
|
||||
@ -754,17 +754,16 @@ static void gpencil_edit_curve_stroke_count_cb(bGPDlayer *gpl,
|
||||
iter->curve_len += gps->editcurve->tot_curve_points * 4;
|
||||
}
|
||||
|
||||
static char gpencil_beztriple_vflag_get(char flag,
|
||||
static uint32_t gpencil_beztriple_vflag_get(char flag,
|
||||
char col_id,
|
||||
bool handle_point,
|
||||
const bool handle_selected)
|
||||
{
|
||||
char vflag = 0;
|
||||
uint32_t vflag = 0;
|
||||
SET_FLAG_FROM_TEST(vflag, (flag & SELECT), VFLAG_VERT_SELECTED);
|
||||
SET_FLAG_FROM_TEST(vflag, handle_point, BEZIER_HANDLE);
|
||||
SET_FLAG_FROM_TEST(vflag, handle_selected, VFLAG_VERT_SELECTED_BEZT_HANDLE);
|
||||
/* Reuse flag of Freestyle to indicate is GPencil data. */
|
||||
vflag |= VFLAG_EDGE_FREESTYLE;
|
||||
vflag |= VFLAG_VERT_GPENCIL_BEZT_HANDLE;
|
||||
|
||||
/* Handle color id. */
|
||||
vflag |= col_id << COLOR_SHIFT;
|
||||
@ -794,7 +793,7 @@ static void gpencil_edit_curve_stroke_iter_cb(bGPDlayer *gpl,
|
||||
for (int i = 0; i < editcurve->tot_curve_points; i++) {
|
||||
BezTriple *bezt = &editcurve->curve_points[i].bezt;
|
||||
const bool handle_selected = BEZT_ISSEL_ANY(bezt);
|
||||
const char vflag[3] = {
|
||||
const uint32_t vflag[3] = {
|
||||
gpencil_beztriple_vflag_get(bezt->f1, bezt->h1, true, handle_selected),
|
||||
gpencil_beztriple_vflag_get(bezt->f2, bezt->h1, hide, handle_selected),
|
||||
gpencil_beztriple_vflag_get(bezt->f3, bezt->h2, true, handle_selected),
|
||||
|
@ -125,7 +125,7 @@ layout(std140) uniform globalsBlock
|
||||
#define sizeViewportInv (sizeViewport.zw)
|
||||
|
||||
/* See: 'draw_cache_impl.h' for matching includes. */
|
||||
|
||||
#define VERT_GPENCIL_BEZT_HANDLE (1 << 30)
|
||||
/* data[0] (1st byte flags) */
|
||||
#define FACE_ACTIVE (1 << 0)
|
||||
#define FACE_SELECTED (1 << 1)
|
||||
|
Loading…
Reference in New Issue
Block a user