fix [#28066] Unchecking 'self project' messes up 'Snap to Vertex'
authorCampbell Barton <ideasman42@gmail.com>
Wed, 27 Jul 2011 07:22:31 +0000 (07:22 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 27 Jul 2011 07:22:31 +0000 (07:22 +0000)
this option is useful for all non-grid snapping modes (when in editmode) so make available in those cases too.

release/scripts/startup/bl_ui/space_view3d.py
source/blender/editors/transform/transform.h
source/blender/editors/transform/transform_snap.c
source/blender/makesdna/DNA_scene_types.h
source/blender/makesrna/intern/rna_scene.c

index 7d35ca9ddb8eca8ff3e2711c12d22fae3512d99e..acb0499c40fb3647dbb3d5c83ef118fc29335afc 100644 (file)
@@ -79,19 +79,22 @@ class VIEW3D_HT_header(bpy.types.Header):
                     row.prop(toolsettings, "proportional_edit_falloff", text="", icon_only=True)
 
         # Snap
+        snap_element = toolsettings.snap_element
         row = layout.row(align=True)
         row.prop(toolsettings, "use_snap", text="")
         row.prop(toolsettings, "snap_element", text="", icon_only=True)
-        if toolsettings.snap_element != 'INCREMENT':
+        if snap_element != 'INCREMENT':
             row.prop(toolsettings, "snap_target", text="")
-            if obj and obj.mode == 'OBJECT':
-                row.prop(toolsettings, "use_snap_align_rotation", text="")
-        if toolsettings.snap_element == 'VOLUME':
+            if obj:
+                if obj.mode == 'OBJECT':
+                    row.prop(toolsettings, "use_snap_align_rotation", text="")
+                elif obj.mode == 'EDIT':
+                    row.prop(toolsettings, "use_snap_self", text="")
+
+        if snap_element == 'VOLUME':
             row.prop(toolsettings, "use_snap_peel_object", text="")
-        elif toolsettings.snap_element == 'FACE':
+        elif snap_element == 'FACE':
             row.prop(toolsettings, "use_snap_project", text="")
-            if toolsettings.use_snap_project and obj.mode == 'EDIT':
-                row.prop(toolsettings, "use_snap_project_self", text="")
 
         # OpenGL render
         row = layout.row(align=True)
index d8e750acb882b9fe4e6a69e22033d866bf460bf5..d8e424887871937c75504245c7f26ed21ed37a3c 100644 (file)
@@ -96,7 +96,7 @@ typedef struct TransSnap {
        short   modeSelect;
        short   align;
        char    project;
-       char    project_self;
+       char    snap_self;
        short   peel;
        short   status;
        float   snapPoint[3]; /* snapping from this point */
index a4307ea336d324f2f6f79ce8945ef6db022bcf8a..933d90ebbf2f8c23ff13d70e3834de51fdde334a 100644 (file)
@@ -392,7 +392,7 @@ static void initSnappingMode(TransInfo *t)
                        }
                        else
                        {
-                               t->tsnap.modeSelect = t->tsnap.project_self ? SNAP_ALL : SNAP_NOT_OBEDIT;
+                               t->tsnap.modeSelect = t->tsnap.snap_self ? SNAP_ALL : SNAP_NOT_OBEDIT;
                        }
                }
                /* Particles edit mode*/
@@ -458,9 +458,9 @@ void initSnapping(TransInfo *t, wmOperator *op)
                                t->tsnap.project = RNA_boolean_get(op->ptr, "use_snap_project");
                        }
 
-                       if (RNA_struct_find_property(op->ptr, "use_snap_project_self"))
+                       if (RNA_struct_find_property(op->ptr, "use_snap_self"))
                        {
-                               t->tsnap.project = RNA_boolean_get(op->ptr, "use_snap_project_self");
+                               t->tsnap.snap_self = RNA_boolean_get(op->ptr, "use_snap_self");
                        }
                }
        }
@@ -473,7 +473,7 @@ void initSnapping(TransInfo *t, wmOperator *op)
 
                t->tsnap.align = ((t->settings->snap_flag & SCE_SNAP_ROTATE) == SCE_SNAP_ROTATE);
                t->tsnap.project = ((t->settings->snap_flag & SCE_SNAP_PROJECT) == SCE_SNAP_PROJECT);
-               t->tsnap.project_self = !((t->settings->snap_flag & SCE_SNAP_PROJECT_NO_SELF) == SCE_SNAP_PROJECT_NO_SELF);
+               t->tsnap.snap_self = !((t->settings->snap_flag & SCE_SNAP_NO_SELF) == SCE_SNAP_NO_SELF);
                t->tsnap.peel = ((t->settings->snap_flag & SCE_SNAP_PROJECT) == SCE_SNAP_PROJECT);
        }
        
index 8203a4dd77c14a0f2575d9abd7791044ff6d91b9..2211f93a8aebbc304759160e1df154ab7f55e77f 100644 (file)
@@ -1074,7 +1074,7 @@ typedef struct Scene {
 #define SCE_SNAP_ROTATE                        2
 #define SCE_SNAP_PEEL_OBJECT   4
 #define SCE_SNAP_PROJECT               8
-#define SCE_SNAP_PROJECT_NO_SELF       16
+#define SCE_SNAP_NO_SELF               16
 /* toolsettings->snap_target */
 #define SCE_SNAP_TARGET_CLOSEST        0
 #define SCE_SNAP_TARGET_CENTER 1
index d9475eaa6832d65bb7bf13d8ae9a26902d1b379f..f4028e45e965e18bd2a95f4d0e7b4bbf01d78468 100644 (file)
@@ -1178,9 +1178,9 @@ static void rna_def_tool_settings(BlenderRNA  *brna)
        RNA_def_property_ui_icon(prop, ICON_RETOPO, 0);
        RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */
 
-       prop= RNA_def_property(srna, "use_snap_project_self", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_boolean_negative_sdna(prop, NULL, "snap_flag", SCE_SNAP_PROJECT_NO_SELF);
-       RNA_def_property_ui_text(prop, "Project to Self", "Project into its self (editmode)");
+       prop= RNA_def_property(srna, "use_snap_self", PROP_BOOLEAN, PROP_NONE);
+       RNA_def_property_boolean_negative_sdna(prop, NULL, "snap_flag", SCE_SNAP_NO_SELF);
+       RNA_def_property_ui_text(prop, "Project to Self", "Snap onto its self (editmode)");
        RNA_def_property_ui_icon(prop, ICON_ORTHO, 0);
        RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */