[Bf-blender-cvs] [8de2b6a0202] master: Assets: Rename workspace active asset library DNA variable

Julian Eisel noreply at git.blender.org
Wed Jul 21 19:38:13 CEST 2021


Commit: 8de2b6a02020ad0bc4e4ad7868988a37251e3f88
Author: Julian Eisel
Date:   Wed Jul 21 19:02:20 2021 +0200
Branches: master
https://developer.blender.org/rB8de2b6a02020ad0bc4e4ad7868988a37251e3f88

Assets: Rename workspace active asset library DNA variable

This new variable was introduced with 7898089de3f2. We don't usually use
an `active` prefix variable. Plus, this makes the name match the one of
the Asset Browser active library variable, so we can use the
`rna_def_asset_library_reference_common()` helper for both.

This will cause Asset Views to open with the default "Current File"
Asset Library. We could avoid that, but it's a minor issue really.

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

M	source/blender/blenkernel/intern/workspace.c
M	source/blender/blenloader/intern/versioning_300.c
M	source/blender/editors/screen/screen_context.c
M	source/blender/makesdna/DNA_workspace_types.h
M	source/blender/makesrna/intern/rna_asset.c
M	source/blender/makesrna/intern/rna_workspace.c

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

diff --git a/source/blender/blenkernel/intern/workspace.c b/source/blender/blenkernel/intern/workspace.c
index 5cac149c503..059dc68b1dc 100644
--- a/source/blender/blenkernel/intern/workspace.c
+++ b/source/blender/blenkernel/intern/workspace.c
@@ -58,7 +58,7 @@ static void workspace_init_data(ID *id)
 {
   WorkSpace *workspace = (WorkSpace *)id;
 
-  BKE_asset_library_reference_init_default(&workspace->active_asset_library);
+  BKE_asset_library_reference_init_default(&workspace->asset_library);
 }
 
 static void workspace_free_data(ID *id)
diff --git a/source/blender/blenloader/intern/versioning_300.c b/source/blender/blenloader/intern/versioning_300.c
index 107871586da..2bb64717615 100644
--- a/source/blender/blenloader/intern/versioning_300.c
+++ b/source/blender/blenloader/intern/versioning_300.c
@@ -531,15 +531,6 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
       }
     }
     FOREACH_NODETREE_END;
-
-    {
-      if (!DNA_struct_elem_find(
-              fd->filesdna, "WorkSpace", "AssetLibraryReference", "active_asset_library")) {
-        LISTBASE_FOREACH (WorkSpace *, workspace, &bmain->workspaces) {
-          BKE_asset_library_reference_init_default(&workspace->active_asset_library);
-        }
-      }
-    }
   }
 
   if (!MAIN_VERSION_ATLEAST(bmain, 300, 10)) {
@@ -582,5 +573,12 @@ void blo_do_versions_300(FileData *fd, Library *UNUSED(lib), Main *bmain)
         }
       }
     }
+
+    if (!DNA_struct_elem_find(
+            fd->filesdna, "WorkSpace", "AssetLibraryReference", "asset_library")) {
+      LISTBASE_FOREACH (WorkSpace *, workspace, &bmain->workspaces) {
+        BKE_asset_library_reference_init_default(&workspace->asset_library);
+      }
+    }
   }
 }
diff --git a/source/blender/editors/screen/screen_context.c b/source/blender/editors/screen/screen_context.c
index 3ce2f326dca..8123d8bb104 100644
--- a/source/blender/editors/screen/screen_context.c
+++ b/source/blender/editors/screen/screen_context.c
@@ -1031,7 +1031,7 @@ static eContextResult screen_ctx_asset_library(const bContext *C, bContextDataRe
 {
   WorkSpace *workspace = CTX_wm_workspace(C);
   CTX_data_pointer_set(
-      result, &workspace->id, &RNA_AssetLibraryReference, &workspace->active_asset_library);
+      result, &workspace->id, &RNA_AssetLibraryReference, &workspace->asset_library);
   return CTX_RESULT_OK;
 }
 
diff --git a/source/blender/makesdna/DNA_workspace_types.h b/source/blender/makesdna/DNA_workspace_types.h
index 9ed01a7dbcc..2bac040ea90 100644
--- a/source/blender/makesdna/DNA_workspace_types.h
+++ b/source/blender/makesdna/DNA_workspace_types.h
@@ -139,7 +139,7 @@ typedef struct WorkSpace {
 
   /** Workspace-wide active asset library, for asset UIs to use (e.g. asset view UI template). The
    * Asset Browser has its own and doesn't use this. */
-  AssetLibraryReference active_asset_library;
+  AssetLibraryReference asset_library;
 } WorkSpace;
 
 /**
diff --git a/source/blender/makesrna/intern/rna_asset.c b/source/blender/makesrna/intern/rna_asset.c
index 06dfe6ce8a8..f9658586f5f 100644
--- a/source/blender/makesrna/intern/rna_asset.c
+++ b/source/blender/makesrna/intern/rna_asset.c
@@ -382,7 +382,7 @@ PropertyRNA *rna_def_asset_library_reference_common(struct StructRNA *srna,
                                                     const char *get,
                                                     const char *set)
 {
-  PropertyRNA *prop = RNA_def_property(srna, "active_asset_library", PROP_ENUM, PROP_NONE);
+  PropertyRNA *prop = RNA_def_property(srna, "asset_library", PROP_ENUM, PROP_NONE);
   RNA_def_property_enum_items(prop, DummyRNA_NULL_items);
   RNA_def_property_enum_funcs(prop, get, set, "rna_asset_library_reference_itemf");
 
diff --git a/source/blender/makesrna/intern/rna_workspace.c b/source/blender/makesrna/intern/rna_workspace.c
index b053bb0ff62..f23ce1dd12f 100644
--- a/source/blender/makesrna/intern/rna_workspace.c
+++ b/source/blender/makesrna/intern/rna_workspace.c
@@ -107,16 +107,16 @@ static void rna_WorkSpace_owner_ids_clear(WorkSpace *workspace)
   WM_main_add_notifier(NC_OBJECT | ND_MODIFIER | NA_REMOVED, workspace);
 }
 
-static int rna_WorkSpace_active_asset_library_get(PointerRNA *ptr)
+static int rna_WorkSpace_asset_library_get(PointerRNA *ptr)
 {
   const WorkSpace *workspace = ptr->data;
-  return rna_asset_library_reference_get(&workspace->active_asset_library);
+  return rna_asset_library_reference_get(&workspace->asset_library);
 }
 
-static void rna_WorkSpace_active_asset_library_set(PointerRNA *ptr, int value)
+static void rna_WorkSpace_asset_library_set(PointerRNA *ptr, int value)
 {
   WorkSpace *workspace = ptr->data;
-  rna_asset_library_reference_set(&workspace->active_asset_library, value);
+  rna_asset_library_reference_set(&workspace->asset_library, value);
 }
 
 static bToolRef *rna_WorkSpace_tools_from_tkey(WorkSpace *workspace,
@@ -420,7 +420,7 @@ static void rna_def_workspace(BlenderRNA *brna)
   RNA_def_property_update(prop, 0, "rna_window_update_all");
 
   prop = rna_def_asset_library_reference_common(
-      srna, "rna_WorkSpace_active_asset_library_get", "rna_WorkSpace_active_asset_library_set");
+      srna, "rna_WorkSpace_asset_library_get", "rna_WorkSpace_asset_library_set");
   RNA_def_property_ui_text(prop,
                            "Asset Library",
                            "Active asset library to show in the UI, not used by the Asset Browser "



More information about the Bf-blender-cvs mailing list