fix [#25598] projection surface snap issue
authorCampbell Barton <ideasman42@gmail.com>
Fri, 17 Jun 2011 13:02:23 +0000 (13:02 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 17 Jun 2011 13:02:23 +0000 (13:02 +0000)
Excuse the thrashing, this is from r35438, reverted r35444 under the _wrong_ impression Martin considered unacceptable.

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 02004283264ead9fc3c2deeceb23b4627282ee50..efea8d31834f8de30d2d0f86ed7dd3df91e86c09 100644 (file)
@@ -98,6 +98,8 @@ class VIEW3D_HT_header(bpy.types.Header):
             row.prop(toolsettings, "use_snap_peel_object", text="")
         elif toolsettings.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 0e0d452a9e684267eb37866de4ce2b8f49f36f06..d8e750acb882b9fe4e6a69e22033d866bf460bf5 100644 (file)
@@ -95,7 +95,8 @@ typedef struct TransSnap {
        short   modePoint;
        short   modeSelect;
        short   align;
-       short   project;
+       char    project;
+       char    project_self;
        short   peel;
        short   status;
        float   snapPoint[3]; /* snapping from this point */
index e3e5e012920d88db731d0930e166794b9aa7fbc6..c4d6eb020288ea765b274776b6e832d1db8d72ca 100644 (file)
@@ -392,7 +392,7 @@ static void initSnappingMode(TransInfo *t)
                        }
                        else
                        {
-                               t->tsnap.modeSelect = SNAP_ALL;
+                               t->tsnap.modeSelect = t->tsnap.project_self ? SNAP_ALL : SNAP_NOT_OBEDIT;
                        }
                }
                /* Particles edit mode*/
@@ -457,6 +457,11 @@ 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"))
+                       {
+                               t->tsnap.project = RNA_boolean_get(op->ptr, "use_snap_project_self");
+                       }
                }
        }
        /* use scene defaults only when transform is modal */
@@ -468,6 +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.peel = ((t->settings->snap_flag & SCE_SNAP_PROJECT) == SCE_SNAP_PROJECT);
        }
        
index c6fa07482c5936cd1369654cc439734b34d1016d..100a66d209fc9179bb459124b510330b2787289e 100644 (file)
@@ -1071,6 +1071,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
 /* toolsettings->snap_target */
 #define SCE_SNAP_TARGET_CLOSEST        0
 #define SCE_SNAP_TARGET_CENTER 1
index 145a58ecf0f231ca14d699bc8c3a11afcc7ef70d..f24c83efe05deb707bce7072936a2bbdcc508c6b 100644 (file)
@@ -1173,6 +1173,12 @@ static void rna_def_tool_settings(BlenderRNA  *brna)
        RNA_def_property_ui_text(prop, "Project Individual Elements", "Project individual elements on the surface of other objects");
        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)");
+       RNA_def_property_ui_icon(prop, ICON_ORTHO, 0);
+       RNA_def_property_update(prop, NC_SCENE|ND_TOOLSETTINGS, NULL); /* header redraw */
        
        /* Grease Pencil */
        prop = RNA_def_property(srna, "use_grease_pencil_sessions", PROP_BOOLEAN, PROP_NONE);