code cleanup: remove unused KeyBlock.adrcode
This commit is contained in:
parent
7db13b989a
commit
405c9d9a95
|
@ -238,8 +238,6 @@ void make_local_key(Key *key)
|
|||
void sort_keys(Key *key)
|
||||
{
|
||||
KeyBlock *kb;
|
||||
//short i, adrcode;
|
||||
//IpoCurve *icu = NULL;
|
||||
KeyBlock *kb2;
|
||||
|
||||
/* locate the key which is out of position */
|
||||
|
@ -259,43 +257,6 @@ void sort_keys(Key *key)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* if more than one Ipo curve, see if this key had a curve */
|
||||
#if 0 // XXX old animation system
|
||||
if (key->ipo && key->ipo->curve.first != key->ipo->curve.last ) {
|
||||
for (icu= key->ipo->curve.first; icu; icu= icu->next) {
|
||||
/* if we find the curve, remove it and reinsert in the
|
||||
* right place */
|
||||
if (icu->adrcode==kb->adrcode) {
|
||||
IpoCurve *icu2;
|
||||
BLI_remlink(&key->ipo->curve, icu);
|
||||
for (icu2= key->ipo->curve.first; icu2; icu2= icu2->next) {
|
||||
if (icu2->adrcode >= kb2->adrcode) {
|
||||
BLI_insertlink(&key->ipo->curve, icu2->prev, icu);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* kb points at the moved key, icu at the moved ipo (if it exists).
|
||||
* go back now and renumber adrcodes */
|
||||
|
||||
/* first new code */
|
||||
adrcode = kb2->adrcode;
|
||||
for (i = kb->adrcode - adrcode; i >= 0; i--, adrcode++) {
|
||||
/* if the next ipo curve matches the current key, renumber it */
|
||||
if (icu && icu->adrcode == kb->adrcode ) {
|
||||
icu->adrcode = adrcode;
|
||||
icu = icu->next;
|
||||
}
|
||||
/* renumber the shape key */
|
||||
kb->adrcode = adrcode;
|
||||
kb = kb->next;
|
||||
}
|
||||
#endif // XXX old animation system
|
||||
}
|
||||
|
||||
/* new rule; first key is refkey, this to match drawing channels... */
|
||||
|
@ -1463,8 +1424,6 @@ KeyBlock *add_keyblock(Key *key, const char *name)
|
|||
|
||||
BLI_uniquename(&key->block, kb, "Key", '.', offsetof(KeyBlock, name), sizeof(kb->name));
|
||||
|
||||
// XXX this is old anim system stuff? (i.e. the 'index' of the shapekey)
|
||||
kb->adrcode= tot-1;
|
||||
kb->uid = key->uidgen++;
|
||||
|
||||
key->totkey++;
|
||||
|
|
|
@ -6612,31 +6612,6 @@ static void ntree_version_242(bNodeTree *ntree)
|
|||
|
||||
}
|
||||
|
||||
|
||||
/* somehow, probably importing via python, keyblock adrcodes are not in order */
|
||||
static void sort_shape_fix(Main *main)
|
||||
{
|
||||
Key *key;
|
||||
KeyBlock *kb;
|
||||
int sorted= 0;
|
||||
|
||||
while (sorted==0) {
|
||||
sorted= 1;
|
||||
for (key= main->key.first; key; key= key->id.next) {
|
||||
for (kb= key->block.first; kb; kb= kb->next) {
|
||||
if (kb->next && kb->adrcode>kb->next->adrcode) {
|
||||
KeyBlock *next= kb->next;
|
||||
BLI_remlink(&key->block, kb);
|
||||
BLI_insertlink(&key->block, next, kb);
|
||||
kb= next;
|
||||
sorted= 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (sorted==0) printf("warning, shape keys were sorted incorrect, fixed it!\n");
|
||||
}
|
||||
}
|
||||
|
||||
static void customdata_version_242(Mesh *me)
|
||||
{
|
||||
CustomDataLayer *layer;
|
||||
|
@ -9288,24 +9263,18 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
|||
|
||||
for (key= main->key.first; key; key= key->id.next) {
|
||||
KeyBlock *kb;
|
||||
int index= 1;
|
||||
|
||||
/* trick to find out if we already introduced adrcode */
|
||||
for (kb= key->block.first; kb; kb= kb->next)
|
||||
if (kb->adrcode) break;
|
||||
|
||||
if (kb==NULL) {
|
||||
for (kb= key->block.first; kb; kb= kb->next) {
|
||||
if (kb==key->refkey) {
|
||||
if (kb->name[0]==0)
|
||||
strcpy(kb->name, "Basis");
|
||||
}
|
||||
else {
|
||||
if (kb->name[0]==0) {
|
||||
BLI_snprintf(kb->name, sizeof(kb->name), "Key %d", index);
|
||||
}
|
||||
kb->adrcode= index++;
|
||||
int index = 1;
|
||||
|
||||
for (kb= key->block.first; kb; kb= kb->next) {
|
||||
if (kb==key->refkey) {
|
||||
if (kb->name[0]==0)
|
||||
strcpy(kb->name, "Basis");
|
||||
}
|
||||
else {
|
||||
if (kb->name[0]==0) {
|
||||
BLI_snprintf(kb->name, sizeof(kb->name), "Key %d", index);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9660,10 +9629,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
|
|||
for (group= main->group.first; group; group= group->id.next)
|
||||
if (group->layer==0)
|
||||
group->layer= (1<<20)-1;
|
||||
|
||||
/* History fix (python?), shape key adrcode numbers have to be sorted */
|
||||
sort_shape_fix(main);
|
||||
|
||||
|
||||
/* now, subversion control! */
|
||||
if (main->subversionfile < 3) {
|
||||
Image *ima;
|
||||
|
|
|
@ -764,7 +764,7 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, int dotess)
|
|||
if ((me->key->type == KEY_RELATIVE) && /* only need offsets for relative shape keys */
|
||||
(actkey != NULL) && /* unlikely, but the active key may not be valid if the
|
||||
* bmesh and the mesh are out of sync */
|
||||
(oldverts != NULL)) /* not used here, but 'oldverts' is used later for applyig 'ofs' */
|
||||
(oldverts != NULL)) /* not used here, but 'oldverts' is used later for applying 'ofs' */
|
||||
{
|
||||
int act_is_basis = FALSE;
|
||||
|
||||
|
@ -780,15 +780,13 @@ void BM_mesh_bm_to_me(BMesh *bm, Mesh *me, int dotess)
|
|||
float (*fp)[3] = actkey->data;
|
||||
int *keyi;
|
||||
|
||||
i = 0;
|
||||
ofs = MEM_callocN(sizeof(float) * 3 * bm->totvert, "currkey->data");
|
||||
mvert = me->mvert;
|
||||
BM_ITER(eve, &iter, bm, BM_VERTS_OF_MESH, NULL) {
|
||||
BM_ITER_INDEX(eve, &iter, bm, BM_VERTS_OF_MESH, NULL, i) {
|
||||
keyi = CustomData_bmesh_get(&bm->vdata, eve->head.data, CD_SHAPE_KEYINDEX);
|
||||
if (keyi && *keyi != ORIGINDEX_NONE) {
|
||||
sub_v3_v3v3(ofs[i], mvert->co, fp[*keyi]);
|
||||
}
|
||||
i++;
|
||||
mvert++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -247,7 +247,7 @@ int join_mesh_exec(bContext *C, wmOperator *op)
|
|||
kbn = MEM_dupallocN(kb);
|
||||
kbn->prev = kbn->next = NULL;
|
||||
|
||||
/* adjust adrcode and other settings to fit (allocate a new data-array) */
|
||||
/* adjust settings to fit (allocate a new data-array) */
|
||||
kbn->data = MEM_callocN(sizeof(float) * 3 * totvert, "joined_shapekey");
|
||||
kbn->totelem = totvert;
|
||||
kbn->weights = NULL;
|
||||
|
@ -260,7 +260,6 @@ int join_mesh_exec(bContext *C, wmOperator *op)
|
|||
kbn->pos = curpos;
|
||||
|
||||
BLI_addtail(&key->block, kbn);
|
||||
kbn->adrcode = key->totkey;
|
||||
key->totkey++;
|
||||
if (key->totkey == 1) key->refkey = kbn;
|
||||
|
||||
|
|
|
@ -130,28 +130,10 @@ static int ED_object_shape_key_remove(bContext *C, Object *ob)
|
|||
|
||||
if (kb->data) MEM_freeN(kb->data);
|
||||
MEM_freeN(kb);
|
||||
|
||||
for (kb= key->block.first; kb; kb= kb->next)
|
||||
if (kb->adrcode>=ob->shapenr)
|
||||
kb->adrcode--;
|
||||
|
||||
#if 0 // XXX old animation system
|
||||
if (key->ipo) {
|
||||
|
||||
for (icu= key->ipo->curve.first; icu; icu= icu->next) {
|
||||
if (icu->adrcode==ob->shapenr-1) {
|
||||
BLI_remlink(&key->ipo->curve, icu);
|
||||
free_ipo_curve(icu);
|
||||
break;
|
||||
}
|
||||
}
|
||||
for (icu= key->ipo->curve.first; icu; icu= icu->next)
|
||||
if (icu->adrcode>=ob->shapenr)
|
||||
icu->adrcode--;
|
||||
|
||||
if (ob->shapenr > 1) {
|
||||
ob->shapenr--;
|
||||
}
|
||||
#endif // XXX old animation system
|
||||
|
||||
if (ob->shapenr>1) ob->shapenr--;
|
||||
}
|
||||
|
||||
if (key->totkey==0) {
|
||||
|
|
|
@ -43,8 +43,8 @@ typedef struct KeyBlock {
|
|||
|
||||
float pos;
|
||||
float curval;
|
||||
short type, adrcode, relative, flag; /* relative == 0 means first key is reference */
|
||||
int totelem, pad2;
|
||||
short type, pad1, relative, flag; /* relative == 0 means first key is reference */
|
||||
int totelem, uid;
|
||||
|
||||
void *data;
|
||||
float *weights;
|
||||
|
@ -53,8 +53,6 @@ typedef struct KeyBlock {
|
|||
|
||||
float slidermin;
|
||||
float slidermax;
|
||||
|
||||
int uid, pad3;
|
||||
} KeyBlock;
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue