[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34078] trunk/blender: Animation data for lattices is now shown in the Animaton Editors

Joshua Leung aligorith at gmail.com
Wed Jan 5 01:37:21 CET 2011


Revision: 34078
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=34078
Author:   aligorith
Date:     2011-01-05 01:37:21 +0100 (Wed, 05 Jan 2011)

Log Message:
-----------
Animation data for lattices is now shown in the Animaton Editors

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/space_dopesheet.py
    trunk/blender/source/blender/editors/animation/anim_channels_defines.c
    trunk/blender/source/blender/editors/animation/anim_channels_edit.c
    trunk/blender/source/blender/editors/animation/anim_filter.c
    trunk/blender/source/blender/editors/animation/keyframes_draw.c
    trunk/blender/source/blender/editors/include/ED_anim_api.h
    trunk/blender/source/blender/editors/space_nla/nla_channels.c
    trunk/blender/source/blender/makesdna/DNA_action_types.h
    trunk/blender/source/blender/makesdna/DNA_lattice_types.h
    trunk/blender/source/blender/makesrna/intern/rna_action.c

Modified: trunk/blender/release/scripts/ui/space_dopesheet.py
===================================================================
--- trunk/blender/release/scripts/ui/space_dopesheet.py	2011-01-04 21:27:44 UTC (rev 34077)
+++ trunk/blender/release/scripts/ui/space_dopesheet.py	2011-01-05 00:37:21 UTC (rev 34078)
@@ -57,6 +57,8 @@
         row.prop(dopesheet, "show_curves", text="")
     if bpy.data.metaballs:
         row.prop(dopesheet, "show_metaballs", text="")
+    if bpy.data.lattices:
+        row.prop(dopesheet, "show_lattices", text="")
     if bpy.data.armatures:
         row.prop(dopesheet, "show_armatures", text="")
     if bpy.data.particles:

Modified: trunk/blender/source/blender/editors/animation/anim_channels_defines.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_channels_defines.c	2011-01-04 21:27:44 UTC (rev 34077)
+++ trunk/blender/source/blender/editors/animation/anim_channels_defines.c	2011-01-05 00:37:21 UTC (rev 34078)
@@ -42,6 +42,7 @@
 #include "DNA_space_types.h"
 #include "DNA_key_types.h"
 #include "DNA_lamp_types.h"
+#include "DNA_lattice_types.h"
 #include "DNA_mesh_types.h"
 #include "DNA_material_types.h"
 #include "DNA_meta_types.h"
@@ -2234,6 +2235,82 @@
 	acf_dsmesh_setting_ptr					/* pointer for setting */
 };
 
