diff options
author | Joshua Leung <aligorith@gmail.com> | 2011-08-07 16:27:20 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2011-08-07 16:27:20 +0400 |
commit | 022e815fbd6d81f9b1baa177cce1abf2f42bcb21 (patch) | |
tree | 5c8b9b947ef50d4b0f398cf6a53b81a04e4f83c9 /source/blender/editors/space_nla/nla_buttons.c | |
parent | 2d884fc035d403d43c7a18e3e61cd56ccdfbec2b (diff) |
Sound clip NLA Strips for Nexyon
These are basically just for specifying when a speaker should fire off
it's soundclip, and as such, many NLA operations are irrelevant for
it. They can only be specified on object-level for speaker objects.
I've still got some UI tweaks I'll need to work on in order for these
to be able to be added even when the speaker doesn't have any NLA
tracks yet. (EDIT: while typing this, I had an idea for how to do
this, but that'll be for next commit). In the mean time, you'll need
to add a single keyframe for the object, snowflake that action and
delete the NLA strip before you can start editing.
Diffstat (limited to 'source/blender/editors/space_nla/nla_buttons.c')
-rw-r--r-- | source/blender/editors/space_nla/nla_buttons.c | 80 |
1 files changed, 54 insertions, 26 deletions
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c index b6de8e7fb59..0f0662d84b1 100644 --- a/source/blender/editors/space_nla/nla_buttons.c +++ b/source/blender/editors/space_nla/nla_buttons.c @@ -213,6 +213,24 @@ static int nla_strip_actclip_panel_poll(const bContext *C, PanelType *UNUSED(pt) return (strip->type == NLASTRIP_TYPE_CLIP); } +static int nla_strip_eval_panel_poll(const bContext *C, PanelType *UNUSED(pt)) +{ + PointerRNA ptr; + NlaStrip *strip; + + if (!nla_panel_context(C, NULL, NULL, &ptr)) + return 0; + if (ptr.data == NULL) + return 0; + + strip= ptr.data; + + if (strip->type == NLASTRIP_TYPE_SOUND) + return 0; + + return 1; +} + /* -------------- */ /* active AnimData */ @@ -278,6 +296,7 @@ static void nla_panel_properties(const bContext *C, Panel *pa) uiLayout *layout= pa->layout; uiLayout *column, *row, *subcol; uiBlock *block; + short showEvalProps = 1; if (!nla_panel_context(C, NULL, NULL, &strip_ptr)) return; @@ -297,32 +316,41 @@ static void nla_panel_properties(const bContext *C, Panel *pa) uiItemR(column, &strip_ptr, "frame_start", 0, NULL, ICON_NONE); uiItemR(column, &strip_ptr, "frame_end", 0, NULL, ICON_NONE); - /* extrapolation */ - row= uiLayoutRow(layout, 1); - uiItemR(row, &strip_ptr, "extrapolation", 0, NULL, ICON_NONE); + /* Evaluation-Related Strip Properties ------------------ */ - /* blending */ - row= uiLayoutRow(layout, 1); - uiItemR(row, &strip_ptr, "blend_type", 0, NULL, ICON_NONE); - - /* blend in/out + autoblending - * - blend in/out can only be set when autoblending is off - */ - column= uiLayoutColumn(layout, 1); - uiLayoutSetActive(column, RNA_boolean_get(&strip_ptr, "use_animated_influence")==0); - uiItemR(column, &strip_ptr, "use_auto_blend", 0, NULL, ICON_NONE); // XXX as toggle? - - subcol= uiLayoutColumn(column, 1); - uiLayoutSetActive(subcol, RNA_boolean_get(&strip_ptr, "use_auto_blend")==0); - uiItemR(subcol, &strip_ptr, "blend_in", 0, NULL, ICON_NONE); - uiItemR(subcol, &strip_ptr, "blend_out", 0, NULL, ICON_NONE); + /* sound properties strips don't have these settings */ + if (RNA_enum_get(&strip_ptr, "type") == NLASTRIP_TYPE_SOUND) + showEvalProps = 0; + + /* only show if allowed to... */ + if (showEvalProps) { + /* extrapolation */ + row= uiLayoutRow(layout, 1); + uiItemR(row, &strip_ptr, "extrapolation", 0, NULL, ICON_NONE); - /* settings */ - column= uiLayoutColumn(layout, 1); - uiLayoutSetActive(column, !(RNA_boolean_get(&strip_ptr, "use_animated_influence") || RNA_boolean_get(&strip_ptr, "use_animated_time"))); - uiItemL(column, "Playback Settings:", ICON_NONE); - uiItemR(column, &strip_ptr, "mute", 0, NULL, ICON_NONE); - uiItemR(column, &strip_ptr, "use_reverse", 0, NULL, ICON_NONE); + /* blending */ + row= uiLayoutRow(layout, 1); + uiItemR(row, &strip_ptr, "blend_type", 0, NULL, ICON_NONE); + + /* blend in/out + autoblending + * - blend in/out can only be set when autoblending is off + */ + column= uiLayoutColumn(layout, 1); + uiLayoutSetActive(column, RNA_boolean_get(&strip_ptr, "use_animated_influence")==0); + uiItemR(column, &strip_ptr, "use_auto_blend", 0, NULL, ICON_NONE); // XXX as toggle? + + subcol= uiLayoutColumn(column, 1); + uiLayoutSetActive(subcol, RNA_boolean_get(&strip_ptr, "use_auto_blend")==0); + uiItemR(subcol, &strip_ptr, "blend_in", 0, NULL, ICON_NONE); + uiItemR(subcol, &strip_ptr, "blend_out", 0, NULL, ICON_NONE); + + /* settings */ + column= uiLayoutColumn(layout, 1); + uiLayoutSetActive(column, !(RNA_boolean_get(&strip_ptr, "use_animated_influence") || RNA_boolean_get(&strip_ptr, "use_animated_time"))); + uiItemL(column, "Playback Settings:", ICON_NONE); + uiItemR(column, &strip_ptr, "mute", 0, NULL, ICON_NONE); + uiItemR(column, &strip_ptr, "use_reverse", 0, NULL, ICON_NONE); + } } @@ -476,14 +504,14 @@ void nla_buttons_register(ARegionType *art) strcpy(pt->idname, "NLA_PT_evaluation"); strcpy(pt->label, "Evaluation"); pt->draw= nla_panel_evaluation; - pt->poll= nla_strip_panel_poll; + pt->poll= nla_strip_eval_panel_poll; BLI_addtail(&art->paneltypes, pt); pt= MEM_callocN(sizeof(PanelType), "spacetype nla panel modifiers"); strcpy(pt->idname, "NLA_PT_modifiers"); strcpy(pt->label, "Modifiers"); pt->draw= nla_panel_modifiers; - pt->poll= nla_strip_panel_poll; + pt->poll= nla_strip_eval_panel_poll; BLI_addtail(&art->paneltypes, pt); } |