[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [21329] branches/soc-2009-aligorith/source /blender: NLA SoC: Assorted fixes

Joshua Leung aligorith at gmail.com
Fri Jul 3 03:10:47 CEST 2009


Revision: 21329
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=21329
Author:   aligorith
Date:     2009-07-03 03:10:46 +0200 (Fri, 03 Jul 2009)

Log Message:
-----------
NLA SoC: Assorted fixes

* Made NLA Editing functions more aware of transitions. 
- A transition can only be added between a pair of action-clips. Previous, two transitions could be added next to each other, which has undefined behaviour
- Deleting a strip with transition(s) on either side will remove the transitions too. Feedback welcome on this
- The 'type' setting for NLA-Strips is no longer editable. This was dangerous as it could result in transitions with undefined behaviour (though nothing would happen).

* Menus for adding F-Modifiers now only show relevant modifiers (i.e. 'Invalid' is not included in the list, and 'Cycles' doesn't need to be shown for NLA since we've got repeat)

* Function Generator and Noise F-Modifiers now have complete GUI's. A few settings were missed during the porting process.

* F-Modifier buttons now have their source-ID's included in the RNA Pointers used. This didn't get them animateable directly, but is a step closer.

Modified Paths:
--------------
    branches/soc-2009-aligorith/source/blender/blenkernel/BKE_fcurve.h
    branches/soc-2009-aligorith/source/blender/blenkernel/intern/nla.c
    branches/soc-2009-aligorith/source/blender/editors/animation/fmodifier_ui.c
    branches/soc-2009-aligorith/source/blender/editors/include/ED_anim_api.h
    branches/soc-2009-aligorith/source/blender/editors/space_graph/graph_buttons.c
    branches/soc-2009-aligorith/source/blender/editors/space_graph/graph_edit.c
    branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_buttons.c
    branches/soc-2009-aligorith/source/blender/editors/space_nla/nla_edit.c
    branches/soc-2009-aligorith/source/blender/makesdna/DNA_anim_types.h
    branches/soc-2009-aligorith/source/blender/makesrna/intern/rna_nla.c

Modified: branches/soc-2009-aligorith/source/blender/blenkernel/BKE_fcurve.h
===================================================================
--- branches/soc-2009-aligorith/source/blender/blenkernel/BKE_fcurve.h	2009-07-02 23:36:16 UTC (rev 21328)
+++ branches/soc-2009-aligorith/source/blender/blenkernel/BKE_fcurve.h	2009-07-03 01:10:46 UTC (rev 21329)
@@ -1,12 +1,33 @@
-/* Testing code for new animation system in 2.5 
- * Copyright 2009, Joshua Leung
+/**
+ * $Id$
+ *
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ *
+ * The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
+ * All rights reserved.
+ *
+ * Contributor(s): Joshua Leung (full recode)
+ *
+ * ***** END GPL LICENSE BLOCK *****
  */
 
 #ifndef BKE_FCURVE_H
 #define BKE_FCURVE_H
 
-//struct ListBase;
-
 struct FCurve;
 struct FModifier;
 struct ChannelDriver;
@@ -54,8 +75,8 @@
 	short size;				/* size in bytes of the struct */
 	short acttype;			/* eFMI_Action_Types */
 	short requires;			/* eFMI_Requirement_Flags */
-	char name[32]; 			/* name of modifier in interface */
-	char structName[32];	/* name of struct for SDNA */
+	char name[64]; 			/* name of modifier in interface */
+	char structName[64];	/* name of struct for SDNA */
 	
 	/* data management function pointers - special handling */
 		/* free any data that is allocated separately (optional) */

Modified: branches/soc-2009-aligorith/source/blender/blenkernel/intern/nla.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/blenkernel/intern/nla.c	2009-07-02 23:36:16 UTC (rev 21328)
+++ branches/soc-2009-aligorith/source/blender/blenkernel/intern/nla.c	2009-07-03 01:10:46 UTC (rev 21329)
@@ -66,7 +66,6 @@
 /* Remove the given NLA strip from the NLA track it occupies, free the strip's data,
  * and the strip itself. 
  */
-// TODO: with things like transitions, should these get freed too? Maybe better as a UI tool
 void free_nlastrip (ListBase *strips, NlaStrip *strip)
 {
 	/* sanity checks */
@@ -793,6 +792,7 @@
 			/* not first, so extend mode can only be NLASTRIP_EXTEND_HOLD_FORWARD not NLASTRIP_EXTEND_HOLD,
 			 * so that it doesn't override strips in previous tracks
 			 */
+			// FIXME: this needs to be more automated, since user can rearrange strips
 			strip->extendmode= NLASTRIP_EXTEND_HOLD_FORWARD;
 		}
 	}
@@ -844,7 +844,7 @@
 			if (strip->act == activeStrip->act)
 				strip->flag |= NLASTRIP_FLAG_TWEAKUSER;
 			else
