code cleanup: make shape key api names consistent with our new convention.
This commit is contained in:
@@ -47,13 +47,13 @@ struct Mesh;
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void BKE_key_free(struct Key *sc);
|
||||
void free_key_nolib(struct Key *key);
|
||||
struct Key *add_key(struct ID *id);
|
||||
void BKE_key_free(struct Key *sc);
|
||||
void BKE_key_free_nolib(struct Key *key);
|
||||
struct Key *BKE_key_add(struct ID *id);
|
||||
struct Key *BKE_key_copy(struct Key *key);
|
||||
struct Key *copy_key_nolib(struct Key *key);
|
||||
void BKE_key_make_local(struct Key *key);
|
||||
void sort_keys(struct Key *key);
|
||||
struct Key *BKE_key_copy_nolib(struct Key *key);
|
||||
void BKE_key_make_local(struct Key *key);
|
||||
void BKE_key_sort(struct Key *key);
|
||||
|
||||
void key_curve_position_weights(float t, float data[4], int type);
|
||||
void key_curve_tangent_weights(float t, float data[4], int type);
|
||||
@@ -61,27 +61,28 @@ void key_curve_normal_weights(float t, float data[4], int type);
|
||||
|
||||
float *do_ob_key(struct Scene *scene, struct Object *ob);
|
||||
|
||||
struct Key *ob_get_key(struct Object *ob);
|
||||
struct KeyBlock *add_keyblock(struct Key *key, const char *name);
|
||||
struct KeyBlock *add_keyblock_ctime(struct Key *key, const char *name, const short do_force);
|
||||
struct KeyBlock *ob_get_keyblock(struct Object *ob);
|
||||
struct KeyBlock *ob_get_reference_keyblock(struct Object *ob);
|
||||
struct KeyBlock *key_get_keyblock(struct Key *key, int index);
|
||||
struct KeyBlock *key_get_named_keyblock(struct Key *key, const char name[]);
|
||||
char *key_get_curValue_rnaPath(struct Key *key, struct KeyBlock *kb);
|
||||
struct Key *BKE_key_from_object(struct Object *ob);
|
||||
struct KeyBlock *BKE_keyblock_from_object(struct Object *ob);
|
||||
struct KeyBlock *BKE_keyblock_from_object_reference(struct Object *ob);
|
||||
|
||||
struct KeyBlock *BKE_keyblock_add(struct Key *key, const char *name);
|
||||
struct KeyBlock *BKE_keyblock_add_ctime(struct Key *key, const char *name, const short do_force);
|
||||
struct KeyBlock *BKE_keyblock_from_key(struct Key *key, int index);
|
||||
struct KeyBlock *BKE_keyblock_find_name(struct Key *key, const char name[]);
|
||||
char *BKE_keyblock_curval_rnapath_get(struct Key *key, struct KeyBlock *kb);
|
||||
// needed for the GE
|
||||
void do_rel_key(const int start, int end, const int tot, char *basispoin, struct Key *key, struct KeyBlock *actkb, const int mode);
|
||||
void BKE_key_evaluate_relative(const int start, int end, const int tot, char *basispoin, struct Key *key, struct KeyBlock *actkb, const int mode);
|
||||
|
||||
/* conversion functions */
|
||||
void key_to_mesh(struct KeyBlock *kb, struct Mesh *me);
|
||||
void mesh_to_key(struct Mesh *me, struct KeyBlock *kb);
|
||||
void key_to_latt(struct KeyBlock *kb, struct Lattice *lt);
|
||||
void latt_to_key(struct Lattice *lt, struct KeyBlock *kb);
|
||||
void key_to_curve(struct KeyBlock *kb, struct Curve *cu, struct ListBase *nurb);
|
||||
void curve_to_key(struct Curve *cu, struct KeyBlock *kb, struct ListBase *nurb);
|
||||
float (*key_to_vertcos(struct Object *ob, struct KeyBlock *kb))[3];
|
||||
void vertcos_to_key(struct Object *ob, struct KeyBlock *kb, float (*vertCos)[3]);
|
||||
void offset_to_key(struct Object *ob, struct KeyBlock *kb, float (*ofs)[3]);
|
||||
void BKE_key_convert_to_mesh(struct KeyBlock *kb, struct Mesh *me);
|
||||
void BKE_key_convert_from_mesh(struct Mesh *me, struct KeyBlock *kb);
|
||||
void BKE_key_convert_to_lattice(struct KeyBlock *kb, struct Lattice *lt);
|
||||
void BKE_key_convert_from_lattice(struct Lattice *lt, struct KeyBlock *kb);
|
||||
void BKE_key_convert_to_curve(struct KeyBlock *kb, struct Curve *cu, struct ListBase *nurb);
|
||||
void BKE_key_convert_from_curve(struct Curve *cu, struct KeyBlock *kb, struct ListBase *nurb);
|
||||
float (*BKE_key_convert_to_vertcos(struct Object *ob, struct KeyBlock *kb))[3];
|
||||
void BKE_key_convert_from_vertcos(struct Object *ob, struct KeyBlock *kb, float (*vertCos)[3]);
|
||||
void BKE_key_convert_from_offset(struct Object *ob, struct KeyBlock *kb, float (*ofs)[3]);
|
||||
|
||||
/* key.c */
|
||||
extern int slurph_opt;
|
||||
|
||||
@@ -808,7 +808,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))) {
|
||||
key_to_mesh(kb, me);
|
||||
BKE_key_convert_to_mesh(kb, me);
|
||||
}
|
||||
|
||||
if (mti->type == eModifierTypeType_OnlyDeform) {
|
||||
@@ -878,7 +878,7 @@ static void *get_orco_coords_dm(Object *ob, BMEditMesh *em, int layer, int *free
|
||||
* by a more flexible customdata system, but not simple */
|
||||
if (!em) {
|
||||
ClothModifierData *clmd = (ClothModifierData *)modifiers_findByType(ob, eModifierType_Cloth);
|
||||
KeyBlock *kb = key_get_keyblock(ob_get_key(ob), clmd->sim_parms->shapekey_rest);
|
||||
KeyBlock *kb = BKE_keyblock_from_key(BKE_key_from_object(ob), clmd->sim_parms->shapekey_rest);
|
||||
|
||||
if (kb->data)
|
||||
return kb->data;
|
||||
@@ -1276,7 +1276,7 @@ static void shapekey_layers_to_keyblocks(DerivedMesh *dm, Mesh *me, int actshape
|
||||
}
|
||||
|
||||
if (!kb) {
|
||||
kb = add_keyblock(me->key, layer->name);
|
||||
kb = BKE_keyblock_add(me->key, layer->name);
|
||||
kb->uid = layer->uid;
|
||||
}
|
||||
|
||||
|
||||
@@ -501,7 +501,7 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Scene *scene, O
|
||||
if (ob->adt)
|
||||
dag_add_driver_relation(ob->adt, dag, node, (ob->type == OB_ARMATURE)); // XXX isdata arg here doesn't give an accurate picture of situation
|
||||
|
||||
key = ob_get_key(ob);
|
||||
key = BKE_key_from_object(ob);
|
||||
if (key && key->adt)
|
||||
dag_add_driver_relation(key->adt, dag, node, 1);
|
||||
|
||||
@@ -2650,7 +2650,7 @@ static void dag_id_flush_update(Scene *sce, ID *id)
|
||||
/* set flags based on ShapeKey */
|
||||
if (idtype == ID_KE) {
|
||||
for (obt = bmain->object.first; obt; obt = obt->id.next) {
|
||||
Key *key = ob_get_key(obt);
|
||||
Key *key = BKE_key_from_object(obt);
|
||||
if (!(ob && obt == ob) && ((ID *)key == id)) {
|
||||
obt->flag |= (OB_RECALC_OB | OB_RECALC_DATA);
|
||||
lib_id_recalc_tag(bmain, &obt->id);
|
||||
|
||||
@@ -94,7 +94,7 @@ void BKE_key_free(Key *key)
|
||||
|
||||
}
|
||||
|
||||
void free_key_nolib(Key *key)
|
||||
void BKE_key_free_nolib(Key *key)
|
||||
{
|
||||
KeyBlock *kb;
|
||||
|
||||
@@ -121,7 +121,7 @@ void free_key_nolib(Key *key)
|
||||
/* from misc_util: flip the bytes from x */
|
||||
/* #define GS(x) (((unsigned char *)(x))[0] << 8 | ((unsigned char *)(x))[1]) */
|
||||
|
||||
Key *add_key(ID *id) /* common function */
|
||||
Key *BKE_key_add(ID *id) /* common function */
|
||||
{
|
||||
Key *key;
|
||||
char *el;
|
||||
@@ -196,7 +196,7 @@ Key *BKE_key_copy(Key *key)
|
||||
}
|
||||
|
||||
|
||||
Key *copy_key_nolib(Key *key)
|
||||
Key *BKE_key_copy_nolib(Key *key)
|
||||
{
|
||||
Key *keyn;
|
||||
KeyBlock *kbn, *kb;
|
||||
@@ -241,7 +241,7 @@ void BKE_key_make_local(Key *key)
|
||||
* currently being called.
|
||||
*/
|
||||
|
||||
void sort_keys(Key *key)
|
||||
void BKE_key_sort(Key *key)
|
||||
{
|
||||
KeyBlock *kb;
|
||||
KeyBlock *kb2;
|
||||
@@ -711,7 +711,7 @@ static void cp_cu_key(Curve *cu, Key *key, KeyBlock *actkb, KeyBlock *kb, const
|
||||
}
|
||||
}
|
||||
|
||||
void do_rel_key(const int start, int end, const int tot, char *basispoin, Key *key, KeyBlock *actkb, const int mode)
|
||||
void BKE_key_evaluate_relative(const int start, int end, const int tot, char *basispoin, Key *key, KeyBlock *actkb, const int mode)
|
||||
{
|
||||
KeyBlock *kb;
|
||||
int *ofsp, ofs[3], elemsize, b;
|
||||
@@ -1071,7 +1071,7 @@ static float *get_weights_array(Object *ob, char *vgroup)
|
||||
|
||||
static void do_mesh_key(Scene *scene, Object *ob, Key *key, char *out, const int tot)
|
||||
{
|
||||
KeyBlock *k[4], *actkb = ob_get_keyblock(ob);
|
||||
KeyBlock *k[4], *actkb = BKE_keyblock_from_object(ob);
|
||||
float t[4];
|
||||
int flag = 0;
|
||||
|
||||
@@ -1106,7 +1106,7 @@ static void do_mesh_key(Scene *scene, Object *ob, Key *key, char *out, const int
|
||||
kb->weights = get_weights_array(ob, kb->vgroup);
|
||||
}
|
||||
|
||||
do_rel_key(0, tot, tot, (char *)out, key, actkb, KEY_MODE_DUMMY);
|
||||
BKE_key_evaluate_relative(0, tot, tot, (char *)out, key, actkb, KEY_MODE_DUMMY);
|
||||
|
||||
for (kb = key->block.first; kb; kb = kb->next) {
|
||||
if (kb->weights) MEM_freeN(kb->weights);
|
||||
@@ -1154,11 +1154,11 @@ static void do_rel_cu_key(Curve *cu, Key *key, KeyBlock *actkb, char *out, const
|
||||
for (a = 0, nu = cu->nurb.first; nu; nu = nu->next, a += step) {
|
||||
if (nu->bp) {
|
||||
step = nu->pntsu * nu->pntsv;
|
||||
do_rel_key(a, a + step, tot, out, key, actkb, KEY_MODE_BPOINT);
|
||||
BKE_key_evaluate_relative(a, a + step, tot, out, key, actkb, KEY_MODE_BPOINT);
|
||||
}
|
||||
else if (nu->bezt) {
|
||||
step = 3 * nu->pntsu;
|
||||
do_rel_key(a, a + step, tot, out, key, actkb, KEY_MODE_BEZTRIPLE);
|
||||
BKE_key_evaluate_relative(a, a + step, tot, out, key, actkb, KEY_MODE_BEZTRIPLE);
|
||||
}
|
||||
else {
|
||||
step = 0;
|
||||
@@ -1169,7 +1169,7 @@ static void do_rel_cu_key(Curve *cu, Key *key, KeyBlock *actkb, char *out, const
|
||||
static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, const int tot)
|
||||
{
|
||||
Curve *cu = ob->data;
|
||||
KeyBlock *k[4], *actkb = ob_get_keyblock(ob);
|
||||
KeyBlock *k[4], *actkb = BKE_keyblock_from_object(ob);
|
||||
float t[4];
|
||||
int flag = 0;
|
||||
|
||||
@@ -1251,7 +1251,7 @@ static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, const in
|
||||
static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int tot)
|
||||
{
|
||||
Lattice *lt = ob->data;
|
||||
KeyBlock *k[4], *actkb = ob_get_keyblock(ob);
|
||||
KeyBlock *k[4], *actkb = BKE_keyblock_from_object(ob);
|
||||
float t[4];
|
||||
int flag;
|
||||
|
||||
@@ -1277,7 +1277,7 @@ static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int
|
||||
for (kb = key->block.first; kb; kb = kb->next)
|
||||
kb->weights = get_weights_array(ob, kb->vgroup);
|
||||
|
||||
do_rel_key(0, tot, tot, out, key, actkb, KEY_MODE_DUMMY);
|
||||
BKE_key_evaluate_relative(0, tot, tot, out, key, actkb, KEY_MODE_DUMMY);
|
||||
|
||||
for (kb = key->block.first; kb; kb = kb->next) {
|
||||
if (kb->weights) MEM_freeN(kb->weights);
|
||||
@@ -1302,8 +1302,8 @@ static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int
|
||||
/* returns key coordinates (+ tilt) when key applied, NULL otherwise */
|
||||
float *do_ob_key(Scene *scene, Object *ob)
|
||||
{
|
||||
Key *key = ob_get_key(ob);
|
||||
KeyBlock *actkb = ob_get_keyblock(ob);
|
||||
Key *key = BKE_key_from_object(ob);
|
||||
KeyBlock *actkb = BKE_keyblock_from_object(ob);
|
||||
char *out;
|
||||
int tot = 0, size = 0;
|
||||
|
||||
@@ -1386,7 +1386,7 @@ float *do_ob_key(Scene *scene, Object *ob)
|
||||
return (float *)out;
|
||||
}
|
||||
|
||||
Key *ob_get_key(Object *ob)
|
||||
Key *BKE_key_from_object(Object *ob)
|
||||
{
|
||||
if (ob == NULL) return NULL;
|
||||
|
||||
@@ -1405,7 +1405,7 @@ Key *ob_get_key(Object *ob)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
KeyBlock *add_keyblock(Key *key, const char *name)
|
||||
KeyBlock *BKE_keyblock_add(Key *key, const char *name)
|
||||
{
|
||||
KeyBlock *kb;
|
||||
float curpos = -0.1;
|
||||
@@ -1439,7 +1439,7 @@ KeyBlock *add_keyblock(Key *key, const char *name)
|
||||
|
||||
/**
|
||||
* \note caller may want to set this to current time, but don't do it here since we need to sort
|
||||
* which could cause problems in some cases, see #add_keyblock_ctime */
|
||||
* which could cause problems in some cases, see #BKE_keyblock_add_ctime */
|
||||
kb->pos = curpos + 0.1f; /* only used for absolute shape keys */
|
||||
|
||||
return kb;
|
||||
@@ -1453,22 +1453,22 @@ KeyBlock *add_keyblock(Key *key, const char *name)
|
||||
* \param name Optional name for the new keyblock.
|
||||
* \param do_force always use ctime even for relative keys.
|
||||
*/
|
||||
KeyBlock *add_keyblock_ctime(Key *key, const char *name, const short do_force)
|
||||
KeyBlock *BKE_keyblock_add_ctime(Key *key, const char *name, const short do_force)
|
||||
{
|
||||
KeyBlock *kb = add_keyblock(key, name);
|
||||
KeyBlock *kb = BKE_keyblock_add(key, name);
|
||||
|
||||
if (do_force || (key->type != KEY_RELATIVE)) {
|
||||
kb->pos = key->ctime / 100.0f;
|
||||
sort_keys(key);
|
||||
BKE_key_sort(key);
|
||||
}
|
||||
|
||||
return kb;
|
||||
}
|
||||
|
||||
/* only the active keyblock */
|
||||
KeyBlock *ob_get_keyblock(Object *ob)
|
||||
KeyBlock *BKE_keyblock_from_object(Object *ob)
|
||||
{
|
||||
Key *key = ob_get_key(ob);
|
||||
Key *key = BKE_key_from_object(ob);
|
||||
|
||||
if (key) {
|
||||
KeyBlock *kb = BLI_findlink(&key->block, ob->shapenr - 1);
|
||||
@@ -1478,9 +1478,9 @@ KeyBlock *ob_get_keyblock(Object *ob)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
KeyBlock *ob_get_reference_keyblock(Object *ob)
|
||||
KeyBlock *BKE_keyblock_from_object_reference(Object *ob)
|
||||
{
|
||||
Key *key = ob_get_key(ob);
|
||||
Key *key = BKE_key_from_object(ob);
|
||||
|
||||
if (key)
|
||||
return key->refkey;
|
||||
@@ -1489,7 +1489,7 @@ KeyBlock *ob_get_reference_keyblock(Object *ob)
|
||||
}
|
||||
|
||||
/* get the appropriate KeyBlock given an index */
|
||||
KeyBlock *key_get_keyblock(Key *key, int index)
|
||||
KeyBlock *BKE_keyblock_from_key(Key *key, int index)
|
||||
{
|
||||
KeyBlock *kb;
|
||||
int i;
|
||||
@@ -1509,7 +1509,7 @@ KeyBlock *key_get_keyblock(Key *key, int index)
|
||||
}
|
||||
|
||||
/* get the appropriate KeyBlock given a name to search for */
|
||||
KeyBlock *key_get_named_keyblock(Key *key, const char name[])
|
||||
KeyBlock *BKE_keyblock_find_name(Key *key, const char name[])
|
||||
{
|
||||
if (key && name)
|
||||
return BLI_findstring(&key->block, name, offsetof(KeyBlock, name));
|
||||
@@ -1520,7 +1520,7 @@ KeyBlock *key_get_named_keyblock(Key *key, const char name[])
|
||||
/* Get RNA-Path for 'value' setting of the given ShapeKey
|
||||
* NOTE: the user needs to free the returned string once they're finish with it
|
||||
*/
|
||||
char *key_get_curValue_rnaPath(Key *key, KeyBlock *kb)
|
||||
char *BKE_keyblock_curval_rnapath_get(Key *key, KeyBlock *kb)
|
||||
{
|
||||
PointerRNA ptr;
|
||||
PropertyRNA *prop;
|
||||
@@ -1542,7 +1542,7 @@ char *key_get_curValue_rnaPath(Key *key, KeyBlock *kb)
|
||||
/* conversion functions */
|
||||
|
||||
/************************* Lattice ************************/
|
||||
void latt_to_key(Lattice *lt, KeyBlock *kb)
|
||||
void BKE_key_convert_from_lattice(Lattice *lt, KeyBlock *kb)
|
||||
{
|
||||
BPoint *bp;
|
||||
float *fp;
|
||||
@@ -1563,7 +1563,7 @@ void latt_to_key(Lattice *lt, KeyBlock *kb)
|
||||
}
|
||||
}
|
||||
|
||||
void key_to_latt(KeyBlock *kb, Lattice *lt)
|
||||
void BKE_key_convert_to_lattice(KeyBlock *kb, Lattice *lt)
|
||||
{
|
||||
BPoint *bp;
|
||||
float *fp;
|
||||
@@ -1581,7 +1581,7 @@ void key_to_latt(KeyBlock *kb, Lattice *lt)
|
||||
}
|
||||
|
||||
/************************* Curve ************************/
|
||||
void curve_to_key(Curve *cu, KeyBlock *kb, ListBase *nurb)
|
||||
void BKE_key_convert_from_curve(Curve *cu, KeyBlock *kb, ListBase *nurb)
|
||||
{
|
||||
Nurb *nu;
|
||||
BezTriple *bezt;
|
||||
@@ -1632,7 +1632,7 @@ void curve_to_key(Curve *cu, KeyBlock *kb, ListBase *nurb)
|
||||
}
|
||||
}
|
||||
|
||||
void key_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb)
|
||||
void BKE_key_convert_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb)
|
||||
{
|
||||
Nurb *nu;
|
||||
BezTriple *bezt;
|
||||
@@ -1683,7 +1683,7 @@ void key_to_curve(KeyBlock *kb, Curve *UNUSED(cu), ListBase *nurb)
|
||||
}
|
||||
|
||||
/************************* Mesh ************************/
|
||||
void mesh_to_key(Mesh *me, KeyBlock *kb)
|
||||
void BKE_key_convert_from_mesh(Mesh *me, KeyBlock *kb)
|
||||
{
|
||||
MVert *mvert;
|
||||
float *fp;
|
||||
@@ -1704,7 +1704,7 @@ void mesh_to_key(Mesh *me, KeyBlock *kb)
|
||||
}
|
||||
}
|
||||
|
||||
void key_to_mesh(KeyBlock *kb, Mesh *me)
|
||||
void BKE_key_convert_to_mesh(KeyBlock *kb, Mesh *me)
|
||||
{
|
||||
MVert *mvert;
|
||||
float *fp;
|
||||
@@ -1721,7 +1721,7 @@ void key_to_mesh(KeyBlock *kb, Mesh *me)
|
||||
}
|
||||
|
||||
/************************* vert coords ************************/
|
||||
float (*key_to_vertcos(Object * ob, KeyBlock * kb))[3]
|
||||
float (*BKE_key_convert_to_vertcos(Object * ob, KeyBlock * kb))[3]
|
||||
{
|
||||
float (*vertCos)[3], *co;
|
||||
float *fp = kb->data;
|
||||
@@ -1743,7 +1743,7 @@ float (*key_to_vertcos(Object * ob, KeyBlock * kb))[3]
|
||||
|
||||
if (tot == 0) return NULL;
|
||||
|
||||
vertCos = MEM_callocN(tot * sizeof(*vertCos), "key_to_vertcos vertCos");
|
||||
vertCos = MEM_callocN(tot * sizeof(*vertCos), "BKE_key_convert_to_vertcos vertCos");
|
||||
|
||||
/* Copy coords to array */
|
||||
co = (float *)vertCos;
|
||||
@@ -1797,7 +1797,7 @@ float (*key_to_vertcos(Object * ob, KeyBlock * kb))[3]
|
||||
return vertCos;
|
||||
}
|
||||
|
||||
void vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
|
||||
void BKE_key_convert_from_vertcos(Object *ob, KeyBlock *kb, float (*vertCos)[3])
|
||||
{
|
||||
float *co = (float *)vertCos, *fp;
|
||||
int tot = 0, a, elemsize;
|
||||
@@ -1826,7 +1826,7 @@ void vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
|
||||
return;
|
||||
}
|
||||
|
||||
fp = kb->data = MEM_callocN(tot * elemsize, "key_to_vertcos vertCos");
|
||||
fp = kb->data = MEM_callocN(tot * elemsize, "BKE_key_convert_to_vertcos vertCos");
|
||||
|
||||
/* Copy coords to keyblock */
|
||||
|
||||
@@ -1877,7 +1877,7 @@ void vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
|
||||
}
|
||||
}
|
||||
|
||||
void offset_to_key(Object *ob, KeyBlock *kb, float (*ofs)[3])
|
||||
void BKE_key_convert_from_offset(Object *ob, KeyBlock *kb, float (*ofs)[3])
|
||||
{
|
||||
int a;
|
||||
float *co = (float *)ofs, *fp = kb->data;
|
||||
|
||||
@@ -482,7 +482,7 @@ ModifierData *modifiers_getVirtualModifierList(Object *ob)
|
||||
}
|
||||
|
||||
/* shape key modifier, not yet for curves */
|
||||
if (ELEM(ob->type, OB_MESH, OB_LATTICE) && ob_get_key(ob)) {
|
||||
if (ELEM(ob->type, OB_MESH, OB_LATTICE) && BKE_key_from_object(ob)) {
|
||||
if (ob->type == OB_MESH && (ob->shapeflag & OB_SHAPE_EDIT_MODE))
|
||||
smd.modifier.mode |= eModifierMode_Editmode | eModifierMode_OnCage;
|
||||
else
|
||||
|
||||
@@ -2868,22 +2868,22 @@ static KeyBlock *insert_meshkey(Scene *scene, Object *ob, const char *name, int
|
||||
int newkey = 0;
|
||||
|
||||
if (key == NULL) {
|
||||
key = me->key = add_key((ID *)me);
|
||||
key = me->key = BKE_key_add((ID *)me);
|
||||
key->type = KEY_RELATIVE;
|
||||
newkey = 1;
|
||||
}
|
||||
|
||||
if (newkey || from_mix == FALSE) {
|
||||
/* create from mesh */
|
||||
kb = add_keyblock_ctime(key, name, FALSE);
|
||||
mesh_to_key(me, kb);
|
||||
kb = BKE_keyblock_add_ctime(key, name, FALSE);
|
||||
BKE_key_convert_from_mesh(me, kb);
|
||||
}
|
||||
else {
|
||||
/* copy from current values */
|
||||
float *data = do_ob_key(scene, ob);
|
||||
|
||||
/* create new block with prepared data */
|
||||
kb = add_keyblock_ctime(key, name, FALSE);
|
||||
kb = BKE_keyblock_add_ctime(key, name, FALSE);
|
||||
kb->data = data;
|
||||
kb->totelem = me->totvert;
|
||||
}
|
||||
@@ -2899,20 +2899,20 @@ static KeyBlock *insert_lattkey(Scene *scene, Object *ob, const char *name, int
|
||||
int newkey = 0;
|
||||
|
||||
if (key == NULL) {
|
||||
key = lt->key = add_key((ID *)lt);
|
||||
key = lt->key = BKE_key_add((ID *)lt);
|
||||
key->type = KEY_RELATIVE;
|
||||
newkey = 1;
|
||||
}
|
||||
|
||||
if (newkey || from_mix == FALSE) {
|
||||
kb = add_keyblock_ctime(key, name, FALSE);
|
||||
kb = BKE_keyblock_add_ctime(key, name, FALSE);
|
||||
if (!newkey) {
|
||||
KeyBlock *basekb = (KeyBlock *)key->block.first;
|
||||
kb->data = MEM_dupallocN(basekb->data);
|
||||
kb->totelem = basekb->totelem;
|
||||
}
|
||||
else {
|
||||
latt_to_key(lt, kb);
|
||||
BKE_key_convert_from_lattice(lt, kb);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -2920,7 +2920,7 @@ static KeyBlock *insert_lattkey(Scene *scene, Object *ob, const char *name, int
|
||||
float *data = do_ob_key(scene, ob);
|
||||
|
||||
/* create new block with prepared data */
|
||||
kb = add_keyblock_ctime(key, name, FALSE);
|
||||
kb = BKE_keyblock_add_ctime(key, name, FALSE);
|
||||
kb->totelem = lt->pntsu * lt->pntsv * lt->pntsw;
|
||||
kb->data = data;
|
||||
}
|
||||
@@ -2937,21 +2937,21 @@ static KeyBlock *insert_curvekey(Scene *scene, Object *ob, const char *name, int
|
||||
int newkey = 0;
|
||||
|
||||
if (key == NULL) {
|
||||
key = cu->key = add_key((ID *)cu);
|
||||
key = cu->key = BKE_key_add((ID *)cu);
|
||||
key->type = KEY_RELATIVE;
|
||||
newkey = 1;
|
||||
}
|
||||
|
||||
if (newkey || from_mix == FALSE) {
|
||||
/* create from curve */
|
||||
kb = add_keyblock_ctime(key, name, FALSE);
|
||||
kb = BKE_keyblock_add_ctime(key, name, FALSE);
|
||||
if (!newkey) {
|
||||
KeyBlock *basekb = (KeyBlock *)key->block.first;
|
||||
kb->data = MEM_dupallocN(basekb->data);
|
||||
kb->totelem = basekb->totelem;
|
||||
}
|
||||
else {
|
||||
curve_to_key(cu, kb, lb);
|
||||
BKE_key_convert_from_curve(cu, kb, lb);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -2959,7 +2959,7 @@ static KeyBlock *insert_curvekey(Scene *scene, Object *ob, const char *name, int
|
||||
float *data = do_ob_key(scene, ob);
|
||||
|
||||
/* create new block with prepared data */
|
||||
kb = add_keyblock_ctime(key, name, FALSE);
|
||||
kb = BKE_keyblock_add_ctime(key, name, FALSE);
|
||||
kb->totelem = BKE_nurbList_verts_count(lb);
|
||||
kb->data = data;
|
||||
}
|
||||
@@ -2989,7 +2989,7 @@ int BKE_object_is_modified(Scene *scene, Object *ob)
|
||||
{
|
||||
int flag = 0;
|
||||
|
||||
if (ob_get_key(ob)) {
|
||||
if (BKE_key_from_object(ob)) {
|
||||
flag |= eModifierMode_Render;
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -424,7 +424,7 @@ static void bm_loop_interp_mdisps(BMesh *bm, BMLoop *target, BMFace *source)
|
||||
float axis_x[3], axis_y[3];
|
||||
|
||||
/* ignore 2-edged faces */
|
||||
if (target->f->len < 3)
|
||||
if (UNLIKELY(target->f->len < 3))
|
||||
return;
|
||||
|
||||
if (!CustomData_has_layer(&bm->ldata, CD_MDISPS))
|
||||
|
||||
@@ -672,7 +672,7 @@ void BM_editselection_plane(BMEditSelection *ese, float r_plane[3])
|
||||
* we cant make a crossvec from a vec thats the same as the vec
|
||||
* unlikely but possible, so make sure if the normal is (0, 0, 1)
|
||||
* that vec isn't the same or in the same direction even. */
|
||||
if (efa->len < 3) {
|
||||
if (UNLIKELY(efa->len < 3)) {
|
||||
/* crappy fallback method */
|
||||
if (efa->no[0] < 0.5f) vec[0] = 1.0f;
|
||||
else if (efa->no[1] < 0.5f) vec[1] = 1.0f;
|
||||
|
||||
@@ -758,7 +758,7 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, int dotess)
|
||||
}
|
||||
|
||||
if (!currkey) {
|
||||
currkey = add_keyblock(me->key, bm->vdata.layers[i].name);
|
||||
currkey = BKE_keyblock_add(me->key, bm->vdata.layers[i].name);
|
||||
currkey->uid = bm->vdata.layers[i].uid;
|
||||
}
|
||||
|
||||
|
||||
@@ -558,7 +558,7 @@ BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac,
|
||||
/* cant kill data we loop on, build a list and remove those */
|
||||
BLI_array_empty(bad_faces);
|
||||
BM_ITER_ELEM (f, &fiter, verts[i], BM_FACES_OF_VERT) {
|
||||
if (f->len < 3) {
|
||||
if (UNLIKELY(f->len < 3)) {
|
||||
BLI_array_append(bad_faces, f);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3196,7 +3196,7 @@ static void achannel_setting_slider_shapekey_cb(bContext *C, void *key_poin, voi
|
||||
{
|
||||
Key *key = (Key *)key_poin;
|
||||
KeyBlock *kb = (KeyBlock *)kb_poin;
|
||||
char *rna_path = key_get_curValue_rnaPath(key, kb);
|
||||
char *rna_path = BKE_keyblock_curval_rnapath_get(key, kb);
|
||||
|
||||
ReportList *reports = CTX_wm_reports(C);
|
||||
Scene *scene = CTX_data_scene(C);
|
||||
@@ -3503,7 +3503,7 @@ void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale
|
||||
KeyBlock *kb = (KeyBlock *)ale->data;
|
||||
Key *key = (Key *)ale->id;
|
||||
|
||||
rna_path = key_get_curValue_rnaPath(key, kb);
|
||||
rna_path = BKE_keyblock_curval_rnapath_get(key, kb);
|
||||
free_path = 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
/* ----------- Private Stuff - Action Editor ------------- */
|
||||
|
||||
/* Get shapekey data being edited (for Action Editor -> ShapeKey mode) */
|
||||
/* Note: there's a similar function in key.c (ob_get_key) */
|
||||
/* Note: there's a similar function in key.c (BKE_key_from_object) */
|
||||
static Key *actedit_get_shapekeys(bAnimContext *ac)
|
||||
{
|
||||
Scene *scene = ac->scene;
|
||||
@@ -114,7 +114,7 @@ static Key *actedit_get_shapekeys(bAnimContext *ac)
|
||||
//if (saction->pin) return NULL;
|
||||
|
||||
/* shapekey data is stored with geometry data */
|
||||
key = ob_get_key(ob);
|
||||
key = BKE_key_from_object(ob);
|
||||
|
||||
if (key) {
|
||||
if (key->type == KEY_RELATIVE)
|
||||
@@ -799,7 +799,7 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
|
||||
/* the corresponding keyframes are from the animdata */
|
||||
if (ale->adt && ale->adt->action) {
|
||||
bAction *act = ale->adt->action;
|
||||
char *rna_path = key_get_curValue_rnaPath(key, kb);
|
||||
char *rna_path = BKE_keyblock_curval_rnapath_get(key, kb);
|
||||
|
||||
/* try to find the F-Curve which corresponds to this exactly,
|
||||
* then free the MEM_alloc'd string
|
||||
@@ -1940,7 +1940,7 @@ static size_t animdata_filter_dopesheet_ob(bAnimContext *ac, ListBase *anim_data
|
||||
/* filter data contained under object first */
|
||||
BEGIN_ANIMFILTER_SUBCHANNELS(EXPANDED_OBJC(ob))
|
||||
{
|
||||
Key *key = ob_get_key(ob);
|
||||
Key *key = BKE_key_from_object(ob);
|
||||
|
||||
/* object-level animation */
|
||||
if ((ob->adt) && !(ads->filterflag & ADS_FILTER_NOOBJ)) {
|
||||
|
||||
@@ -1836,7 +1836,7 @@ static short object_frame_has_keyframe(Object *ob, float frame, short filter)
|
||||
|
||||
/* try shapekey keyframes (if available, and allowed by filter) */
|
||||
if (!(filter & ANIMFILTER_KEYS_LOCAL) && !(filter & ANIMFILTER_KEYS_NOSKEY) ) {
|
||||
Key *key = ob_get_key(ob);
|
||||
Key *key = BKE_key_from_object(ob);
|
||||
|
||||
/* shapekeys can have keyframes ('Relative Shape Keys')
|
||||
* or depend on time (old 'Absolute Shape Keys')
|
||||
|
||||
@@ -1233,12 +1233,12 @@ void make_editNurb(Object *obedit)
|
||||
set_actNurb(obedit, NULL);
|
||||
|
||||
if (ELEM(obedit->type, OB_CURVE, OB_SURF)) {
|
||||
actkey = ob_get_keyblock(obedit);
|
||||
actkey = BKE_keyblock_from_object(obedit);
|
||||
|
||||
if (actkey) {
|
||||
// XXX strcpy(G.editModeTitleExtra, "(Key) ");
|
||||
undo_editmode_clear();
|
||||
key_to_curve(actkey, cu, &cu->nurb);
|
||||
BKE_key_convert_to_curve(actkey, cu, &cu->nurb);
|
||||
}
|
||||
|
||||
if (editnurb) {
|
||||
|
||||
@@ -556,7 +556,7 @@ static void *editbtMesh_to_undoMesh(void *emv, void *obdata)
|
||||
UndoMesh *um = MEM_callocN(sizeof(UndoMesh), "undo Mesh");
|
||||
|
||||
/* make sure shape keys work */
|
||||
um->me.key = obme->key ? copy_key_nolib(obme->key) : NULL;
|
||||
um->me.key = obme->key ? BKE_key_copy_nolib(obme->key) : NULL;
|
||||
|
||||
/* BM_mesh_validate(em->bm); */ /* for troubleshooting */
|
||||
|
||||
|
||||
@@ -196,7 +196,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
else if (haskey) {
|
||||
/* add a new key-block and add to the mesh */
|
||||
key = me->key = add_key((ID *)me);
|
||||
key = me->key = BKE_key_add((ID *)me);
|
||||
key->type = KEY_RELATIVE;
|
||||
}
|
||||
|
||||
@@ -245,8 +245,8 @@ int join_mesh_exec(bContext *C, wmOperator *op)
|
||||
if (me->key && key) {
|
||||
for (kb = me->key->block.first; kb; kb = kb->next) {
|
||||
/* if key doesn't exist in destination mesh, add it */
|
||||
if (key_get_named_keyblock(key, kb->name) == NULL) {
|
||||
kbn = add_keyblock(key, kb->name);
|
||||
if (BKE_keyblock_find_name(key, kb->name) == NULL) {
|
||||
kbn = BKE_keyblock_add(key, kb->name);
|
||||
|
||||
/* copy most settings */
|
||||
kbn->pos = kb->pos;
|
||||
@@ -351,7 +351,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
|
||||
fp1 = ((float *)kb->data) + (vertofs * 3);
|
||||
|
||||
/* check if this mesh has such a shapekey */
|
||||
okb = key_get_named_keyblock(me->key, kb->name);
|
||||
okb = BKE_keyblock_find_name(me->key, kb->name);
|
||||
if (okb) {
|
||||
/* copy this mesh's shapekey to the destination shapekey (need to transform first) */
|
||||
fp2 = ((float *)(okb->data));
|
||||
@@ -381,7 +381,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
|
||||
fp1 = ((float *)kb->data) + (vertofs * 3);
|
||||
|
||||
/* check if this was one of the original shapekeys */
|
||||
okb = key_get_named_keyblock(nkey, kb->name);
|
||||
okb = BKE_keyblock_find_name(nkey, kb->name);
|
||||
if (okb) {
|
||||
/* copy this mesh's shapekey to the destination shapekey */
|
||||
fp2 = ((float *)(okb->data));
|
||||
@@ -602,12 +602,12 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op)
|
||||
}
|
||||
|
||||
if (key == NULL) {
|
||||
key = me->key = add_key((ID *)me);
|
||||
key = me->key = BKE_key_add((ID *)me);
|
||||
key->type = KEY_RELATIVE;
|
||||
|
||||
/* first key added, so it was the basis. initialize it with the existing mesh */
|
||||
kb = add_keyblock(key, NULL);
|
||||
mesh_to_key(me, kb);
|
||||
kb = BKE_keyblock_add(key, NULL);
|
||||
BKE_key_convert_from_mesh(me, kb);
|
||||
}
|
||||
|
||||
/* now ready to add new keys from selected meshes */
|
||||
@@ -623,7 +623,7 @@ int join_mesh_shapes_exec(bContext *C, wmOperator *op)
|
||||
|
||||
if (!dm) continue;
|
||||
|
||||
kb = add_keyblock(key, base->object->id.name + 2);
|
||||
kb = BKE_keyblock_add(key, base->object->id.name + 2);
|
||||
|
||||
DM_to_meshkey(dm, me, kb);
|
||||
|
||||
|
||||
@@ -1826,7 +1826,7 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
|
||||
|
||||
/* check if obdata is copied */
|
||||
if (didit) {
|
||||
Key *key = ob_get_key(obn);
|
||||
Key *key = BKE_key_from_object(obn);
|
||||
|
||||
if (dupflag & USER_DUP_ACT) {
|
||||
bActuator *act;
|
||||
|
||||
@@ -92,9 +92,9 @@ void make_editLatt(Object *obedit)
|
||||
|
||||
free_editLatt(obedit);
|
||||
|
||||
actkey = ob_get_keyblock(obedit);
|
||||
actkey = BKE_keyblock_from_object(obedit);
|
||||
if (actkey)
|
||||
key_to_latt(actkey, lt);
|
||||
BKE_key_convert_to_lattice(actkey, lt);
|
||||
|
||||
lt->editlatt = MEM_callocN(sizeof(EditLatt), "editlatt");
|
||||
lt->editlatt->latt = MEM_dupallocN(lt);
|
||||
|
||||
@@ -565,15 +565,15 @@ static int modifier_apply_shape(ReportList *reports, Scene *scene, Object *ob, M
|
||||
}
|
||||
|
||||
if (key == NULL) {
|
||||
key = me->key = add_key((ID *)me);
|
||||
key = me->key = BKE_key_add((ID *)me);
|
||||
key->type = KEY_RELATIVE;
|
||||
/* 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 = add_keyblock(key, NULL);
|
||||
mesh_to_key(me, kb);
|
||||
kb = BKE_keyblock_add(key, NULL);
|
||||
BKE_key_convert_from_mesh(me, kb);
|
||||
}
|
||||
|
||||
kb = add_keyblock(key, md->name);
|
||||
kb = BKE_keyblock_add(key, md->name);
|
||||
DM_to_meshkey(dm, me, kb);
|
||||
|
||||
dm->release(dm);
|
||||
|
||||
@@ -78,7 +78,7 @@ static void ED_object_shape_key_add(bContext *C, Scene *scene, Object *ob, int f
|
||||
{
|
||||
KeyBlock *kb;
|
||||
if ((kb = BKE_object_insert_shape_key(scene, ob, NULL, from_mix))) {
|
||||
Key *key = ob_get_key(ob);
|
||||
Key *key = BKE_key_from_object(ob);
|
||||
/* for absolute shape keys, new keys may not be added last */
|
||||
ob->shapenr = BLI_findindex(&key->block, kb) + 1;
|
||||
|
||||
@@ -95,7 +95,7 @@ static int ED_object_shape_key_remove(bContext *C, Object *ob)
|
||||
Key *key;
|
||||
//IpoCurve *icu;
|
||||
|
||||
key = ob_get_key(ob);
|
||||
key = BKE_key_from_object(ob);
|
||||
if (key == NULL)
|
||||
return 0;
|
||||
|
||||
@@ -115,14 +115,14 @@ static int ED_object_shape_key_remove(bContext *C, Object *ob)
|
||||
/* apply new basis key on original data */
|
||||
switch (ob->type) {
|
||||
case OB_MESH:
|
||||
key_to_mesh(key->refkey, ob->data);
|
||||
BKE_key_convert_to_mesh(key->refkey, ob->data);
|
||||
break;
|
||||
case OB_CURVE:
|
||||
case OB_SURF:
|
||||
key_to_curve(key->refkey, ob->data, BKE_curve_nurbs_get(ob->data));
|
||||
BKE_key_convert_to_curve(key->refkey, ob->data, BKE_curve_nurbs_get(ob->data));
|
||||
break;
|
||||
case OB_LATTICE:
|
||||
key_to_latt(key->refkey, ob->data);
|
||||
BKE_key_convert_to_lattice(key->refkey, ob->data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -155,7 +155,7 @@ static int object_shape_key_mirror(bContext *C, Object *ob)
|
||||
KeyBlock *kb;
|
||||
Key *key;
|
||||
|
||||
key = ob_get_key(ob);
|
||||
key = BKE_key_from_object(ob);
|
||||
if (key == NULL)
|
||||
return 0;
|
||||
|
||||
@@ -323,8 +323,8 @@ void OBJECT_OT_shape_key_remove(wmOperatorType *ot)
|
||||
static int shape_key_clear_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Key *key = ob_get_key(ob);
|
||||
KeyBlock *kb = ob_get_keyblock(ob);
|
||||
Key *key = BKE_key_from_object(ob);
|
||||
KeyBlock *kb = BKE_keyblock_from_object(ob);
|
||||
|
||||
if (!key || !kb)
|
||||
return OPERATOR_CANCELLED;
|
||||
@@ -357,8 +357,8 @@ void OBJECT_OT_shape_key_clear(wmOperatorType *ot)
|
||||
static int shape_key_retime_exec(bContext *C, wmOperator *UNUSED(op))
|
||||
{
|
||||
Object *ob = ED_object_context(C);
|
||||
Key *key = ob_get_key(ob);
|
||||
KeyBlock *kb = ob_get_keyblock(ob);
|
||||
Key *key = BKE_key_from_object(ob);
|
||||
KeyBlock *kb = BKE_keyblock_from_object(ob);
|
||||
float cfra = 0.0f;
|
||||
|
||||
if (!key || !kb)
|
||||
@@ -419,7 +419,7 @@ static int shape_key_move_exec(bContext *C, wmOperator *op)
|
||||
Object *ob = ED_object_context(C);
|
||||
|
||||
int type = RNA_enum_get(op->ptr, "type");
|
||||
Key *key = ob_get_key(ob);
|
||||
Key *key = BKE_key_from_object(ob);
|
||||
|
||||
if (key) {
|
||||
KeyBlock *kb, *kb_other;
|
||||
|
||||
@@ -2649,7 +2649,7 @@ void sculpt_vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
|
||||
}
|
||||
|
||||
if (is_basis) {
|
||||
ofs = key_to_vertcos(ob, kb);
|
||||
ofs = BKE_key_convert_to_vertcos(ob, kb);
|
||||
|
||||
/* calculate key coord offsets (from previous location) */
|
||||
for (a = 0; a < me->totvert; a++) {
|
||||
@@ -2662,7 +2662,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)
|
||||
offset_to_key(ob, currkey, ofs);
|
||||
BKE_key_convert_from_offset(ob, currkey, ofs);
|
||||
|
||||
currkey = currkey->next;
|
||||
}
|
||||
@@ -2683,7 +2683,7 @@ void sculpt_vertcos_to_key(Object *ob, KeyBlock *kb, float (*vertCos)[3])
|
||||
}
|
||||
|
||||
/* apply new coords on active key block */
|
||||
vertcos_to_key(ob, kb, vertCos);
|
||||
BKE_key_convert_from_vertcos(ob, kb, vertCos);
|
||||
}
|
||||
|
||||
static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush)
|
||||
@@ -3074,7 +3074,7 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob, int need_
|
||||
/* BMESH ONLY --- at some point we should move sculpt code to use polygons only - but for now it needs tessfaces */
|
||||
BKE_mesh_tessface_ensure(me);
|
||||
|
||||
if (!mmd) ss->kb = ob_get_keyblock(ob);
|
||||
if (!mmd) ss->kb = BKE_keyblock_from_object(ob);
|
||||
else ss->kb = NULL;
|
||||
|
||||
/* needs to be called after we ensure tessface */
|
||||
@@ -3109,7 +3109,7 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob, int need_
|
||||
|
||||
free_sculptsession_deformMats(ss);
|
||||
|
||||
ss->orig_cos = (ss->kb) ? key_to_vertcos(ob, ss->kb) : mesh_getVertexCos(me, NULL);
|
||||
ss->orig_cos = (ss->kb) ? BKE_key_convert_to_vertcos(ob, ss->kb) : mesh_getVertexCos(me, NULL);
|
||||
|
||||
crazyspace_build_sculpt(scene, ob, &ss->deform_imats, &ss->deform_cos);
|
||||
BLI_pbvh_apply_vertCos(ss->pbvh, ss->deform_cos);
|
||||
@@ -3123,7 +3123,7 @@ void sculpt_update_mesh_elements(Scene *scene, Sculpt *sd, Object *ob, int need_
|
||||
|
||||
/* if pbvh is deformed, key block is already applied to it */
|
||||
if (ss->kb && !BLI_pbvh_isDeformed(ss->pbvh)) {
|
||||
float (*vertCos)[3] = key_to_vertcos(ob, ss->kb);
|
||||
float (*vertCos)[3] = BKE_key_convert_to_vertcos(ob, ss->kb);
|
||||
|
||||
if (vertCos) {
|
||||
/* apply shape keys coordinates to PBVH */
|
||||
|
||||
@@ -107,8 +107,8 @@ static int sculpt_undo_restore_coords(bContext *C, DerivedMesh *dm, SculptUndoNo
|
||||
if (ss->kb && strcmp(ss->kb->name, unode->shapeName)) {
|
||||
/* shape key has been changed before calling undo operator */
|
||||
|
||||
Key *key = ob_get_key(ob);
|
||||
KeyBlock *kb = key_get_named_keyblock(key, unode->shapeName);
|
||||
Key *key = BKE_key_from_object(ob);
|
||||
KeyBlock *kb = BKE_keyblock_find_name(key, unode->shapeName);
|
||||
|
||||
if (kb) {
|
||||
ob->shapenr = BLI_findindex(&key->block, kb) + 1;
|
||||
@@ -127,7 +127,7 @@ static int sculpt_undo_restore_coords(bContext *C, DerivedMesh *dm, SculptUndoNo
|
||||
|
||||
if (ss->kb) {
|
||||
float (*vertCos)[3];
|
||||
vertCos = key_to_vertcos(ob, ss->kb);
|
||||
vertCos = BKE_key_convert_to_vertcos(ob, ss->kb);
|
||||
|
||||
for (i = 0; i < unode->totvert; i++) {
|
||||
if (ss->modifiers_active) sculpt_undo_restore_deformed(ss, unode, i, index[i], vertCos[index[i]]);
|
||||
|
||||
@@ -368,7 +368,7 @@ static void stats_string(Scene *scene)
|
||||
s += sprintf(s, "%s | ", versionstr);
|
||||
|
||||
if (scene->obedit) {
|
||||
if (ob_get_keyblock(scene->obedit))
|
||||
if (BKE_keyblock_from_object(scene->obedit))
|
||||
s += sprintf(s, "(Key) ");
|
||||
|
||||
if (scene->obedit->type == OB_MESH) {
|
||||
|
||||
@@ -3620,7 +3620,7 @@ static int draw_mesh_object(Scene *scene, ARegion *ar, View3D *v3d, RegionView3D
|
||||
}
|
||||
|
||||
if (obedit && ob != obedit && ob->data == obedit->data) {
|
||||
if (ob_get_key(ob) || ob_get_key(obedit)) {}
|
||||
if (BKE_key_from_object(ob) || BKE_key_from_object(obedit)) {}
|
||||
else if (ob->modifiers.first || obedit->modifiers.first) {}
|
||||
else drawlinked = 1;
|
||||
}
|
||||
|
||||
@@ -901,7 +901,7 @@ static void draw_selected_name(Scene *scene, Object *ob)
|
||||
|
||||
/* try to display active shapekey too */
|
||||
shapes[0] = '\0';
|
||||
key = ob_get_key(ob);
|
||||
key = BKE_key_from_object(ob);
|
||||
if (key) {
|
||||
kb = BLI_findlink(&key->block, ob->shapenr - 1);
|
||||
if (kb) {
|
||||
|
||||
@@ -5170,7 +5170,7 @@ void special_aftertrans_update(bContext *C, TransInfo *t)
|
||||
/* Depending on the lock status, draw necessary views */
|
||||
// fixme... some of this stuff is not good
|
||||
if (ob) {
|
||||
if (ob->pose || ob_get_key(ob))
|
||||
if (ob->pose || BKE_key_from_object(ob))
|
||||
DAG_id_tag_update(&ob->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
|
||||
else
|
||||
DAG_id_tag_update(&ob->id, OB_RECALC_OB);
|
||||
|
||||
@@ -61,7 +61,7 @@ static Key *rna_ShapeKey_find_key(ID *id)
|
||||
case ID_KE: return (Key *)id;
|
||||
case ID_LT: return ((Lattice *)id)->key;
|
||||
case ID_ME: return ((Mesh *)id)->key;
|
||||
case ID_OB: return ob_get_key((Object *)id);
|
||||
case ID_OB: return BKE_key_from_object((Object *)id);
|
||||
default: return NULL;
|
||||
}
|
||||
}
|
||||
@@ -360,7 +360,7 @@ static void rna_Key_update_data(Main *bmain, Scene *UNUSED(scene), PointerRNA *p
|
||||
Object *ob;
|
||||
|
||||
for (ob = bmain->object.first; ob; ob = ob->id.next) {
|
||||
if (ob_get_key(ob) == key) {
|
||||
if (BKE_key_from_object(ob) == key) {
|
||||
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
|
||||
WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
|
||||
}
|
||||
|
||||
@@ -1101,7 +1101,7 @@ static void rna_GameObjectSettings_used_state_get(PointerRNA *ptr, int *values)
|
||||
static void rna_Object_active_shape_key_index_range(PointerRNA *ptr, int *min, int *max, int *softmin, int *softmax)
|
||||
{
|
||||
Object *ob = (Object *)ptr->id.data;
|
||||
Key *key = ob_get_key(ob);
|
||||
Key *key = BKE_key_from_object(ob);
|
||||
|
||||
*min = 0;
|
||||
if (key) {
|
||||
@@ -1130,7 +1130,7 @@ static void rna_Object_active_shape_key_index_set(PointerRNA *ptr, int value)
|
||||
static PointerRNA rna_Object_active_shape_key_get(PointerRNA *ptr)
|
||||
{
|
||||
Object *ob = (Object *)ptr->id.data;
|
||||
Key *key = ob_get_key(ob);
|
||||
Key *key = BKE_key_from_object(ob);
|
||||
KeyBlock *kb;
|
||||
PointerRNA keyptr;
|
||||
|
||||
|
||||
@@ -849,7 +849,7 @@ static void rna_SpaceDopeSheetEditor_action_update(Main *UNUSED(bmain), Scene *s
|
||||
adt = BKE_id_add_animdata(&obact->id); /* this only adds if non-existant */
|
||||
}
|
||||
else if (saction->mode == SACTCONT_SHAPEKEY) {
|
||||
Key *key = ob_get_key(obact);
|
||||
Key *key = BKE_key_from_object(obact);
|
||||
if (key)
|
||||
adt = BKE_id_add_animdata(&key->id); /* this only adds if non-existant */
|
||||
}
|
||||
@@ -876,7 +876,7 @@ static void rna_SpaceDopeSheetEditor_mode_update(Main *UNUSED(bmain), Scene *sce
|
||||
|
||||
/* special exceptions for ShapeKey Editor mode */
|
||||
if (saction->mode == SACTCONT_SHAPEKEY) {
|
||||
Key *key = ob_get_key(obact);
|
||||
Key *key = BKE_key_from_object(obact);
|
||||
|
||||
/* 1) update the action stored for the editor */
|
||||
if (key)
|
||||
|
||||
@@ -54,7 +54,7 @@ static void deformVerts(ModifierData *md, Object *ob,
|
||||
int numVerts,
|
||||
ModifierApplyFlag UNUSED(flag))
|
||||
{
|
||||
KeyBlock *kb = ob_get_keyblock(ob);
|
||||
KeyBlock *kb = BKE_keyblock_from_object(ob);
|
||||
float (*deformedVerts)[3];
|
||||
|
||||
if (kb && kb->totelem == numVerts) {
|
||||
@@ -69,8 +69,8 @@ static void deformVerts(ModifierData *md, Object *ob,
|
||||
static void deformMatrices(ModifierData *md, Object *ob, DerivedMesh *derivedData,
|
||||
float (*vertexCos)[3], float (*defMats)[3][3], int numVerts)
|
||||
{
|
||||
Key *key = ob_get_key(ob);
|
||||
KeyBlock *kb = ob_get_keyblock(ob);
|
||||
Key *key = BKE_key_from_object(ob);
|
||||
KeyBlock *kb = BKE_keyblock_from_object(ob);
|
||||
float scale[3][3];
|
||||
|
||||
(void)vertexCos; /* unused */
|
||||
@@ -94,7 +94,7 @@ static void deformVertsEM(ModifierData *md, Object *ob,
|
||||
float (*vertexCos)[3],
|
||||
int numVerts)
|
||||
{
|
||||
Key *key = ob_get_key(ob);
|
||||
Key *key = BKE_key_from_object(ob);
|
||||
|
||||
if (key && key->type == KEY_RELATIVE)
|
||||
deformVerts(md, ob, derivedData, vertexCos, numVerts, 0);
|
||||
@@ -107,8 +107,8 @@ static void deformMatricesEM(ModifierData *UNUSED(md), Object *ob,
|
||||
float (*defMats)[3][3],
|
||||
int numVerts)
|
||||
{
|
||||
Key *key = ob_get_key(ob);
|
||||
KeyBlock *kb = ob_get_keyblock(ob);
|
||||
Key *key = BKE_key_from_object(ob);
|
||||
KeyBlock *kb = BKE_keyblock_from_object(ob);
|
||||
float scale[3][3];
|
||||
|
||||
(void)vertexCos; /* unused */
|
||||
|
||||
@@ -173,7 +173,7 @@ bool BL_ShapeDeformer::Update(void)
|
||||
/* store verts locally */
|
||||
VerifyStorage();
|
||||
|
||||
do_rel_key(0, m_bmesh->totvert, m_bmesh->totvert, (char *)(float *)m_transverts, m_bmesh->key, NULL, 0); /* last arg is ignored */
|
||||
BKE_key_evaluate_relative(0, m_bmesh->totvert, m_bmesh->totvert, (char *)(float *)m_transverts, m_bmesh->key, NULL, 0); /* last arg is ignored */
|
||||
m_bDynamic = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user