From a51ff5208b47254122eefb4ed9cc832fb4885012 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 27 Jan 2021 15:00:27 +0100 Subject: Fix alpha transparency slider range being influenced by RGB values For buttons that edit array properties, the soft min/max and slider ranges are based on the range of all values in the array. However for alpha this does not make much sense, the only reasonable range is 0..1 even when there are RGB values larger than 1. So treat alpha as an individual property. --- source/blender/editors/interface/interface.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 7340a373573..319ae385ffc 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -3201,6 +3201,7 @@ void ui_but_range_set_soft(uiBut *but) if (but->rnaprop) { const PropertyType type = RNA_property_type(but->rnaprop); + const PropertySubType subtype = RNA_property_subtype(but->rnaprop); double softmin, softmax /*, step, precision*/; double value_min; double value_max; @@ -3224,7 +3225,7 @@ void ui_but_range_set_soft(uiBut *but) value_max = (double)value_range[1]; } else { - value_min = value_max = (double)RNA_property_int_get(&but->rnapoin, but->rnaprop); + value_min = value_max = ui_but_value_get(but); } } else if (type == PROP_FLOAT) { @@ -3237,14 +3238,15 @@ void ui_but_range_set_soft(uiBut *but) /*step = fstep;*/ /*UNUSED*/ /*precision = fprecision;*/ /*UNUSED*/ - if (is_array) { + /* Use shared min/max for array values, except for color alpha. */ + if (is_array && !(subtype == PROP_COLOR && but->rnaindex == 3)) { float value_range[2]; RNA_property_float_get_array_range(&but->rnapoin, but->rnaprop, value_range); value_min = (double)value_range[0]; value_max = (double)value_range[1]; } else { - value_min = value_max = (double)RNA_property_float_get(&but->rnapoin, but->rnaprop); + value_min = value_max = ui_but_value_get(but); } } else { -- cgit v1.2.3 From 133966423aa61f614541ef910c34aea3d2275057 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 28 Jan 2021 13:14:29 +0100 Subject: Revert "Depsgraph: Remove redundant copy-on-write operations" This reverts commit 76fd41e9db19dd2a33fae0e690f76792b13d49ed. This should have been reverted along with 0f95f51361d73fbd8ba8d80b3b65da930dcf3b20, since this change by itself is causing crashes when the depsgraph accesses a non-existent copy-on-write component. Ref T84717 --- source/blender/depsgraph/intern/builder/deg_builder_nodes.cc | 7 ++++--- source/blender/depsgraph/intern/builder/deg_builder_relations.cc | 6 ------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc index a109c5d8d88..dcdf2f48607 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.cc @@ -155,7 +155,6 @@ IDNode *DepsgraphNodeBuilder::add_id_node(ID *id) { BLI_assert(id->session_uuid != MAIN_ID_SESSION_UUID_UNSET); - const ID_Type id_type = GS(id->name); IDNode *id_node = nullptr; ID *id_cow = nullptr; IDComponentsMask previously_visible_components_mask = 0; @@ -174,8 +173,10 @@ IDNode *DepsgraphNodeBuilder::add_id_node(ID *id) id_node->previously_visible_components_mask = previously_visible_components_mask; id_node->previous_eval_flags = previous_eval_flags; id_node->previous_customdata_masks = previous_customdata_masks; - /* NOTE: Zero number of components indicates that ID node was just created. */ - if (id_node->components.is_empty() && deg_copy_on_write_is_needed(id_type)) { + /* Currently all ID nodes are supposed to have copy-on-write logic. + * + * NOTE: Zero number of components indicates that ID node was just created. */ + if (id_node->components.is_empty()) { ComponentNode *comp_cow = id_node->add_component(NodeType::COPY_ON_WRITE); OperationNode *op_cow = comp_cow->add_operation( function_bind(deg_evaluate_copy_on_write, _1, id_node), diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc index 5f591b4aee0..fcaa3854d37 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.cc @@ -2788,13 +2788,7 @@ void DepsgraphRelationBuilder::build_nested_shapekey(ID *owner, Key *key) void DepsgraphRelationBuilder::build_copy_on_write_relations(IDNode *id_node) { ID *id_orig = id_node->id_orig; - const ID_Type id_type = GS(id_orig->name); - - if (!deg_copy_on_write_is_needed(id_type)) { - return; - } - TimeSourceKey time_source_key; OperationKey copy_on_write_key(id_orig, NodeType::COPY_ON_WRITE, OperationCode::COPY_ON_WRITE); /* XXX: This is a quick hack to make Alt-A to work. */ -- cgit v1.2.3 From fcb7b0adcc843f2dd90ba4175d6008c35ed3168f Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Thu, 28 Jan 2021 17:03:34 +0100 Subject: Fix T85157: join node not working when the second mesh is empty The issue was that the `offset` in `dst_span[offset]` was out of bounds when the domain size is 0. The fix is to simply skip copying attributes in that case. --- source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc b/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc index 67bc095fa31..42402e23fa5 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_join_geometry.cc @@ -163,6 +163,9 @@ static void fill_new_attribute(Span src_components, int offset = 0; for (const GeometryComponent *component : src_components) { const int domain_size = component->attribute_domain_size(domain); + if (domain_size == 0) { + continue; + } ReadAttributePtr read_attribute = component->attribute_get_for_read( attribute_name, domain, data_type, nullptr); -- cgit v1.2.3 From 2f60e5d1b56dfb8c9104f4652e5cfa5914e58bd7 Mon Sep 17 00:00:00 2001 From: Dalai Felinto Date: Thu, 28 Jan 2021 22:44:20 +0100 Subject: Cleanup: Move geonodes object info RNA enum This enum is only used by the node. So it does not need to be declared outside the scope of its function. Originally I thought this may be relevant to the collection info node as well, but the patch for it is defining its own enums. --- source/blender/makesrna/intern/rna_nodetree.c | 33 ++++++++++++++------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 1cd3593e4a4..5afc892820c 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -494,22 +494,6 @@ static const EnumPropertyItem rna_node_geometry_attribute_input_type_items_no_bo {0, NULL, 0, NULL, NULL}, }; -static const EnumPropertyItem rna_node_geometry_object_info_transform_space_items[] = { - {GEO_NODE_TRANSFORM_SPACE_ORIGINAL, - "ORIGINAL", - 0, - "Original", - "Output the geometry relative to the input object transform, and the location, rotation and " - "scale relative to the world origin"}, - {GEO_NODE_TRANSFORM_SPACE_RELATIVE, - "RELATIVE", - 0, - "Relative", - "Bring the input object geometry, location, rotation and scale into the modified object, " - "maintaining the relative position between the two objects in the scene"}, - {0, NULL, 0, NULL, NULL}, -}; - #endif #undef ITEM_ATTRIBUTE @@ -8866,6 +8850,23 @@ static void def_geo_object_info(StructRNA *srna) { PropertyRNA *prop; + static const EnumPropertyItem rna_node_geometry_object_info_transform_space_items[] = { + {GEO_NODE_TRANSFORM_SPACE_ORIGINAL, + "ORIGINAL", + 0, + "Original", + "Output the geometry relative to the input object transform, and the location, rotation " + "and " + "scale relative to the world origin"}, + {GEO_NODE_TRANSFORM_SPACE_RELATIVE, + "RELATIVE", + 0, + "Relative", + "Bring the input object geometry, location, rotation and scale into the modified object, " + "maintaining the relative position between the two objects in the scene"}, + {0, NULL, 0, NULL, NULL}, + }; + RNA_def_struct_sdna_from(srna, "NodeGeometryObjectInfo", "storage"); prop = RNA_def_property(srna, "transform_space", PROP_ENUM, PROP_NONE); -- cgit v1.2.3