Cleanup: Further use of const for object bounding boxes

Also solves two warnings from the previous similar commit,
f688e3cc31. The change to the grease pencil
modifier is quite suspicious, but doesn't change the behavior,
which was already broken.
This commit is contained in:
Hans Goudey 2022-04-01 18:30:09 -05:00
parent 69c07adb51
commit 5387d33e5f
10 changed files with 15 additions and 15 deletions

View File

@ -246,8 +246,8 @@ void RB_shape_trimesh_update(rbCollisionShape *shape,
float *vertices,
int num_verts,
int vert_stride,
float min[3],
float max[3]);
const float min[3],
const float max[3]);
/* ********************************** */
/* Constraints */

View File

@ -802,8 +802,8 @@ void RB_shape_trimesh_update(rbCollisionShape *shape,
float *vertices,
int num_verts,
int vert_stride,
float min[3],
float max[3])
const float min[3],
const float max[3])
{
if (shape->mesh == NULL || num_verts != shape->mesh->num_vertices) {
return;

View File

@ -337,7 +337,7 @@ void BKE_boundbox_minmax(const struct BoundBox *bb,
float r_min[3],
float r_max[3]);
struct BoundBox *BKE_object_boundbox_get(struct Object *ob);
const struct BoundBox *BKE_object_boundbox_get(struct Object *ob);
void BKE_object_dimensions_get(struct Object *ob, float r_vec[3]);
/**
* The original scale and object matrix can be passed in so any difference

View File

@ -3587,7 +3587,7 @@ void BKE_boundbox_minmax(const BoundBox *bb,
}
}
BoundBox *BKE_object_boundbox_get(Object *ob)
const BoundBox *BKE_object_boundbox_get(Object *ob)
{
BoundBox *bb = nullptr;

View File

@ -243,7 +243,7 @@ void BKE_object_handle_data_update(Depsgraph *depsgraph, Scene *scene, Object *o
/** Bounding box from evaluated geometry. */
static void object_sync_boundbox_to_original(Object *object_orig, Object *object_eval)
{
BoundBox *bb = object_eval->runtime.bb;
const BoundBox *bb = object_eval->runtime.bb;
if (!bb || (bb->flag & BOUNDBOX_DIRTY)) {
BKE_object_boundbox_calc_from_evaluated_geometry(object_eval);
}

View File

@ -614,7 +614,7 @@ static void drw_call_obinfos_init(DRWObjectInfos *ob_infos, Object *ob)
drw_call_calc_orco(ob, ob_infos->orcotexfac);
/* Random float value. */
uint random = (DST.dupli_source) ?
DST.dupli_source->random_id :
DST.dupli_source->random_id :
/* TODO(fclem): this is rather costly to do at runtime. Maybe we can
* put it in ob->runtime and make depsgraph ensure it is up to date. */
BLI_hash_int_2d(BLI_hash_string(ob->id.name + 2), 0);
@ -638,7 +638,7 @@ static void drw_call_obinfos_init(DRWObjectInfos *ob_infos, Object *ob)
static void drw_call_culling_init(DRWCullingState *cull, Object *ob)
{
BoundBox *bbox;
const BoundBox *bbox;
if (ob != NULL && (bbox = BKE_object_boundbox_get(ob))) {
float corner[3];
/* Get BoundSphere center and radius from the BoundBox. */

View File

@ -459,7 +459,7 @@ static int voxel_size_edit_invoke(bContext *C, wmOperator *op, const wmEvent *ev
op->customdata = cd;
/* Select the front facing face of the mesh bounding box. */
BoundBox *bb = BKE_mesh_boundbox_get(cd->active_object);
const BoundBox *bb = BKE_mesh_boundbox_get(cd->active_object);
/* Indices of the Bounding Box faces. */
const int BB_faces[6][4] = {

View File

@ -1039,7 +1039,7 @@ static void cursor_draw_tiling_preview(const uint gpuattr,
Object *ob,
const float radius)
{
BoundBox *bb = BKE_object_boundbox_get(ob);
const BoundBox *bb = BKE_object_boundbox_get(ob);
float orgLoc[3], location[3];
int tile_pass = 0;
int start[3];

View File

@ -2349,7 +2349,7 @@ static short snapMesh(SnapObjectContext *sctx,
float dist_px_sq = square_f(*dist_px);
/* Test BoundBox */
BoundBox *bb = BKE_object_boundbox_get(ob_eval);
const BoundBox *bb = BKE_object_boundbox_get(ob_eval);
if (bb &&
!snap_bound_box_check_dist(
bb->vec[0], bb->vec[6], lpmat, sctx->runtime.win_size, sctx->runtime.mval, dist_px_sq)) {

View File

@ -132,10 +132,10 @@ static void generate_geometry(GpencilModifierData *md,
/* Get bounbox for relative offset. */
float size[3] = {0.0f, 0.0f, 0.0f};
if (mmd->flag & GP_ARRAY_USE_RELATIVE) {
const BoundBox *bb = BKE_object_boundbox_get(ob);
BoundBox bb;
const float min[3] = {-1.0f, -1.0f, -1.0f}, max[3] = {1.0f, 1.0f, 1.0f};
BKE_boundbox_init_from_minmax(bb, min, max);
BKE_boundbox_calc_size_aabb(bb, size);
BKE_boundbox_init_from_minmax(&bb, min, max);
BKE_boundbox_calc_size_aabb(&bb, size);
mul_v3_fl(size, 2.0f);
/* Need a minimum size (for flat drawings). */
CLAMP3_MIN(size, 0.01f);