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:
authorHans Goudey <h.goudey@me.com>2022-04-28 17:10:37 +0300
committerHans Goudey <h.goudey@me.com>2022-04-28 17:10:50 +0300
commitb1b153b88c14b516183f7dd43b2c0111c0e7b041 (patch)
tree6c54c74326ae042c6682327a48c37eeb4179e768 /source/blender/blenkernel/intern/key.c
parent4412cbc6d1912cb40194c81b463f52587ca5d5eb (diff)
Cleanup: Improve const correctness of shape key functions
Diffstat (limited to 'source/blender/blenkernel/intern/key.c')
-rw-r--r--source/blender/blenkernel/intern/key.c74
1 files changed, 37 insertions, 37 deletions
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index 73b66edd4fb..18302c514e1 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -1759,7 +1759,7 @@ Key *BKE_key_from_id(ID *id)
return NULL;
}
-Key **BKE_key_from_object_p(const Object *ob)
+Key **BKE_key_from_object_p( Object *ob)
{
if (ob == NULL || ob->data == NULL) {
return NULL;
@@ -1768,7 +1768,7 @@ Key **BKE_key_from_object_p(const Object *ob)
return BKE_key_from_id_p(ob->data);
}
-Key *BKE_key_from_object(const Object *ob)
+Key *BKE_key_from_object( Object *ob)
{
Key **key_p;
key_p = BKE_key_from_object_p(ob);
@@ -1911,7 +1911,7 @@ void BKE_keyblock_copy_settings(KeyBlock *kb_dst, const KeyBlock *kb_src)
kb_dst->slidermax = kb_src->slidermax;
}
-char *BKE_keyblock_curval_rnapath_get(Key *key, KeyBlock *kb)
+char *BKE_keyblock_curval_rnapath_get(const Key *key, const KeyBlock *kb)
{
PointerRNA ptr;
PropertyRNA *prop;
@@ -1934,7 +1934,7 @@ char *BKE_keyblock_curval_rnapath_get(Key *key, KeyBlock *kb)
/************************* Lattice ************************/
-void BKE_keyblock_update_from_lattice(Lattice *lt, KeyBlock *kb)
+void BKE_keyblock_update_from_lattice(const Lattice *lt, KeyBlock *kb)
{
BPoint *bp;
float(*fp)[3];
@@ -1954,7 +1954,7 @@ void BKE_keyblock_update_from_lattice(Lattice *lt, KeyBlock *kb)
}
}
-void BKE_keyblock_convert_from_lattice(Lattice *lt, KeyBlock *kb)
+void BKE_keyblock_convert_from_lattice(const Lattice *lt, KeyBlock *kb)
{
int tot;
@@ -1971,7 +1971,7 @@ void BKE_keyblock_convert_from_lattice(Lattice *lt, KeyBlock *kb)
BKE_keyblock_update_from_lattice(lt, kb);
}
-void BKE_keyblock_convert_to_lattice(KeyBlock *kb, Lattice *lt)
+void BKE_keyblock_convert_to_lattice(const KeyBlock *kb, Lattice *lt)
{
BPoint *bp;
const float(*fp)[3];
@@ -2009,7 +2009,7 @@ int BKE_keyblock_curve_element_count(const ListBase *nurb)
return tot;
}
-void BKE_keyblock_update_from_curve(Curve *UNUSED(cu), KeyBlock *kb, ListBase *nurb)
+void BKE_keyblock_update_from_curve(const Curve *UNUSED(cu), KeyBlock *kb, const ListBase *nurb)
{
Nurb *nu;
BezTriple *bezt;
@@ -2079,7 +2079,7 @@ void BKE_keyblock_curve_data_transform(const ListBase *nurb,
}
}
-void BKE_keyblock_convert_from_curve(Curve *cu, KeyBlock *kb, ListBase *nurb)
+void BKE_keyblock_convert_from_curve(const Curve *cu, KeyBlock *kb, const ListBase *nurb)
{
int tot;
@@ -2135,7 +2135,7 @@ void BKE_keyblock_convert_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nu
/************************* Mesh ************************/
-void BKE_keyblock_update_from_mesh(Mesh *me, KeyBlock *kb)
+void BKE_keyblock_update_from_mesh(const Mesh *me, KeyBlock *kb)
{
MVert *mvert;
float(*fp)[3];
@@ -2155,7 +2155,7 @@ void BKE_keyblock_update_from_mesh(Mesh *me, KeyBlock *kb)
}
}
-void BKE_keyblock_convert_from_mesh(Mesh *me, Key *key, KeyBlock *kb)
+void BKE_keyblock_convert_from_mesh(const Mesh *me, const Key *key, KeyBlock *kb)
{
const int len = me->totvert;
@@ -2171,7 +2171,7 @@ void BKE_keyblock_convert_from_mesh(Mesh *me, Key *key, KeyBlock *kb)
BKE_keyblock_update_from_mesh(me, kb);
}
-void BKE_keyblock_convert_to_mesh(KeyBlock *kb, struct MVert *mvert, int totvert)
+void BKE_keyblock_convert_to_mesh(const KeyBlock *kb, MVert *mvert, const int totvert)
{
const float(*fp)[3];
int a, tot;
@@ -2185,8 +2185,8 @@ void BKE_keyblock_convert_to_mesh(KeyBlock *kb, struct MVert *mvert, int totvert
}
}
-void BKE_keyblock_mesh_calc_normals(struct KeyBlock *kb,
- struct Mesh *mesh,
+void BKE_keyblock_mesh_calc_normals(const KeyBlock *kb,
+ const Mesh *mesh,
float (*r_vertnors)[3],
float (*r_polynors)[3],
float (*r_loopnors)[3])
@@ -2266,7 +2266,7 @@ void BKE_keyblock_mesh_calc_normals(struct KeyBlock *kb,
/************************* raw coords ************************/
-void BKE_keyblock_update_from_vertcos(Object *ob, KeyBlock *kb, const float (*vertCos)[3])
+void BKE_keyblock_update_from_vertcos(const Object *ob, KeyBlock *kb, const float (*vertCos)[3])
{
const float(*co)[3] = vertCos;
float *fp = kb->data;
@@ -2302,10 +2302,10 @@ void BKE_keyblock_update_from_vertcos(Object *ob, KeyBlock *kb, const float (*ve
}
}
else if (ELEM(ob->type, OB_CURVES_LEGACY, OB_SURF)) {
- Curve *cu = (Curve *)ob->data;
- Nurb *nu;
- BezTriple *bezt;
- BPoint *bp;
+ const Curve *cu = (const Curve *)ob->data;
+ const Nurb *nu;
+ const BezTriple *bezt;
+ const BPoint *bp;
for (nu = cu->nurb.first; nu; nu = nu->next) {
if (nu->bezt) {
@@ -2326,7 +2326,7 @@ void BKE_keyblock_update_from_vertcos(Object *ob, KeyBlock *kb, const float (*ve
}
}
-void BKE_keyblock_convert_from_vertcos(Object *ob, KeyBlock *kb, const float (*vertCos)[3])
+void BKE_keyblock_convert_from_vertcos(const Object *ob, KeyBlock *kb, const float (*vertCos)[3])
{
int tot = 0, elemsize;
@@ -2334,17 +2334,17 @@ void BKE_keyblock_convert_from_vertcos(Object *ob, KeyBlock *kb, const float (*v
/* Count of vertex coords in array */
if (ob->type == OB_MESH) {
- Mesh *me = (Mesh *)ob->data;
+ const Mesh *me = (const Mesh *)ob->data;
tot = me->totvert;
elemsize = me->key->elemsize;
}
else if (ob->type == OB_LATTICE) {
- Lattice *lt = (Lattice *)ob->data;
+ const Lattice *lt = (const Lattice *)ob->data;
tot = lt->pntsu * lt->pntsv * lt->pntsw;
elemsize = lt->key->elemsize;
}
else if (ELEM(ob->type, OB_CURVES_LEGACY, OB_SURF)) {
- Curve *cu = (Curve *)ob->data;
+ const Curve *cu = (const Curve *)ob->data;
elemsize = cu->key->elemsize;
tot = BKE_keyblock_curve_element_count(&cu->nurb);
}
@@ -2359,7 +2359,7 @@ void BKE_keyblock_convert_from_vertcos(Object *ob, KeyBlock *kb, const float (*v
BKE_keyblock_update_from_vertcos(ob, kb, vertCos);
}
-float (*BKE_keyblock_convert_to_vertcos(Object *ob, KeyBlock *kb))[3]
+float (*BKE_keyblock_convert_to_vertcos(const Object *ob, const KeyBlock *kb))[3]
{
float(*vertCos)[3], (*co)[3];
const float *fp = kb->data;
@@ -2367,15 +2367,15 @@ float (*BKE_keyblock_convert_to_vertcos(Object *ob, KeyBlock *kb))[3]
/* Count of vertex coords in array */
if (ob->type == OB_MESH) {
- Mesh *me = (Mesh *)ob->data;
+ const Mesh *me = (const Mesh *)ob->data;
tot = me->totvert;
}
else if (ob->type == OB_LATTICE) {
- Lattice *lt = (Lattice *)ob->data;
+ const Lattice *lt = (const Lattice *)ob->data;
tot = lt->pntsu * lt->pntsv * lt->pntsw;
}
else if (ELEM(ob->type, OB_CURVES_LEGACY, OB_SURF)) {
- Curve *cu = (Curve *)ob->data;
+ const Curve *cu = (const Curve *)ob->data;
tot = BKE_nurbList_verts_count(&cu->nurb);
}
@@ -2392,10 +2392,10 @@ float (*BKE_keyblock_convert_to_vertcos(Object *ob, KeyBlock *kb))[3]
}
}
else if (ELEM(ob->type, OB_CURVES_LEGACY, OB_SURF)) {
- Curve *cu = (Curve *)ob->data;
- Nurb *nu;
- BezTriple *bezt;
- BPoint *bp;
+ const Curve *cu = (const Curve *)ob->data;
+ const Nurb *nu;
+ const BezTriple *bezt;
+ const BPoint *bp;
for (nu = cu->nurb.first; nu; nu = nu->next) {
if (nu->bezt) {
@@ -2420,7 +2420,7 @@ float (*BKE_keyblock_convert_to_vertcos(Object *ob, KeyBlock *kb))[3]
/************************* raw coord offsets ************************/
-void BKE_keyblock_update_from_offset(Object *ob, KeyBlock *kb, const float (*ofs)[3])
+void BKE_keyblock_update_from_offset(const Object *ob, KeyBlock *kb, const float (*ofs)[3])
{
int a;
float *fp = kb->data;
@@ -2431,10 +2431,10 @@ void BKE_keyblock_update_from_offset(Object *ob, KeyBlock *kb, const float (*ofs
}
}
else if (ELEM(ob->type, OB_CURVES_LEGACY, OB_SURF)) {
- Curve *cu = (Curve *)ob->data;
- Nurb *nu;
- BezTriple *bezt;
- BPoint *bp;
+ const Curve *cu = (const Curve *)ob->data;
+ const Nurb *nu;
+ const BezTriple *bezt;
+ const BPoint *bp;
for (nu = cu->nurb.first; nu; nu = nu->next) {
if (nu->bezt) {
@@ -2535,9 +2535,9 @@ bool BKE_keyblock_move(Object *ob, int org_index, int new_index)
return true;
}
-bool BKE_keyblock_is_basis(Key *key, const int index)
+bool BKE_keyblock_is_basis(const Key *key, const int index)
{
- KeyBlock *kb;
+ const KeyBlock *kb;
int i;
if (key->type == KEY_RELATIVE) {