Cleanup: Improve const correctness of shape key functions
This commit is contained in:
parent
4412cbc6d1
commit
b1b153b88c
|
@ -66,8 +66,8 @@ bool BKE_key_idtype_support(short id_type);
|
|||
|
||||
struct Key **BKE_key_from_id_p(struct ID *id);
|
||||
struct Key *BKE_key_from_id(struct ID *id);
|
||||
struct Key **BKE_key_from_object_p(const struct Object *ob);
|
||||
struct Key *BKE_key_from_object(const struct Object *ob);
|
||||
struct Key **BKE_key_from_object_p(struct Object *ob);
|
||||
struct Key *BKE_key_from_object(struct Object *ob);
|
||||
/**
|
||||
* Only the active key-block.
|
||||
*/
|
||||
|
@ -100,27 +100,33 @@ void BKE_keyblock_copy_settings(struct KeyBlock *kb_dst, const struct KeyBlock *
|
|||
* Get RNA-Path for 'value' setting of the given shape-key.
|
||||
* \note the user needs to free the returned string once they're finished with it.
|
||||
*/
|
||||
char *BKE_keyblock_curval_rnapath_get(struct Key *key, struct KeyBlock *kb);
|
||||
char *BKE_keyblock_curval_rnapath_get(const struct Key *key, const struct KeyBlock *kb);
|
||||
|
||||
/* conversion functions */
|
||||
/* NOTE: 'update_from' versions do not (re)allocate mem in kb, while 'convert_from' do. */
|
||||
|
||||
void BKE_keyblock_update_from_lattice(struct Lattice *lt, struct KeyBlock *kb);
|
||||
void BKE_keyblock_convert_from_lattice(struct Lattice *lt, struct KeyBlock *kb);
|
||||
void BKE_keyblock_convert_to_lattice(struct KeyBlock *kb, struct Lattice *lt);
|
||||
void BKE_keyblock_update_from_lattice(const struct Lattice *lt, struct KeyBlock *kb);
|
||||
void BKE_keyblock_convert_from_lattice(const struct Lattice *lt, struct KeyBlock *kb);
|
||||
void BKE_keyblock_convert_to_lattice(const struct KeyBlock *kb, struct Lattice *lt);
|
||||
|
||||
int BKE_keyblock_curve_element_count(const struct ListBase *nurb);
|
||||
void BKE_keyblock_curve_data_transform(const struct ListBase *nurb,
|
||||
const float mat[4][4],
|
||||
const void *src,
|
||||
void *dst);
|
||||
void BKE_keyblock_update_from_curve(struct Curve *cu, struct KeyBlock *kb, struct ListBase *nurb);
|
||||
void BKE_keyblock_convert_from_curve(struct Curve *cu, struct KeyBlock *kb, struct ListBase *nurb);
|
||||
void BKE_keyblock_update_from_curve(const struct Curve *cu,
|
||||
struct KeyBlock *kb,
|
||||
const struct ListBase *nurb);
|
||||
void BKE_keyblock_convert_from_curve(const struct Curve *cu,
|
||||
struct KeyBlock *kb,
|
||||
const struct ListBase *nurb);
|
||||
void BKE_keyblock_convert_to_curve(struct KeyBlock *kb, struct Curve *cu, struct ListBase *nurb);
|
||||
|
||||
void BKE_keyblock_update_from_mesh(struct Mesh *me, struct KeyBlock *kb);
|
||||
void BKE_keyblock_convert_from_mesh(struct Mesh *me, struct Key *key, struct KeyBlock *kb);
|
||||
void BKE_keyblock_convert_to_mesh(struct KeyBlock *kb, struct MVert *mvert, int totvert);
|
||||
void BKE_keyblock_update_from_mesh(const struct Mesh *me, struct KeyBlock *kb);
|
||||
void BKE_keyblock_convert_from_mesh(const struct Mesh *me,
|
||||
const struct Key *key,
|
||||
struct KeyBlock *kb);
|
||||
void BKE_keyblock_convert_to_mesh(const struct KeyBlock *kb, struct MVert *mvert, int totvert);
|
||||
|
||||
/**
|
||||
* Computes normals (vertices, polygons and/or loops ones) of given mesh for given shape key.
|
||||
|
@ -131,21 +137,21 @@ void BKE_keyblock_convert_to_mesh(struct KeyBlock *kb, struct MVert *mvert, int
|
|||
* \param r_polynors: if non-NULL, an array of vectors, same length as number of polygons.
|
||||
* \param r_loopnors: if non-NULL, an array of vectors, same length as number of loops.
|
||||
*/
|
||||
void BKE_keyblock_mesh_calc_normals(struct KeyBlock *kb,
|
||||
struct Mesh *mesh,
|
||||
void BKE_keyblock_mesh_calc_normals(const struct KeyBlock *kb,
|
||||
const struct Mesh *mesh,
|
||||
float (*r_vertnors)[3],
|
||||
float (*r_polynors)[3],
|
||||
float (*r_loopnors)[3]);
|
||||
|
||||
void BKE_keyblock_update_from_vertcos(struct Object *ob,
|
||||
void BKE_keyblock_update_from_vertcos(const struct Object *ob,
|
||||
struct KeyBlock *kb,
|
||||
const float (*vertCos)[3]);
|
||||
void BKE_keyblock_convert_from_vertcos(struct Object *ob,
|
||||
void BKE_keyblock_convert_from_vertcos(const struct Object *ob,
|
||||
struct KeyBlock *kb,
|
||||
const float (*vertCos)[3]);
|
||||
float (*BKE_keyblock_convert_to_vertcos(struct Object *ob, struct KeyBlock *kb))[3];
|
||||
float (*BKE_keyblock_convert_to_vertcos(const struct Object *ob, const struct KeyBlock *kb))[3];
|
||||
|
||||
void BKE_keyblock_update_from_offset(struct Object *ob,
|
||||
void BKE_keyblock_update_from_offset(const struct Object *ob,
|
||||
struct KeyBlock *kb,
|
||||
const float (*ofs)[3]);
|
||||
|
||||
|
@ -165,7 +171,7 @@ bool BKE_keyblock_move(struct Object *ob, int org_index, int new_index);
|
|||
/**
|
||||
* Check if given key-block (as index) is used as basis by others in given key.
|
||||
*/
|
||||
bool BKE_keyblock_is_basis(struct Key *key, int index);
|
||||
bool BKE_keyblock_is_basis(const struct Key *key, int index);
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
/** \name Key-Block Data Access
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -123,7 +123,7 @@ AbstractHierarchyWriter *EnsuredWriter::operator->()
|
|||
|
||||
bool AbstractHierarchyWriter::check_is_animated(const HierarchyContext &context) const
|
||||
{
|
||||
const Object *object = context.object;
|
||||
Object *object = context.object;
|
||||
|
||||
if (BKE_animdata_id_is_animated(static_cast<ID *>(object->data))) {
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue