Revision: 38176
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38176
Author:   aligorith
Date:     2011-07-07 05:17:36 +0000 (Thu, 07 Jul 2011)
Log Message:
-----------
NLA Strips cannot have their actions changed while the "tweakmode" is
on, otherwise things could screw up

Modified Paths:
--------------
    branches/soc-2011-pepper/source/blender/makesrna/intern/rna_nla.c

Modified: branches/soc-2011-pepper/source/blender/makesrna/intern/rna_nla.c
===================================================================
--- branches/soc-2011-pepper/source/blender/makesrna/intern/rna_nla.c   
2011-07-07 04:47:47 UTC (rev 38175)
+++ branches/soc-2011-pepper/source/blender/makesrna/intern/rna_nla.c   
2011-07-07 05:17:36 UTC (rev 38176)
@@ -222,6 +222,29 @@
        data->blendout= value;
 }
 
+static int rna_NlaStrip_action_editable(PointerRNA *ptr)
+{
+       NlaStrip *strip = (NlaStrip *)ptr->data;
+       
+       /* strip actions shouldn't be editable if NLA tweakmode is on */
+       if (ptr->id.data) {
+               AnimData *adt = BKE_animdata_from_id(ptr->id.data);
+               
+               if (adt) {
+                       /* active action is only editable when it is not a 
tweaking strip */
+                       if ((adt->flag & ADT_NLA_EDIT_ON) || (adt->actstrip) || 
(adt->tmpact))
+                               return 0;
+               }
+       }
+       
+       /* check for clues that strip probably shouldn't be used... */
+       if (strip->flag & NLASTRIP_FLAG_TWEAKUSER)
+               return 0;
+               
+       /* should be ok, though we may still miss some cases */
+       return 1;
+}
+
 static void rna_NlaStrip_action_start_frame_set(PointerRNA *ptr, float value)
 {
        NlaStrip *data= (NlaStrip*)ptr->data;
@@ -429,6 +452,7 @@
        RNA_def_property_pointer_sdna(prop, NULL, "act");
        RNA_def_property_pointer_funcs(prop, NULL, NULL, NULL, 
"rna_Action_id_poll");
        RNA_def_property_flag(prop, PROP_EDITABLE); 
+       RNA_def_property_editable_func(prop, "rna_NlaStrip_action_editable");
        RNA_def_property_ui_text(prop, "Action", "Action referenced by this 
strip");
        RNA_def_property_update(prop, NC_ANIMATION|ND_NLA, NULL); /* this will 
do? */
        

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to