add option requested [#25598] projection surface snap issue
authorCampbell Barton <ideasman42@gmail.com>
Wed, 9 Mar 2011 22:45:34 +0000 (22:45 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 9 Mar 2011 22:45:34 +0000 (22:45 +0000)
for retopo workflow you don't wan't to project the mesh onto its self, added option not to.

release/scripts/ui/space_view3d.py
source/blender/blenkernel/intern/particle_system.c
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 751d54dd289b199b46fe263310912e392ba0748f..2dff6032cdbee0512dda775de002363084adcde8 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 15c6b30d4e53f4ef6c9ff4e1045c0ec18f34bbd6..81d97d4f8c5b6ebcb29992442caccd273de1f000 100644 (file)
@@ -1025,7 +1025,6 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
        ParticleData *pa=0, *tpars= 0;
        ParticleSettings *part;
        ParticleSeam *seams= 0;
-       ChildParticle *cpa=0;
        KDTree *tree=0;
        DerivedMesh *dm= NULL;
        float *jit= NULL;
index b0bd4ccc5eb359dd1f7faf2defbeb226ceba9c3f..8e891aecfd9928f90747b4ca611ae0739478cf61 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 44de86c1e3036046f76343b4e59db02d7332ff8e..01e9f03936826645322ec2540ef0c4b08e84190b 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 13e8e1fb862ff5016f73456974487c5a05f9c7aa..5c3cc648e3b490363de759defc38a33211178c90 100644 (file)
@@ -1073,6 +1073,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 ae79846029480ef8ee9274711778caee5ff231fa..bbcbbc7b7080d8038345ca4d167501b6d81af486 100644 (file)
@@ -1143,6 +1143,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);