[Bf-blender-cvs] [6fda1c80730] greasepencil-refactor: GPencil: Rename collision to boundbox
Antonio Vazquez
noreply at git.blender.org
Fri Feb 7 17:13:15 CET 2020
Commit: 6fda1c807303a67545f723dc64b54f2f54a9b2e9
Author: Antonio Vazquez
Date: Fri Feb 7 17:12:56 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rB6fda1c807303a67545f723dc64b54f2f54a9b2e9
GPencil: Rename collision to boundbox
The initial use of the variables was collision, but now are used for more things, so it's better put a more general name.
===================================================================
M source/blender/blenkernel/intern/gpencil.c
M source/blender/editors/gpencil/gpencil_utils.c
M source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
M source/blender/makesdna/DNA_gpencil_types.h
===================================================================
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 610c8b4280c..2b58525396b 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1340,8 +1340,8 @@ void BKE_gpencil_centroid_3d(bGPdata *gpd, float r_centroid[3])
/* Compute stroke collision detection center and radius. */
void BKE_gpencil_stroke_collision_get(bGPDstroke *gps)
{
- INIT_MINMAX(gps->collision_min, gps->collision_max);
- BKE_gpencil_stroke_minmax(gps, false, gps->collision_min, gps->collision_max);
+ INIT_MINMAX(gps->boundbox_min, gps->boundbox_max);
+ BKE_gpencil_stroke_minmax(gps, false, gps->boundbox_min, gps->boundbox_max);
}
/* create bounding box values */
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index 6995f7074e8..3ac01bb45ff 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -2564,26 +2564,25 @@ bool ED_gpencil_stroke_check_collision(GP_SpaceConversion *gsc,
{
const int offset = (int)ceil(sqrt((radius * radius) * 2));
bGPDspoint pt_dummy, pt_dummy_ps;
- float gps_collision_min[2] = {0.0f};
- float gps_collision_max[2] = {0.0f};
+ float boundbox_min[2] = {0.0f};
+ float boundbox_max[2] = {0.0f};
float zerov3[3];
/* Check we have something to use (only for old files). */
- if (equals_v3v3(zerov3, gps->collision_min)) {
+ if (equals_v3v3(zerov3, gps->boundbox_min)) {
BKE_gpencil_stroke_collision_get(gps);
}
/* Convert bound box to 2d */
- copy_v3_v3(&pt_dummy.x, gps->collision_min);
+ copy_v3_v3(&pt_dummy.x, gps->boundbox_min);
gp_point_to_parent_space(&pt_dummy, diff_mat, &pt_dummy_ps);
- gp_point_to_xy_fl(gsc, gps, &pt_dummy_ps, &gps_collision_min[0], &gps_collision_min[1]);
+ gp_point_to_xy_fl(gsc, gps, &pt_dummy_ps, &boundbox_min[0], &boundbox_min[1]);
- copy_v3_v3(&pt_dummy.x, gps->collision_max);
+ copy_v3_v3(&pt_dummy.x, gps->boundbox_max);
gp_point_to_parent_space(&pt_dummy, diff_mat, &pt_dummy_ps);
- gp_point_to_xy_fl(gsc, gps, &pt_dummy_ps, &gps_collision_max[0], &gps_collision_max[1]);
+ gp_point_to_xy_fl(gsc, gps, &pt_dummy_ps, &boundbox_max[0], &boundbox_max[1]);
- rcti rect_stroke = {
- gps_collision_min[0], gps_collision_max[0], gps_collision_min[1], gps_collision_max[1]};
+ rcti rect_stroke = {boundbox_min[0], boundbox_max[0], boundbox_min[1], boundbox_max[1]};
/* For mouse, add a small offet to avoid false negative in corners. */
rcti rect_mouse = {mouse[0] - offset, mouse[0] + offset, mouse[1] - offset, mouse[1] + offset};
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
index ab621a966a7..712959adefe 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilarray.c
@@ -231,7 +231,7 @@ static void generate_geometry(GpencilModifierData *md,
/* Calculate original stroke center (only first loop). */
float center[3];
if (x == 1) {
- add_v3_v3v3(center, gps->collision_min, gps->collision_max);
+ add_v3_v3v3(center, gps->boundbox_min, gps->boundbox_max);
mul_v3_fl(center, 0.5f);
sub_v3_v3v3(center, center, ob->obmat[3]);
}
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 409b758d570..1b5d893764f 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -229,10 +229,10 @@ typedef struct bGPDstroke {
/** Factor of opacity for Fill color (used by opacity modifier). */
float fill_opacity_fac;
- /** Min of the collision bound box used to speedup painting. */
- float collision_min[3];
- /** Max of the collision bound box used to speedup painting. */
- float collision_max[3];
+ /** Min of the bound box used to speedup painting operators. */
+ float boundbox_min[3];
+ /** Max of the bound box used to speedup painting operators. */
+ float boundbox_max[3];
/** UV rotation */
float uv_rotation;
More information about the Bf-blender-cvs
mailing list