proportional editing for masks
authorCampbell Barton <ideasman42@gmail.com>
Wed, 30 May 2012 07:34:25 +0000 (07:34 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 30 May 2012 07:34:25 +0000 (07:34 +0000)
release/scripts/startup/bl_ui/space_clip.py
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_generics.c
source/blender/makesdna/DNA_scene_types.h
source/blender/makesrna/intern/rna_scene.c

index c6ea5633f23250e507080682d414949fb4f5ba1e..0211ffd0c9f5dac565465c5ab23cc0618d2946d4 100644 (file)
@@ -75,8 +75,15 @@ class CLIP_HT_header(Header):
         row.template_ID(sc, "clip", open='clip.open')
 
         if sc.mode == 'MASKEDITING':
+            toolsettings = context.tool_settings
+
             row = layout.row()
             row.template_ID(sc, "mask", new="mask.new")
+            
+            row = layout.row(align=True)
+            row.prop(toolsettings, "use_proportional_edit_mask", text="", icon_only=True)
+            if toolsettings.use_proportional_edit_objects:
+                row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
 
         if clip:
             tracking = clip.tracking
index b80b6d6a1bc6f6e7f6b4be32f03c4b0513e7ffe4..cb2eaf7aef908c5fd1a87abadd54cac5ca47813c 100644 (file)
@@ -1517,6 +1517,8 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
                {
                        if (t->obedit)
                                ts->proportional = proportional;
+                       else if (t->options & CTX_MASK)
+                               ts->proportional_mask = (proportional != PROP_EDIT_OFF);
                        else
                                ts->proportional_objects = (proportional != PROP_EDIT_OFF);
                }
@@ -1650,13 +1652,8 @@ int initTransform(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event, int
                t->draw_handle_cursor = WM_paint_cursor_activate(CTX_wm_manager(C), helpline_poll, drawHelpline, t);
        }
        else if (t->spacetype == SPACE_CLIP) {
-               SpaceClip *sc = CTX_wm_space_clip(C);
                unit_m3(t->spacemtx);
                t->draw_handle_view = ED_region_draw_cb_activate(t->ar->type, drawTransformView, t, REGION_DRAW_POST_VIEW);
-               if (ED_space_clip_show_trackedit(sc))
-                       t->options |= CTX_MOVIECLIP;
-               else if (ED_space_clip_show_maskedit(sc))
-                       t->options |= CTX_MASK;
        }
        else
                unit_m3(t->spacemtx);
index 985a393f238f04df1e0056d56c0e3862ff70a83c..46ee80aff5b0b3b08cadf54cf7affcbad6bfa8d5 100644 (file)
@@ -1127,6 +1127,11 @@ int initTransInfo(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
                SpaceClip *sclip = sa->spacedata.first;
                t->view = &ar->v2d;
                t->around = sclip->around;
+
+               if (ED_space_clip_show_trackedit(sclip))
+                       t->options |= CTX_MOVIECLIP;
+               else if (ED_space_clip_show_maskedit(sclip))
+                       t->options |= CTX_MASK;
        }
        else {
                if (ar) {
@@ -1189,6 +1194,15 @@ int initTransInfo(bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
                                                        t->flag |= T_PROP_CONNECTED;
                                                }
                                        }
+                                       else if (t->options & CTX_MASK) {
+                                               if (ts->proportional_mask) {
+                                                       t->flag |= T_PROP_EDIT;
+
+                                                       if (ts->proportional == PROP_EDIT_CONNECTED) {
+                                                               t->flag |= T_PROP_CONNECTED;
+                                                       }
+                                               }
+                                       }
                                        else if (t->obedit == NULL && ts->proportional_objects) {
                                                t->flag |= T_PROP_EDIT;
                                        }
index 198b6a9bf8093bae8ec63bdcbdb8d897e1cebd32..75b0b18879ddf59c3121b618fa8857b3cbb51c78 100644 (file)
@@ -999,7 +999,8 @@ typedef struct ToolSettings {
        short snap_flag, snap_target;
        short proportional, prop_mode;
        char proportional_objects; /* proportional edit, object mode */
-       char pad[5];
+       char proportional_mask; /* proportional edit, object mode */
+       char pad[4];
 
        char auto_normalize; /*auto normalizing mode in wpaint*/
        char multipaint; /* paint multiple bones in wpaint */
index 17efc25c13278ea59fe67a3a7b2d81e89c6cae06..646118debb5eb15c208ab2d55470653612cb99d2 100644 (file)
@@ -1565,6 +1565,12 @@ static void rna_def_tool_settings(BlenderRNA  *brna)
        RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
        RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
 
+       prop = RNA_def_property(srna, "use_proportional_edit_mask", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "proportional_mask", 0);
+       RNA_def_property_ui_text(prop, "Proportional Editing Objects", "Proportional editing mask mode");
+       RNA_def_property_ui_icon(prop, ICON_PROP_OFF, 1);
+       RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); /* header redraw */
+
        prop = RNA_def_property(srna, "proportional_edit_falloff", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "prop_mode");
        RNA_def_property_enum_items(prop, proportional_falloff_items);