GPencil: Cleanup function names replace gp_ by gpencil_ prefix (cont)
This commit is contained in:
parent
a351eb0726
commit
164a49f047
|
@ -1129,7 +1129,7 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf)
|
|||
((ts->gpencil_v3d_align & GP_PROJECT_DEPTH_VIEW) == 0)) {
|
||||
float origin[3];
|
||||
ED_gpencil_drawing_reference_get(tgpf->scene, tgpf->ob, ts->gpencil_v3d_align, origin);
|
||||
ED_gp_project_stroke_to_plane(
|
||||
ED_gpencil_project_stroke_to_plane(
|
||||
tgpf->scene, tgpf->ob, tgpf->rv3d, gps, origin, tgpf->lock_axis - 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -431,7 +431,7 @@ static void gpencil_reproject_toplane(tGPsdata *p, bGPDstroke *gps)
|
|||
|
||||
/* get drawing origin */
|
||||
gpencil_get_3d_reference(p, origin);
|
||||
ED_gp_project_stroke_to_plane(p->scene, obact, rv3d, gps, origin, p->lock_axis - 1);
|
||||
ED_gpencil_project_stroke_to_plane(p->scene, obact, rv3d, gps, origin, p->lock_axis - 1);
|
||||
}
|
||||
|
||||
/* convert screen-coordinates to buffer-coordinates */
|
||||
|
@ -891,11 +891,11 @@ static short gpencil_stroke_addpoint(tGPsdata *p,
|
|||
gpencil_get_3d_reference(p, origin);
|
||||
/* reproject current */
|
||||
ED_gpencil_tpoint_to_point(p->region, origin, pt, &spt);
|
||||
ED_gp_project_point_to_plane(p->scene, obact, rv3d, origin, p->lock_axis - 1, &spt);
|
||||
ED_gpencil_project_point_to_plane(p->scene, obact, rv3d, origin, p->lock_axis - 1, &spt);
|
||||
|
||||
/* reproject previous */
|
||||
ED_gpencil_tpoint_to_point(p->region, origin, ptb, &spt2);
|
||||
ED_gp_project_point_to_plane(p->scene, obact, rv3d, origin, p->lock_axis - 1, &spt2);
|
||||
ED_gpencil_project_point_to_plane(p->scene, obact, rv3d, origin, p->lock_axis - 1, &spt2);
|
||||
p->totpixlen += len_v3v3(&spt.x, &spt2.x);
|
||||
pt->uv_fac = p->totpixlen;
|
||||
}
|
||||
|
|
|
@ -982,12 +982,12 @@ static void gpencil_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
|
|||
ED_gpencil_drawing_reference_get(tgpi->scene, tgpi->ob, ts->gpencil_v3d_align, origin);
|
||||
/* reproject current */
|
||||
ED_gpencil_tpoint_to_point(tgpi->region, origin, tpt, &spt);
|
||||
ED_gp_project_point_to_plane(
|
||||
ED_gpencil_project_point_to_plane(
|
||||
tgpi->scene, tgpi->ob, tgpi->rv3d, origin, tgpi->lock_axis - 1, &spt);
|
||||
|
||||
/* reproject previous */
|
||||
ED_gpencil_tpoint_to_point(tgpi->region, origin, tptb, &spt2);
|
||||
ED_gp_project_point_to_plane(
|
||||
ED_gpencil_project_point_to_plane(
|
||||
tgpi->scene, tgpi->ob, tgpi->rv3d, origin, tgpi->lock_axis - 1, &spt2);
|
||||
tgpi->totpixlen += len_v3v3(&spt.x, &spt2.x);
|
||||
tpt->uv_fac = tgpi->totpixlen;
|
||||
|
@ -1045,7 +1045,7 @@ static void gpencil_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
|
|||
if (!is_depth) {
|
||||
float origin[3];
|
||||
ED_gpencil_drawing_reference_get(tgpi->scene, tgpi->ob, ts->gpencil_v3d_align, origin);
|
||||
ED_gp_project_stroke_to_plane(
|
||||
ED_gpencil_project_stroke_to_plane(
|
||||
tgpi->scene, tgpi->ob, tgpi->rv3d, gps, origin, ts->gp_sculpt.lock_axis - 1);
|
||||
}
|
||||
|
||||
|
|
|
@ -172,9 +172,9 @@ typedef bool (*GP_BrushApplyCb)(tGP_BrushEditData *gso,
|
|||
/* Utility Functions */
|
||||
|
||||
/* apply lock axis reset */
|
||||
static void gpsculpt_compute_lock_axis(tGP_BrushEditData *gso,
|
||||
bGPDspoint *pt,
|
||||
const float save_pt[3])
|
||||
static void gpencil_sculpt_compute_lock_axis(tGP_BrushEditData *gso,
|
||||
bGPDspoint *pt,
|
||||
const float save_pt[3])
|
||||
{
|
||||
const ToolSettings *ts = gso->scene->toolsettings;
|
||||
const View3DCursor *cursor = &gso->scene->cursor;
|
||||
|
@ -221,7 +221,7 @@ static void gpsculpt_compute_lock_axis(tGP_BrushEditData *gso,
|
|||
/* Context ---------------------------------------- */
|
||||
|
||||
/* Get the sculpting settings */
|
||||
static GP_Sculpt_Settings *gpsculpt_get_settings(Scene *scene)
|
||||
static GP_Sculpt_Settings *gpencil_sculpt_get_settings(Scene *scene)
|
||||
{
|
||||
return &scene->toolsettings->gp_sculpt;
|
||||
}
|
||||
|
@ -229,7 +229,7 @@ static GP_Sculpt_Settings *gpsculpt_get_settings(Scene *scene)
|
|||
/* Brush Operations ------------------------------- */
|
||||
|
||||
/* Invert behavior of brush? */
|
||||
static bool gp_brush_invert_check(tGP_BrushEditData *gso)
|
||||
static bool gpencil_brush_invert_check(tGP_BrushEditData *gso)
|
||||
{
|
||||
/* The basic setting is the brush's setting (from the panel) */
|
||||
bool invert = ((gso->brush->gpencil_settings->sculpt_flag & GP_SCULPT_FLAG_INVERT) != 0) ||
|
||||
|
@ -251,7 +251,9 @@ static bool gp_brush_invert_check(tGP_BrushEditData *gso)
|
|||
}
|
||||
|
||||
/* Compute strength of effect */
|
||||
static float gp_brush_influence_calc(tGP_BrushEditData *gso, const int radius, const int co[2])
|
||||
static float gpencil_brush_influence_calc(tGP_BrushEditData *gso,
|
||||
const int radius,
|
||||
const int co[2])
|
||||
{
|
||||
Brush *brush = gso->brush;
|
||||
|
||||
|
@ -322,14 +324,14 @@ static void gpencil_update_geometry(bGPdata *gpd)
|
|||
|
||||
/* A simple (but slower + inaccurate)
|
||||
* smooth-brush implementation to test the algorithm for stroke smoothing. */
|
||||
static bool gp_brush_smooth_apply(tGP_BrushEditData *gso,
|
||||
bGPDstroke *gps,
|
||||
float UNUSED(rot_eval),
|
||||
int pt_index,
|
||||
const int radius,
|
||||
const int co[2])
|
||||
static bool gpencil_brush_smooth_apply(tGP_BrushEditData *gso,
|
||||
bGPDstroke *gps,
|
||||
float UNUSED(rot_eval),
|
||||
int pt_index,
|
||||
const int radius,
|
||||
const int co[2])
|
||||
{
|
||||
float inf = gp_brush_influence_calc(gso, radius, co);
|
||||
float inf = gpencil_brush_influence_calc(gso, radius, co);
|
||||
|
||||
/* perform smoothing */
|
||||
if (gso->brush->gpencil_settings->sculpt_mode_flag & GP_SCULPT_FLAGMODE_APPLY_POSITION) {
|
||||
|
@ -352,12 +354,12 @@ static bool gp_brush_smooth_apply(tGP_BrushEditData *gso,
|
|||
/* Line Thickness Brush */
|
||||
|
||||
/* Make lines thicker or thinner by the specified amounts */
|
||||
static bool gp_brush_thickness_apply(tGP_BrushEditData *gso,
|
||||
bGPDstroke *gps,
|
||||
float UNUSED(rot_eval),
|
||||
int pt_index,
|
||||
const int radius,
|
||||
const int co[2])
|
||||
static bool gpencil_brush_thickness_apply(tGP_BrushEditData *gso,
|
||||
bGPDstroke *gps,
|
||||
float UNUSED(rot_eval),
|
||||
int pt_index,
|
||||
const int radius,
|
||||
const int co[2])
|
||||
{
|
||||
bGPDspoint *pt = gps->points + pt_index;
|
||||
float inf;
|
||||
|
@ -366,12 +368,12 @@ static bool gp_brush_thickness_apply(tGP_BrushEditData *gso,
|
|||
* - We divide the strength by 10, so that users can set "sane" values.
|
||||
* Otherwise, good default values are in the range of 0.093
|
||||
*/
|
||||
inf = gp_brush_influence_calc(gso, radius, co) / 10.0f;
|
||||
inf = gpencil_brush_influence_calc(gso, radius, co) / 10.0f;
|
||||
|
||||
/* apply */
|
||||
/* XXX: this is much too strong,
|
||||
* and it should probably do some smoothing with the surrounding stuff. */
|
||||
if (gp_brush_invert_check(gso)) {
|
||||
if (gpencil_brush_invert_check(gso)) {
|
||||
/* make line thinner - reduce stroke pressure */
|
||||
pt->pressure -= inf;
|
||||
}
|
||||
|
@ -396,21 +398,21 @@ static bool gp_brush_thickness_apply(tGP_BrushEditData *gso,
|
|||
/* Color Strength Brush */
|
||||
|
||||
/* Make color more or less transparent by the specified amounts */
|
||||
static bool gp_brush_strength_apply(tGP_BrushEditData *gso,
|
||||
bGPDstroke *gps,
|
||||
float UNUSED(rot_eval),
|
||||
int pt_index,
|
||||
const int radius,
|
||||
const int co[2])
|
||||
static bool gpencil_brush_strength_apply(tGP_BrushEditData *gso,
|
||||
bGPDstroke *gps,
|
||||
float UNUSED(rot_eval),
|
||||
int pt_index,
|
||||
const int radius,
|
||||
const int co[2])
|
||||
{
|
||||
bGPDspoint *pt = gps->points + pt_index;
|
||||
float inf;
|
||||
|
||||
/* Compute strength of effect */
|
||||
inf = gp_brush_influence_calc(gso, radius, co) * 0.125f;
|
||||
inf = gpencil_brush_influence_calc(gso, radius, co) * 0.125f;
|
||||
|
||||
/* Invert effect. */
|
||||
if (gp_brush_invert_check(gso)) {
|
||||
if (gpencil_brush_invert_check(gso)) {
|
||||
inf *= -1.0f;
|
||||
}
|
||||
|
||||
|
@ -443,7 +445,7 @@ typedef struct tGPSB_Grab_StrokeData {
|
|||
} tGPSB_Grab_StrokeData;
|
||||
|
||||
/* initialise custom data for handling this stroke */
|
||||
static void gp_brush_grab_stroke_init(tGP_BrushEditData *gso, bGPDstroke *gps)
|
||||
static void gpencil_brush_grab_stroke_init(tGP_BrushEditData *gso, bGPDstroke *gps)
|
||||
{
|
||||
tGPSB_Grab_StrokeData *data = NULL;
|
||||
|
||||
|
@ -481,15 +483,15 @@ static void gp_brush_grab_stroke_init(tGP_BrushEditData *gso, bGPDstroke *gps)
|
|||
}
|
||||
|
||||
/* store references to stroke points in the initial stage */
|
||||
static bool gp_brush_grab_store_points(tGP_BrushEditData *gso,
|
||||
bGPDstroke *gps,
|
||||
float rot_eval,
|
||||
int pt_index,
|
||||
const int radius,
|
||||
const int co[2])
|
||||
static bool gpencil_brush_grab_store_points(tGP_BrushEditData *gso,
|
||||
bGPDstroke *gps,
|
||||
float rot_eval,
|
||||
int pt_index,
|
||||
const int radius,
|
||||
const int co[2])
|
||||
{
|
||||
tGPSB_Grab_StrokeData *data = BLI_ghash_lookup(gso->stroke_customdata, gps);
|
||||
float inf = gp_brush_influence_calc(gso, radius, co);
|
||||
float inf = gpencil_brush_influence_calc(gso, radius, co);
|
||||
|
||||
BLI_assert(data != NULL);
|
||||
BLI_assert(data->size < data->capacity);
|
||||
|
@ -505,7 +507,7 @@ static bool gp_brush_grab_store_points(tGP_BrushEditData *gso,
|
|||
}
|
||||
|
||||
/* Compute effect vector for grab brush */
|
||||
static void gp_brush_grab_calc_dvec(tGP_BrushEditData *gso)
|
||||
static void gpencil_brush_grab_calc_dvec(tGP_BrushEditData *gso)
|
||||
{
|
||||
/* Convert mouse-movements to movement vector */
|
||||
RegionView3D *rv3d = gso->region->regiondata;
|
||||
|
@ -532,9 +534,9 @@ static void gp_brush_grab_calc_dvec(tGP_BrushEditData *gso)
|
|||
}
|
||||
|
||||
/* Apply grab transform to all relevant points of the affected strokes */
|
||||
static void gp_brush_grab_apply_cached(tGP_BrushEditData *gso,
|
||||
bGPDstroke *gps,
|
||||
const float diff_mat[4][4])
|
||||
static void gpencil_brush_grab_apply_cached(tGP_BrushEditData *gso,
|
||||
bGPDstroke *gps,
|
||||
const float diff_mat[4][4])
|
||||
{
|
||||
tGPSB_Grab_StrokeData *data = BLI_ghash_lookup(gso->stroke_customdata, gps);
|
||||
/* If a new frame is created, could be impossible find the stroke. */
|
||||
|
@ -553,7 +555,7 @@ static void gp_brush_grab_apply_cached(tGP_BrushEditData *gso,
|
|||
|
||||
/* get evaluated transformation */
|
||||
gso->rot_eval = data->rot_eval[i];
|
||||
gp_brush_grab_calc_dvec(gso);
|
||||
gpencil_brush_grab_calc_dvec(gso);
|
||||
|
||||
/* adjust the amount of displacement to apply */
|
||||
mul_v3_v3fl(delta, gso->dvec, data->weights[i]);
|
||||
|
@ -569,12 +571,12 @@ static void gp_brush_grab_apply_cached(tGP_BrushEditData *gso,
|
|||
mul_m4_v3(inverse_diff_mat, &pt->x);
|
||||
|
||||
/* compute lock axis */
|
||||
gpsculpt_compute_lock_axis(gso, pt, save_pt);
|
||||
gpencil_sculpt_compute_lock_axis(gso, pt, save_pt);
|
||||
}
|
||||
}
|
||||
|
||||
/* free customdata used for handling this stroke */
|
||||
static void gp_brush_grab_stroke_free(void *ptr)
|
||||
static void gpencil_brush_grab_stroke_free(void *ptr)
|
||||
{
|
||||
tGPSB_Grab_StrokeData *data = (tGPSB_Grab_StrokeData *)ptr;
|
||||
|
||||
|
@ -589,19 +591,19 @@ static void gp_brush_grab_stroke_free(void *ptr)
|
|||
|
||||
/* ----------------------------------------------- */
|
||||
/* Push Brush */
|
||||
/* NOTE: Depends on gp_brush_grab_calc_dvec() */
|
||||
static bool gp_brush_push_apply(tGP_BrushEditData *gso,
|
||||
bGPDstroke *gps,
|
||||
float UNUSED(rot_eval),
|
||||
int pt_index,
|
||||
const int radius,
|
||||
const int co[2])
|
||||
/* NOTE: Depends on gpencil_brush_grab_calc_dvec() */
|
||||
static bool gpencil_brush_push_apply(tGP_BrushEditData *gso,
|
||||
bGPDstroke *gps,
|
||||
float UNUSED(rot_eval),
|
||||
int pt_index,
|
||||
const int radius,
|
||||
const int co[2])
|
||||
{
|
||||
bGPDspoint *pt = gps->points + pt_index;
|
||||
float save_pt[3];
|
||||
copy_v3_v3(save_pt, &pt->x);
|
||||
|
||||
float inf = gp_brush_influence_calc(gso, radius, co);
|
||||
float inf = gpencil_brush_influence_calc(gso, radius, co);
|
||||
float delta[3] = {0.0f};
|
||||
|
||||
/* adjust the amount of displacement to apply */
|
||||
|
@ -612,7 +614,7 @@ static bool gp_brush_push_apply(tGP_BrushEditData *gso,
|
|||
add_v3_v3(&pt->x, delta);
|
||||
|
||||
/* compute lock axis */
|
||||
gpsculpt_compute_lock_axis(gso, pt, save_pt);
|
||||
gpencil_sculpt_compute_lock_axis(gso, pt, save_pt);
|
||||
|
||||
/* done */
|
||||
return true;
|
||||
|
@ -621,10 +623,10 @@ static bool gp_brush_push_apply(tGP_BrushEditData *gso,
|
|||
/* ----------------------------------------------- */
|
||||
/* Pinch Brush */
|
||||
/* Compute reference midpoint for the brush - this is what we'll be moving towards */
|
||||
static void gp_brush_calc_midpoint(tGP_BrushEditData *gso)
|
||||
static void gpencil_brush_calc_midpoint(tGP_BrushEditData *gso)
|
||||
{
|
||||
/* Convert mouse position to 3D space
|
||||
* See: gpencil_paint.c :: gp_stroke_convertcoords()
|
||||
* See: gpencil_paint.c :: gpencil_stroke_convertcoords()
|
||||
*/
|
||||
RegionView3D *rv3d = gso->region->regiondata;
|
||||
const float *rvec = gso->object->loc;
|
||||
|
@ -647,12 +649,12 @@ static void gp_brush_calc_midpoint(tGP_BrushEditData *gso)
|
|||
}
|
||||
|
||||
/* Shrink distance between midpoint and this point... */
|
||||
static bool gp_brush_pinch_apply(tGP_BrushEditData *gso,
|
||||
bGPDstroke *gps,
|
||||
float UNUSED(rot_eval),
|
||||
int pt_index,
|
||||
const int radius,
|
||||
const int co[2])
|
||||
static bool gpencil_brush_pinch_apply(tGP_BrushEditData *gso,
|
||||
bGPDstroke *gps,
|
||||
float UNUSED(rot_eval),
|
||||
int pt_index,
|
||||
const int radius,
|
||||
const int co[2])
|
||||
{
|
||||
bGPDspoint *pt = gps->points + pt_index;
|
||||
float fac, inf;
|
||||
|
@ -665,7 +667,7 @@ static bool gp_brush_pinch_apply(tGP_BrushEditData *gso,
|
|||
* - Div 10 = Not enough effect
|
||||
* - Div 5 = Happy medium... (by trial and error)
|
||||
*/
|
||||
inf = gp_brush_influence_calc(gso, radius, co) / 5.0f;
|
||||
inf = gpencil_brush_influence_calc(gso, radius, co) / 5.0f;
|
||||
|
||||
/* 1) Make this point relative to the cursor/midpoint (dvec) */
|
||||
float fpt[3];
|
||||
|
@ -677,7 +679,7 @@ static bool gp_brush_pinch_apply(tGP_BrushEditData *gso,
|
|||
* OR
|
||||
* Increase the distance (if inverting the brush action!)
|
||||
*/
|
||||
if (gp_brush_invert_check(gso)) {
|
||||
if (gpencil_brush_invert_check(gso)) {
|
||||
/* Inflate (inverse) */
|
||||
fac = 1.0f + (inf * inf); /* squared to temper the effect... */
|
||||
}
|
||||
|
@ -692,7 +694,7 @@ static bool gp_brush_pinch_apply(tGP_BrushEditData *gso,
|
|||
mul_v3_m4v3(&pt->x, gso->object->imat, fpt);
|
||||
|
||||
/* compute lock axis */
|
||||
gpsculpt_compute_lock_axis(gso, pt, save_pt);
|
||||
gpencil_sculpt_compute_lock_axis(gso, pt, save_pt);
|
||||
|
||||
/* done */
|
||||
return true;
|
||||
|
@ -704,12 +706,12 @@ static bool gp_brush_pinch_apply(tGP_BrushEditData *gso,
|
|||
* convert the rotated point and convert it into "data" space
|
||||
*/
|
||||
|
||||
static bool gp_brush_twist_apply(tGP_BrushEditData *gso,
|
||||
bGPDstroke *gps,
|
||||
float UNUSED(rot_eval),
|
||||
int pt_index,
|
||||
const int radius,
|
||||
const int co[2])
|
||||
static bool gpencil_brush_twist_apply(tGP_BrushEditData *gso,
|
||||
bGPDstroke *gps,
|
||||
float UNUSED(rot_eval),
|
||||
int pt_index,
|
||||
const int radius,
|
||||
const int co[2])
|
||||
{
|
||||
bGPDspoint *pt = gps->points + pt_index;
|
||||
float angle, inf;
|
||||
|
@ -717,10 +719,10 @@ static bool gp_brush_twist_apply(tGP_BrushEditData *gso,
|
|||
copy_v3_v3(save_pt, &pt->x);
|
||||
|
||||
/* Angle to rotate by */
|
||||
inf = gp_brush_influence_calc(gso, radius, co);
|
||||
inf = gpencil_brush_influence_calc(gso, radius, co);
|
||||
angle = DEG2RADF(1.0f) * inf;
|
||||
|
||||
if (gp_brush_invert_check(gso)) {
|
||||
if (gpencil_brush_invert_check(gso)) {
|
||||
/* invert angle that we rotate by */
|
||||
angle *= -1;
|
||||
}
|
||||
|
@ -749,7 +751,7 @@ static bool gp_brush_twist_apply(tGP_BrushEditData *gso,
|
|||
mul_v3_m4v3(&pt->x, gso->object->imat, fpt);
|
||||
|
||||
/* compute lock axis */
|
||||
gpsculpt_compute_lock_axis(gso, pt, save_pt);
|
||||
gpencil_sculpt_compute_lock_axis(gso, pt, save_pt);
|
||||
}
|
||||
else {
|
||||
const float axis[3] = {0.0f, 0.0f, 1.0f};
|
||||
|
@ -787,12 +789,12 @@ static bool gp_brush_twist_apply(tGP_BrushEditData *gso,
|
|||
/* ----------------------------------------------- */
|
||||
/* Randomize Brush */
|
||||
/* Apply some random jitter to the point */
|
||||
static bool gp_brush_randomize_apply(tGP_BrushEditData *gso,
|
||||
bGPDstroke *gps,
|
||||
float UNUSED(rot_eval),
|
||||
int pt_index,
|
||||
const int radius,
|
||||
const int co[2])
|
||||
static bool gpencil_brush_randomize_apply(tGP_BrushEditData *gso,
|
||||
bGPDstroke *gps,
|
||||
float UNUSED(rot_eval),
|
||||
int pt_index,
|
||||
const int radius,
|
||||
const int co[2])
|
||||
{
|
||||
bGPDspoint *pt = gps->points + pt_index;
|
||||
float save_pt[3];
|
||||
|
@ -801,7 +803,7 @@ static bool gp_brush_randomize_apply(tGP_BrushEditData *gso,
|
|||
/* Amount of jitter to apply depends on the distance of the point to the cursor,
|
||||
* as well as the strength of the brush
|
||||
*/
|
||||
const float inf = gp_brush_influence_calc(gso, radius, co) / 2.0f;
|
||||
const float inf = gpencil_brush_influence_calc(gso, radius, co) / 2.0f;
|
||||
const float fac = BLI_rng_get_float(gso->rng) * inf;
|
||||
|
||||
/* apply random to position */
|
||||
|
@ -840,7 +842,7 @@ static bool gp_brush_randomize_apply(tGP_BrushEditData *gso,
|
|||
ED_view3d_win_to_delta(gso->gsc.region, svec, dvec, zfac);
|
||||
add_v3_v3(&pt->x, dvec);
|
||||
/* compute lock axis */
|
||||
gpsculpt_compute_lock_axis(gso, pt, save_pt);
|
||||
gpencil_sculpt_compute_lock_axis(gso, pt, save_pt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -909,7 +911,7 @@ typedef struct tGPSB_CloneBrushData {
|
|||
} tGPSB_CloneBrushData;
|
||||
|
||||
/* Initialise "clone" brush data */
|
||||
static void gp_brush_clone_init(bContext *C, tGP_BrushEditData *gso)
|
||||
static void gpencil_brush_clone_init(bContext *C, tGP_BrushEditData *gso)
|
||||
{
|
||||
tGPSB_CloneBrushData *data;
|
||||
bGPDstroke *gps;
|
||||
|
@ -958,7 +960,7 @@ static void gp_brush_clone_init(bContext *C, tGP_BrushEditData *gso)
|
|||
}
|
||||
|
||||
/* Free custom data used for "clone" brush */
|
||||
static void gp_brush_clone_free(tGP_BrushEditData *gso)
|
||||
static void gpencil_brush_clone_free(tGP_BrushEditData *gso)
|
||||
{
|
||||
tGPSB_CloneBrushData *data = gso->customdata;
|
||||
|
||||
|
@ -980,7 +982,7 @@ static void gp_brush_clone_free(tGP_BrushEditData *gso)
|
|||
}
|
||||
|
||||
/* Create new copies of the strokes on the clipboard */
|
||||
static void gp_brush_clone_add(bContext *C, tGP_BrushEditData *gso)
|
||||
static void gpencil_brush_clone_add(bContext *C, tGP_BrushEditData *gso)
|
||||
{
|
||||
tGPSB_CloneBrushData *data = gso->customdata;
|
||||
|
||||
|
@ -995,7 +997,7 @@ static void gp_brush_clone_add(bContext *C, tGP_BrushEditData *gso)
|
|||
/* Compute amount to offset the points by */
|
||||
/* NOTE: This assumes that screenspace strokes are NOT used in the 3D view... */
|
||||
|
||||
gp_brush_calc_midpoint(gso); /* this puts the cursor location into gso->dvec */
|
||||
gpencil_brush_calc_midpoint(gso); /* this puts the cursor location into gso->dvec */
|
||||
sub_v3_v3v3(delta, gso->dvec, data->buffer_midpoint);
|
||||
|
||||
/* Copy each stroke into the layer */
|
||||
|
@ -1051,14 +1053,14 @@ static void gp_brush_clone_add(bContext *C, tGP_BrushEditData *gso)
|
|||
}
|
||||
|
||||
/* Move newly-added strokes around - "Stamp" mode of the Clone brush */
|
||||
static void gp_brush_clone_adjust(tGP_BrushEditData *gso)
|
||||
static void gpencil_brush_clone_adjust(tGP_BrushEditData *gso)
|
||||
{
|
||||
tGPSB_CloneBrushData *data = gso->customdata;
|
||||
size_t snum;
|
||||
|
||||
/* Compute the amount of movement to apply (overwrites dvec) */
|
||||
gso->rot_eval = 0.0f;
|
||||
gp_brush_grab_calc_dvec(gso);
|
||||
gpencil_brush_grab_calc_dvec(gso);
|
||||
|
||||
/* For each of the stored strokes, apply the offset to each point */
|
||||
/* NOTE: Again this assumes that in the 3D view,
|
||||
|
@ -1076,7 +1078,7 @@ static void gp_brush_clone_adjust(tGP_BrushEditData *gso)
|
|||
|
||||
/* compute influence on point */
|
||||
gpencil_point_to_xy(&gso->gsc, gps, pt, &sco[0], &sco[1]);
|
||||
influence = gp_brush_influence_calc(gso, gso->brush->size, sco);
|
||||
influence = gpencil_brush_influence_calc(gso, gso->brush->size, sco);
|
||||
|
||||
/* adjust the amount of displacement to apply */
|
||||
mul_v3_v3fl(delta, gso->dvec, influence);
|
||||
|
@ -1088,24 +1090,24 @@ static void gp_brush_clone_adjust(tGP_BrushEditData *gso)
|
|||
}
|
||||
|
||||
/* Entrypoint for applying "clone" brush */
|
||||
static bool gpsculpt_brush_apply_clone(bContext *C, tGP_BrushEditData *gso)
|
||||
static bool gpencil_sculpt_brush_apply_clone(bContext *C, tGP_BrushEditData *gso)
|
||||
{
|
||||
/* Which "mode" are we operating in? */
|
||||
if (gso->first) {
|
||||
/* Create initial clones */
|
||||
gp_brush_clone_add(C, gso);
|
||||
gpencil_brush_clone_add(C, gso);
|
||||
}
|
||||
else {
|
||||
/* Stamp or Continuous Mode */
|
||||
if (1 /*gso->brush->mode == GP_EDITBRUSH_CLONE_MODE_STAMP*/) {
|
||||
/* Stamp - Proceed to translate the newly added strokes */
|
||||
gp_brush_clone_adjust(gso);
|
||||
gpencil_brush_clone_adjust(gso);
|
||||
}
|
||||
else {
|
||||
/* Continuous - Just keep pasting everytime we move */
|
||||
/* TODO: The spacing of repeat should be controlled using a
|
||||
* "stepsize" or similar property? */
|
||||
gp_brush_clone_add(C, gso);
|
||||
gpencil_brush_clone_add(C, gso);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1115,7 +1117,7 @@ static bool gpsculpt_brush_apply_clone(bContext *C, tGP_BrushEditData *gso)
|
|||
/* ************************************************ */
|
||||
/* Header Info for GPencil Sculpt */
|
||||
|
||||
static void gpsculpt_brush_header_set(bContext *C, tGP_BrushEditData *gso)
|
||||
static void gpencil_sculpt_brush_header_set(bContext *C, tGP_BrushEditData *gso)
|
||||
{
|
||||
Brush *brush = gso->brush;
|
||||
char str[UI_MAX_DRAW_STR] = "";
|
||||
|
@ -1135,7 +1137,7 @@ static void gpsculpt_brush_header_set(bContext *C, tGP_BrushEditData *gso)
|
|||
|
||||
/* Init/Exit ----------------------------------------------- */
|
||||
|
||||
static bool gpsculpt_brush_init(bContext *C, wmOperator *op)
|
||||
static bool gpencil_sculpt_brush_init(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ToolSettings *ts = scene->toolsettings;
|
||||
|
@ -1151,7 +1153,7 @@ static bool gpsculpt_brush_init(bContext *C, wmOperator *op)
|
|||
gso->depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
gso->bmain = CTX_data_main(C);
|
||||
/* store state */
|
||||
gso->settings = gpsculpt_get_settings(scene);
|
||||
gso->settings = gpencil_sculpt_get_settings(scene);
|
||||
|
||||
/* Random generator, only init once. */
|
||||
uint rng_seed = (uint)(PIL_check_seconds_timer_i() & UINT_MAX);
|
||||
|
@ -1229,7 +1231,7 @@ static bool gpsculpt_brush_init(bContext *C, wmOperator *op)
|
|||
}
|
||||
else {
|
||||
/* initialise customdata */
|
||||
gp_brush_clone_init(C, gso);
|
||||
gpencil_brush_clone_init(C, gso);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1249,12 +1251,12 @@ static bool gpsculpt_brush_init(bContext *C, wmOperator *op)
|
|||
gpencil_point_conversion_init(C, &gso->gsc);
|
||||
|
||||
/* update header */
|
||||
gpsculpt_brush_header_set(C, gso);
|
||||
gpencil_sculpt_brush_header_set(C, gso);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void gpsculpt_brush_exit(bContext *C, wmOperator *op)
|
||||
static void gpencil_sculpt_brush_exit(bContext *C, wmOperator *op)
|
||||
{
|
||||
tGP_BrushEditData *gso = op->customdata;
|
||||
wmWindow *win = CTX_wm_window(C);
|
||||
|
@ -1267,13 +1269,13 @@ static void gpsculpt_brush_exit(bContext *C, wmOperator *op)
|
|||
* - Keys don't need to be freed, as those are the strokes
|
||||
* - Values assigned to those keys do, as they are custom structs
|
||||
*/
|
||||
BLI_ghash_free(gso->stroke_customdata, NULL, gp_brush_grab_stroke_free);
|
||||
BLI_ghash_free(gso->stroke_customdata, NULL, gpencil_brush_grab_stroke_free);
|
||||
break;
|
||||
}
|
||||
|
||||
case GPSCULPT_TOOL_CLONE: {
|
||||
/* Free customdata */
|
||||
gp_brush_clone_free(gso);
|
||||
gpencil_brush_clone_free(gso);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1305,7 +1307,7 @@ static void gpsculpt_brush_exit(bContext *C, wmOperator *op)
|
|||
}
|
||||
|
||||
/* poll callback for stroke sculpting operator(s) */
|
||||
static bool gpsculpt_brush_poll(bContext *C)
|
||||
static bool gpencil_sculpt_brush_poll(bContext *C)
|
||||
{
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
if (area && area->spacetype != SPACE_VIEW3D) {
|
||||
|
@ -1318,7 +1320,7 @@ static bool gpsculpt_brush_poll(bContext *C)
|
|||
|
||||
/* Init Sculpt Stroke ---------------------------------- */
|
||||
|
||||
static void gpsculpt_brush_init_stroke(bContext *C, tGP_BrushEditData *gso)
|
||||
static void gpencil_sculpt_brush_init_stroke(bContext *C, tGP_BrushEditData *gso)
|
||||
{
|
||||
bGPdata *gpd = gso->gpd;
|
||||
|
||||
|
@ -1360,10 +1362,10 @@ static void gpsculpt_brush_init_stroke(bContext *C, tGP_BrushEditData *gso)
|
|||
* For strokes with one point only this is impossible to calculate because there isn't a
|
||||
* valid reference point.
|
||||
*/
|
||||
static float gpsculpt_rotation_eval_get(tGP_BrushEditData *gso,
|
||||
bGPDstroke *gps_eval,
|
||||
bGPDspoint *pt_eval,
|
||||
int idx_eval)
|
||||
static float gpencil_sculpt_rotation_eval_get(tGP_BrushEditData *gso,
|
||||
bGPDstroke *gps_eval,
|
||||
bGPDspoint *pt_eval,
|
||||
int idx_eval)
|
||||
{
|
||||
/* If multiframe or no modifiers, return 0. */
|
||||
if ((GPENCIL_MULTIEDIT_SESSIONS_ON(gso->gpd)) || (!gso->is_transformed)) {
|
||||
|
@ -1414,10 +1416,10 @@ static float gpsculpt_rotation_eval_get(tGP_BrushEditData *gso,
|
|||
}
|
||||
|
||||
/* Apply brush operation to points in this stroke */
|
||||
static bool gpsculpt_brush_do_stroke(tGP_BrushEditData *gso,
|
||||
bGPDstroke *gps,
|
||||
const float diff_mat[4][4],
|
||||
GP_BrushApplyCb apply)
|
||||
static bool gpencil_sculpt_brush_do_stroke(tGP_BrushEditData *gso,
|
||||
bGPDstroke *gps,
|
||||
const float diff_mat[4][4],
|
||||
GP_BrushApplyCb apply)
|
||||
{
|
||||
GP_SpaceConversion *gsc = &gso->gsc;
|
||||
rcti *rect = &gso->brush_rect;
|
||||
|
@ -1459,7 +1461,7 @@ static bool gpsculpt_brush_do_stroke(tGP_BrushEditData *gso,
|
|||
if (len_v2v2_int(mval_i, pc1) <= radius) {
|
||||
/* apply operation to this point */
|
||||
if (pt_active != NULL) {
|
||||
rot_eval = gpsculpt_rotation_eval_get(gso, gps, pt, 0);
|
||||
rot_eval = gpencil_sculpt_rotation_eval_get(gso, gps, pt, 0);
|
||||
changed = apply(gso, gps_active, rot_eval, 0, radius, pc1);
|
||||
}
|
||||
}
|
||||
|
@ -1513,7 +1515,7 @@ static bool gpsculpt_brush_do_stroke(tGP_BrushEditData *gso,
|
|||
}
|
||||
index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i;
|
||||
if ((pt_active != NULL) && (index < gps_active->totpoints)) {
|
||||
rot_eval = gpsculpt_rotation_eval_get(gso, gps, pt, i);
|
||||
rot_eval = gpencil_sculpt_rotation_eval_get(gso, gps, pt, i);
|
||||
ok = apply(gso, gps_active, rot_eval, index, radius, pc1);
|
||||
}
|
||||
|
||||
|
@ -1530,7 +1532,7 @@ static bool gpsculpt_brush_do_stroke(tGP_BrushEditData *gso,
|
|||
pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt;
|
||||
index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i + 1;
|
||||
if ((pt_active != NULL) && (index < gps_active->totpoints)) {
|
||||
rot_eval = gpsculpt_rotation_eval_get(gso, gps, pt, i + 1);
|
||||
rot_eval = gpencil_sculpt_rotation_eval_get(gso, gps, pt, i + 1);
|
||||
ok |= apply(gso, gps_active, rot_eval, index, radius, pc2);
|
||||
include_last = false;
|
||||
}
|
||||
|
@ -1551,7 +1553,7 @@ static bool gpsculpt_brush_do_stroke(tGP_BrushEditData *gso,
|
|||
pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt;
|
||||
index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i;
|
||||
if ((pt_active != NULL) && (index < gps_active->totpoints)) {
|
||||
rot_eval = gpsculpt_rotation_eval_get(gso, gps, pt, i);
|
||||
rot_eval = gpencil_sculpt_rotation_eval_get(gso, gps, pt, i);
|
||||
changed |= apply(gso, gps_active, rot_eval, index, radius, pc1);
|
||||
include_last = false;
|
||||
}
|
||||
|
@ -1564,11 +1566,11 @@ static bool gpsculpt_brush_do_stroke(tGP_BrushEditData *gso,
|
|||
}
|
||||
|
||||
/* Apply sculpt brushes to strokes in the given frame */
|
||||
static bool gpsculpt_brush_do_frame(bContext *C,
|
||||
tGP_BrushEditData *gso,
|
||||
bGPDlayer *gpl,
|
||||
bGPDframe *gpf,
|
||||
const float diff_mat[4][4])
|
||||
static bool gpencil_sculpt_brush_do_frame(bContext *C,
|
||||
tGP_BrushEditData *gso,
|
||||
bGPDlayer *gpl,
|
||||
bGPDframe *gpf,
|
||||
const float diff_mat[4][4])
|
||||
{
|
||||
bool changed = false;
|
||||
bool redo_geom = false;
|
||||
|
@ -1588,20 +1590,22 @@ static bool gpsculpt_brush_do_frame(bContext *C,
|
|||
switch (tool) {
|
||||
case GPSCULPT_TOOL_SMOOTH: /* Smooth strokes */
|
||||
{
|
||||
changed |= gpsculpt_brush_do_stroke(gso, gps, diff_mat, gp_brush_smooth_apply);
|
||||
changed |= gpencil_sculpt_brush_do_stroke(gso, gps, diff_mat, gpencil_brush_smooth_apply);
|
||||
redo_geom |= changed;
|
||||
break;
|
||||
}
|
||||
|
||||
case GPSCULPT_TOOL_THICKNESS: /* Adjust stroke thickness */
|
||||
{
|
||||
changed |= gpsculpt_brush_do_stroke(gso, gps, diff_mat, gp_brush_thickness_apply);
|
||||
changed |= gpencil_sculpt_brush_do_stroke(
|
||||
gso, gps, diff_mat, gpencil_brush_thickness_apply);
|
||||
break;
|
||||
}
|
||||
|
||||
case GPSCULPT_TOOL_STRENGTH: /* Adjust stroke color strength */
|
||||
{
|
||||
changed |= gpsculpt_brush_do_stroke(gso, gps, diff_mat, gp_brush_strength_apply);
|
||||
changed |= gpencil_sculpt_brush_do_stroke(
|
||||
gso, gps, diff_mat, gpencil_brush_strength_apply);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1614,13 +1618,13 @@ static bool gpsculpt_brush_do_frame(bContext *C,
|
|||
* 1) Prepare data buffers (init/clear) for this stroke
|
||||
* 2) Use the points now under the cursor
|
||||
*/
|
||||
gp_brush_grab_stroke_init(gso, gps_active);
|
||||
changed |= gpsculpt_brush_do_stroke(
|
||||
gso, gps_active, diff_mat, gp_brush_grab_store_points);
|
||||
gpencil_brush_grab_stroke_init(gso, gps_active);
|
||||
changed |= gpencil_sculpt_brush_do_stroke(
|
||||
gso, gps_active, diff_mat, gpencil_brush_grab_store_points);
|
||||
}
|
||||
else {
|
||||
/* Apply effect to the stored points */
|
||||
gp_brush_grab_apply_cached(gso, gps_active, diff_mat);
|
||||
gpencil_brush_grab_apply_cached(gso, gps_active, diff_mat);
|
||||
changed |= true;
|
||||
}
|
||||
}
|
||||
|
@ -1630,28 +1634,29 @@ static bool gpsculpt_brush_do_frame(bContext *C,
|
|||
|
||||
case GPSCULPT_TOOL_PUSH: /* Push points */
|
||||
{
|
||||
changed |= gpsculpt_brush_do_stroke(gso, gps, diff_mat, gp_brush_push_apply);
|
||||
changed |= gpencil_sculpt_brush_do_stroke(gso, gps, diff_mat, gpencil_brush_push_apply);
|
||||
redo_geom |= changed;
|
||||
break;
|
||||
}
|
||||
|
||||
case GPSCULPT_TOOL_PINCH: /* Pinch points */
|
||||
{
|
||||
changed |= gpsculpt_brush_do_stroke(gso, gps, diff_mat, gp_brush_pinch_apply);
|
||||
changed |= gpencil_sculpt_brush_do_stroke(gso, gps, diff_mat, gpencil_brush_pinch_apply);
|
||||
redo_geom |= changed;
|
||||
break;
|
||||
}
|
||||
|
||||
case GPSCULPT_TOOL_TWIST: /* Twist points around midpoint */
|
||||
{
|
||||
changed |= gpsculpt_brush_do_stroke(gso, gps, diff_mat, gp_brush_twist_apply);
|
||||
changed |= gpencil_sculpt_brush_do_stroke(gso, gps, diff_mat, gpencil_brush_twist_apply);
|
||||
redo_geom |= changed;
|
||||
break;
|
||||
}
|
||||
|
||||
case GPSCULPT_TOOL_RANDOMIZE: /* Apply jitter */
|
||||
{
|
||||
changed |= gpsculpt_brush_do_stroke(gso, gps, diff_mat, gp_brush_randomize_apply);
|
||||
changed |= gpencil_sculpt_brush_do_stroke(
|
||||
gso, gps, diff_mat, gpencil_brush_randomize_apply);
|
||||
redo_geom |= changed;
|
||||
break;
|
||||
}
|
||||
|
@ -1685,7 +1690,7 @@ static bool gpsculpt_brush_do_frame(bContext *C,
|
|||
}
|
||||
|
||||
/* Perform two-pass brushes which modify the existing strokes */
|
||||
static bool gpsculpt_brush_apply_standard(bContext *C, tGP_BrushEditData *gso)
|
||||
static bool gpencil_sculpt_brush_apply_standard(bContext *C, tGP_BrushEditData *gso)
|
||||
{
|
||||
ToolSettings *ts = gso->scene->toolsettings;
|
||||
Depsgraph *depsgraph = gso->depsgraph;
|
||||
|
@ -1703,7 +1708,7 @@ static bool gpsculpt_brush_apply_standard(bContext *C, tGP_BrushEditData *gso)
|
|||
{
|
||||
/* calculate amount of displacement to apply */
|
||||
gso->rot_eval = 0.0f;
|
||||
gp_brush_grab_calc_dvec(gso);
|
||||
gpencil_brush_grab_calc_dvec(gso);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1711,7 +1716,7 @@ static bool gpsculpt_brush_apply_standard(bContext *C, tGP_BrushEditData *gso)
|
|||
case GPSCULPT_TOOL_TWIST: /* Twist points around midpoint */
|
||||
{
|
||||
/* calculate midpoint of the brush (in data space) */
|
||||
gp_brush_calc_midpoint(gso);
|
||||
gpencil_brush_calc_midpoint(gso);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1719,7 +1724,7 @@ static bool gpsculpt_brush_apply_standard(bContext *C, tGP_BrushEditData *gso)
|
|||
{
|
||||
/* compute the displacement vector for the cursor (in data space) */
|
||||
gso->rot_eval = 0.0f;
|
||||
gp_brush_grab_calc_dvec(gso);
|
||||
gpencil_brush_grab_calc_dvec(gso);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1764,7 +1769,7 @@ static bool gpsculpt_brush_apply_standard(bContext *C, tGP_BrushEditData *gso)
|
|||
}
|
||||
|
||||
/* affect strokes in this frame */
|
||||
changed |= gpsculpt_brush_do_frame(C, gso, gpl, gpf, diff_mat);
|
||||
changed |= gpencil_sculpt_brush_do_frame(C, gso, gpl, gpf, diff_mat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1772,7 +1777,7 @@ static bool gpsculpt_brush_apply_standard(bContext *C, tGP_BrushEditData *gso)
|
|||
if (gpl->actframe != NULL) {
|
||||
/* Apply to active frame's strokes */
|
||||
gso->mf_falloff = 1.0f;
|
||||
changed |= gpsculpt_brush_do_frame(C, gso, gpl, gpl->actframe, diff_mat);
|
||||
changed |= gpencil_sculpt_brush_do_frame(C, gso, gpl, gpl->actframe, diff_mat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1781,7 +1786,7 @@ static bool gpsculpt_brush_apply_standard(bContext *C, tGP_BrushEditData *gso)
|
|||
}
|
||||
|
||||
/* Calculate settings for applying brush */
|
||||
static void gpsculpt_brush_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
|
||||
static void gpencil_sculpt_brush_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
|
||||
{
|
||||
tGP_BrushEditData *gso = op->customdata;
|
||||
Brush *brush = gso->brush;
|
||||
|
@ -1821,10 +1826,10 @@ static void gpsculpt_brush_apply(bContext *C, wmOperator *op, PointerRNA *itempt
|
|||
/* Apply brush */
|
||||
char tool = gso->brush->gpencil_sculpt_tool;
|
||||
if (tool == GPSCULPT_TOOL_CLONE) {
|
||||
changed = gpsculpt_brush_apply_clone(C, gso);
|
||||
changed = gpencil_sculpt_brush_apply_clone(C, gso);
|
||||
}
|
||||
else {
|
||||
changed = gpsculpt_brush_apply_standard(C, gso);
|
||||
changed = gpencil_sculpt_brush_apply_standard(C, gso);
|
||||
}
|
||||
|
||||
/* Updates */
|
||||
|
@ -1841,7 +1846,7 @@ static void gpsculpt_brush_apply(bContext *C, wmOperator *op, PointerRNA *itempt
|
|||
}
|
||||
|
||||
/* Running --------------------------------------------- */
|
||||
static Brush *gpsculpt_get_smooth_brush(tGP_BrushEditData *gso)
|
||||
static Brush *gpencil_sculpt_get_smooth_brush(tGP_BrushEditData *gso)
|
||||
{
|
||||
Main *bmain = gso->bmain;
|
||||
Brush *brush = BLI_findstring(&bmain->brushes, "Smooth Stroke", offsetof(ID, name) + 2);
|
||||
|
@ -1850,7 +1855,7 @@ static Brush *gpsculpt_get_smooth_brush(tGP_BrushEditData *gso)
|
|||
}
|
||||
|
||||
/* helper - a record stroke, and apply paint event */
|
||||
static void gpsculpt_brush_apply_event(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
static void gpencil_sculpt_brush_apply_event(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
tGP_BrushEditData *gso = op->customdata;
|
||||
PointerRNA itemptr;
|
||||
|
@ -1878,7 +1883,7 @@ static void gpsculpt_brush_apply_event(bContext *C, wmOperator *op, const wmEven
|
|||
if (event->shift) {
|
||||
gso->brush_prev = gso->brush;
|
||||
|
||||
gso->brush = gpsculpt_get_smooth_brush(gso);
|
||||
gso->brush = gpencil_sculpt_get_smooth_brush(gso);
|
||||
if (gso->brush == NULL) {
|
||||
gso->brush = gso->brush_prev;
|
||||
}
|
||||
|
@ -1890,28 +1895,28 @@ static void gpsculpt_brush_apply_event(bContext *C, wmOperator *op, const wmEven
|
|||
}
|
||||
|
||||
/* apply */
|
||||
gpsculpt_brush_apply(C, op, &itemptr);
|
||||
gpencil_sculpt_brush_apply(C, op, &itemptr);
|
||||
}
|
||||
|
||||
/* reapply */
|
||||
static int gpsculpt_brush_exec(bContext *C, wmOperator *op)
|
||||
static int gpencil_sculpt_brush_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
if (!gpsculpt_brush_init(C, op)) {
|
||||
if (!gpencil_sculpt_brush_init(C, op)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
RNA_BEGIN (op->ptr, itemptr, "stroke") {
|
||||
gpsculpt_brush_apply(C, op, &itemptr);
|
||||
gpencil_sculpt_brush_apply(C, op, &itemptr);
|
||||
}
|
||||
RNA_END;
|
||||
|
||||
gpsculpt_brush_exit(C, op);
|
||||
gpencil_sculpt_brush_exit(C, op);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
/* start modal painting */
|
||||
static int gpsculpt_brush_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
static int gpencil_sculpt_brush_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
tGP_BrushEditData *gso = NULL;
|
||||
const bool is_modal = RNA_boolean_get(op->ptr, "wait_for_input");
|
||||
|
@ -1927,7 +1932,7 @@ static int gpsculpt_brush_invoke(bContext *C, wmOperator *op, const wmEvent *eve
|
|||
}
|
||||
|
||||
/* init painting data */
|
||||
if (!gpsculpt_brush_init(C, op)) {
|
||||
if (!gpencil_sculpt_brush_init(C, op)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
|
@ -1974,11 +1979,11 @@ static int gpsculpt_brush_invoke(bContext *C, wmOperator *op, const wmEvent *eve
|
|||
ARegion *region = CTX_wm_region(C);
|
||||
|
||||
/* ensure that we'll have a new frame to draw on */
|
||||
gpsculpt_brush_init_stroke(C, gso);
|
||||
gpencil_sculpt_brush_init_stroke(C, gso);
|
||||
|
||||
/* apply first dab... */
|
||||
gso->is_painting = true;
|
||||
gpsculpt_brush_apply_event(C, op, event);
|
||||
gpencil_sculpt_brush_apply_event(C, op, event);
|
||||
|
||||
/* redraw view with feedback */
|
||||
ED_region_tag_redraw(region);
|
||||
|
@ -1988,7 +1993,7 @@ static int gpsculpt_brush_invoke(bContext *C, wmOperator *op, const wmEvent *eve
|
|||
}
|
||||
|
||||
/* painting - handle events */
|
||||
static int gpsculpt_brush_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
static int gpencil_sculpt_brush_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
tGP_BrushEditData *gso = op->customdata;
|
||||
const bool is_modal = RNA_boolean_get(op->ptr, "wait_for_input");
|
||||
|
@ -2003,7 +2008,7 @@ static int gpsculpt_brush_modal(bContext *C, wmOperator *op, const wmEvent *even
|
|||
case MOUSEMOVE:
|
||||
case INBETWEEN_MOUSEMOVE:
|
||||
/* apply brush effect at new position */
|
||||
gpsculpt_brush_apply_event(C, op, event);
|
||||
gpencil_sculpt_brush_apply_event(C, op, event);
|
||||
|
||||
/* force redraw, so that the cursor will at least be valid */
|
||||
redraw_region = true;
|
||||
|
@ -2013,7 +2018,7 @@ static int gpsculpt_brush_modal(bContext *C, wmOperator *op, const wmEvent *even
|
|||
case TIMER:
|
||||
if (event->customdata == gso->timer) {
|
||||
gso->timerTick = true;
|
||||
gpsculpt_brush_apply_event(C, op, event);
|
||||
gpencil_sculpt_brush_apply_event(C, op, event);
|
||||
gso->timerTick = false;
|
||||
}
|
||||
break;
|
||||
|
@ -2029,7 +2034,7 @@ static int gpsculpt_brush_modal(bContext *C, wmOperator *op, const wmEvent *even
|
|||
/* end sculpt session, since we're not modal */
|
||||
gso->is_painting = false;
|
||||
|
||||
gpsculpt_brush_exit(C, op);
|
||||
gpencil_sculpt_brush_exit(C, op);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
break;
|
||||
|
@ -2038,7 +2043,7 @@ static int gpsculpt_brush_modal(bContext *C, wmOperator *op, const wmEvent *even
|
|||
case MIDDLEMOUSE:
|
||||
case RIGHTMOUSE:
|
||||
case EVT_ESCKEY:
|
||||
gpsculpt_brush_exit(C, op);
|
||||
gpencil_sculpt_brush_exit(C, op);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
}
|
||||
|
@ -2053,14 +2058,14 @@ static int gpsculpt_brush_modal(bContext *C, wmOperator *op, const wmEvent *even
|
|||
gso->is_painting = true;
|
||||
gso->first = true;
|
||||
|
||||
gpsculpt_brush_init_stroke(C, gso);
|
||||
gpsculpt_brush_apply_event(C, op, event);
|
||||
gpencil_sculpt_brush_init_stroke(C, gso);
|
||||
gpencil_sculpt_brush_apply_event(C, op, event);
|
||||
break;
|
||||
|
||||
/* Exit modal operator, based on the "standard" ops */
|
||||
case RIGHTMOUSE:
|
||||
case EVT_ESCKEY:
|
||||
gpsculpt_brush_exit(C, op);
|
||||
gpencil_sculpt_brush_exit(C, op);
|
||||
return OPERATOR_FINISHED;
|
||||
|
||||
/* MMB is often used for view manipulations */
|
||||
|
@ -2124,11 +2129,11 @@ void GPENCIL_OT_sculpt_paint(wmOperatorType *ot)
|
|||
ot->description = "Apply tweaks to strokes by painting over the strokes"; // XXX
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = gpsculpt_brush_exec;
|
||||
ot->invoke = gpsculpt_brush_invoke;
|
||||
ot->modal = gpsculpt_brush_modal;
|
||||
ot->cancel = gpsculpt_brush_exit;
|
||||
ot->poll = gpsculpt_brush_poll;
|
||||
ot->exec = gpencil_sculpt_brush_exec;
|
||||
ot->invoke = gpencil_sculpt_brush_invoke;
|
||||
ot->modal = gpencil_sculpt_brush_modal;
|
||||
ot->cancel = gpencil_sculpt_brush_exit;
|
||||
ot->poll = gpencil_sculpt_brush_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
|
||||
|
|
|
@ -369,7 +369,7 @@ typedef enum eGP_SelectGrouped {
|
|||
/* ----------------------------------- */
|
||||
|
||||
/* On each visible layer, check for selected strokes - if found, select all others */
|
||||
static void gp_select_same_layer(bContext *C)
|
||||
static void gpencil_select_same_layer(bContext *C)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
|
||||
|
@ -412,7 +412,7 @@ static void gp_select_same_layer(bContext *C)
|
|||
}
|
||||
|
||||
/* Select all strokes with same colors as selected ones */
|
||||
static void gp_select_same_material(bContext *C)
|
||||
static void gpencil_select_same_material(bContext *C)
|
||||
{
|
||||
/* First, build set containing all the colors of selected strokes */
|
||||
GSet *selected_colors = BLI_gset_str_new("GP Selected Colors");
|
||||
|
@ -462,10 +462,10 @@ static int gpencil_select_grouped_exec(bContext *C, wmOperator *op)
|
|||
|
||||
switch (mode) {
|
||||
case GP_SEL_SAME_LAYER:
|
||||
gp_select_same_layer(C);
|
||||
gpencil_select_same_layer(C);
|
||||
break;
|
||||
case GP_SEL_SAME_MATERIAL:
|
||||
gp_select_same_material(C);
|
||||
gpencil_select_same_material(C);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -853,21 +853,21 @@ void GPENCIL_OT_select_less(wmOperatorType *ot)
|
|||
* Helper to check if a given stroke is within the area.
|
||||
*
|
||||
* \note Code here is adapted (i.e. copied directly)
|
||||
* from gpencil_paint.c #gp_stroke_eraser_dostroke().
|
||||
* from gpencil_paint.c #gpencil_stroke_eraser_dostroke().
|
||||
* It would be great to de-duplicate the logic here sometime, but that can wait.
|
||||
*/
|
||||
static bool gp_stroke_do_circle_sel(bGPdata *UNUSED(gpd),
|
||||
bGPDlayer *gpl,
|
||||
bGPDstroke *gps,
|
||||
GP_SpaceConversion *gsc,
|
||||
const int mx,
|
||||
const int my,
|
||||
const int radius,
|
||||
const bool select,
|
||||
rcti *rect,
|
||||
const float diff_mat[4][4],
|
||||
const int selectmode,
|
||||
const float scale)
|
||||
static bool gpencil_stroke_do_circle_sel(bGPdata *UNUSED(gpd),
|
||||
bGPDlayer *gpl,
|
||||
bGPDstroke *gps,
|
||||
GP_SpaceConversion *gsc,
|
||||
const int mx,
|
||||
const int my,
|
||||
const int radius,
|
||||
const bool select,
|
||||
rcti *rect,
|
||||
const float diff_mat[4][4],
|
||||
const int selectmode,
|
||||
const float scale)
|
||||
{
|
||||
bGPDspoint *pt = NULL;
|
||||
int x0 = 0, y0 = 0;
|
||||
|
@ -998,18 +998,18 @@ static int gpencil_circle_select_exec(bContext *C, wmOperator *op)
|
|||
|
||||
/* find visible strokes, and select if hit */
|
||||
GP_EVALUATED_STROKES_BEGIN (gpstroke_iter, C, gpl, gps) {
|
||||
changed |= gp_stroke_do_circle_sel(gpd,
|
||||
gpl,
|
||||
gps,
|
||||
&gsc,
|
||||
mx,
|
||||
my,
|
||||
radius,
|
||||
select,
|
||||
&rect,
|
||||
gpstroke_iter.diff_mat,
|
||||
selectmode,
|
||||
scale);
|
||||
changed |= gpencil_stroke_do_circle_sel(gpd,
|
||||
gpl,
|
||||
gps,
|
||||
&gsc,
|
||||
mx,
|
||||
my,
|
||||
radius,
|
||||
select,
|
||||
&rect,
|
||||
gpstroke_iter.diff_mat,
|
||||
selectmode,
|
||||
scale);
|
||||
}
|
||||
GP_EVALUATED_STROKES_END(gpstroke_iter);
|
||||
|
||||
|
|
|
@ -768,7 +768,7 @@ void gpencil_point_to_xy(
|
|||
/**
|
||||
* Convert a Grease Pencil coordinate (i.e. can be 2D or 3D) to screenspace (2D).
|
||||
*
|
||||
* Just like #gp_point_to_xy(), except the resulting coordinates are floats not ints.
|
||||
* Just like #gpencil_point_to_xy(), except the resulting coordinates are floats not ints.
|
||||
* Use this version to solve "stair-step" artifacts which may arise when
|
||||
* roundtripping the calculations.
|
||||
*
|
||||
|
@ -836,7 +836,7 @@ void gpencil_point_to_xy_fl(const GP_SpaceConversion *gsc,
|
|||
}
|
||||
|
||||
/**
|
||||
* generic based on gp_point_to_xy_fl
|
||||
* generic based on gpencil_point_to_xy_fl
|
||||
*/
|
||||
void gpencil_point_3d_to_xy(const GP_SpaceConversion *gsc,
|
||||
const short flag,
|
||||
|
@ -1056,12 +1056,12 @@ void ED_gpencil_project_stroke_to_view(bContext *C, bGPDlayer *gpl, bGPDstroke *
|
|||
/**
|
||||
* Reproject all points of the stroke to a plane locked to axis to avoid stroke offset
|
||||
*/
|
||||
void ED_gp_project_stroke_to_plane(const Scene *scene,
|
||||
const Object *ob,
|
||||
const RegionView3D *rv3d,
|
||||
bGPDstroke *gps,
|
||||
const float origin[3],
|
||||
const int axis)
|
||||
void ED_gpencil_project_stroke_to_plane(const Scene *scene,
|
||||
const Object *ob,
|
||||
const RegionView3D *rv3d,
|
||||
bGPDstroke *gps,
|
||||
const float origin[3],
|
||||
const int axis)
|
||||
{
|
||||
const ToolSettings *ts = scene->toolsettings;
|
||||
const View3DCursor *cursor = &scene->cursor;
|
||||
|
@ -1173,7 +1173,7 @@ void ED_gpencil_stroke_reproject(Depsgraph *depsgraph,
|
|||
float xy[2];
|
||||
|
||||
/* 3D to Screen-space */
|
||||
/* Note: We can't use gp_point_to_xy() here because that uses ints for the screen-space
|
||||
/* Note: We can't use gpencil_point_to_xy() here because that uses ints for the screen-space
|
||||
* coordinates, resulting in lost precision, which in turn causes stair-stepping
|
||||
* artifacts in the final points. */
|
||||
|
||||
|
@ -1207,7 +1207,7 @@ void ED_gpencil_stroke_reproject(Depsgraph *depsgraph,
|
|||
}
|
||||
}
|
||||
|
||||
ED_gp_project_point_to_plane(gsc->scene, gsc->ob, rv3d, origin, axis, &pt2);
|
||||
ED_gpencil_project_point_to_plane(gsc->scene, gsc->ob, rv3d, origin, axis, &pt2);
|
||||
|
||||
copy_v3_v3(&pt->x, &pt2.x);
|
||||
|
||||
|
@ -1261,12 +1261,12 @@ void ED_gpencil_stroke_reproject(Depsgraph *depsgraph,
|
|||
* Reproject given point to a plane locked to axis to avoid stroke offset
|
||||
* \param pt: Point to affect (used for input & output).
|
||||
*/
|
||||
void ED_gp_project_point_to_plane(const Scene *scene,
|
||||
const Object *ob,
|
||||
const RegionView3D *rv3d,
|
||||
const float origin[3],
|
||||
const int axis,
|
||||
bGPDspoint *pt)
|
||||
void ED_gpencil_project_point_to_plane(const Scene *scene,
|
||||
const Object *ob,
|
||||
const RegionView3D *rv3d,
|
||||
const float origin[3],
|
||||
const int axis,
|
||||
bGPDspoint *pt)
|
||||
{
|
||||
const ToolSettings *ts = scene->toolsettings;
|
||||
const View3DCursor *cursor = &scene->cursor;
|
||||
|
@ -1738,7 +1738,7 @@ void ED_gpencil_vgroup_deselect(bContext *C, Object *ob)
|
|||
/* Cursor drawing */
|
||||
|
||||
/* check if cursor is in drawing region */
|
||||
static bool gp_check_cursor_region(bContext *C, int mval_i[2])
|
||||
static bool gpencil_check_cursor_region(bContext *C, int mval_i[2])
|
||||
{
|
||||
ARegion *region = CTX_wm_region(C);
|
||||
ScrArea *area = CTX_wm_area(C);
|
||||
|
@ -1810,7 +1810,7 @@ void ED_gpencil_brush_draw_eraser(Brush *brush, int x, int y)
|
|||
GPU_line_smooth(false);
|
||||
}
|
||||
|
||||
static bool gp_brush_cursor_poll(bContext *C)
|
||||
static bool gpencil_brush_cursor_poll(bContext *C)
|
||||
{
|
||||
if (WM_toolsystem_active_tool_is_brush(C)) {
|
||||
return true;
|
||||
|
@ -1821,7 +1821,7 @@ static bool gp_brush_cursor_poll(bContext *C)
|
|||
/**
|
||||
* Helper callback for drawing the cursor itself.
|
||||
*/
|
||||
static void gp_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);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
|
@ -1841,7 +1841,7 @@ static void gp_brush_cursor_draw(bContext *C, int x, int y, void *customdata)
|
|||
|
||||
int mval_i[2] = {x, y};
|
||||
/* Check if cursor is in drawing region and has valid data-block. */
|
||||
if ((!gp_check_cursor_region(C, mval_i)) || (gpd == NULL)) {
|
||||
if ((!gpencil_check_cursor_region(C, mval_i)) || (gpd == NULL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2026,8 +2026,8 @@ void ED_gpencil_toggle_brush_cursor(bContext *C, bool enable, void *customdata)
|
|||
/* enable cursor */
|
||||
gset->paintcursor = WM_paint_cursor_activate(SPACE_TYPE_ANY,
|
||||
RGN_TYPE_ANY,
|
||||
gp_brush_cursor_poll,
|
||||
gp_brush_cursor_draw,
|
||||
gpencil_brush_cursor_poll,
|
||||
gpencil_brush_cursor_draw,
|
||||
(lastpost) ? customdata : NULL);
|
||||
}
|
||||
}
|
||||
|
@ -2228,7 +2228,8 @@ static bool gpencil_check_collision(bGPDstroke *gps,
|
|||
return hit;
|
||||
}
|
||||
|
||||
static void gp_copy_points(bGPDstroke *gps, bGPDspoint *pt, bGPDspoint *pt_final, int i, int i2)
|
||||
static void gpencil_copy_points(
|
||||
bGPDstroke *gps, bGPDspoint *pt, bGPDspoint *pt_final, int i, int i2)
|
||||
{
|
||||
/* don't copy same point */
|
||||
if (i == i2) {
|
||||
|
@ -2260,7 +2261,7 @@ static void gp_copy_points(bGPDstroke *gps, bGPDspoint *pt, bGPDspoint *pt_final
|
|||
}
|
||||
}
|
||||
|
||||
static void gp_insert_point(
|
||||
static void gpencil_insert_point(
|
||||
bGPDstroke *gps, bGPDspoint *a_pt, bGPDspoint *b_pt, const float co_a[3], float co_b[3])
|
||||
{
|
||||
bGPDspoint *temp_points;
|
||||
|
@ -2303,13 +2304,13 @@ static void gp_insert_point(
|
|||
for (int i = 0; i < oldtotpoints; i++) {
|
||||
bGPDspoint *pt = &temp_points[i];
|
||||
bGPDspoint *pt_final = &gps->points[i2];
|
||||
gp_copy_points(gps, pt, pt_final, i, i2);
|
||||
gpencil_copy_points(gps, pt, pt_final, i, i2);
|
||||
|
||||
/* create new point duplicating point and copy location */
|
||||
if ((i == a_idx) || (i == b_idx)) {
|
||||
i2++;
|
||||
pt_final = &gps->points[i2];
|
||||
gp_copy_points(gps, pt, pt_final, i, i2);
|
||||
gpencil_copy_points(gps, pt, pt_final, i, i2);
|
||||
copy_v3_v3(&pt_final->x, (i == a_idx) ? co_a : co_b);
|
||||
|
||||
/* Un-select. */
|
||||
|
@ -2326,7 +2327,7 @@ static void gp_insert_point(
|
|||
MEM_SAFE_FREE(temp_points);
|
||||
}
|
||||
|
||||
static float gp_calc_factor(float p2d_a1[2], float p2d_a2[2], float r_hit2d[2])
|
||||
static float gpencil_calc_factor(float p2d_a1[2], float p2d_a2[2], float r_hit2d[2])
|
||||
{
|
||||
float dist1 = len_squared_v2v2(p2d_a1, p2d_a2);
|
||||
float dist2 = len_squared_v2v2(p2d_a1, r_hit2d);
|
||||
|
@ -2451,7 +2452,7 @@ int ED_gpencil_select_stroke_segment(bGPDlayer *gpl,
|
|||
}
|
||||
|
||||
if (hit_a) {
|
||||
f = gp_calc_factor(p2d_a1, p2d_a2, r_hit2d);
|
||||
f = gpencil_calc_factor(p2d_a1, p2d_a2, r_hit2d);
|
||||
interp_v3_v3v3(r_hita, &pta1->x, &pta2->x, f);
|
||||
if (f > min_factor) {
|
||||
hit_pointa = pta2; /* first point is second (inverted loop) */
|
||||
|
@ -2484,7 +2485,7 @@ int ED_gpencil_select_stroke_segment(bGPDlayer *gpl,
|
|||
}
|
||||
|
||||
if (hit_b) {
|
||||
f = gp_calc_factor(p2d_a1, p2d_a2, r_hit2d);
|
||||
f = gpencil_calc_factor(p2d_a1, p2d_a2, r_hit2d);
|
||||
interp_v3_v3v3(r_hitb, &pta1->x, &pta2->x, f);
|
||||
if (f > min_factor) {
|
||||
hit_pointb = pta1;
|
||||
|
@ -2498,7 +2499,7 @@ int ED_gpencil_select_stroke_segment(bGPDlayer *gpl,
|
|||
|
||||
/* insert new point in the collision points */
|
||||
if (insert) {
|
||||
gp_insert_point(gps, hit_pointa, hit_pointb, r_hita, r_hitb);
|
||||
gpencil_insert_point(gps, hit_pointa, hit_pointb, r_hita, r_hitb);
|
||||
}
|
||||
|
||||
/* free memory */
|
||||
|
|
|
@ -74,7 +74,7 @@ static const EnumPropertyItem gpencil_modesEnumPropertyItem_mode[] = {
|
|||
};
|
||||
|
||||
/* Poll callback for stroke vertex paint operator. */
|
||||
static bool gp_vertexpaint_mode_poll(bContext *C)
|
||||
static bool gpencil_vertexpaint_mode_poll(bContext *C)
|
||||
{
|
||||
ToolSettings *ts = CTX_data_tool_settings(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
|
@ -97,7 +97,7 @@ static bool gp_vertexpaint_mode_poll(bContext *C)
|
|||
return false;
|
||||
}
|
||||
|
||||
static int gp_vertexpaint_brightness_contrast_exec(bContext *C, wmOperator *op)
|
||||
static int gpencil_vertexpaint_brightness_contrast_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
bGPdata *gpd = (bGPdata *)ob->data;
|
||||
|
@ -178,8 +178,8 @@ void GPENCIL_OT_vertex_color_brightness_contrast(wmOperatorType *ot)
|
|||
ot->description = "Adjust vertex color brightness/contrast";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = gp_vertexpaint_brightness_contrast_exec;
|
||||
ot->poll = gp_vertexpaint_mode_poll;
|
||||
ot->exec = gpencil_vertexpaint_brightness_contrast_exec;
|
||||
ot->poll = gpencil_vertexpaint_mode_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
@ -192,7 +192,7 @@ void GPENCIL_OT_vertex_color_brightness_contrast(wmOperatorType *ot)
|
|||
RNA_def_property_ui_range(prop, min, max, 1, 1);
|
||||
}
|
||||
|
||||
static int gp_vertexpaint_hsv_exec(bContext *C, wmOperator *op)
|
||||
static int gpencil_vertexpaint_hsv_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
bGPdata *gpd = (bGPdata *)ob->data;
|
||||
|
@ -273,8 +273,8 @@ void GPENCIL_OT_vertex_color_hsv(wmOperatorType *ot)
|
|||
ot->description = "Adjust vertex color HSV values";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = gp_vertexpaint_hsv_exec;
|
||||
ot->poll = gp_vertexpaint_mode_poll;
|
||||
ot->exec = gpencil_vertexpaint_hsv_exec;
|
||||
ot->poll = gpencil_vertexpaint_mode_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
@ -286,7 +286,7 @@ void GPENCIL_OT_vertex_color_hsv(wmOperatorType *ot)
|
|||
RNA_def_float(ot->srna, "v", 1.0f, 0.0f, 2.0f, "Value", "", 0.0f, 2.0f);
|
||||
}
|
||||
|
||||
static int gp_vertexpaint_invert_exec(bContext *C, wmOperator *op)
|
||||
static int gpencil_vertexpaint_invert_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
bGPdata *gpd = (bGPdata *)ob->data;
|
||||
|
@ -344,8 +344,8 @@ void GPENCIL_OT_vertex_color_invert(wmOperatorType *ot)
|
|||
ot->description = "Invert RGB values";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = gp_vertexpaint_invert_exec;
|
||||
ot->poll = gp_vertexpaint_mode_poll;
|
||||
ot->exec = gpencil_vertexpaint_invert_exec;
|
||||
ot->poll = gpencil_vertexpaint_mode_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
@ -354,7 +354,7 @@ void GPENCIL_OT_vertex_color_invert(wmOperatorType *ot)
|
|||
ot->prop = RNA_def_enum(ot->srna, "mode", gpencil_modesEnumPropertyItem_mode, 0, "Mode", "");
|
||||
}
|
||||
|
||||
static int gp_vertexpaint_levels_exec(bContext *C, wmOperator *op)
|
||||
static int gpencil_vertexpaint_levels_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
bGPdata *gpd = (bGPdata *)ob->data;
|
||||
|
@ -413,8 +413,8 @@ void GPENCIL_OT_vertex_color_levels(wmOperatorType *ot)
|
|||
ot->description = "Adjust levels of vertex colors";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = gp_vertexpaint_levels_exec;
|
||||
ot->poll = gp_vertexpaint_mode_poll;
|
||||
ot->exec = gpencil_vertexpaint_levels_exec;
|
||||
ot->poll = gpencil_vertexpaint_mode_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
@ -428,7 +428,7 @@ void GPENCIL_OT_vertex_color_levels(wmOperatorType *ot)
|
|||
ot->srna, "gain", 1.0f, 0.0f, FLT_MAX, "Gain", "Value to multiply colors by", 0.0f, 10.0f);
|
||||
}
|
||||
|
||||
static int gp_vertexpaint_set_exec(bContext *C, wmOperator *op)
|
||||
static int gpencil_vertexpaint_set_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
ToolSettings *ts = CTX_data_tool_settings(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
|
@ -485,8 +485,8 @@ void GPENCIL_OT_vertex_color_set(wmOperatorType *ot)
|
|||
ot->description = "Set active color to all selected vertex";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = gp_vertexpaint_set_exec;
|
||||
ot->poll = gp_vertexpaint_mode_poll;
|
||||
ot->exec = gpencil_vertexpaint_set_exec;
|
||||
ot->poll = gpencil_vertexpaint_mode_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
@ -497,7 +497,9 @@ void GPENCIL_OT_vertex_color_set(wmOperatorType *ot)
|
|||
}
|
||||
|
||||
/* Helper to extract color from vertex color to create a palette. */
|
||||
static bool gp_extract_palette_from_vertex(bContext *C, const bool selected, const int threshold)
|
||||
static bool gpencil_extract_palette_from_vertex(bContext *C,
|
||||
const bool selected,
|
||||
const int threshold)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
|
@ -657,7 +659,7 @@ static uint get_material_type(MaterialGPencilStyle *gp_style,
|
|||
return r_i;
|
||||
}
|
||||
|
||||
static bool gp_material_to_vertex_poll(bContext *C)
|
||||
static bool gpencil_material_to_vertex_poll(bContext *C)
|
||||
{
|
||||
/* only supported with grease pencil objects */
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
|
@ -668,7 +670,7 @@ static bool gp_material_to_vertex_poll(bContext *C)
|
|||
return true;
|
||||
}
|
||||
|
||||
static int gp_material_to_vertex_exec(bContext *C, wmOperator *op)
|
||||
static int gpencil_material_to_vertex_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
Main *bmain = CTX_data_main(C);
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
|
@ -814,7 +816,7 @@ static int gp_material_to_vertex_exec(bContext *C, wmOperator *op)
|
|||
|
||||
/* Generate a Palette. */
|
||||
if (palette) {
|
||||
gp_extract_palette_from_vertex(C, selected, 1);
|
||||
gpencil_extract_palette_from_vertex(C, selected, 1);
|
||||
}
|
||||
|
||||
/* Clean unused materials. */
|
||||
|
@ -834,8 +836,8 @@ void GPENCIL_OT_material_to_vertex_color(wmOperatorType *ot)
|
|||
ot->description = "Replace materials in strokes with Vertex Color";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = gp_material_to_vertex_exec;
|
||||
ot->poll = gp_material_to_vertex_poll;
|
||||
ot->exec = gpencil_material_to_vertex_exec;
|
||||
ot->poll = gpencil_material_to_vertex_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
@ -852,7 +854,7 @@ void GPENCIL_OT_material_to_vertex_color(wmOperatorType *ot)
|
|||
}
|
||||
|
||||
/* Extract Palette from Vertex Color. */
|
||||
static bool gp_extract_palette_vertex_poll(bContext *C)
|
||||
static bool gpencil_extract_palette_vertex_poll(bContext *C)
|
||||
{
|
||||
/* only supported with grease pencil objects */
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
|
@ -863,12 +865,12 @@ static bool gp_extract_palette_vertex_poll(bContext *C)
|
|||
return true;
|
||||
}
|
||||
|
||||
static int gp_extract_palette_vertex_exec(bContext *C, wmOperator *op)
|
||||
static int gpencil_extract_palette_vertex_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
const bool selected = RNA_boolean_get(op->ptr, "selected");
|
||||
const int threshold = RNA_int_get(op->ptr, "threshold");
|
||||
|
||||
if (gp_extract_palette_from_vertex(C, selected, threshold)) {
|
||||
if (gpencil_extract_palette_from_vertex(C, selected, threshold)) {
|
||||
BKE_reportf(op->reports, RPT_INFO, "Palette created");
|
||||
}
|
||||
else {
|
||||
|
@ -886,8 +888,8 @@ void GPENCIL_OT_extract_palette_vertex(wmOperatorType *ot)
|
|||
ot->description = "Extract all colors used in Grease Pencil Vertex and create a Palette";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = gp_extract_palette_vertex_exec;
|
||||
ot->poll = gp_extract_palette_vertex_poll;
|
||||
ot->exec = gpencil_extract_palette_vertex_exec;
|
||||
ot->poll = gpencil_extract_palette_vertex_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO;
|
||||
|
|
|
@ -263,7 +263,7 @@ static void brush_calc_dvec_2d(tGP_BrushVertexpaintData *gso)
|
|||
* number of pixels (see: GP_GRID_PIXEL_SIZE)
|
||||
*/
|
||||
|
||||
static void gp_grid_cells_init(tGP_BrushVertexpaintData *gso)
|
||||
static void gpencil_grid_cells_init(tGP_BrushVertexpaintData *gso)
|
||||
{
|
||||
tGP_Grid *grid;
|
||||
float bottom[2];
|
||||
|
@ -298,7 +298,7 @@ static void gp_grid_cells_init(tGP_BrushVertexpaintData *gso)
|
|||
}
|
||||
|
||||
/* Get the index used in the grid base on dvec. */
|
||||
static void gp_grid_cell_average_color_idx_get(tGP_BrushVertexpaintData *gso, int r_idx[2])
|
||||
static void gpencil_grid_cell_average_color_idx_get(tGP_BrushVertexpaintData *gso, int r_idx[2])
|
||||
{
|
||||
/* Lower direction. */
|
||||
if (gso->dvec[1] < 0.0f) {
|
||||
|
@ -348,7 +348,7 @@ static void gp_grid_cell_average_color_idx_get(tGP_BrushVertexpaintData *gso, in
|
|||
}
|
||||
}
|
||||
|
||||
static int gp_grid_cell_index_get(tGP_BrushVertexpaintData *gso, int pc[2])
|
||||
static int gpencil_grid_cell_index_get(tGP_BrushVertexpaintData *gso, int pc[2])
|
||||
{
|
||||
float bottom[2], top[2];
|
||||
|
||||
|
@ -366,7 +366,7 @@ static int gp_grid_cell_index_get(tGP_BrushVertexpaintData *gso, int pc[2])
|
|||
}
|
||||
|
||||
/* Fill the grid with the color in each cell and assign point cell index. */
|
||||
static void gp_grid_colors_calc(tGP_BrushVertexpaintData *gso)
|
||||
static void gpencil_grid_colors_calc(tGP_BrushVertexpaintData *gso)
|
||||
{
|
||||
tGP_Selected *selected = NULL;
|
||||
bGPDstroke *gps_selected = NULL;
|
||||
|
@ -383,7 +383,7 @@ static void gp_grid_colors_calc(tGP_BrushVertexpaintData *gso)
|
|||
selected = &gso->pbuffer[i];
|
||||
gps_selected = selected->gps;
|
||||
pt = &gps_selected->points[selected->pt_index];
|
||||
int grid_index = gp_grid_cell_index_get(gso, selected->pc);
|
||||
int grid_index = gpencil_grid_cell_index_get(gso, selected->pc);
|
||||
|
||||
if (grid_index > -1) {
|
||||
grid = &gso->grid[grid_index];
|
||||
|
@ -639,7 +639,7 @@ static bool brush_smear_apply(tGP_BrushVertexpaintData *gso,
|
|||
|
||||
/* Need get average colors in the grid. */
|
||||
if ((!gso->grid_ready) && (gso->pbuffer_used > 0)) {
|
||||
gp_grid_colors_calc(gso);
|
||||
gpencil_grid_colors_calc(gso);
|
||||
}
|
||||
|
||||
/* The influence is equal to strength and no decay around brush radius. */
|
||||
|
@ -657,10 +657,10 @@ static bool brush_smear_apply(tGP_BrushVertexpaintData *gso,
|
|||
inf *= fac;
|
||||
|
||||
/* Retry row and col for average color. */
|
||||
gp_grid_cell_average_color_idx_get(gso, average_idx);
|
||||
gpencil_grid_cell_average_color_idx_get(gso, average_idx);
|
||||
|
||||
/* Retry average color cell. */
|
||||
int grid_index = gp_grid_cell_index_get(gso, selected->pc);
|
||||
int grid_index = gpencil_grid_cell_index_get(gso, selected->pc);
|
||||
if (grid_index > -1) {
|
||||
int row = grid_index / gso->grid_size;
|
||||
int col = grid_index - (gso->grid_size * row);
|
||||
|
@ -700,7 +700,7 @@ static bool brush_smear_apply(tGP_BrushVertexpaintData *gso,
|
|||
|
||||
/* ************************************************ */
|
||||
/* Header Info */
|
||||
static void gp_vertexpaint_brush_header_set(bContext *C)
|
||||
static void gpencil_vertexpaint_brush_header_set(bContext *C)
|
||||
{
|
||||
ED_workspace_status_text(C,
|
||||
TIP_("GPencil Vertex Paint: LMB to paint | RMB/Escape to Exit"
|
||||
|
@ -712,7 +712,7 @@ static void gp_vertexpaint_brush_header_set(bContext *C)
|
|||
|
||||
/* Init/Exit ----------------------------------------------- */
|
||||
|
||||
static bool gp_vertexpaint_brush_init(bContext *C, wmOperator *op)
|
||||
static bool gpencil_vertexpaint_brush_init(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ToolSettings *ts = CTX_data_tool_settings(C);
|
||||
|
@ -768,12 +768,12 @@ static bool gp_vertexpaint_brush_init(bContext *C, wmOperator *op)
|
|||
gpencil_point_conversion_init(C, &gso->gsc);
|
||||
|
||||
/* Update header. */
|
||||
gp_vertexpaint_brush_header_set(C);
|
||||
gpencil_vertexpaint_brush_header_set(C);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void gp_vertexpaint_brush_exit(bContext *C, wmOperator *op)
|
||||
static void gpencil_vertexpaint_brush_exit(bContext *C, wmOperator *op)
|
||||
{
|
||||
tGP_BrushVertexpaintData *gso = op->customdata;
|
||||
|
||||
|
@ -791,17 +791,17 @@ static void gp_vertexpaint_brush_exit(bContext *C, wmOperator *op)
|
|||
}
|
||||
|
||||
/* Poll callback for stroke vertex paint operator. */
|
||||
static bool gp_vertexpaint_brush_poll(bContext *C)
|
||||
static bool gpencil_vertexpaint_brush_poll(bContext *C)
|
||||
{
|
||||
/* NOTE: this is a bit slower, but is the most accurate... */
|
||||
return CTX_DATA_COUNT(C, editable_gpencil_strokes) != 0;
|
||||
}
|
||||
|
||||
/* Helper to save the points selected by the brush. */
|
||||
static void gp_save_selected_point(tGP_BrushVertexpaintData *gso,
|
||||
bGPDstroke *gps,
|
||||
int index,
|
||||
int pc[2])
|
||||
static void gpencil_save_selected_point(tGP_BrushVertexpaintData *gso,
|
||||
bGPDstroke *gps,
|
||||
int index,
|
||||
int pc[2])
|
||||
{
|
||||
tGP_Selected *selected;
|
||||
bGPDspoint *pt = &gps->points[index];
|
||||
|
@ -822,10 +822,10 @@ static void gp_save_selected_point(tGP_BrushVertexpaintData *gso,
|
|||
}
|
||||
|
||||
/* Select points in this stroke and add to an array to be used later. */
|
||||
static void gp_vertexpaint_select_stroke(tGP_BrushVertexpaintData *gso,
|
||||
bGPDstroke *gps,
|
||||
const char tool,
|
||||
const float diff_mat[4][4])
|
||||
static void gpencil_vertexpaint_select_stroke(tGP_BrushVertexpaintData *gso,
|
||||
bGPDstroke *gps,
|
||||
const char tool,
|
||||
const float diff_mat[4][4])
|
||||
{
|
||||
GP_SpaceConversion *gsc = &gso->gsc;
|
||||
rcti *rect = &gso->brush_rect;
|
||||
|
@ -863,7 +863,7 @@ static void gp_vertexpaint_select_stroke(tGP_BrushVertexpaintData *gso,
|
|||
if (len_v2v2_int(mval_i, pc1) <= radius) {
|
||||
/* apply operation to this point */
|
||||
if (pt_active != NULL) {
|
||||
gp_save_selected_point(gso, gps_active, 0, pc1);
|
||||
gpencil_save_selected_point(gso, gps_active, 0, pc1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -914,7 +914,7 @@ static void gp_vertexpaint_select_stroke(tGP_BrushVertexpaintData *gso,
|
|||
continue;
|
||||
}
|
||||
hit = true;
|
||||
gp_save_selected_point(gso, gps_active, index, pc1);
|
||||
gpencil_save_selected_point(gso, gps_active, index, pc1);
|
||||
}
|
||||
|
||||
/* Only do the second point if this is the last segment,
|
||||
|
@ -931,7 +931,7 @@ static void gp_vertexpaint_select_stroke(tGP_BrushVertexpaintData *gso,
|
|||
index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i + 1;
|
||||
if (pt_active != NULL) {
|
||||
hit = true;
|
||||
gp_save_selected_point(gso, gps_active, index, pc2);
|
||||
gpencil_save_selected_point(gso, gps_active, index, pc2);
|
||||
include_last = false;
|
||||
}
|
||||
}
|
||||
|
@ -950,7 +950,7 @@ static void gp_vertexpaint_select_stroke(tGP_BrushVertexpaintData *gso,
|
|||
index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i;
|
||||
if (pt_active != NULL) {
|
||||
hit = true;
|
||||
gp_save_selected_point(gso, gps_active, index, pc1);
|
||||
gpencil_save_selected_point(gso, gps_active, index, pc1);
|
||||
|
||||
include_last = false;
|
||||
}
|
||||
|
@ -970,7 +970,7 @@ static void gp_vertexpaint_select_stroke(tGP_BrushVertexpaintData *gso,
|
|||
/* Need repeat the effect because if we don't do that the tint process
|
||||
* is very slow. */
|
||||
for (int repeat = 0; repeat < 50; repeat++) {
|
||||
gp_save_selected_point(gso, gps_active, -1, NULL);
|
||||
gpencil_save_selected_point(gso, gps_active, -1, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -979,11 +979,11 @@ static void gp_vertexpaint_select_stroke(tGP_BrushVertexpaintData *gso,
|
|||
}
|
||||
|
||||
/* Apply vertex paint brushes to strokes in the given frame. */
|
||||
static bool gp_vertexpaint_brush_do_frame(bContext *C,
|
||||
tGP_BrushVertexpaintData *gso,
|
||||
bGPDlayer *gpl,
|
||||
bGPDframe *gpf,
|
||||
const float diff_mat[4][4])
|
||||
static bool gpencil_vertexpaint_brush_do_frame(bContext *C,
|
||||
tGP_BrushVertexpaintData *gso,
|
||||
bGPDlayer *gpl,
|
||||
bGPDframe *gpf,
|
||||
const float diff_mat[4][4])
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
const char tool = ob->mode == OB_MODE_VERTEX_GPENCIL ? gso->brush->gpencil_vertex_tool :
|
||||
|
@ -1010,7 +1010,7 @@ static bool gp_vertexpaint_brush_do_frame(bContext *C,
|
|||
}
|
||||
|
||||
/* Check points below the brush. */
|
||||
gp_vertexpaint_select_stroke(gso, gps, tool, diff_mat);
|
||||
gpencil_vertexpaint_select_stroke(gso, gps, tool, diff_mat);
|
||||
}
|
||||
|
||||
/* For Average tool, need calculate the average resulting color from all colors
|
||||
|
@ -1092,7 +1092,7 @@ static bool gp_vertexpaint_brush_do_frame(bContext *C,
|
|||
}
|
||||
|
||||
/* Apply brush effect to all layers. */
|
||||
static bool gp_vertexpaint_brush_apply_to_layers(bContext *C, tGP_BrushVertexpaintData *gso)
|
||||
static bool gpencil_vertexpaint_brush_apply_to_layers(bContext *C, tGP_BrushVertexpaintData *gso)
|
||||
{
|
||||
ToolSettings *ts = CTX_data_tool_settings(C);
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
|
@ -1138,7 +1138,7 @@ static bool gp_vertexpaint_brush_apply_to_layers(bContext *C, tGP_BrushVertexpai
|
|||
}
|
||||
|
||||
/* affect strokes in this frame */
|
||||
changed |= gp_vertexpaint_brush_do_frame(C, gso, gpl, gpf, diff_mat);
|
||||
changed |= gpencil_vertexpaint_brush_do_frame(C, gso, gpl, gpf, diff_mat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1146,7 +1146,7 @@ static bool gp_vertexpaint_brush_apply_to_layers(bContext *C, tGP_BrushVertexpai
|
|||
/* Apply to active frame's strokes */
|
||||
if (gpl->actframe != NULL) {
|
||||
gso->mf_falloff = 1.0f;
|
||||
changed |= gp_vertexpaint_brush_do_frame(C, gso, gpl, gpl->actframe, diff_mat);
|
||||
changed |= gpencil_vertexpaint_brush_do_frame(C, gso, gpl, gpl->actframe, diff_mat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1155,7 +1155,7 @@ static bool gp_vertexpaint_brush_apply_to_layers(bContext *C, tGP_BrushVertexpai
|
|||
}
|
||||
|
||||
/* Calculate settings for applying brush */
|
||||
static void gp_vertexpaint_brush_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
|
||||
static void gpencil_vertexpaint_brush_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
|
||||
{
|
||||
tGP_BrushVertexpaintData *gso = op->customdata;
|
||||
Brush *brush = gso->brush;
|
||||
|
@ -1196,9 +1196,9 @@ static void gp_vertexpaint_brush_apply(bContext *C, wmOperator *op, PointerRNA *
|
|||
brush_calc_dvec_2d(gso);
|
||||
|
||||
/* Calc grid for smear tool. */
|
||||
gp_grid_cells_init(gso);
|
||||
gpencil_grid_cells_init(gso);
|
||||
|
||||
changed = gp_vertexpaint_brush_apply_to_layers(C, gso);
|
||||
changed = gpencil_vertexpaint_brush_apply_to_layers(C, gso);
|
||||
|
||||
/* Updates */
|
||||
if (changed) {
|
||||
|
@ -1216,7 +1216,9 @@ static void gp_vertexpaint_brush_apply(bContext *C, wmOperator *op, PointerRNA *
|
|||
/* Running --------------------------------------------- */
|
||||
|
||||
/* helper - a record stroke, and apply paint event */
|
||||
static void gp_vertexpaint_brush_apply_event(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
static void gpencil_vertexpaint_brush_apply_event(bContext *C,
|
||||
wmOperator *op,
|
||||
const wmEvent *event)
|
||||
{
|
||||
tGP_BrushVertexpaintData *gso = op->customdata;
|
||||
PointerRNA itemptr;
|
||||
|
@ -1238,28 +1240,28 @@ static void gp_vertexpaint_brush_apply_event(bContext *C, wmOperator *op, const
|
|||
RNA_float_set(&itemptr, "pressure", pressure);
|
||||
|
||||
/* apply */
|
||||
gp_vertexpaint_brush_apply(C, op, &itemptr);
|
||||
gpencil_vertexpaint_brush_apply(C, op, &itemptr);
|
||||
}
|
||||
|
||||
/* reapply */
|
||||
static int gp_vertexpaint_brush_exec(bContext *C, wmOperator *op)
|
||||
static int gpencil_vertexpaint_brush_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
if (!gp_vertexpaint_brush_init(C, op)) {
|
||||
if (!gpencil_vertexpaint_brush_init(C, op)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
RNA_BEGIN (op->ptr, itemptr, "stroke") {
|
||||
gp_vertexpaint_brush_apply(C, op, &itemptr);
|
||||
gpencil_vertexpaint_brush_apply(C, op, &itemptr);
|
||||
}
|
||||
RNA_END;
|
||||
|
||||
gp_vertexpaint_brush_exit(C, op);
|
||||
gpencil_vertexpaint_brush_exit(C, op);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
/* start modal painting */
|
||||
static int gp_vertexpaint_brush_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
static int gpencil_vertexpaint_brush_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
tGP_BrushVertexpaintData *gso = NULL;
|
||||
const bool is_modal = RNA_boolean_get(op->ptr, "wait_for_input");
|
||||
|
@ -1273,7 +1275,7 @@ static int gp_vertexpaint_brush_invoke(bContext *C, wmOperator *op, const wmEven
|
|||
}
|
||||
|
||||
/* init painting data */
|
||||
if (!gp_vertexpaint_brush_init(C, op)) {
|
||||
if (!gpencil_vertexpaint_brush_init(C, op)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
|
@ -1288,7 +1290,7 @@ static int gp_vertexpaint_brush_invoke(bContext *C, wmOperator *op, const wmEven
|
|||
|
||||
/* apply first dab... */
|
||||
gso->is_painting = true;
|
||||
gp_vertexpaint_brush_apply_event(C, op, event);
|
||||
gpencil_vertexpaint_brush_apply_event(C, op, event);
|
||||
|
||||
/* redraw view with feedback */
|
||||
ED_region_tag_redraw(region);
|
||||
|
@ -1298,7 +1300,7 @@ static int gp_vertexpaint_brush_invoke(bContext *C, wmOperator *op, const wmEven
|
|||
}
|
||||
|
||||
/* painting - handle events */
|
||||
static int gp_vertexpaint_brush_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
static int gpencil_vertexpaint_brush_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
tGP_BrushVertexpaintData *gso = op->customdata;
|
||||
const bool is_modal = RNA_boolean_get(op->ptr, "wait_for_input");
|
||||
|
@ -1313,7 +1315,7 @@ static int gp_vertexpaint_brush_modal(bContext *C, wmOperator *op, const wmEvent
|
|||
case MOUSEMOVE:
|
||||
case INBETWEEN_MOUSEMOVE:
|
||||
/* apply brush effect at new position */
|
||||
gp_vertexpaint_brush_apply_event(C, op, event);
|
||||
gpencil_vertexpaint_brush_apply_event(C, op, event);
|
||||
|
||||
/* force redraw, so that the cursor will at least be valid */
|
||||
redraw_region = true;
|
||||
|
@ -1329,7 +1331,7 @@ static int gp_vertexpaint_brush_modal(bContext *C, wmOperator *op, const wmEvent
|
|||
/* end painting, since we're not modal */
|
||||
gso->is_painting = false;
|
||||
|
||||
gp_vertexpaint_brush_exit(C, op);
|
||||
gpencil_vertexpaint_brush_exit(C, op);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
break;
|
||||
|
@ -1338,7 +1340,7 @@ static int gp_vertexpaint_brush_modal(bContext *C, wmOperator *op, const wmEvent
|
|||
case MIDDLEMOUSE:
|
||||
case RIGHTMOUSE:
|
||||
case EVT_ESCKEY:
|
||||
gp_vertexpaint_brush_exit(C, op);
|
||||
gpencil_vertexpaint_brush_exit(C, op);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
}
|
||||
|
@ -1353,13 +1355,13 @@ static int gp_vertexpaint_brush_modal(bContext *C, wmOperator *op, const wmEvent
|
|||
gso->is_painting = true;
|
||||
gso->first = true;
|
||||
|
||||
gp_vertexpaint_brush_apply_event(C, op, event);
|
||||
gpencil_vertexpaint_brush_apply_event(C, op, event);
|
||||
break;
|
||||
|
||||
/* Exit modal operator, based on the "standard" ops */
|
||||
case RIGHTMOUSE:
|
||||
case EVT_ESCKEY:
|
||||
gp_vertexpaint_brush_exit(C, op);
|
||||
gpencil_vertexpaint_brush_exit(C, op);
|
||||
return OPERATOR_FINISHED;
|
||||
|
||||
/* MMB is often used for view manipulations */
|
||||
|
@ -1421,11 +1423,11 @@ void GPENCIL_OT_vertex_paint(wmOperatorType *ot)
|
|||
ot->description = "Paint stroke points with a color";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = gp_vertexpaint_brush_exec;
|
||||
ot->invoke = gp_vertexpaint_brush_invoke;
|
||||
ot->modal = gp_vertexpaint_brush_modal;
|
||||
ot->cancel = gp_vertexpaint_brush_exit;
|
||||
ot->poll = gp_vertexpaint_brush_poll;
|
||||
ot->exec = gpencil_vertexpaint_brush_exec;
|
||||
ot->invoke = gpencil_vertexpaint_brush_invoke;
|
||||
ot->modal = gpencil_vertexpaint_brush_modal;
|
||||
ot->cancel = gpencil_vertexpaint_brush_exit;
|
||||
ot->poll = gpencil_vertexpaint_brush_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
|
||||
|
|
|
@ -268,7 +268,7 @@ static bool brush_draw_apply(tGP_BrushWeightpaintData *gso,
|
|||
|
||||
/* ************************************************ */
|
||||
/* Header Info */
|
||||
static void gp_weightpaint_brush_header_set(bContext *C)
|
||||
static void gpencil_weightpaint_brush_header_set(bContext *C)
|
||||
{
|
||||
ED_workspace_status_text(C, TIP_("GPencil Weight Paint: LMB to paint | RMB/Escape to Exit"));
|
||||
}
|
||||
|
@ -278,7 +278,7 @@ static void gp_weightpaint_brush_header_set(bContext *C)
|
|||
|
||||
/* Init/Exit ----------------------------------------------- */
|
||||
|
||||
static bool gp_weightpaint_brush_init(bContext *C, wmOperator *op)
|
||||
static bool gpencil_weightpaint_brush_init(bContext *C, wmOperator *op)
|
||||
{
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
ToolSettings *ts = CTX_data_tool_settings(C);
|
||||
|
@ -333,12 +333,12 @@ static bool gp_weightpaint_brush_init(bContext *C, wmOperator *op)
|
|||
gpencil_point_conversion_init(C, &gso->gsc);
|
||||
|
||||
/* Update header. */
|
||||
gp_weightpaint_brush_header_set(C);
|
||||
gpencil_weightpaint_brush_header_set(C);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void gp_weightpaint_brush_exit(bContext *C, wmOperator *op)
|
||||
static void gpencil_weightpaint_brush_exit(bContext *C, wmOperator *op)
|
||||
{
|
||||
tGP_BrushWeightpaintData *gso = op->customdata;
|
||||
|
||||
|
@ -352,17 +352,17 @@ static void gp_weightpaint_brush_exit(bContext *C, wmOperator *op)
|
|||
}
|
||||
|
||||
/* Poll callback for stroke weight paint operator. */
|
||||
static bool gp_weightpaint_brush_poll(bContext *C)
|
||||
static bool gpencil_weightpaint_brush_poll(bContext *C)
|
||||
{
|
||||
/* NOTE: this is a bit slower, but is the most accurate... */
|
||||
return CTX_DATA_COUNT(C, editable_gpencil_strokes) != 0;
|
||||
}
|
||||
|
||||
/* Helper to save the points selected by the brush. */
|
||||
static void gp_save_selected_point(tGP_BrushWeightpaintData *gso,
|
||||
bGPDstroke *gps,
|
||||
int index,
|
||||
int pc[2])
|
||||
static void gpencil_save_selected_point(tGP_BrushWeightpaintData *gso,
|
||||
bGPDstroke *gps,
|
||||
int index,
|
||||
int pc[2])
|
||||
{
|
||||
tGP_Selected *selected;
|
||||
bGPDspoint *pt = &gps->points[index];
|
||||
|
@ -381,9 +381,9 @@ static void gp_save_selected_point(tGP_BrushWeightpaintData *gso,
|
|||
}
|
||||
|
||||
/* Select points in this stroke and add to an array to be used later. */
|
||||
static void gp_weightpaint_select_stroke(tGP_BrushWeightpaintData *gso,
|
||||
bGPDstroke *gps,
|
||||
const float diff_mat[4][4])
|
||||
static void gpencil_weightpaint_select_stroke(tGP_BrushWeightpaintData *gso,
|
||||
bGPDstroke *gps,
|
||||
const float diff_mat[4][4])
|
||||
{
|
||||
GP_SpaceConversion *gsc = &gso->gsc;
|
||||
rcti *rect = &gso->brush_rect;
|
||||
|
@ -421,7 +421,7 @@ static void gp_weightpaint_select_stroke(tGP_BrushWeightpaintData *gso,
|
|||
if (len_v2v2_int(mval_i, pc1) <= radius) {
|
||||
/* apply operation to this point */
|
||||
if (pt_active != NULL) {
|
||||
gp_save_selected_point(gso, gps_active, 0, pc1);
|
||||
gpencil_save_selected_point(gso, gps_active, 0, pc1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -456,7 +456,7 @@ static void gp_weightpaint_select_stroke(tGP_BrushWeightpaintData *gso,
|
|||
pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt;
|
||||
index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i;
|
||||
if (pt_active != NULL) {
|
||||
gp_save_selected_point(gso, gps_active, index, pc1);
|
||||
gpencil_save_selected_point(gso, gps_active, index, pc1);
|
||||
}
|
||||
|
||||
/* Only do the second point if this is the last segment,
|
||||
|
@ -472,7 +472,7 @@ static void gp_weightpaint_select_stroke(tGP_BrushWeightpaintData *gso,
|
|||
pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt;
|
||||
index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i + 1;
|
||||
if (pt_active != NULL) {
|
||||
gp_save_selected_point(gso, gps_active, index, pc2);
|
||||
gpencil_save_selected_point(gso, gps_active, index, pc2);
|
||||
include_last = false;
|
||||
}
|
||||
}
|
||||
|
@ -490,7 +490,7 @@ static void gp_weightpaint_select_stroke(tGP_BrushWeightpaintData *gso,
|
|||
pt_active = (pt->runtime.pt_orig) ? pt->runtime.pt_orig : pt;
|
||||
index = (pt->runtime.pt_orig) ? pt->runtime.idx_orig : i;
|
||||
if (pt_active != NULL) {
|
||||
gp_save_selected_point(gso, gps_active, index, pc1);
|
||||
gpencil_save_selected_point(gso, gps_active, index, pc1);
|
||||
|
||||
include_last = false;
|
||||
}
|
||||
|
@ -501,11 +501,11 @@ static void gp_weightpaint_select_stroke(tGP_BrushWeightpaintData *gso,
|
|||
}
|
||||
|
||||
/* Apply weight paint brushes to strokes in the given frame. */
|
||||
static bool gp_weightpaint_brush_do_frame(bContext *C,
|
||||
tGP_BrushWeightpaintData *gso,
|
||||
bGPDlayer *gpl,
|
||||
bGPDframe *gpf,
|
||||
const float diff_mat[4][4])
|
||||
static bool gpencil_weightpaint_brush_do_frame(bContext *C,
|
||||
tGP_BrushWeightpaintData *gso,
|
||||
bGPDlayer *gpl,
|
||||
bGPDframe *gpf,
|
||||
const float diff_mat[4][4])
|
||||
{
|
||||
Object *ob = CTX_data_active_object(C);
|
||||
char tool = gso->brush->gpencil_weight_tool;
|
||||
|
@ -531,7 +531,7 @@ static bool gp_weightpaint_brush_do_frame(bContext *C,
|
|||
}
|
||||
|
||||
/* Check points below the brush. */
|
||||
gp_weightpaint_select_stroke(gso, gps, diff_mat);
|
||||
gpencil_weightpaint_select_stroke(gso, gps, diff_mat);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------
|
||||
|
@ -561,7 +561,7 @@ static bool gp_weightpaint_brush_do_frame(bContext *C,
|
|||
}
|
||||
|
||||
/* Apply brush effect to all layers. */
|
||||
static bool gp_weightpaint_brush_apply_to_layers(bContext *C, tGP_BrushWeightpaintData *gso)
|
||||
static bool gpencil_weightpaint_brush_apply_to_layers(bContext *C, tGP_BrushWeightpaintData *gso)
|
||||
{
|
||||
ToolSettings *ts = CTX_data_tool_settings(C);
|
||||
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
|
||||
|
@ -608,7 +608,7 @@ static bool gp_weightpaint_brush_apply_to_layers(bContext *C, tGP_BrushWeightpai
|
|||
}
|
||||
|
||||
/* affect strokes in this frame */
|
||||
changed |= gp_weightpaint_brush_do_frame(C, gso, gpl, gpf, diff_mat);
|
||||
changed |= gpencil_weightpaint_brush_do_frame(C, gso, gpl, gpf, diff_mat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -616,7 +616,7 @@ static bool gp_weightpaint_brush_apply_to_layers(bContext *C, tGP_BrushWeightpai
|
|||
if (gpl->actframe != NULL) {
|
||||
/* Apply to active frame's strokes */
|
||||
gso->mf_falloff = 1.0f;
|
||||
changed |= gp_weightpaint_brush_do_frame(C, gso, gpl, gpl->actframe, diff_mat);
|
||||
changed |= gpencil_weightpaint_brush_do_frame(C, gso, gpl, gpl->actframe, diff_mat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -625,7 +625,7 @@ static bool gp_weightpaint_brush_apply_to_layers(bContext *C, tGP_BrushWeightpai
|
|||
}
|
||||
|
||||
/* Calculate settings for applying brush */
|
||||
static void gp_weightpaint_brush_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
|
||||
static void gpencil_weightpaint_brush_apply(bContext *C, wmOperator *op, PointerRNA *itemptr)
|
||||
{
|
||||
tGP_BrushWeightpaintData *gso = op->customdata;
|
||||
Brush *brush = gso->brush;
|
||||
|
@ -658,7 +658,7 @@ static void gp_weightpaint_brush_apply(bContext *C, wmOperator *op, PointerRNA *
|
|||
/* Calculate 2D direction vector and relative angle. */
|
||||
brush_calc_dvec_2d(gso);
|
||||
|
||||
changed = gp_weightpaint_brush_apply_to_layers(C, gso);
|
||||
changed = gpencil_weightpaint_brush_apply_to_layers(C, gso);
|
||||
|
||||
/* Updates */
|
||||
if (changed) {
|
||||
|
@ -676,7 +676,9 @@ static void gp_weightpaint_brush_apply(bContext *C, wmOperator *op, PointerRNA *
|
|||
/* Running --------------------------------------------- */
|
||||
|
||||
/* helper - a record stroke, and apply paint event */
|
||||
static void gp_weightpaint_brush_apply_event(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
static void gpencil_weightpaint_brush_apply_event(bContext *C,
|
||||
wmOperator *op,
|
||||
const wmEvent *event)
|
||||
{
|
||||
tGP_BrushWeightpaintData *gso = op->customdata;
|
||||
PointerRNA itemptr;
|
||||
|
@ -698,28 +700,28 @@ static void gp_weightpaint_brush_apply_event(bContext *C, wmOperator *op, const
|
|||
RNA_float_set(&itemptr, "pressure", pressure);
|
||||
|
||||
/* apply */
|
||||
gp_weightpaint_brush_apply(C, op, &itemptr);
|
||||
gpencil_weightpaint_brush_apply(C, op, &itemptr);
|
||||
}
|
||||
|
||||
/* reapply */
|
||||
static int gp_weightpaint_brush_exec(bContext *C, wmOperator *op)
|
||||
static int gpencil_weightpaint_brush_exec(bContext *C, wmOperator *op)
|
||||
{
|
||||
if (!gp_weightpaint_brush_init(C, op)) {
|
||||
if (!gpencil_weightpaint_brush_init(C, op)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
RNA_BEGIN (op->ptr, itemptr, "stroke") {
|
||||
gp_weightpaint_brush_apply(C, op, &itemptr);
|
||||
gpencil_weightpaint_brush_apply(C, op, &itemptr);
|
||||
}
|
||||
RNA_END;
|
||||
|
||||
gp_weightpaint_brush_exit(C, op);
|
||||
gpencil_weightpaint_brush_exit(C, op);
|
||||
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
|
||||
/* start modal painting */
|
||||
static int gp_weightpaint_brush_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
static int gpencil_weightpaint_brush_invoke(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
tGP_BrushWeightpaintData *gso = NULL;
|
||||
const bool is_modal = RNA_boolean_get(op->ptr, "wait_for_input");
|
||||
|
@ -733,7 +735,7 @@ static int gp_weightpaint_brush_invoke(bContext *C, wmOperator *op, const wmEven
|
|||
}
|
||||
|
||||
/* init painting data */
|
||||
if (!gp_weightpaint_brush_init(C, op)) {
|
||||
if (!gpencil_weightpaint_brush_init(C, op)) {
|
||||
return OPERATOR_CANCELLED;
|
||||
}
|
||||
|
||||
|
@ -748,7 +750,7 @@ static int gp_weightpaint_brush_invoke(bContext *C, wmOperator *op, const wmEven
|
|||
|
||||
/* apply first dab... */
|
||||
gso->is_painting = true;
|
||||
gp_weightpaint_brush_apply_event(C, op, event);
|
||||
gpencil_weightpaint_brush_apply_event(C, op, event);
|
||||
|
||||
/* redraw view with feedback */
|
||||
ED_region_tag_redraw(region);
|
||||
|
@ -758,7 +760,7 @@ static int gp_weightpaint_brush_invoke(bContext *C, wmOperator *op, const wmEven
|
|||
}
|
||||
|
||||
/* painting - handle events */
|
||||
static int gp_weightpaint_brush_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
static int gpencil_weightpaint_brush_modal(bContext *C, wmOperator *op, const wmEvent *event)
|
||||
{
|
||||
tGP_BrushWeightpaintData *gso = op->customdata;
|
||||
const bool is_modal = RNA_boolean_get(op->ptr, "wait_for_input");
|
||||
|
@ -773,7 +775,7 @@ static int gp_weightpaint_brush_modal(bContext *C, wmOperator *op, const wmEvent
|
|||
case MOUSEMOVE:
|
||||
case INBETWEEN_MOUSEMOVE:
|
||||
/* apply brush effect at new position */
|
||||
gp_weightpaint_brush_apply_event(C, op, event);
|
||||
gpencil_weightpaint_brush_apply_event(C, op, event);
|
||||
|
||||
/* force redraw, so that the cursor will at least be valid */
|
||||
redraw_region = true;
|
||||
|
@ -789,7 +791,7 @@ static int gp_weightpaint_brush_modal(bContext *C, wmOperator *op, const wmEvent
|
|||
/* end painting, since we're not modal */
|
||||
gso->is_painting = false;
|
||||
|
||||
gp_weightpaint_brush_exit(C, op);
|
||||
gpencil_weightpaint_brush_exit(C, op);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
break;
|
||||
|
@ -798,7 +800,7 @@ static int gp_weightpaint_brush_modal(bContext *C, wmOperator *op, const wmEvent
|
|||
case MIDDLEMOUSE:
|
||||
case RIGHTMOUSE:
|
||||
case EVT_ESCKEY:
|
||||
gp_weightpaint_brush_exit(C, op);
|
||||
gpencil_weightpaint_brush_exit(C, op);
|
||||
return OPERATOR_FINISHED;
|
||||
}
|
||||
}
|
||||
|
@ -813,13 +815,13 @@ static int gp_weightpaint_brush_modal(bContext *C, wmOperator *op, const wmEvent
|
|||
gso->is_painting = true;
|
||||
gso->first = true;
|
||||
|
||||
gp_weightpaint_brush_apply_event(C, op, event);
|
||||
gpencil_weightpaint_brush_apply_event(C, op, event);
|
||||
break;
|
||||
|
||||
/* Exit modal operator, based on the "standard" ops */
|
||||
case RIGHTMOUSE:
|
||||
case EVT_ESCKEY:
|
||||
gp_weightpaint_brush_exit(C, op);
|
||||
gpencil_weightpaint_brush_exit(C, op);
|
||||
return OPERATOR_FINISHED;
|
||||
|
||||
/* MMB is often used for view manipulations */
|
||||
|
@ -881,11 +883,11 @@ void GPENCIL_OT_weight_paint(wmOperatorType *ot)
|
|||
ot->description = "Paint stroke points with a color";
|
||||
|
||||
/* api callbacks */
|
||||
ot->exec = gp_weightpaint_brush_exec;
|
||||
ot->invoke = gp_weightpaint_brush_invoke;
|
||||
ot->modal = gp_weightpaint_brush_modal;
|
||||
ot->cancel = gp_weightpaint_brush_exit;
|
||||
ot->poll = gp_weightpaint_brush_poll;
|
||||
ot->exec = gpencil_weightpaint_brush_exec;
|
||||
ot->invoke = gpencil_weightpaint_brush_invoke;
|
||||
ot->modal = gpencil_weightpaint_brush_modal;
|
||||
ot->cancel = gpencil_weightpaint_brush_exit;
|
||||
ot->poll = gpencil_weightpaint_brush_poll;
|
||||
|
||||
/* flags */
|
||||
ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO | OPTYPE_BLOCKING;
|
||||
|
|
|
@ -254,18 +254,18 @@ void ED_gpencil_add_defaults(struct bContext *C, struct Object *ob);
|
|||
void ED_gpencil_setup_modes(struct bContext *C, struct bGPdata *gpd, int newmode);
|
||||
bool ED_object_gpencil_exit(struct Main *bmain, struct Object *ob);
|
||||
|
||||
void ED_gp_project_stroke_to_plane(const struct Scene *scene,
|
||||
const struct Object *ob,
|
||||
const struct RegionView3D *rv3d,
|
||||
struct bGPDstroke *gps,
|
||||
const float origin[3],
|
||||
const int axis);
|
||||
void ED_gp_project_point_to_plane(const struct Scene *scene,
|
||||
const struct Object *ob,
|
||||
const struct RegionView3D *rv3d,
|
||||
const float origin[3],
|
||||
const int axis,
|
||||
struct bGPDspoint *pt);
|
||||
void ED_gpencil_project_stroke_to_plane(const struct Scene *scene,
|
||||
const struct Object *ob,
|
||||
const struct RegionView3D *rv3d,
|
||||
struct bGPDstroke *gps,
|
||||
const float origin[3],
|
||||
const int axis);
|
||||
void ED_gpencil_project_point_to_plane(const struct Scene *scene,
|
||||
const struct Object *ob,
|
||||
const struct RegionView3D *rv3d,
|
||||
const float origin[3],
|
||||
const int axis,
|
||||
struct bGPDspoint *pt);
|
||||
void ED_gpencil_drawing_reference_get(const struct Scene *scene,
|
||||
const struct Object *ob,
|
||||
char align_flag,
|
||||
|
|
Loading…
Reference in New Issue