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.
This commit is contained in:
Campbell Barton 2011-03-09 22:45:34 +00:00
parent ca63b15131
commit 1110c80696
6 changed files with 18 additions and 3 deletions

View 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)

View 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;

View 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 */

View 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);
}

View 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

View 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);