[Bf-blender-cvs] [b4924b2ddb] app-templates: Hide templates from the UI when none are found
Campbell Barton
noreply at git.blender.org
Thu Mar 23 01:35:54 CET 2017
Commit: b4924b2ddba5cd22f61547b9b19433f29e10fc23
Author: Campbell Barton
Date: Thu Mar 23 11:31:18 2017 +1100
Branches: app-templates
https://developer.blender.org/rBb4924b2ddba5cd22f61547b9b19433f29e10fc23
Hide templates from the UI when none are found
===================================================================
M release/scripts/startup/bl_ui/space_info.py
M release/scripts/startup/bl_ui/space_userpref.py
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_info.py b/release/scripts/startup/bl_ui/space_info.py
index 489fb27f14..d44dfe2851 100644
--- a/release/scripts/startup/bl_ui/space_info.py
+++ b/release/scripts/startup/bl_ui/space_info.py
@@ -127,16 +127,17 @@ class INFO_MT_file(Menu):
layout.operator("wm.save_homefile", icon='SAVE_PREFS')
layout.operator("wm.read_factory_settings", icon='LOAD_FACTORY')
- app_template = context.user_preferences.app_template
- if app_template:
- layout.operator(
- "wm.read_factory_settings",
- text="Load Template Settings",
- icon='LOAD_FACTORY',
- ).app_template = app_template
- del app_template
-
- layout.menu("USERPREF_MT_app_templates", icon='FILE_BLEND')
+ if any(bpy.utils.app_template_paths()):
+ app_template = context.user_preferences.app_template
+ if app_template:
+ layout.operator(
+ "wm.read_factory_settings",
+ text="Load Template Settings",
+ icon='LOAD_FACTORY',
+ ).app_template = app_template
+ del app_template
+
+ layout.menu("USERPREF_MT_app_templates", icon='FILE_BLEND')
layout.separator()
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 86ff255dab..5f18403ef4 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -159,12 +159,17 @@ class USERPREF_MT_splash(Menu):
split = layout.split()
row = split.row()
- row.label("Template:")
- template = context.user_preferences.app_template
- row.menu(
- "USERPREF_MT_templates_splash",
- text=bpy.path.display_name(template) if template else "Default",
- )
+
+ if any(bpy.utils.app_template_paths()):
+ row.label("Template:")
+ template = context.user_preferences.app_template
+ row.menu(
+ "USERPREF_MT_templates_splash",
+ text=bpy.path.display_name(template) if template else "Default",
+ )
+ else:
+ row.label("")
+
row = split.row()
row.label("Interaction:")
More information about the Bf-blender-cvs
mailing list