UI: add extensions section (shown when extension repos are enabled)
This is a place-holder by default, the work-in-progress extensions add-on makes use of this.
This commit is contained in:
@@ -1994,6 +1994,36 @@ class USERPREF_PT_keymap(KeymapPanel, Panel):
|
||||
# print("runtime", time.time() - start)
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Extension Panels
|
||||
|
||||
class ExtensionsPanel:
|
||||
bl_space_type = 'PREFERENCES'
|
||||
bl_region_type = 'WINDOW'
|
||||
bl_context = "extensions"
|
||||
|
||||
|
||||
class USERPREF_PT_extensions(ExtensionsPanel, Panel):
|
||||
bl_label = "Extensions"
|
||||
bl_options = {'HIDE_HEADER'}
|
||||
|
||||
# NOTE: currently disabled by an add-on when used.
|
||||
unused = True
|
||||
|
||||
@classmethod
|
||||
def poll(cls, _context):
|
||||
return cls.unused
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
row = layout.row()
|
||||
row.label(text="The add-on to use extensions is disabled! See:")
|
||||
row.operator(
|
||||
"wm.url_open", text="Extension Add-on Repo", icon='URL',
|
||||
).url = "https://projects.blender.org/ideasman42/bl_ext"
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
# Add-On Panels
|
||||
|
||||
@@ -2272,6 +2302,7 @@ class USERPREF_PT_addons(AddOnPanel, Panel):
|
||||
# -----------------------------------------------------------------------------
|
||||
# Studio Light Panels
|
||||
|
||||
|
||||
class StudioLightPanel:
|
||||
bl_space_type = 'PREFERENCES'
|
||||
bl_region_type = 'WINDOW'
|
||||
@@ -2633,6 +2664,8 @@ classes = (
|
||||
USERPREF_PT_navigation_fly_walk_gravity,
|
||||
|
||||
USERPREF_PT_keymap,
|
||||
|
||||
USERPREF_PT_extensions,
|
||||
USERPREF_PT_addons,
|
||||
|
||||
USERPREF_PT_studiolight_lights,
|
||||
|
||||
@@ -1070,6 +1070,7 @@ typedef enum eUserPref_Section {
|
||||
USER_SECTION_NAVIGATION = 14,
|
||||
USER_SECTION_FILE_PATHS = 15,
|
||||
USER_SECTION_EXPERIMENTAL = 16,
|
||||
USER_SECTION_EXTENSIONS = 17,
|
||||
} eUserPref_Section;
|
||||
|
||||
/** #UserDef_SpaceData.flag (State of the user preferences UI). */
|
||||
|
||||
@@ -56,6 +56,7 @@ const EnumPropertyItem rna_enum_preference_section_items[] = {
|
||||
{USER_SECTION_EDITING, "EDITING", 0, "Editing", ""},
|
||||
{USER_SECTION_ANIMATION, "ANIMATION", 0, "Animation", ""},
|
||||
RNA_ENUM_ITEM_SEPR,
|
||||
{USER_SECTION_EXTENSIONS, "EXTENSIONS", 0, "Extensions", ""},
|
||||
{USER_SECTION_ADDONS, "ADDONS", 0, "Add-ons", ""},
|
||||
#if 0 /* def WITH_USERDEF_WORKSPACES */
|
||||
RNA_ENUM_ITEM_SEPR,
|
||||
@@ -302,6 +303,9 @@ static void rna_PreferencesExperimental_use_extension_repos_set(PointerRNA * /*p
|
||||
U.experimental.use_extension_repos = value;
|
||||
BKE_callback_exec_null(bmain, BKE_CB_EVT_EXTENSION_REPOS_UPDATE_POST);
|
||||
}
|
||||
|
||||
/* Needed to redraw the preferences window. */
|
||||
WM_main_add_notifier(NC_WINDOW, nullptr);
|
||||
}
|
||||
|
||||
static void rna_userdef_font_update(Main * /*bmain*/, Scene * /*scene*/, PointerRNA * /*ptr*/)
|
||||
@@ -601,7 +605,10 @@ static const EnumPropertyItem *rna_UseDef_active_section_itemf(bContext * /*C*/,
|
||||
{
|
||||
UserDef *userdef = static_cast<UserDef *>(ptr->data);
|
||||
|
||||
if ((userdef->flag & USER_DEVELOPER_UI) != 0) {
|
||||
const bool use_developer_ui = (userdef->flag & USER_DEVELOPER_UI) != 0;
|
||||
const bool use_extension_repos = use_developer_ui && U.experimental.use_extension_repos;
|
||||
|
||||
if (use_developer_ui && use_extension_repos) {
|
||||
*r_free = false;
|
||||
return rna_enum_preference_section_items;
|
||||
}
|
||||
@@ -613,7 +620,14 @@ static const EnumPropertyItem *rna_UseDef_active_section_itemf(bContext * /*C*/,
|
||||
it++)
|
||||
{
|
||||
if (it->value == USER_SECTION_EXPERIMENTAL) {
|
||||
continue;
|
||||
if (use_developer_ui == false) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else if (it->value == USER_SECTION_EXTENSIONS) {
|
||||
if (use_extension_repos == false) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
RNA_enum_item_add(&items, &totitem, it);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user