From 06ead314b63f068ae9deaed369021b01aa5f1029 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 19 Nov 2021 16:04:24 +0100 Subject: Asset Preferences: disallow single file as asset library Asset libraries should be directories on disk. By manually entering a file path it was possible to have a single blend file as asset library, but that was not a designed-for situation, and it doesn't play well with the asset catalog system. --- source/blender/makesrna/intern/rna_userdef.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index 32b3be9ee09..4542f8fa1d7 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -344,6 +344,12 @@ static void rna_userdef_asset_library_name_set(PointerRNA *ptr, const char *valu BKE_preferences_asset_library_name_set(&U, library, value); } +static void rna_userdef_asset_library_path_set(PointerRNA *ptr, const char *value) +{ + bUserAssetLibrary *library = (bUserAssetLibrary *)ptr->data; + BKE_preferences_asset_library_path_set(library, value); +} + static void rna_userdef_script_autoexec_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) @@ -6092,6 +6098,7 @@ static void rna_def_userdef_filepaths_asset_library(BlenderRNA *brna) prop = RNA_def_property(srna, "path", PROP_STRING, PROP_DIRPATH); RNA_def_property_ui_text( prop, "Path", "Path to a directory with .blend files to use as an asset library"); + RNA_def_property_string_funcs(prop, NULL, NULL, "rna_userdef_asset_library_path_set"); RNA_def_property_update(prop, 0, "rna_userdef_update"); } -- cgit v1.2.3