Fix T42857: Inconsistency between cache line visibility and ability to change frame from image space

This commit is contained in:
Sergey Sharybin 2014-12-09 20:33:19 +05:00
parent 781db5f8a6
commit 491839b3c8
Notes: blender-bot 2023-02-14 10:18:56 +01:00
Referenced by issue #42857, Time-line in UV/image editor inaccessible in mask mode & accessible, but invisible in view mode
5 changed files with 28 additions and 9 deletions

View File

@ -79,5 +79,7 @@ int ED_space_image_maskedit_mask_poll(struct bContext *C);
void ED_image_draw_info(struct Scene *scene, struct ARegion *ar, bool color_manage, bool use_default_view, int channels, int x, int y,
const unsigned char cp[4], const float fp[4], const float linearcol[4], int *zp, float *zpf);
bool ED_space_image_show_cache(struct SpaceImage *sima);
#endif /* __ED_IMAGE_H__ */

View File

@ -784,7 +784,7 @@ static int slide_point_invoke(bContext *C, wmOperator *op, const wmEvent *event)
SlidePointData *slidedata;
if (mask == NULL) {
return OPERATOR_CANCELLED;
return OPERATOR_PASS_THROUGH;
}
slidedata = slide_point_customdata(C, op, event);
@ -1286,7 +1286,7 @@ static int slide_spline_curvature_invoke(bContext *C, wmOperator *op, const wmEv
SlideSplineCurvatureData *slide_data;
if (mask == NULL) {
return OPERATOR_CANCELLED;
return OPERATOR_PASS_THROUGH;
}
/* Be sure we don't conflict with point slide here. */

View File

@ -854,8 +854,13 @@ void draw_image_main(const bContext *C, ARegion *ar)
draw_render_info(sima->iuser.scene, ima, ar, zoomx, zoomy);
}
static bool show_image_cache(Image *image, Mask *mask)
bool ED_space_image_show_cache(SpaceImage *sima)
{
Image *image = ED_space_image(sima);
Mask *mask = NULL;
if (sima->mode == SI_MODE_MASK) {
mask = ED_space_image_get_mask(sima);
}
if (image == NULL && mask == NULL) {
return false;
}
@ -873,12 +878,12 @@ void draw_image_cache(const bContext *C, ARegion *ar)
float x, cfra = CFRA, sfra = SFRA, efra = EFRA, framelen = ar->winx / (efra - sfra + 1);
Mask *mask = NULL;
if (sima->mode == SI_MODE_MASK) {
mask = ED_space_image_get_mask(sima);
if (!ED_space_image_show_cache(sima)) {
return;
}
if (!show_image_cache(image, mask)) {
return;
if (sima->mode == SI_MODE_MASK) {
mask = ED_space_image_get_mask(sima);
}
glEnable(GL_BLEND);

View File

@ -2582,8 +2582,9 @@ static int image_sample_invoke(bContext *C, wmOperator *op, const wmEvent *event
ImageSampleInfo *info;
if (ar->regiontype == RGN_TYPE_WINDOW) {
if (event->mval[1] <= 16)
if (event->mval[1] <= 16 && ED_space_image_show_cache(sima)) {
return OPERATOR_PASS_THROUGH;
}
}
if (!ED_space_image_has_buffer(sima))
@ -3017,8 +3018,10 @@ static int change_frame_invoke(bContext *C, wmOperator *op, const wmEvent *event
ARegion *ar = CTX_wm_region(C);
if (ar->regiontype == RGN_TYPE_WINDOW) {
if (event->mval[1] > 16)
SpaceImage *sima = CTX_wm_space_image(C);
if (event->mval[1] > 16 || !ED_space_image_show_cache(sima)) {
return OPERATOR_PASS_THROUGH;
}
}
RNA_int_set(op->ptr, "frame", frame_from_event(C, event));

View File

@ -3877,6 +3877,15 @@ static int uv_set_2d_cursor_invoke(bContext *C, wmOperator *op, const wmEvent *e
ARegion *ar = CTX_wm_region(C);
float location[2];
if (ar->regiontype == RGN_TYPE_WINDOW) {
if (event->mval[1] <= 16) {
SpaceImage *sima = CTX_wm_space_image(C);
if (sima && ED_space_image_show_cache(sima)) {
return OPERATOR_PASS_THROUGH;
}
}
}
UI_view2d_region_to_view(&ar->v2d, event->mval[0], event->mval[1], &location[0], &location[1]);
RNA_float_set_array(op->ptr, "location", location);