From 62a2b92b6bef8b01bd4b34f02b188297e1f62c71 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 23 May 2022 12:11:09 +0200 Subject: Fix T98283: Regression: crash when opening file that has Collision modifier on liboverride object Some RNA property update callbacks can already generate such modifier, and only one is allowed per object, so had to adapt code actually adding new modifiers in liboverride apply codebase. --- source/blender/makesrna/intern/rna_object.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c index 1fb41bf792f..98fc6633f78 100644 --- a/source/blender/makesrna/intern/rna_object.c +++ b/source/blender/makesrna/intern/rna_object.c @@ -1829,6 +1829,24 @@ bool rna_Object_modifiers_override_apply(Main *bmain, ModifierData *mod_dst = ED_object_modifier_add( NULL, bmain, NULL, ob_dst, mod_src->name, mod_src->type); + if (mod_dst == NULL) { + /* This can happen e.g. when a modifier type is tagged as `eModifierTypeFlag_Single`, and that + * modifier has somehow been added already by another code path (e.g. + * `rna_CollisionSettings_dependency_update` does add the `eModifierType_Collision` singleton + * modifier). + * + * Try to handle this by finding already existing one here. */ + const ModifierTypeInfo *mti = BKE_modifier_get_info((ModifierType)mod_src->type); + if (mti->flags & eModifierTypeFlag_Single) { + mod_dst = BKE_modifiers_findby_type(ob_dst, (ModifierType)mod_src->type); + } + + if (mod_dst == NULL) { + BLI_assert(mod_src != NULL); + return false; + } + } + /* XXX Current handling of 'copy' from particle-system modifier is *very* bad (it keeps same psys * pointer as source, then calling code copies psys of object separately and do some magic * remapping of pointers...), unfortunately several pieces of code in Object editing area rely on -- cgit v1.2.3 From 469ee7ff1529a1b28ce0b300835ebc42d5c5362f Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 19 May 2022 20:31:58 +0200 Subject: Python API: add mathutils.Color functions to convert color spaces Between scene linear and sRGB, XYZ, linear Rec.709 and ACES2065-1. And add some clarifications about color spaces in the docs. Fixes T98267 Ref T68926 Differential Revision: https://developer.blender.org/D14989 --- source/blender/makesrna/intern/rna_mesh.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'source/blender/makesrna') diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c index 38d473f04dd..ec0a182e338 100644 --- a/source/blender/makesrna/intern/rna_mesh.c +++ b/source/blender/makesrna/intern/rna_mesh.c @@ -2195,7 +2195,7 @@ static void rna_def_mloopcol(BlenderRNA *brna) RNA_def_property_range(prop, 0.0f, 1.0f); RNA_def_property_float_funcs( prop, "rna_MeshLoopColor_color_get", "rna_MeshLoopColor_color_set", NULL); - RNA_def_property_ui_text(prop, "Color", ""); + RNA_def_property_ui_text(prop, "Color", "Color in sRGB color space"); RNA_def_property_update(prop, 0, "rna_Mesh_update_data_legacy_deg_tag_all"); } @@ -3210,7 +3210,9 @@ static void rna_def_mesh(BlenderRNA *brna) NULL); RNA_def_property_struct_type(prop, "MeshLoopColorLayer"); RNA_def_property_override_flag(prop, PROPOVERRIDE_IGNORE); - RNA_def_property_ui_text(prop, "Vertex Colors", "All vertex colors"); + RNA_def_property_ui_text(prop, + "Vertex Colors", + "Legacy vertex color layers. Deprecated, use color attributes instead"); rna_def_loop_colors(brna, prop); /* Sculpt Vertex colors */ @@ -3228,7 +3230,9 @@ static void rna_def_mesh(BlenderRNA *brna) NULL); RNA_def_property_struct_type(prop, "MeshVertColorLayer"); RNA_def_property_override_flag(prop, PROPOVERRIDE_IGNORE); - RNA_def_property_ui_text(prop, "Sculpt Vertex Colors", "All vertex colors"); + RNA_def_property_ui_text(prop, + "Sculpt Vertex Colors", + "Sculpt vertex color layers. Deprecated, use color attributes instead"); rna_def_vert_colors(brna, prop); /* TODO: edge customdata layers (bmesh py api can access already). */ -- cgit v1.2.3