Cleanup: Remove unused shape key functions
These were last used in some sculpt code that has been refactored to do things more efficiently. For that same reason I don't think we're likely to need them elsewhere.
This commit is contained in:
@@ -143,13 +143,6 @@ void BKE_keyblock_mesh_calc_normals(const KeyBlock *kb,
|
||||
float (*r_face_normals)[3],
|
||||
float (*r_loop_normals)[3]);
|
||||
|
||||
void BKE_keyblock_update_from_vertcos(const Object *ob, KeyBlock *kb, const float (*vertCos)[3]);
|
||||
void BKE_keyblock_convert_from_vertcos(const Object *ob, KeyBlock *kb, const float (*vertCos)[3]);
|
||||
float (*BKE_keyblock_convert_to_vertcos(const Object *ob, const KeyBlock *kb))[3];
|
||||
|
||||
/** RAW coordinates offsets. */
|
||||
void BKE_keyblock_update_from_offset(const Object *ob, KeyBlock *kb, const float (*ofs)[3]);
|
||||
|
||||
/* other management */
|
||||
|
||||
/**
|
||||
|
||||
@@ -2294,190 +2294,6 @@ void BKE_keyblock_mesh_calc_normals(const KeyBlock *kb,
|
||||
|
||||
/************************* raw coords ************************/
|
||||
|
||||
void BKE_keyblock_update_from_vertcos(const Object *ob, KeyBlock *kb, const float (*vertCos)[3])
|
||||
{
|
||||
const float(*co)[3] = vertCos;
|
||||
float *fp = static_cast<float *>(kb->data);
|
||||
int tot, a;
|
||||
|
||||
#ifndef NDEBUG
|
||||
if (ob->type == OB_LATTICE) {
|
||||
Lattice *lt = static_cast<Lattice *>(ob->data);
|
||||
BLI_assert((lt->pntsu * lt->pntsv * lt->pntsw) == kb->totelem);
|
||||
}
|
||||
else if (ELEM(ob->type, OB_CURVES_LEGACY, OB_SURF)) {
|
||||
Curve *cu = static_cast<Curve *>(ob->data);
|
||||
BLI_assert(BKE_keyblock_curve_element_count(&cu->nurb) == kb->totelem);
|
||||
}
|
||||
else if (ob->type == OB_MESH) {
|
||||
Mesh *mesh = static_cast<Mesh *>(ob->data);
|
||||
BLI_assert(mesh->verts_num == kb->totelem);
|
||||
}
|
||||
else {
|
||||
BLI_assert(0 == kb->totelem);
|
||||
}
|
||||
#endif
|
||||
|
||||
tot = kb->totelem;
|
||||
if (tot == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Copy coords to key-block. */
|
||||
if (ELEM(ob->type, OB_MESH, OB_LATTICE)) {
|
||||
for (a = 0; a < tot; a++, fp += 3, co++) {
|
||||
copy_v3_v3(fp, *co);
|
||||
}
|
||||
}
|
||||
else if (ELEM(ob->type, OB_CURVES_LEGACY, OB_SURF)) {
|
||||
const Curve *cu = (const Curve *)ob->data;
|
||||
const BezTriple *bezt;
|
||||
const BPoint *bp;
|
||||
|
||||
LISTBASE_FOREACH (const Nurb *, nu, &cu->nurb) {
|
||||
if (nu->bezt) {
|
||||
for (a = nu->pntsu, bezt = nu->bezt; a; a--, bezt++) {
|
||||
for (int i = 0; i < 3; i++, co++) {
|
||||
copy_v3_v3(&fp[i * 3], *co);
|
||||
}
|
||||
fp += KEYELEM_FLOAT_LEN_BEZTRIPLE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (a = nu->pntsu * nu->pntsv, bp = nu->bp; a; a--, bp++, co++) {
|
||||
copy_v3_v3(fp, *co);
|
||||
fp += KEYELEM_FLOAT_LEN_BPOINT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BKE_keyblock_convert_from_vertcos(const Object *ob, KeyBlock *kb, const float (*vertCos)[3])
|
||||
{
|
||||
int tot = 0, elemsize;
|
||||
|
||||
MEM_SAFE_FREE(kb->data);
|
||||
|
||||
/* Count of vertex coords in array */
|
||||
if (ob->type == OB_MESH) {
|
||||
const Mesh *mesh = (const Mesh *)ob->data;
|
||||
tot = mesh->verts_num;
|
||||
elemsize = mesh->key->elemsize;
|
||||
}
|
||||
else if (ob->type == OB_LATTICE) {
|
||||
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)) {
|
||||
const Curve *cu = (const Curve *)ob->data;
|
||||
elemsize = cu->key->elemsize;
|
||||
tot = BKE_keyblock_curve_element_count(&cu->nurb);
|
||||
}
|
||||
|
||||
if (tot == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
kb->data = MEM_mallocN(tot * elemsize, __func__);
|
||||
|
||||
/* Copy coords to key-block. */
|
||||
BKE_keyblock_update_from_vertcos(ob, kb, vertCos);
|
||||
}
|
||||
|
||||
float (*BKE_keyblock_convert_to_vertcos(const Object *ob, const KeyBlock *kb))[3]
|
||||
{
|
||||
float(*vertCos)[3], (*co)[3];
|
||||
const float *fp = static_cast<const float *>(kb->data);
|
||||
int tot = 0, a;
|
||||
|
||||
/* Count of vertex coords in array */
|
||||
if (ob->type == OB_MESH) {
|
||||
const Mesh *mesh = (const Mesh *)ob->data;
|
||||
tot = mesh->verts_num;
|
||||
}
|
||||
else if (ob->type == OB_LATTICE) {
|
||||
const Lattice *lt = (const Lattice *)ob->data;
|
||||
tot = lt->pntsu * lt->pntsv * lt->pntsw;
|
||||
}
|
||||
else if (ELEM(ob->type, OB_CURVES_LEGACY, OB_SURF)) {
|
||||
const Curve *cu = (const Curve *)ob->data;
|
||||
tot = BKE_nurbList_verts_count(&cu->nurb);
|
||||
}
|
||||
|
||||
if (tot == 0) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
co = vertCos = static_cast<float(*)[3]>(MEM_mallocN(tot * sizeof(*vertCos), __func__));
|
||||
|
||||
/* Copy coords to array */
|
||||
if (ELEM(ob->type, OB_MESH, OB_LATTICE)) {
|
||||
for (a = 0; a < tot; a++, fp += 3, co++) {
|
||||
copy_v3_v3(*co, fp);
|
||||
}
|
||||
}
|
||||
else if (ELEM(ob->type, OB_CURVES_LEGACY, OB_SURF)) {
|
||||
const Curve *cu = (const Curve *)ob->data;
|
||||
const BezTriple *bezt;
|
||||
const BPoint *bp;
|
||||
|
||||
LISTBASE_FOREACH (Nurb *, nu, &cu->nurb) {
|
||||
if (nu->bezt) {
|
||||
for (a = nu->pntsu, bezt = nu->bezt; a; a--, bezt++) {
|
||||
for (int i = 0; i < 3; i++, co++) {
|
||||
copy_v3_v3(*co, &fp[i * 3]);
|
||||
}
|
||||
fp += KEYELEM_FLOAT_LEN_BEZTRIPLE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (a = nu->pntsu * nu->pntsv, bp = nu->bp; a; a--, bp++, co++) {
|
||||
copy_v3_v3(*co, fp);
|
||||
fp += KEYELEM_FLOAT_LEN_BPOINT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return vertCos;
|
||||
}
|
||||
|
||||
void BKE_keyblock_update_from_offset(const Object *ob, KeyBlock *kb, const float (*ofs)[3])
|
||||
{
|
||||
int a;
|
||||
float *fp = static_cast<float *>(kb->data);
|
||||
|
||||
if (ELEM(ob->type, OB_MESH, OB_LATTICE)) {
|
||||
for (a = 0; a < kb->totelem; a++, fp += 3, ofs++) {
|
||||
add_v3_v3(fp, *ofs);
|
||||
}
|
||||
}
|
||||
else if (ELEM(ob->type, OB_CURVES_LEGACY, OB_SURF)) {
|
||||
const Curve *cu = (const Curve *)ob->data;
|
||||
const BezTriple *bezt;
|
||||
const BPoint *bp;
|
||||
|
||||
LISTBASE_FOREACH (const Nurb *, nu, &cu->nurb) {
|
||||
if (nu->bezt) {
|
||||
for (a = nu->pntsu, bezt = nu->bezt; a; a--, bezt++) {
|
||||
for (int i = 0; i < 3; i++, ofs++) {
|
||||
add_v3_v3(&fp[i * 3], *ofs);
|
||||
}
|
||||
fp += KEYELEM_FLOAT_LEN_BEZTRIPLE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (a = nu->pntsu * nu->pntsv, bp = nu->bp; a; a--, bp++, ofs++) {
|
||||
add_v3_v3(fp, *ofs);
|
||||
fp += KEYELEM_FLOAT_LEN_BPOINT;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool BKE_keyblock_move(Object *ob, int org_index, int new_index)
|
||||
{
|
||||
Key *key = BKE_key_from_object(ob);
|
||||
|
||||
Reference in New Issue
Block a user