removed 3D view listener for changing the background image frame.
authorCampbell Barton <ideasman42@gmail.com>
Tue, 19 Jan 2010 14:04:33 +0000 (14:04 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 19 Jan 2010 14:04:33 +0000 (14:04 +0000)
do this on drawing instead since SCREEN_OT_animation_step isnt calling the notifier (assume this is to be more efficient?). this isnt slow so is ok to do on drawing.

rename BKE_image_user_calc_imanr to BKE_image_user_calc_frame

source/blender/blenkernel/BKE_image.h
source/blender/blenkernel/intern/image.c
source/blender/editors/space_image/image_buttons.c
source/blender/editors/space_view3d/space_view3d.c
source/blender/editors/space_view3d/view3d_draw.c
source/blender/makesrna/intern/rna_image.c
source/blender/nodes/intern/CMP_nodes/CMP_image.c
source/blender/nodes/intern/CMP_nodes/CMP_splitViewer.c
source/blender/nodes/intern/CMP_nodes/CMP_viewer.c
source/blender/render/intern/source/texture.c

index 6b8d9d1768e66e21ac3965d08a46db08d2c7764c..bf50648fea27d4fe92957f4ba04b801e119e232e 100644 (file)
@@ -128,7 +128,7 @@ struct Image *BKE_image_verify_viewer(int type, const char *name);
 void BKE_image_assign_ibuf(struct Image *ima, struct ImBuf *ibuf);
 
 /* called on frame change or before render */
-void BKE_image_user_calc_imanr(struct ImageUser *iuser, int cfra, int fieldnr);
+void BKE_image_user_calc_frame(struct ImageUser *iuser, int cfra, int fieldnr);
 
 /* produce image export path */
 int BKE_get_image_export_path(struct Image *im, const char *dest_dir, char *abs, int abs_size, char *rel, int rel_size);
index b9be460234538b7166c2d462e9869290607d3273..ad7826ab9c41d9238da9c1eb331be4132588fbd7 100644 (file)
@@ -2214,7 +2214,7 @@ ImBuf *BKE_image_get_ibuf(Image *ima, ImageUser *iuser)
        return BKE_image_acquire_ibuf(ima, iuser, NULL);
 }
 
-void BKE_image_user_calc_imanr(ImageUser *iuser, int cfra, int fieldnr)
+void BKE_image_user_calc_frame(ImageUser *iuser, int cfra, int fieldnr)
 {
        int imanr, len;
        
index e740b355727e66090db8689197265af370b8e45e..c882c8db6c6303107a650901ad16d302ead40c36 100644 (file)
@@ -592,7 +592,7 @@ static void set_frames_cb(bContext *C, void *ima_v, void *iuser_v)
        
        if(ima->anim) {
                iuser->frames = IMB_anim_get_duration(ima->anim);
-               BKE_image_user_calc_imanr(iuser, scene->r.cfra, 0);
+               BKE_image_user_calc_frame(iuser, scene->r.cfra, 0);
        }
 }
 
index 986d8003e6e7d784f881d9989da1e6dbd6e266e4..6ba278700223c135ef10e4ff0a1d40b826bf888f 100644 (file)
@@ -785,6 +785,7 @@ static int view3d_context(const bContext *C, const char *member, bContextDataRes
 }
 
 /*area (not region) level listener*/
+#if 0 // removed since BKE_image_user_calc_frame is now called in draw_bgpic because screen_ops doesnt call the notifier.
 void space_view3d_listener(struct ScrArea *area, struct wmNotifier *wmn)
 {
        if (wmn->category == NC_SCENE && wmn->data == ND_FRAME) {
@@ -793,10 +794,11 @@ void space_view3d_listener(struct ScrArea *area, struct wmNotifier *wmn)
                if (v3d->bgpic && v3d->bgpic->ima) {
                        Scene *scene = wmn->reference;
 
-                       BKE_image_user_calc_imanr(&v3d->bgpic->iuser, scene->r.cfra, 0);
+                       BKE_image_user_calc_frame(&v3d->bgpic->iuser, scene->r.cfra, 0);
                }
        }
 }
+#endif
 
 /* only called once, from space/spacetypes.c */
 void ED_spacetype_view3d(void)
@@ -810,7 +812,7 @@ void ED_spacetype_view3d(void)
        st->new= view3d_new;
        st->free= view3d_free;
        st->init= view3d_init;
