[Bf-blender-cvs] [9a3a016fb6c] temp-gpencil-bezier-stroke-type: Merge branch 'master' into temp-gpencil-bezier-stroke-type
Antonio Vazquez
noreply at git.blender.org
Wed Apr 28 17:37:10 CEST 2021
Commit: 9a3a016fb6ce40c2921bdd231b33a1ebe9f244ae
Author: Antonio Vazquez
Date: Wed Apr 28 17:36:50 2021 +0200
Branches: temp-gpencil-bezier-stroke-type
https://developer.blender.org/rB9a3a016fb6ce40c2921bdd231b33a1ebe9f244ae
Merge branch 'master' into temp-gpencil-bezier-stroke-type
Conflicts:
source/blender/editors/transform/transform_convert_gpencil.c
===================================================================
===================================================================
diff --cc source/blender/editors/transform/transform_convert_gpencil.c
index ca31603a09a,4932a5f8d23..cd8dc517b8b
--- a/source/blender/editors/transform/transform_convert_gpencil.c
+++ b/source/blender/editors/transform/transform_convert_gpencil.c
@@@ -368,71 -297,69 +366,71 @@@ static void createTransGPencil_strokes(
bool is_ctrl_point = (j == 1);
bool sel = sel_flag & (1 << j);
- if (is_prop_edit || sel) {
- copy_v3_v3(td->iloc, bezt->vec[j]);
- td->loc = bezt->vec[j];
- bool rotate_around_ctrl = !handles_visible ||
- (t->around == V3D_AROUND_LOCAL_ORIGINS) ||
- (bezt->f2 & SELECT);
- copy_v3_v3(td->center, bezt->vec[rotate_around_ctrl ? 1 : j]);
+ if (!is_prop_edit && !sel) {
+ continue;
+ }
+
+ copy_v3_v3(td->iloc, bezt->vec[j]);
+ td->loc = bezt->vec[j];
+ bool rotate_around_ctrl = !handles_visible ||
+ (t->around == V3D_AROUND_LOCAL_ORIGINS) ||
+ (bezt->f2 & SELECT);
+ copy_v3_v3(td->center, bezt->vec[rotate_around_ctrl ? 1 : j]);
- if (!handles_visible || is_ctrl_point) {
- if (bezt->f2 & SELECT) {
- td->flag = TD_SELECTED;
- }
- else {
- td->flag = 0;
+ if (!handles_visible || is_ctrl_point) {
+ if (bezt->f2 & SELECT) {
+ td->flag = TD_SELECTED;
+ }
+ else {
+ td->flag = 0;
+ }
}
- }
- else if (handles_visible) {
- if (BEZT_ISSEL_IDX(bezt, j)) {
- td->flag = TD_SELECTED;
- }
- else {
- td->flag = 0;
+ else if (handles_visible) {
+ if (sel) {
+ td->flag = TD_SELECTED;
+ }
+ else {
+ td->flag = 0;
+ }
}
- }
- td->ext = NULL;
- if (is_ctrl_point) {
- if (t->mode != TFM_MIRROR) {
- if (t->mode != TFM_GPENCIL_OPACITY) {
- if (is_scale_thickness) {
- td->val = &(gpc_pt->pressure);
- td->ival = gpc_pt->pressure;
- }
- }
- else {
- td->val = &(gpc_pt->strength);
- td->ival = gpc_pt->strength;
+ td->ext = NULL;
+ if (is_ctrl_point) {
+ if (t->mode != TFM_MIRROR) {
+ if (t->mode != TFM_GPENCIL_OPACITY) {
+ if (is_scale_thickness) {
+ td->val = &(gpc_pt->pressure);
+ td->ival = gpc_pt->pressure;
}
}
+ else {
+ td->val = &(gpc_pt->strength);
+ td->ival = gpc_pt->strength;
+ }
}
- else {
- td->val = NULL;
- }
+ }
+ else {
+ td->val = NULL;
+ }
- if (hdata == NULL) {
- if (is_ctrl_point && ((sel_flag & SEL_F1 & SEL_F3) == 0)) {
- hdata = initTransDataCurveHandles(td, bezt);
- }
- else if (!is_ctrl_point) {
- hdata = initTransDataCurveHandles(td, bezt);
- }
+ if (hdata == NULL) {
+ if (is_ctrl_point && ((sel_flag & SEL_F1 & SEL_F3) == 0)) {
+ hdata = initTransDataCurveHandles(td, bezt);
}
+ else if (!is_ctrl_point) {
+ hdata = initTransDataCurveHandles(td, bezt);
+ }
+ }
- td->extra = gps;
- td->ob = obact;
+ td->extra = gps;
+ td->ob = obact;
- copy_m3_m3(td->smtx, smtx);
- copy_m3_m3(td->mtx, mtx);
- copy_m3_m3(td->axismtx, mtx);
+ copy_m3_m3(td->smtx, smtx);
+ copy_m3_m3(td->mtx, mtx);
+ copy_m3_m3(td->axismtx, mtx);
- td++;
- tail++;
- }
+ td++;
+ tail++;
bezt_use |= sel;
}
diff --cc source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
index c46a7006758,ea37558fa7f..554fbefcbf7
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilopacity.c
@@@ -84,13 -86,46 +86,46 @@@ static void copyData(const GpencilModif
tgmd->curve_intensity = BKE_curvemapping_copy(gmd->curve_intensity);
}
+ static float give_opacity_fading_factor(OpacityGpencilModifierData *mmd,
+ Object *ob_this,
+ float *pos,
+ bool apply_obmat)
+ {
+ float factor_depth = 1.0f;
+
+ if (((mmd->flag & GP_OPACITY_FADING) == 0) || ((mmd->object) == NULL)) {
+ return factor_depth;
+ }
+
+ float gvert[3];
+ if (apply_obmat) {
+ mul_v3_m4v3(gvert, ob_this->obmat, pos);
+ }
+ float dist = len_v3v3(mmd->object->obmat[3], gvert);
+ float fading_max = MAX2(mmd->fading_start, mmd->fading_end);
+ float fading_min = MIN2(mmd->fading_start, mmd->fading_end);
+
+ /* Better with ratiof() function from line art. */
+ if (dist > fading_max) {
+ factor_depth = 0.0f;
+ }
+ else if (dist <= fading_max && dist > fading_min) {
+ factor_depth = (fading_max - dist) / (fading_max - fading_min);
+ }
+ else {
+ factor_depth = 1.0f;
+ }
+
+ return factor_depth;
+ }
+
/* opacity strokes */
-static void deformStroke(GpencilModifierData *md,
- Depsgraph *UNUSED(depsgraph),
- Object *ob,
- bGPDlayer *gpl,
- bGPDframe *UNUSED(gpf),
- bGPDstroke *gps)
+static void deformPolyline(GpencilModifierData *md,
+ Depsgraph *UNUSED(depsgraph),
+ Object *ob,
+ bGPDlayer *gpl,
+ bGPDframe *UNUSED(gpf),
+ bGPDstroke *gps)
{
OpacityGpencilModifierData *mmd = (OpacityGpencilModifierData *)md;
const int def_nr = BKE_object_defgroup_name_index(ob, mmd->vgname);
More information about the Bf-blender-cvs
mailing list