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:
authorSergey Sharybin <sergey.vfx@gmail.com>2012-04-29 16:32:26 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2012-04-29 16:32:26 +0400
commitc27c87dde4f627565df7cb000b7eba45c2604ce4 (patch)
treeb08cecd61310a99d013e4bbbcabb70f92685b648 /source/blender/editors/space_clip/clip_utils.c
parent16d4c49c464ba4c56d96120003456e92688432f1 (diff)
Camera tracking: backport refactoring made in local branches with masking and dopesheet view into trunk
Mostly related on changes in poll functions for tracking operators and some changes to how interface is initializing for different view types.
Diffstat (limited to 'source/blender/editors/space_clip/clip_utils.c')
-rw-r--r--source/blender/editors/space_clip/clip_utils.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/source/blender/editors/space_clip/clip_utils.c b/source/blender/editors/space_clip/clip_utils.c
index 443a1d0cdd3..c8ba8be7eae 100644
--- a/source/blender/editors/space_clip/clip_utils.c
+++ b/source/blender/editors/space_clip/clip_utils.c
@@ -29,6 +29,7 @@
* \ingroup spclip
*/
+#include "DNA_scene_types.h"
#include "DNA_object_types.h" /* SELECT */
#include "MEM_guardedalloc.h"
@@ -42,6 +43,9 @@
#include "BKE_tracking.h"
#include "BKE_depsgraph.h"
+#include "BIF_gl.h"
+#include "BIF_glutil.h"
+
#include "WM_api.h"
#include "WM_types.h"
@@ -53,6 +57,8 @@
#include "RNA_access.h"
#include "RNA_define.h"
+#include "UI_interface.h"
+#include "UI_resources.h"
#include "UI_view2d.h"
#include "clip_intern.h" // own include
@@ -220,3 +226,57 @@ void clip_view_center_to_point(SpaceClip *sc, float x, float y)
sc->xof = (x - 0.5f) * width * aspx;
sc->yof = (y - 0.5f) * height * aspy;
}
+
+void clip_draw_cfra(SpaceClip *sc, ARegion *ar, Scene *scene)
+{
+ View2D *v2d = &ar->v2d;
+ float xscale, yscale;
+ float vec[2];
+
+ /* Draw a light green line to indicate current frame */
+ vec[0] = (float)(sc->user.framenr * scene->r.framelen);
+
+ UI_ThemeColor(TH_CFRAME);
+ glLineWidth(2.0);
+
+ glBegin(GL_LINE_STRIP);
+ vec[1] = v2d->cur.ymin;
+ glVertex2fv(vec);
+
+ vec[1] = v2d->cur.ymax;
+ glVertex2fv(vec);
+ glEnd();
+
+ glLineWidth(1.0);
+
+ UI_view2d_view_orthoSpecial(ar, v2d, 1);
+
+ /* because the frame number text is subject to the same scaling as the contents of the view */
+ UI_view2d_getscale(v2d, &xscale, &yscale);
+ glScalef(1.0f/xscale, 1.0f, 1.0f);
+
+ clip_draw_curfra_label(sc, (float)sc->user.framenr * xscale, 18);
+
+ /* restore view transform */
+ glScalef(xscale, 1.0, 1.0);
+}
+
+void clip_draw_sfra_efra(View2D *v2d, Scene *scene)
+{
+ UI_view2d_view_ortho(v2d);
+
+ /* currently clip editor supposes that editing clip length is equal to scene frame range */
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ glEnable(GL_BLEND);
+ glColor4f(0.0f, 0.0f, 0.0f, 0.4f);
+
+ glRectf(v2d->cur.xmin, v2d->cur.ymin, (float)SFRA, v2d->cur.ymax);
+ glRectf((float)EFRA, v2d->cur.ymin, v2d->cur.xmax, v2d->cur.ymax);
+ glDisable(GL_BLEND);
+
+ UI_ThemeColorShade(TH_BACK, -60);
+
+ /* thin lines where the actual frames are */
+ fdrawline((float)SFRA, v2d->cur.ymin, (float)SFRA, v2d->cur.ymax);
+ fdrawline((float)EFRA, v2d->cur.ymin, (float)EFRA, v2d->cur.ymax);
+}