-       st->listener = space_view3d_listener;
+//     st->listener = space_view3d_listener;
        st->duplicate= view3d_duplicate;
        st->operatortypes= view3d_operatortypes;
        st->keymap= view3d_keymap;
index 914344647bd333ff93de9267e014c4e1635528a5..529b100c1d44c25b58696a85b6010aceb36cf385 100644 (file)
@@ -1317,9 +1317,12 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
        if(bgpic==NULL) return;
        
        ima= bgpic->ima;
-       
-       if(ima)
+
+       if(ima) {
+               /* notifier can also call this however screen_ops.c */
+               BKE_image_user_calc_frame(&bgpic->iuser, CFRA, 0);
                ibuf= BKE_image_get_ibuf(ima, &bgpic->iuser);
+       }
        if(ibuf==NULL || (ibuf->rect==NULL && ibuf->rect_float==NULL) ) 
                return;
        if(ibuf->channels!=4)
index c4d7e772c58c06cea62e5b77fca10caa4729248e..1c0ee2c416ff00af1aa1467437cb52e5af348833 100644 (file)
@@ -118,7 +118,7 @@ static void rna_ImageUser_update(Main *bmain, Scene *scene, PointerRNA *ptr)
 {
        ImageUser *iuser= ptr->data;
 
-       BKE_image_user_calc_imanr(iuser, scene->r.cfra, 0);
+       BKE_image_user_calc_frame(iuser, scene->r.cfra, 0);
 }
 
 static EnumPropertyItem *rna_Image_source_itemf(bContext *C, PointerRNA *ptr, int *free)
index a204f8df4b2467f0553115797dac127482594ad7..f209687d6a53929dcbaa386d3b4453b6833c39a7 100644 (file)
@@ -198,7 +198,7 @@ static void node_composit_exec_image(void *data, bNode *node, bNodeStack **in, b
                CompBuf *stackbuf= NULL;
                
                /* first set the right frame number in iuser */
-               BKE_image_user_calc_imanr(iuser, rd->cfra, 0);
+               BKE_image_user_calc_frame(iuser, rd->cfra, 0);
                
                /* force a load, we assume iuser index will be set OK anyway */
                if(ima->type==IMA_TYPE_MULTILAYER)
index 04383f478e9e1a1fa32e5b28701169eb43baa046..7564b07523f247a7563ad1ff38ec4672f8e149b4 100644 (file)
@@ -65,7 +65,7 @@ static void node_composit_exec_splitviewer(void *data, bNode *node, bNodeStack *
                buf1= typecheck_compbuf(in[0]->data, CB_RGBA);
                buf2= typecheck_compbuf(in[1]->data, CB_RGBA);
                
-               BKE_image_user_calc_imanr(node->storage, rd->cfra, 0);
+               BKE_image_user_calc_frame(node->storage, rd->cfra, 0);
                
                /* always returns for viewer image, but we check nevertheless */
                ibuf= BKE_image_get_ibuf(ima, node->storage);
index d0dcc5c6973c1fc3f9245c3e39b663bcb217f695..105037d3bfca744d783f9261e6a6c1e1cc2c0c6c 100644 (file)
@@ -51,7 +51,7 @@ static void node_composit_exec_viewer(void *data, bNode *node, bNodeStack **in,
                CompBuf *cbuf, *tbuf;
                int rectx, recty;
                
-               BKE_image_user_calc_imanr(node->storage, rd->cfra, 0);
+               BKE_image_user_calc_frame(node->storage, rd->cfra, 0);
 
                /* always returns for viewer image, but we check nevertheless */
                ibuf= BKE_image_get_ibuf(ima, node->storage);
index 38ee8f736169bd881b0bde4d6c226756a84ee0f6..6aacf99a074aed1336f73ca28310b89cc3061799 100644 (file)
@@ -92,7 +92,7 @@ void init_render_texture(Render *re, Tex *tex)
        
        /* imap test */
        if(tex->ima && ELEM(tex->ima->source, IMA_SRC_MOVIE, IMA_SRC_SEQUENCE)) {
-               BKE_image_user_calc_imanr(&tex->iuser, cfra, re?re->flag & R_SEC_FIELD:0);
+               BKE_image_user_calc_frame(&tex->iuser, cfra, re?re->flag & R_SEC_FIELD:0);
        }
        
        if(tex->type==TEX_PLUGIN) {