Extrude along normals.
authorMartin Poirier <theeth@yahoo.com>
Thu, 16 Jul 2009 03:16:03 +0000 (03:16 +0000)
committerMartin Poirier <theeth@yahoo.com>
Thu, 16 Jul 2009 03:16:03 +0000 (03:16 +0000)
Note that this is on in all cases now, it needs to be restricted to face extrude only.

Some slight transform operator cleanup too.

source/blender/editors/include/ED_transform.h
source/blender/editors/mesh/editmesh_tools.c
source/blender/editors/transform/transform.c
source/blender/editors/transform/transform_generics.c
source/blender/editors/transform/transform_ops.c

index 5719aa6323461cb7230822ccf4cb9db265f8e54c..de1294c9b2bb1eed9d80388d21f1a8ad1739d101 100644 (file)
@@ -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);
index 6993efefe21cf660df442556eda11021e2a4d96c..2e869933db95711be8e80aa7cc80012d249df5bd 100644 (file)
@@ -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", "");
 }
 
index d45a6f422320713396ba8a937eaef1c258f7be7c..c62ea07e39886ffec82eb8315bc44f4615e1bf09 100644 (file)
@@ -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)
                {
index 560b37caf0adebb4d8f83c7eee153b8a3c4f0f99..d1394d65f9610680a11c05e03657c2f8f2d22003 100644 (file)
@@ -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)
                        {
index f2630f40c9cbcd792d2ebb4889106b34c8ed2f60..f817776dbd8fe99d42118794b2726ba7ff5d3b66 100644 (file)
@@ -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)