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>2011-06-27 07:54:33 +0400
committerJoshua Leung <aligorith@gmail.com>2011-06-27 07:54:33 +0400
commitb6bc47eb098261189c63b3aecb806960db6235e1 (patch)
tree21b7fffb95505afbc686751ea29fe862144769b9 /source/blender/editors/animation
parent17da597cc83eaaacdb7d70bb8c8f74aee872f4d3 (diff)
AnimChannelFiltering - Material Nodes support
Animation for Material nodes is now shown in Animation Editors :)
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r--source/blender/editors/animation/anim_channels_defines.c51
-rw-r--r--source/blender/editors/animation/anim_filter.c23
2 files changed, 53 insertions, 21 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c
index c3e79d787e1..c4246ab534c 100644
--- a/source/blender/editors/animation/anim_channels_defines.c
+++ b/source/blender/editors/animation/anim_channels_defines.c
@@ -259,23 +259,53 @@ static short acf_generic_basic_offset(bAnimContext *ac, bAnimListElem *ale)
return 0;
}
+/* offset based on nodetree type */
+static short acf_nodetree_rootType_offset(bNodeTree *ntree)
+{
+ if (ntree) {
+ switch (ntree->type) {
+ case NTREE_SHADER:
+ /* 1 additional level (i.e. is indented one level in from material,
+ * so shift all right by one step)
+ */
+ return INDENT_STEP_SIZE;
+
+ case NTREE_COMPOSIT:
+ /* no additional levels needed */
+ return 0;
+
+ case NTREE_TEXTURE:
+ /* 2 additional levels */
+ return INDENT_STEP_SIZE*2;
+ }
+ }
+
+ // unknown
+ return 0;
+}
+
/* offset for groups + grouped entities */
static short acf_generic_group_offset(bAnimContext *ac, bAnimListElem *ale)
{
short offset= acf_generic_basic_offset(ac, ale);
if (ale->id) {
- /* special exception for textures */
+ /* texture animdata */
if (GS(ale->id->name) == ID_TE) {
offset += 21;
}
- /* special exception for materials and particles */
+ /* materials and particles animdata */
else if (ELEM(GS(ale->id->name),ID_MA,ID_PA))
offset += 14;
- /* if not in Action Editor mode, groupings must carry some offset too... */
+ /* if not in Action Editor mode, action-groups (and their children) must carry some offset too... */
else if (ac->datatype != ANIMCONT_ACTION)
offset += 14;
+
+ /* nodetree animdata */
+ if (GS(ale->id->name) == ID_NT) {
+ offset += acf_nodetree_rootType_offset((bNodeTree*)ale->id);
+ }
}
/* offset is just the normal type - i.e. based on indention */
@@ -1827,6 +1857,17 @@ static int acf_dsntree_icon(bAnimListElem *UNUSED(ale))
return ICON_NODETREE;
}
+/* offset for nodetree expanders */
+static short acf_dsntree_offset(bAnimContext *ac, bAnimListElem *ale)
+{
+ bNodeTree *ntree = (bNodeTree *)ale->data;
+ short offset= acf_generic_basic_offset(ac, ale);
+
+ offset += acf_nodetree_rootType_offset(ntree);
+
+ return offset;
+}
+
/* get the appropriate flag(s) for the setting when it is valid */
static int acf_dsntree_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
{
@@ -1884,8 +1925,8 @@ static bAnimChannelType ACF_DSNTREE=
acf_generic_dataexpand_color, /* backdrop color */
acf_generic_dataexpand_backdrop,/* backdrop */
- acf_generic_indention_1, /* indent level */ // XXX this only works for compositing
- acf_generic_basic_offset, /* offset */
+ acf_generic_indention_1, /* indent level */
+ acf_dsntree_offset, /* offset */
acf_generic_idblock_name, /* name */
acf_dsntree_icon, /* icon */
diff --git a/source/blender/editors/animation/anim_filter.c b/source/blender/editors/animation/anim_filter.c
index ca300892636..e2c902d6131 100644
--- a/source/blender/editors/animation/anim_filter.c
+++ b/source/blender/editors/animation/anim_filter.c
@@ -672,7 +672,7 @@ static bAnimListElem *make_new_animlistelem (void *data, short datatype, ID *own
bNodeTree *ntree= (bNodeTree *)data;
AnimData *adt= ntree->adt;
- ale->flag= FILTER_NTREE_SCED(ntree);
+ ale->flag= FILTER_NTREE_DATA(ntree);
ale->key_data= (adt) ? adt->action : NULL;
ale->datatype= ALE_ACT;
@@ -1282,25 +1282,11 @@ static size_t animdata_filter_gpencil (ListBase *anim_data, void *UNUSED(data),
static size_t animdata_filter_ds_nodetree (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, ID *owner_id, bNodeTree *ntree, int filter_mode)
{
ListBase tmp_data = {NULL, NULL};
- short expanded = 0;
size_t tmp_items = 0;
size_t items = 0;
- /* get datatype specific data first */
- if (owner_id == NULL)
- return 0;
-
- switch (GS(owner_id->name)) {
- case ID_SCE: /* compositing nodes */
- {
- //Scene *scene = (Scene *)owner_id;
- expanded = FILTER_NTREE_SCED(ntree); // XXX: this macro needs renaming... doesn't only do this for scene ones!
- }
- break;
- }
-
/* add nodetree animation channels */
- BEGIN_ANIMFILTER_SUBCHANNELS(expanded)
+ BEGIN_ANIMFILTER_SUBCHANNELS(FILTER_NTREE_DATA(ntree))
{
/* animation data filtering */
tmp_items += animfilter_block_data(ac, &tmp_data, ads, (ID *)ntree, filter_mode);
@@ -1427,6 +1413,11 @@ static size_t animdata_filter_ds_materials (bAnimContext *ac, ListBase *anim_dat
/* textures */
if (!(ads->filterflag & ADS_FILTER_NOTEX))
tmp_items += animdata_filter_ds_textures(ac, &tmp_data, ads, (ID *)ma, filter_mode);
+
+ /* nodes */
+ if ((ma->nodetree) && !(ads->filterflag & ADS_FILTER_NONTREE)) {
+ tmp_items += animdata_filter_ds_nodetree(ac, &tmp_data, ads, (ID *)ma, ma->nodetree, filter_mode);
+ }
}
END_ANIMFILTER_SUBCHANNELS;