Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/editors/transform/transform.c8
-rw-r--r--source/blender/editors/transform/transform_constraints.c4
-rw-r--r--source/blender/editors/transform/transform_generics.c9
-rw-r--r--source/blender/editors/transform/transform_ops.c6
-rw-r--r--source/blender/editors/transform/transform_orientations.c4
-rw-r--r--source/blender/makesdna/DNA_view3d_types.h1
6 files changed, 30 insertions, 2 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index a8e061ee612..29214565836 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -2218,7 +2218,13 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
orientation = V3D_MANIP_CUSTOM + orientation_index_custom;
BLI_assert(orientation >= V3D_MANIP_CUSTOM);
}
- RNA_enum_set(op->ptr, "constraint_orientation", orientation);
+
+ RNA_float_set_array(op->ptr, "constraint_matrix", &t->spacemtx[0][0]);
+
+ /* Use 'constraint_matrix' instead. */
+ if (orientation != V3D_MANIP_CUSTOM_MATRIX) {
+ RNA_enum_set(op->ptr, "constraint_orientation", orientation);
+ }
if (t->con.mode & CON_APPLY) {
if (t->con.mode & CON_AXIS0) {
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index b24ef4e0ba2..22d616572c1 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -701,6 +701,10 @@ void setUserConstraint(TransInfo *t, short orientation, int mode, const char fte
BLI_snprintf(text, sizeof(text), ftext, IFACE_("gimbal"));
setConstraint(t, t->spacemtx, mode, text);
break;
+ case V3D_MANIP_CUSTOM_MATRIX:
+ BLI_snprintf(text, sizeof(text), ftext, IFACE_("custom matrix"));
+ setConstraint(t, t->spacemtx, mode, text);
+ break;
case V3D_MANIP_CUSTOM:
{
char orientation_str[128];
diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c
index a9c77dc8773..61b18a16eba 100644
--- a/source/blender/editors/transform/transform_generics.c
+++ b/source/blender/editors/transform/transform_generics.c
@@ -1486,9 +1486,16 @@ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *eve
t->around = V3D_AROUND_CENTER_BOUNDS;
}
- if (op && ((prop = RNA_struct_find_property(op->ptr, "constraint_orientation")) &&
+ if (op && ((prop = RNA_struct_find_property(op->ptr, "constraint_matrix")) &&
RNA_property_is_set(op->ptr, prop)))
{
+ RNA_property_float_get_array(op->ptr, prop, &t->spacemtx[0][0]);
+ t->current_orientation = V3D_MANIP_CUSTOM_MATRIX;
+ t->custom_orientation = 0;
+ }
+ else if (op && ((prop = RNA_struct_find_property(op->ptr, "constraint_orientation")) &&
+ RNA_property_is_set(op->ptr, prop)))
+ {
short orientation = RNA_property_enum_get(op->ptr, prop);
TransformOrientation *custom_orientation = NULL;
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index 6979fe73cec..ee0b11ead11 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -563,9 +563,15 @@ void Transform_Properties(struct wmOperatorType *ot, int flags)
if (flags & P_CONSTRAINT) {
RNA_def_boolean_vector(ot->srna, "constraint_axis", 3, NULL, "Constraint Axis", "");
+
+ /* Set by 'constraint_orientation' or gizmo which acts on non-standard orientation. */
+ prop = RNA_def_float_matrix(ot->srna, "constraint_matrix", 3, 3, NULL, 0.0f, 0.0f, "Matrix", "", 0.0f, 0.0f);
+ RNA_def_property_flag(prop, PROP_HIDDEN | PROP_SKIP_SAVE);
+
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 (flags & P_MIRROR) {
diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c
index 9df1fef1a3c..447842e9bf0 100644
--- a/source/blender/editors/transform/transform_orientations.c
+++ b/source/blender/editors/transform/transform_orientations.c
@@ -487,6 +487,10 @@ void initTransformOrientation(bContext *C, TransInfo *t)
ED_view3d_cursor3d_calc_mat3(t->scene, CTX_wm_view3d(C), t->spacemtx);
break;
}
+ case V3D_MANIP_CUSTOM_MATRIX:
+ /* Already set. */
+ BLI_strncpy(t->spacename, IFACE_("custom"), sizeof(t->spacename));
+ break;
case V3D_MANIP_CUSTOM:
BLI_strncpy(t->spacename, t->custom_orientation->name, sizeof(t->spacename));
diff --git a/source/blender/makesdna/DNA_view3d_types.h b/source/blender/makesdna/DNA_view3d_types.h
index d5bacd1f4a4..6796c9d4d00 100644
--- a/source/blender/makesdna/DNA_view3d_types.h
+++ b/source/blender/makesdna/DNA_view3d_types.h
@@ -507,6 +507,7 @@ enum {
#define V3D_MANIP_VIEW 3
#define V3D_MANIP_GIMBAL 4
#define V3D_MANIP_CURSOR 5
+#define V3D_MANIP_CUSTOM_MATRIX (V3D_MANIP_CUSTOM - 1) /* Runtime only, never saved to DNA. */
#define V3D_MANIP_CUSTOM 1024
/* View3d.mpr_flag (also) */