-				strip->flag &= ~NLASTRIP_FLAG_TWEAKUSER; // XXX probably don't need to clear this...
+				strip->flag &= ~NLASTRIP_FLAG_TWEAKUSER;
 		}
 	}
 	
@@ -887,8 +887,8 @@
 		
 	// TODO: need to sync the user-strip with the new state of the action!
 		
-	/* for all NLA-tracks, clear the 'disabled' flag
-	 * for all NLA-strips, clear the 'tweak-user' flag
+	/* for all Tracks, clear the 'disabled' flag
+	 * for all Strips, clear the 'tweak-user' flag
 	 */
 	for (nlt= adt->nla_tracks.first; nlt; nlt= nlt->next) {
 		nlt->flag &= ~NLATRACK_DISABLED;

Modified: branches/soc-2009-aligorith/source/blender/editors/animation/fmodifier_ui.c
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/animation/fmodifier_ui.c	2009-07-02 23:36:16 UTC (rev 21328)
+++ branches/soc-2009-aligorith/source/blender/editors/animation/fmodifier_ui.c	2009-07-03 01:10:46 UTC (rev 21329)
@@ -134,7 +134,7 @@
 /* --------------- */
 	
 /* draw settings for generator modifier */
-static void draw_modifier__generator(uiLayout *layout, FModifier *fcm, short width)
+static void draw_modifier__generator(uiLayout *layout, ID *id, FModifier *fcm, short width)
 {
 	FMod_Generator *data= (FMod_Generator *)fcm->data;
 	uiLayout *col, *row;
@@ -143,7 +143,7 @@
 	PointerRNA ptr;
 	
 	/* init the RNA-pointer */
-	RNA_pointer_create(NULL, &RNA_FModifierFunctionGenerator, fcm, &ptr);
+	RNA_pointer_create(id, &RNA_FModifierFunctionGenerator, fcm, &ptr);
 	
 	/* basic settings (backdrop + mode selector + some padding) */
 	col= uiLayoutColumn(layout, 1);
@@ -248,31 +248,36 @@
 /* --------------- */
 
 /* draw settings for noise modifier */
-static void draw_modifier__fn_generator(uiLayout *layout, FModifier *fcm, short width)
+static void draw_modifier__fn_generator(uiLayout *layout, ID *id, FModifier *fcm, short width)
 {
-	uiLayout *col= uiLayoutColumn(layout, 0); // no grouping for now
+	uiLayout *col;
 	PointerRNA ptr;
 	
 	/* init the RNA-pointer */
-	RNA_pointer_create(NULL, &RNA_FModifierFunctionGenerator, fcm, &ptr);
+	RNA_pointer_create(id, &RNA_FModifierFunctionGenerator, fcm, &ptr);
 	
 	/* add the settings */
-	uiItemR(col, NULL, 0, &ptr, "amplitude", 0, 0, 0);
-	uiItemR(col, NULL, 0, &ptr, "phase_multiplier", 0, 0, 0);
-	uiItemR(col, NULL, 0, &ptr, "phase_offset", 0, 0, 0);
-	uiItemR(col, NULL, 0, &ptr, "value_offset", 0, 0, 0);
+	col= uiLayoutColumn(layout, 1);
+		uiItemR(col, "", 0, &ptr, "type", 0, 0, 0);
+		uiItemR(col, NULL, 0, &ptr, "additive", 0, 0, 1);
+	
+	col= uiLayoutColumn(layout, 0); // no grouping for now
+		uiItemR(col, NULL, 0, &ptr, "amplitude", 0, 0, 0);
+		uiItemR(col, NULL, 0, &ptr, "phase_multiplier", 0, 0, 0);
+		uiItemR(col, NULL, 0, &ptr, "phase_offset", 0, 0, 0);
+		uiItemR(col, NULL, 0, &ptr, "value_offset", 0, 0, 0);
 }
 
 /* --------------- */
 
 /* draw settings for cycles modifier */
-static void draw_modifier__cycles(uiLayout *layout, FModifier *fcm, short width)
+static void draw_modifier__cycles(uiLayout *layout, ID *id, FModifier *fcm, short width)
 {
 	uiLayout *split, *col;
 	PointerRNA ptr;
 	
 	/* init the RNA-pointer */
-	RNA_pointer_create(NULL, &RNA_FModifierCycles, fcm, &ptr);
+	RNA_pointer_create(id, &RNA_FModifierCycles, fcm, &ptr);
 	
 	/* split into 2 columns 
 	 * NOTE: the mode comboboxes shouldn't get labels, otherwise there isn't enough room
@@ -295,14 +300,17 @@
 /* --------------- */
 
 /* draw settings for noise modifier */
-static void draw_modifier__noise(uiLayout *layout, FModifier *fcm, short width)
+static void draw_modifier__noise(uiLayout *layout, ID *id, FModifier *fcm, short width)
 {
 	uiLayout *split, *col;
 	PointerRNA ptr;
 	
 	/* init the RNA-pointer */
-	RNA_pointer_create(NULL, &RNA_FModifierNoise, fcm, &ptr);
+	RNA_pointer_create(id, &RNA_FModifierNoise, fcm, &ptr);
 	
+	/* blending mode */
+	uiItemR(layout, NULL, 0, &ptr, "modification", 0, 0, 0);
+	
 	/* split into 2 columns */
 	split= uiLayoutSplit(layout, 0.5f);
 	
@@ -479,7 +487,7 @@
 }
 
 /* draw settings for envelope modifier */
-static void draw_modifier__envelope(uiLayout *layout, FModifier *fcm, short width)
+static void draw_modifier__envelope(uiLayout *layout, ID *id, FModifier *fcm, short width)
 {
 	FMod_Envelope *env= (FMod_Envelope *)fcm->data;
 	FCM_EnvelopeData *fed;
@@ -490,7 +498,7 @@
 	int i;
 	
 	/* init the RNA-pointer */
-	RNA_pointer_create(NULL, &RNA_FModifierEnvelope, fcm, &ptr);
+	RNA_pointer_create(id, &RNA_FModifierEnvelope, fcm, &ptr);
 	
 	/* general settings */
 	col= uiLayoutColumn(layout, 1);
@@ -534,13 +542,13 @@
 /* --------------- */
 
 /* draw settings for limits modifier */
-static void draw_modifier__limits(uiLayout *layout, FModifier *fcm, short width)
+static void draw_modifier__limits(uiLayout *layout, ID *id, FModifier *fcm, short width)
 {
 	uiLayout *split, *col, *row;
 	PointerRNA ptr;
 	
 	/* init the RNA-pointer */
-	RNA_pointer_create(NULL, &RNA_FModifierLimits, fcm, &ptr);
+	RNA_pointer_create(id, &RNA_FModifierLimits, fcm, &ptr);
 	
 	/* row 1: minimum */
 	{
@@ -582,7 +590,7 @@
 /* --------------- */
 
 
-void ANIM_uiTemplate_fmodifier_draw (uiLayout *layout, ListBase *modifiers, FModifier *fcm)
+void ANIM_uiTemplate_fmodifier_draw (uiLayout *layout, ID *id, ListBase *modifiers, FModifier *fcm)
 {
 	FModifierTypeInfo *fmi= fmodifier_get_typeinfo(fcm);
 	uiLayout *box, *row, *subrow;
@@ -639,27 +647,27 @@
 		/* draw settings for individual modifiers */
 		switch (fcm->type) {
 			case FMODIFIER_TYPE_GENERATOR: /* Generator */
-				draw_modifier__generator(box, fcm, width);
+				draw_modifier__generator(box, id, fcm, width);
 				break;
 				
 			case FMODIFIER_TYPE_FN_GENERATOR: /* Built-In Function Generator */
-				draw_modifier__fn_generator(box, fcm, width);
+				draw_modifier__fn_generator(box, id, fcm, width);
 				break;
 				
 			case FMODIFIER_TYPE_CYCLES: /* Cycles */
-				draw_modifier__cycles(box, fcm, width);
+				draw_modifier__cycles(box, id, fcm, width);
 				break;
 				
 			case FMODIFIER_TYPE_ENVELOPE: /* Envelope */
-				draw_modifier__envelope(box, fcm, width);
+				draw_modifier__envelope(box, id, fcm, width);
 				break;
 				
 			case FMODIFIER_TYPE_LIMITS: /* Limits */
-				draw_modifier__limits(box, fcm, width);
+				draw_modifier__limits(box, id, fcm, width);
 				break;
 			
 			case FMODIFIER_TYPE_NOISE: /* Noise */
-				draw_modifier__noise(box, fcm, width);
+				draw_modifier__noise(box, id, fcm, width);
 				break;
 			
 			default: /* unknown type */

Modified: branches/soc-2009-aligorith/source/blender/editors/include/ED_anim_api.h
===================================================================
--- branches/soc-2009-aligorith/source/blender/editors/include/ED_anim_api.h	2009-07-02 23:36:16 UTC (rev 21328)
+++ branches/soc-2009-aligorith/source/blender/editors/include/ED_anim_api.h	2009-07-03 01:10:46 UTC (rev 21329)
@@ -300,7 +300,7 @@
 
 /* draw a given F-Modifier for some layout/UI-Block */
 // XXX not quite complete yet
-void ANIM_uiTemplate_fmodifier_draw(struct uiLayout *layout, ListBase *modifiers, struct FModifier *fcm);
+void ANIM_uiTemplate_fmodifier_draw(struct uiLayout *layout, struct ID *id, ListBase *modifiers, struct FModifier *fcm);
 
 /* ************************************************* */
 /* ASSORTED TOOLS */


@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list