Cleanup: rename `BKE_key_convert/update` to `BKE_keyblock_convert/update`.
We are handling a keyblock here, not a whole key(set). Names are alreay a bit confusing, let's be consistent at least.
This commit is contained in:
parent
a52fbfa828
commit
d526ef607d
|
@ -88,28 +88,27 @@ void BKE_key_evaluate_relative(const int start, int end, const int tot, char *ba
|
|||
|
||||
/* conversion functions */
|
||||
/* Note: 'update_from' versions do not (re)allocate mem in kb, while 'convert_from' do. */
|
||||
void BKE_key_update_from_lattice(struct Lattice *lt, struct KeyBlock *kb);
|
||||
void BKE_key_convert_from_lattice(struct Lattice *lt, struct KeyBlock *kb);
|
||||
void BKE_key_convert_to_lattice(struct KeyBlock *kb, struct Lattice *lt);
|
||||
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_key_update_from_curve(struct Curve *cu, struct KeyBlock *kb, struct ListBase *nurb);
|
||||
void BKE_key_convert_from_curve(struct Curve *cu, struct KeyBlock *kb, struct ListBase *nurb);
|
||||
void BKE_key_convert_to_curve(struct KeyBlock *kb, struct Curve *cu, struct ListBase *nurb);
|
||||
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_convert_to_curve(struct KeyBlock *kb, struct Curve *cu, struct ListBase *nurb);
|
||||
|
||||
void BKE_key_update_from_mesh(struct Mesh *me, struct KeyBlock *kb);
|
||||
void BKE_key_convert_from_mesh(struct Mesh *me, struct KeyBlock *kb);
|
||||
void BKE_key_convert_to_mesh(struct KeyBlock *kb, struct Mesh *me);
|
||||
void BKE_keyblock_update_from_mesh(struct Mesh *me, struct KeyBlock *kb);
|
||||
void BKE_keyblock_convert_from_mesh(struct Mesh *me, struct KeyBlock *kb);
|
||||
void BKE_keyblock_convert_to_mesh(struct KeyBlock *kb, struct Mesh *me);
|
||||
|
||||
void BKE_key_update_from_vertcos(struct Object *ob, struct KeyBlock *kb, float (*vertCos)[3]);
|
||||
void BKE_key_convert_from_vertcos(struct Object *ob, struct KeyBlock *kb, float (*vertCos)[3]);
|
||||
float (*BKE_key_convert_to_vertcos(struct Object *ob, struct KeyBlock *kb))[3];
|
||||
void BKE_keyblock_update_from_vertcos(struct Object *ob, struct KeyBlock *kb, float (*vertCos)[3]);
|
||||
void BKE_keyblock_convert_from_vertcos(struct Object *ob, struct KeyBlock *kb, float (*vertCos)[3]);
|
||||
float (*BKE_keyblock_convert_to_vertcos(struct Object *ob, struct KeyBlock *kb))[3];
|
||||
|
||||
void BKE_key_update_from_offset(struct Object *ob, struct KeyBlock *kb, float (*ofs)[3]);
|
||||
void BKE_keyblock_update_from_offset(struct Object *ob, struct KeyBlock *kb, float (*ofs)[3]);
|
||||
|
||||
/* other management */
|
||||
bool BKE_keyblock_move(struct Object *ob, int org_index, int new_index);
|
||||
|
||||
|
||||
/* key.c */
|
||||
extern int slurph_opt;
|
||||
|
||||
|
|
|
@ -914,7 +914,7 @@ DerivedMesh *mesh_create_derived_for_modifier(Scene *scene, Object *ob,
|
|||
if (mti->isDisabled && mti->isDisabled(md, 0)) return NULL;
|
||||
|
||||
if (build_shapekey_layers && me->key && (kb = BLI_findlink(&me->key->block, ob->shapenr - 1))) {
|
||||
BKE_key_convert_to_mesh(kb, me);
|
||||
BKE_keyblock_convert_to_mesh(kb, me);
|
||||
}
|
||||
|
||||
if (mti->type == eModifierTypeType_OnlyDeform) {
|
||||
|
|
|
@ -1669,7 +1669,7 @@ char *BKE_keyblock_curval_rnapath_get(Key *key, KeyBlock *kb)
|
|||
/* conversion functions */
|
||||
|
||||
/************************* Lattice ************************/
|
||||
void BKE_key_update_from_lattice(Lattice *lt, KeyBlock *kb)
|
||||
void BKE_keyblock_update_from_lattice(Lattice *lt, KeyBlock *kb)
|
||||
{
|
||||
BPoint *bp;
|
||||
float *fp;
|
||||
|
@ -1687,7 +1687,7 @@ void BKE_key_update_from_lattice(Lattice *lt, KeyBlock *kb)
|
|||
}
|
||||
}
|
||||
|
||||
void BKE_key_convert_from_lattice(Lattice *lt, KeyBlock *kb)
|
||||
void BKE_keyblock_convert_from_lattice(Lattice *lt, KeyBlock *kb)
|
||||
{
|
||||
int tot;
|
||||
|
||||
|
@ -1699,10 +1699,10 @@ void BKE_key_convert_from_lattice(Lattice *lt, KeyBlock *kb)
|
|||
kb->data = MEM_mallocN(lt->key->elemsize * tot, __func__);
|
||||
kb->totelem = tot;
|
||||
|
||||
BKE_key_update_from_lattice(lt, kb);
|
||||
BKE_keyblock_update_from_lattice(lt, kb);
|
||||
}
|
||||
|
||||
void BKE_key_convert_to_lattice(KeyBlock *kb, Lattice *lt)
|
||||
void BKE_keyblock_convert_to_lattice(KeyBlock *kb, Lattice *lt)
|
||||
{
|
||||
BPoint *bp;
|
||||
const float *fp;
|
||||
|
@ -1720,7 +1720,7 @@ void BKE_key_convert_to_lattice(KeyBlock *kb, Lattice *lt)
|
|||
}
|
||||
|
||||
/************************* Curve ************************/
|
||||
void BKE_key_update_from_curve(Curve *UNUSED(cu), KeyBlock *kb, ListBase *nurb)
|
||||
void BKE_keyblock_update_from_curve(Curve *UNUSED(cu), KeyBlock *kb, ListBase *nurb)
|
||||
{
|
||||
Nurb *nu;
|
||||
BezTriple *bezt;
|
||||
|
@ -1767,7 +1767,7 @@ void BKE_key_update_from_curve(Curve *UNUSED(cu), KeyBlock *kb, ListBase *nurb)
|
|||
}
|
||||
}
|
||||
|
||||
void BKE_key_convert_from_curve(Curve *cu, KeyBlock *kb, ListBase *nurb)
|
||||
void BKE_keyblock_convert_from_curve(Curve *cu, KeyBlock *kb, ListBase *nurb)
|
||||
{
|
||||
int tot;
|
||||
|
||||
|
@ -1780,10 +1780,10 @@ void BKE_key_convert_from_curve(Curve *cu, KeyBlock *kb, ListBase *nurb)
|
|||
kb->data = MEM_mallocN(cu->key->elemsize * tot, __func__);
|
||||
kb->totelem = tot;
|
||||
|
||||
BKE_key_update_from_curve(cu, kb, nurb);
|
||||
BKE_keyblock_update_from_curve(cu, kb, nurb);
|
||||
}
|
||||
|
||||
void BKE_key_convert_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb)
|
||||
void BKE_keyblock_convert_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb)
|
||||
{
|
||||
Nurb *nu;
|
||||
BezTriple *bezt;
|
||||
|
@ -1834,7 +1834,7 @@ void BKE_key_convert_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb)
|
|||
}
|
||||
|
||||
/************************* Mesh ************************/
|
||||
void BKE_key_update_from_mesh(Mesh *me, KeyBlock *kb)
|
||||
void BKE_keyblock_update_from_mesh(Mesh *me, KeyBlock *kb)
|
||||
{
|
||||
MVert *mvert;
|
||||
float *fp;
|
||||
|
@ -1853,7 +1853,7 @@ void BKE_key_update_from_mesh(Mesh *me, KeyBlock *kb)
|
|||
}
|
||||
}
|
||||
|
||||
void BKE_key_convert_from_mesh(Mesh *me, KeyBlock *kb)
|
||||
void BKE_keyblock_convert_from_mesh(Mesh *me, KeyBlock *kb)
|
||||
{
|
||||
int tot = me->totvert;
|
||||
|
||||
|
@ -1864,10 +1864,10 @@ void BKE_key_convert_from_mesh(Mesh *me, KeyBlock *kb)
|
|||
kb->data = MEM_mallocN(me->key->elemsize * tot, __func__);
|
||||
kb->totelem = tot;
|
||||
|
||||
BKE_key_update_from_mesh(me, kb);
|
||||
BKE_keyblock_update_from_mesh(me, kb);
|
||||
}
|
||||
|
||||
void BKE_key_convert_to_mesh(KeyBlock *kb, Mesh *me)
|
||||
void BKE_keyblock_convert_to_mesh(KeyBlock *kb, Mesh *me)
|
||||
{
|
||||
MVert *mvert;
|
||||
const float *fp;
|
||||
|
@ -1884,7 +1884,7 @@ void BKE_key_convert_to_mesh(KeyBlock *kb, Mesh *me)
|
|||
}
|
||||
|
||||
/************************* raw coords ************************/
|
||||
void BKE_key_update_from_vertcos(Object *ob, KeyBlock *kb, float (*vertCos)[3])
|
||||
void BKE_keyblock_update_from_vertcos(Object *ob, KeyBlock *kb, float (*vertCos)[3])
|
||||
{
|
||||
float *co = (float *)vertCos;
|
||||
float *fp = kb->data;
|
||||
|
@ -1945,7 +1945,7 @@ void BKE_key_update_from_vertcos(Object *ob, KeyBlock *kb, float (*vertCos)[3])
|
|||
}
|
||||
}
|
||||
|
||||
void BKE_key_convert_from_vertcos(Object *ob, KeyBlock *kb, float (*vertCos)[3])
|
||||
void BKE_keyblock_convert_from_vertcos(Object *ob, KeyBlock *kb, float (*vertCos)[3])
|
||||
{
|
||||
int tot = 0, elemsize;
|
||||
|
||||
|
@ -1973,10 +1973,10 @@ void BKE_key_convert_from_vertcos(Object *ob, KeyBlock *kb, float (*vertCos)[3])
|
|||
kb->data = MEM_mallocN(tot * elemsize, __func__);
|
||||
|
||||
/* Copy coords to keyblock */
|
||||
BKE_key_update_from_vertcos(ob, kb, vertCos);
|
||||
BKE_keyblock_update_from_vertcos(ob, kb, vertCos);
|
||||
}
|
||||
|
||||
float (*BKE_key_convert_to_vertcos(Object *ob, KeyBlock *kb))[3]
|
||||
float (*BKE_keyblock_convert_to_vertcos(Object *ob, KeyBlock *kb))[3]
|
||||
{
|
||||
float (*vertCos)[3], *co;
|
||||
const float *fp = kb->data;
|
||||
|
@ -1998,7 +1998,7 @@ float (*BKE_key_convert_to_vertcos(Object *ob, KeyBlock *kb))[3]
|
|||
|
||||
if (tot == 0) return NULL;
|
||||
|
||||
vertCos = MEM_mallocN(tot * sizeof(*vertCos), "BKE_key_convert_to_vertcos vertCos");
|
||||
vertCos = MEM_mallocN(tot * sizeof(*vertCos), __func__);
|
||||
|
||||
/* Copy coords to array */
|
||||
co = (float *)vertCos;
|
||||
|
@ -2053,7 +2053,7 @@ float (*BKE_key_convert_to_vertcos(Object *ob, KeyBlock *kb))[3]
|
|||
}
|
||||
|
||||
/************************* raw coord offsets ************************/
|
||||
void BKE_key_update_from_offset(Object *ob, KeyBlock *kb, float (*ofs)[3])
|
||||
void BKE_keyblock_update_from_offset(Object *ob, KeyBlock *kb, float (*ofs)[3])
|
||||
{
|
||||
int a;
|
||||
float *co = (float *)ofs, *fp = kb->data;
|
||||
|
|
|
@ -3360,7 +3360,7 @@ static KeyBlock *insert_meshkey(Scene *scene, Object *ob, const char *name, cons
|
|||
if (newkey || from_mix == false) {
|
||||
/* create from mesh */
|
||||
kb = BKE_keyblock_add_ctime(key, name, false);
|
||||
BKE_key_convert_from_mesh(me, kb);
|
||||
BKE_keyblock_convert_from_mesh(me, kb);
|
||||
}
|
||||
else {
|
||||
/* copy from current values */
|
||||
|
@ -3397,7 +3397,7 @@ static KeyBlock *insert_lattkey(Scene *scene, Object *ob, const char *name, cons
|
|||
kb->totelem = basekb->totelem;
|
||||
}
|
||||
else {
|
||||
BKE_key_convert_from_lattice(lt, kb);
|
||||
BKE_keyblock_convert_from_lattice(lt, kb);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -3437,7 +3437,7 @@ static KeyBlock *insert_curvekey(Scene *scene, Object *ob, const char *name, con
|
|||
kb->totelem = basekb->totelem;
|
||||
}
|
||||
else {
|
||||
BKE_key_convert_from_curve(cu, kb, lb);
|
||||
BKE_keyblock_convert_from_curve(cu, kb, lb);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -740,7 +740,7 @@ void BKE_sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob,
|
|||
|
||||
BKE_free_sculptsession_deformMats(ss);
|
||||
|
||||
ss->orig_cos = (ss->kb) ? BKE_key_convert_to_vertcos(ob, ss->kb) : BKE_mesh_vertexCos_get(me, NULL);
|
||||
ss->orig_cos = (ss->kb) ? BKE_keyblock_convert_to_vertcos(ob, ss->kb) : BKE_mesh_vertexCos_get(me, NULL);
|
||||
|
||||
BKE_crazyspace_build_sculpt(scene, ob, &ss->deform_imats, &ss->deform_cos);
|
||||
BKE_pbvh_apply_vertCos(ss->pbvh, ss->deform_cos);
|
||||
|
@ -755,14 +755,14 @@ void BKE_sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob,
|
|||
}
|
||||
|
||||
if (ss->kb != NULL && ss->deform_cos == NULL) {
|
||||
ss->deform_cos = BKE_key_convert_to_vertcos(ob, ss->kb);
|
||||
ss->deform_cos = BKE_keyblock_convert_to_vertcos(ob, ss->kb);
|
||||
}
|
||||
|
||||
/* if pbvh is deformed, key block is already applied to it */
|
||||
if (ss->kb) {
|
||||
bool pbvh_deformd = BKE_pbvh_isDeformed(ss->pbvh);
|
||||
if (!pbvh_deformd || ss->deform_cos == NULL) {
|
||||
float (*vertCos)[3] = BKE_key_convert_to_vertcos(ob, ss->kb);
|
||||
float (*vertCos)[3] = BKE_keyblock_convert_to_vertcos(ob, ss->kb);
|
||||
|
||||
if (vertCos) {
|
||||
if (!pbvh_deformd) {
|
||||
|
|
|
@ -702,7 +702,7 @@ void ArmatureImporter::make_shape_keys()
|
|||
|
||||
//insert basis key
|
||||
kb = BKE_keyblock_add_ctime(key, "Basis", false);
|
||||
BKE_key_convert_from_mesh(source_me, kb);
|
||||
BKE_keyblock_convert_from_mesh(source_me, kb);
|
||||
|
||||
//insert other shape keys
|
||||
for (int i = 0 ; i < morphTargetIds.getCount() ; i++ ) {
|
||||
|
@ -716,7 +716,7 @@ void ArmatureImporter::make_shape_keys()
|
|||
std::string morph_name = *this->mesh_importer->get_geometry_name(me->id.name);
|
||||
|
||||
kb = BKE_keyblock_add_ctime(key, morph_name.c_str(), false);
|
||||
BKE_key_convert_from_mesh(me, kb);
|
||||
BKE_keyblock_convert_from_mesh(me, kb);
|
||||
|
||||
//apply weights
|
||||
weight = morphWeights.getFloatValues()->getData()[i];
|
||||
|
|
|
@ -159,7 +159,7 @@ void GeometryExporter::operator()(Object *ob)
|
|||
//skip the basis
|
||||
kb = kb->next;
|
||||
for (; kb; kb = kb->next) {
|
||||
BKE_key_convert_to_mesh(kb, me);
|
||||
BKE_keyblock_convert_to_mesh(kb, me);
|
||||
export_key_mesh(ob, me, kb);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1358,7 +1358,7 @@ void make_editNurb(Object *obedit)
|
|||
if (actkey) {
|
||||
// XXX strcpy(G.editModeTitleExtra, "(Key) ");
|
||||
undo_editmode_clear();
|
||||
BKE_key_convert_to_curve(actkey, cu, &cu->nurb);
|
||||
BKE_keyblock_convert_to_curve(actkey, cu, &cu->nurb);
|
||||
}
|
||||
|
||||
if (editnurb) {
|
||||
|
|
|
@ -627,7 +627,7 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op)
|
|||
|
||||
/* first key added, so it was the basis. initialize it with the existing mesh */
|
||||
kb = BKE_keyblock_add(key, NULL);
|
||||
BKE_key_convert_from_mesh(me, kb);
|
||||
BKE_keyblock_convert_from_mesh(me, kb);
|
||||
}
|
||||
|
||||
/* now ready to add new keys from selected meshes */
|
||||
|
|
|
@ -100,7 +100,7 @@ void make_editLatt(Object *obedit)
|
|||
|
||||
actkey = BKE_keyblock_from_object(obedit);
|
||||
if (actkey)
|
||||
BKE_key_convert_to_lattice(actkey, lt);
|
||||
BKE_keyblock_convert_to_lattice(actkey, lt);
|
||||
|
||||
lt->editlatt = MEM_callocN(sizeof(EditLatt), "editlatt");
|
||||
lt->editlatt->latt = MEM_dupallocN(lt);
|
||||
|
|
|
@ -560,7 +560,7 @@ static int modifier_apply_shape(ReportList *reports, Scene *scene, Object *ob, M
|
|||
/* if that was the first key block added, then it was the basis.
|
||||
* Initialize it with the mesh, and add another for the modifier */
|
||||
kb = BKE_keyblock_add(key, NULL);
|
||||
BKE_key_convert_from_mesh(me, kb);
|
||||
BKE_keyblock_convert_from_mesh(me, kb);
|
||||
}
|
||||
|
||||
kb = BKE_keyblock_add(key, md->name);
|
||||
|
|
|
@ -133,14 +133,14 @@ static bool ED_object_shape_key_remove(Main *bmain, Object *ob)
|
|||
/* apply new basis key on original data */
|
||||
switch (ob->type) {
|
||||
case OB_MESH:
|
||||
BKE_key_convert_to_mesh(key->refkey, ob->data);
|
||||
BKE_keyblock_convert_to_mesh(key->refkey, ob->data);
|
||||
break;
|
||||
case OB_CURVE:
|
||||
case OB_SURF:
|
||||
BKE_key_convert_to_curve(key->refkey, ob->data, BKE_curve_nurbs_get(ob->data));
|
||||
BKE_keyblock_convert_to_curve(key->refkey, ob->data, BKE_curve_nurbs_get(ob->data));
|
||||
break;
|
||||
case OB_LATTICE:
|
||||
BKE_key_convert_to_lattice(key->refkey, ob->data);
|
||||
BKE_keyblock_convert_to_lattice(key->refkey, ob->data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2929,7 +2929,7 @@ void sculpt_vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
|
|||
}
|
||||
|
||||
if (is_basis) {
|
||||
ofs = BKE_key_convert_to_vertcos(ob, kb);
|
||||
ofs = BKE_keyblock_convert_to_vertcos(ob, kb);
|
||||
|
||||
/* calculate key coord offsets (from previous location) */
|
||||
for (a = 0; a < me->totvert; a++) {
|
||||
|
@ -2942,7 +2942,7 @@ void sculpt_vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
|
|||
int apply_offset = ((currkey != kb) && (ob->shapenr - 1 == currkey->relative));
|
||||
|
||||
if (apply_offset)
|
||||
BKE_key_update_from_offset(ob, currkey, ofs);
|
||||
BKE_keyblock_update_from_offset(ob, currkey, ofs);
|
||||
|
||||
currkey = currkey->next;
|
||||
}
|
||||
|
@ -2961,7 +2961,7 @@ void sculpt_vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
|
|||
}
|
||||
|
||||
/* apply new coords on active key block, no need to re-allocate kb->data here! */
|
||||
BKE_key_update_from_vertcos(ob, kb, vertCos);
|
||||
BKE_keyblock_update_from_vertcos(ob, kb, vertCos);
|
||||
}
|
||||
|
||||
/* Note: we do the topology update before any brush actions to avoid
|
||||
|
|
|
@ -127,7 +127,7 @@ static int sculpt_undo_restore_coords(bContext *C, DerivedMesh *dm, SculptUndoNo
|
|||
|
||||
if (ss->kb) {
|
||||
float (*vertCos)[3];
|
||||
vertCos = BKE_key_convert_to_vertcos(ob, ss->kb);
|
||||
vertCos = BKE_keyblock_convert_to_vertcos(ob, ss->kb);
|
||||
|
||||
for (i = 0; i < unode->totvert; i++) {
|
||||
if (ss->modifiers_active) {
|
||||
|
|
Loading…
Reference in New Issue