RNA + Animation:
authorJoshua Leung <aligorith@gmail.com>
Sun, 27 Sep 2009 09:38:13 +0000 (09:38 +0000)
committerJoshua Leung <aligorith@gmail.com>
Sun, 27 Sep 2009 09:38:13 +0000 (09:38 +0000)
* 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

source/blender/blenkernel/intern/action.c
source/blender/editors/space_graph/graph_edit.c
source/blender/makesrna/intern/rna_armature.c
source/blender/makesrna/intern/rna_scene.c
source/blender/makesrna/intern/rna_sequence.c

index 4cfd35a494d9725115610352b70924679f10d2b1..b8dc9fd049dab3eab830c436ae89c228789b672d 100644 (file)
@@ -1181,138 +1181,6 @@ static void blend_pose_offset_bone(bActionStrip *strip, bPose *dst, bPose *src,
        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)
 */
index 9814f16de16cabfbe9209bdb9dfa76a3c74d24b0..8c739d68cea0c6cdaacbea35eb7ad5cd03dce9b1 100644 (file)
@@ -1344,6 +1344,8 @@ static int graphkeys_euler_filter_exec (bContext *C, wmOperator *op)
                 *      - 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 {
index c89ed48d44a08ba14e1a2e1b4d1bda997f507933..5dbfdd3e6f1a2d73752792126cc2c2ba0f7c94ea 100644 (file)
@@ -592,6 +592,7 @@ static void rna_def_armature(BlenderRNA *brna)
        RNA_def_struct_ui_icon(srna, ICON_ARMATURE_DATA);
        RNA_def_struct_sdna(srna, "bArmature");
        
+       /* Animation Data */
        rna_def_animdata_common(srna);
        
        /* Collections */
index f0b4fae69ee92997b73786b74e9d71e6d6231643..1d8ebdce36918d0b4b90aa569652d064bfd43ee2 100644 (file)
@@ -2041,6 +2041,9 @@ void RNA_def_scene(BlenderRNA *brna)
        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.");
index 51e81d6dd3a7f9155ecda8b13e1620563188d945..9404fb775c3a1b9e302cacd2baac834d2ca560db 100644 (file)
@@ -228,7 +228,15 @@ static char *rna_Sequence_path(PointerRNA *ptr)
        /* 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)