Trackpad pans for UV/Image and MovieClip editors were inverse compared to all other...
authorTon Roosendaal <ton@blender.org>
Sat, 5 Jan 2013 17:57:17 +0000 (17:57 +0000)
committerTon Roosendaal <ton@blender.org>
Sat, 5 Jan 2013 17:57:17 +0000 (17:57 +0000)
source/blender/editors/render/render_preview.c
source/blender/editors/space_clip/clip_ops.c
source/blender/editors/space_image/image_ops.c

index 8d748d3ea20732d9c84b2b481d266b2cdbf7096f..cb3d92fbc672a56c7152b050bb93f3fe0557f98d 100644 (file)
@@ -84,6 +84,8 @@
 #include "IMB_imbuf_types.h"
 #include "IMB_colormanagement.h"
 
 #include "IMB_imbuf_types.h"
 #include "IMB_colormanagement.h"
 
+#include "GPU_extensions.h"
+
 #include "BIF_gl.h"
 #include "BIF_glutil.h"
 
 #include "BIF_gl.h"
 #include "BIF_glutil.h"
 
@@ -885,6 +887,8 @@ static void icon_preview_startjob(void *customdata, short *stop, short *do_updat
        ID *id = sp->id;
        short idtype = GS(id->name);
 
        ID *id = sp->id;
        short idtype = GS(id->name);
 
+       printf("icon start job %s\n", id->name);
+       
        if (idtype == ID_IM) {
                Image *ima = (Image *)id;
                ImBuf *ibuf = NULL;
        if (idtype == ID_IM) {
                Image *ima = (Image *)id;
                ImBuf *ibuf = NULL;
@@ -1007,8 +1011,27 @@ static void icon_preview_endjob(void *customdata)
 {
        IconPreview *ip = customdata;
 
 {
        IconPreview *ip = customdata;
 
-       if (ip->id && GS(ip->id->name) == ID_BR)
-               WM_main_add_notifier(NC_BRUSH | NA_EDITED, ip->id);
+       if (ip->id) {
+               printf("icon end job %s\n", ip->id->name);
+
+               if (GS(ip->id->name) == ID_BR)
+                       WM_main_add_notifier(NC_BRUSH | NA_EDITED, ip->id);
+               
+               if (GS(ip->id->name) == ID_MA) {
+                       Material *ma = (Material *)ip->id;
+                       PreviewImage *prv_img = ma->preview;
+                       int i;
+                       
+                       /* signal to gpu texture */
+                       for (i = 0; i < NUM_ICON_SIZES; ++i) {
+                               if (prv_img->gputexture[i]) {
+                                       GPU_texture_free(prv_img->gputexture[i]);
+                                       prv_img->gputexture[i] = NULL;
+                                       WM_main_add_notifier(NC_MATERIAL|ND_SHADING_DRAW, ip->id);
+                               }
+                       }
+               }
+       }
 }
 
 static void icon_preview_free(void *customdata)
 }
 
 static void icon_preview_free(void *customdata)
@@ -1044,7 +1067,7 @@ void ED_preview_icon_job(const bContext *C, void *owner, ID *id, unsigned int *r
 
        /* setup job */
        WM_jobs_customdata_set(wm_job, ip, icon_preview_free);
 
        /* setup job */
        WM_jobs_customdata_set(wm_job, ip, icon_preview_free);
-       WM_jobs_timer(wm_job, 0.25, NC_MATERIAL, NC_MATERIAL);
+       WM_jobs_timer(wm_job, 0.1, NC_MATERIAL, NC_MATERIAL);
        WM_jobs_callbacks(wm_job, icon_preview_startjob_all_sizes, NULL, NULL, icon_preview_endjob);
 
        WM_jobs_start(CTX_wm_manager(C), wm_job);
        WM_jobs_callbacks(wm_job, icon_preview_startjob_all_sizes, NULL, NULL, icon_preview_endjob);
 
        WM_jobs_start(CTX_wm_manager(C), wm_job);
index 4e53f34359ee4e930232810f3e8aa06a941453e9..caf28e1c551aac326e4dab535c1db03b809cdd61 100644 (file)
@@ -382,8 +382,8 @@ static int view_pan_invoke(bContext *C, wmOperator *op, wmEvent *event)
                SpaceClip *sc = CTX_wm_space_clip(C);
                float offset[2];
 
                SpaceClip *sc = CTX_wm_space_clip(C);
                float offset[2];
 
-               offset[0] = (event->x - event->prevx) / sc->zoom;
-               offset[1] = (event->y - event->prevy) / sc->zoom;
+               offset[0] = (event->prevx - event->x) / sc->zoom;
+               offset[1] = (event->prevy - event->y) / sc->zoom;
 
                RNA_float_set_array(op->ptr, "offset", offset);
 
 
                RNA_float_set_array(op->ptr, "offset", offset);
 
index f1662bc254dcfb33c27f3409aca3f6f309ed374b..57c00a52231765cddaab21307d118d2e6514600e 100644 (file)
@@ -299,8 +299,8 @@ static int image_view_pan_invoke(bContext *C, wmOperator *op, wmEvent *event)
                SpaceImage *sima = CTX_wm_space_image(C);
                float offset[2];
                
                SpaceImage *sima = CTX_wm_space_image(C);
                float offset[2];
                
-               offset[0] = (event->x - event->prevx) / sima->zoom;
-               offset[1] = (event->y - event->prevy) / sima->zoom;
+               offset[0] = (event->prevx - event->x) / sima->zoom;
+               offset[1] = (event->prevy - event->y) / sima->zoom;
                RNA_float_set_array(op->ptr, "offset", offset);
 
                image_view_pan_exec(C, op);
                RNA_float_set_array(op->ptr, "offset", offset);
 
                image_view_pan_exec(C, op);