Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_nodes.cc
| Show First 20 Lines • Show All 108 Lines • ▼ Show 20 Lines | |||||
| using blender::MutableSpan; | using blender::MutableSpan; | ||||
| using blender::Set; | using blender::Set; | ||||
| using blender::Span; | using blender::Span; | ||||
| using blender::Stack; | using blender::Stack; | ||||
| using blender::StringRef; | using blender::StringRef; | ||||
| using blender::StringRefNull; | using blender::StringRefNull; | ||||
| using blender::Vector; | using blender::Vector; | ||||
| using blender::bke::AttributeMetaData; | using blender::bke::AttributeMetaData; | ||||
| using blender::bke::AttributeValidator; | |||||
| using blender::fn::Field; | using blender::fn::Field; | ||||
| using blender::fn::FieldOperation; | |||||
| using blender::fn::GField; | using blender::fn::GField; | ||||
| using blender::fn::ValueOrField; | using blender::fn::ValueOrField; | ||||
| using blender::fn::ValueOrFieldCPPType; | using blender::fn::ValueOrFieldCPPType; | ||||
| using blender::nodes::FieldInferencingInterface; | using blender::nodes::FieldInferencingInterface; | ||||
| using blender::nodes::GeoNodeExecParams; | using blender::nodes::GeoNodeExecParams; | ||||
| using blender::nodes::InputSocketFieldType; | using blender::nodes::InputSocketFieldType; | ||||
| using blender::nodes::geo_eval_log::GeoModifierLog; | using blender::nodes::geo_eval_log::GeoModifierLog; | ||||
| using blender::threading::EnumerableThreadSpecific; | using blender::threading::EnumerableThreadSpecific; | ||||
| ▲ Show 20 Lines • Show All 915 Lines • ▼ Show 20 Lines | for (const auto item : outputs_by_domain.items()) { | ||||
| if (!attributes.domain_supported(domain)) { | if (!attributes.domain_supported(domain)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| const int domain_size = attributes.domain_size(domain); | const int domain_size = attributes.domain_size(domain); | ||||
| blender::bke::GeometryFieldContext field_context{component, domain}; | blender::bke::GeometryFieldContext field_context{component, domain}; | ||||
| blender::fn::FieldEvaluator field_evaluator{field_context, domain_size}; | blender::fn::FieldEvaluator field_evaluator{field_context, domain_size}; | ||||
| for (const OutputAttributeInfo &output_info : outputs_info) { | for (const OutputAttributeInfo &output_info : outputs_info) { | ||||
| const CPPType &type = output_info.field.cpp_type(); | const CPPType &type = output_info.field.cpp_type(); | ||||
| const AttributeValidator validator = attributes.lookup_validator(output_info.name); | |||||
| OutputAttributeToStore store{ | OutputAttributeToStore store{ | ||||
| component_type, | component_type, | ||||
| domain, | domain, | ||||
| output_info.name, | output_info.name, | ||||
| GMutableSpan{ | GMutableSpan{ | ||||
| type, MEM_malloc_arrayN(domain_size, type.size(), __func__), domain_size}}; | type, MEM_malloc_arrayN(domain_size, type.size(), __func__), domain_size}}; | ||||
| field_evaluator.add_with_destination(output_info.field, store.data); | GField field = validator.validate_field_if_necessary(output_info.field); | ||||
| field_evaluator.add_with_destination(std::move(field), store.data); | |||||
| attributes_to_store.append(store); | attributes_to_store.append(store); | ||||
| } | } | ||||
| field_evaluator.evaluate(); | field_evaluator.evaluate(); | ||||
| } | } | ||||
| } | } | ||||
| return attributes_to_store; | return attributes_to_store; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 691 Lines • ▼ Show 20 Lines | static void internal_dependencies_panel_draw(const bContext *UNUSED(C), Panel *panel) | ||||
| NodesModifierData *nmd = static_cast<NodesModifierData *>(ptr->data); | NodesModifierData *nmd = static_cast<NodesModifierData *>(ptr->data); | ||||
| GeoTreeLog *tree_log = get_root_tree_log(*nmd); | GeoTreeLog *tree_log = get_root_tree_log(*nmd); | ||||
| if (tree_log == nullptr) { | if (tree_log == nullptr) { | ||||
| return; | return; | ||||
| } | } | ||||
| tree_log->ensure_used_named_attributes(); | tree_log->ensure_used_named_attributes(); | ||||
| const Map<std::string, NamedAttributeUsage> &usage_by_attribute = | const Map<StringRefNull, NamedAttributeUsage> &usage_by_attribute = | ||||
| tree_log->used_named_attributes; | tree_log->used_named_attributes; | ||||
| if (usage_by_attribute.is_empty()) { | if (usage_by_attribute.is_empty()) { | ||||
| uiItemL(layout, IFACE_("No named attributes used"), ICON_INFO); | uiItemL(layout, IFACE_("No named attributes used"), ICON_INFO); | ||||
| return; | return; | ||||
| } | } | ||||
| struct NameWithUsage { | struct NameWithUsage { | ||||
| ▲ Show 20 Lines • Show All 161 Lines • Show Last 20 Lines | |||||