Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/blenkernel/intern/attribute_access.cc')
-rw-r--r--source/blender/blenkernel/intern/attribute_access.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/attribute_access.cc b/source/blender/blenkernel/intern/attribute_access.cc
index bdf1891a55a..8c4f87be91f 100644
--- a/source/blender/blenkernel/intern/attribute_access.cc
+++ b/source/blender/blenkernel/intern/attribute_access.cc
@@ -190,7 +190,7 @@ AttributeDomain attribute_domain_highest_priority(Span<AttributeDomain> domains)
void OutputAttribute::save()
{
save_has_been_called_ = true;
- if (optional_span_varray_.has_value()) {
+ if (optional_span_varray_) {
optional_span_varray_->save();
}
if (save_) {
@@ -817,6 +817,12 @@ bool GeometryComponent::attribute_is_builtin(const blender::StringRef attribute_
return providers->builtin_attribute_providers().contains_as(attribute_name);
}
+bool GeometryComponent::attribute_is_builtin(const AttributeIDRef &attribute_id) const
+{
+ /* Anonymous attributes cannot be built-in. */
+ return attribute_id.is_named() && this->attribute_is_builtin(attribute_id.name());
+}
+
blender::bke::ReadAttributeLookup GeometryComponent::attribute_try_get_for_read(
const AttributeIDRef &attribute_id) const
{
@@ -1210,7 +1216,7 @@ static OutputAttribute create_output_attribute(GeometryComponent &component,
BLI_assert(cpp_type != nullptr);
const nodes::DataTypeConversions &conversions = nodes::get_implicit_type_conversions();
- if (attribute_id.is_named() && component.attribute_is_builtin(attribute_id.name())) {
+ if (component.attribute_is_builtin(attribute_id)) {
const StringRef attribute_name = attribute_id.name();
WriteAttributeLookup attribute = component.attribute_try_get_for_write(attribute_name);
if (!attribute) {
@@ -1315,7 +1321,9 @@ const GVArray *AttributeFieldInput::get_varray_for_context(const fn::FieldContex
const AttributeDomain domain = geometry_context->domain();
const CustomDataType data_type = cpp_type_to_custom_data_type(*type_);
GVArrayPtr attribute = component.attribute_try_get_for_read(name_, domain, data_type);
- return scope.add(std::move(attribute));
+ if (attribute) {
+ return scope.add(std::move(attribute));
+ }
}
return nullptr;
}