From 1110c80696ab98f7522b36ce797aa409ccc312a3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 9 Mar 2011 22:45:34 +0000 Subject: [PATCH] add option requested [#25598] projection surface snap issue 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 | 2 ++ source/blender/blenkernel/intern/particle_system.c | 1 - source/blender/editors/transform/transform.h | 3 ++- source/blender/editors/transform/transform_snap.c | 8 +++++++- source/blender/makesdna/DNA_scene_types.h | 1 + source/blender/makesrna/intern/rna_scene.c | 6 ++++++ 6 files changed, 18 insertions(+), 3 deletions(-) diff --git a/release/scripts/ui/space_view3d.py b/release/scripts/ui/space_view3d.py index 751d54dd289..2dff6032cdb 100644 --- a/release/scripts/ui/space_view3d.py +++ b/release/scripts/ui/space_view3d.py @@ -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) diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index 15c6b30d4e5..81d97d4f8c5 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -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; diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index b0bd4ccc5eb..8e891aecfd9 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -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 */ diff --git a/source/blender/editors/transform/transform_snap.c b/source/blender/editors/transform/transform_snap.c index 44de86c1e30..01e9f039368 100644 --- a/source/blender/editors/transform/transform_snap.c +++ b/source/blender/editors/transform/transform_snap.c @@ -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); } diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 13e8e1fb862..5c3cc648e3b 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -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 diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index ae798460294..bbcbbc7b708 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -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);