Animation Editors - Texture Animation:
authorJoshua Leung <aligorith@gmail.com>
Wed, 17 Feb 2010 10:21:07 +0000 (10:21 +0000)
committerJoshua Leung <aligorith@gmail.com>
Wed, 17 Feb 2010 10:21:07 +0000 (10:21 +0000)
Texture animation is now shown in the animation editors. Texture stacks are shown for each Material/Lamp/World block that uses them.

There is currently still a bit of a bug with this which means that unless the owner of the texture stack is animated too, the animation data for the textures won't show up. This will get rectified soon though.

12 files changed:
source/blender/blenkernel/intern/texture.c
source/blender/editors/animation/anim_channels_defines.c
source/blender/editors/animation/anim_filter.c
source/blender/editors/animation/keyframes_edit.c
source/blender/editors/include/ED_anim_api.h
source/blender/editors/interface/interface_templates.c
source/blender/makesdna/DNA_action_types.h
source/blender/makesdna/DNA_lamp_types.h
source/blender/makesdna/DNA_material_types.h
source/blender/makesdna/DNA_texture_types.h
source/blender/makesdna/DNA_world_types.h
source/blender/makesrna/intern/rna_action.c

index feeb98a5a8c3a8ae541e4e85497d84ab59e852e3..10fdbc7fa1414235c61552d275a233c8966a4e14 100644 (file)
@@ -420,6 +420,7 @@ void free_texture(Tex *tex)
        if(tex->env) BKE_free_envmap(tex->env);
        if(tex->pd) BKE_free_pointdensity(tex->pd);
        if(tex->vd) BKE_free_voxeldata(tex->vd);
+       BKE_free_animdata((struct ID *)tex);
        BKE_previewimg_free(&tex->preview);
        BKE_icon_delete((struct ID*)tex);
        tex->id.icon_id = 0;
index 696a3553a46f4c193e61ef8ead289740cd885ccd..3e711ccc2c1b6cb36f6f3fbf20ca277ab3ee3369 100644 (file)
@@ -55,6 +55,7 @@
 #include "DNA_lamp_types.h"
 #include "DNA_mesh_types.h"
 #include "DNA_material_types.h"
+#include "DNA_texture_types.h"
 #include "DNA_meta_types.h"
 #include "DNA_node_types.h"
 #include "DNA_userdef_types.h"
