GPencil: Add Frame parameter to modifier deformStroke Callback
This commit adds the frame to deformStroke Callback as a preparation for new modifiers that will need this variable. Actually, the existing modifiers are not using the frame.
This commit is contained in:
parent
a897c8e342
commit
31da3936b4
|
@ -140,6 +140,7 @@ typedef struct GpencilModifierTypeInfo {
|
|||
struct Depsgraph *depsgraph,
|
||||
struct Object *ob,
|
||||
struct bGPDlayer *gpl,
|
||||
struct bGPDframe *gpf,
|
||||
struct bGPDstroke *gps);
|
||||
|
||||
/**
|
||||
|
|
|
@ -343,7 +343,7 @@ bool BKE_gpencil_has_time_modifiers(Object *ob)
|
|||
void BKE_gpencil_stroke_modifiers(Depsgraph *depsgraph,
|
||||
Object *ob,
|
||||
bGPDlayer *gpl,
|
||||
bGPDframe *UNUSED(gpf),
|
||||
bGPDframe *gpf,
|
||||
bGPDstroke *gps,
|
||||
bool is_render)
|
||||
{
|
||||
|
@ -360,7 +360,7 @@ void BKE_gpencil_stroke_modifiers(Depsgraph *depsgraph,
|
|||
}
|
||||
|
||||
if (mti && mti->deformStroke) {
|
||||
mti->deformStroke(md, depsgraph, ob, gpl, gps);
|
||||
mti->deformStroke(md, depsgraph, ob, gpl, gpf, gps);
|
||||
/* subdivide always requires update */
|
||||
if (md->type == eGpencilModifierType_Subdiv) {
|
||||
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
|
||||
|
|
|
@ -107,6 +107,7 @@ static void deformStroke(GpencilModifierData *md,
|
|||
Depsgraph *UNUSED(depsgraph),
|
||||
Object *ob,
|
||||
bGPDlayer *UNUSED(gpl),
|
||||
bGPDframe *UNUSED(gpf),
|
||||
bGPDstroke *gps)
|
||||
{
|
||||
ArmatureGpencilModifierData *mmd = (ArmatureGpencilModifierData *)md;
|
||||
|
@ -140,7 +141,7 @@ static void bakeModifier(Main *bmain, Depsgraph *depsgraph, GpencilModifierData
|
|||
|
||||
/* compute armature effects on this frame */
|
||||
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
|
||||
deformStroke(md_eval, depsgraph, object_eval, gpl, gps);
|
||||
deformStroke(md_eval, depsgraph, object_eval, gpl, gpf, gps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ static void deformStroke(GpencilModifierData *md,
|
|||
Depsgraph *UNUSED(depsgraph),
|
||||
Object *ob,
|
||||
bGPDlayer *gpl,
|
||||
bGPDframe *UNUSED(gpf),
|
||||
bGPDstroke *gps)
|
||||
{
|
||||
|
||||
|
@ -128,7 +129,7 @@ static void bakeModifier(Main *bmain, Depsgraph *depsgraph, GpencilModifierData
|
|||
copy_v4_v4(gps->runtime.tmp_stroke_rgba, gp_style->stroke_rgba);
|
||||
copy_v4_v4(gps->runtime.tmp_fill_rgba, gp_style->fill_rgba);
|
||||
|
||||
deformStroke(md, depsgraph, ob, gpl, gps);
|
||||
deformStroke(md, depsgraph, ob, gpl, gpf, gps);
|
||||
|
||||
gpencil_apply_modifier_material(
|
||||
bmain, ob, mat, gh_color, gps, (bool)(mmd->flag & GP_COLOR_CREATE_COLORS));
|
||||
|
|
|
@ -190,6 +190,7 @@ static void deformStroke(GpencilModifierData *md,
|
|||
Depsgraph *UNUSED(depsgraph),
|
||||
Object *ob,
|
||||
bGPDlayer *gpl,
|
||||
bGPDframe *UNUSED(gpf),
|
||||
bGPDstroke *gps)
|
||||
{
|
||||
HookGpencilModifierData *mmd = (HookGpencilModifierData *)md;
|
||||
|
@ -285,7 +286,7 @@ static void bakeModifier(Main *bmain, Depsgraph *depsgraph, GpencilModifierData
|
|||
|
||||
/* compute hook effects on this frame */
|
||||
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
|
||||
deformStroke(md, depsgraph, ob, gpl, gps);
|
||||
deformStroke(md, depsgraph, ob, gpl, gpf, gps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,6 +70,7 @@ static void deformStroke(GpencilModifierData *md,
|
|||
Depsgraph *UNUSED(depsgraph),
|
||||
Object *ob,
|
||||
bGPDlayer *gpl,
|
||||
bGPDframe *UNUSED(gpf),
|
||||
bGPDstroke *gps)
|
||||
{
|
||||
LatticeGpencilModifierData *mmd = (LatticeGpencilModifierData *)md;
|
||||
|
@ -134,7 +135,7 @@ static void bakeModifier(Main *bmain, Depsgraph *depsgraph, GpencilModifierData
|
|||
|
||||
/* compute lattice effects on this frame */
|
||||
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
|
||||
deformStroke(md, depsgraph, ob, gpl, gps);
|
||||
deformStroke(md, depsgraph, ob, gpl, gpf, gps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,8 +72,12 @@ static bool dependsOnTime(GpencilModifierData *md)
|
|||
}
|
||||
|
||||
/* aply noise effect based on stroke direction */
|
||||
static void deformStroke(
|
||||
GpencilModifierData *md, Depsgraph *depsgraph, Object *ob, bGPDlayer *gpl, bGPDstroke *gps)
|
||||
static void deformStroke(GpencilModifierData *md,
|
||||
Depsgraph *depsgraph,
|
||||
Object *ob,
|
||||
bGPDlayer *gpl,
|
||||
bGPDframe *UNUSED(gpf),
|
||||
bGPDstroke *gps)
|
||||
{
|
||||
NoiseGpencilModifierData *mmd = (NoiseGpencilModifierData *)md;
|
||||
bGPDspoint *pt0, *pt1;
|
||||
|
@ -239,7 +243,7 @@ static void bakeModifier(struct Main *UNUSED(bmain),
|
|||
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
|
||||
for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
|
||||
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
|
||||
deformStroke(md, depsgraph, ob, gpl, gps);
|
||||
deformStroke(md, depsgraph, ob, gpl, gpf, gps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,6 +64,7 @@ static void deformStroke(GpencilModifierData *md,
|
|||
Depsgraph *UNUSED(depsgraph),
|
||||
Object *ob,
|
||||
bGPDlayer *gpl,
|
||||
bGPDframe *UNUSED(gpf),
|
||||
bGPDstroke *gps)
|
||||
{
|
||||
OffsetGpencilModifierData *mmd = (OffsetGpencilModifierData *)md;
|
||||
|
@ -116,7 +117,7 @@ static void bakeModifier(struct Main *UNUSED(bmain),
|
|||
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
|
||||
for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
|
||||
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
|
||||
deformStroke(md, depsgraph, ob, gpl, gps);
|
||||
deformStroke(md, depsgraph, ob, gpl, gpf, gps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,6 +67,7 @@ static void deformStroke(GpencilModifierData *md,
|
|||
Depsgraph *UNUSED(depsgraph),
|
||||
Object *ob,
|
||||
bGPDlayer *gpl,
|
||||
bGPDframe *UNUSED(gpf),
|
||||
bGPDstroke *gps)
|
||||
{
|
||||
OpacityGpencilModifierData *mmd = (OpacityGpencilModifierData *)md;
|
||||
|
@ -146,7 +147,7 @@ static void bakeModifier(Main *bmain, Depsgraph *depsgraph, GpencilModifierData
|
|||
copy_v4_v4(gps->runtime.tmp_stroke_rgba, gp_style->stroke_rgba);
|
||||
copy_v4_v4(gps->runtime.tmp_fill_rgba, gp_style->fill_rgba);
|
||||
|
||||
deformStroke(md, depsgraph, ob, gpl, gps);
|
||||
deformStroke(md, depsgraph, ob, gpl, gpf, gps);
|
||||
|
||||
gpencil_apply_modifier_material(
|
||||
bmain, ob, mat, gh_color, gps, (bool)(mmd->flag & GP_OPACITY_CREATE_COLORS));
|
||||
|
|
|
@ -57,6 +57,7 @@ static void deformStroke(GpencilModifierData *md,
|
|||
Depsgraph *UNUSED(depsgraph),
|
||||
Object *ob,
|
||||
bGPDlayer *gpl,
|
||||
bGPDframe *UNUSED(gpf),
|
||||
bGPDstroke *gps)
|
||||
{
|
||||
SimplifyGpencilModifierData *mmd = (SimplifyGpencilModifierData *)md;
|
||||
|
@ -95,7 +96,7 @@ static void bakeModifier(struct Main *UNUSED(bmain),
|
|||
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
|
||||
for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
|
||||
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
|
||||
deformStroke(md, depsgraph, ob, gpl, gps);
|
||||
deformStroke(md, depsgraph, ob, gpl, gpf, gps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,6 +60,7 @@ static void deformStroke(GpencilModifierData *md,
|
|||
Depsgraph *UNUSED(depsgraph),
|
||||
Object *ob,
|
||||
bGPDlayer *gpl,
|
||||
bGPDframe *UNUSED(gpf),
|
||||
bGPDstroke *gps)
|
||||
{
|
||||
SmoothGpencilModifierData *mmd = (SmoothGpencilModifierData *)md;
|
||||
|
@ -123,7 +124,7 @@ static void bakeModifier(struct Main *UNUSED(bmain),
|
|||
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
|
||||
for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
|
||||
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
|
||||
deformStroke(md, depsgraph, ob, gpl, gps);
|
||||
deformStroke(md, depsgraph, ob, gpl, gpf, gps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,6 +59,7 @@ static void deformStroke(GpencilModifierData *md,
|
|||
Depsgraph *UNUSED(depsgraph),
|
||||
Object *ob,
|
||||
bGPDlayer *gpl,
|
||||
bGPDframe *UNUSED(gpf),
|
||||
bGPDstroke *gps)
|
||||
{
|
||||
SubdivGpencilModifierData *mmd = (SubdivGpencilModifierData *)md;
|
||||
|
@ -89,7 +90,7 @@ static void bakeModifier(struct Main *UNUSED(bmain),
|
|||
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
|
||||
for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
|
||||
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
|
||||
deformStroke(md, depsgraph, ob, gpl, gps);
|
||||
deformStroke(md, depsgraph, ob, gpl, gpf, gps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,6 +83,7 @@ static void deformStroke(GpencilModifierData *md,
|
|||
Depsgraph *UNUSED(depsgraph),
|
||||
Object *ob,
|
||||
bGPDlayer *gpl,
|
||||
bGPDframe *UNUSED(gpf),
|
||||
bGPDstroke *gps)
|
||||
{
|
||||
ThickGpencilModifierData *mmd = (ThickGpencilModifierData *)md;
|
||||
|
@ -143,7 +144,7 @@ static void bakeModifier(struct Main *UNUSED(bmain),
|
|||
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
|
||||
for (bGPDframe *gpf = gpl->frames.first; gpf; gpf = gpf->next) {
|
||||
for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) {
|
||||
deformStroke(md, depsgraph, ob, gpl, gps);
|
||||
deformStroke(md, depsgraph, ob, gpl, gpf, gps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ static void deformStroke(GpencilModifierData *md,
|
|||
Depsgraph *UNUSED(depsgraph),
|
||||
Object *ob,
|
||||
bGPDlayer *gpl,
|
||||
bGPDframe *UNUSED(gpf),
|
||||
bGPDstroke *gps)
|
||||
{
|
||||
TintGpencilModifierData *mmd = (TintGpencilModifierData *)md;
|
||||
|
@ -134,7 +135,7 @@ static void bakeModifier(Main *bmain, Depsgraph *depsgraph, GpencilModifierData
|
|||
copy_v4_v4(gps->runtime.tmp_stroke_rgba, gp_style->stroke_rgba);
|
||||
copy_v4_v4(gps->runtime.tmp_fill_rgba, gp_style->fill_rgba);
|
||||
|
||||
deformStroke(md, depsgraph, ob, gpl, gps);
|
||||
deformStroke(md, depsgraph, ob, gpl, gpf, gps);
|
||||
|
||||
gpencil_apply_modifier_material(
|
||||
bmain, ob, mat, gh_color, gps, (bool)(mmd->flag & GP_TINT_CREATE_COLORS));
|
||||
|
|
Loading…
Reference in New Issue