Revision: 14210
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14210
Author:   aligorith
Date:     2008-03-22 12:06:51 +0100 (Sat, 22 Mar 2008)

Log Message:
-----------
== Action Editor - Preview Range (Ctrl-Alt-P) ==

Quick feature for setting Preview Range in Action Editor: the hotkey Ctrl-Alt-P 
sets the Preview Range so that it matches the extents of the active action.

Modified Paths:
--------------
    trunk/blender/source/blender/include/BIF_editaction.h
    trunk/blender/source/blender/src/editaction.c

Modified: trunk/blender/source/blender/include/BIF_editaction.h
===================================================================
--- trunk/blender/source/blender/include/BIF_editaction.h       2008-03-22 
10:53:35 UTC (rev 14209)
+++ trunk/blender/source/blender/include/BIF_editaction.h       2008-03-22 
11:06:51 UTC (rev 14210)
@@ -190,6 +190,7 @@
 void *get_action_context(short *datatype);
 
 void remake_action_ipos(struct bAction *act);
+void action_previewrange_set(struct bAction *act);
 
 /* event handling */
 void winqreadactionspace(struct ScrArea *sa, void *spacedata, struct BWinEvent 
*evt);

Modified: trunk/blender/source/blender/src/editaction.c
===================================================================
--- trunk/blender/source/blender/src/editaction.c       2008-03-22 10:53:35 UTC 
(rev 14209)
+++ trunk/blender/source/blender/src/editaction.c       2008-03-22 11:06:51 UTC 
(rev 14210)
@@ -797,6 +797,36 @@
        }
 }
 
+/* Quick-tool for preview-range functionality in Action Editor for setting 
Preview-Range  
+ * bounds to extents of Action, when Ctrl-Alt-P is used. Only available for 
actions.
+ */
+void action_previewrange_set (bAction *act)
+{
+       float start, end;
+       
+       /* sanity check */
+       if (act == NULL)
+               return;
+               
+       /* calculate range + make sure it is adjusted for nla-scaling */
+       calc_action_range(act, &start, &end, 0);
+       if (NLA_ACTION_SCALED) {
+               start= get_action_frame_inv(OBACT, start);
+               end= get_action_frame_inv(OBACT, end);
+       }
+       
+       /* set preview range */
+       G.scene->r.psfra= start;
+       G.scene->r.pefra= end;
+       
+       BIF_undo_push("Set anim-preview range");
+       allqueue(REDRAWTIME, 0);
+       allqueue(REDRAWACTION, 0);
+       allqueue(REDRAWNLA, 0);
+       allqueue(REDRAWIPO, 0);
+       allqueue(REDRAWBUTSALL, 0);
+}
+
 /* **************************************************** */
 /* ACTION CHANNEL GROUPS */
 
@@ -4454,7 +4484,9 @@
                        break;
                        
                case PKEY:
-                       if (G.qual & LR_CTRLKEY) /* set preview range */
+                       if (G.qual == (LR_CTRLKEY|LR_ALTKEY)) /* set preview 
range to range of action */
+                               action_previewrange_set(G.saction->action);
+                       else if (G.qual & LR_CTRLKEY) /* set preview range */
                                anim_previewrange_set();
                        else if (G.qual & LR_ALTKEY) /* clear preview range */
                                anim_previewrange_clear();


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to