Separate proportional edit setting between edit and object mode. They are now used...
authorMartin Poirier <theeth@yahoo.com>
Sat, 31 Jul 2010 19:26:21 +0000 (19:26 +0000)
committerMartin Poirier <theeth@yahoo.com>
Sat, 31 Jul 2010 19:26:21 +0000 (19:26 +0000)
source/blender/editors/curve/curve_ops.c
source/blender/editors/include/ED_object.h
source/blender/editors/mesh/mesh_ops.c
source/blender/editors/object/object_ops.c
source/blender/editors/physics/physics_ops.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/uvedit/uvedit_ops.c
source/blender/makesdna/DNA_scene_types.h
source/blender/makesrna/intern/rna_scene.c

index d650cecdc3eee486f08d0b0b353e54cd74b96230..47b1fee3cf68c6bc3838003c29e825ec9e59d429 100644 (file)
@@ -233,6 +233,6 @@ void ED_keymap_curve(wmKeyConfig *keyconf)
        /* menus */
        WM_keymap_add_menu(keymap, "VIEW3D_MT_hook", HKEY, KM_PRESS, KM_CTRL, 0);
 
-       ED_object_generic_keymap(keyconf, keymap, 2);
+       ED_object_generic_keymap(keyconf, keymap, 3);
 }
 
index a03cd135f1ca5baa9b49591f649efcf32a7c07ac..efa5d6c5dadf511d476bea47de9e47391160ba5f 100644 (file)
@@ -55,7 +55,13 @@ void ED_operatortypes_object(void);
 void ED_operatormacros_object(void);
 void ED_keymap_object(struct wmKeyConfig *keyconf);
 
-/* generic editmode keys like pet */
+/* generic editmode keys like pet
+ * do_pet
+ *     0: No
+ *     1: Object
+ *     2: Edit
+ *     3: Edit with connected
+ * */
 void ED_object_generic_keymap(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap, int do_pet);
 
        /* send your own notifier for select! */
index e143e4859f56a7880921bfbee4c3904a667c2a9b..9eac347c8938b3cf3f8c5b4c0e872b5669366fa3 100644 (file)
@@ -314,6 +314,6 @@ void ED_keymap_mesh(wmKeyConfig *keyconf)
        WM_keymap_add_menu(keymap, "VIEW3D_MT_uv_map", UKEY, KM_PRESS, 0, 0);
        WM_keymap_add_menu(keymap, "VIEW3D_MT_vertex_group", GKEY, KM_PRESS, KM_CTRL, 0);
        
-       ED_object_generic_keymap(keyconf, keymap, 2);
+       ED_object_generic_keymap(keyconf, keymap, 3);
 }
 
index e1ea7924916490f3e788b98070c77f986991fa16..610a82d964c997f3eed27978e181c7662b2f5046 100644 (file)
@@ -364,7 +364,10 @@ void ED_keymap_object(wmKeyConfig *keyconf)
                RNA_int_set(kmi->ptr, "level", i);
        }
 
-       /* Lattice -------------------------------------------------------------------- */
+       /* ############################################################################ */
+       /* ################################ LATTICE ################################### */
+       /* ############################################################################ */
+
        keymap= WM_keymap_find(keyconf, "Lattice", 0, 0);
        keymap->poll= ED_operator_editlattice;
 
@@ -375,7 +378,7 @@ void ED_keymap_object(wmKeyConfig *keyconf)
                /* menus */
        WM_keymap_add_menu(keymap, "VIEW3D_MT_hook", HKEY, KM_PRESS, KM_CTRL, 0);
 
-       ED_object_generic_keymap(keyconf, keymap, 1);
+       ED_object_generic_keymap(keyconf, keymap, 2);
 }
 
 void ED_object_generic_keymap(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap, int do_pet)
