[Bf-blender-cvs] [928665b9192] greasepencil-object: GPencil: Add missing recalc of bounding box in Array modifier
Antonio Vazquez
noreply at git.blender.org
Thu Mar 5 10:27:21 CET 2020
Commit: 928665b91929c9e20e1ff48139237e360edefdfe
Author: Antonio Vazquez
Date: Thu Mar 5 10:24:50 2020 +0100
Branches: greasepencil-object
https://developer.blender.org/rB928665b91929c9e20e1ff48139237e360edefdfe
GPencil: Add missing recalc of bounding box in Array modifier
Also some code cleanup and fix compiler warnings
===================================================================
M source/blender/blenkernel/BKE_gpencil.h
M source/blender/blenkernel/intern/gpencil.c
M source/blender/blenkernel/intern/gpencil_modifier.c
M source/blender/editors/gpencil/gpencil_data.c
M source/blender/editors/gpencil/gpencil_utils.c
M source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
M source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
M source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_gpencil.h b/source/blender/blenkernel/BKE_gpencil.h
index dae0b0d6f83..9d382775df7 100644
--- a/source/blender/blenkernel/BKE_gpencil.h
+++ b/source/blender/blenkernel/BKE_gpencil.h
@@ -238,7 +238,7 @@ bool BKE_gpencil_stroke_select_check(const struct bGPDstroke *gps);
struct BoundBox *BKE_gpencil_boundbox_get(struct Object *ob);
void BKE_gpencil_centroid_3d(struct bGPdata *gpd, float r_centroid[3]);
-void BKE_gpencil_stroke_collision_get(struct bGPDstroke *gps);
+void BKE_gpencil_stroke_boundingbox_calc(struct bGPDstroke *gps);
/* vertex groups */
void BKE_gpencil_dvert_ensure(struct bGPDstroke *gps);
@@ -252,7 +252,7 @@ void BKE_gpencil_frame_active_set(struct Depsgraph *depsgraph, struct bGPdata *g
void BKE_gpencil_stroke_normal(const struct bGPDstroke *gps, float r_normal[3]);
void BKE_gpencil_stroke_simplify_adaptive(struct bGPDstroke *gps, float factor);
void BKE_gpencil_stroke_simplify_fixed(struct bGPDstroke *gps);
-void BKE_gpencil_stroke_subdivide(struct bGPDstroke *gps, int level, int flag, int type);
+void BKE_gpencil_stroke_subdivide(struct bGPDstroke *gps, int level, int type);
bool BKE_gpencil_stroke_trim(struct bGPDstroke *gps);
void BKE_gpencil_stroke_merge_distance(struct bGPDframe *gpf,
struct bGPDstroke *gps,
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 1cb0e12e6c4..07826754787 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1449,8 +1449,8 @@ void BKE_gpencil_centroid_3d(bGPdata *gpd, float r_centroid[3])
mul_v3_v3fl(r_centroid, tot, 0.5f);
}
-/* Compute stroke collision detection center and radius. */
-void BKE_gpencil_stroke_collision_get(bGPDstroke *gps)
+/* Compute stroke bounding box. */
+void BKE_gpencil_stroke_boundingbox_calc(bGPDstroke *gps)
{
INIT_MINMAX(gps->boundbox_min, gps->boundbox_max);
BKE_gpencil_stroke_minmax(gps, false, gps->boundbox_min, gps->boundbox_max);
@@ -2888,8 +2888,8 @@ void BKE_gpencil_stroke_geometry_update(bGPDstroke *gps)
/* calc uv data along the stroke */
BKE_gpencil_stroke_uv_update(gps);
- /* Calc collision center and radius. */
- BKE_gpencil_stroke_collision_get(gps);
+ /* Calc stroke bounding box. */
+ BKE_gpencil_stroke_boundingbox_calc(gps);
}
float BKE_gpencil_stroke_length(const bGPDstroke *gps, bool use_3d)
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index 1864b886fd3..1014db27d84 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -622,7 +622,7 @@ GpencilModifierData *BKE_gpencil_modifiers_findByName(Object *ob, const char *na
return BLI_findstring(&(ob->greasepencil_modifiers), name, offsetof(GpencilModifierData, name));
}
-void BKE_gpencil_stroke_subdivide(bGPDstroke *gps, int level, int flag, int type)
+void BKE_gpencil_stroke_subdivide(bGPDstroke *gps, int level, int type)
{
bGPDspoint *temp_points;
MDeformVert *temp_dverts = NULL;
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index 3f8998c7823..decd1865f12 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -636,18 +636,18 @@ enum {
static int gp_frame_duplicate_exec(bContext *C, wmOperator *op)
{
bGPdata *gpd = ED_gpencil_data_get_active(C);
- bGPDlayer *gpl = BKE_gpencil_layer_active_get(gpd);
+ bGPDlayer *gpl_active = BKE_gpencil_layer_active_get(gpd);
Scene *scene = CTX_data_scene(C);
int mode = RNA_enum_get(op->ptr, "mode");
/* sanity checks */
- if (ELEM(NULL, gpd, gpl)) {
+ if (ELEM(NULL, gpd, gpl_active)) {
return OPERATOR_CANCELLED;
}
if (mode == 0) {
- BKE_gpencil_frame_addcopy(gpl, CFRA);
+ BKE_gpencil_frame_addcopy(gpl_active, CFRA);
}
else {
LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) {
@@ -3427,7 +3427,7 @@ void GPENCIL_OT_layer_mask_add(wmOperatorType *ot)
RNA_def_string(ot->srna, "name", NULL, 128, "Layer", "Name of the layer");
}
-static int gp_layer_mask_remove_exec(bContext *C, wmOperator *op)
+static int gp_layer_mask_remove_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob = CTX_data_active_object(C);
if ((ob == NULL) || (ob->type != OB_GPENCIL)) {
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index f3b7a7bd06e..485608115fb 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -2578,7 +2578,7 @@ bool ED_gpencil_stroke_check_collision(GP_SpaceConversion *gsc,
/* Check we have something to use (only for old files). */
if (equals_v3v3(zerov3, gps->boundbox_min)) {
- BKE_gpencil_stroke_collision_get(gps);
+ BKE_gpencil_stroke_boundingbox_calc(gps);
}
/* Convert bound box to 2d */
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
index 17491a0d2ef..7ea709bbbbb 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
@@ -261,6 +261,8 @@ static void generate_geometry(GpencilModifierData *md,
/* Add new stroke. */
BLI_addhead(&iter->gpf->strokes, gps_dst);
+ /* Calc bounding box. */
+ BKE_gpencil_stroke_boundingbox_calc(gps_dst);
}
/* Advance random index. */
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
index 396ef627c50..8fce57f3368 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilbuild.c
@@ -399,7 +399,7 @@ static void build_concurrent(BuildGpencilModifierData *mmd, bGPDframe *gpf, floa
/* --------------------------------------------- */
static void generate_geometry(
- GpencilModifierData *md, Depsgraph *depsgraph, Object *ob, bGPDlayer *gpl, bGPDframe *gpf)
+ GpencilModifierData *md, Depsgraph *depsgraph, bGPDlayer *gpl, bGPDframe *gpf)
{
BuildGpencilModifierData *mmd = (BuildGpencilModifierData *)md;
const bool reverse = (mmd->transition != GP_BUILD_TRANSITION_GROW);
@@ -528,7 +528,7 @@ static void generateStrokes(GpencilModifierData *md, Depsgraph *depsgraph, Objec
if (gpf == NULL) {
continue;
}
- generate_geometry(md, depsgraph, ob, gpl, gpf);
+ generate_geometry(md, depsgraph, gpl, gpf);
}
}
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c
index dd1d6ce2dd1..25abf0b81eb 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilsubdiv.c
@@ -85,7 +85,7 @@ static void deformStroke(GpencilModifierData *md,
return;
}
- BKE_gpencil_stroke_subdivide(gps, mmd->level, mmd->flag, mmd->type);
+ BKE_gpencil_stroke_subdivide(gps, mmd->level, mmd->type);
}
static void bakeModifier(struct Main *UNUSED(bmain),
More information about the Bf-blender-cvs
mailing list