[Bf-blender-cvs] [b1c2f4d468c] blender2.8: Numeric Input: preference to default to advanced

Campbell Barton noreply at git.blender.org
Wed Jul 11 16:32:43 CEST 2018


Commit: b1c2f4d468c91a257fbc696700521509325aa6f4
Author: Campbell Barton
Date:   Wed Jul 11 16:31:28 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBb1c2f4d468c91a257fbc696700521509325aa6f4

Numeric Input: preference to default to advanced

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

M	release/scripts/startup/bl_ui/space_userpref.py
M	source/blender/editors/interface/resources.c
M	source/blender/editors/util/numinput.c
M	source/blender/makesdna/DNA_userdef_types.h
M	source/blender/makesrna/intern/rna_userdef.c

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

diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index ca96c79b2b4..939e958375a 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -434,6 +434,7 @@ class USERPREF_PT_edit(Panel):
 
         col.label(text="Transform:")
         col.prop(edit, "use_drag_immediately")
+        col.prop(edit, "use_numeric_input_advanced")
 
         row.separator()
         row.separator()
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index c279c949e62..a2b1aa1f251 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1562,7 +1562,7 @@ void init_userdef_do_versions(Main *bmain)
 	if (!USER_VERSION_ATLEAST(278, 6)) {
 		/* Clear preference flags for re-use. */
 		U.flag &= ~(
-		    USER_FLAG_DEPRECATED_1 | USER_FLAG_DEPRECATED_2 | USER_FLAG_DEPRECATED_3 |
+		    USER_FLAG_NUMINPUT_ADVANCED | USER_FLAG_DEPRECATED_2 | USER_FLAG_DEPRECATED_3 |
 		    USER_FLAG_DEPRECATED_6 | USER_FLAG_DEPRECATED_7 |
 		    USER_FLAG_DEPRECATED_9 | USER_DEVELOPER_UI);
 		U.uiflag &= ~(
diff --git a/source/blender/editors/util/numinput.c b/source/blender/editors/util/numinput.c
index 8bd5c9640a5..f64182d2ad6 100644
--- a/source/blender/editors/util/numinput.c
+++ b/source/blender/editors/util/numinput.c
@@ -276,17 +276,20 @@ bool handleNumInput(bContext *C, NumInput *n, const wmEvent *event)
 	short dir = STRCUR_DIR_NEXT, mode = STRCUR_JUMP_NONE;
 	int cur;
 
-#ifndef USE_FAKE_EDIT
-	if ((event->ctrl == 0) && (event->alt == 0) && (event->ascii != '\0') &&
-	    strchr("01234567890@%^&*-+/{}()[]<>.|", event->ascii))
+#ifdef USE_FAKE_EDIT
+	if (U.flag & USER_FLAG_NUMINPUT_ADVANCED)
+#endif
 	{
-		if (!(n->flag & NUM_EDIT_FULL)) {
-			n->flag |= NUM_EDITED;
-			n->flag |= NUM_EDIT_FULL;
-			n->val_flag[idx] |= NUM_EDITED;
+		if ((event->ctrl == 0) && (event->alt == 0) && (event->ascii != '\0') &&
+		    strchr("01234567890@%^&*-+/{}()[]<>.|", event->ascii))
+		{
+			if (!(n->flag & NUM_EDIT_FULL)) {
+				n->flag |= NUM_EDITED;
+				n->flag |= NUM_EDIT_FULL;
+				n->val_flag[idx] |= NUM_EDITED;
+			}
 		}
 	}
-#endif
 
 	switch (event->type) {
 		case EVT_MODAL_MAP:
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 45c6b9634f4..5b8f6fcb73f 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -673,7 +673,7 @@ typedef enum eUserPref_Section {
 /* UserDef.flag */
 typedef enum eUserPref_Flag {
 	USER_AUTOSAVE			= (1 << 0),
-	USER_FLAG_DEPRECATED_1	= (1 << 1),  /* cleared */
+	USER_FLAG_NUMINPUT_ADVANCED = (1 << 1),
 	USER_FLAG_DEPRECATED_2	= (1 << 2),  /* cleared */
 	USER_FLAG_DEPRECATED_3	= (1 << 3),  /* cleared */
 /*	USER_SCENEGLOBAL         = (1 << 4), deprecated */
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 517e4047515..3d116482656 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -3845,6 +3845,14 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Release confirms",
 	                         "Moving things with a mouse drag confirms when releasing the button");
 
+	prop = RNA_def_property(srna, "use_numeric_input_advanced", PROP_BOOLEAN, PROP_NONE);
+	RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_FLAG_NUMINPUT_ADVANCED);
+	RNA_def_property_ui_text(
+	        prop, "Default to Advanced Numeric Input",
+	        "When entering numbers while transforming, "
+	        "default to advanced mode for full math expression evaluation");
+
+
 	/* Undo */
 	prop = RNA_def_property(srna, "undo_steps", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "undosteps");



More information about the Bf-blender-cvs mailing list