@@ -383,22 +386,31 @@ void ED_object_generic_keymap(struct wmKeyConfig *keyconf, struct wmKeyMap *keym
        wmKeyMapItem *kmi;
 
        /* used by mesh, curve & lattice only */
-       if(do_pet > 0) {
+       if(do_pet) {
                /* context ops */
                kmi = WM_keymap_add_item(keymap, "WM_OT_context_cycle_enum", OKEY, KM_PRESS, KM_SHIFT, 0);
                RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_editing_falloff");
 
-               kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", OKEY, KM_PRESS, 0, 0);
-               RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_editing");
-               RNA_string_set(kmi->ptr, "value_1", "DISABLED");
-               RNA_string_set(kmi->ptr, "value_2", "ENABLED");
+               // Object mode
+               if (do_pet == 1) {
+
+                       kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle", OKEY, KM_PRESS, 0, 0);
+                       RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_editing_objects");
+
+               } else { // Edit mode
 
-               /* for modes/object types that allow 'conencted' mode, add the Alt O key */
-               if (do_pet > 1) {
-                       kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", OKEY, KM_PRESS, KM_ALT, 0);
+                       kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", OKEY, KM_PRESS, 0, 0);
                        RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_editing");
                        RNA_string_set(kmi->ptr, "value_1", "DISABLED");
-                       RNA_string_set(kmi->ptr, "value_2", "CONNECTED");
+                       RNA_string_set(kmi->ptr, "value_2", "ENABLED");
+
+                       /* for modes/object types that allow 'connected' mode, add the Alt O key */
+                       if (do_pet == 3) {
+                               kmi = WM_keymap_add_item(keymap, "WM_OT_context_toggle_enum", OKEY, KM_PRESS, KM_ALT, 0);
+                               RNA_string_set(kmi->ptr, "data_path", "tool_settings.proportional_editing");
+                               RNA_string_set(kmi->ptr, "value_1", "DISABLED");
+                               RNA_string_set(kmi->ptr, "value_2", "CONNECTED");
+                       }
                }
        }
 }
index 5a51c36cd09d8002b6b00c3ad8c084ad09e15003..2b7f8e9d5a2548d2c8e25dd1dc5177c7b32016d8 100644 (file)
@@ -114,7 +114,7 @@ static void keymap_particle(wmKeyConfig *keyconf)
        
        WM_keymap_add_item(keymap, "PARTICLE_OT_weight_set", KKEY, KM_PRESS, KM_SHIFT, 0);
 
-       ED_object_generic_keymap(keyconf, keymap, 1);
+       ED_object_generic_keymap(keyconf, keymap, 2);
 }
 
 /******************************* boids *************************************/
index 9743a4ef0f56537720dc9394acc994b95ec86e9d..926d8ffd00744bc2c37334a47315f258a2d0435f 100644 (file)
@@ -1367,17 +1367,17 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
                }
        }
 
-       /* XXX convert stupid flag to enum */
+       /* convert flag to enum */
        switch(t->flag & (T_PROP_EDIT|T_PROP_CONNECTED))
        {
        case (T_PROP_EDIT|T_PROP_CONNECTED):
-               proportional = 2;
+               proportional = PROP_EDIT_CONNECTED;
                break;
        case T_PROP_EDIT:
-               proportional = 1;
+               proportional = PROP_EDIT_ON;
                break;
        default:
-               proportional = 0;
+               proportional = PROP_EDIT_OFF;
        }
 
        // If modal, save settings back in scene if not set as operator argument
