Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2011-03-14 13:45:42 +0300
committerJoshua Leung <aligorith@gmail.com>2011-03-14 13:45:42 +0300
commit7609370d504de51371b96d8e6807ec6f62ee6c69 (patch)
tree70c34d8fd214dd963602ceff0f2f247704fd1295 /source/blender/editors/animation
parent2d1ef275f2299c71dade74743cdca0c771648333 (diff)
Bugfixes:
- Sync Markers option works for local markers (or any other list of markers in future) too now. - Apply Pose to Restpose operator now displays a warning if an action was found (warning about the action now being invalid)
Diffstat (limited to 'source/blender/editors/animation')
-rw-r--r--source/blender/editors/animation/anim_markers.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/source/blender/editors/animation/anim_markers.c b/source/blender/editors/animation/anim_markers.c
index b6450ada96f..c802ba621f1 100644
--- a/source/blender/editors/animation/anim_markers.c
+++ b/source/blender/editors/animation/anim_markers.c
@@ -68,6 +68,7 @@
#include "ED_util.h"
#include "ED_numinput.h"
#include "ED_object.h"
+#include "ED_transform.h"
#include "ED_types.h"
/* ************* Marker API **************** */
@@ -114,6 +115,57 @@ ListBase *ED_animcontext_get_markers(const bAnimContext *ac)
/* --------------------------------- */
+/* Apply some transformation to markers after the fact
+ * < markers: list of markers to affect - this may or may not be the scene markers list, so don't assume anything
+ * < scene: current scene (for getting current frame)
+ * < mode: (TfmMode) transform mode that this transform is for
+ * < value: from the transform code, this is t->vec[0] (which is delta transform for grab/extend, and scale factor for scale)
+ * < side: (B/L/R) for 'extend' functionality, which side of current frame to use
+ */
+int ED_markers_post_apply_transform (ListBase *markers, Scene *scene, int mode, float value, char side)
+{
+ TimeMarker *marker;
+ float cfra = (float)CFRA;
+ int changed = 0;
+
+ /* sanity check */
+ if (markers == NULL)
+ return changed;
+
+ /* affect selected markers - it's unlikely that we will want to affect all in this way? */
+ for (marker = markers->first; marker; marker = marker->next) {
+ if (marker->flag & SELECT) {
+ switch (mode) {
+ case TFM_TIME_TRANSLATE:
+ case TFM_TIME_EXTEND:
+ {
+ /* apply delta if marker is on the right side of the current frame */
+ if ((side=='B') ||
+ (side=='L' && marker->frame < cfra) ||
+ (side=='R' && marker->frame >= cfra))
+ {
+ marker->frame += (int)floorf(value + 0.5f);
+ changed++;
+ }
+ }
+ break;
+
+ case TFM_TIME_SCALE:
+ {
+ /* rescale the distance between the marker and the current frame */
+ marker->frame= cfra + (int)floorf(((float)(marker->frame - cfra) * value) + 0.5f);
+ changed++;
+ }
+ break;
+ }
+ }
+ }
+
+ return changed;
+}
+
+/* --------------------------------- */
+
/* Get the marker that is closest to this point */
/* XXX for select, the min_dist should be small */
TimeMarker *ED_markers_find_nearest_marker (ListBase *markers, float x)