mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
Merge branch 'blender-v5.1-release'
This commit is contained in:
commit
e1c8abcf49
4 changed files with 60 additions and 7 deletions
|
|
@ -531,7 +531,7 @@ enum PropertyOverrideFlag {
|
|||
* created for it, and no attempt to restore the data from linked reference either.
|
||||
*
|
||||
* WARNING: This flag should be used with a lot of caution, as it completely bypasses override
|
||||
* system. It is currently only used for ID's names, since we cannot prevent local override to
|
||||
* system. It is used for example for ID's names, since we cannot prevent local override to
|
||||
* get a different name from the linked reference, and ID names are 'rna name property' (i.e. are
|
||||
* used in overrides of collections of IDs). See also `BKE_lib_override_library_update()` where
|
||||
* we deal manually with the value of that property at DNA level. */
|
||||
|
|
|
|||
|
|
@ -772,6 +772,26 @@ static PointerRNA rna_AttributeGroupID_new(
|
|||
*bke::custom_data_type_to_attr_type(eCustomDataType(type)),
|
||||
bke::Attribute::ArrayData::from_default_value(cpp_type, domain_size));
|
||||
|
||||
if (owner.type() == AttributeOwnerType::Mesh) {
|
||||
Mesh *mesh = owner.get_mesh();
|
||||
if (ELEM(attr.data_type(), bke::AttrType::ColorFloat, bke::AttrType::ColorByte)) {
|
||||
if (!mesh->active_color_attribute) {
|
||||
BKE_id_attributes_active_color_set(id, attr.name());
|
||||
}
|
||||
if (!mesh->default_color_attribute) {
|
||||
BKE_id_attributes_default_color_set(id, attr.name());
|
||||
}
|
||||
}
|
||||
if (ELEM(attr.data_type(), bke::AttrType::Float2)) {
|
||||
if (mesh->active_uv_map_name().is_empty()) {
|
||||
mesh->uv_maps_active_set(attr.name());
|
||||
}
|
||||
if (mesh->default_uv_map_name().is_empty()) {
|
||||
mesh->uv_maps_default_set(attr.name());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DEG_id_tag_update(id, ID_RECALC_GEOMETRY);
|
||||
WM_main_add_notifier(NC_GEOM | ND_DATA, id);
|
||||
|
||||
|
|
|
|||
|
|
@ -877,9 +877,9 @@ static void rna_def_nlastrip(BlenderRNA *brna)
|
|||
"property instead.");
|
||||
RNA_def_property_update(
|
||||
prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update");
|
||||
/* The `..._ui` properties should NOT be considered for library overrides, as they are meant to
|
||||
* have different behavior than when setting their non-`..._ui` counterparts. */
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
|
||||
/* The `..._ui` properties should NOT be considered for library overrides. But they should *act*
|
||||
* as if they are a overridable property since from a user perspective they are. */
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_IGNORE);
|
||||
|
||||
prop = RNA_def_property(srna, "frame_end_ui", PROP_FLOAT, PROP_TIME);
|
||||
RNA_def_property_float_sdna(prop, nullptr, "end");
|
||||
|
|
@ -892,9 +892,9 @@ static void rna_def_nlastrip(BlenderRNA *brna)
|
|||
"changed, see the \"frame_end\" property instead.");
|
||||
RNA_def_property_update(
|
||||
prop, NC_ANIMATION | ND_NLA | NA_EDITED, "rna_NlaStrip_transform_update");
|
||||
/* The `..._ui` properties should NOT be considered for library overrides, as they are meant to
|
||||
* have different behavior than when setting their non-`..._ui` counterparts. */
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_NO_COMPARISON);
|
||||
/* The `..._ui` properties should NOT be considered for library overrides. But they should *act*
|
||||
* as if they are a overridable property since from a user perspective they are. */
|
||||
RNA_def_property_override_flag(prop, PROPOVERRIDE_IGNORE);
|
||||
|
||||
/* Blending */
|
||||
prop = RNA_def_property(srna, "blend_in", PROP_FLOAT, PROP_NONE);
|
||||
|
|
|
|||
|
|
@ -68,6 +68,39 @@ class TestCurves(unittest.TestCase):
|
|||
self.assertTrue(self.curves.attributes["a" * 100].name == "a" * 100)
|
||||
|
||||
|
||||
class TestMesh(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.mesh = bpy.data.meshes.new("test")
|
||||
self.mesh.vertices.add(10)
|
||||
|
||||
def tearDown(self):
|
||||
bpy.data.meshes.remove(self.mesh)
|
||||
del self.mesh
|
||||
|
||||
def test_set_active_color_attribute_if_empty(self):
|
||||
self.assertTrue(self.mesh.attributes.active_color_name == "")
|
||||
self.assertTrue(self.mesh.attributes.default_color_name == "")
|
||||
|
||||
self.mesh.attributes.new("a", 'FLOAT_COLOR', 'POINT')
|
||||
self.assertTrue(self.mesh.attributes.active_color_name == "a")
|
||||
self.assertTrue(self.mesh.attributes.default_color_name == "a")
|
||||
|
||||
self.mesh.attributes.new("b", 'FLOAT_COLOR', 'POINT')
|
||||
self.assertTrue(self.mesh.attributes.active_color_name == "a")
|
||||
self.assertTrue(self.mesh.attributes.default_color_name == "a")
|
||||
|
||||
def test_set_active_uv_map_if_empty(self):
|
||||
self.assertTrue(self.mesh.uv_layers.active is None)
|
||||
|
||||
self.mesh.attributes.new("a", 'FLOAT2', 'CORNER')
|
||||
self.assertTrue(self.mesh.uv_layers.active is not None)
|
||||
self.assertTrue(self.mesh.uv_layers.active.name == "a")
|
||||
|
||||
self.mesh.attributes.new("b", 'FLOAT2', 'CORNER')
|
||||
self.assertTrue(self.mesh.uv_layers.active is not None)
|
||||
self.assertTrue(self.mesh.uv_layers.active.name == "a")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
sys.argv = [__file__] + (sys.argv[sys.argv.index("--") + 1:] if "--" in sys.argv else [])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue