Cleanup: trailing space w/ slash, right shift
This commit is contained in:
parent
bbca6af6a5
commit
bbc5571093
|
@ -93,8 +93,9 @@ typedef enum eDrawStrokeFlags {
|
|||
/* ----- Tool Buffer Drawing ------ */
|
||||
|
||||
/* draw stroke defined in buffer (simple ogl lines/points for now, as dotted lines) */
|
||||
static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short thickness,
|
||||
short dflag, short sflag, float ink[4])
|
||||
static void gp_draw_stroke_buffer(
|
||||
const tGPspoint *points, int totpoints, short thickness,
|
||||
short dflag, short sflag, float ink[4])
|
||||
{
|
||||
int draw_points = 0;
|
||||
|
||||
|
@ -241,8 +242,9 @@ static void gp_draw_stroke_point(
|
|||
}
|
||||
|
||||
/* draw a given stroke in 3d (i.e. in 3d-space), using simple ogl lines */
|
||||
static void gp_draw_stroke_3d(const bGPDspoint *points, int totpoints, short thickness, bool UNUSED(debug),
|
||||
short UNUSED(sflag), const float ink[4], bool cyclic)
|
||||
static void gp_draw_stroke_3d(
|
||||
const bGPDspoint *points, int totpoints, short thickness, bool UNUSED(debug),
|
||||
short UNUSED(sflag), const float ink[4], bool cyclic)
|
||||
{
|
||||
float curpressure = points[0].pressure;
|
||||
float cyclic_fpt[3];
|
||||
|
@ -322,8 +324,9 @@ static void gp_draw_stroke_3d(const bGPDspoint *points, int totpoints, short thi
|
|||
/* ----- Fancy 2D-Stroke Drawing ------ */
|
||||
|
||||
/* draw a given stroke in 2d */
|
||||
static void gp_draw_stroke_2d(const bGPDspoint *points, int totpoints, short thickness_s, short dflag, short sflag,
|
||||
bool UNUSED(debug), int offsx, int offsy, int winx, int winy, const float ink[4])
|
||||
static void gp_draw_stroke_2d(
|
||||
const bGPDspoint *points, int totpoints, short thickness_s, short dflag, short sflag,
|
||||
bool UNUSED(debug), int offsx, int offsy, int winx, int winy, const float ink[4])
|
||||
{
|
||||
/* otherwise thickness is twice that of the 3D view */
|
||||
float thickness = (float)thickness_s * 0.5f;
|
||||
|
@ -553,8 +556,9 @@ static void gp_draw_strokes(
|
|||
gp_draw_stroke_point(gps->points, lthick, dflag, gps->flag, offsx, offsy, winx, winy, color);
|
||||
}
|
||||
else {
|
||||
gp_draw_stroke_3d(gps->points, gps->totpoints, lthick, debug, gps->flag,
|
||||
color, gps->flag & GP_STROKE_CYCLIC);
|
||||
gp_draw_stroke_3d(
|
||||
gps->points, gps->totpoints, lthick, debug, gps->flag,
|
||||
color, gps->flag & GP_STROKE_CYCLIC);
|
||||
}
|
||||
|
||||
if (no_xray) {
|
||||
|
@ -570,8 +574,9 @@ static void gp_draw_strokes(
|
|||
gp_draw_stroke_point(gps->points, lthick, dflag, gps->flag, offsx, offsy, winx, winy, color);
|
||||
}
|
||||
else {
|
||||
gp_draw_stroke_2d(gps->points, gps->totpoints, lthick, dflag, gps->flag, debug,
|
||||
offsx, offsy, winx, winy, color);
|
||||
gp_draw_stroke_2d(
|
||||
gps->points, gps->totpoints, lthick, dflag, gps->flag, debug,
|
||||
offsx, offsy, winx, winy, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -527,8 +527,9 @@ static void gp_stroke_simplify(tGPsdata *p)
|
|||
j += 2;
|
||||
}
|
||||
}
|
||||
gp_stroke_addpoint(p, &old_points[num_points - 1].x, old_points[num_points - 1].pressure,
|
||||
p->inittime + (double)old_points[num_points - 1].time);
|
||||
gp_stroke_addpoint(
|
||||
p, &old_points[num_points - 1].x, old_points[num_points - 1].pressure,
|
||||
p->inittime + (double)old_points[num_points - 1].time);
|
||||
|
||||
/* free old buffer */
|
||||
MEM_freeN(old_points);
|
||||
|
@ -782,10 +783,11 @@ static bool gp_stroke_eraser_is_occluded(tGPsdata *p, const bGPDspoint *pt, cons
|
|||
|
||||
/* eraser tool - evaluation per stroke */
|
||||
/* TODO: this could really do with some optimization (KD-Tree/BVH?) */
|
||||
static void gp_stroke_eraser_dostroke(tGPsdata *p,
|
||||
bGPDframe *gpf, bGPDstroke *gps,
|
||||
const int mval[2], const int mvalo[2],
|
||||
const int radius, const rcti *rect)
|
||||
static void gp_stroke_eraser_dostroke(
|
||||
tGPsdata *p,
|
||||
bGPDframe *gpf, bGPDstroke *gps,
|
||||
const int mval[2], const int mvalo[2],
|
||||
const int radius, const rcti *rect)
|
||||
{
|
||||
bGPDspoint *pt1, *pt2;
|
||||
int pc1[2] = {0};
|
||||
|
@ -1431,10 +1433,11 @@ static void gpencil_draw_eraser(bContext *UNUSED(C), int x, int y, void *p_ptr)
|
|||
immUniform1f("dash_width", 12.0f);
|
||||
immUniform1f("dash_factor", 0.5f);
|
||||
|
||||
imm_draw_circle_wire_2d(shdr_pos, x, y, p->radius,
|
||||
/* XXX Dashed shader gives bad results with sets of small segments currently,
|
||||
* temp hack around the issue. :( */
|
||||
max_ii(8, p->radius / 2)); /* was fixed 40 */
|
||||
imm_draw_circle_wire_2d(
|
||||
shdr_pos, x, y, p->radius,
|
||||
/* XXX Dashed shader gives bad results with sets of small segments currently,
|
||||
* temp hack around the issue. :( */
|
||||
max_ii(8, p->radius / 2)); /* was fixed 40 */
|
||||
|
||||
immUnbindProgram();
|
||||
|
||||
|
@ -1453,9 +1456,10 @@ static void gpencil_draw_toggle_eraser_cursor(bContext *C, tGPsdata *p, short en
|
|||
}
|
||||
else if (enable && !p->erasercursor) {
|
||||
/* enable cursor */
|
||||
p->erasercursor = WM_paint_cursor_activate(CTX_wm_manager(C),
|
||||
NULL, /* XXX */
|
||||
gpencil_draw_eraser, p);
|
||||
p->erasercursor = WM_paint_cursor_activate(
|
||||
CTX_wm_manager(C),
|
||||
NULL, /* XXX */
|
||||
gpencil_draw_eraser, p);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -199,8 +199,9 @@ static void gp_draw_stroke_buffer_fill(const tGPspoint *points, int totpoints, f
|
|||
}
|
||||
|
||||
/* draw stroke defined in buffer (simple ogl lines/points for now, as dotted lines) */
|
||||
static void gp_draw_stroke_buffer(const tGPspoint *points, int totpoints, short thickness,
|
||||
short dflag, short sflag, float ink[4], float fill_ink[4])
|
||||
static void gp_draw_stroke_buffer(
|
||||
const tGPspoint *points, int totpoints, short thickness,
|
||||
short dflag, short sflag, float ink[4], float fill_ink[4])
|
||||
{
|
||||
int draw_points = 0;
|
||||
|
||||
|
@ -317,8 +318,9 @@ static void gp_calc_2d_stroke_fxy(const float pt[3], short sflag, int offsx, int
|
|||
/* draw a 2D buffer stroke in "volumetric" style
|
||||
* NOTE: the stroke buffer doesn't have any coordinate offsets/transforms
|
||||
*/
|
||||
static void gp_draw_stroke_volumetric_buffer(const tGPspoint *points, int totpoints, short thickness,
|
||||
short dflag, const float ink[4])
|
||||
static void gp_draw_stroke_volumetric_buffer(
|
||||
const tGPspoint *points, int totpoints, short thickness,
|
||||
short dflag, const float ink[4])
|
||||
{
|
||||
/* error checking */
|
||||
if ((points == NULL) || (totpoints <= 0))
|
||||
|
@ -350,10 +352,11 @@ static void gp_draw_stroke_volumetric_buffer(const tGPspoint *points, int totpoi
|
|||
}
|
||||
|
||||
/* draw a 2D strokes in "volumetric" style */
|
||||
static void gp_draw_stroke_volumetric_2d(const bGPDspoint *points, int totpoints, short thickness,
|
||||
short UNUSED(dflag), short sflag,
|
||||
int offsx, int offsy, int winx, int winy,
|
||||
const float diff_mat[4][4], const float ink[4])
|
||||
static void gp_draw_stroke_volumetric_2d(
|
||||
const bGPDspoint *points, int totpoints, short thickness,
|
||||
short UNUSED(dflag), short sflag,
|
||||
int offsx, int offsy, int winx, int winy,
|
||||
const float diff_mat[4][4], const float ink[4])
|
||||
{
|
||||
GPUVertFormat *format = immVertexFormat();
|
||||
uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
|
||||
|
@ -1440,7 +1443,7 @@ void ED_gp_draw_primitives(const bContext *C, tGPDprimitive *tgpi, const int typ
|
|||
}
|
||||
|
||||
Object *obact = CTX_data_active_object(C);
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph(C); \
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph(C);
|
||||
|
||||
float color[4];
|
||||
UI_GetThemeColor3fv(TH_GP_VERTEX_SELECT, color);
|
||||
|
|
|
@ -168,8 +168,9 @@ typedef struct tGP_BrushEditData {
|
|||
|
||||
|
||||
/* Callback for performing some brush operation on a single point */
|
||||
typedef bool (*GP_BrushApplyCb)(tGP_BrushEditData *gso, bGPDstroke *gps, int pt_index,
|
||||
const int radius, const int co[2]);
|
||||
typedef bool (*GP_BrushApplyCb)(
|
||||
tGP_BrushEditData *gso, bGPDstroke *gps, int pt_index,
|
||||
const int radius, const int co[2]);
|
||||
|
||||
/* ************************************************ */
|
||||
/* Utility Functions */
|
||||
|
@ -1620,7 +1621,7 @@ static bool gpsculpt_brush_do_frame(
|
|||
static bool gpsculpt_brush_apply_standard(bContext *C, tGP_BrushEditData *gso)
|
||||
{
|
||||
ToolSettings *ts = CTX_data_tool_settings(C);
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph(C); \
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph(C);
|
||||
Object *obact = gso->object;
|
||||
bGPdata *gpd = gso->gpd;
|
||||
bool changed = false;
|
||||
|
@ -1684,9 +1685,9 @@ static bool gpsculpt_brush_apply_standard(bContext *C, tGP_BrushEditData *gso)
|
|||
if (gso->use_multiframe_falloff) {
|
||||
/* Faloff depends on distance to active frame (relative to the overall frame range) */
|
||||
gso->mf_falloff = BKE_gpencil_multiframe_falloff_calc(
|
||||
gpf, gpl->actframe->framenum,
|
||||
f_init, f_end,
|
||||
ts->gp_sculpt.cur_falloff);
|
||||
gpf, gpl->actframe->framenum,
|
||||
f_init, f_end,
|
||||
ts->gp_sculpt.cur_falloff);
|
||||
}
|
||||
else {
|
||||
/* No falloff */
|
||||
|
|
|
@ -134,8 +134,9 @@ static const EnumPropertyItem prop_gpencil_convert_timingmodes[] = {
|
|||
{0, NULL, 0, NULL, NULL},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem *rna_GPConvert_mode_items(bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop),
|
||||
bool *UNUSED(r_free))
|
||||
static const EnumPropertyItem *rna_GPConvert_mode_items(
|
||||
bContext *UNUSED(C), PointerRNA *ptr, PropertyRNA *UNUSED(prop),
|
||||
bool *UNUSED(r_free))
|
||||
{
|
||||
if (RNA_boolean_get(ptr, "use_timing_data")) {
|
||||
return prop_gpencil_convert_timingmodes;
|
||||
|
@ -155,7 +156,7 @@ static void gp_strokepoint_convertcoords(
|
|||
Scene *scene = CTX_data_scene(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
ARegion *ar = CTX_wm_region(C);
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph(C); \
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph(C);
|
||||
Object *obact = CTX_data_active_object(C);
|
||||
bGPDspoint mypt, *pt;
|
||||
|
||||
|
@ -254,8 +255,9 @@ static void gp_timing_data_set_nbr(tGpTimingData *gtd, const int nbr)
|
|||
}
|
||||
|
||||
/* add stroke point to timing buffers */
|
||||
static void gp_timing_data_add_point(tGpTimingData *gtd, const double stroke_inittime, const float time,
|
||||
const float delta_dist)
|
||||
static void gp_timing_data_add_point(
|
||||
tGpTimingData *gtd, const double stroke_inittime, const float time,
|
||||
const float delta_dist)
|
||||
{
|
||||
float delta_time = 0.0f;
|
||||
const int cur_point = gtd->cur_point;
|
||||
|
@ -290,9 +292,10 @@ static void gp_timing_data_add_point(tGpTimingData *gtd, const double stroke_ini
|
|||
#define MIN_TIME_DELTA 0.02f
|
||||
|
||||
/* Loop over next points to find the end of the stroke, and compute */
|
||||
static int gp_find_end_of_stroke_idx(tGpTimingData *gtd, RNG *rng, const int idx, const int nbr_gaps,
|
||||
int *nbr_done_gaps, const float tot_gaps_time, const float delta_time,
|
||||
float *next_delta_time)
|
||||
static int gp_find_end_of_stroke_idx(
|
||||
tGpTimingData *gtd, RNG *rng, const int idx, const int nbr_gaps,
|
||||
int *nbr_done_gaps, const float tot_gaps_time, const float delta_time,
|
||||
float *next_delta_time)
|
||||
{
|
||||
int j;
|
||||
|
||||
|
@ -370,9 +373,10 @@ static void gp_stroke_path_animation_preprocess_gaps(tGpTimingData *gtd, RNG *rn
|
|||
}
|
||||
}
|
||||
|
||||
static void gp_stroke_path_animation_add_keyframes(Depsgraph *depsgraph, ReportList *reports, PointerRNA ptr, PropertyRNA *prop, FCurve *fcu,
|
||||
Curve *cu, tGpTimingData *gtd, RNG *rng, const float time_range,
|
||||
const int nbr_gaps, const float tot_gaps_time)
|
||||
static void gp_stroke_path_animation_add_keyframes(
|
||||
Depsgraph *depsgraph, ReportList *reports, PointerRNA ptr, PropertyRNA *prop, FCurve *fcu,
|
||||
Curve *cu, tGpTimingData *gtd, RNG *rng, const float time_range,
|
||||
const int nbr_gaps, const float tot_gaps_time)
|
||||
{
|
||||
/* Use actual recorded timing! */
|
||||
const float time_start = (float)gtd->start_frame;
|
||||
|
@ -398,8 +402,9 @@ static void gp_stroke_path_animation_add_keyframes(Depsgraph *depsgraph, ReportL
|
|||
start_stroke_idx = i;
|
||||
delta_time = next_delta_time;
|
||||
/* find end of that new stroke */
|
||||
end_stroke_idx = gp_find_end_of_stroke_idx(gtd, rng, i, nbr_gaps, &nbr_done_gaps,
|
||||
tot_gaps_time, delta_time, &next_delta_time);
|
||||
end_stroke_idx = gp_find_end_of_stroke_idx(
|
||||
gtd, rng, i, nbr_gaps, &nbr_done_gaps,
|
||||
tot_gaps_time, delta_time, &next_delta_time);
|
||||
/* This one should *never* be negative! */
|
||||
end_stroke_time = time_start + ((gtd->times[end_stroke_idx] + delta_time) / gtd->tot_time * time_range);
|
||||
}
|
||||
|
@ -530,8 +535,9 @@ static void gp_stroke_path_animation(bContext *C, ReportList *reports, Curve *cu
|
|||
printf("GP Stroke Path Conversion: Starting keying!\n");
|
||||
}
|
||||
|
||||
gp_stroke_path_animation_add_keyframes(depsgraph, reports, ptr, prop, fcu, cu, gtd, rng, time_range,
|
||||
nbr_gaps, tot_gaps_time);
|
||||
gp_stroke_path_animation_add_keyframes(
|
||||
depsgraph, reports, ptr, prop, fcu, cu, gtd, rng, time_range,
|
||||
nbr_gaps, tot_gaps_time);
|
||||
|
||||
BLI_rng_free(rng);
|
||||
}
|
||||
|
@ -562,9 +568,10 @@ static void gp_stroke_path_animation(bContext *C, ReportList *reports, Curve *cu
|
|||
/* convert stroke to 3d path */
|
||||
|
||||
/* helper */
|
||||
static void gp_stroke_to_path_add_point(tGpTimingData *gtd, BPoint *bp, const float p[3], const float prev_p[3],
|
||||
const bool do_gtd, const double inittime, const float time,
|
||||
const float width, const float rad_fac, float minmax_weights[2])
|
||||
static void gp_stroke_to_path_add_point(
|
||||
tGpTimingData *gtd, BPoint *bp, const float p[3], const float prev_p[3],
|
||||
const bool do_gtd, const double inittime, const float time,
|
||||
const float width, const float rad_fac, float minmax_weights[2])
|
||||
{
|
||||
copy_v3_v3(bp->vec, p);
|
||||
bp->vec[3] = 1.0f;
|
||||
|
@ -587,9 +594,10 @@ static void gp_stroke_to_path_add_point(tGpTimingData *gtd, BPoint *bp, const fl
|
|||
}
|
||||
}
|
||||
|
||||
static void gp_stroke_to_path(bContext *C, bGPdata *gpd, bGPDlayer *gpl, bGPDstroke *gps, Curve *cu, rctf *subrect, Nurb **curnu,
|
||||
float minmax_weights[2], const float rad_fac, bool stitch, const bool add_start_point,
|
||||
const bool add_end_point, tGpTimingData *gtd)
|
||||
static void gp_stroke_to_path(
|
||||
bContext *C, bGPdata *gpd, bGPDlayer *gpl, bGPDstroke *gps, Curve *cu, rctf *subrect, Nurb **curnu,
|
||||
float minmax_weights[2], const float rad_fac, bool stitch, const bool add_start_point,
|
||||
const bool add_end_point, tGpTimingData *gtd)
|
||||
{
|
||||
bGPDspoint *pt;
|
||||
Nurb *nu = (curnu) ? *curnu : NULL;
|
||||
|
@ -666,8 +674,9 @@ static void gp_stroke_to_path(bContext *C, bGPdata *gpd, bGPDlayer *gpl, bGPDstr
|
|||
}
|
||||
}
|
||||
bp++;
|
||||
gp_stroke_to_path_add_point(gtd, bp, p1, (bp - 1)->vec, do_gtd, gps->prev->inittime, dt1,
|
||||
0.0f, rad_fac, minmax_weights);
|
||||
gp_stroke_to_path_add_point(
|
||||
gtd, bp, p1, (bp - 1)->vec, do_gtd, gps->prev->inittime, dt1,
|
||||
0.0f, rad_fac, minmax_weights);
|
||||
|
||||
/* Second point */
|
||||
/* Note dt2 is always negative, which marks the gap. */
|
||||
|
@ -729,8 +738,9 @@ static void gp_stroke_to_path(bContext *C, bGPdata *gpd, bGPDlayer *gpl, bGPDstr
|
|||
/* get coordinates to add at */
|
||||
gp_strokepoint_convertcoords(C, gpd, gpl, gps, pt, p, subrect);
|
||||
|
||||
gp_stroke_to_path_add_point(gtd, bp, p, (prev_bp) ? prev_bp->vec : p, do_gtd, gps->inittime, pt->time,
|
||||
width, rad_fac, minmax_weights);
|
||||
gp_stroke_to_path_add_point(
|
||||
gtd, bp, p, (prev_bp) ? prev_bp->vec : p, do_gtd, gps->inittime, pt->time,
|
||||
width, rad_fac, minmax_weights);
|
||||
|
||||
prev_bp = bp;
|
||||
}
|
||||
|
@ -769,10 +779,11 @@ static void gp_stroke_to_path(bContext *C, bGPdata *gpd, bGPDlayer *gpl, bGPDstr
|
|||
/* convert stroke to 3d bezier */
|
||||
|
||||
/* helper */
|
||||
static void gp_stroke_to_bezier_add_point(tGpTimingData *gtd, BezTriple *bezt,
|
||||
const float p[3], const float h1[3], const float h2[3], const float prev_p[3],
|
||||
const bool do_gtd, const double inittime, const float time,
|
||||
const float width, const float rad_fac, float minmax_weights[2])
|
||||
static void gp_stroke_to_bezier_add_point(
|
||||
tGpTimingData *gtd, BezTriple *bezt,
|
||||
const float p[3], const float h1[3], const float h2[3], const float prev_p[3],
|
||||
const bool do_gtd, const double inittime, const float time,
|
||||
const float width, const float rad_fac, float minmax_weights[2])
|
||||
{
|
||||
copy_v3_v3(bezt->vec[0], h1);
|
||||
copy_v3_v3(bezt->vec[1], p);
|
||||
|
@ -797,9 +808,10 @@ static void gp_stroke_to_bezier_add_point(tGpTimingData *gtd, BezTriple *bezt,
|
|||
}
|
||||
}
|
||||
|
||||
static void gp_stroke_to_bezier(bContext *C, bGPdata *gpd, bGPDlayer *gpl, bGPDstroke *gps, Curve *cu, rctf *subrect, Nurb **curnu,
|
||||
float minmax_weights[2], const float rad_fac, bool stitch, const bool add_start_point,
|
||||
const bool add_end_point, tGpTimingData *gtd)
|
||||
static void gp_stroke_to_bezier(
|
||||
bContext *C, bGPdata *gpd, bGPDlayer *gpl, bGPDstroke *gps, Curve *cu, rctf *subrect, Nurb **curnu,
|
||||
float minmax_weights[2], const float rad_fac, bool stitch, const bool add_start_point,
|
||||
const bool add_end_point, tGpTimingData *gtd)
|
||||
{
|
||||
bGPDspoint *pt;
|
||||
Nurb *nu = (curnu) ? *curnu : NULL;
|
||||
|
@ -918,15 +930,17 @@ static void gp_stroke_to_bezier(bContext *C, bGPdata *gpd, bGPDlayer *gpl, bGPDs
|
|||
interp_v3_v3v3(h1, p1, bezt->vec[1], BEZT_HANDLE_FAC);
|
||||
interp_v3_v3v3(h2, p1, p2, BEZT_HANDLE_FAC);
|
||||
bezt++;
|
||||
gp_stroke_to_bezier_add_point(gtd, bezt, p1, h1, h2, (bezt - 1)->vec[1], do_gtd, gps->prev->inittime, dt1,
|
||||
0.0f, rad_fac, minmax_weights);
|
||||
gp_stroke_to_bezier_add_point(
|
||||
gtd, bezt, p1, h1, h2, (bezt - 1)->vec[1], do_gtd, gps->prev->inittime, dt1,
|
||||
0.0f, rad_fac, minmax_weights);
|
||||
|
||||
/* Second point */
|
||||
interp_v3_v3v3(h1, p2, p1, BEZT_HANDLE_FAC);
|
||||
interp_v3_v3v3(h2, p2, p3d_cur, BEZT_HANDLE_FAC);
|
||||
bezt++;
|
||||
gp_stroke_to_bezier_add_point(gtd, bezt, p2, h1, h2, p1, do_gtd, gps->inittime, dt2,
|
||||
0.0f, rad_fac, minmax_weights);
|
||||
gp_stroke_to_bezier_add_point(
|
||||
gtd, bezt, p2, h1, h2, p1, do_gtd, gps->inittime, dt2,
|
||||
0.0f, rad_fac, minmax_weights);
|
||||
|
||||
old_nbezt += 2;
|
||||
copy_v3_v3(p3d_prev, p2);
|
||||
|
@ -950,8 +964,9 @@ static void gp_stroke_to_bezier(bContext *C, bGPdata *gpd, bGPDlayer *gpl, bGPDs
|
|||
interp_v3_v3v3(h1, p, p3d_cur, -BEZT_HANDLE_FAC);
|
||||
interp_v3_v3v3(h2, p, p3d_cur, BEZT_HANDLE_FAC);
|
||||
bezt = &nu->bezt[old_nbezt];
|
||||
gp_stroke_to_bezier_add_point(gtd, bezt, p, h1, h2, p, do_gtd, gps->inittime, dt,
|
||||
0.0f, rad_fac, minmax_weights);
|
||||
gp_stroke_to_bezier_add_point(
|
||||
gtd, bezt, p, h1, h2, p, do_gtd, gps->inittime, dt,
|
||||
0.0f, rad_fac, minmax_weights);
|
||||
|
||||
old_nbezt++;
|
||||
copy_v3_v3(p3d_prev, p);
|
||||
|
@ -979,8 +994,9 @@ static void gp_stroke_to_bezier(bContext *C, bGPdata *gpd, bGPDlayer *gpl, bGPDs
|
|||
interp_v3_v3v3(h2, p3d_cur, p3d_prev, -BEZT_HANDLE_FAC);
|
||||
}
|
||||
|
||||
gp_stroke_to_bezier_add_point(gtd, bezt, p3d_cur, h1, h2, prev_bezt ? prev_bezt->vec[1] : p3d_cur,
|
||||
do_gtd, gps->inittime, pt->time, width, rad_fac, minmax_weights);
|
||||
gp_stroke_to_bezier_add_point(
|
||||
gtd, bezt, p3d_cur, h1, h2, prev_bezt ? prev_bezt->vec[1] : p3d_cur,
|
||||
do_gtd, gps->inittime, pt->time, width, rad_fac, minmax_weights);
|
||||
|
||||
/* shift coord vects */
|
||||
copy_v3_v3(p3d_prev, p3d_cur);
|
||||
|
@ -1018,8 +1034,9 @@ static void gp_stroke_to_bezier(bContext *C, bGPdata *gpd, bGPDlayer *gpl, bGPDs
|
|||
interp_v3_v3v3(h1, p, prev_bezt->vec[1], BEZT_HANDLE_FAC);
|
||||
interp_v3_v3v3(h2, p, prev_bezt->vec[1], -BEZT_HANDLE_FAC);
|
||||
/* Note bezt has already been incremented in main loop above, so it points to the right place. */
|
||||
gp_stroke_to_bezier_add_point(gtd, bezt, p, h1, h2, prev_bezt->vec[1], do_gtd, gps->inittime, dt,
|
||||
0.0f, rad_fac, minmax_weights);
|
||||
gp_stroke_to_bezier_add_point(
|
||||
gtd, bezt, p, h1, h2, prev_bezt->vec[1], do_gtd, gps->inittime, dt,
|
||||
0.0f, rad_fac, minmax_weights);
|
||||
}
|
||||
|
||||
/* must calculate handles or else we crash */
|
||||
|
@ -1122,8 +1139,9 @@ static int gp_camera_view_subrect(bContext *C, rctf *subrect)
|
|||
}
|
||||
|
||||
/* convert a given grease-pencil layer to a 3d-curve representation (using current view if appropriate) */
|
||||
static void gp_layer_to_curve(bContext *C, ReportList *reports, bGPdata *gpd, bGPDlayer *gpl, const int mode,
|
||||
const bool norm_weights, const float rad_fac, const bool link_strokes, tGpTimingData *gtd)
|
||||
static void gp_layer_to_curve(
|
||||
bContext *C, ReportList *reports, bGPdata *gpd, bGPDlayer *gpl, const int mode,
|
||||
const bool norm_weights, const float rad_fac, const bool link_strokes, tGpTimingData *gtd)
|
||||
{
|
||||
struct Main *bmain = CTX_data_main(C);
|
||||
ViewLayer *view_layer = CTX_data_view_layer(C);
|
||||
|
@ -1190,13 +1208,15 @@ static void gp_layer_to_curve(bContext *C, ReportList *reports, bGPdata *gpd, bG
|
|||
|
||||
switch (mode) {
|
||||
case GP_STROKECONVERT_PATH:
|
||||
gp_stroke_to_path(C, gpd, gpl, gps, cu, subrect_ptr, &nu, minmax_weights, rad_fac, stitch,
|
||||
add_start_point, add_end_point, gtd);
|
||||
gp_stroke_to_path(
|
||||
C, gpd, gpl, gps, cu, subrect_ptr, &nu, minmax_weights, rad_fac, stitch,
|
||||
add_start_point, add_end_point, gtd);
|
||||
break;
|
||||
case GP_STROKECONVERT_CURVE:
|
||||
case GP_STROKECONVERT_POLY: /* convert after */
|
||||
gp_stroke_to_bezier(C, gpd, gpl, gps, cu, subrect_ptr, &nu, minmax_weights, rad_fac, stitch,
|
||||
add_start_point, add_end_point, gtd);
|
||||
gp_stroke_to_bezier(
|
||||
C, gpd, gpl, gps, cu, subrect_ptr, &nu, minmax_weights, rad_fac, stitch,
|
||||
add_start_point, add_end_point, gtd);
|
||||
break;
|
||||
default:
|
||||
BLI_assert(!"invalid mode");
|
||||
|
|
|
@ -1994,8 +1994,9 @@ static void joined_gpencil_fix_animdata_cb(ID *id, FCurve *fcu, void *user_data)
|
|||
|
||||
/* only remap if changed; this still means there will be some waste if there aren't many drivers/keys */
|
||||
if (!STREQ(old_name, new_name) && strstr(fcu->rna_path, old_name)) {
|
||||
fcu->rna_path = BKE_animsys_fix_rna_path_rename(id, fcu->rna_path, "layers",
|
||||
old_name, new_name, 0, 0, false);
|
||||
fcu->rna_path = BKE_animsys_fix_rna_path_rename(
|
||||
id, fcu->rna_path, "layers",
|
||||
old_name, new_name, 0, 0, false);
|
||||
|
||||
/* we don't want to apply a second remapping on this F-Curve now,
|
||||
* so stop trying to fix names names
|
||||
|
@ -2029,8 +2030,9 @@ static void joined_gpencil_fix_animdata_cb(ID *id, FCurve *fcu, void *user_data)
|
|||
if (!STREQ(old_name, new_name)) {
|
||||
if ((dtar->rna_path) && strstr(dtar->rna_path, old_name)) {
|
||||
/* Fix up path */
|
||||
dtar->rna_path = BKE_animsys_fix_rna_path_rename(id, dtar->rna_path, "layers",
|
||||
old_name, new_name, 0, 0, false);
|
||||
dtar->rna_path = BKE_animsys_fix_rna_path_rename(
|
||||
id, dtar->rna_path, "layers",
|
||||
old_name, new_name, 0, 0, false);
|
||||
break; /* no need to try any more names for layer path */
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2192,10 +2192,10 @@ static int gp_snap_to_cursor(bContext *C, wmOperator *op)
|
|||
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph(C); \
|
||||
Object *obact = CTX_data_active_object(C); \
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph(C);
|
||||
Object *obact = CTX_data_active_object(C);
|
||||
|
||||
const bool use_offset = RNA_boolean_get(op->ptr, "use_offset");
|
||||
const bool use_offset = RNA_boolean_get(op->ptr, "use_offset");
|
||||
const float *cursor_global = ED_view3d_cursor3d_get(scene, v3d)->location;
|
||||
|
||||
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
|
||||
|
@ -2280,10 +2280,10 @@ static int gp_snap_cursor_to_sel(bContext *C, wmOperator *UNUSED(op))
|
|||
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
View3D *v3d = CTX_wm_view3d(C);
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph(C); \
|
||||
Object *obact = CTX_data_active_object(C); \
|
||||
Depsgraph *depsgraph = CTX_data_depsgraph(C);
|
||||
Object *obact = CTX_data_active_object(C);
|
||||
|
||||
float *cursor = ED_view3d_cursor3d_get(scene, v3d)->location;
|
||||
float *cursor = ED_view3d_cursor3d_get(scene, v3d)->location;
|
||||
float centroid[3] = {0.0f};
|
||||
float min[3], max[3];
|
||||
size_t count = 0;
|
||||
|
|
|
@ -127,8 +127,8 @@ typedef struct tGPDfill {
|
|||
|
||||
/* draw a given stroke using same thickness and color for all points */
|
||||
static void gp_draw_basic_stroke(
|
||||
tGPDfill *tgpf, bGPDstroke *gps, const float diff_mat[4][4],
|
||||
bool cyclic, float ink[4], int flag, float thershold)
|
||||
tGPDfill *tgpf, bGPDstroke *gps, const float diff_mat[4][4],
|
||||
const bool cyclic, const float ink[4], const int flag, const float thershold)
|
||||
{
|
||||
bGPDspoint *points = gps->points;
|
||||
|
||||
|
@ -183,7 +183,7 @@ static void gp_draw_basic_stroke(
|
|||
}
|
||||
|
||||
/* loop all layers */
|
||||
static void gp_draw_datablock(tGPDfill *tgpf, float ink[4])
|
||||
static void gp_draw_datablock(tGPDfill *tgpf, const float ink[4])
|
||||
{
|
||||
/* duplicated: etempFlags */
|
||||
enum {
|
||||
|
@ -258,8 +258,9 @@ static void gp_draw_datablock(tGPDfill *tgpf, float ink[4])
|
|||
if ((tgpf->fill_draw_mode == GP_FILL_DMODE_CONTROL) ||
|
||||
(tgpf->fill_draw_mode == GP_FILL_DMODE_BOTH))
|
||||
{
|
||||
gp_draw_basic_stroke(tgpf, gps, tgpw.diff_mat, gps->flag & GP_STROKE_CYCLIC, ink,
|
||||
tgpf->flag, tgpf->fill_threshold);
|
||||
gp_draw_basic_stroke(
|
||||
tgpf, gps, tgpw.diff_mat, gps->flag & GP_STROKE_CYCLIC, ink,
|
||||
tgpf->flag, tgpf->fill_threshold);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -322,7 +323,7 @@ static void gp_render_offscreen(tGPDfill *tgpf)
|
|||
GPU_matrix_set(tgpf->rv3d->viewmat);
|
||||
|
||||
/* draw strokes */
|
||||
float ink[4] = { 1.0f, 0.0f, 0.0f, 1.0f };
|
||||
float ink[4] = {1.0f, 0.0f, 0.0f, 1.0f};
|
||||
gp_draw_datablock(tgpf, ink);
|
||||
|
||||
/* restore size */
|
||||
|
@ -355,10 +356,10 @@ static void gp_render_offscreen(tGPDfill *tgpf)
|
|||
}
|
||||
|
||||
/* return pixel data (rgba) at index */
|
||||
static void get_pixel(ImBuf *ibuf, int idx, float r_col[4])
|
||||
static void get_pixel(const ImBuf *ibuf, const int idx, float r_col[4])
|
||||
{
|
||||
if (ibuf->rect_float) {
|
||||
float *frgba = &ibuf->rect_float[idx * 4];
|
||||
const float *frgba = &ibuf->rect_float[idx * 4];
|
||||
copy_v4_v4(r_col, frgba);
|
||||
}
|
||||
else {
|
||||
|
@ -637,14 +638,14 @@ static void gpencil_get_outline_points(tGPDfill *tgpf)
|
|||
const int NEIGHBOR_COUNT = 8;
|
||||
|
||||
const int offset[8][2] = {
|
||||
{ -1, -1 },
|
||||
{ 0, -1 },
|
||||
{ 1, -1 },
|
||||
{ 1, 0 },
|
||||
{ 1, 1 },
|
||||
{ 0, 1 },
|
||||
{ -1, 1 },
|
||||
{ -1, 0 }
|
||||
{-1, -1},
|
||||
{0, -1},
|
||||
{1, -1},
|
||||
{1, 0},
|
||||
{1, 1},
|
||||
{0, 1},
|
||||
{-1, 1},
|
||||
{-1, 0}
|
||||
};
|
||||
|
||||
tgpf->stack = BLI_stack_new(sizeof(int[2]), __func__);
|
||||
|
@ -919,10 +920,12 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf)
|
|||
/* if axis locked, reproject to plane locked */
|
||||
if ((tgpf->lock_axis > GP_LOCKAXIS_NONE) && ((ts->gpencil_v3d_align & GP_PROJECT_DEPTH_VIEW) == 0)) {
|
||||
float origin[3];
|
||||
ED_gp_get_drawing_reference(tgpf->v3d, tgpf->scene, tgpf->ob, tgpf->gpl,
|
||||
ts->gpencil_v3d_align, origin);
|
||||
ED_gp_project_stroke_to_plane(tgpf->ob, tgpf->rv3d, gps, origin,
|
||||
tgpf->lock_axis - 1);
|
||||
ED_gp_get_drawing_reference(
|
||||
tgpf->v3d, tgpf->scene, tgpf->ob, tgpf->gpl,
|
||||
ts->gpencil_v3d_align, origin);
|
||||
ED_gp_project_stroke_to_plane(
|
||||
tgpf->ob, tgpf->rv3d, gps, origin,
|
||||
tgpf->lock_axis - 1);
|
||||
}
|
||||
|
||||
/* if parented change position relative to parent object */
|
||||
|
@ -952,7 +955,7 @@ static void gpencil_draw_boundary_lines(const bContext *UNUSED(C), tGPDfill *tgp
|
|||
if (!tgpf->gpd) {
|
||||
return;
|
||||
}
|
||||
float ink[4] = { 1.0f, 0.0f, 0.0f, 1.0f };
|
||||
const float ink[4] = {1.0f, 0.0f, 0.0f, 1.0f};
|
||||
gp_draw_datablock(tgpf, ink);
|
||||
}
|
||||
|
||||
|
|
|
@ -192,16 +192,19 @@ typedef struct GP_SpaceConversion {
|
|||
float mat[4][4]; /* transform matrix on the strokes (introduced in [b770964]) */
|
||||
} GP_SpaceConversion;
|
||||
|
||||
bool gp_stroke_inside_circle(const int mval[2], const int UNUSED(mvalo[2]),
|
||||
int rad, int x0, int y0, int x1, int y1);
|
||||
bool gp_stroke_inside_circle(
|
||||
const int mval[2], const int UNUSED(mvalo[2]),
|
||||
int rad, int x0, int y0, int x1, int y1);
|
||||
|
||||
void gp_point_conversion_init(struct bContext *C, GP_SpaceConversion *r_gsc);
|
||||
|
||||
void gp_point_to_xy(GP_SpaceConversion *settings, struct bGPDstroke *gps, struct bGPDspoint *pt,
|
||||
int *r_x, int *r_y);
|
||||
void gp_point_to_xy(
|
||||
GP_SpaceConversion *settings, struct bGPDstroke *gps, struct bGPDspoint *pt,
|
||||
int *r_x, int *r_y);
|
||||
|
||||
void gp_point_to_xy_fl(GP_SpaceConversion *gsc, bGPDstroke *gps, bGPDspoint *pt,
|
||||
float *r_x, float *r_y);
|
||||
void gp_point_to_xy_fl(
|
||||
GP_SpaceConversion *gsc, bGPDstroke *gps, bGPDspoint *pt,
|
||||
float *r_x, float *r_y);
|
||||
|
||||
void gp_point_to_parent_space(bGPDspoint *pt, float diff_mat[4][4], bGPDspoint *r_pt);
|
||||
/**
|
||||
|
|
|
@ -563,8 +563,8 @@ static short gp_stroke_addpoint(
|
|||
tGPspoint *pt;
|
||||
ToolSettings *ts = p->scene->toolsettings;
|
||||
Object *obact = (Object *)p->ownerPtr.data;
|
||||
Depsgraph *depsgraph = p->depsgraph; \
|
||||
RegionView3D *rv3d = p->ar->regiondata;
|
||||
Depsgraph *depsgraph = p->depsgraph;
|
||||
RegionView3D *rv3d = p->ar->regiondata;
|
||||
View3D *v3d = p->sa->spacedata.first;
|
||||
MaterialGPencilStyle *gp_style = p->material->gp_style;
|
||||
const int def_nr = obact->actdef - 1;
|
||||
|
|
|
@ -434,8 +434,9 @@ const EnumPropertyItem *ED_gpencil_layers_with_new_enum_itemf(
|
|||
* \param x0, y0 The screen-space x and y coordinates of the start of the stroke segment
|
||||
* \param x1, y1 The screen-space x and y coordinates of the end of the stroke segment
|
||||
*/
|
||||
bool gp_stroke_inside_circle(const int mval[2], const int UNUSED(mvalo[2]),
|
||||
int rad, int x0, int y0, int x1, int y1)
|
||||
bool gp_stroke_inside_circle(
|
||||
const int mval[2], const int UNUSED(mvalo[2]),
|
||||
int rad, int x0, int y0, int x1, int y1)
|
||||
{
|
||||
/* simple within-radius check for now */
|
||||
const float mval_fl[2] = {mval[0], mval[1]};
|
||||
|
@ -550,9 +551,9 @@ void gp_point_conversion_init(bContext *C, GP_SpaceConversion *r_gsc)
|
|||
/**
|
||||
* Convert point to parent space
|
||||
*
|
||||
* \param pt Original point
|
||||
* \param diff_mat Matrix with the difference between original parent matrix
|
||||
* \param[out] r_pt Pointer to new point after apply matrix
|
||||
* \param pt: Original point
|
||||
* \param diff_mat: Matrix with the difference between original parent matrix
|
||||
* \param[out] r_pt: Pointer to new point after apply matrix
|
||||
*/
|
||||
void gp_point_to_parent_space(bGPDspoint *pt, float diff_mat[4][4], bGPDspoint *r_pt)
|
||||
{
|
||||
|
@ -610,8 +611,9 @@ void gp_apply_parent_point(Depsgraph *depsgraph, Object *obact, bGPdata *gpd, bG
|
|||
*
|
||||
* \warning This assumes that the caller has already checked whether the stroke in question can be drawn.
|
||||
*/
|
||||
void gp_point_to_xy(GP_SpaceConversion *gsc, bGPDstroke *gps, bGPDspoint *pt,
|
||||
int *r_x, int *r_y)
|
||||
void gp_point_to_xy(
|
||||
GP_SpaceConversion *gsc, bGPDstroke *gps, bGPDspoint *pt,
|
||||
int *r_x, int *r_y)
|
||||
{
|
||||
ARegion *ar = gsc->ar;
|
||||
View2D *v2d = gsc->v2d;
|
||||
|
@ -663,8 +665,9 @@ void gp_point_to_xy(GP_SpaceConversion *gsc, bGPDstroke *gps, bGPDspoint *pt,
|
|||
*
|
||||
* \warning This assumes that the caller has already checked whether the stroke in question can be drawn
|
||||
*/
|
||||
void gp_point_to_xy_fl(GP_SpaceConversion *gsc, bGPDstroke *gps, bGPDspoint *pt,
|
||||
float *r_x, float *r_y)
|
||||
void gp_point_to_xy_fl(
|
||||
GP_SpaceConversion *gsc, bGPDstroke *gps, bGPDspoint *pt,
|
||||
float *r_x, float *r_y)
|
||||
{
|
||||
ARegion *ar = gsc->ar;
|
||||
View2D *v2d = gsc->v2d;
|
||||
|
@ -929,8 +932,8 @@ void ED_gp_project_point_to_plane(Object *ob, RegionView3D *rv3d, const float or
|
|||
|
||||
/**
|
||||
* Subdivide a stroke once, by adding a point half way between each pair of existing points
|
||||
* \param gps Stroke data
|
||||
* \param subdivide Number of times to subdivide
|
||||
* \param gps: Stroke data
|
||||
* \param subdivide: Number of times to subdivide
|
||||
*/
|
||||
void gp_subdivide_stroke(bGPDstroke *gps, const int subdivide)
|
||||
{
|
||||
|
@ -1024,8 +1027,8 @@ void gp_subdivide_stroke(bGPDstroke *gps, const int subdivide)
|
|||
|
||||
/**
|
||||
* Add randomness to stroke
|
||||
* \param gps Stroke data
|
||||
* \param brush Brush data
|
||||
* \param gps: Stroke data
|
||||
* \param brush: Brush data
|
||||
*/
|
||||
void gp_randomize_stroke(bGPDstroke *gps, Brush *brush, RNG *rng)
|
||||
{
|
||||
|
@ -1679,10 +1682,11 @@ void ED_gpencil_toggle_brush_cursor(bContext *C, bool enable, void *customdata)
|
|||
gset->paintcursor = NULL;
|
||||
}
|
||||
/* enable cursor */
|
||||
gset->paintcursor = WM_paint_cursor_activate(CTX_wm_manager(C),
|
||||
NULL,
|
||||
gp_brush_drawcursor,
|
||||
(lastpost) ? customdata : NULL);
|
||||
gset->paintcursor = WM_paint_cursor_activate(
|
||||
CTX_wm_manager(C),
|
||||
NULL,
|
||||
gp_brush_drawcursor,
|
||||
(lastpost) ? customdata : NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue