Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2012-04-05 09:25:20 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-04-05 09:25:20 +0400
commit8cddb18da05eeed43bedffb9079869cfc9d0f4cd (patch)
tree01d1f584c908e398f4219f2c8e343b343bdd010f
parentdb562488d672567dd367d64fa7a8a081e9dcbf9e (diff)
- fix error with conflusing key/keyblock in the shape template UI - absolute keyblocks would always be greyed out.
- fix mistake setting wrong variable in unlikely case of curve having no bezier or point array set.
-rw-r--r--source/blender/blenkernel/intern/key.c58
-rw-r--r--source/blender/editors/interface/interface_templates.c5
2 files changed, 33 insertions, 30 deletions
diff --git a/source/blender/blenkernel/intern/key.c b/source/blender/blenkernel/intern/key.c
index 14deb67da25..e81cb235c4c 100644
--- a/source/blender/blenkernel/intern/key.c
+++ b/source/blender/blenkernel/intern/key.c
@@ -1106,14 +1106,14 @@ 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);
- float cfra, t[4], delta;
- int a, flag = 0;
+ float t[4];
+ int flag = 0;
if (key->slurph && key->type != KEY_RELATIVE) {
const float ctime_scaled = key->ctime / 100.0f;
- int step;
-
- delta = (float)key->slurph / tot;
+ float delta = (float)key->slurph / tot;
+ float cfra = (float)scene->r.cfra;
+ int step, a;
if (tot > 100 && slurph_opt) {
step = tot / 50;
@@ -1124,8 +1124,6 @@ static void do_mesh_key(Scene *scene, Object *ob, Key *key, char *out, const int
step = 1;
}
- cfra= (float)scene->r.cfra;
-
for (a=0; a<tot; a+=step, cfra+= delta) {
flag = setkeys(ctime_scaled, &key->block, k, t, 0);
@@ -1204,15 +1202,16 @@ static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, const in
{
Curve *cu= ob->data;
KeyBlock *k[4], *actkb= ob_get_keyblock(ob);
- float cfra, t[4], delta;
- int a, flag = 0;
+ float t[4];
+ int flag = 0;
if (key->slurph && key->type != KEY_RELATIVE) {
const float ctime_scaled = key->ctime / 100.0f;
+ float delta = (float)key->slurph / tot;
+ float cfra = (float)scene->r.cfra;
Nurb *nu;
- int mode = 0, i = 0, remain = 0, step, estep = 0, count = 0;
-
- delta = (float)key->slurph / tot;
+ int i = 0, remain = 0;
+ int step, a;
if (tot > 100 && slurph_opt) {
step = tot / 50;
@@ -1223,22 +1222,26 @@ static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, const in
step = 1;
}
- cfra= (float)scene->r.cfra;
-
for (nu=cu->nurb.first; nu; nu=nu->next) {
+ int estep, mode;
+
if (nu->bp) {
- mode= KEY_MODE_BPOINT;
- estep= nu->pntsu*nu->pntsv;
+ mode = KEY_MODE_BPOINT;
+ estep = nu->pntsu * nu->pntsv;
}
else if (nu->bezt) {
- mode= KEY_MODE_BEZTRIPLE;
- estep= 3*nu->pntsu;
+ mode = KEY_MODE_BEZTRIPLE;
+ estep = 3 * nu->pntsu;
+ }
+ else {
+ mode = 0;
+ estep = 0;
}
- else
- step= 0; /* XXX - is this some mistake??? - the estep from last iter could be used - campbell */
- a= 0;
+ a = 0;
while (a < estep) {
+ int count;
+
if (remain <= 0) {
cfra+= delta;
flag = setkeys(ctime_scaled, &key->block, k, t, 0);
@@ -1246,7 +1249,7 @@ static void do_curve_key(Scene *scene, Object *ob, Key *key, char *out, const in
remain= step;
}
- count= MIN2(remain, estep);
+ count = MIN2(remain, estep);
if (mode == KEY_MODE_BEZTRIPLE) {
count += 3 - count % 3;
}
@@ -1281,16 +1284,15 @@ static void do_latt_key(Scene *scene, Object *ob, Key *key, char *out, const int
{
Lattice *lt= ob->data;
KeyBlock *k[4], *actkb= ob_get_keyblock(ob);
- float delta, cfra, t[4];
- int a, flag;
+ float t[4];
+ int flag;
if (key->slurph && key->type != KEY_RELATIVE) {
const float ctime_scaled = key->ctime / 100.0f;
+ float delta = (float)key->slurph / tot;
+ float cfra = (float)scene->r.cfra;
+ int a;
- delta = (float)key->slurph / tot;
-
- cfra = (float)scene->r.cfra;
-
for (a=0; a<tot; a++, cfra+= delta) {
flag = setkeys(ctime_scaled, &key->block, k, t, 0);
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index 81db18aa0f8..9a02b858731 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -2165,6 +2165,7 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
else if (itemptr->type == &RNA_ShapeKey) {
Object *ob = (Object *)activeptr->data;
Key *key = (Key *)itemptr->id.data;
+ KeyBlock *kb = (KeyBlock *)itemptr->data;
split = uiLayoutSplit(sub, 0.66f, 0);
@@ -2176,8 +2177,8 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe
else uiItemR(row, itemptr, "value", 0, "", ICON_NONE);
uiItemR(row, itemptr, "mute", 0, "", 0);
- if ( (key->flag & KEYBLOCK_MUTE) ||
- (ob->mode == OB_MODE_EDIT && !((ob->shapeflag & OB_SHAPE_EDIT_MODE) && ob->type == OB_MESH)) )
+ if ((kb->flag & KEYBLOCK_MUTE) ||
+ (ob->mode == OB_MODE_EDIT && !((ob->shapeflag & OB_SHAPE_EDIT_MODE) && ob->type == OB_MESH)))
{
uiLayoutSetActive(row, 0);
}