@@ -255,8 +256,9 @@ static short acf_generic_indention_flexible(bAnimContext *ac, bAnimListElem *ale
        short indent= 0;
        
        if (ale->id) {
-               /* special exception for materials and particles */
-               if (ELEM(GS(ale->id->name),ID_MA,ID_PA))
+               /* special exception for materials, textures, and particles */
+               // xxx should tex use indention 2?
+               if (ELEM3(GS(ale->id->name),ID_MA,ID_PA,ID_TE))
                        indent++;
        }
        
@@ -290,8 +292,25 @@ 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 */
+               if (GS(ale->id->name) == ID_TE) {
+                       /* minimum offset */
+                       offset += 21;
+                       
+                       /* special offset from owner type */
+                       switch (ale->ownertype) {
+                               case ANIMTYPE_DSMAT:
+                                       offset += 21;
+                                       break;
+                                       
+                               case ANIMTYPE_DSLAM:
+                               case ANIMTYPE_DSWOR:
+                                       offset += 14;
+                                       break;
+                       }
+               }
                /* special exception for materials and particles */
-               if (ELEM(GS(ale->id->name),ID_MA,ID_PA)) 
+               else if (ELEM(GS(ale->id->name),ID_MA,ID_PA)) 
                        offset += 21;
                        
                /* if not in Action Editor mode, groupings must carry some offset too... */
@@ -329,13 +348,19 @@ static short acf_generic_none_setting_valid(bAnimContext *ac, bAnimListElem *ale
 static short acf_generic_dsexpand_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting)
 {
        switch (setting) {
-               /* only expand supported */
+               /* only expand supported everywhere */
                case ACHANNEL_SETTING_EXPAND:
                        return 1;
                        
-                /* visible - only available in Graph Editor */
+               /* visible 
+                *      - only available in Graph Editor 
+                *      - NOT available for 'filler' channels
+                */
                case ACHANNEL_SETTING_VISIBLE: 
-                       return ((ac) && (ac->spacetype == SPACE_IPO));
+                       if (ELEM3(ale->type, ANIMTYPE_FILLMATD, ANIMTYPE_FILLPARTD, ANIMTYPE_FILLTEXD))
+                               return 0;
+                       else
+                               return ((ac) && (ac->spacetype == SPACE_IPO));
                        
                default:
                        return 0;
@@ -1166,6 +1191,112 @@ static bAnimChannelType ACF_FILLPARTD=
        acf_generic_dsexpand_setting_ptr                /* pointer for setting */
 };
 
+/* Textures Expander  ------------------------------------------- */
+
+/* offset for groups + grouped entities */
+static short acf_filltexd_offset(bAnimContext *ac, bAnimListElem *ale)
+{
+       short offset= acf_generic_basic_offset(ac, ale);
+       
+       if (ale->id) {
+               /* materials */
+               switch (GS(ale->id->name)) {
+                       case ID_MA:
+                               offset += 21;
+                               break;
+                               
+                       case ID_LA:
+                       case ID_WO:
+                               offset += 14;
+                               break;
+               }
+       }
+       
+       return offset;
+}
+
+// TODO: just get this from RNA?
+static int acf_filltexd_icon(bAnimListElem *ale)
+{
+       return ICON_TEXTURE_DATA;
+}
+
+static void acf_filltexd_name(bAnimListElem *ale, char *name)
+{
+       strcpy(name, "Textures");
+}
+
+/* get pointer to the setting (category only) */
+static void *acf_filltexd_setting_ptr(bAnimListElem *ale, int setting, short *type)
+{
+       ID *id= (ID *)ale->data;
+       
+       /* clear extra return data first */
+       *type= 0;
+       
+       switch (setting) {
+               case ACHANNEL_SETTING_EXPAND: /* expanded */
+               {
+                       switch (GS(id->name)) {
+                               case ID_MA:
+                               {
+                                       Material *ma= (Material *)id;
+                                       GET_ACF_FLAG_PTR(ma->flag);
+                               }
+                               
+                               case ID_LA:
+                               {
+                                       Lamp *la= (Lamp *)id;
+                                       GET_ACF_FLAG_PTR(la->flag);
+                               }
+                                       
+                               case ID_WO:
+                               {
+                                       World *wo= (World *)id;
+                                       GET_ACF_FLAG_PTR(wo->flag);
+                               }
+                       }
+               }
+               
+               default: /* unsupported */
+                       return NULL;
+       }
+}
+
+/* get the appropriate flag(s) for the setting when it is valid  */
+static int acf_filltexd_setting_flag(bAnimContext *ac, int setting, short *neg)
+{
+       /* clear extra return data first */
+       *neg= 0;
+       
+       switch (setting) {
+               case ACHANNEL_SETTING_EXPAND: /* expanded */
+                       /* NOTE: the exact same flag must be used for other texture stack types too! */
+                       return MA_DS_SHOW_TEXS; 
+               
+               default: /* unsupported */
+                       return 0;
+       }
+}
+
+/* particles expander type define */
+static bAnimChannelType ACF_FILLTEXD= 
+{
+       "Textures Filler",                              /* type name */
+       
+       acf_generic_dataexpand_color,   /* backdrop color */
+       acf_generic_dataexpand_backdrop,/* backdrop */
+       acf_generic_indention_flexible, /* indent level */
+       acf_filltexd_offset,                    /* offset */
+       
+       acf_filltexd_name,                              /* name */
+       acf_filltexd_icon,                              /* icon */
+       
+       acf_generic_dsexpand_setting_valid,     /* has setting */       
+       acf_filltexd_setting_flag,                      /* flag for setting */
+       acf_filltexd_setting_ptr                        /* pointer for setting */
+};
+
 /* Material Expander  ------------------------------------------- */
 
 // TODO: just get this from RNA?
@@ -1324,6 +1455,101 @@ static bAnimChannelType ACF_DSLAM=
        acf_dslam_setting_ptr                                   /* pointer for setting */
 };
 
+/* Texture Expander  ------------------------------------------- */
+
+// TODO: just get this from RNA?
+static int acf_dstex_icon(bAnimListElem *ale)
+{
+       return ICON_TEXTURE_DATA;
+}
+
+/* offset for texture expanders */
+static short acf_dstex_offset(bAnimContext *ac, bAnimListElem *ale)
+{
+       short offset = 21;
+       
+       /* special offset from owner type */
+       // FIXME: too much now!
+       switch (ale->ownertype) {
+               case ANIMTYPE_DSMAT:
+                       offset += 14;
+                       
+               case ANIMTYPE_DSLAM:
+               case ANIMTYPE_DSWOR:
+                       offset += 7;
+       }
+       
+       return offset;
+}
+
+/* get the appropriate flag(s) for the setting when it is valid  */
+static int acf_dstex_setting_flag(bAnimContext *ac, int setting, short *neg)
+{
+       /* clear extra return data first */
+       *neg= 0;
+       
+       switch (setting) {
+               case ACHANNEL_SETTING_EXPAND: /* expanded */
+                       return TEX_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_dstex_setting_ptr(bAnimListElem *ale, int setting, short *type)
+{
+       Tex *tex= (Tex *)ale->data;
+       
+       /* clear extra return data first */
+       *type= 0;
+       
+       switch (setting) {
+               case ACHANNEL_SETTING_EXPAND: /* expanded */
+                       GET_ACF_FLAG_PTR(tex->flag);
+                       
+               case ACHANNEL_SETTING_SELECT: /* selected */
+               case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
+               case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
+                       if (tex->adt)
+                               GET_ACF_FLAG_PTR(tex->adt->flag)
+                       else
+                               return NULL;    
+               
+               default: /* unsupported */
+                       return NULL;
+       }
+}
+
+/* material expander type define */
+static bAnimChannelType ACF_DSTEX= 
+{
+       "Texture Data Expander",                /* type name */
+       
+       acf_generic_channel_color,              /* backdrop color */
+       acf_generic_channel_backdrop,   /* backdrop */
+       acf_generic_indention_0,                /* indent level */
+       acf_dstex_offset,                               /* offset */
+       
+       acf_generic_idblock_name,               /* name */
+       acf_dstex_icon,                                 /* icon */
+       
+       acf_generic_dataexpand_setting_valid,   /* has setting */
+       acf_dstex_setting_flag,                                 /* flag for setting */
+       acf_dstex_setting_ptr                                   /* pointer for setting */
+};
+
 /* Camera Expander  ------------------------------------------- */
 
 // TODO: just get this from RNA?
@@ -2260,6 +2486,7 @@ void ANIM_init_channel_typeinfo_data (void)
                animchannelTypeInfo[type++]= &ACF_FILLDRIVERS;  /* Drivers Expander */
                animchannelTypeInfo[type++]= &ACF_FILLMATD;     /* Materials Expander */
                animchannelTypeInfo[type++]= &ACF_FILLPARTD;    /* Particles Expander */
+               animchannelTypeInfo[type++]= &ACF_FILLTEXD;             /* Textures Expander */
                
                animchannelTypeInfo[type++]= &ACF_DSMAT;                /* Material Channel */
                animchannelTypeInfo[type++]= &ACF_DSLAM;                /* Lamp Channel */
@@ -2272,6 +2499,7 @@ void ANIM_init_channel_typeinfo_data (void)
                animchannelTypeInfo[type++]= &ACF_DSMBALL;              /* MetaBall Channel */
                animchannelTypeInfo[type++]= &ACF_DSARM;                /* Armature Channel */
                animchannelTypeInfo[type++]= &ACF_DSMESH;               /* Mesh Channel */
+               animchannelTypeInfo[type++]= &ACF_DSTEX;                /* Texture Channel */
                
                animchannelTypeInfo[type++]= &ACF_SHAPEKEY;             /* ShapeKey */
                
index b519be88595a39aada1b68aca18aaeadb3d9fe97..9f6f76dc3c1132706d8d91c875455998a0ef430f 100644 (file)
@@ -71,6 +71,7 @@
 #include "DNA_sequence_types.h"
 #include "DNA_scene_types.h"
 #include "DNA_screen_types.h"
+#include "DNA_texture_types.h"
 #include "DNA_windowmanager_types.h"
 #include "DNA_world_types.h"
 
@@ -552,6 +553,35 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s
                                
                                ale->flag= FILTER_PART_OBJC(ob);
                                
+                               ale->key_data= NULL;
+                               ale->datatype= ALE_NONE;
+                       }
+                               break;
+                       case ANIMTYPE_FILLTEXD:
+                       {
+                               ID *id= (ID *)data;
+                               
+                               switch (GS(id->name)) {
+                                       case ID_MA:
+                                       {
+                                               Material *ma= (Material *)id;
+                                               ale->flag= FILTER_TEX_MATC(ma);
+                                       }
+                                               break;
+                                       case ID_LA:
+                                       {
+                                               Lamp *la= (Lamp *)id;
+                                               ale->flag= FILTER_TEX_LAMC(la);
+                                       }
+                                               break;
+                                       case ID_WO:
+                                       {
+                                               World *wo= (World *)id;
+                                               ale->flag= FILTER_TEX_WORC(wo);
+                                       }
+                                               break;
+                               }
+                               
                                ale->key_data= NULL;
                                ale->datatype= ALE_NONE;
                        }
@@ -684,6 +714,19 @@ bAnimListElem *make_new_animlistelem (void *data, short datatype, void *owner, s
                                ale->key_data= (adt) ? adt->action : NULL;
                                ale->datatype= ALE_ACT;
                                
+                               ale->adt= BKE_animdata_from_id(data);
+                       }
+                               break;
+                       case ANIMTYPE_DSTEX:
+                       {
+                               Tex *tex= (Tex *)data;
+                               AnimData *adt= tex->adt;
+                               
+                               ale->flag= FILTER_TEX_DATA(tex); 
+                               
+                               ale->key_data= (adt) ? adt->action : NULL;
+                               ale->datatype= ALE_ACT;
+                               
                                ale->adt= BKE_animdata_from_id(data);
                        }
                                break;
@@ -1220,6 +1263,133 @@ static int animdata_filter_gpencil (ListBase *anim_data, bScreen *sc, int filter
 }
 #endif 
 
+/* NOTE: owner_id is either material, lamp, or world block, which is the direct owner of the texture stack in question */
+static int animdata_filter_dopesheet_texs (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, ID *owner_id, int filter_mode)
+{
+       ListBase texs = {NULL, NULL};
+       LinkData *ld;
+       MTex **mtex = NULL;
+       short expanded=0;
+       int ownertype = ANIMTYPE_NONE;
+       
+       bAnimListElem *ale=NULL;
+       int items=0, a=0;
+       
+       /* get datatype specific data first */
+       if (owner_id == NULL)
+               return 0;
+       
+       switch (GS(owner_id->name)) {
+               case ID_MA:
+               {
+                       Material *ma= (Material *)owner_id;
+                       
+                       mtex= (MTex**)(&ma->mtex);
+                       expanded= FILTER_TEX_MATC(ma);
+                       ownertype= ANIMTYPE_DSMAT;
+               }
+                       break;
+               case ID_LA:
+               {
+                       Lamp *la= (Lamp *)owner_id;
+                       
+                       mtex= (MTex**)(&la->mtex);
+                       expanded= FILTER_TEX_LAMC(la);
+                       ownertype= ANIMTYPE_DSLAM;
+               }
+                       break;
+               case ID_WO:
+               {
+                       World *wo= (World *)owner_id;
+                       
+                       mtex= (MTex**)(&wo->mtex);
+                       expanded= FILTER_TEX_WORC(wo);
+                       ownertype= ANIMTYPE_DSWOR;
+               }
+                       break;
+               default: 
+               {
+                       /* invalid/unsupported option */
+                       if (G.f & G_DEBUG)
+                               printf("ERROR: unsupported owner_id (i.e. texture stack) for filter textures - %s \n", owner_id->name);
+                       return 0;
+               }
+       }
+       
+       /* firstly check that we actuallly have some textures, by gathering all textures in a temp list */
+       for (a=0; a < MAX_MTEX; a++) {
+               Tex *tex= (mtex[a]) ? mtex[a]->tex : NULL;
+               short ok = 0;
+               
+               /* for now, if no texture returned, skip (this shouldn't confuse the user I hope) */
+               if (ELEM(NULL, tex, tex->adt)) 
+                       continue;
+               
+               /* check if ok */
+               ANIMDATA_FILTER_CASES(tex, 
+                       { /* AnimData blocks - do nothing... */ },
+                       ok=1;, 
+                       ok=1;, 
+                       ok=1;)
+               if (ok == 0) continue;
+               
+               /* make a temp list elem for this */
+               ld= MEM_callocN(sizeof(LinkData), "DopeSheet-TextureCache");
+               ld->data= tex;
+               BLI_addtail(&texs, ld);
+       }
+       
+       /* if there were no channels found, no need to carry on */
+       if (texs.first == NULL)
+               return 0;
+       
+       /* include textures-expand widget? */
+       if ((filter_mode & ANIMFILTER_CHANNELS) && !(filter_mode & ANIMFILTER_CURVESONLY)) {
+               ale= make_new_animlistelem(owner_id, ANIMTYPE_FILLTEXD, owner_id, ownertype, owner_id);
+               if (ale) {
+                       BLI_addtail(anim_data, ale);
+                       items++;
+               }
+       }
+       
+       /* add textures */
+       if ((expanded) || (filter_mode & ANIMFILTER_CURVESONLY)) {
+               /* for each texture in cache, add channels  */
+               for (ld= texs.first; ld; ld= ld->next) {
+                       Tex *tex= (Tex *)ld->data;
+                       
+                       /* include texture-expand widget? */
+                       if (filter_mode & ANIMFILTER_CHANNELS) {
+                               /* check if filtering by active status */
+                               if ANIMCHANNEL_ACTIVEOK(tex) {
+                                       ale= make_new_animlistelem(tex, ANIMTYPE_DSTEX, owner_id, ownertype, owner_id);
+                                       if (ale) {
+                                               BLI_addtail(anim_data, ale);
+                                               items++;
+                                       }
+                               }
+                       }
+                       
+                       /* add texture's animation data
+                        * NOTE: for these, we make the owner/ownertype the material/lamp/etc. not the texture, otherwise the
+                        * drawing code cannot resolve the indention easily
+                        */
+                       if (!(filter_mode & ANIMFILTER_VISIBLE) || FILTER_TEX_DATA(tex) || (filter_mode & ANIMFILTER_CURVESONLY)) {
+                               ANIMDATA_FILTER_CASES(tex, 
+                                       { /* AnimData blocks - do nothing... */ },
+                                       items += animdata_filter_nla(ac, anim_data, ads, tex->adt, filter_mode, owner_id, ownertype, (ID *)tex);, 
+                                       items += animdata_filter_fcurves(anim_data, ads, tex->adt->drivers.first, NULL, owner_id, ownertype, filter_mode, (ID *)tex);, 
+                                       items += animdata_filter_action(ac, anim_data, ads, tex->adt->action, filter_mode, owner_id, ownertype, (ID *)tex);)
+                       }
+               }
+       }
+       
+       /* free cache */
+       BLI_freelistN(&texs);
+       
+       /* return the number of items added to the list */
+       return items;
+}
 
 static int animdata_filter_dopesheet_mats (bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, Base *base, int filter_mode)
 {
@@ -1254,6 +1424,7 @@ static int animdata_filter_dopesheet_mats (bAnimContext *ac, ListBase *anim_data
        }
        
        /* if there were no channels found, no need to carry on */
+       // XXX: textures with no animated owner material won't work because of this...
        if (mats.first == NULL)
                return 0;
        
@@ -1287,11 +1458,16 @@ static int animdata_filter_dopesheet_mats (bAnimContext *ac, ListBase *anim_data
                        
                        /* add material's animation data */
                        if (!(filter_mode & ANIMFILTER_VISIBLE) || FILTER_MAT_OBJD(ma) || (filter_mode & ANIMFILTER_CURVESONLY)) {
+                               /* material's animation data */
                                ANIMDATA_FILTER_CASES(ma, 
                                        { /* AnimData blocks - do nothing... */ },
                                        items += animdata_filter_nla(ac, anim_data, ads, ma->adt, filter_mode, ma, ANIMTYPE_DSMAT, (ID *)ma);, 
                                        items += animdata_filter_fcurves(anim_data, ads, ma->adt->drivers.first, NULL, ma, ANIMTYPE_DSMAT, filter_mode, (ID *)ma);, 
                                        items += animdata_filter_action(ac, anim_data, ads, ma->adt->action, filter_mode, ma, ANIMTYPE_DSMAT, (ID *)ma);)
+                                       
+                               /* textures */
+                               if (!(ads->filterflag & ADS_FILTER_NOTEX))
+                                       items += animdata_filter_dopesheet_texs(ac, anim_data, ads, (ID *)ma, filter_mode);
                        }
                }
        }
@@ -1443,7 +1619,18 @@ static int animdata_filter_dopesheet_obdata (bAnimContext *ac, ListBase *anim_da
                        { /* AnimData blocks - do nothing... */ },
                        items+= animdata_filter_nla(ac, anim_data, ads, iat->adt, filter_mode, iat, type, (ID *)iat);,
                        items+= animdata_filter_fcurves(anim_data, ads, adt->drivers.first, NULL, iat, type, filter_mode, (ID *)iat);, 
-                       items += animdata_filter_action(ac, anim_data, ads, iat->adt->action, filter_mode, iat, type, (ID *)iat);)
+                       items+= animdata_filter_action(ac, anim_data, ads, iat->adt->action, filter_mode, iat, type, (ID *)iat);)
+                       
+               /* sub-data filtering... */
+               switch (ob->type) {
+                       case OB_LAMP:   /* lamp - textures */
+                       {
+                               /* textures */
+                               if (!(ads->filterflag & ADS_FILTER_NOTEX))
+                                       items += animdata_filter_dopesheet_texs(ac, anim_data, ads, ob->data, filter_mode);
+                       }
+                               break;
+               }
        }
        
        /* return the number of items added to the list */
