[Bf-blender-cvs] [b3597b1128c] asset-browser-grid-view: Add Asset Browser as own editor

Julian Eisel noreply at git.blender.org
Fri Jan 28 19:32:08 CET 2022


Commit: b3597b1128c29f255e3b44bb1879df84adcef76d
Author: Julian Eisel
Date:   Fri Jan 28 19:27:37 2022 +0100
Branches: asset-browser-grid-view
https://developer.blender.org/rBb3597b1128c29f255e3b44bb1879df84adcef76d

Add Asset Browser as own editor

This is part of a (tentative) plan to split off the Asset Browser from
the File Browser, while adding a new grid-view API that generalizes most
of the UI. Both editors can use this and only have to implement their
case-specific logic. This then allows us to add a proper asset system,
that's not tied to the file browser backend anymore.

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

M	release/datafiles/userdef/userdef_default_theme.c
M	release/scripts/presets/interface_theme/Blender_Light.xml
M	release/scripts/startup/bl_ui/__init__.py
A	release/scripts/startup/bl_ui/space_assets.py
M	source/blender/blenloader/intern/versioning_userdef.c
M	source/blender/editors/CMakeLists.txt
M	source/blender/editors/include/ED_space_api.h
M	source/blender/editors/interface/interface_template_search_menu.cc
M	source/blender/editors/interface/resources.c
M	source/blender/editors/space_api/CMakeLists.txt
M	source/blender/editors/space_api/spacetypes.c
A	source/blender/editors/space_assets/CMakeLists.txt
A	source/blender/editors/space_assets/asset_browser_intern.hh
A	source/blender/editors/space_assets/asset_browser_ops.cc
A	source/blender/editors/space_assets/space_assets.cc
M	source/blender/makesdna/DNA_space_types.h
M	source/blender/makesdna/DNA_userdef_types.h
M	source/blender/makesrna/RNA_access.h
M	source/blender/makesrna/intern/rna_space.c
M	source/blender/makesrna/intern/rna_userdef.c

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

diff --git a/release/datafiles/userdef/userdef_default_theme.c b/release/datafiles/userdef/userdef_default_theme.c
index 055a2e37c6c..b095b58d191 100644
--- a/release/datafiles/userdef/userdef_default_theme.c
+++ b/release/datafiles/userdef/userdef_default_theme.c
@@ -1067,6 +1067,35 @@ const bTheme U_theme_default = {
     .edited_object = RGBA(0x00806266),
     .row_alternate = RGBA(0xffffff04),
   },
