[Bf-blender-cvs] [44370a307cc] master: UI: hide transform constraints when not used

Campbell Barton noreply at git.blender.org
Thu Jul 26 07:49:19 CEST 2018


Commit: 44370a307cc77435880793a6420be143004b34f7
Author: Campbell Barton
Date:   Thu Jul 26 15:44:27 2018 +1000
Branches: master
https://developer.blender.org/rB44370a307cc77435880793a6420be143004b34f7

UI: hide transform constraints when not used

===================================================================

M	source/blender/editors/transform/transform.c
M	source/blender/editors/transform/transform_ops.c

===================================================================

diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c
index d9e36d0963a..79d06de8b41 100644
--- a/source/blender/editors/transform/transform.c
+++ b/source/blender/editors/transform/transform.c
@@ -1999,7 +1999,11 @@ void saveTransform(bContext *C, TransInfo *t, wmOperator *op)
 			}
 		}
 
-		RNA_property_boolean_set_array(op->ptr, prop, constraint_axis);
+		/* Only set if needed, so we can hide in the UI when nothing is set.
+		 * See 'transform_poll_property'. */
+		if (ELEM(true, UNPACK3(constraint_axis))) {
+			RNA_property_boolean_set_array(op->ptr, prop, constraint_axis);
+		}
 	}
 
 	{
diff --git a/source/blender/editors/transform/transform_ops.c b/source/blender/editors/transform/transform_ops.c
index f8e23c9744d..df118d7a272 100644
--- a/source/blender/editors/transform/transform_ops.c
+++ b/source/blender/editors/transform/transform_ops.c
@@ -499,6 +499,17 @@ static bool transform_poll_property(const bContext *UNUSED(C), wmOperator *op, c
 {
 	const char *prop_id = RNA_property_identifier(prop);
 
+	/* Orientation/Constraints. */
+	{
+		/* Hide orientation axis if no constraints are set, since it wont be used. */
+		PropertyRNA *prop_con = RNA_struct_find_property(op->ptr, "constraint_axis");
+		if (prop_con && !RNA_property_is_set(op->ptr, prop_con)) {
+			if (STRPREFIX(prop_id, "constraint")) {
+				return false;
+			}
+		}
+	}
+
 	/* Proportional Editing. */
 	{
 		PropertyRNA *prop_pet = RNA_struct_find_property(op->ptr, "proportional");



More information about the Bf-blender-cvs mailing list