[Bf-blender-cvs] [7234c363dbf] blender-projects-basics: Hide UI behind experimental option

Julian Eisel noreply at git.blender.org
Tue Oct 18 18:28:24 CEST 2022


Commit: 7234c363dbf874dc8b20d88d5bc02187871e10aa
Author: Julian Eisel
Date:   Tue Oct 18 18:26:50 2022 +0200
Branches: blender-projects-basics
https://developer.blender.org/rB7234c363dbf874dc8b20d88d5bc02187871e10aa

Hide UI behind experimental option

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

M	release/scripts/startup/bl_ui/space_topbar.py
M	release/scripts/startup/bl_ui/space_userpref.py
M	source/blender/blenkernel/intern/blendfile.c
M	source/blender/blenloader/intern/writefile.cc
M	source/blender/editors/project/project_ops.cc
M	source/blender/makesdna/DNA_userdef_types.h
M	source/blender/makesrna/intern/rna_screen.c
M	source/blender/makesrna/intern/rna_userdef.c

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

diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py
index 180050c7aa5..b6c22f2acd7 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -273,13 +273,14 @@ class TOPBAR_MT_file(Menu):
 
         layout.operator_context = 'INVOKE_AREA'
         layout.menu("TOPBAR_MT_file_new", text="New", text_ctxt=i18n_contexts.id_windowmanager, icon='FILE_NEW')
-        layout.operator("wm.open_mainfile", text="Open File...", icon='FILE_FOLDER')
+        layout.operator("wm.open_mainfile", text="Open...", icon='FILE_FOLDER')
         layout.menu("TOPBAR_MT_file_open_recent")
         layout.operator("wm.revert_mainfile")
         layout.menu("TOPBAR_MT_file_recover")
 
-        props = layout.operator("project.new", text="Set up Project...")
-        props.open_settings_after = True
+        if context.preferences.experimental.use_blender_projects:
+            props = layout.operator("project.new", text="Set up Project...")
+            props.open_settings_after = True
 
         layout.separator()
 
@@ -627,7 +628,8 @@ class TOPBAR_MT_edit(Menu):
 
         layout.separator()
 
-        layout.operator("screen.project_settings_show", text="Project Settings...")
+        if context.preferences.experimental.use_blender_projects:
+            layout.operator("screen.project_settings_show", text="Project Settings...")
         layout.operator("screen.userpref_show",
                         text="Preferences...", icon='PREFERENCES')
 
@@ -734,7 +736,7 @@ class TOPBAR_MT_help(Menu):
 class TOPBAR_MT_file_context_menu(Menu):
     bl_label = "File Context Menu"
 
-    def draw(self, _context):
+    def draw(self, context):
         layout = self.layout
 
         layout.operator_context = 'INVOKE_AREA'
@@ -753,7 +755,8 @@ class TOPBAR_MT_file_context_menu(Menu):
 
         layout.separator()
 
-        layout.operator("screen.project_settings_show", text="Project Settings...")
+        if context.preferences.experimental.use_blender_projects:
+            layout.operator("screen.project_settings_show", text="Project Settings...")
         layout.operator("screen.userpref_show",
                         text="Preferences...", icon='PREFERENCES')
 
diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index e57820d47d4..7223c750f32 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -1234,6 +1234,10 @@ class ThemeGenericClassGenerator:
             if theme_area.identifier in {'USER_INTERFACE', 'STYLE', 'BONE_COLOR_SETS'}:
                 continue
 
+            prefs = bpy.context.preferences
+            if not prefs.experimental.use_blender_projects and theme_area.identifier == 'PROJECT_SETTINGS':
+                continue
+
             panel_id = "USERPREF_PT_theme_" + theme_area.identifier.lower()
             # Generate panel-class from theme_area
             yield type(panel_id, (PreferenceThemeSpacePanel, ThemePanel, Panel), {
@@ -2285,6 +2289,7 @@ class USERPREF_PT_experimental_prototypes(ExperimentalPanel, Panel):
                 ({"property": "use_full_frame_compositor"}, "T88150"),
                 ({"property": "enable_eevee_next"}, "T93220"),
                 ({"property": "use_draw_manager_acquire_lock"}, "T98016"),
+                ({"property": "use_blender_projects"}, None),
             ),
         )
 
