use a different setting for fill/cyclic - you may want to have unfilled cyclic curves.
authorCampbell Barton <ideasman42@gmail.com>
Sat, 14 Jul 2012 20:53:52 +0000 (20:53 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 14 Jul 2012 20:53:52 +0000 (20:53 +0000)
release/scripts/startup/bl_ui/space_clip.py
source/blender/blenkernel/intern/mask_rasterize.c
source/blender/editors/mask/mask_draw.c
source/blender/makesdna/DNA_mask_types.h
source/blender/makesrna/intern/rna_mask.c

index d937837e5d1bdb25ef6301a834b23bdb02997e5b..874405bd66b64f35a065a46753b117a7b5a436af 100644 (file)
@@ -733,7 +733,9 @@ class CLIP_PT_active_mask_spline(Panel):
 
         col = layout.column()
         col.prop(spline, "weight_interpolation")
-        col.prop(spline, "use_cyclic")
+        rowsub = col.row()
+        rowsub.prop(spline, "use_cyclic")
+        rowsub.prop(spline, "use_fill")
 
 
 class CLIP_PT_active_mask_point(Panel):
index a08118e6fa2fe3ae347382ede24b8025188792d9..815f3ab34e3a23c77d6b1265fc07fbca361a0d77 100644 (file)
@@ -467,7 +467,7 @@ void BLI_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
                BLI_scanfill_begin(&sf_ctx);
 
                for (spline = masklay->splines.first; spline; spline = spline->next) {
-                       const unsigned int is_cyclic = (spline->flag & MASK_SPLINE_CYCLIC) != 0;
+                       const unsigned int is_fill = (spline->flag & MASK_SPLINE_NOFILL) == 0;
 
                        float (*diff_points)[2];
                        int tot_diff_point;
@@ -541,7 +541,7 @@ void BLI_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
                                        }
                                }
 
-                               if (is_cyclic) {
+                               if (is_fill) {
                                        copy_v2_v2(co, diff_points[0]);
                                        sf_vert_prev = BLI_scanfill_vert_add(&sf_ctx, co);
                                        sf_vert_prev->tmp.u = sf_vert_tot;
@@ -597,7 +597,7 @@ void BLI_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
                                        }
                                }
                                else {
-                                       /* unfilled spline (non cyclic) */
+                                       /* unfilled spline */
                                        if (diff_feather_points) {
 
                                                float co_diff[3];
@@ -605,7 +605,6 @@ void BLI_maskrasterize_handle_init(MaskRasterHandle *mr_handle, struct Mask *mas
                                                float co_feather[3];
                                                co_feather[2] = 1.0f;
 
-
                                                open_spline_ranges[open_spline_index ][0] = sf_vert_tot;
                                                open_spline_ranges[open_spline_index ][1] = tot_diff_point;
                                                open_spline_index++;
index f080b9f96e7871c105e867c31f8720cac81be130..f378d5452a446a337140c2a2086f299e5a9197bd 100644 (file)
@@ -388,6 +388,9 @@ static void draw_spline_curve(MaskLayer *masklay, MaskSpline *spline,
        mask_draw_curve_type(spline, feather_points, tot_feather_point,
                             TRUE, is_smooth, is_active,
                             rgb_tmp, draw_type);
+
+       /* TODO, draw mirror values when MASK_SPLINE_NOFILL is set */
+
        MEM_freeN(feather_points);
 
        /* draw main curve */
index 52fedd72e86f4eba1f95a867088f417f7f0bae63..4c2330965ee7d812c8fa1ae3db391807e13822ce 100644 (file)
@@ -137,7 +137,10 @@ typedef struct MaskLayer {
 
 /* MaskSpline->flag */
 /* reserve (1 << 0) for SELECT */
-#define MASK_SPLINE_CYCLIC  (1 << 1)
+enum {
+       MASK_SPLINE_CYCLIC  = (1 << 1),
+       MASK_SPLINE_NOFILL    = (1 << 2)
+};
 
 /* MaskSpline->weight_interp */
 #define MASK_SPLINE_INTERP_LINEAR   1
index b879d2b19f7b683b284ccad13f07fcbbe7816a39..e6fd47985cbdd437724b4b74abcda0959954d175 100644 (file)
@@ -566,6 +566,13 @@ static void rna_def_maskSpline(BlenderRNA *brna)
        RNA_def_property_boolean_sdna(prop, NULL, "flag", MASK_SPLINE_CYCLIC);
        RNA_def_property_ui_text(prop, "Cyclic", "Make this spline a closed loop");
        RNA_def_property_update(prop, 0, "rna_Mask_update_data");
+
+       /* fill */
+       prop = RNA_def_property(srna, "use_fill", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
+       RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", MASK_SPLINE_NOFILL);
+       RNA_def_property_ui_text(prop, "Fill", "Make this spline filled");
+       RNA_def_property_update(prop, 0, "rna_Mask_update_data");
 }
 
 static void rna_def_mask_layer(BlenderRNA *brna)