|
|
|
|
@@ -381,47 +381,67 @@ static int transform_invoke(bContext *C, wmOperator *op, wmEvent *event)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Properties_Proportional(struct wmOperatorType *ot)
|
|
|
|
|
{
|
|
|
|
|
RNA_def_enum(ot->srna, "proportional", proportional_editing_items, 0, "Proportional Editing", "");
|
|
|
|
|
RNA_def_enum(ot->srna, "proportional_editing_falloff", proportional_falloff_items, 0, "Proportional Editing Falloff", "Falloff type for proportional editing mode.");
|
|
|
|
|
RNA_def_float(ot->srna, "proportional_size", 1, 0, FLT_MAX, "Proportional Size", "", 0, 100);
|
|
|
|
|
}
|
|
|
|
|
#define P_MIRROR (1 << 0)
|
|
|
|
|
#define P_PROPORTIONAL (1 << 1)
|
|
|
|
|
#define P_AXIS (1 << 2)
|
|
|
|
|
#define P_SNAP (1 << 3)
|
|
|
|
|
#define P_GEO_SNAP (P_SNAP|(1 << 4))
|
|
|
|
|
#define P_ALIGN_SNAP (P_GEO_SNAP|(1 << 5))
|
|
|
|
|
#define P_CONSTRAINT (1 << 6)
|
|
|
|
|
|
|
|
|
|
void Properties_Axis(struct wmOperatorType *ot)
|
|
|
|
|
|
|
|
|
|
void Transform_Properties(struct wmOperatorType *ot, int flags)
|
|
|
|
|
{
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
prop= RNA_def_property(ot->srna, "axis", PROP_FLOAT, PROP_DIRECTION);
|
|
|
|
|
RNA_def_property_array(prop, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Axis", "The axis around which the transformation occurs");
|
|
|
|
|
}
|
|
|
|
|
// Add confirm method all the time
|
|
|
|
|
prop = RNA_def_boolean(ot->srna, "release_confirm", 0, "Confirm on Release", "Confirm operation when releasing button");
|
|
|
|
|
RNA_def_property_flag(prop, PROP_HIDDEN);
|
|
|
|
|
|
|
|
|
|
void Properties_Snapping(struct wmOperatorType *ot, short fullsnap, short align)
|
|
|
|
|
{
|
|
|
|
|
RNA_def_boolean(ot->srna, "snap", 0, "Use Snapping Options", "");
|
|
|
|
|
if (flags & P_AXIS)
|
|
|
|
|
{
|
|
|
|
|
prop= RNA_def_property(ot->srna, "axis", PROP_FLOAT, PROP_DIRECTION);
|
|
|
|
|
RNA_def_property_array(prop, 3);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Axis", "The axis around which the transformation occurs");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (fullsnap) {
|
|
|
|
|
RNA_def_enum(ot->srna, "snap_target", snap_target_items, 0, "Target", "");
|
|
|
|
|
RNA_def_float_vector(ot->srna, "snap_point", 3, NULL, -FLT_MAX, FLT_MAX, "Point", "", -FLT_MAX, FLT_MAX);
|
|
|
|
|
if (flags & P_CONSTRAINT)
|
|
|
|
|
{
|
|
|
|
|
RNA_def_boolean_vector(ot->srna, "constraint_axis", 3, NULL, "Constraint Axis", "");
|
|
|
|
|
prop= RNA_def_property(ot->srna, "constraint_orientation", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation");
|
|
|
|
|
RNA_def_enum_funcs(prop, rna_TransformOrientation_itemf);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (align) {
|
|
|
|
|
RNA_def_boolean(ot->srna, "snap_align", 0, "Align with Point Normal", "");
|
|
|
|
|
RNA_def_float_vector(ot->srna, "snap_normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal", "", -FLT_MAX, FLT_MAX);
|
|
|
|
|
if (flags & P_MIRROR)
|
|
|
|
|
{
|
|
|
|
|
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (flags & P_PROPORTIONAL)
|
|
|
|
|
{
|
|
|
|
|
RNA_def_enum(ot->srna, "proportional", proportional_editing_items, 0, "Proportional Editing", "");
|
|
|
|
|
RNA_def_enum(ot->srna, "proportional_editing_falloff", proportional_falloff_items, 0, "Proportional Editing Falloff", "Falloff type for proportional editing mode.");
|
|
|
|
|
RNA_def_float(ot->srna, "proportional_size", 1, 0, FLT_MAX, "Proportional Size", "", 0, 100);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (flags & P_SNAP)
|
|
|
|
|
{
|
|
|
|
|
RNA_def_boolean(ot->srna, "snap", 0, "Use Snapping Options", "");
|
|
|
|
|
|
|
|
|
|
if (flags & P_GEO_SNAP) {
|
|
|
|
|
RNA_def_enum(ot->srna, "snap_target", snap_target_items, 0, "Target", "");
|
|
|
|
|
RNA_def_float_vector(ot->srna, "snap_point", 3, NULL, -FLT_MAX, FLT_MAX, "Point", "", -FLT_MAX, FLT_MAX);
|
|
|
|
|
|
|
|
|
|
if (flags & P_ALIGN_SNAP) {
|
|
|
|
|
RNA_def_boolean(ot->srna, "snap_align", 0, "Align with Point Normal", "");
|
|
|
|
|
RNA_def_float_vector(ot->srna, "snap_normal", 3, NULL, -FLT_MAX, FLT_MAX, "Normal", "", -FLT_MAX, FLT_MAX);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Properties_Constraints(struct wmOperatorType *ot)
|
|
|
|
|
{
|
|
|
|
|
PropertyRNA *prop;
|
|
|
|
|
|
|
|
|
|
RNA_def_boolean_vector(ot->srna, "constraint_axis", 3, NULL, "Constraint Axis", "");
|
|
|
|
|
prop= RNA_def_property(ot->srna, "constraint_orientation", PROP_ENUM, PROP_NONE);
|
|
|
|
|
RNA_def_property_ui_text(prop, "Orientation", "Transformation orientation");
|
|
|
|
|
RNA_def_enum_funcs(prop, rna_TransformOrientation_itemf);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TRANSFORM_OT_translate(struct wmOperatorType *ot)
|
|
|
|
|
{
|
|
|
|
|
/* identifiers */
|
|
|
|
|
@@ -439,13 +459,7 @@ void TRANSFORM_OT_translate(struct wmOperatorType *ot)
|
|
|
|
|
|
|
|
|
|
RNA_def_float_vector(ot->srna, "value", 3, NULL, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
|
|
|
|
|
|
|
|
|
|
Properties_Proportional(ot);
|
|
|
|
|
|
|
|
|
|
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
|
|
|
|
|
|
|
|
|
|
Properties_Constraints(ot);
|
|
|
|
|
|
|
|
|
|
Properties_Snapping(ot, 1, 1);
|
|
|
|
|
Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_ALIGN_SNAP);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TRANSFORM_OT_resize(struct wmOperatorType *ot)
|
|
|
|
|
@@ -465,13 +479,7 @@ void TRANSFORM_OT_resize(struct wmOperatorType *ot)
|
|
|
|
|
|
|
|
|
|
RNA_def_float_vector(ot->srna, "value", 3, VecOne, -FLT_MAX, FLT_MAX, "Vector", "", -FLT_MAX, FLT_MAX);
|
|
|
|
|
|
|
|
|
|
Properties_Proportional(ot);
|
|
|
|
|
|
|
|
|
|
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
|
|
|
|
|
|
|
|
|
|
Properties_Constraints(ot);
|
|
|
|
|
|
|
|
|
|
Properties_Snapping(ot, 1, 0);
|
|
|
|
|
Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_GEO_SNAP);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -492,11 +500,7 @@ void TRANSFORM_OT_trackball(struct wmOperatorType *ot)
|
|
|
|
|
|
|
|
|
|
RNA_def_float_vector(ot->srna, "value", 2, VecOne, -FLT_MAX, FLT_MAX, "angle", "", -FLT_MAX, FLT_MAX);
|
|
|
|
|
|
|
|
|
|
Properties_Proportional(ot);
|
|
|
|
|
|
|
|
|
|
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
|
|
|
|
|
|
|
|
|
|
Properties_Snapping(ot, 0, 0);
|
|
|
|
|
Transform_Properties(ot, P_PROPORTIONAL|P_MIRROR|P_SNAP);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TRANSFORM_OT_rotate(struct wmOperatorType *ot)
|
|
|
|
|
@@ -516,15 +520,7 @@ void TRANSFORM_OT_rotate(struct wmOperatorType *ot)
|
|
|
|
|
|
|
|
|
|
RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI*2, M_PI*2);
|
|
|
|
|
|
|
|
|
|
Properties_Axis(ot);
|
|
|
|
|
|
|
|
|
|
Properties_Proportional(ot);
|
|
|
|
|
|
|
|
|
|
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
|
|
|
|
|
|
|
|
|
|
Properties_Constraints(ot);
|
|
|
|
|
|
|
|
|
|
Properties_Snapping(ot, 1, 0);
|
|
|
|
|
Transform_Properties(ot, P_AXIS|P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_GEO_SNAP);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TRANSFORM_OT_tilt(struct wmOperatorType *ot)
|
|
|
|
|
@@ -547,13 +543,7 @@ void TRANSFORM_OT_tilt(struct wmOperatorType *ot)
|
|
|
|
|
|
|
|
|
|
RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", -M_PI*2, M_PI*2);
|
|
|
|
|
|
|
|
|
|
Properties_Proportional(ot);
|
|
|
|
|
|
|
|
|
|
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
|
|
|
|
|
|
|
|
|
|
Properties_Constraints(ot);
|
|
|
|
|
|
|
|
|
|
Properties_Snapping(ot, 0, 0);
|
|
|
|
|
Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_SNAP);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TRANSFORM_OT_warp(struct wmOperatorType *ot)
|
|
|
|
|
@@ -573,14 +563,8 @@ void TRANSFORM_OT_warp(struct wmOperatorType *ot)
|
|
|
|
|
|
|
|
|
|
RNA_def_float_rotation(ot->srna, "value", 1, NULL, -FLT_MAX, FLT_MAX, "Angle", "", 0, 1);
|
|
|
|
|
|
|
|
|
|
Properties_Proportional(ot);
|
|
|
|
|
|
|
|
|
|
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
|
|
|
|
|
|
|
|
|
|
Properties_Snapping(ot, 0, 0);
|
|
|
|
|
|
|
|
|
|
Transform_Properties(ot, P_PROPORTIONAL|P_MIRROR|P_SNAP);
|
|
|
|
|
// XXX Warp axis?
|
|
|
|
|
// Properties_Constraints(ot);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TRANSFORM_OT_shear(struct wmOperatorType *ot)
|
|
|
|
|
@@ -600,14 +584,8 @@ void TRANSFORM_OT_shear(struct wmOperatorType *ot)
|
|
|
|
|
|
|
|
|
|
RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
|
|
|
|
|
|
|
|
|
|
Properties_Proportional(ot);
|
|
|
|
|
|
|
|
|
|
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
|
|
|
|
|
|
|
|
|
|
Properties_Snapping(ot, 0, 0);
|
|
|
|
|
|
|
|
|
|
Transform_Properties(ot, P_PROPORTIONAL|P_MIRROR|P_SNAP);
|
|
|
|
|
// XXX Shear axis?
|
|
|
|
|
// Properties_Constraints(ot);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TRANSFORM_OT_shrink_fatten(struct wmOperatorType *ot)
|
|
|
|
|
@@ -627,11 +605,7 @@ void TRANSFORM_OT_shrink_fatten(struct wmOperatorType *ot)
|
|
|
|
|
|
|
|
|
|
RNA_def_float(ot->srna, "value", 0, -FLT_MAX, FLT_MAX, "Offset", "", -FLT_MAX, FLT_MAX);
|
|
|
|
|
|
|
|
|
|
Properties_Proportional(ot);
|
|
|
|
|
|
|
|
|
|
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
|
|
|
|
|
|
|
|
|
|
Properties_Snapping(ot, 0, 0);
|
|
|
|
|
Transform_Properties(ot, P_PROPORTIONAL|P_MIRROR|P_SNAP);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TRANSFORM_OT_tosphere(struct wmOperatorType *ot)
|
|
|
|
|
@@ -652,11 +626,7 @@ void TRANSFORM_OT_tosphere(struct wmOperatorType *ot)
|
|
|
|
|
|
|
|
|
|
RNA_def_float_factor(ot->srna, "value", 0, 0, 1, "Factor", "", 0, 1);
|
|
|
|
|
|
|
|
|
|
Properties_Proportional(ot);
|
|
|
|
|
|
|
|
|
|
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
|
|
|
|
|
|
|
|
|
|
Properties_Snapping(ot, 0, 0);
|
|
|
|
|
Transform_Properties(ot, P_PROPORTIONAL|P_MIRROR|P_SNAP);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TRANSFORM_OT_mirror(struct wmOperatorType *ot)
|
|
|
|
|
@@ -674,8 +644,7 @@ void TRANSFORM_OT_mirror(struct wmOperatorType *ot)
|
|
|
|
|
ot->cancel = transform_cancel;
|
|
|
|
|
ot->poll = ED_operator_areaactive;
|
|
|
|
|
|
|
|
|
|
Properties_Proportional(ot);
|
|
|
|
|
Properties_Constraints(ot);
|
|
|
|
|
Transform_Properties(ot, P_CONSTRAINT|P_PROPORTIONAL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot)
|
|
|
|
|
@@ -695,9 +664,7 @@ void TRANSFORM_OT_edge_slide(struct wmOperatorType *ot)
|
|
|
|
|
|
|
|
|
|
RNA_def_float_factor(ot->srna, "value", 0, -1.0f, 1.0f, "Factor", "", -1.0f, 1.0f);
|
|
|
|
|
|
|
|
|
|
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
|
|
|
|
|
|
|
|
|
|
Properties_Snapping(ot, 0, 0);
|
|
|
|
|
Transform_Properties(ot, P_MIRROR|P_SNAP);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TRANSFORM_OT_edge_crease(struct wmOperatorType *ot)
|
|
|
|
|
@@ -717,7 +684,7 @@ void TRANSFORM_OT_edge_crease(struct wmOperatorType *ot)
|
|
|
|
|
|
|
|
|
|
RNA_def_float_factor(ot->srna, "value", 0, -1.0f, 1.0f, "Factor", "", -1.0f, 1.0f);
|
|
|
|
|
|
|
|
|
|
Properties_Snapping(ot, 0, 0);
|
|
|
|
|
Transform_Properties(ot, P_SNAP);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TRANSFORM_OT_seq_slide(struct wmOperatorType *ot)
|
|
|
|
|
@@ -737,7 +704,7 @@ void TRANSFORM_OT_seq_slide(struct wmOperatorType *ot)
|
|
|
|
|
|
|
|
|
|
RNA_def_float_vector(ot->srna, "value", 2, VecOne, -FLT_MAX, FLT_MAX, "angle", "", -FLT_MAX, FLT_MAX);
|
|
|
|
|
|
|
|
|
|
Properties_Snapping(ot, 0, 0);
|
|
|
|
|
Transform_Properties(ot, P_SNAP);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TRANSFORM_OT_transform(struct wmOperatorType *ot)
|
|
|
|
|
@@ -791,12 +758,7 @@ void TRANSFORM_OT_transform(struct wmOperatorType *ot)
|
|
|
|
|
|
|
|
|
|
RNA_def_float_vector(ot->srna, "value", 4, NULL, -FLT_MAX, FLT_MAX, "Values", "", -FLT_MAX, FLT_MAX);
|
|
|
|
|
|
|
|
|
|
Properties_Axis(ot);
|
|
|
|
|
|
|
|
|
|
Properties_Proportional(ot);
|
|
|
|
|
RNA_def_boolean(ot->srna, "mirror", 0, "Mirror Editing", "");
|
|
|
|
|
|
|
|
|
|
Properties_Constraints(ot);
|
|
|
|
|
Transform_Properties(ot, P_AXIS|P_CONSTRAINT|P_PROPORTIONAL|P_MIRROR|P_ALIGN_SNAP);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void transform_operatortypes(void)
|
|
|
|
|
@@ -912,6 +874,7 @@ void transform_keymap_for_space(wmKeyConfig *keyconf, wmKeyMap *keymap, int spac
|
|
|
|
|
|
|
|
|
|
km= WM_keymap_add_item(keymap, OP_TRANSLATION, EVT_TWEAK_A, KM_ANY, 0, 0);
|
|
|
|
|
km= WM_keymap_add_item(keymap, OP_TRANSLATION, EVT_TWEAK_S, KM_ANY, 0, 0);
|
|
|
|
|
RNA_enum_set(km->ptr, "release_confirm", 1);
|
|
|
|
|
|
|
|
|
|
km = WM_keymap_add_item(keymap, OP_ROTATION, RKEY, KM_PRESS, 0, 0);
|
|
|
|
|
|
|
|
|
|
|