+  .space_assets = {
+    .back = RGBA(0x28282800),
+    .title = RGBA(0xffffffff),
+    .text = RGBA(0xe6e6e6ff),
+    .text_hi = RGBA(0xffffffff),
+    .header = RGBA(0x303030b3),
+    .header_text = RGBA(0xeeeeeeff),
+    .header_text_hi = RGBA(0xffffffff),
+    .tab_active = RGBA(0x303030ff),
+    .tab_inactive = RGBA(0x1d1d1dff),
+    .tab_back = RGBA(0x181818ff),
+    .tab_outline = RGBA(0x3d3d3dff),
+    .button = RGBA(0x30303000),
+    .button_title = RGBA(0xffffffff),
+    .button_text = RGBA(0xccccccff),
+    .button_text_hi = RGBA(0xffffffff),
+    .navigation_bar = RGBA(0x303030ff),
+    .execution_buts = RGBA(0x303030ff),
+    .panelcolors = {
+      .header = RGBA(0x3d3d3dff),
+      .back = RGBA(0x3d3d3dff),
+      .sub_back = RGBA(0x0000001f),
+    },
+    .hilite = RGBA(0x4772b3ff),
+    .vertex_size = 3,
+    .outline_width = 1,
+    .facedot_size = 4,
+    .row_alternate = RGBA(0xffffff04),
+  },
   .tarm = {
     {
       .solid = RGBA(0x9a0000ff),
diff --git a/release/scripts/presets/interface_theme/Blender_Light.xml b/release/scripts/presets/interface_theme/Blender_Light.xml
index 9a315763c8b..97cca3dd31a 100644
--- a/release/scripts/presets/interface_theme/Blender_Light.xml
+++ b/release/scripts/presets/interface_theme/Blender_Light.xml
@@ -1363,6 +1363,42 @@
         </space_list>
       </ThemeSpreadsheet>
     </spreadsheet>
+    <asset_browser>
+      <ThemeAssetBrowser
+        row_alternate="#ffffff0f"
+        >
+        <space>
+          <ThemeSpaceGeneric
+            back="#999999"
+            title="#000000"
+            text="#000000"
+            text_hi="#ffffff"
+            header="#adadadff"
+            header_text="#000000"
+            header_text_hi="#ffffff"
+            button="#999999e6"
+            button_title="#1a1a1a"
+            button_text="#000000"
+            button_text_hi="#000000"
+            navigation_bar="#00000000"
+            execution_buts="#999999e6"
+            tab_active="#6697e6"
+            tab_inactive="#cccccc"
+            tab_back="#999999ff"
+            tab_outline="#999999"
+            >
+            <panelcolors>
+              <ThemePanelColors
+                header="#42424200"
+                back="#00000028"
+                sub_back="#00000024"
+                >
+              </ThemePanelColors>
+            </panelcolors>
+          </ThemeSpaceGeneric>
+        </space>
+      </ThemeAssetBrowser>
+    </asset_browser>
     <bone_color_sets>
       <ThemeBoneColorSet
         normal="#9a0000"
diff --git a/release/scripts/startup/bl_ui/__init__.py b/release/scripts/startup/bl_ui/__init__.py
index 1fb40ad8bc8..7c4244af994 100644
--- a/release/scripts/startup/bl_ui/__init__.py
+++ b/release/scripts/startup/bl_ui/__init__.py
@@ -75,6 +75,7 @@ _modules = [
     "space_toolsystem_common",
     "space_toolsystem_toolbar",
 
+    "space_assets",
     "space_clip",
     "space_console",
     "space_dopesheet",
diff --git a/release/scripts/startup/bl_ui/space_assets.py b/release/scripts/startup/bl_ui/space_assets.py
new file mode 100644
index 00000000000..5c14599267c
--- /dev/null
+++ b/release/scripts/startup/bl_ui/space_assets.py
@@ -0,0 +1,40 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+#  This program is free software; you can redistribute it and/or
+#  modify it under the terms of the GNU General Public License
+#  as published by the Free Software Foundation; either version 2
+#  of the License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful,
+#  but WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#  GNU General Public License for more details.
+#
+#  You should have received a copy of the GNU General Public License
+#  along with this program; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+
+# <pep8 compliant>
+from bpy.types import Header
+
+
+class ASSETBROWSER_HT_header(Header):
+    bl_space_type = 'ASSET_BROWSER'
+
+    def draw(self, context):
+        layout = self.layout
+        # space = context.space_data
+
+        layout.template_header()
+
+
+classes = (
+    ASSETBROWSER_HT_header,
+)
+
+if __name__ == "__main__":  # only for live edit.
+    from bpy.utils import register_class
+    for cls in classes:
+        register_class(cls)
diff --git a/source/blender/blenloader/intern/versioning_userdef.c b/source/blender/blenloader/intern/versioning_userdef.c
index 064d7977c68..0dc4d11f200 100644
--- a/source/blender/blenloader/intern/versioning_userdef.c
+++ b/source/blender/blenloader/intern/versioning_userdef.c
@@ -348,6 +348,7 @@ static void do_versions_theme(const UserDef *userdef, bTheme *btheme)
    */
   {
     /* Keep this block, even when empty. */
+    btheme->space_assets = btheme->space_file;
   }
 
 #undef FROM_DEFAULT_V4_UCHAR
diff --git a/source/blender/editors/CMakeLists.txt b/source/blender/editors/CMakeLists.txt
index 092198cea86..992dd93e6f6 100644
--- a/source/blender/editors/CMakeLists.txt
+++ b/source/blender/editors/CMakeLists.txt
@@ -41,6 +41,7 @@ if(WITH_BLENDER)
   add_subdirectory(sound)
   add_subdirectory(space_action)
   add_subdirectory(space_api)
+  add_subdirectory(space_assets)
   add_subdirectory(space_buttons)
   add_subdirectory(space_clip)
   add_subdirectory(space_console)
diff --git a/source/blender/editors/include/ED_space_api.h b/source/blender/editors/include/ED_space_api.h
index fb76b36baef..05b7115a594 100644
--- a/source/blender/editors/include/ED_space_api.h
+++ b/source/blender/editors/include/ED_space_api.h
@@ -42,6 +42,7 @@ void ED_spacemacros_init(void);
  * Calls for registering default spaces, only called once, from #ED_spacetypes_init
  * \{ */
 
+void ED_spacetype_assets(void);
 void ED_spacetype_outliner(void);
 void ED_spacetype_view3d(void);
 void ED_spacetype_ipo(void);
diff --git a/source/blender/editors/interface/interface_template_search_menu.cc b/source/blender/editors/interface/interface_template_search_menu.cc
index 0ce3a0d8af1..3dab6133c4f 100644
--- a/source/blender/editors/interface/interface_template_search_menu.cc
+++ b/source/blender/editors/interface/interface_template_search_menu.cc
@@ -657,6 +657,8 @@ static MenuSearch_Data *menu_items_from_ui_create(
           SPACE_MENU_NOP(SPACE_STATUSBAR);
           SPACE_MENU_NOP(SPACE_TOPBAR);
           SPACE_MENU_NOP(SPACE_SPREADSHEET);
+          /* TODO */
+          SPACE_MENU_NOP(SPACE_ASSETS);
         }
       }
       for (int i = 0; i < idname_array_len; i++) {
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 3b511e23384..9aceedbb051 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -163,6 +163,9 @@ const uchar *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colorid)
         case SPACE_SPREADSHEET:
           ts = &btheme->space_spreadsheet;
           break;
+        case SPACE_ASSETS:
+          ts = &btheme->space_assets;
+          break;
         default:
           ts = &btheme->space_view3d;
           break;
diff --git a/source/blender/editors/space_api/CMakeLists.txt b/source/blender/editors/space_api/CMakeLists.txt
index 85c07223f2d..14d1fddb51e 100644
--- a/source/blender/editors/space_api/CMakeLists.txt
+++ b/source/blender/editors/space_api/CMakeLists.txt
@@ -38,6 +38,7 @@ set(SRC
 set(LIB
   bf_editor_geometry
   bf_editor_space_action
+  bf_editor_space_assets
   bf_editor_space_buttons
   bf_editor_space_clip
   bf_editor_space_console
diff --git a/source/blender/editors/space_api/spacetypes.c b/source/blender/editors/space_api/spacetypes.c
index f8adba30547..5873cd6b40a 100644
--- a/source/blender/editors/space_api/spacetypes.c
+++ b/source/blender/editors/space_api/spacetypes.c
@@ -76,6 +76,7 @@ void ED_spacetypes_init(void)
   U.widget_unit = 20;
 
   /* Create space types. */
+  ED_spacetype_assets();
   ED_spacetype_outliner();
   ED_spacetype_view3d();
   ED_spacetype_ipo();
diff --git a/source/blender/editors/space_api/CMakeLists.txt b/source/blender/editors/space_assets/CMakeLists.txt
similarity index 61%
copy from source/blender/editors/space_api/CMakeLists.txt
copy to source/blender/editors/space_assets/CMakeLists.txt
index 85c07223f2d..8e4419734da 100644
--- a/source/blender/editors/space_api/CMakeLists.txt
+++ b/source/blender/editors/space_assets/CMakeLists.txt
@@ -17,45 +17,24 @@
 
 set(INC
   ../include
-  ../io
+  ../../blenfont
   ../../blenkernel
   ../../blenlib
+  ../../blentranslation
   ../../gpu
   ../../makesdna
   ../../makesrna
   ../../windowmanager
+  ../../../../intern/glew-mx
   ../../../../intern/guardedalloc
 )
 
-set(INC_SYS
-
-)
-
 set(SRC
-  spacetypes.c
+  asset_browser_ops.cc
+  space_assets.cc
 )
 
 set(LIB
-  bf_editor_geometry
-  bf_editor_space_action
-  bf_editor_space_buttons
-  bf_editor_space_clip
-  bf_editor_space_console
-  bf_editor_space_file
-  bf_editor_space_graph
-  bf_editor_space_image
-  bf_editor_space_info
-  bf_editor_space_nla
-  bf_editor_space_node
-  bf_editor_space_outliner
-  bf_editor_space_script
-  bf_editor_space_sequencer
-  bf_editor_space_spreadsheet
-  bf_editor_space_statusbar
-  bf_editor_space_text
-  bf_editor_space_topbar
-  bf_editor_space_userpref
-  bf_editor_space_view3d
 )
 
-blender_add_lib(bf_editor_space_api "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
+blender_add_lib(bf_editor_space_assets "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
diff --git a/source/blender/editors/space_assets/asset_browser_intern.hh b/source/blender/editors/space_assets/asset_browser_intern.hh
new file mode 100644
index 00000000000..18a0e438c7a
--- /dev/null
+++ b/source/ble

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list