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/blenkernel/intern
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/blenkernel/intern')
-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
6 files changed, 48 insertions, 47 deletions
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,