Merging r44227 through r45619 from trunk into soc-2011-tomato
authorSergey Sharybin <sergey.vfx@gmail.com>
Sat, 14 Apr 2012 10:46:47 +0000 (10:46 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Sat, 14 Apr 2012 10:46:47 +0000 (10:46 +0000)
1  2 
release/scripts/startup/bl_ui/space_clip.py
source/blender/blenloader/intern/readfile.c
source/blender/editors/space_clip/clip_draw.c
source/blender/editors/space_clip/clip_editor.c
source/blender/editors/space_clip/space_clip.c
source/blender/makesdna/DNA_space_types.h
source/blender/makesrna/intern/rna_space.c

@@@ -210,52 -216,34 +216,58 @@@ static void draw_movieclip_notes(SpaceC
                ED_region_info_draw(ar, str, block, 0.6f);
  }
  
+ static void verify_buffer_float(ImBuf *ibuf)
+ {
+       if (ibuf->rect_float && (ibuf->rect == NULL || (ibuf->userflags & IB_RECT_INVALID))) {
+               IMB_rect_from_float(ibuf);
+       }
+ }
  static void draw_movieclip_buffer(SpaceClip *sc, ARegion *ar, ImBuf *ibuf,
-                       int width, int height, float zoomx, float zoomy)
+                                   int width, int height, float zoomx, float zoomy)
  {
        int x, y;
-       MovieClip *clip= ED_space_clip(sc);
+       MovieClip *clip = ED_space_clip(sc);
  
 -      /* set zoom */
 -      glPixelZoom(zoomx*width/ibuf->x, zoomy*height/ibuf->y);
 -
        /* find window pixel coordinates of origin */
        UI_view2d_to_region_no_clip(&ar->v2d, 0.0f, 0.0f, &x, &y);
  
-       if(sc->flag&SC_MUTE_FOOTAGE) {
+       if (sc->flag & SC_MUTE_FOOTAGE) {
                glColor3f(0.0f, 0.0f, 0.0f);
-               glRectf(x, y, x+zoomx*width, y+zoomy*height);
-       } else {
-               if(ibuf->rect_float && !ibuf->rect) {
-                       IMB_rect_from_float(ibuf);
-               }
+               glRectf(x, y, x + zoomx * width, y + zoomy * height);
+       }
+       else {
+               verify_buffer_float(ibuf);
  
 -              if (ibuf->rect)
 -                      glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
 +              if(ibuf->rect) {
 +                      if(sc->flag & SC_TEXTURE_BUFFER) {
 +                              ED_space_clip_load_movieclip_buffer(sc, ibuf);
 +
 +                              glPushMatrix();
 +                              glTranslatef(x, y, 0.0f);
 +                              glScalef(zoomx, zoomy, 1.0f);
 +
 +                              glBegin(GL_QUADS);
 +                                      glTexCoord2f(0.0f, 0.0f); glVertex2f(0.0f,  0.0f);
 +                                      glTexCoord2f(1.0f, 0.0f); glVertex2f(width, 0.0f);
 +                                      glTexCoord2f(1.0f, 1.0f); glVertex2f(width, height);
 +                                      glTexCoord2f(0.0f, 1.0f); glVertex2f(0.0f,  height);
 +                              glEnd();
 +
 +                              glPopMatrix();
 +
 +                              ED_space_clip_unload_movieclip_buffer(sc);
 +                      }
 +                      else {
 +                              /* set zoom */
 +                              glPixelZoom(zoomx*width/ibuf->x, zoomy*height/ibuf->y);
 +
 +                              glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect);
 +
 +                              /* reset zoom */
 +                              glPixelZoom(1.0f, 1.0f);
 +                      }
 +              }
        }
  
        /* draw boundary border for frame if stabilization is enabled */
@@@ -208,14 -208,12 +208,14 @@@ static SpaceLink *clip_new(const bConte
  /* not spacelink itself */
  static void clip_free(SpaceLink *sl)
  {
-       SpaceClip *sc= (SpaceClip*) sl;
+       SpaceClip *sc = (SpaceClip*) sl;
  
-       sc->clip= NULL;
+       sc->clip = NULL;
  
-       if(sc->scopes.track_preview)
+       if (sc->scopes.track_preview)
                IMB_freeImBuf(sc->scopes.track_preview);
 +
 +      ED_space_clip_free_texture_buffer(sc);
  }
  
  /* spacetype; init callback */
@@@ -226,12 -224,11 +226,12 @@@ static void clip_init(struct wmWindowMa
  
  static SpaceLink *clip_duplicate(SpaceLink *sl)
  {
-       SpaceClip *scn= MEM_dupallocN(sl);
+       SpaceClip *scn = MEM_dupallocN(sl);
  
        /* clear or remove stuff from old */
-       scn->scopes.track_preview= NULL;
-       scn->scopes.ok= 0;
+       scn->scopes.track_preview = NULL;
+       scn->scopes.ok = FALSE;
 +      scn->draw_context= NULL;
  
        return (SpaceLink *)scn;
  }
@@@ -516,13 -516,13 +516,15 @@@ typedef struct SpaceClip 
        /* current stabilization data */
        float loc[2], scale, angle;     /* pre-composed stabilization data */
        int pad;
-       float stabmat[4][4], unistabmat[4][4];          /* current stabilization matrix and the same matrix in unified space,
-                                                                                                  defined when drawing and used for mouse position calculation */
+       float stabmat[4][4], unistabmat[4][4];  /* current stabilization matrix and the same matrix in unified space,
+                                                * defined when drawing and used for mouse position calculation */
  
        /* movie postprocessing */
-       int postproc_flag, pad2;
+       int postproc_flag;
+       int runtime_flag;                       /* different runtime flags */
 +
 +      void *draw_context;
  } SpaceClip;
  
  /* view3d  Now in DNA_view3d_types.h */
@@@ -2985,16 -3072,13 +3072,18 @@@ static void rna_def_space_clip(BlenderR
        RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
  
        /* show graph_tracks */
-       prop= RNA_def_property(srna, "show_graph_tracks", PROP_BOOLEAN, PROP_NONE);
+       prop = RNA_def_property(srna, "show_graph_tracks", PROP_BOOLEAN, PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_SHOW_GRAPH_TRACKS);
-       RNA_def_property_ui_text(prop, "Show Tracks", "Display the speed curves (in \"x\" direction red, in \"y\" direction green) for the selected tracks");
+       RNA_def_property_ui_text(prop, "Show Tracks",
+                                "Display the speed curves (in \"x\" direction red, in \"y\" direction green) "
+                                "for the selected tracks");
        RNA_def_property_update(prop, NC_SPACE|ND_SPACE_CLIP, NULL);
  
 +      prop= RNA_def_property(srna, "use_texture_buffer", PROP_BOOLEAN, PROP_NONE);
 +      RNA_def_property_ui_text(prop, "Use Texture Buffer", "Use texture buffer to display o,age frames frame on screen");
 +      RNA_def_property_boolean_sdna(prop, NULL, "flag", SC_TEXTURE_BUFFER);
 +      RNA_def_property_update(prop, NC_WINDOW, NULL);
 +
        /* ** channels ** */
  
        /* show_red_channel */