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:
authorMatt Ebb <matt@mke3.net>2009-11-11 08:03:49 +0300
committerMatt Ebb <matt@mke3.net>2009-11-11 08:03:49 +0300
commitbf50cc8b3991f2705f3db0f7a1fb5b4b52e4cbef (patch)
treec014b34b4491d0805416fdc06fdc989992b975c5 /source/blender
parent792c4d602db232f2c0027f4e7d2d15ef4370b5f7 (diff)
Added compositing node support to the animation editors
Now when nodes are keyed, they will show up in the dopesheet/graph editor/etc in a new 'Nodetree' category. Still a major problem left, nodes need unique names in order for the rna paths to hold animation data properly...
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c75
-rw-r--r--source/blender/editors/animation/anim_draw.c1
-rw-r--r--source/blender/editors/animation/anim_filter.c91
-rw-r--r--source/blender/editors/animation/keyframes_draw.c10
-rw-r--r--source/blender/editors/animation/keyframes_edit.c9
-rw-r--r--source/blender/editors/include/ED_anim_api.h2
-rw-r--r--source/blender/editors/space_nla/nla_buttons.c1
-rw-r--r--source/blender/editors/space_nla/nla_channels.c1
-rw-r--r--source/blender/makesdna/DNA_action_types.h1
-rw-r--r--source/blender/makesdna/DNA_node_types.h5
10 files changed, 193 insertions, 3 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index 7d4ad868b45..865e89c927a 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -55,6 +55,7 @@
#include "DNA_lamp_types.h"
#include "DNA_material_types.h"
#include "DNA_meta_types.h"
+#include "DNA_node_types.h"
#include "DNA_userdef_types.h"
#include "DNA_gpencil_types.h"
#include "DNA_windowmanager_types.h"
@@ -1735,6 +1736,79 @@ static bAnimChannelType ACF_DSARM=
acf_dsarm_setting_ptr /* pointer for setting */
};
+/* NodeTree Expander ------------------------------------------- */
+
+// TODO: just get this from RNA?
+static int acf_dsntree_icon(bAnimListElem *ale)
+{
+ return ICON_NODETREE;
+}
+
+/* get the appropriate flag(s) for the setting when it is valid */
+static int acf_dsntree_setting_flag(int setting, short *neg)
+{
+ /* clear extra return data first */
+ *neg= 0;
+
+ switch (setting) {
+ case ACHANNEL_SETTING_EXPAND: /* expanded */
+ return NTREE_DS_EXPAND;
+
+ case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
+ return ADT_NLA_EVAL_OFF;
+
+ case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
+ *neg= 1;
+ return ADT_CURVES_NOT_VISIBLE;
+
+ case ACHANNEL_SETTING_SELECT: /* selected */
+ return ADT_UI_SELECTED;
+
+ default: /* unsupported */
+ return 0;
+ }
+}
+
+/* get pointer to the setting */
+static void *acf_dsntree_setting_ptr(bAnimListElem *ale, int setting, short *type)
+{
+ bNodeTree *ntree= (bNodeTree *)ale->data;
+
+ /* clear extra return data first */
+ *type= 0;
+
+ switch (setting) {
+ case ACHANNEL_SETTING_EXPAND: /* expanded */
+ GET_ACF_FLAG_PTR(ntree->flag);
+
+ case ACHANNEL_SETTING_SELECT: /* selected */
+ case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
+ case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
+ if (ntree->adt)
+ GET_ACF_FLAG_PTR(ntree->adt->flag)
+ else
+ return NULL;
+
+ default: /* unsupported */
+ return NULL;
+ }
+}
+
+/* metaball expander type define */
+static bAnimChannelType ACF_DSNTREE=
+{
+acf_generic_dataexpand_backdrop,/* backdrop */
+acf_generic_indention_1, /* indent level */
+acf_generic_basic_offset, /* offset */
+
+acf_generic_idblock_name, /* name */
+acf_dsntree_icon, /* icon */
+
+acf_generic_dataexpand_setting_valid, /* has setting */
+acf_dsntree_setting_flag, /* flag for setting */
+acf_dsntree_setting_ptr /* pointer for setting */
+};
+
/* ShapeKey Entry ------------------------------------------- */
@@ -1982,6 +2056,7 @@ void ANIM_init_channel_typeinfo_data (void)
animchannelTypeInfo[type++]= &ACF_DSCUR; /* Curve Channel */
animchannelTypeInfo[type++]= &ACF_DSSKEY; /* ShapeKey Channel */
animchannelTypeInfo[type++]= &ACF_DSWOR; /* World Channel */
+ animchannelTypeInfo[type++]= &ACF_DSNTREE; /* NodeTree Channel */
animchannelTypeInfo[type++]= &ACF_DSPART; /* Particle Channel */
animchannelTypeInfo[type++]= &ACF_DSMBALL; /* MetaBall Channel */
animchannelTypeInfo[type++]= &ACF_DSARM; /* Armature Channel */
diff --git a/source/blender/editors/animation/anim_draw.c b/source/blender/editors/animation/anim_draw.c
index aa581a7d15a..45512ae82fe 100644
--- a/source/blender/editors/animation/anim_draw.c
+++ b/source/blender/editors/animation/anim_draw.c
@@ -343,6 +343,7 @@ short ANIM_headerUI_standard_buttons (const bContext *C, bDopeSheet *ads, uiBloc
uiBlockBeginAlign(block);
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOSCE, B_REDR, ICON_SCENE_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Scene Animation");
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOWOR, B_REDR, ICON_WORLD_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display World Animation");
+ uiDefIconButBitI(block, TOGN, ADS_FILTER_NONTREE, B_REDR, ICON_NODETREE, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display Node Tree Animation");
if (mainptr && mainptr->key.first)
uiDefIconButBitI(block, TOGN, ADS_FILTER_NOSHAPEKEYS, B_REDR, ICON_SHAPEKEY_DATA, (short)(xco+=XIC),yco,XIC,YIC, &(ads->filterflag), 0, 0, 0, 0, "Display ShapeKeys");
if (mainptr && mainptr->mat.first)
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index 8c4f10fb222..eab5404f106 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -64,6 +64,7 @@
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meta_types.h"
+#include "DNA_node_types.h"
#include "DNA_object_types.h"
#include "DNA_particle_types.h"
#include "DNA_space_types.h"
@@ -599,6 +600,19 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s
ale->adt= BKE_animdata_from_id(data);
}
break;
+ case ANIMTYPE_DSARM:
+ {
+ bArmature *arm= (bArmature *)data;
+ AnimData *adt= arm->adt;
+
+ ale->flag= FILTER_ARM_OBJD(arm);
+
+ ale->key_data= (adt) ? adt->action : NULL;
+ ale->datatype= ALE_ACT;
+
+ ale->adt= BKE_animdata_from_id(data);
+ }
+ break;
case ANIMTYPE_DSSKEY:
{
Key *key= (Key *)data;
@@ -625,6 +639,19 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s
ale->adt= BKE_animdata_from_id(data);
}
break;
+ case ANIMTYPE_DSNTREE:
+ {
+ bNodeTree *ntree= (bNodeTree *)data;
+ AnimData *adt= ntree->adt;
+
+ ale->flag= FILTER_NTREE_SCED(ntree);
+
+ ale->key_data= (adt) ? adt->action : NULL;
+ ale->datatype= ALE_ACT;
+
+ ale->adt= BKE_animdata_from_id(data);
+ }
+ break;
case ANIMTYPE_DSPART:
{
ParticleSettings *part= (ParticleSettings*)ale->data;
@@ -1485,6 +1512,7 @@ static int animdata_filter_dopesheet_ob (ListBase *anim_data, bDopeSheet *ads, B
static int animdata_filter_dopesheet_scene (ListBase *anim_data, bDopeSheet *ads, Scene *sce, int filter_mode)
{
World *wo= sce->world;
+ bNodeTree *ntree= sce->nodetree;
AnimData *adt= NULL;
bAnimListElem *ale;
int items = 0;
@@ -1590,6 +1618,50 @@ static int animdata_filter_dopesheet_scene (ListBase *anim_data, bDopeSheet *ads
}
)
}
+ /* nodetree */
+ if ((ntree && ntree->adt) && !(ads->filterflag & ADS_FILTER_NONTREE)) {
+ /* Action, Drivers, or NLA for Nodetree */
+ adt= ntree->adt;
+ ANIMDATA_FILTER_CASES(ntree,
+ { /* AnimData blocks - do nothing... */ },
+ { /* nla */
+ /* add NLA tracks */
+ items += animdata_filter_nla(anim_data, ads, adt, filter_mode, ntree, ANIMTYPE_DSNTREE, (ID *)ntree);
+ },
+ { /* drivers */
+ /* include nodetree-expand widget? */
+ if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
+ ale= make_new_animlistelem(ntree, ANIMTYPE_DSNTREE, sce, ANIMTYPE_SCENE, (ID *)ntree);
+ if (ale) {
+ BLI_addtail(anim_data, ale);
+ items++;
+ }
+ }
+
+ /* add F-Curve channels (drivers are F-Curves) */
+ if (FILTER_NTREE_SCED(ntree)/*EXPANDED_DRVD(adt)*/ || !(filter_mode & ANIMFILTER_CHANNELS)) {
+ // XXX owner info is messed up now...
+ items += animdata_filter_fcurves(anim_data, ads, adt->drivers.first, NULL, ntree, ANIMTYPE_DSNTREE, filter_mode, (ID *)ntree);
+ }
+ },
+ { /* action */
+ /* include nodetree-expand widget? */
+ if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
+ ale= make_new_animlistelem(ntree, ANIMTYPE_DSNTREE, sce, ANIMTYPE_SCENE, (ID *)sce);
+ if (ale) {
+ BLI_addtail(anim_data, ale);
+ items++;
+ }
+ }
+
+ /* add channels */
+ if (FILTER_NTREE_SCED(ntree) || (filter_mode & ANIMFILTER_CURVESONLY)) {
+ items += animdata_filter_action(anim_data, ads, adt->action, filter_mode, ntree, ANIMTYPE_DSNTREE, (ID *)ntree);
+ }
+ }
+ )
+ }
+
// TODO: scene compositing nodes (these aren't standard node-trees)
@@ -1616,7 +1688,7 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bAnimContext *ac, bDo
/* scene-linked animation */
// TODO: sequencer, composite nodes - are we to include those here too?
{
- short sceOk= 0, worOk= 0;
+ short sceOk= 0, worOk= 0, nodeOk=0;
/* check filtering-flags if ok */
ANIMDATA_FILTER_CASES(sce,
@@ -1643,17 +1715,30 @@ static int animdata_filter_dopesheet (ListBase *anim_data, bAnimContext *ac, bDo
worOk= !(ads->filterflag & ADS_FILTER_NOWOR);,
worOk= !(ads->filterflag & ADS_FILTER_NOWOR);)
}
+ if (sce->nodetree) {
+ ANIMDATA_FILTER_CASES(sce->nodetree,
+ {
+ /* for the special AnimData blocks only case, we only need to add
+ * the block if it is valid... then other cases just get skipped (hence ok=0)
+ */
+ ANIMDATA_ADD_ANIMDATA(sce->nodetree);
+ nodeOk=0;
+ },
+ nodeOk= !(ads->filterflag & ADS_FILTER_NONTREE);,
+ nodeOk= !(ads->filterflag & ADS_FILTER_NONTREE);,
+ nodeOk= !(ads->filterflag & ADS_FILTER_NONTREE);)
+ }
/* if only F-Curves with visible flags set can be shown, check that
* datablocks haven't been set to invisible
*/
if (filter_mode & ANIMFILTER_CURVEVISIBLE) {
if ((sce->adt) && (sce->adt->flag & ADT_CURVES_NOT_VISIBLE))
- sceOk= worOk= 0;
+ sceOk= worOk= nodeOk= 0;
}
/* check if not all bad (i.e. so there is something to show) */
- if ( !(!sceOk && !worOk) ) {
+ if ( !(!sceOk && !worOk && !nodeOk) ) {
/* add scene data to the list of filtered channels */
items += animdata_filter_dopesheet_scene(anim_data, ads, sce, filter_mode);
}
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index a84ca580a15..fb02a88ea2b 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -58,6 +58,7 @@
#include "DNA_lamp_types.h"
#include "DNA_material_types.h"
#include "DNA_meta_types.h"
+#include "DNA_node_types.h"
#include "DNA_particle_types.h"
#include "DNA_userdef_types.h"
#include "DNA_gpencil_types.h"
@@ -688,6 +689,15 @@ void scene_to_keylist(bDopeSheet *ads, Scene *sce, DLRBT_Tree *keys, DLRBT_Tree
if (adt->action)
action_to_keylist(adt, adt->action, keys, blocks);
}
+
+ /* nodetree animdata */
+ if ((sce->nodetree) && (sce->nodetree->adt) && !(filterflag & ADS_FILTER_NONTREE)) {
+ adt= sce->nodetree->adt;
+
+ // TODO: when we adapt NLA system, this needs to be the NLA-scaled version
+ if (adt->action)
+ action_to_keylist(adt, adt->action, keys, blocks);
+ }
}
}
diff --git a/source/blender/editors/animation/keyframes_edit.c b/source/blender/editors/animation/keyframes_edit.c
index d4ec78ace16..23daa4a9034 100644
--- a/source/blender/editors/animation/keyframes_edit.c
+++ b/source/blender/editors/animation/keyframes_edit.c
@@ -44,6 +44,7 @@
#include "DNA_material_types.h"
#include "DNA_object_types.h"
#include "DNA_meta_types.h"
+#include "DNA_node_types.h"
#include "DNA_particle_types.h"
#include "DNA_space_types.h"
#include "DNA_scene_types.h"
@@ -304,6 +305,7 @@ static short ob_keys_bezier_loop(BeztEditData *bed, Object *ob, BeztEditFunc bez
static short scene_keys_bezier_loop(BeztEditData *bed, Scene *sce, BeztEditFunc bezt_ok, BeztEditFunc bezt_cb, FcuEditFunc fcu_cb, int filterflag)
{
World *wo= (sce) ? sce->world : NULL;
+ bNodeTree *ntree= (sce) ? sce->nodetree : NULL;
/* sanity check */
if (sce == NULL)
@@ -321,6 +323,13 @@ static short scene_keys_bezier_loop(BeztEditData *bed, Scene *sce, BeztEditFunc
return 1;
}
+ /* NodeTree */
+ if (ntree && ntree->adt) {
+ if (adt_keys_bezier_loop(bed, ntree->adt, bezt_ok, bezt_cb, fcu_cb, filterflag))
+ return 1;
+ }
+
+
return 0;
}
diff --git a/source/blender/editors/include/ED_anim_api.h b/source/blender/editors/include/ED_anim_api.h
index f90d28cd175..5c83d685362 100644
--- a/source/blender/editors/include/ED_anim_api.h
+++ b/source/blender/editors/include/ED_anim_api.h
@@ -140,6 +140,7 @@ typedef enum eAnim_ChannelType {
ANIMTYPE_DSCUR,
ANIMTYPE_DSSKEY,
ANIMTYPE_DSWOR,
+ ANIMTYPE_DSNTREE,
ANIMTYPE_DSPART,
ANIMTYPE_DSMBALL,
ANIMTYPE_DSARM,
@@ -202,6 +203,7 @@ typedef enum eAnimFilter_Flags {
#define EXPANDED_SCEC(sce) ((sce->flag & SCE_DS_COLLAPSED)==0)
/* 'Sub-Scene' channels (flags stored in Data block) */
#define FILTER_WOR_SCED(wo) ((wo->flag & WO_DS_EXPAND))
+#define FILTER_NTREE_SCED(ntree) ((ntree->flag & NTREE_DS_EXPAND))
/* 'Object' channels */
#define SEL_OBJC(base) ((base->flag & SELECT))
#define EXPANDED_OBJC(ob) ((ob->nlaflag & OB_ADS_COLLAPSED)==0)
diff --git a/source/blender/editors/space_nla/nla_buttons.c b/source/blender/editors/space_nla/nla_buttons.c
index 3d43265b862..6e5da38dd10 100644
--- a/source/blender/editors/space_nla/nla_buttons.c
+++ b/source/blender/editors/space_nla/nla_buttons.c
@@ -155,6 +155,7 @@ static int nla_panel_context(const bContext *C, PointerRNA *adt_ptr, PointerRNA
case ANIMTYPE_DSCUR:
case ANIMTYPE_DSSKEY:
case ANIMTYPE_DSWOR:
+ case ANIMTYPE_DSNTREE:
case ANIMTYPE_DSPART:
case ANIMTYPE_DSMBALL:
case ANIMTYPE_DSARM:
diff --git a/source/blender/editors/space_nla/nla_channels.c b/source/blender/editors/space_nla/nla_channels.c
index a9380c03346..ab447dd974a 100644
--- a/source/blender/editors/space_nla/nla_channels.c
+++ b/source/blender/editors/space_nla/nla_channels.c
@@ -189,6 +189,7 @@ static int mouse_nla_channels (bAnimContext *ac, float x, int channel_index, sho
case ANIMTYPE_DSCUR:
case ANIMTYPE_DSSKEY:
case ANIMTYPE_DSWOR:
+ case ANIMTYPE_DSNTREE:
case ANIMTYPE_DSPART:
case ANIMTYPE_DSMBALL:
case ANIMTYPE_DSARM:
diff --git a/source/blender/makesdna/DNA_action_types.h b/source/blender/makesdna/DNA_action_types.h
index aed0d4e80a7..5f6d8ef375a 100644
--- a/source/blender/makesdna/DNA_action_types.h
+++ b/source/blender/makesdna/DNA_action_types.h
@@ -446,6 +446,7 @@ typedef enum DOPESHEET_FILTERFLAG {
ADS_FILTER_NOPART = (1<<16),
ADS_FILTER_NOMBA = (1<<17),
ADS_FILTER_NOARM = (1<<18),
+ ADS_FILTER_NONTREE = (1<<19),
/* NLA-specific filters */
ADS_FILTER_NLA_NOACT = (1<<20), /* if the AnimData block has no NLA data, don't include to just show Action-line */
diff --git a/source/blender/makesdna/DNA_node_types.h b/source/blender/makesdna/DNA_node_types.h
index 73ff7432577..9d80f7f720e 100644
--- a/source/blender/makesdna/DNA_node_types.h
+++ b/source/blender/makesdna/DNA_node_types.h
@@ -177,6 +177,8 @@ typedef struct bNodeTree {
int stacksize; /* amount of elements in stack */
int cur_index; /* sockets in groups have unique identifiers, adding new sockets always
will increase this counter */
+ int flag, pad;
+
ListBase alltypes; /* type definitions */
struct bNodeType *owntype; /* for groups or dynamic trees, no read/write */
@@ -201,6 +203,9 @@ typedef struct bNodeTree {
#define NTREE_TYPE_INIT 1
#define NTREE_EXEC_INIT 2
+/* ntree->flag */
+#define NTREE_DS_EXPAND 1 /* for animation editors */
+
/* data structs, for node->storage */
/* this one has been replaced with ImageUser, keep it for do_versions() */