[Bf-blender-cvs] [8ffc3ee2570] master: Cleanup: Correct asset TODO comment, move setter next to getter

Julian Eisel noreply at git.blender.org
Tue Jul 20 21:50:34 CEST 2021


Commit: 8ffc3ee25704c5df8dfdd2c282a2bcbab3a3e933
Author: Julian Eisel
Date:   Tue Jul 20 20:00:04 2021 +0200
Branches: master
https://developer.blender.org/rB8ffc3ee25704c5df8dfdd2c282a2bcbab3a3e933

Cleanup: Correct asset TODO comment, move setter next to getter

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

M	source/blender/makesrna/intern/rna_asset.c

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

diff --git a/source/blender/makesrna/intern/rna_asset.c b/source/blender/makesrna/intern/rna_asset.c
index 0020d90ba1a..3b39a4edb32 100644
--- a/source/blender/makesrna/intern/rna_asset.c
+++ b/source/blender/makesrna/intern/rna_asset.c
@@ -132,6 +132,14 @@ static PointerRNA rna_AssetHandle_file_data_get(PointerRNA *ptr)
   return rna_pointer_inherit_refine(ptr, &RNA_FileSelectEntry, asset_handle->file_data);
 }
 
+static void rna_AssetHandle_file_data_set(PointerRNA *ptr,
+                                          PointerRNA value,
+                                          struct ReportList *UNUSED(reports))
+{
+  AssetHandle *asset_handle = ptr->data;
+  asset_handle->file_data = value.data;
+}
+
 static void rna_AssetHandle_get_full_library_path(
     // AssetHandle *asset,
     bContext *C,
@@ -150,14 +158,6 @@ static PointerRNA rna_AssetHandle_local_id_get(PointerRNA *ptr)
   return rna_pointer_inherit_refine(ptr, &RNA_ID, id);
 }
 
-static void rna_AssetHandle_file_data_set(PointerRNA *ptr,
-                                          PointerRNA value,
-                                          struct ReportList *UNUSED(reports))
-{
-  AssetHandle *asset_handle = ptr->data;
-  asset_handle->file_data = value.data;
-}
-
 int rna_asset_library_reference_get(const AssetLibraryReference *library)
 {
   return ED_asset_library_reference_to_enum_value(library);
@@ -343,7 +343,9 @@ static void rna_def_asset_handle(BlenderRNA *brna)
   srna = RNA_def_struct(brna, "AssetHandle", "PropertyGroup");
   RNA_def_struct_ui_text(srna, "Asset Handle", "Reference to some asset");
 
-  /* TODO why is this editable? There probably shouldn't be a setter. */
+  /* TODO It is super ugly to expose the file data here. We have to do it though so the asset view
+   * template can populate a RNA collection with asset-handles, which are just file entries
+   * currently. A proper design is being worked on. */
   prop = RNA_def_property(srna, "file_data", PROP_POINTER, PROP_NONE);
   RNA_def_property_flag(prop, PROP_EDITABLE);
   RNA_def_property_struct_type(prop, "FileSelectEntry");



More information about the Bf-blender-cvs mailing list