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-31 11:43:47 +0400
committerJoshua Leung <aligorith@gmail.com>2009-07-31 11:43:47 +0400
commita1eef5bb4d1ac64cfde0a5055a889116ee855b7f (patch)
tree9d6d41c69b672868f0e8f09d7dd0430cc4ade00b /source/blender/editors/space_nla/nla_buttons.c
parent6f847863a131cc61addbe6485abf2f24ae150ff1 (diff)
Animato - NLA + Realtime Animating Goodies
* When doing realtime recording of animation (i.e. transforming objects + bones while animation playback is running, and auto-keying is enabled), animation will be added to a new NLA Track+Strip combo everytime a single 'loop' of the frame range has finished. This will allow 'passes' over the animation to be less destructive. * Made the evaluation of the active action (when NLA data is present), be handled as part of the normal NLA system evaluation code (as if it were just another strip in a track at the end). The immediate benefit is that there are now some settings (available in the "Animation Data" panel in the NLA Editor with a strip selected) which allow for the way the active action is combined with the NLA stack results. For instance, the way that the action extrapolates is used in the recording tweaks above.
Diffstat (limited to 'source/blender/editors/space_nla/nla_buttons.c')
-rw-r--r--source/blender/editors/space_nla/nla_buttons.c75
1 files changed, 65 insertions, 10 deletions
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c
index a74037d1ace..a87ab36714c 100644
--- a/source/blender/editors/space_nla/nla_buttons.c
+++ b/source/blender/editors/space_nla/nla_buttons.c
@@ -100,7 +100,7 @@ static void do_nla_region_buttons(bContext *C, void *arg, int event)
WM_event_add_notifier(C, NC_SCENE|NC_OBJECT|ND_TRANSFORM, NULL);
}
-static int nla_panel_context(const bContext *C, PointerRNA *nlt_ptr, PointerRNA *strip_ptr)
+static int nla_panel_context(const bContext *C, PointerRNA *adt_ptr, PointerRNA *nlt_ptr, PointerRNA *strip_ptr)
{
bAnimContext ac;
bAnimListElem *ale= NULL;
@@ -121,8 +121,13 @@ static int nla_panel_context(const bContext *C, PointerRNA *nlt_ptr, PointerRNA
for (ale= anim_data.first; ale; ale= ale->next) {
if (ale->type == ANIMTYPE_NLATRACK) {
NlaTrack *nlt= (NlaTrack *)ale->data;
+ AnimData *adt= ale->adt;
/* found it, now set the pointers */
+ if (adt_ptr) {
+ /* AnimData pointer */
+ RNA_pointer_create(ale->id, &RNA_AnimData, adt, adt_ptr);
+ }
if (nlt_ptr) {
/* NLA-Track pointer */
RNA_pointer_create(ale->id, &RNA_NlaTrack, nlt, nlt_ptr);
@@ -151,16 +156,22 @@ static int nla_panel_poll(const bContext *C, PanelType *pt)
}
#endif
+static int nla_animdata_panel_poll(const bContext *C, PanelType *pt)
+{
+ PointerRNA ptr;
+ return (nla_panel_context(C, &ptr, NULL, NULL) && (ptr.data != NULL));
+}
+
static int nla_track_panel_poll(const bContext *C, PanelType *pt)
{
PointerRNA ptr;
- return (nla_panel_context(C, &ptr, NULL) && (ptr.data != NULL));
+ return (nla_panel_context(C, NULL, &ptr, NULL) && (ptr.data != NULL));
}
static int nla_strip_panel_poll(const bContext *C, PanelType *pt)
{
PointerRNA ptr;
- return (nla_panel_context(C, NULL, &ptr) && (ptr.data != NULL));
+ return (nla_panel_context(C, NULL, NULL, &ptr) && (ptr.data != NULL));
}
static int nla_strip_actclip_panel_poll(const bContext *C, PanelType *pt)
@@ -168,7 +179,7 @@ static int nla_strip_actclip_panel_poll(const bContext *C, PanelType *pt)
PointerRNA ptr;
NlaStrip *strip;
- if (!nla_panel_context(C, NULL, &ptr))
+ if (!nla_panel_context(C, NULL, NULL, &ptr))
return 0;
if (ptr.data == NULL)
return 0;
@@ -179,6 +190,42 @@ static int nla_strip_actclip_panel_poll(const bContext *C, PanelType *pt)
/* -------------- */
+/* active AnimData */
+static void nla_panel_animdata (const bContext *C, Panel *pa)
+{
+ PointerRNA adt_ptr;
+ AnimData *adt;
+ uiLayout *layout= pa->layout;
+ uiLayout *row;
+ uiBlock *block;
+
+ /* check context and also validity of pointer */
+ if (!nla_panel_context(C, &adt_ptr, NULL, NULL))
+ return;
+ adt= adt_ptr.data;
+
+ block= uiLayoutGetBlock(layout);
+ uiBlockSetHandleFunc(block, do_nla_region_buttons, NULL);
+
+ /* Active Action Properties ------------------------------------- */
+ /* action */
+ row= uiLayoutRow(layout, 1);
+ uiLayoutSetEnabled(row, (adt->flag & ADT_NLA_EDIT_ON)==0);
+ uiItemR(row, NULL, 0, &adt_ptr, "action", 0, 0, 0);
+
+ /* extrapolation */
+ row= uiLayoutRow(layout, 1);
+ uiItemR(row, NULL, 0, &adt_ptr, "action_extrapolation", 0, 0, 0);
+
+ /* blending */
+ row= uiLayoutRow(layout, 1);
+ uiItemR(row, NULL, 0, &adt_ptr, "action_blending", 0, 0, 0);
+
+ /* influence */
+ row= uiLayoutRow(layout, 1);
+ uiItemR(row, NULL, 0, &adt_ptr, "action_influence", 0, 0, 0);
+}
+
/* active NLA-Track */
static void nla_panel_track (const bContext *C, Panel *pa)
{
@@ -188,9 +235,9 @@ static void nla_panel_track (const bContext *C, Panel *pa)
uiBlock *block;
/* check context and also validity of pointer */
- if (!nla_panel_context(C, &nlt_ptr, NULL))
+ if (!nla_panel_context(C, NULL, &nlt_ptr, NULL))
return;
-
+
block= uiLayoutGetBlock(layout);
uiBlockSetHandleFunc(block, do_nla_region_buttons, NULL);
@@ -207,7 +254,7 @@ static void nla_panel_properties(const bContext *C, Panel *pa)
uiLayout *column, *row, *subcol;
uiBlock *block;
- if (!nla_panel_context(C, NULL, &strip_ptr))
+ if (!nla_panel_context(C, NULL, NULL, &strip_ptr))
return;
block= uiLayoutGetBlock(layout);
@@ -263,7 +310,7 @@ static void nla_panel_actclip(const bContext *C, Panel *pa)
uiBlock *block;
/* check context and also validity of pointer */
- if (!nla_panel_context(C, NULL, &strip_ptr))
+ if (!nla_panel_context(C, NULL, NULL, &strip_ptr))
return;
block= uiLayoutGetBlock(layout);
@@ -298,7 +345,7 @@ static void nla_panel_evaluation(const bContext *C, Panel *pa)
uiBlock *block;
/* check context and also validity of pointer */
- if (!nla_panel_context(C, NULL, &strip_ptr))
+ if (!nla_panel_context(C, NULL, NULL, &strip_ptr))
return;
block= uiLayoutGetBlock(layout);
@@ -330,7 +377,7 @@ static void nla_panel_modifiers(const bContext *C, Panel *pa)
uiBlock *block;
/* check context and also validity of pointer */
- if (!nla_panel_context(C, NULL, &strip_ptr))
+ if (!nla_panel_context(C, NULL, NULL, &strip_ptr))
return;
strip= strip_ptr.data;
@@ -362,6 +409,14 @@ void nla_buttons_register(ARegionType *art)
{
PanelType *pt;
+ pt= MEM_callocN(sizeof(PanelType), "spacetype nla panel animdata");
+ strcpy(pt->idname, "NLA_PT_animdata");
+ strcpy(pt->label, "Animation Data");
+ pt->draw= nla_panel_animdata;
+ pt->poll= nla_animdata_panel_poll;
+ pt->flag= PNL_DEFAULT_CLOSED;
+ BLI_addtail(&art->paneltypes, pt);
+
pt= MEM_callocN(sizeof(PanelType), "spacetype nla panel track");
strcpy(pt->idname, "NLA_PT_track");
strcpy(pt->label, "Active Track");