@@ -1385,7 +1385,10 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
 
                /* save settings if not set in operator */
                if (RNA_struct_find_property(op->ptr, "proportional") && !RNA_property_is_set(op->ptr, "proportional")) {
-                       ts->proportional = proportional;
+                       if (t->obedit)
+                               ts->proportional = proportional;
+                       else
+                               ts->proportional_objects = (proportional != PROP_EDIT_OFF);
                }
 
                if (RNA_struct_find_property(op->ptr, "proportional_size") && !RNA_property_is_set(op->ptr, "proportional_size")) {
index 8d98255d3d96a97a5f11313efc0058d657f6db99..920c5c12ea1ea9b16432359edde26879b229dcca 100644 (file)
@@ -38,6 +38,7 @@
 #include "DNA_armature_types.h"
 #include "DNA_lattice_types.h"
 #include "DNA_screen_types.h"
+#include "DNA_scene_types.h"
 #include "DNA_space_types.h"
 #include "DNA_view3d_types.h"
 
@@ -1033,9 +1034,9 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
                {
                        switch(RNA_enum_get(op->ptr, "proportional"))
                        {
-                       case 2: /* XXX connected constant */
+                       case PROP_EDIT_CONNECTED:
                                t->flag |= T_PROP_CONNECTED;
-                       case 1: /* XXX prop on constant */
+                       case PROP_EDIT_ON:
                                t->flag |= T_PROP_EDIT;
                                break;
                        }
@@ -1045,11 +1046,19 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
                        /* use settings from scene only if modal */
                        if (t->flag & T_MODAL)
                        {
-                               if ((t->options & CTX_NO_PET) == 0 && (ts->proportional != PROP_EDIT_OFF)) {
-                                       t->flag |= T_PROP_EDIT;
+                               if ((t->options & CTX_NO_PET) == 0)
+                               {
+                                       if (t->obedit && ts->proportional != PROP_EDIT_OFF)
+                                       {
+                                               t->flag |= T_PROP_EDIT;
 
-                                       if(ts->proportional == PROP_EDIT_CONNECTED)
-                                               t->flag |= T_PROP_CONNECTED;
+                                               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 bae8d4b7fcffd85df2377f9a2fe64e9192472fb7..cbc0eb41f841384ad88b322241803f2c59a17480 100644 (file)
@@ -3241,7 +3241,7 @@ void ED_keymap_uvedit(wmKeyConfig *keyconf)
        /* menus */
        WM_keymap_add_menu(keymap, "IMAGE_MT_uvs_snap", SKEY, KM_PRESS, KM_SHIFT, 0);
 
-       ED_object_generic_keymap(keyconf, keymap, 1);
+       ED_object_generic_keymap(keyconf, keymap, 2);
 
        transform_keymap_for_space(keyconf, keymap, SPACE_IMAGE);
 }
index f4b022bd56b0ed88845ce22cd33594b18b051fe8..984aa5a67051016a46943f69ea2332989a5171fd 100644 (file)
@@ -724,11 +724,13 @@ typedef struct ToolSettings {
        /* Transform */
        short snap_mode, snap_flag, snap_target;
        short proportional, prop_mode;
+       char proportional_objects; /* proportional edit, object mode */
+       char pad[3];
 
-       int auto_normalize, intpad; /*auto normalizing mode in wpaint*/
+       int auto_normalize; /*auto normalizing mode in wpaint*/
 
        short sculpt_paint_settings; /* user preferences for sculpt and paint */
-       short pad;
+       short pad1;
        int sculpt_paint_unified_size; /* unified radius of brush in pixels */
        float sculpt_paint_unified_unprojected_radius;/* unified radius of brush in Blender units */
        float sculpt_paint_unified_alpha; /* unified strength of brush */
index a08e9e4252fb5e8d7b69ca4f804e14590f795358..966e7696ede391f54cab60d8a73516fdb54b1d62 100644 (file)
@@ -1009,6 +1009,12 @@ static void rna_def_tool_settings(BlenderRNA  *brna)
        RNA_def_property_ui_text(prop, "Proportional Editing", "Proportional editing mode");
        RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */
 
+       prop= RNA_def_property(srna, "proportional_editing_objects", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "proportional_objects", 0);
+       RNA_def_property_ui_text(prop, "Proportional Editing Objects", "Proportional editing object 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_editing_falloff", PROP_ENUM, PROP_NONE);
        RNA_def_property_enum_sdna(prop, NULL, "prop_mode");
        RNA_def_property_enum_items(prop, proportional_falloff_items);