[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [23508] trunk/blender/source/blender: RNA + Animation:

Joshua Leung aligorith at gmail.com
Sun Sep 27 11:38:15 CEST 2009


Revision: 23508
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=23508
Author:   aligorith
Date:     2009-09-27 11:38:13 +0200 (Sun, 27 Sep 2009)

Log Message:
-----------
RNA + Animation:

* Added missing RNA wrapping for Scene -> AnimData
* Fixed bug (with temp-fix) where sequence strips with no names couldn't be animated properly. Currently, this will just use the index of the strip, although that is likely to be mutable (adding/removing strips will change it).

* Removed some old unused code from action.c

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/action.c
    trunk/blender/source/blender/editors/space_graph/graph_edit.c
    trunk/blender/source/blender/makesrna/intern/rna_armature.c
    trunk/blender/source/blender/makesrna/intern/rna_scene.c
    trunk/blender/source/blender/makesrna/intern/rna_sequence.c

Modified: trunk/blender/source/blender/blenkernel/intern/action.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/action.c	2009-09-27 09:19:29 UTC (rev 23507)
+++ trunk/blender/source/blender/blenkernel/intern/action.c	2009-09-27 09:38:13 UTC (rev 23508)
@@ -1181,138 +1181,6 @@
 	VecAddf(dst->cyclic_offset, dst->cyclic_offset, src->cyclic_offset);
 }
 
-typedef struct NlaIpoChannel {
-	struct NlaIpoChannel *next, *prev;
-	float val;
-	void *poin;
-	int type;
-} NlaIpoChannel;
-
-static void extract_ipochannels_from_action(ListBase *lb, ID *id, bAction *act, const char *name, float ctime)
-{
-	bActionChannel *achan= get_action_channel(act, name);
-	IpoCurve *icu;
-	NlaIpoChannel *nic;
-	
-	if(achan==NULL) return;
-	
-	if(achan->ipo) {
-		calc_ipo(achan->ipo, ctime);
-		
-		for(icu= achan->ipo->curve.first; icu; icu= icu->next) {
-			/* skip IPO_BITS, is for layers and cannot be blended */
-			if(icu->vartype != IPO_BITS) {
-				nic= MEM_callocN(sizeof(NlaIpoChannel), "NlaIpoChannel");
-				BLI_addtail(lb, nic);
-				nic->val= icu->curval;
-				nic->poin= get_ipo_poin(id, icu, &nic->type);
-			}
-		}
-	}
-	
-	/* constraint channels only for objects */
-	if(GS(id->name)==ID_OB) {
-		Object *ob= (Object *)id;
-		bConstraint *con;
-		bConstraintChannel *conchan;
-		
-		for (con=ob->constraints.first; con; con=con->next) {
-			conchan = get_constraint_channel(&achan->constraintChannels, con->name);
-			
-			if(conchan && conchan->ipo) {
-				calc_ipo(conchan->ipo, ctime);
-				
-				icu= conchan->ipo->curve.first;	// only one ipo now
-				if(icu) {
-					nic= MEM_callocN(sizeof(NlaIpoChannel), "NlaIpoChannel constr");
-					BLI_addtail(lb, nic);
-					nic->val= icu->curval;
-					nic->poin= &con->enforce;
-					nic->type= IPO_FLOAT;
-				}
-			}
-		}
-	}
-}
-
-static NlaIpoChannel *find_nla_ipochannel(ListBase *lb, void *poin)
-{
-	NlaIpoChannel *nic;
-	
-	if(poin) {
-		for(nic= lb->first; nic; nic= nic->next) {
-			if(nic->poin==poin)
-				return nic;
-		}
-	}
-	return NULL;
-}
-
-
-static void blend_ipochannels(ListBase *dst, ListBase *src, float srcweight, int mode)
-{
-	NlaIpoChannel *snic, *dnic, *next;
-	float dstweight;
-	
-	switch (mode){
-		case ACTSTRIPMODE_BLEND:
-			dstweight = 1.0F - srcweight;
-			break;
-		case ACTSTRIPMODE_ADD:
-			dstweight = 1.0F;
-			break;
-		default :
-			dstweight = 1.0F;
-	}
-	
-	for(snic= src->first; snic; snic= next) {
-		next= snic->next;
-		
-		dnic= find_nla_ipochannel(dst, snic->poin);
-		if(dnic==NULL) {
-			/* remove from src list, and insert in dest */
-			BLI_remlink(src, snic);
-			BLI_addtail(dst, snic);
-		}
-		else {
-			/* we do the blend */
-			dnic->val= dstweight*dnic->val + srcweight*snic->val;
-		}
-	}
-}
-
-static int execute_ipochannels(ListBase *lb)
-{
-	NlaIpoChannel *nic;
-	int count = 0;
-	
-	for(nic= lb->first; nic; nic= nic->next) {
-		if(nic->poin) {
-			write_ipo_poin(nic->poin, nic->type, nic->val);
-			count++;
-		}
-	}
-	return count;
-}
-
-/* nla timing */
-
-/* this now only used for repeating cycles, to enable fields and blur. */
-/* the whole time control in blender needs serious thinking... */
-static float nla_time(Scene *scene, float cfra, float unit)
-{
-	extern float bluroffs;	// bad construct, borrowed from object.c for now
-	extern float fieldoffs;
-	
-	/* motion blur & fields */
-	cfra+= unit*(bluroffs+fieldoffs);
-	
-	/* global time */
-	cfra*= scene->r.framelen;	
-	
-	return cfra;
-}
-
 /* added "sizecorr" here, to allow armatures to be scaled and still have striding.
    Only works for uniform scaling. In general I'd advise against scaling armatures ever though! (ton)
 */