+/* Lattice Expander  ------------------------------------------- */
+
+// TODO: just get this from RNA?
+static int acf_dslat_icon(bAnimListElem *UNUSED(ale))
+{
+	return ICON_LATTICE_DATA;
+}
+
+/* get the appropriate flag(s) for the setting when it is valid  */
+static int acf_dslat_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
+{
+	/* clear extra return data first */
+	*neg= 0;
+	
+	switch (setting) {
+		case ACHANNEL_SETTING_EXPAND: /* expanded */
+			return LT_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_dslat_setting_ptr(bAnimListElem *ale, int setting, short *type)
+{
+	Lattice *lt= (Lattice *)ale->data;
+	
+	/* clear extra return data first */
+	*type= 0;
+	
+	switch (setting) {
+		case ACHANNEL_SETTING_EXPAND: /* expanded */
+			GET_ACF_FLAG_PTR(lt->flag);
+			
+		case ACHANNEL_SETTING_SELECT: /* selected */
+		case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
+		case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
+			if (lt->adt)
+				GET_ACF_FLAG_PTR(lt->adt->flag)
+				else
+					return NULL;
+			
+		default: /* unsupported */
+			return NULL;
+	}
+}
+
+/* node tree expander type define */
+static bAnimChannelType ACF_DSLAT= 
+{
+	"Lattice Expander",				/* type name */
+	
+	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_idblock_name,		/* name */
+	acf_dslat_icon,					/* icon */
+	
+	acf_generic_dataexpand_setting_valid,	/* has setting */
+	acf_dslat_setting_flag,					/* flag for setting */
+	acf_dslat_setting_ptr					/* pointer for setting */
+};
+
 /* ShapeKey Entry  ------------------------------------------- */
 
 /* name for ShapeKey */
@@ -2490,6 +2567,7 @@
 		animchannelTypeInfo[type++]= &ACF_DSARM;		/* Armature Channel */
 		animchannelTypeInfo[type++]= &ACF_DSMESH;		/* Mesh Channel */
 		animchannelTypeInfo[type++]= &ACF_DSTEX;		/* Texture Channel */
+		animchannelTypeInfo[type++]= &ACF_DSLAT;		/* Lattice Channel */
 		
 		animchannelTypeInfo[type++]= &ACF_SHAPEKEY;		/* ShapeKey */
 		

Modified: trunk/blender/source/blender/editors/animation/anim_channels_edit.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_channels_edit.c	2011-01-04 21:27:44 UTC (rev 34077)
+++ trunk/blender/source/blender/editors/animation/anim_channels_edit.c	2011-01-05 00:37:21 UTC (rev 34078)
@@ -114,6 +114,8 @@
 			case ANIMTYPE_DSMBALL:
 			case ANIMTYPE_DSARM:
 			case ANIMTYPE_DSMESH:
+			case ANIMTYPE_DSTEX:
+			case ANIMTYPE_DSLAT:
 			{
 				/* need to verify that this data is valid for now */
 				if (ale->adt) {
@@ -157,6 +159,7 @@
 			case ANIMTYPE_DSMBALL:
 			case ANIMTYPE_DSARM:
 			case ANIMTYPE_DSMESH:
+			case ANIMTYPE_DSLAT:
 			{
 				/* need to verify that this data is valid for now */
 				// XXX: ale may be null!
@@ -234,6 +237,7 @@
 				case ANIMTYPE_DSMESH:
 				case ANIMTYPE_DSNTREE:
 				case ANIMTYPE_DSTEX:
+				case ANIMTYPE_DSLAT:
 				{
 					if ((ale->adt) && (ale->adt->flag & ADT_UI_SELECTED))
 						sel= ACHANNEL_SETFLAG_CLEAR;
@@ -317,6 +321,7 @@
 			case ANIMTYPE_DSMESH:
 			case ANIMTYPE_DSNTREE:
 			case ANIMTYPE_DSTEX:
+			case ANIMTYPE_DSLAT:
 			{
 				/* need to verify that this data is valid for now */
 				if (ale->adt) {
@@ -1938,6 +1943,7 @@
 		case ANIMTYPE_DSMESH:
 		case ANIMTYPE_DSNTREE:
 		case ANIMTYPE_DSTEX:
+		case ANIMTYPE_DSLAT:
 		{
 			/* sanity checking... */
 			if (ale->adt) {

Modified: trunk/blender/source/blender/editors/animation/anim_filter.c
===================================================================
--- trunk/blender/source/blender/editors/animation/anim_filter.c	2011-01-04 21:27:44 UTC (rev 34077)
+++ trunk/blender/source/blender/editors/animation/anim_filter.c	2011-01-05 00:37:21 UTC (rev 34078)
@@ -626,6 +626,19 @@
 				ale->adt= BKE_animdata_from_id(data);
 			}
 				break;
+			case ANIMTYPE_DSLAT:
+			{
+				Lattice *lt= (Lattice *)data;
+				AnimData *adt= lt->adt;
+				
+				ale->flag= FILTER_LATTICE_OBJD(lt);
+				
+				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;
@@ -1583,6 +1596,14 @@
 			expanded= FILTER_MESH_OBJD(me);
 		}
 			break;
+		case OB_LATTICE: /* ---- Lattice ---- */
+		{
+			Lattice *lt = (Lattice *)ob->data;
+			
+			type= ANIMTYPE_DSLAT;
+			expanded= FILTER_LATTICE_OBJD(lt);
+		}
+			break;
 	}
 	
 	/* special exception for drivers instead of action */
@@ -1841,6 +1862,19 @@
 			}
 		}
 			break;
+		case OB_LATTICE: /* ------- Lattice ---------- */
+		{
+			Lattice *lt= (Lattice *)ob->data;
+			
+			if ((ads->filterflag & ADS_FILTER_NOLAT) == 0) {
+				ANIMDATA_FILTER_CASES(lt,
+					{ /* AnimData blocks - do nothing... */ },
+					obdata_ok= 1;,
+					obdata_ok= 1;,
+					obdata_ok= 1;)
+			}
+		}
+			break;
 	}
 	if (obdata_ok) 
 		items += animdata_filter_dopesheet_obdata(ac, anim_data, ads, base, filter_mode);
@@ -2354,6 +2388,23 @@
 							dataOk= !(ads->filterflag & ADS_FILTER_NOMESH);)
 					}
 						break;
+					case OB_LATTICE: /* ------- Lattice ---------- */
+					{
+						Lattice *lt= (Lattice *)ob->data;
+						dataOk= 0;
+						ANIMDATA_FILTER_CASES(lt, 
+							if ((ads->filterflag & ADS_FILTER_NOLAT)==0) {
+								/* 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(lt);
+								dataOk=0;
+							},
+							dataOk= !(ads->filterflag & ADS_FILTER_NOLAT);, 
+							dataOk= !(ads->filterflag & ADS_FILTER_NOLAT);, 
+							dataOk= !(ads->filterflag & ADS_FILTER_NOLAT);)
+					}
+						break;
 					default: /* --- other --- */
 						dataOk= 0;
 						break;

Modified: trunk/blender/source/blender/editors/animation/keyframes_draw.c
===================================================================
--- trunk/blender/source/blender/editors/animation/keyframes_draw.c	2011-01-04 21:27:44 UTC (rev 34077)
+++ trunk/blender/source/blender/editors/animation/keyframes_draw.c	2011-01-05 00:37:21 UTC (rev 34078)
@@ -47,6 +47,7 @@
 #include "DNA_scene_types.h"
 #include "DNA_key_types.h"
 #include "DNA_lamp_types.h"
+#include "DNA_lattice_types.h"
 #include "DNA_mesh_types.h"
 #include "DNA_material_types.h"
 #include "DNA_meta_types.h"
@@ -812,6 +813,14 @@
 				action_to_keylist(me->adt, me->adt->action, keys, blocks);
 		}
 			break;
+		case OB_LATTICE: /* ------- Lattice ---------- */
+		{
+			Lattice *lt= (Lattice *)ob->data;
+			
+			if ((lt->adt) && !(filterflag & ADS_FILTER_NOLAT)) 
+				action_to_keylist(lt->adt, lt->adt->action, keys, blocks);
+		}
+			break;
 	}
 	
 	/* Add Particle System Keyframes */

Modified: trunk/blender/source/blender/editors/include/ED_anim_api.h
===================================================================
--- trunk/blender/source/blender/editors/include/ED_anim_api.h	2011-01-04 21:27:44 UTC (rev 34077)
+++ trunk/blender/source/blender/editors/include/ED_anim_api.h	2011-01-05 00:37:21 UTC (rev 34078)
@@ -153,6 +153,7 @@
 	ANIMTYPE_DSARM,
 	ANIMTYPE_DSMESH,
 	ANIMTYPE_DSTEX,
+	ANIMTYPE_DSLAT,
 	
 	ANIMTYPE_SHAPEKEY,
 	
@@ -230,6 +231,8 @@
 #define FILTER_MBALL_OBJD(mb) ((mb->flag2 & MB_DS_EXPAND))
 #define FILTER_ARM_OBJD(arm) ((arm->flag & ARM_DS_EXPAND))
 #define FILTER_MESH_OBJD(me) ((me->flag & ME_DS_EXPAND))
+#define FILTER_LATTICE_OBJD(lt) ((lt->flag & LT_DS_EXPAND))
+
 	/* '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)

Modified: trunk/blender/source/blender/editors/space_nla/nla_channels.c
===================================================================
--- trunk/blender/source/blender/editors/space_nla/nla_channels.c	2011-01-04 21:27:44 UTC (rev 34077)
+++ trunk/blender/source/blender/editors/space_nla/nla_channels.c	2011-01-05 00:37:21 UTC (rev 34078)
@@ -173,6 +173,7 @@
 		case ANIMTYPE_DSARM:
 		case ANIMTYPE_DSMESH:
 		case ANIMTYPE_DSTEX:
+		case ANIMTYPE_DSLAT:
 		{
 			/* sanity checking... */
 			if (ale->adt) {

Modified: trunk/blender/source/blender/makesdna/DNA_action_types.h
===================================================================
--- trunk/blender/source/blender/makesdna/DNA_action_types.h	2011-01-04 21:27:44 UTC (rev 34077)
+++ trunk/blender/source/blender/makesdna/DNA_action_types.h	2011-01-05 00:37:21 UTC (rev 34078)
@@ -530,7 +530,7 @@
 	ADS_FILTER_NOSHAPEKEYS 		= (1<<6),
 	ADS_FILTER_NOMESH			= (1<<7),

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list