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:
authorOve Murberg Henriksen <sorayasilvermoon@hotmail.com>2012-04-12 20:01:24 +0400
committerOve Murberg Henriksen <sorayasilvermoon@hotmail.com>2012-04-12 20:01:24 +0400
commit93f22cf0125285edb2ee87efe63580f2e87ac0fd (patch)
treefc4705c9c841e062ee646f063211813487ba550b /source/blender/editors/object
parent244836b18da1bbb6be94b7a5353ae8beaff1eb9d (diff)
parent10a333556a5b7d05bb42e61e8f42dac10ed8cad1 (diff)
svn merge ^/trunk/blender -r45364:HEAD --accept postpone
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r--source/blender/editors/object/object_intern.h1
-rw-r--r--source/blender/editors/object/object_ops.c1
-rw-r--r--source/blender/editors/object/object_shapekey.c67
-rw-r--r--source/blender/editors/object/object_vgroup.c2
4 files changed, 47 insertions, 24 deletions
diff --git a/source/blender/editors/object/object_intern.h b/source/blender/editors/object/object_intern.h
index 19eb3575241..8ba64e66025 100644
--- a/source/blender/editors/object/object_intern.h
+++ b/source/blender/editors/object/object_intern.h
@@ -215,6 +215,7 @@ void OBJECT_OT_vertex_group_move(struct wmOperatorType *ot);
void OBJECT_OT_shape_key_add(struct wmOperatorType *ot);
void OBJECT_OT_shape_key_remove(struct wmOperatorType *ot);
void OBJECT_OT_shape_key_clear(struct wmOperatorType *ot);
+void OBJECT_OT_shape_key_retime(struct wmOperatorType *ot);
void OBJECT_OT_shape_key_mirror(struct wmOperatorType *ot);
void OBJECT_OT_shape_key_move(struct wmOperatorType *ot);
diff --git a/source/blender/editors/object/object_ops.c b/source/blender/editors/object/object_ops.c
index 115d452fd4e..43385ea80a3 100644
--- a/source/blender/editors/object/object_ops.c
+++ b/source/blender/editors/object/object_ops.c
@@ -195,6 +195,7 @@ void ED_operatortypes_object(void)
WM_operatortype_append(OBJECT_OT_shape_key_add);
WM_operatortype_append(OBJECT_OT_shape_key_remove);
WM_operatortype_append(OBJECT_OT_shape_key_clear);
+ WM_operatortype_append(OBJECT_OT_shape_key_retime);
WM_operatortype_append(OBJECT_OT_shape_key_mirror);
WM_operatortype_append(OBJECT_OT_shape_key_move);
diff --git a/source/blender/editors/object/object_shapekey.c b/source/blender/editors/object/object_shapekey.c
index 959bda22263..79b1ca13c9e 100644
--- a/source/blender/editors/object/object_shapekey.c
+++ b/source/blender/editors/object/object_shapekey.c
@@ -76,9 +76,11 @@
static void ED_object_shape_key_add(bContext *C, Scene *scene, Object *ob, int from_mix)
{
- if (object_insert_shape_key(scene, ob, NULL, from_mix)) {
+ KeyBlock *kb;
+ if ((kb = object_insert_shape_key(scene, ob, NULL, from_mix))) {
Key *key= ob_get_key(ob);
- ob->shapenr= BLI_countlist(&key->block);
+ /* for absolute shape keys, new keys may not be added last */
+ ob->shapenr = BLI_findindex(&key->block, kb) + 1;
WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
}
@@ -128,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) {
@@ -369,6 +353,41 @@ void OBJECT_OT_shape_key_clear(wmOperatorType *ot)
ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
}
+/* starting point and step size could be optional */
+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);
+ float cfra = 0.0f;
+
+ if (!key || !kb)
+ return OPERATOR_CANCELLED;
+
+ for (kb=key->block.first; kb; kb=kb->next)
+ kb->pos = (cfra += 0.1f);
+
+ DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
+ WM_event_add_notifier(C, NC_OBJECT|ND_DRAW, ob);
+
+ return OPERATOR_FINISHED;
+}
+
+void OBJECT_OT_shape_key_retime(wmOperatorType *ot)
+{
+ /* identifiers */
+ ot->name = "Re-Time Shape Keys";
+ ot->description = "Resets the timing for absolute shape keys";
+ ot->idname = "OBJECT_OT_shape_key_retime";
+
+ /* api callbacks */
+ ot->poll = shape_key_poll;
+ ot->exec = shape_key_retime_exec;
+
+ /* flags */
+ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO;
+}
+
static int shape_key_mirror_exec(bContext *C, wmOperator *UNUSED(op))
{
Object *ob= ED_object_context(C);
@@ -434,6 +453,8 @@ static int shape_key_move_exec(bContext *C, wmOperator *op)
BLI_insertlinkafter(&key->block, kb_other, kb);
ob->shapenr++;
}
+
+ SWAP(float, kb_other->pos, kb->pos) /* for absolute shape keys */
}
DAG_id_tag_update(&ob->id, OB_RECALC_DATA);
diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c
index c0150d6e3b0..aab05e022c0 100644
--- a/source/blender/editors/object/object_vgroup.c
+++ b/source/blender/editors/object/object_vgroup.c
@@ -2116,7 +2116,7 @@ static int vertex_group_poll(bContext *C)
return (ob && !ob->id.lib && OB_TYPE_SUPPORT_VGROUP(ob->type) && data && !data->lib);
}
-static int vertex_group_poll_edit(bContext *C)
+static int UNUSED_FUNCTION(vertex_group_poll_edit)(bContext *C)
{
Object *ob= ED_object_context(C);
ID *data= (ob)? ob->data: NULL;