User Preference Experimental Tab
Experimental tab in User Preferences for experimental features. The tab option is only visible when "Developer Extras" is on. Included here is a (commented out) example panel to be used as a template for the new experimental panels. Since these panels will come and go it is nice to have a reference in the code. Differential Revision: https://developer.blender.org/D6203
This commit is contained in:
parent
3ecb1056c9
commit
a7fcd78d2d
|
@ -2132,6 +2132,66 @@ class USERPREF_PT_studiolight_light_editor(Panel):
|
|||
layout.prop(system, "light_ambient")
|
||||
|
||||
|
||||
class ExperimentalPanel:
|
||||
bl_space_type = 'PREFERENCES'
|
||||
bl_region_type = 'WINDOW'
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
prefs = context.preferences
|
||||
return (prefs.active_section == 'EXPERIMENTAL')
|
||||
|
||||
def draw(self, context):
|
||||
layout = self.layout
|
||||
|
||||
layout.use_property_split = True
|
||||
layout.use_property_decorate = False
|
||||
|
||||
self.draw_props(context, layout)
|
||||
|
||||
|
||||
class USERPREF_PT_experimental_all(ExperimentalPanel, Panel):
|
||||
bl_label = "All"
|
||||
bl_options = {'HIDE_HEADER'}
|
||||
|
||||
def draw_props(self, context, layout):
|
||||
prefs = context.preferences
|
||||
experimental = prefs.experimental
|
||||
|
||||
col = layout.column()
|
||||
col.prop(experimental, "use_experimental_all")
|
||||
|
||||
# For the other settings create new panels
|
||||
# and make sure they are disabled if use_experimental_all is True
|
||||
|
||||
|
||||
"""
|
||||
Example panel, leave it here so we always have a template to follow even
|
||||
after the features are gone from the experimental panel.
|
||||
|
||||
class USERPREF_PT_experimental_virtual_reality(ExperimentalPanel, Panel):
|
||||
bl_label = "Virtual Reality"
|
||||
|
||||
def draw_props(self, context, _layout):
|
||||
prefs = context.preferences
|
||||
experimental = prefs.experimental
|
||||
_layout.active = not experimental.use_experimental_all
|
||||
|
||||
row = _layout.row()
|
||||
split = row.split().column()
|
||||
split.prop(experimental, "use_virtual_reality_scene_inspection, text="Scene Inspection")
|
||||
split.prop(experimental, "use_virtual_reality_immersive_drawing", text="Continuous Immersive Drawing")
|
||||
|
||||
split = row.split().column()
|
||||
split.operator(
|
||||
"wm.url_open", text="https://developer.blender.org/T71347", icon='URL',
|
||||
).url = "https://developer.blender.org/T71347"
|
||||
split.operator(
|
||||
"wm.url_open", text="https://developer.blender.org/T71348", icon='URL',
|
||||
).url = "https://developer.blender.org/T71348"
|
||||
"""
|
||||
|
||||
|
||||
# Order of registration defines order in UI,
|
||||
# so dynamically generated classes are 'injected' in the intended order.
|
||||
classes = (
|
||||
|
@ -2214,6 +2274,8 @@ classes = (
|
|||
USERPREF_PT_studiolight_matcaps,
|
||||
USERPREF_PT_studiolight_world,
|
||||
|
||||
USERPREF_PT_experimental_all,
|
||||
|
||||
# Add dynamically generated editor theme panels last,
|
||||
# so they show up last in the theme section.
|
||||
*ThemeGenericClassGenerator.generate_panel_classes_from_theme_areas(),
|
||||
|
|
|
@ -595,6 +595,16 @@ typedef struct UserDef_FileSpaceData {
|
|||
int temp_win_sizey;
|
||||
} UserDef_FileSpaceData;
|
||||
|
||||
/**
|
||||
* Store UI data here instead of the space
|
||||
* since the space is typically a window which is freed.
|
||||
*/
|
||||
typedef struct UserDef_Experimental {
|
||||
/** #eUserPref_Experimental_Flag options. */
|
||||
int flag;
|
||||
char _pad0[4];
|
||||
} UserDef_Experimental;
|
||||
|
||||
typedef struct UserDef {
|
||||
/** UserDef has separate do-version handling, and can be read from other files. */
|
||||
int versionfile, subversionfile;
|
||||
|
@ -846,6 +856,8 @@ typedef struct UserDef {
|
|||
UserDef_SpaceData space_data;
|
||||
UserDef_FileSpaceData file_space_data;
|
||||
|
||||
UserDef_Experimental experimental;
|
||||
|
||||
/** Runtime data (keep last). */
|
||||
UserDef_Runtime runtime;
|
||||
} UserDef;
|
||||
|
@ -878,6 +890,7 @@ typedef enum eUserPref_Section {
|
|||
USER_SECTION_ANIMATION = 13,
|
||||
USER_SECTION_NAVIGATION = 14,
|
||||
USER_SECTION_FILE_PATHS = 15,
|
||||
USER_SECTION_EXPERIMENTAL = 16,
|
||||
} eUserPref_Section;
|
||||
|
||||
/** #UserDef_SpaceData.flag (State of the user preferences UI). */
|
||||
|
@ -887,6 +900,11 @@ typedef enum eUserPref_SpaceData_Flag {
|
|||
USER_SPACEDATA_ADDONS_SHOW_ONLY_ENABLED = (1 << 1),
|
||||
} eUserPref_SpaceData_Flag;
|
||||
|
||||
/** #UserDef_Experimental.flag. */
|
||||
typedef enum eUserPref_Experimental_Flag {
|
||||
USER_EXPERIMENTAL_ALL = (1 << 0),
|
||||
} eUserPref_Experimental_Flag;
|
||||
|
||||
/** #UserDef.flag */
|
||||
typedef enum eUserPref_Flag {
|
||||
USER_AUTOSAVE = (1 << 0),
|
||||
|
|
|
@ -69,6 +69,32 @@ static const EnumPropertyItem opensubdiv_compute_type_items[] = {
|
|||
};
|
||||
#endif
|
||||
|
||||
static const EnumPropertyItem preference_section_items[] = {
|
||||
{USER_SECTION_INTERFACE, "INTERFACE", 0, "Interface", ""},
|
||||
{USER_SECTION_THEME, "THEMES", 0, "Themes", ""},
|
||||
{USER_SECTION_VIEWPORT, "VIEWPORT", 0, "Viewport", ""},
|
||||
{USER_SECTION_LIGHT, "LIGHTS", 0, "Lights", ""},
|
||||
{USER_SECTION_EDITING, "EDITING", 0, "Editing", ""},
|
||||
{USER_SECTION_ANIMATION, "ANIMATION", 0, "Animation", ""},
|
||||
{0, "", 0, NULL, NULL},
|
||||
{USER_SECTION_ADDONS, "ADDONS", 0, "Add-ons", ""},
|
||||
#if 0 // def WITH_USERDEF_WORKSPACES
|
||||
{0, "", 0, NULL, NULL},
|
||||
{USER_SECTION_WORKSPACE_CONFIG, "WORKSPACE_CONFIG", 0, "Configuration File", ""},
|
||||
{USER_SECTION_WORKSPACE_ADDONS, "WORKSPACE_ADDONS", 0, "Add-on Overrides", ""},
|
||||
{USER_SECTION_WORKSPACE_KEYMAPS, "WORKSPACE_KEYMAPS", 0, "Keymap Overrides", ""},
|
||||
#endif
|
||||
{0, "", 0, NULL, NULL},
|
||||
{USER_SECTION_INPUT, "INPUT", 0, "Input", ""},
|
||||
{USER_SECTION_NAVIGATION, "NAVIGATION", 0, "Navigation", ""},
|
||||
{USER_SECTION_KEYMAP, "KEYMAP", 0, "Keymap", ""},
|
||||
{0, "", 0, NULL, NULL},
|
||||
{USER_SECTION_SYSTEM, "SYSTEM", 0, "System", ""},
|
||||
{USER_SECTION_SAVE_LOAD, "SAVE_LOAD", 0, "Save & Load", ""},
|
||||
{USER_SECTION_FILE_PATHS, "FILE_PATHS", 0, "File Paths", ""},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
};
|
||||
|
||||
static const EnumPropertyItem audio_device_items[] = {
|
||||
{0, "Null", 0, "None", "Null device - there will be no audio output"},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
|
@ -435,6 +461,39 @@ static int rna_UserDef_mouse_emulate_3_button_modifier_get(PointerRNA *ptr)
|
|||
# endif
|
||||
}
|
||||
|
||||
static const EnumPropertyItem *rna_UseDef_active_section_itemf(bContext *UNUSED(C),
|
||||
PointerRNA *ptr,
|
||||
PropertyRNA *UNUSED(prop),
|
||||
bool *r_free)
|
||||
{
|
||||
UserDef *userdef = ptr->data;
|
||||
|
||||
if ((userdef->flag & USER_DEVELOPER_UI) == 0) {
|
||||
*r_free = false;
|
||||
return preference_section_items;
|
||||
}
|
||||
|
||||
EnumPropertyItem *items = NULL;
|
||||
int totitem = 0;
|
||||
|
||||
RNA_enum_items_add(&items, &totitem, preference_section_items);
|
||||
RNA_enum_item_add_separator(&items, &totitem);
|
||||
|
||||
EnumPropertyItem item = {
|
||||
.value = USER_SECTION_EXPERIMENTAL,
|
||||
.name = "Experimental",
|
||||
.identifier = "EXPERIMENTAL",
|
||||
.icon = 0,
|
||||
.description = "",
|
||||
};
|
||||
|
||||
RNA_enum_item_add(&items, &totitem, &item);
|
||||
RNA_enum_item_end(&items, &totitem);
|
||||
|
||||
*r_free = true;
|
||||
return items;
|
||||
}
|
||||
|
||||
static PointerRNA rna_UserDef_view_get(PointerRNA *ptr)
|
||||
{
|
||||
return rna_pointer_inherit_refine(ptr, &RNA_PreferencesView, ptr->data);
|
||||
|
@ -4162,6 +4221,7 @@ static void rna_def_userdef_view(BlenderRNA *brna)
|
|||
prop,
|
||||
"Developer Extras",
|
||||
"Show options for developers (edit source in context menu, geometry indices)");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
|
||||
prop = RNA_def_property(srna, "show_object_info", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "uiflag", USER_DRAWVIEWINFO);
|
||||
|
@ -5756,6 +5816,25 @@ static void rna_def_userdef_filepaths(BlenderRNA *brna)
|
|||
"Enables automatic saving of preview images in the .blend file");
|
||||
}
|
||||
|
||||
static void rna_def_userdef_experimental(BlenderRNA *brna)
|
||||
{
|
||||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
srna = RNA_def_struct(brna, "PreferencesExperimental", NULL);
|
||||
RNA_def_struct_sdna(srna, "UserDef_Experimental");
|
||||
RNA_def_struct_nested(brna, srna, "Preferences");
|
||||
RNA_def_struct_clear_flag(srna, STRUCT_UNDO);
|
||||
RNA_def_struct_ui_text(srna, "Experimental", "Experimental features");
|
||||
|
||||
prop = RNA_def_property(srna, "use_experimental_all", PROP_BOOLEAN, PROP_NONE);
|
||||
RNA_def_property_boolean_sdna(prop, NULL, "flag", USER_EXPERIMENTAL_ALL);
|
||||
RNA_def_property_ui_text(prop,
|
||||
"All Experimental Features",
|
||||
"Expose all the experimental features in the user interface");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_update");
|
||||
}
|
||||
|
||||
static void rna_def_userdef_addon_collection(BlenderRNA *brna, PropertyRNA *cprop)
|
||||
{
|
||||
StructRNA *srna;
|
||||
|
@ -5815,32 +5894,6 @@ void RNA_def_userdef(BlenderRNA *brna)
|
|||
StructRNA *srna;
|
||||
PropertyRNA *prop;
|
||||
|
||||
static const EnumPropertyItem preference_section_items[] = {
|
||||
{USER_SECTION_INTERFACE, "INTERFACE", 0, "Interface", ""},
|
||||
{USER_SECTION_THEME, "THEMES", 0, "Themes", ""},
|
||||
{USER_SECTION_VIEWPORT, "VIEWPORT", 0, "Viewport", ""},
|
||||
{USER_SECTION_LIGHT, "LIGHTS", 0, "Lights", ""},
|
||||
{USER_SECTION_EDITING, "EDITING", 0, "Editing", ""},
|
||||
{USER_SECTION_ANIMATION, "ANIMATION", 0, "Animation", ""},
|
||||
{0, "", 0, NULL, NULL},
|
||||
{USER_SECTION_ADDONS, "ADDONS", 0, "Add-ons", ""},
|
||||
# if 0 // def WITH_USERDEF_WORKSPACES
|
||||
{0, "", 0, NULL, NULL},
|
||||
{USER_SECTION_WORKSPACE_CONFIG, "WORKSPACE_CONFIG", 0, "Configuration File", ""},
|
||||
{USER_SECTION_WORKSPACE_ADDONS, "WORKSPACE_ADDONS", 0, "Add-on Overrides", ""},
|
||||
{USER_SECTION_WORKSPACE_KEYMAPS, "WORKSPACE_KEYMAPS", 0, "Keymap Overrides", ""},
|
||||
# endif
|
||||
{0, "", 0, NULL, NULL},
|
||||
{USER_SECTION_INPUT, "INPUT", 0, "Input", ""},
|
||||
{USER_SECTION_NAVIGATION, "NAVIGATION", 0, "Navigation", ""},
|
||||
{USER_SECTION_KEYMAP, "KEYMAP", 0, "Keymap", ""},
|
||||
{0, "", 0, NULL, NULL},
|
||||
{USER_SECTION_SYSTEM, "SYSTEM", 0, "System", ""},
|
||||
{USER_SECTION_SAVE_LOAD, "SAVE_LOAD", 0, "Save & Load", ""},
|
||||
{USER_SECTION_FILE_PATHS, "FILE_PATHS", 0, "File Paths", ""},
|
||||
{0, NULL, 0, NULL, NULL},
|
||||
};
|
||||
|
||||
rna_def_userdef_dothemes(brna);
|
||||
rna_def_userdef_solidlight(brna);
|
||||
rna_def_userdef_walk_navigation(brna);
|
||||
|
@ -5853,6 +5906,7 @@ void RNA_def_userdef(BlenderRNA *brna)
|
|||
prop = RNA_def_property(srna, "active_section", PROP_ENUM, PROP_NONE);
|
||||
RNA_def_property_enum_sdna(prop, NULL, "space_data.section_active");
|
||||
RNA_def_property_enum_items(prop, preference_section_items);
|
||||
RNA_def_property_enum_funcs(prop, NULL, NULL, "rna_UseDef_active_section_itemf");
|
||||
RNA_def_property_ui_text(
|
||||
prop, "Active Section", "Active section of the preferences shown in the user interface");
|
||||
RNA_def_property_update(prop, 0, "rna_userdef_ui_update");
|
||||
|
@ -5922,6 +5976,14 @@ void RNA_def_userdef(BlenderRNA *brna)
|
|||
RNA_def_property_ui_text(
|
||||
prop, "System & OpenGL", "Graphics driver and operating system settings");
|
||||
|
||||
prop = RNA_def_property(srna, "experimental", PROP_POINTER, PROP_NONE);
|
||||
RNA_def_property_flag(prop, PROP_NEVER_NULL);
|
||||
RNA_def_property_struct_type(prop, "PreferencesExperimental");
|
||||
RNA_def_property_ui_text(
|
||||
prop,
|
||||
"Experimental",
|
||||
"Settings for features that are still early in their development stage");
|
||||
|
||||
prop = RNA_def_int_vector(srna,
|
||||
"version",
|
||||
3,
|
||||
|
@ -5975,6 +6037,7 @@ void RNA_def_userdef(BlenderRNA *brna)
|
|||
rna_def_userdef_studiolights(brna);
|
||||
rna_def_userdef_studiolight(brna);
|
||||
rna_def_userdef_pathcompare(brna);
|
||||
rna_def_userdef_experimental(brna);
|
||||
|
||||
USERDEF_TAG_DIRTY_PROPERTY_UPDATE_DISABLE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue