Extrude along normals.

Note that this is on in all cases now, it needs to be restricted to face extrude only.

Some slight transform operator cleanup too.
This commit is contained in:
Martin Poirier 2009-07-16 03:16:03 +00:00
parent 2b99cdd5ca
commit 111be5ea2a
5 changed files with 23 additions and 11 deletions

@ -40,6 +40,7 @@ struct bContext;
struct Object;
struct uiLayout;
struct EnumPropertyItem;
struct wmOperatorType;
void transform_keymap_for_space(struct wmWindowManager *wm, struct ListBase *keymap, int spaceid);
void transform_operatortypes(void);

@ -702,6 +702,7 @@ static int mesh_extrude_invoke(bContext *C, wmOperator *op, wmEvent *event)
Scene *scene= CTX_data_scene(C);
Object *obedit= CTX_data_edit_object(C);
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
int constraint_axis[3] = {0, 0, 1};
extrude_mesh(obedit,em, op);
@ -712,6 +713,12 @@ static int mesh_extrude_invoke(bContext *C, wmOperator *op, wmEvent *event)
RNA_enum_set(op->ptr, "proportional", 0);
RNA_boolean_set(op->ptr, "mirror", 0);
/* the following two should only be set when extruding faces */
RNA_enum_set(op->ptr, "constraint_orientation", V3D_MANIP_NORMAL);
RNA_boolean_set_array(op->ptr, "constraint_axis", constraint_axis);
WM_operator_name_call(C, "TFM_OT_translation", WM_OP_INVOKE_REGION_WIN, op->ptr);
return OPERATOR_FINISHED;
@ -750,6 +757,7 @@ void MESH_OT_extrude(wmOperatorType *ot)
/* to give to transform */
Properties_Proportional(ot);
Properties_Constraints(ot);
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
}

@ -1170,7 +1170,7 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
if (RNA_struct_find_property(op->ptr, "constraint_axis"))
{
RNA_int_set(op->ptr, "constraint_orientation", t->current_orientation);
RNA_enum_set(op->ptr, "constraint_orientation", t->current_orientation);
if (t->con.mode & CON_APPLY)
{

@ -886,7 +886,7 @@ int initTransInfo (bContext *C, TransInfo *t, wmOperator *op, wmEvent *event)
if (op && RNA_struct_find_property(op->ptr, "constraint_axis") && RNA_property_is_set(op->ptr, "constraint_orientation"))
{
t->current_orientation = RNA_int_get(op->ptr, "constraint_orientation");
t->current_orientation = RNA_enum_get(op->ptr, "constraint_orientation");
if (t->current_orientation >= V3D_MANIP_CUSTOM + BIF_countTransformOrientation(C) - 1)
{

@ -81,6 +81,13 @@ EnumPropertyItem proportional_falloff_types[] = {
{0, NULL, 0, NULL, NULL}
};
EnumPropertyItem orientation_items[]= {
{V3D_MANIP_GLOBAL, "GLOBAL", 0, "Global", ""},
{V3D_MANIP_NORMAL, "NORMAL", 0, "Normal", ""},
{V3D_MANIP_LOCAL, "LOCAL", 0, "Local", ""},
{V3D_MANIP_VIEW, "VIEW", 0, "View", ""},
{0, NULL, 0, NULL, NULL}};
char OP_TRANSLATION[] = "TFM_OT_translation";
char OP_ROTATION[] = "TFM_OT_rotation";
char OP_TOSPHERE[] = "TFM_OT_tosphere";
@ -137,12 +144,6 @@ static EnumPropertyItem *select_orientation_itemf(bContext *C, PointerRNA *ptr,
void TFM_OT_select_orientation(struct wmOperatorType *ot)
{
PropertyRNA *prop;
static EnumPropertyItem orientation_items[]= {
{V3D_MANIP_GLOBAL, "GLOBAL", 0, "Global", ""},
{V3D_MANIP_NORMAL, "NORMAL", 0, "Normal", ""},
{V3D_MANIP_LOCAL, "LOCAL", 0, "Local", ""},
{V3D_MANIP_VIEW, "VIEW", 0, "View", ""},
{0, NULL, 0, NULL, NULL}};
/* identifiers */
ot->name = "Select Orientation";
@ -293,8 +294,11 @@ void Properties_Snapping(struct wmOperatorType *ot, short align)
void Properties_Constraints(struct wmOperatorType *ot)
{
PropertyRNA *prop;
RNA_def_boolean_vector(ot->srna, "constraint_axis", 3, NULL, "Constraint Axis", "");
RNA_def_int(ot->srna, "constraint_orientation", 0, 0, INT_MAX, "Constraint Orientation", "", 0, INT_MAX);
prop= RNA_def_enum(ot->srna, "constraint_orientation", orientation_items, V3D_MANIP_GLOBAL, "Orientation", "DOC_BROKEN");
RNA_def_enum_funcs(prop, select_orientation_itemf);
}
void TFM_OT_translation(struct wmOperatorType *ot)
@ -558,8 +562,7 @@ void TFM_OT_transform(struct wmOperatorType *ot)
Properties_Proportional(ot);
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
RNA_def_boolean_vector(ot->srna, "constraint_axis", 3, NULL, "Constraint Axis", "");
RNA_def_int(ot->srna, "constraint_orientation", 0, 0, INT_MAX, "Constraint Orientation", "", 0, INT_MAX);
Properties_Constraints(ot);
}
void transform_operatortypes(void)