Modified: trunk/blender/source/blender/editors/space_graph/graph_edit.c
===================================================================
--- trunk/blender/source/blender/editors/space_graph/graph_edit.c	2009-09-27 09:19:29 UTC (rev 23507)
+++ trunk/blender/source/blender/editors/space_graph/graph_edit.c	2009-09-27 09:38:13 UTC (rev 23508)
@@ -1344,6 +1344,8 @@
 		 *	- first check if id-blocks are compatible
 		 */
 		if ((euf) && (ale->id != euf->id)) {
+			/* if the paths match, add this curve to the set of curves */
+			// NOTE: simple string compare for now... could be a bit more fancy...
 			
 		}
 		else {

Modified: trunk/blender/source/blender/makesrna/intern/rna_armature.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_armature.c	2009-09-27 09:19:29 UTC (rev 23507)
+++ trunk/blender/source/blender/makesrna/intern/rna_armature.c	2009-09-27 09:38:13 UTC (rev 23508)
@@ -592,6 +592,7 @@
 	RNA_def_struct_ui_icon(srna, ICON_ARMATURE_DATA);
 	RNA_def_struct_sdna(srna, "bArmature");
 	
+	/* Animation Data */
 	rna_def_animdata_common(srna);
 	
 	/* Collections */

Modified: trunk/blender/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_scene.c	2009-09-27 09:19:29 UTC (rev 23507)
+++ trunk/blender/source/blender/makesrna/intern/rna_scene.c	2009-09-27 09:38:13 UTC (rev 23508)
@@ -2041,6 +2041,9 @@
 	RNA_def_property_ui_text(prop, "Stamp Note", "User define note for the render stamping.");
 	RNA_def_property_update(prop, NC_SCENE|ND_RENDER_OPTIONS, NULL);
 	
+	/* Animation Data (for Scene) */
+	rna_def_animdata_common(srna);
+	
 	/* Nodes (Compositing) */
 	prop= RNA_def_property(srna, "nodetree", PROP_POINTER, PROP_NONE);
 	RNA_def_property_ui_text(prop, "Node Tree", "Compositing node tree.");

Modified: trunk/blender/source/blender/makesrna/intern/rna_sequence.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_sequence.c	2009-09-27 09:19:29 UTC (rev 23507)
+++ trunk/blender/source/blender/makesrna/intern/rna_sequence.c	2009-09-27 09:38:13 UTC (rev 23508)
@@ -228,7 +228,15 @@
 	/* sequencer data comes from scene... 
 	 * TODO: would be nice to make SequenceEditor data a datablock of its own (for shorter paths)
 	 */
-	return BLI_sprintfN("sequence_editor.sequences[\"%s\"]", seq->name+2);
+	if (seq->name+2)
+		return BLI_sprintfN("sequence_editor.sequences[\"%s\"]", seq->name+2);
+	else {
+		/* compromise for the frequent sitation when strips don't have names... */
+		Scene *sce= (Scene*)ptr->id.data;
+		Editing *ed= seq_give_editing(sce, FALSE);
+		
+		return BLI_sprintfN("sequence_editor.sequences[%d]", BLI_findindex(&ed->seqbase, seq));
+	}
 }
 
 static PointerRNA rna_SequenceEdtior_meta_stack_get(CollectionPropertyIterator *iter)





More information about the Bf-blender-cvs mailing list