From 8a97b8555587d8241fd79d54c08c1a6ced7acf53 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Sun, 17 Feb 2019 12:27:07 +0100 Subject: Fix T54504: Cycles wrong backwards compatibility with linked libraries. The code assumed all datablocks were read from .blend files saved with the same version. This restructures the Cycles versioning code to take into account libraries. --- source/blender/makesrna/intern/rna_ID.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source/blender/makesrna/intern/rna_ID.c') diff --git a/source/blender/makesrna/intern/rna_ID.c b/source/blender/makesrna/intern/rna_ID.c index 3a22782f31e..85b1ec4d958 100644 --- a/source/blender/makesrna/intern/rna_ID.c +++ b/source/blender/makesrna/intern/rna_ID.c @@ -762,6 +762,14 @@ static IDProperty *rna_IDPropertyWrapPtr_idprops(PointerRNA *ptr, bool UNUSED(cr return ptr->data; } +static void rna_Library_version_get(PointerRNA *ptr, int *value) +{ + Library *lib = (Library *)ptr->data; + value[0] = lib->versionfile / 100; + value[1] = lib->versionfile % 100; + value[2] = lib->subversionfile; +} + #else static void rna_def_ID_properties(BlenderRNA *brna) @@ -1110,6 +1118,12 @@ static void rna_def_library(BlenderRNA *brna) RNA_def_property_pointer_sdna(prop, NULL, "packedfile"); RNA_def_property_ui_text(prop, "Packed File", ""); + prop = RNA_def_int_vector(srna, "version", 3, NULL, 0, INT_MAX, + "Version", "Version of Blender the library .blend was saved with", 0, INT_MAX); + RNA_def_property_int_funcs(prop, "rna_Library_version_get", NULL, NULL); + RNA_def_property_clear_flag(prop, PROP_EDITABLE); + RNA_def_property_flag(prop, PROP_THICK_WRAP); + func = RNA_def_function(srna, "reload", "WM_lib_reload"); RNA_def_function_flag(func, FUNC_USE_REPORTS | FUNC_USE_CONTEXT); RNA_def_function_ui_description(func, "Reload this library and all its linked data-blocks"); -- cgit v1.2.3