Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-06-13 09:08:34 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-06-13 09:20:09 +0300
commit827959ff98e77739e5753789ad645d4b53cca3c9 (patch)
tree25a35ae07419bcd5b4eb53c17a6b7832c364aca7 /source/blender
parentdd4071b379f0b4024e7dc6ee987d5104ddf35fed (diff)
Cleanup: use const arguments to deform functions
This changes curve deform code not to set the objects inverse matrix, this shouldn't cause problems as it's not used elsewhere afterwards.
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/blenkernel/BKE_anim_path.h2
-rw-r--r--source/blender/blenkernel/BKE_armature.h12
-rw-r--r--source/blender/blenkernel/BKE_curve.h12
-rw-r--r--source/blender/blenkernel/BKE_deform.h12
-rw-r--r--source/blender/blenkernel/BKE_lattice.h18
-rw-r--r--source/blender/blenkernel/intern/anim_path.c12
-rw-r--r--source/blender/blenkernel/intern/armature_deform.c20
-rw-r--r--source/blender/blenkernel/intern/curve_deform.c27
-rw-r--r--source/blender/blenkernel/intern/deform.c10
-rw-r--r--source/blender/blenkernel/intern/lattice.c2
-rw-r--r--source/blender/blenkernel/intern/lattice_deform.c24
11 files changed, 77 insertions, 74 deletions
diff --git a/source/blender/blenkernel/BKE_anim_path.h b/source/blender/blenkernel/BKE_anim_path.h
index b56e4a4a262..4de853303ad 100644
--- a/source/blender/blenkernel/BKE_anim_path.h
+++ b/source/blender/blenkernel/BKE_anim_path.h
@@ -36,7 +36,7 @@ struct Path;
void free_path(struct Path *path);
void calc_curvepath(struct Object *ob, struct ListBase *nurbs);
-bool where_on_path(struct Object *ob,
+bool where_on_path(const struct Object *ob,
float ctime,
float r_vec[4],
float r_dir[3],
diff --git a/source/blender/blenkernel/BKE_armature.h b/source/blender/blenkernel/BKE_armature.h
index 7572c3cb452..6fb6675a05a 100644
--- a/source/blender/blenkernel/BKE_armature.h
+++ b/source/blender/blenkernel/BKE_armature.h
@@ -352,8 +352,8 @@ void BKE_pose_eval_proxy_copy_bone(struct Depsgraph *depsgraph,
/* Note that we could have a 'BKE_armature_deform_coords' that doesn't take object data
* currently there are no callers for this though. */
-void BKE_armature_deform_coords_with_gpencil_stroke(struct Object *ob_arm,
- struct Object *ob_target,
+void BKE_armature_deform_coords_with_gpencil_stroke(const struct Object *ob_arm,
+ const struct Object *ob_target,
float (*vert_coords)[3],
float (*vert_deform_mats)[3][3],
int vert_coords_len,
@@ -362,8 +362,8 @@ void BKE_armature_deform_coords_with_gpencil_stroke(struct Object *ob_arm,
const char *defgrp_name,
struct bGPDstroke *gps_target);
-void BKE_armature_deform_coords_with_mesh(struct Object *ob_arm,
- struct Object *ob_target,
+void BKE_armature_deform_coords_with_mesh(const struct Object *ob_arm,
+ const struct Object *ob_target,
float (*vert_coords)[3],
float (*vert_deform_mats)[3][3],
int vert_coords_len,
@@ -372,8 +372,8 @@ void BKE_armature_deform_coords_with_mesh(struct Object *ob_arm,
const char *defgrp_name,
const struct Mesh *me_target);
-void BKE_armature_deform_coords_with_editmesh(struct Object *ob_arm,
- struct Object *ob_target,
+void BKE_armature_deform_coords_with_editmesh(const struct Object *ob_arm,
+ const struct Object *ob_target,
float (*vert_coords)[3],
float (*vert_deform_mats)[3][3],
int vert_coords_len,
diff --git a/source/blender/blenkernel/BKE_curve.h b/source/blender/blenkernel/BKE_curve.h
index 5ea77058520..d32ab474229 100644
--- a/source/blender/blenkernel/BKE_curve.h
+++ b/source/blender/blenkernel/BKE_curve.h
@@ -309,8 +309,8 @@ void BKE_curve_decimate_nurb(struct Nurb *nu,
/** \name Deform 3D Coordinates by Curve (curve_deform.c)
* \{ */
-void BKE_curve_deform_coords(struct Object *ob_curve,
- struct Object *ob_target,
+void BKE_curve_deform_coords(const struct Object *ob_curve,
+ const struct Object *ob_target,
float (*vert_coords)[3],
const int vert_coords_len,
const struct MDeformVert *dvert,
@@ -318,8 +318,8 @@ void BKE_curve_deform_coords(struct Object *ob_curve,
const short flag,
const short defaxis);
-void BKE_curve_deform_coords_with_editmesh(Object *ob_curve,
- Object *ob_target,
+void BKE_curve_deform_coords_with_editmesh(const Object *ob_curve,
+ const Object *ob_target,
float (*vert_coords)[3],
const int vert_coords_len,
const int defgrp_index,
@@ -327,8 +327,8 @@ void BKE_curve_deform_coords_with_editmesh(Object *ob_curve,
const short defaxis,
struct BMEditMesh *em_target);
-void BKE_curve_deform_co(struct Object *ob_curve,
- struct Object *ob_target,
+void BKE_curve_deform_co(const struct Object *ob_curve,
+ const struct Object *ob_target,
const float orco[3],
float vec[3],
const int no_rot_axis,
diff --git a/source/blender/blenkernel/BKE_deform.h b/source/blender/blenkernel/BKE_deform.h
index c86b877b575..04b85aebb39 100644
--- a/source/blender/blenkernel/BKE_deform.h
+++ b/source/blender/blenkernel/BKE_deform.h
@@ -40,14 +40,16 @@ struct bDeformGroup;
struct bDeformGroup *BKE_object_defgroup_new(struct Object *ob, const char *name);
void BKE_defgroup_copy_list(struct ListBase *lb1, const struct ListBase *lb2);
struct bDeformGroup *BKE_defgroup_duplicate(const struct bDeformGroup *ingroup);
-struct bDeformGroup *BKE_object_defgroup_find_name(struct Object *ob, const char *name);
-int *BKE_object_defgroup_flip_map(struct Object *ob, int *flip_map_len, const bool use_default);
-int *BKE_object_defgroup_flip_map_single(struct Object *ob,
+struct bDeformGroup *BKE_object_defgroup_find_name(const struct Object *ob, const char *name);
+int *BKE_object_defgroup_flip_map(const struct Object *ob,
+ int *flip_map_len,
+ const bool use_default);
+int *BKE_object_defgroup_flip_map_single(const struct Object *ob,
int *flip_map_len,
const bool use_default,
int defgroup);
-int BKE_object_defgroup_flip_index(struct Object *ob, int index, const bool use_default);
-int BKE_object_defgroup_name_index(struct Object *ob, const char *name);
+int BKE_object_defgroup_flip_index(const struct Object *ob, int index, const bool use_default);
+int BKE_object_defgroup_name_index(const struct Object *ob, const char *name);
void BKE_object_defgroup_unique_name(struct bDeformGroup *dg, struct Object *ob);
struct MDeformWeight *BKE_defvert_find_index(const struct MDeformVert *dv, const int defgroup);
diff --git a/source/blender/blenkernel/BKE_lattice.h b/source/blender/blenkernel/BKE_lattice.h
index a1e335447fe..bb23ad63020 100644
--- a/source/blender/blenkernel/BKE_lattice.h
+++ b/source/blender/blenkernel/BKE_lattice.h
@@ -59,7 +59,7 @@ void BKE_lattice_modifiers_calc(struct Depsgraph *depsgraph,
struct Scene *scene,
struct Object *ob);
-struct MDeformVert *BKE_lattice_deform_verts_get(struct Object *lattice);
+struct MDeformVert *BKE_lattice_deform_verts_get(const struct Object *lattice);
struct BPoint *BKE_lattice_active_point_get(struct Lattice *lt);
struct BoundBox *BKE_lattice_boundbox_get(struct Object *ob);
@@ -103,23 +103,23 @@ extern void (*BKE_lattice_batch_cache_free_cb)(struct Lattice *lt);
/** \name Deform 3D Coordinates by Lattice (lattice_deform.c)
* \{ */
-struct LatticeDeformData *BKE_lattice_deform_data_create(struct Object *oblatt, struct Object *ob)
- ATTR_WARN_UNUSED_RESULT;
+struct LatticeDeformData *BKE_lattice_deform_data_create(
+ const struct Object *oblatt, const struct Object *ob) ATTR_WARN_UNUSED_RESULT;
void BKE_lattice_deform_data_eval_co(struct LatticeDeformData *lattice_deform_data,
float co[3],
float weight);
void BKE_lattice_deform_data_destroy(struct LatticeDeformData *lattice_deform_data);
-void BKE_lattice_deform_coords(struct Object *ob_lattice,
- struct Object *ob_target,
+void BKE_lattice_deform_coords(const struct Object *ob_lattice,
+ const struct Object *ob_target,
float (*vert_coords)[3],
const int vert_coords_len,
const short flag,
const char *defgrp_name,
float influence);
-void BKE_lattice_deform_coords_with_mesh(struct Object *ob_lattice,
- struct Object *ob_target,
+void BKE_lattice_deform_coords_with_mesh(const struct Object *ob_lattice,
+ const struct Object *ob_target,
float (*vert_coords)[3],
const int vert_coords_len,
const short flag,
@@ -127,8 +127,8 @@ void BKE_lattice_deform_coords_with_mesh(struct Object *ob_lattice,
const float influence,
const struct Mesh *me_target);
-void BKE_lattice_deform_coords_with_editmesh(struct Object *ob_lattice,
- struct Object *ob_target,
+void BKE_lattice_deform_coords_with_editmesh(const struct Object *ob_lattice,
+ const struct Object *ob_target,
float (*vert_coords)[3],
const int vert_coords_len,
const short flag,
diff --git a/source/blender/blenkernel/intern/anim_path.c b/source/blender/blenkernel/intern/anim_path.c
index 56ff7d07809..628e54971ce 100644
--- a/source/blender/blenkernel/intern/anim_path.c
+++ b/source/blender/blenkernel/intern/anim_path.c
@@ -203,7 +203,7 @@ static int interval_test(const int min, const int max, int p1, const int cycl)
*
* \return success.
*/
-bool where_on_path(Object *ob,
+bool where_on_path(const Object *ob,
float ctime,
float r_vec[4],
float r_dir[3],
@@ -212,14 +212,14 @@ bool where_on_path(Object *ob,
float *r_weight)
{
Curve *cu;
- Nurb *nu;
- BevList *bl;
- Path *path;
- PathPoint *pp, *p0, *p1, *p2, *p3;
+ const Nurb *nu;
+ const BevList *bl;
+ const Path *path;
+ const PathPoint *pp, *p0, *p1, *p2, *p3;
float fac;
float data[4];
int cycl = 0, s0, s1, s2, s3;
- ListBase *nurbs;
+ const ListBase *nurbs;
if (ob == NULL || ob->type != OB_CURVE) {
return false;
diff --git a/source/blender/blenkernel/intern/armature_deform.c b/source/blender/blenkernel/intern/armature_deform.c
index e180070f518..e757e30e524 100644
--- a/source/blender/blenkernel/intern/armature_deform.c
+++ b/source/blender/blenkernel/intern/armature_deform.c
@@ -240,8 +240,8 @@ static void pchan_bone_deform(bPoseChannel *pchan,
* \{ */
typedef struct ArmatureUserdata {
- Object *ob_arm;
- Object *ob_target;
+ const Object *ob_arm;
+ const Object *ob_target;
const Mesh *me_target;
float (*vert_coords)[3];
float (*vert_deform_mats)[3][3];
@@ -462,8 +462,8 @@ static void armature_vert_task_editmesh_no_dvert(void *__restrict userdata, Memp
armature_vert_task_with_dvert(data, BM_elem_index_get(v), NULL);
}
-static void armature_deform_coords_impl(Object *ob_arm,
- Object *ob_target,
+static void armature_deform_coords_impl(const Object *ob_arm,
+ const Object *ob_target,
float (*vert_coords)[3],
float (*vert_deform_mats)[3][3],
const int vert_coords_len,
@@ -616,8 +616,8 @@ static void armature_deform_coords_impl(Object *ob_arm,
}
}
-void BKE_armature_deform_coords_with_gpencil_stroke(Object *ob_arm,
- Object *ob_target,
+void BKE_armature_deform_coords_with_gpencil_stroke(const Object *ob_arm,
+ const Object *ob_target,
float (*vert_coords)[3],
float (*vert_deform_mats)[3][3],
int vert_coords_len,
@@ -639,8 +639,8 @@ void BKE_armature_deform_coords_with_gpencil_stroke(Object *ob_arm,
gps_target);
}
-void BKE_armature_deform_coords_with_mesh(Object *ob_arm,
- Object *ob_target,
+void BKE_armature_deform_coords_with_mesh(const Object *ob_arm,
+ const Object *ob_target,
float (*vert_coords)[3],
float (*vert_deform_mats)[3][3],
int vert_coords_len,
@@ -662,8 +662,8 @@ void BKE_armature_deform_coords_with_mesh(Object *ob_arm,
NULL);
}
-void BKE_armature_deform_coords_with_editmesh(Object *ob_arm,
- Object *ob_target,
+void BKE_armature_deform_coords_with_editmesh(const Object *ob_arm,
+ const Object *ob_target,
float (*vert_coords)[3],
float (*vert_deform_mats)[3][3],
int vert_coords_len,
diff --git a/source/blender/blenkernel/intern/curve_deform.c b/source/blender/blenkernel/intern/curve_deform.c
index 2c3b99308d0..d4f197521a1 100644
--- a/source/blender/blenkernel/intern/curve_deform.c
+++ b/source/blender/blenkernel/intern/curve_deform.c
@@ -57,10 +57,11 @@ typedef struct {
int no_rot_axis;
} CurveDeform;
-static void init_curve_deform(Object *ob_curve, Object *ob_target, CurveDeform *cd)
+static void init_curve_deform(const Object *ob_curve, const Object *ob_target, CurveDeform *cd)
{
- invert_m4_m4(ob_target->imat, ob_target->obmat);
- mul_m4_m4m4(cd->objectspace, ob_target->imat, ob_curve->obmat);
+ float imat[4][4];
+ invert_m4_m4(imat, ob_target->obmat);
+ mul_m4_m4m4(cd->objectspace, imat, ob_curve->obmat);
invert_m4_m4(cd->curvespace, cd->objectspace);
copy_m3_m4(cd->objectspace3, cd->objectspace);
cd->no_rot_axis = 0;
@@ -71,7 +72,7 @@ static void init_curve_deform(Object *ob_curve, Object *ob_target, CurveDeform *
*
* \return Success.
*/
-static bool where_on_path_deform(Object *ob_curve,
+static bool where_on_path_deform(const Object *ob_curve,
float ctime,
float r_vec[4],
float r_dir[3],
@@ -142,7 +143,7 @@ static bool where_on_path_deform(Object *ob_curve,
* using #CurveDeform.no_rot_axis axis is using another define.
*/
static bool calc_curve_deform(
- Object *ob_curve, float co[3], const short axis, CurveDeform *cd, float r_quat[4])
+ const Object *ob_curve, float co[3], const short axis, const CurveDeform *cd, float r_quat[4])
{
Curve *cu = ob_curve->data;
float fac, loc[4], dir[3], new_quat[4], radius;
@@ -257,8 +258,8 @@ static bool calc_curve_deform(
* #BKE_curve_deform and related functions.
* \{ */
-static void curve_deform_coords_impl(Object *ob_curve,
- Object *ob_target,
+static void curve_deform_coords_impl(const Object *ob_curve,
+ const Object *ob_target,
float (*vert_coords)[3],
const int vert_coords_len,
const MDeformVert *dvert,
@@ -425,8 +426,8 @@ static void curve_deform_coords_impl(Object *ob_curve,
}
}
-void BKE_curve_deform_coords(Object *ob_curve,
- Object *ob_target,
+void BKE_curve_deform_coords(const Object *ob_curve,
+ const Object *ob_target,
float (*vert_coords)[3],
const int vert_coords_len,
const MDeformVert *dvert,
@@ -438,8 +439,8 @@ void BKE_curve_deform_coords(Object *ob_curve,
ob_curve, ob_target, vert_coords, vert_coords_len, dvert, defgrp_index, flag, defaxis, NULL);
}
-void BKE_curve_deform_coords_with_editmesh(Object *ob_curve,
- Object *ob_target,
+void BKE_curve_deform_coords_with_editmesh(const Object *ob_curve,
+ const Object *ob_target,
float (*vert_coords)[3],
const int vert_coords_len,
const int defgrp_index,
@@ -464,8 +465,8 @@ void BKE_curve_deform_coords_with_editmesh(Object *ob_curve,
*
* The result written in vec and r_mat.
*/
-void BKE_curve_deform_co(Object *ob_curve,
- Object *ob_target,
+void BKE_curve_deform_co(const Object *ob_curve,
+ const Object *ob_target,
const float orco[3],
float vec[3],
const int no_rot_axis,
diff --git a/source/blender/blenkernel/intern/deform.c b/source/blender/blenkernel/intern/deform.c
index 9a3965a86f6..b97935d57f2 100644
--- a/source/blender/blenkernel/intern/deform.c
+++ b/source/blender/blenkernel/intern/deform.c
@@ -486,14 +486,14 @@ void BKE_defvert_flip_merged(MDeformVert *dvert, const int *flip_map, const int
}
}
-bDeformGroup *BKE_object_defgroup_find_name(Object *ob, const char *name)
+bDeformGroup *BKE_object_defgroup_find_name(const Object *ob, const char *name)
{
return (name && name[0] != '\0') ?
BLI_findstring(&ob->defbase, name, offsetof(bDeformGroup, name)) :
NULL;
}
-int BKE_object_defgroup_name_index(Object *ob, const char *name)
+int BKE_object_defgroup_name_index(const Object *ob, const char *name)
{
return (name && name[0] != '\0') ?
BLI_findstringindex(&ob->defbase, name, offsetof(bDeformGroup, name)) :
@@ -503,7 +503,7 @@ int BKE_object_defgroup_name_index(Object *ob, const char *name)
/**
* \note caller must free.
*/
-int *BKE_object_defgroup_flip_map(Object *ob, int *flip_map_len, const bool use_default)
+int *BKE_object_defgroup_flip_map(const Object *ob, int *flip_map_len, const bool use_default)
{
int defbase_tot = *flip_map_len = BLI_listbase_count(&ob->defbase);
@@ -545,7 +545,7 @@ int *BKE_object_defgroup_flip_map(Object *ob, int *flip_map_len, const bool use_
/**
* \note caller must free.
*/
-int *BKE_object_defgroup_flip_map_single(Object *ob,
+int *BKE_object_defgroup_flip_map_single(const Object *ob,
int *flip_map_len,
const bool use_default,
int defgroup)
@@ -580,7 +580,7 @@ int *BKE_object_defgroup_flip_map_single(Object *ob,
}
}
-int BKE_object_defgroup_flip_index(Object *ob, int index, const bool use_default)
+int BKE_object_defgroup_flip_index(const Object *ob, int index, const bool use_default)
{
bDeformGroup *dg = BLI_findlink(&ob->defbase, index);
int flip_index = -1;
diff --git a/source/blender/blenkernel/intern/lattice.c b/source/blender/blenkernel/intern/lattice.c
index c3b2fd9e35d..8820434cbcf 100644
--- a/source/blender/blenkernel/intern/lattice.c
+++ b/source/blender/blenkernel/intern/lattice.c
@@ -552,7 +552,7 @@ void BKE_lattice_modifiers_calc(struct Depsgraph *depsgraph, Scene *scene, Objec
}
}
-struct MDeformVert *BKE_lattice_deform_verts_get(struct Object *oblatt)
+struct MDeformVert *BKE_lattice_deform_verts_get(const struct Object *oblatt)
{
Lattice *lt = (Lattice *)oblatt->data;
BLI_assert(oblatt->type == OB_LATTICE);
diff --git a/source/blender/blenkernel/intern/lattice_deform.c b/source/blender/blenkernel/intern/lattice_deform.c
index 4b2f97d8df6..2b3349d4d9a 100644
--- a/source/blender/blenkernel/intern/lattice_deform.c
+++ b/source/blender/blenkernel/intern/lattice_deform.c
@@ -54,12 +54,12 @@
* \{ */
typedef struct LatticeDeformData {
- Object *object;
+ const Object *object;
float *latticedata;
float latmat[4][4];
} LatticeDeformData;
-LatticeDeformData *BKE_lattice_deform_data_create(Object *oblatt, Object *ob)
+LatticeDeformData *BKE_lattice_deform_data_create(const Object *oblatt, const Object *ob)
{
/* we make an array with all differences */
Lattice *lt = oblatt->data;
@@ -131,7 +131,7 @@ void BKE_lattice_deform_data_eval_co(LatticeDeformData *lattice_deform_data,
float co[3],
float weight)
{
- Object *ob = lattice_deform_data->object;
+ const Object *ob = lattice_deform_data->object;
Lattice *lt = ob->data;
float u, v, w, tu[4], tv[4], tw[4];
float vec[3];
@@ -141,7 +141,7 @@ void BKE_lattice_deform_data_eval_co(LatticeDeformData *lattice_deform_data,
/* vgroup influence */
int defgrp_index = -1;
float co_prev[3], weight_blend = 0.0f;
- MDeformVert *dvert = BKE_lattice_deform_verts_get(ob);
+ const MDeformVert *dvert = BKE_lattice_deform_verts_get(ob);
float *__restrict latticedata = lattice_deform_data->latticedata;
if (lt->editlatt) {
@@ -335,8 +335,8 @@ static void lattice_vert_task_editmesh_no_dvert(void *__restrict userdata, Mempo
lattice_deform_vert_with_dvert(data, BM_elem_index_get(v), NULL);
}
-static void lattice_deform_coords_impl(Object *ob_lattice,
- Object *ob_target,
+static void lattice_deform_coords_impl(const Object *ob_lattice,
+ const Object *ob_target,
float (*vert_coords)[3],
const int vert_coords_len,
const short flag,
@@ -415,8 +415,8 @@ static void lattice_deform_coords_impl(Object *ob_lattice,
BKE_lattice_deform_data_destroy(lattice_deform_data);
}
-void BKE_lattice_deform_coords(Object *ob_lattice,
- Object *ob_target,
+void BKE_lattice_deform_coords(const Object *ob_lattice,
+ const Object *ob_target,
float (*vert_coords)[3],
int vert_coords_len,
short flag,
@@ -427,8 +427,8 @@ void BKE_lattice_deform_coords(Object *ob_lattice,
ob_lattice, ob_target, vert_coords, vert_coords_len, flag, defgrp_name, fac, NULL, NULL);
}
-void BKE_lattice_deform_coords_with_mesh(Object *ob_lattice,
- Object *ob_target,
+void BKE_lattice_deform_coords_with_mesh(const Object *ob_lattice,
+ const Object *ob_target,
float (*vert_coords)[3],
const int vert_coords_len,
const short flag,
@@ -447,8 +447,8 @@ void BKE_lattice_deform_coords_with_mesh(Object *ob_lattice,
NULL);
}
-void BKE_lattice_deform_coords_with_editmesh(struct Object *ob_lattice,
- struct Object *ob_target,
+void BKE_lattice_deform_coords_with_editmesh(const struct Object *ob_lattice,
+ const struct Object *ob_target,
float (*vert_coords)[3],
const int vert_coords_len,
const short flag,