diff options
-rw-r--r-- | release/scripts/startup/bl_ui/space_image.py | 2 | ||||
-rw-r--r-- | source/blender/editors/include/ED_node.h | 3 | ||||
-rw-r--r-- | source/blender/editors/space_image/space_image.c | 39 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_edit.c | 21 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_intern.h | 2 | ||||
-rw-r--r-- | source/blender/editors/space_node/space_node.c | 7 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_conversions.c | 5 |
7 files changed, 57 insertions, 22 deletions
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py index 7752eb9771a..af39ce3437a 100644 --- a/release/scripts/startup/bl_ui/space_image.py +++ b/release/scripts/startup/bl_ui/space_image.py @@ -430,7 +430,7 @@ class IMAGE_HT_header(Header): if ima.type == 'COMPOSITE' and ima.source in {'MOVIE', 'SEQUENCE'}: row.operator("image.play_composite", icon='PLAY') - if show_uvedit or mode == 'PAINT': + if show_uvedit or show_maskedit or mode == 'PAINT': layout.prop(sima, "use_realtime_update", text="", icon_only=True, icon='LOCKED') diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h index ca468a15771..b6a1fd0f979 100644 --- a/source/blender/editors/include/ED_node.h +++ b/source/blender/editors/include/ED_node.h @@ -41,6 +41,7 @@ struct bNodeTree; struct bNode; struct bNodeTree; struct ScrArea; +struct Scene; struct View2D; typedef enum { @@ -73,6 +74,8 @@ int ED_node_select_check(ListBase *lb); void ED_node_post_apply_transform(struct bContext *C, struct bNodeTree *ntree); void ED_node_set_active(struct Main *bmain, struct bNodeTree *ntree, struct bNode *node); +void ED_node_composite_job(const bContext *C, struct bNodeTree *nodetree, struct Scene *scene_owner); + /* node ops.c */ void ED_operatormacros_node(void); diff --git a/source/blender/editors/space_image/space_image.c b/source/blender/editors/space_image/space_image.c index f97813d3dd3..0007ef2ef77 100644 --- a/source/blender/editors/space_image/space_image.c +++ b/source/blender/editors/space_image/space_image.c @@ -46,12 +46,14 @@ #include "BKE_screen.h" #include "BKE_tessmesh.h" #include "BKE_sequencer.h" +#include "BKE_node.h" #include "IMB_imbuf_types.h" #include "ED_image.h" #include "ED_mask.h" #include "ED_mesh.h" +#include "ED_node.h" #include "ED_space_api.h" #include "ED_screen.h" #include "ED_uvedit.h" @@ -341,11 +343,14 @@ static void image_dropboxes(void) WM_dropbox_add(lb, "IMAGE_OT_open", image_drop_poll, image_drop_copy); } - -static void image_refresh(const bContext *C, ScrArea *UNUSED(sa)) +/** + * \note take care not to get into feedback loop here, + * calling composite job causes viewer to refresh. + */ +static void image_refresh(const bContext *C, ScrArea *sa) { Scene *scene = CTX_data_scene(C); - SpaceImage *sima = CTX_wm_space_image(C); + SpaceImage *sima = sa->spacedata.first; Object *obedit = CTX_data_edit_object(C); Image *ima; @@ -354,7 +359,17 @@ static void image_refresh(const bContext *C, ScrArea *UNUSED(sa)) BKE_image_user_check_frame_calc(&sima->iuser, scene->r.cfra, 0); /* check if we have to set the image from the editmesh */ - if (ima && (ima->source == IMA_SRC_VIEWER || sima->pin)) ; + if (ima && (ima->source == IMA_SRC_VIEWER && sima->mode == SI_MODE_MASK)) { + if (sima->lock) { + Mask *mask = ED_space_image_get_mask(sima); + if (mask) { + ED_node_composite_job(C, scene->nodetree, scene); + } + } + } + else if (ima && (ima->source == IMA_SRC_VIEWER || sima->pin)) { + /* pass */ + } else if (obedit && obedit->type == OB_MESH) { Mesh *me = (Mesh *)obedit->data; struct BMEditMesh *em = me->edit_btmesh; @@ -396,6 +411,9 @@ static void image_refresh(const bContext *C, ScrArea *UNUSED(sa)) static void image_listener(ScrArea *sa, wmNotifier *wmn) { SpaceImage *sima = (SpaceImage *)sa->spacedata.first; + + /* grr, prevent feedback loop */ + const int show_mask = (sima->image && (sima->image->source == IMA_SRC_VIEWER && sima->mode == SI_MODE_MASK)); /* context changes */ switch (wmn->category) { @@ -404,15 +422,16 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn) case ND_FRAME: image_scopes_tag_refresh(sa); ED_area_tag_refresh(sa); - ED_area_tag_redraw(sa); + ED_area_tag_redraw(sa); break; case ND_MODE: case ND_RENDER_RESULT: case ND_COMPO_RESULT: if (ED_space_image_show_render(sima)) image_scopes_tag_refresh(sa); - ED_area_tag_refresh(sa); - ED_area_tag_redraw(sa); + if (!show_mask) + ED_area_tag_refresh(sa); + ED_area_tag_redraw(sa); break; } break; @@ -436,9 +455,13 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn) if (sima->mode == SI_MODE_MASK) { switch (wmn->data) { case ND_SELECT: + ED_area_tag_redraw(sa); + break; case ND_DATA: case ND_DRAW: + /* causes node-recalc */ ED_area_tag_redraw(sa); + ED_area_tag_refresh(sa); break; } switch (wmn->action) { @@ -446,7 +469,9 @@ static void image_listener(ScrArea *sa, wmNotifier *wmn) ED_area_tag_redraw(sa); break; case NA_EDITED: + /* causes node-recalc */ ED_area_tag_redraw(sa); + ED_area_tag_refresh(sa); break; } } diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index d32303b27d1..fe10a52b77d 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -163,26 +163,31 @@ static void compo_startjob(void *cjv, short *stop, short *do_update, float *prog } -void snode_composite_job(const bContext *C, ScrArea *sa) +/** + * \param sa_owner is the owner of the job, + * we don't use it for anything else currently so could also be a void pointer, + * but for now keep it an 'Scene' for consistency. + * + * \note only call from spaces `refresh` callbacks, not direct! - use with care. + */ +void ED_node_composite_job(const bContext *C, struct bNodeTree *nodetree, Scene *scene_owner) { - SpaceNode *snode = sa->spacedata.first; wmJob *steve; CompoJob *cj; - steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), sa, "Compositing", WM_JOB_EXCL_RENDER | WM_JOB_PROGRESS); + steve = WM_jobs_get(CTX_wm_manager(C), CTX_wm_window(C), scene_owner, "Compositing", WM_JOB_EXCL_RENDER | WM_JOB_PROGRESS); cj = MEM_callocN(sizeof(CompoJob), "compo job"); - + /* customdata for preview thread */ cj->scene = CTX_data_scene(C); - cj->ntree = snode->nodetree; - + cj->ntree = nodetree; + /* setup job */ WM_jobs_customdata(steve, cj, compo_freejob); WM_jobs_timer(steve, 0.1, NC_SCENE, NC_SCENE | ND_COMPO_RESULT); WM_jobs_callbacks(steve, compo_startjob, compo_initjob, compo_updatejob, NULL); - + WM_jobs_start(CTX_wm_manager(C), steve); - } /* ***************************************** */ diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index d91c158aaf3..16a31924826 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -169,7 +169,7 @@ void snode_notify(bContext *C, SpaceNode *snode); void snode_dag_update(bContext *C, SpaceNode *snode); void snode_set_context(SpaceNode *snode, Scene *scene); void snode_make_group_editable(SpaceNode *snode, bNode *gnode); -void snode_composite_job(const struct bContext *C, ScrArea *sa); + bNode *node_tree_get_editgroup(bNodeTree *ntree); void snode_update(struct SpaceNode *snode, struct bNode *node); bNode *editnode_get_active(bNodeTree *ntree); diff --git a/source/blender/editors/space_node/space_node.c b/source/blender/editors/space_node/space_node.c index af301bce942..a79bfe39257 100644 --- a/source/blender/editors/space_node/space_node.c +++ b/source/blender/editors/space_node/space_node.c @@ -46,7 +46,7 @@ #include "ED_render.h" #include "ED_screen.h" - +#include "ED_node.h" #include "WM_api.h" #include "WM_types.h" @@ -289,8 +289,9 @@ static void node_area_refresh(const struct bContext *C, ScrArea *sa) snode->recalc = 0; node_render_changed_exec((struct bContext *)C, NULL); } - else - snode_composite_job(C, sa); + else { + ED_node_composite_job(C, snode->nodetree, scene); + } } } else if (snode->treetype == NTREE_TEXTURE) { diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c index 02101b9d02d..00cde33e799 100644 --- a/source/blender/editors/transform/transform_conversions.c +++ b/source/blender/editors/transform/transform_conversions.c @@ -4983,8 +4983,9 @@ static void special_aftertrans_update__mask(bContext *C, TransInfo *t) if (t->scene->nodetree) { /* tracks can be used for stabilization nodes, * flush update for such nodes */ - nodeUpdateID(t->scene->nodetree, &mask->id); - WM_event_add_notifier(C, NC_SCENE | ND_NODES, NULL); + //if (nodeUpdateID(t->scene->nodetree, &mask->id)) { + WM_event_add_notifier(C, NC_MASK | ND_DATA, &mask->id); + //} } /* TODO - dont key all masks... */ |