Commit: a4f08297ed3c201c66a340e5261cac0aeb68b523
Author: Campbell Barton
Date:   Thu Jun 21 14:54:21 2018 +0200
Branches: master
https://developer.blender.org/rBa4f08297ed3c201c66a340e5261cac0aeb68b523

UI: preference for developer extras

Currently only used for "Edit Source" feature.

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

M       release/scripts/startup/bl_ui/space_userpref.py
M       release/scripts/startup/bl_ui/space_view3d.py
M       source/blender/editors/interface/interface_handlers.c
M       source/blender/editors/interface/resources.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 8db9d63c0aa..b7d425bbc6f 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -223,6 +223,7 @@ class USERPREF_PT_interface(Panel):
         col.prop(view, "ui_line_width", text="Line Width")
         col.prop(view, "show_tooltips")
         col.prop(view, "show_tooltips_python")
+        col.prop(view, "show_developer_ui")
         col.prop(view, "show_object_info", text="Object Info")
         col.prop(view, "show_large_cursors")
         col.prop(view, "show_view_name", text="View Name")
diff --git a/release/scripts/startup/bl_ui/space_view3d.py 
b/release/scripts/startup/bl_ui/space_view3d.py
index 7d582f8536f..c8f113f558d 100644
--- a/release/scripts/startup/bl_ui/space_view3d.py
+++ b/release/scripts/startup/bl_ui/space_view3d.py
@@ -3728,7 +3728,7 @@ class VIEW3D_PT_view3d_meshdisplay(Panel):
         col.label(text="Face Info:")
         col.prop(mesh, "show_extra_face_area", text="Area")
         col.prop(mesh, "show_extra_face_angle", text="Angle")
-        if bpy.app.debug:
+        if context.user_preferences.view.show_developer_ui:
             layout.prop(mesh, "show_extra_indices")
 
 
diff --git a/source/blender/editors/interface/interface_handlers.c 
b/source/blender/editors/interface/interface_handlers.c
index 48d9e186863..49617786236 100644
--- a/source/blender/editors/interface/interface_handlers.c
+++ b/source/blender/editors/interface/interface_handlers.c
@@ -7138,8 +7138,10 @@ static bool ui_but_menu(bContext *C, uiBut *but)
        }
 
        /* perhaps we should move this into (G.debug & G_DEBUG) - campbell */
-       if (ui_block_is_menu(but->block) == false) {
-               uiItemFullO(layout, "UI_OT_editsource", NULL, ICON_NONE, NULL, 
WM_OP_INVOKE_DEFAULT, 0, NULL);
+       if (U.flag & USER_DEVELOPER_UI) {
+               if (ui_block_is_menu(but->block) == false) {
+                       uiItemFullO(layout, "UI_OT_editsource", NULL, 
ICON_NONE, NULL, WM_OP_INVOKE_DEFAULT, 0, NULL);
+               }
        }
 
        if (BKE_addon_find(&U.addons, "ui_translate")) {
diff --git a/source/blender/editors/interface/resources.c 
b/source/blender/editors/interface/resources.c
index 4864133c905..f9ca2095390 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -2758,7 +2758,7 @@ void init_userdef_do_versions(Main *bmain)
                U.flag &= ~(
                    USER_FLAG_DEPRECATED_1 | USER_FLAG_DEPRECATED_2 | 
USER_FLAG_DEPRECATED_3 |
                    USER_FLAG_DEPRECATED_6 | USER_FLAG_DEPRECATED_7 |
-                   USER_FLAG_DEPRECATED_9 | USER_FLAG_DEPRECATED_10);
+                   USER_FLAG_DEPRECATED_9 | USER_DEVELOPER_UI);
                U.uiflag &= ~(
                    USER_UIFLAG_DEPRECATED_7);
                U.transopts &= ~(
diff --git a/source/blender/makesdna/DNA_userdef_types.h 
b/source/blender/makesdna/DNA_userdef_types.h
index 0a9f715f86b..314ca1dfaa9 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -613,7 +613,7 @@ typedef enum eUserPref_Flag {
        USER_FLAG_DEPRECATED_7  = (1 << 7),  /* cleared */
        USER_MAT_ON_OB                  = (1 << 8),
        USER_FLAG_DEPRECATED_9  = (1 << 9),   /* cleared */
-       USER_FLAG_DEPRECATED_10 = (1 << 10),  /* cleared */
+       USER_DEVELOPER_UI               = (1 << 10),
        USER_TOOLTIPS                   = (1 << 11),
        USER_TWOBUTTONMOUSE             = (1 << 12),
        USER_NONUMPAD                   = (1 << 13),
diff --git a/source/blender/makesrna/intern/rna_userdef.c 
b/source/blender/makesrna/intern/rna_userdef.c
index 15ebbd02018..c5a74122b3b 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -3374,6 +3374,12 @@ static void rna_def_userdef_view(BlenderRNA *brna)
        RNA_def_property_boolean_negative_sdna(prop, NULL, "flag", 
USER_TOOLTIPS_PYTHON);
        RNA_def_property_ui_text(prop, "Python Tooltips", "Show Python 
references in tooltips");
 
+       prop = RNA_def_property(srna, "show_developer_ui", PROP_BOOLEAN, 
PROP_NONE);
+       RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_DEVELOPER_UI);
+       RNA_def_property_ui_text(
+               prop, "Developer Extras",
+               "Show options for developers (edit source in context menu, 
geometry indices)");
+
        prop = RNA_def_property(srna, "show_object_info", PROP_BOOLEAN, 
PROP_NONE);
        RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_DRAWVIEWINFO);
        RNA_def_property_ui_text(prop, "Display Object Info", "Display objects 
name and frame number in 3D view");

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to