diff --git a/source/blender/blenkernel/intern/blendfile.c b/source/blender/blenkernel/intern/blendfile.c
index d8e3183447e..e39c8756d96 100644
--- a/source/blender/blenkernel/intern/blendfile.c
+++ b/source/blender/blenkernel/intern/blendfile.c
@@ -448,6 +448,9 @@ static void setup_app_blend_file_data(bContext *C,
 
 static void setup_app_project_data(BlendFileData *bfd, const struct BlendFileReadParams *params)
 {
+  if (!U.experimental.use_blender_projects) {
+    return;
+  }
   if ((params->skip_flags & BLO_READ_SKIP_DATA) == 0) {
     BKE_project_active_load_from_path(bfd->main->filepath);
   }
diff --git a/source/blender/blenloader/intern/writefile.cc b/source/blender/blenloader/intern/writefile.cc
index 6b049278f8b..01a729732a1 100644
--- a/source/blender/blenloader/intern/writefile.cc
+++ b/source/blender/blenloader/intern/writefile.cc
@@ -1442,7 +1442,9 @@ bool BLO_write_file(Main *mainvar,
   }
 
   /* Update active project information based on the new file location. */
-  BKE_project_active_load_from_path(filepath);
+  if (U.experimental.use_blender_projects) {
+    BKE_project_active_load_from_path(filepath);
+  }
 
   /* actual file writing */
   const bool err = write_file_handle(
diff --git a/source/blender/editors/project/project_ops.cc b/source/blender/editors/project/project_ops.cc
index 797b4fd3f56..b9398aa9e95 100644
--- a/source/blender/editors/project/project_ops.cc
+++ b/source/blender/editors/project/project_ops.cc
@@ -39,6 +39,15 @@ static bool has_active_project_poll(bContext *C)
 /** \name New project operator
  * \{ */
 
+static bool new_project_poll(bContext *C)
+{
+  if (!U.experimental.use_blender_projects) {
+    CTX_wm_operator_poll_msg_set(C, "Experimental project support is not enabled");
+    return false;
+  }
+  return true;
+}
+
 static int new_project_exec(bContext *C, wmOperator *op)
 {
   const Main *bmain = CTX_data_main(C);
@@ -89,6 +98,7 @@ static void PROJECT_OT_new(wmOperatorType *ot)
   ot->invoke = new_project_invoke;
   ot->exec = new_project_exec;
   /* omit window poll so this can work in background mode */
+  ot->poll = new_project_poll;
 
   WM_operator_properties_filesel(ot,
                                  FILE_TYPE_FOLDER,
diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h
index 44a5bf5a20d..5a6c7992a3e 100644
--- a/source/blender/makesdna/DNA_userdef_types.h
+++ b/source/blender/makesdna/DNA_userdef_types.h
@@ -647,7 +647,8 @@ typedef struct UserDef_Experimental {
   char use_sculpt_texture_paint;
   char use_draw_manager_acquire_lock;
   char use_realtime_compositor;
-  char _pad[7];
+  char use_blender_projects;
+  char _pad[6];
   /** `makesdna` does not allow empty structs. */
 } UserDef_Experimental;
 
diff --git a/source/blender/makesrna/intern/rna_screen.c b/source/blender/makesrna/intern/rna_screen.c
index a65bd613ecf..2051045cd73 100644
--- a/source/blender/makesrna/intern/rna_screen.c
+++ b/source/blender/makesrna/intern/rna_screen.c
@@ -186,6 +186,10 @@ static const EnumPropertyItem *rna_Area_ui_type_itemf(bContext *C,
       continue;
     }
 
+    if (!U.experimental.use_blender_projects && (item_from->value == SPACE_PROJECT_SETTINGS)) {
+      continue;
+    }
+
     SpaceType *st = item_from->identifier[0] ? BKE_spacetype_from_id(item_from->value) : NULL;
     int totitem_prev = totitem;
     if (st && st->space_subtype_item_extend != NULL) {
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 0c873ef1997..2fed4e3f4a3 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -6369,6 +6369,12 @@ static void rna_def_userdef_experimental(BlenderRNA *brna)
   RNA_def_property_ui_text(
       prop, "Override Templates", "Enable library override template in the python API");
 
+  prop = RNA_def_property(srna, "use_blender_projects", PROP_BOOLEAN, PROP_NONE);
+  RNA_def_property_ui_text(prop,
+                           "Blender Projects",
+                           "Enable support for Blender project directories, consisting out of "
+                           "multiple .blend files and dedicated project settings");
+
   prop = RNA_def_property(srna, "enable_eevee_next", PROP_BOOLEAN, PROP_NONE);
   RNA_def_property_boolean_sdna(prop, NULL, "enable_eevee_next", 1);
   RNA_def_property_ui_text(prop, "EEVEE Next", "Enable the new EEVEE codebase, requires restart");



More information about the Bf-blender-cvs mailing list