From f9e63430ac38f806ac9e69b57f37cd07111f1970 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 16 Jul 2012 14:17:01 +0000 Subject: [PATCH 1/2] use calculated spline resoltion rather then fixed at 32. --- source/blender/blenkernel/BKE_mask.h | 3 +++ source/blender/blenkernel/intern/mask.c | 4 ++-- source/blender/blenkernel/intern/mask_rasterize.c | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/source/blender/blenkernel/BKE_mask.h b/source/blender/blenkernel/BKE_mask.h index 411350764b3..a293e4a784b 100644 --- a/source/blender/blenkernel/BKE_mask.h +++ b/source/blender/blenkernel/BKE_mask.h @@ -64,6 +64,9 @@ void BKE_mask_layer_copy_list(struct ListBase *masklayers_new, struct ListBase * /* splines */ struct MaskSpline *BKE_mask_spline_add(struct MaskLayer *masklay); +int BKE_mask_spline_resolution(struct MaskSpline *spline, int width, int height); +int BKE_mask_spline_feather_resolution(struct MaskSpline *spline, int width, int height); + int BKE_mask_spline_differentiate_calc_total(const struct MaskSpline *spline, const int resol); float (*BKE_mask_spline_differentiate(struct MaskSpline *spline, int *tot_diff_point))[2]; diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c index 1efa62efa13..9374b5dc1d9 100644 --- a/source/blender/blenkernel/intern/mask.c +++ b/source/blender/blenkernel/intern/mask.c @@ -246,7 +246,7 @@ MaskSpline *BKE_mask_spline_add(MaskLayer *masklay) return spline; } -static int BKE_mask_spline_resolution(MaskSpline *spline, int width, int height) +int BKE_mask_spline_resolution(MaskSpline *spline, int width, int height) { float max_segment = 0.01f; int i, resol = 1; @@ -284,7 +284,7 @@ static int BKE_mask_spline_resolution(MaskSpline *spline, int width, int height) return resol; } -static int BKE_mask_spline_feather_resolution(MaskSpline *spline, int width, int height) +int BKE_mask_spline_feather_resolution(MaskSpline *spline, int width, int height) { const float max_segment = 0.005; int resol = BKE_mask_spline_resolution(spline, width, height); diff --git a/source/blender/blenkernel/intern/mask_rasterize.c b/source/blender/blenkernel/intern/mask_rasterize.c index c3d67a24c3b..7b84abc3d36 100644 --- a/source/blender/blenkernel/intern/mask_rasterize.c +++ b/source/blender/blenkernel/intern/mask_rasterize.c @@ -471,7 +471,6 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas const short do_feather) { const rctf default_bounds = {0.0f, 1.0f, 0.0f, 1.0f}; - const int resol = SPLINE_RESOL; /* TODO: real size */ const float pixel_size = 1.0f / MIN2(width, height); const float zvec[3] = {0.0f, 0.0f, 1.0f}; @@ -522,6 +521,10 @@ void BKE_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas float (*diff_feather_points)[2]; int tot_diff_feather_points; + const int resol_a = BKE_mask_spline_resolution(spline, width, height) / 4; + const int resol_b = BKE_mask_spline_feather_resolution(spline, width, height) / 4; + const int resol = CLAMPIS(MAX2(resol_a, resol_b), 4, 512); + diff_points = BKE_mask_spline_differentiate_with_resolution_ex( spline, resol, &tot_diff_point); From 13b56dec782e7b492fed2107eb4db0736e93d10f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 16 Jul 2012 14:27:45 +0000 Subject: [PATCH 2/2] show alpha in the mask buttons item list --- source/blender/editors/interface/interface_templates.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 49e3818fe08..8832f32f43d 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -2242,13 +2242,13 @@ static void list_item_row(bContext *C, uiLayout *layout, PointerRNA *ptr, Pointe } } else if (itemptr->type == &RNA_MaskLayer) { - split = uiLayoutSplit(sub, 0.5f, FALSE); + split = uiLayoutRow(sub, FALSE); uiItemL(split, name, icon); uiBlockSetEmboss(block, UI_EMBOSSN); row = uiLayoutRow(split, TRUE); - // uiItemR(row, itemptr, "alpha", 0, "", ICON_NONE); // enable when used + uiItemR(row, itemptr, "alpha", 0, "", ICON_NONE); // enable when used uiItemR(row, itemptr, "hide", 0, "", 0); uiItemR(row, itemptr, "hide_select", 0, "", 0); uiItemR(row, itemptr, "hide_render", 0, "", 0);