@@ -1788,6 +1975,13 @@ static int animdata_filter_dopesheet_scene (bAnimContext *ac, ListBase *anim_dat
                                }
                        }
                )
+               
+               /* if expanded, check world textures too */
+               if (FILTER_WOR_SCED(wo) || (filter_mode & ANIMFILTER_CURVESONLY)) {
+                       /* textures for world */
+                       if (!(ads->filterflag & ADS_FILTER_NOTEX))
+                               items += animdata_filter_dopesheet_texs(ac, anim_data, ads, (ID *)wo, filter_mode);
+               }
        }
        /* nodetree */
        if ((ntree && ntree->adt) && !(ads->filterflag & ADS_FILTER_NONTREE)) {
@@ -2025,10 +2219,40 @@ static int animdata_filter_dopesheet (bAnimContext *ac, ListBase *anim_data, bDo
                                                                matOk= 1;, 
                                                                matOk= 1;, 
                                                                matOk= 1;)
-                                               }
+                                                               
+                                                       if (matOk) 
+                                                               break;
                                                        
-                                               if (matOk) 
-                                                       break;
+                                                       /* textures? */
+                                                       // TODO: make this a macro that is used in the other checks too
+                                                       // NOTE: this has little use on its own, since the actual filtering still ignores if no anim on the data
+                                                       if (!(ads->filterflag & ADS_FILTER_NOTEX)) {
+                                                               int mtInd;
+                                                               
+                                                               for (mtInd= 0; mtInd < MAX_MTEX; mtInd++) {
+                                                                       MTex *mtex= ma->mtex[mtInd];
+                                                                       
+                                                                       if (mtex && mtex->tex) {
+                                                                               /* if texture has relevant animation data, break */
+                                                                               ANIMDATA_FILTER_CASES(mtex->tex, 
+                                                                                       {
+                                                                                               /* 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(mtex->tex);
+                                                                                               matOk=0;
+                                                                                       },
+                                                                                       matOk= 1;, 
+                                                                                       matOk= 1;, 
+                                                                                       matOk= 1;)
+                                                                                       
+                                                                               if (matOk) 
+                                                                                       break;
+                                                                       }
+                                                               }
+                                                       }
+                                                       
+                                               }
                                        }
                                }
                                
index 6511a02271883ed248636cdf075950f037c55ca9..ca1df14e14c0d8b3e0dfd7c90093aa9447f09c06 100644 (file)
@@ -642,6 +642,7 @@ static short snap_bezier_nearmarker(BeztEditData *bed, BezTriple *bezt)
 static short snap_bezier_horizontal(BeztEditData *bed, BezTriple *bezt)
 {
        if (bezt->f2 & SELECT) {
+               // XXX currently this snaps both handles to the nearest horizontal value, but perhaps user just wants to level out handles instead?
                bezt->vec[0][1]= bezt->vec[2][1]= (float)floor(bezt->vec[1][1] + 0.5f);
                if ((bezt->h1==HD_AUTO) || (bezt->h1==HD_VECT)) bezt->h1= HD_ALIGN;
                if ((bezt->h2==HD_AUTO) || (bezt->h2==HD_VECT)) bezt->h2= HD_ALIGN;
index 5f966b9ddc3eed5979a1f629ff546faf23f40cae..2f089a41a3f9b3a7b20293f2031963c6ed383a5e 100644 (file)
@@ -134,6 +134,7 @@ typedef enum eAnim_ChannelType {
        ANIMTYPE_FILLDRIVERS,
        ANIMTYPE_FILLMATD,
        ANIMTYPE_FILLPARTD,
+       ANIMTYPE_FILLTEXD,
        
        ANIMTYPE_DSMAT,
        ANIMTYPE_DSLAM,
@@ -146,6 +147,7 @@ typedef enum eAnim_ChannelType {
        ANIMTYPE_DSMBALL,
        ANIMTYPE_DSARM,
        ANIMTYPE_DSMESH,
+       ANIMTYPE_DSTEX,
        
        ANIMTYPE_SHAPEKEY,
        
@@ -225,8 +227,13 @@ typedef enum eAnimFilter_Flags {
        /* 'Sub-object/Action' channels (flags stored in Action) */
 #define SEL_ACTC(actc) ((actc->flag & ACT_SELECTED))
 #define EXPANDED_ACTC(actc) ((actc->flag & ACT_COLLAPSED)==0)
-       /* 'Sub-AnimData' chanenls */
+       /* 'Sub-AnimData' channels */
 #define EXPANDED_DRVD(adt) ((adt->flag & ADT_DRIVERS_COLLAPSED)==0)
+       /* Texture expanders */
+#define FILTER_TEX_MATC(ma) ((ma->flag & MA_DS_SHOW_TEXS))
+#define FILTER_TEX_LAMC(la) ((la->flag & LA_DS_SHOW_TEXS))
+#define FILTER_TEX_WORC(wa) ((wo->flag & WO_DS_SHOW_TEXS))
+#define FILTER_TEX_DATA(tex) ((tex->flag & TEX_DS_EXPAND))
 
 /* Actions (also used for Dopesheet) */
        /* Action Channel Group */
index 12e0066c53c0800143daaab1b2ca70b31be32467..c327d4515d3dbbc79c34ad5d3cc424898dd3498e 100644 (file)
@@ -105,6 +105,8 @@ void uiTemplateDopeSheetFilter(uiLayout *layout, bContext *C, PointerRNA *ptr)
                uiItemR(row, "", 0, ptr, "display_material", 0);
        if (mainptr && mainptr->lamp.first)
                uiItemR(row, "", 0, ptr, "display_lamp", 0);
+       if (mainptr && mainptr->tex.first)
+               uiItemR(row, "", 0, ptr, "display_texture", 0);
        if (mainptr && mainptr->camera.first)
                uiItemR(row, "", 0, ptr, "display_camera", 0);
        if (mainptr && mainptr->curve.first)
index 278f54db3a955da29dab85e9aeacc098a824543d..f76a7f6140e5233bdb54c54a18ad35eec9076de9 100644 (file)
@@ -537,6 +537,7 @@ typedef enum eDopeSheet_FilterFlag {
        ADS_FILTER_NOMBA                        = (1<<17),
        ADS_FILTER_NOARM                        = (1<<18),
        ADS_FILTER_NONTREE                      = (1<<19),
+       ADS_FILTER_NOTEX                        = (1<<20),
        
                /* NLA-specific filters */
        ADS_FILTER_NLA_NOACT            = (1<<25),      /* if the AnimData block has no NLA data, don't include to just show Action-line */
index 665cb1c3819ec0bacb0a472bf3544fe452eb78b2..cb458708b3eccc7c44b361db4ada60c1a8c92104 100644 (file)
@@ -115,6 +115,10 @@ typedef struct Lamp {
 
 /* flag */
 #define LA_DS_EXPAND   1
+       /* NOTE: this must have the same value as MA_DS_SHOW_TEXS, 
+        * otherwise anim-editors will not read correctly
+        */
+#define LA_DS_SHOW_TEXS        4
 
 /* type */
 #define LA_LOCAL               0
index fa6cddd822779f5895cc82c49bf46a24dcaf0842..f8eb6e76693ed6b1919a80cb974af350d1ee63d9 100644 (file)
@@ -181,6 +181,11 @@ typedef struct Material {
 #define MA_IS_USED             1
                /* for dopesheet */
 #define MA_DS_EXPAND   2
+               /* for dopesheet (texture stack expander)
+                * NOTE: this must have the same value as other texture stacks, 
+                * otherwise anim-editors will not read correctly
+                */
+#define MA_DS_SHOW_TEXS        4
 
 /* mode (is int) */
 #define MA_TRACEBLE            1
index be8c909271b4cf547d59a838ed7f268fbe79e233..5747669d015afb673a0d15b609d2eccf4515bdd0 100644 (file)
@@ -357,6 +357,7 @@ typedef struct TexMapping {
 #define TEX_REPEAT_XMIR                128
 #define TEX_REPEAT_YMIR                256
 #define TEX_FLAG_MASK          ( TEX_COLORBAND | TEX_FLIPBLEND | TEX_NEGALPHA | TEX_CHECKER_ODD | TEX_CHECKER_EVEN | TEX_PRV_ALPHA | TEX_PRV_NOR | TEX_REPEAT_XMIR | TEX_REPEAT_YMIR ) 
+#define TEX_DS_EXPAND          512
 
 /* extend (starts with 1 because of backward comp.) */
 #define TEX_EXTEND             1
index 0c0317ac44405bf92af833f8d0570a9ed0ce75c3..66d31467c4a8b2bfdc3d8ef4f104b1485273fa86 100644 (file)
@@ -186,6 +186,10 @@ typedef struct World {
 
 /* flag */
 #define WO_DS_EXPAND   (1<<0)
+       /* NOTE: this must have the same value as MA_DS_SHOW_TEXS, 
+        * otherwise anim-editors will not read correctly
+        */
+#define WO_DS_SHOW_TEXS        (1<<2)
 
 #endif
 
index 3e56ce7f562f480082bf827239a377c6b64ee8ab..3033999ecde941c3ca5bb5d2a077e07d74580acf 100644 (file)
@@ -142,6 +142,12 @@ static void rna_def_dopesheet(BlenderRNA *brna)
        RNA_def_property_ui_icon(prop, ICON_LAMP_DATA, 0);
        RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN_EDIT, NULL);
        
+       prop= RNA_def_property(srna, "display_texture", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOTEX);
+       RNA_def_property_ui_text(prop, "Display Texture", "Include visualization of Texture related Animation data");
+       RNA_def_property_ui_icon(prop, ICON_TEXTURE_DATA, 0);
+       RNA_def_property_update(prop, NC_ANIMATION|ND_ANIMCHAN_EDIT, NULL);
+       
        prop= RNA_def_property(srna, "display_curve", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_negative_sdna(prop, NULL, "filterflag", ADS_FILTER_NOCUR);
        RNA_def_property_ui_text(prop, "Display Curve", "Include visualization of Curve related Animation data");