projects
/
blender.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7cc5af4
)
falloff option for mask layers
author
Campbell Barton <ideasman42@gmail.com>
Sun, 15 Jul 2012 03:11:07 +0000
(
03:11
+0000)
committer
Campbell Barton <ideasman42@gmail.com>
Sun, 15 Jul 2012 03:11:07 +0000
(
03:11
+0000)
release/scripts/startup/bl_ui/space_clip.py
patch
|
blob
|
history
source/blender/blenkernel/intern/mask_rasterize.c
patch
|
blob
|
history
source/blender/makesdna/DNA_mask_types.h
patch
|
blob
|
history
source/blender/makesrna/intern/rna_mask.c
patch
|
blob
|
history
diff --git
a/release/scripts/startup/bl_ui/space_clip.py
b/release/scripts/startup/bl_ui/space_clip.py
index 874405bd66b64f35a065a46753b117a7b5a436af..ac724518e8503562e53fdf3c557ee119bc5b6858 100644
(file)
--- a/
release/scripts/startup/bl_ui/space_clip.py
+++ b/
release/scripts/startup/bl_ui/space_clip.py
@@
-707,6
+707,7
@@
class CLIP_PT_mask_layers(Panel):
row.prop(active_layer, "invert", text="", icon='IMAGE_ALPHA')
layout.prop(active_layer, "blend")
row.prop(active_layer, "invert", text="", icon='IMAGE_ALPHA')
layout.prop(active_layer, "blend")
+ layout.prop(active_layer, "falloff")
class CLIP_PT_active_mask_spline(Panel):
class CLIP_PT_active_mask_spline(Panel):
diff --git
a/source/blender/blenkernel/intern/mask_rasterize.c
b/source/blender/blenkernel/intern/mask_rasterize.c
index cd3b6c71c09dba5479b21b1f7d272e968167552a..b415e9f1ba8dd288b447bf2f26a61c7daa65d12d 100644
(file)
--- a/
source/blender/blenkernel/intern/mask_rasterize.c
+++ b/
source/blender/blenkernel/intern/mask_rasterize.c
@@
-32,6
+32,7
@@
#include "DNA_vec_types.h"
#include "DNA_mask_types.h"
#include "DNA_vec_types.h"
#include "DNA_mask_types.h"
+#include "DNA_scene_types.h"
#include "BLI_utildefines.h"
#include "BLI_scanfill.h"
#include "BLI_utildefines.h"
#include "BLI_scanfill.h"
@@
-93,6
+94,7
@@
typedef struct MaskRasterLayer {
float alpha;
char blend;
char blend_flag;
float alpha;
char blend;
char blend_flag;
+ char falloff;
} MaskRasterLayer;
} MaskRasterLayer;
@@
-832,6
+834,7
@@
void BLI_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
layer->alpha = masklay->alpha;
layer->blend = masklay->blend;
layer->blend_flag = masklay->blend_flag;
layer->alpha = masklay->alpha;
layer->blend = masklay->blend;
layer->blend_flag = masklay->blend_flag;
+ layer->falloff = masklay->falloff;
}
/* printf("tris %d, feather tris %d\n", sf_tri_tot, tot_feather_quads); */
}
/* printf("tris %d, feather tris %d\n", sf_tri_tot, tot_feather_quads); */
@@
-976,11
+979,29
@@
float BLI_maskrasterize_handle_sample(MaskRasterHandle *mr_handle, const float x
float value_layer;
if (BLI_in_rctf_v(&layer->bounds, xy)) {
float value_layer;
if (BLI_in_rctf_v(&layer->bounds, xy)) {
- const float dist = 1.0f - layer_bucket_depth_from_xy(layer, xy);
- const float dist_ease = (3.0f * dist * dist - 2.0f * dist * dist * dist);
+ float val = 1.0f - layer_bucket_depth_from_xy(layer, xy);
+
+ switch (layer->falloff) {
+ case PROP_SMOOTH:
+ /* ease - gives less hard lines for dilate/erode feather */
+ val = (3.0f * val * val - 2.0f * val * val * val);
+ break;
+ case PROP_SPHERE:
+ val = sqrtf(2.0f * val - val * val);
+ break;
+ case PROP_ROOT:
+ val = sqrtf(val);
+ break;
+ case PROP_SHARP:
+ val = val * val;
+ break;
+ case PROP_LIN:
+ default:
+ /* nothing */
+ break;
+ }
- /* apply alpha */
- value_layer = dist_ease * layer->alpha;
+ value_layer = val * layer->alpha;
}
else {
value_layer = 0.0f;
}
else {
value_layer = 0.0f;
diff --git
a/source/blender/makesdna/DNA_mask_types.h
b/source/blender/makesdna/DNA_mask_types.h
index 4c2330965ee7d812c8fa1ae3db391807e13822ce..dd9ea508723af37587463f21cdaeeab9243ea161 100644
(file)
--- a/
source/blender/makesdna/DNA_mask_types.h
+++ b/
source/blender/makesdna/DNA_mask_types.h
@@
-127,6
+127,8
@@
typedef struct MaskLayer {
float alpha;
char blend;
char blend_flag;
float alpha;
char blend;
char blend_flag;
+ char falloff;
+ char pad[7];
char flag; /* for animation */
char restrictflag; /* matching 'Object' flag of the same name - eventually use in the outliner */
char flag; /* for animation */
char restrictflag; /* matching 'Object' flag of the same name - eventually use in the outliner */
diff --git
a/source/blender/makesrna/intern/rna_mask.c
b/source/blender/makesrna/intern/rna_mask.c
index e6fd47985cbdd437724b4b74abcda0959954d175..2b89dd02daeb14b8c875a2b0740754202696afae 100644
(file)
--- a/
source/blender/makesrna/intern/rna_mask.c
+++ b/
source/blender/makesrna/intern/rna_mask.c
@@
-35,6
+35,7
@@
#include "BKE_tracking.h"
#include "RNA_define.h"
#include "BKE_tracking.h"
#include "RNA_define.h"
+#include "RNA_enum_types.h"
#include "rna_internal.h"
#include "rna_internal.h"
@@
-653,6
+654,12
@@
static void rna_def_mask_layer(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Restrict View", "Invert the mask black/white");
RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
RNA_def_property_ui_text(prop, "Restrict View", "Invert the mask black/white");
RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
+ prop = RNA_def_property(srna, "falloff", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "falloff");
+ RNA_def_property_enum_items(prop, proportional_falloff_curve_only_items);
+ RNA_def_property_ui_text(prop, "Falloff", "Falloff type the feather");
+ RNA_def_property_update(prop, NC_MASK | NA_EDITED, NULL);
+
}
static void rna_def_masklayers(BlenderRNA *brna, PropertyRNA *cprop)
}
static void rna_def_masklayers(BlenderRNA *brna, PropertyRNA *cprop)