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:
authorJoshua Leung <aligorith@gmail.com>2009-07-03 05:10:46 +0400
committerJoshua Leung <aligorith@gmail.com>2009-07-03 05:10:46 +0400
commit28d371d1178642e17f5dfc300f1500a132ce7149 (patch)
tree8b6eb6ae7ac36b4a1823e5725ed92f29b1e528c8 /source/blender/editors/space_nla
parente55d90b340d15944d53414419d8f4671f435af75 (diff)
NLA SoC: Assorted fixes
* Made NLA Editing functions more aware of transitions. - A transition can only be added between a pair of action-clips. Previous, two transitions could be added next to each other, which has undefined behaviour - Deleting a strip with transition(s) on either side will remove the transitions too. Feedback welcome on this - The 'type' setting for NLA-Strips is no longer editable. This was dangerous as it could result in transitions with undefined behaviour (though nothing would happen). * Menus for adding F-Modifiers now only show relevant modifiers (i.e. 'Invalid' is not included in the list, and 'Cycles' doesn't need to be shown for NLA since we've got repeat) * Function Generator and Noise F-Modifiers now have complete GUI's. A few settings were missed during the porting process. * F-Modifier buttons now have their source-ID's included in the RNA Pointers used. This didn't get them animateable directly, but is a step closer.
Diffstat (limited to 'source/blender/editors/space_nla')
-rw-r--r--source/blender/editors/space_nla/nla_buttons.c2
-rw-r--r--source/blender/editors/space_nla/nla_edit.c50
2 files changed, 49 insertions, 3 deletions
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c
index 7eb10866b8c..38ac59cbc9e 100644
--- a/source/blender/editors/space_nla/nla_buttons.c
+++ b/source/blender/editors/space_nla/nla_buttons.c
@@ -341,7 +341,7 @@ static void nla_panel_modifiers(const bContext *C, Panel *pa)
for (fcm= strip->modifiers.first; fcm; fcm= fcm->next) {
col= uiLayoutColumn(pa->layout, 1);
- ANIM_uiTemplate_fmodifier_draw(col, &strip->modifiers, fcm);
+ ANIM_uiTemplate_fmodifier_draw(col, strip_ptr.id.data, &strip->modifiers, fcm);
}
}
diff --git a/source/blender/editors/space_nla/nla_edit.c b/source/blender/editors/space_nla/nla_edit.c
index 9910e62b262..10b25beddff 100644
--- a/source/blender/editors/space_nla/nla_edit.c
+++ b/source/blender/editors/space_nla/nla_edit.c
@@ -386,6 +386,12 @@ static int nlaedit_add_transition_exec (bContext *C, wmOperator *op)
/* check if there's space between the two */
if (IS_EQ(s1->end, s2->start))
continue;
+ /* make neither one is a transition
+ * - although this is impossible to create with the standard tools,
+ * the user may have altered the settings
+ */
+ if (ELEM(NLASTRIP_TYPE_TRANSITION, s1->type, s2->type))
+ continue;
/* allocate new strip */
strip= MEM_callocN(sizeof(NlaStrip), "NlaStrip");
@@ -577,8 +583,18 @@ static int nlaedit_delete_exec (bContext *C, wmOperator *op)
nstrip= strip->next;
/* if selected, delete */
- if (strip->flag & NLASTRIP_FLAG_SELECT)
+ if (strip->flag & NLASTRIP_FLAG_SELECT) {
+ /* if a strip either side of this was a transition, delete those too */
+ if ((strip->prev) && (strip->prev->type == NLASTRIP_TYPE_TRANSITION))
+ free_nlastrip(&nlt->strips, strip->prev);
+ if ((nstrip) && (nstrip->type == NLASTRIP_TYPE_TRANSITION)) {
+ nstrip= nstrip->next;
+ free_nlastrip(&nlt->strips, strip->next);
+ }
+
+ /* finally, delete this strip */
free_nlastrip(&nlt->strips, strip);
+ }
}
}
@@ -1026,6 +1042,36 @@ void NLA_OT_clear_scale (wmOperatorType *ot)
/* ******************** Add F-Modifier Operator *********************** */
+/* present a special customised popup menu for this, with some filtering */
+static int nla_fmodifier_add_invoke (bContext *C, wmOperator *op, wmEvent *event)
+{
+ uiPopupMenu *pup;
+ uiLayout *layout;
+ int i;
+
+ pup= uiPupMenuBegin(C, "Add F-Modifier", 0);
+ layout= uiPupMenuLayout(pup);
+
+ /* start from 1 to skip the 'Invalid' modifier type */
+ for (i = 1; i < FMODIFIER_NUM_TYPES; i++) {
+ FModifierTypeInfo *fmi= get_fmodifier_typeinfo(i);
+
+ /* check if modifier is valid for this context */
+ if (fmi == NULL)
+ continue;
+ if (i == FMODIFIER_TYPE_CYCLES) /* we already have repeat... */
+ continue;
+
+ /* add entry to add this type of modifier */
+ uiItemEnumO(layout, fmi->name, 0, "NLA_OT_fmodifier_add", "type", i);
+ }
+ uiItemS(layout);
+
+ uiPupMenuEnd(C, pup);
+
+ return OPERATOR_CANCELLED;
+}
+
static int nla_fmodifier_add_exec(bContext *C, wmOperator *op)
{
bAnimContext ac;
@@ -1089,7 +1135,7 @@ void NLA_OT_fmodifier_add (wmOperatorType *ot)
ot->idname= "NLA_OT_fmodifier_add";
/* api callbacks */
- ot->invoke= WM_menu_invoke;
+ ot->invoke= nla_fmodifier_add_invoke;
ot->exec= nla_fmodifier_add_exec;
ot->poll= nlaop_poll_tweakmode_off;