Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_nodes.cc
| Show First 20 Lines • Show All 811 Lines • ▼ Show 20 Lines | if (use_attribute) { | ||||
| const StringRef attribute_name{IDP_String(property_attribute_name)}; | const StringRef attribute_name{IDP_String(property_attribute_name)}; | ||||
| if (!blender::bke::allow_procedural_attribute_access(attribute_name)) { | if (!blender::bke::allow_procedural_attribute_access(attribute_name)) { | ||||
| init_socket_cpp_value_from_property(*property, socket_data_type, r_value); | init_socket_cpp_value_from_property(*property, socket_data_type, r_value); | ||||
| return; | return; | ||||
| } | } | ||||
| auto attribute_input = std::make_shared<blender::bke::AttributeFieldInput>( | auto attribute_input = std::make_shared<blender::bke::AttributeFieldInput>( | ||||
| attribute_name, *socket_type.base_cpp_type); | attribute_name, *socket_type.base_cpp_type); | ||||
| GField attribute_field{std::move(attribute_input), 0}; | GField attribute_field{std::move(attribute_input), 0}; | ||||
| const blender::fn::ValueOrFieldCPPType *cpp_type = | const auto *value_or_field_cpp_type = ValueOrFieldCPPType::get_from_self( | ||||
| dynamic_cast<const blender::fn::ValueOrFieldCPPType *>( | *socket_type.geometry_nodes_cpp_type); | ||||
| socket_type.geometry_nodes_cpp_type); | BLI_assert(value_or_field_cpp_type != nullptr); | ||||
| BLI_assert(cpp_type != nullptr); | value_or_field_cpp_type->construct_from_field(r_value, std::move(attribute_field)); | ||||
| cpp_type->construct_from_field(r_value, std::move(attribute_field)); | |||||
| } | } | ||||
| else { | else { | ||||
| init_socket_cpp_value_from_property(*property, socket_data_type, r_value); | init_socket_cpp_value_from_property(*property, socket_data_type, r_value); | ||||
| } | } | ||||
| } | } | ||||
| static const lf::FunctionNode &find_viewer_lf_node(const bNode &viewer_bnode) | static const lf::FunctionNode &find_viewer_lf_node(const bNode &viewer_bnode) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 146 Lines • ▼ Show 20 Lines | if (attribute_name.is_empty()) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| if (!blender::bke::allow_procedural_attribute_access(attribute_name)) { | if (!blender::bke::allow_procedural_attribute_access(attribute_name)) { | ||||
| continue; | continue; | ||||
| } | } | ||||
| const int index = socket->index(); | const int index = socket->index(); | ||||
| const GPointer value = output_values[index]; | const GPointer value = output_values[index]; | ||||
| const ValueOrFieldCPPType *cpp_type = dynamic_cast<const ValueOrFieldCPPType *>(value.type()); | const auto *value_or_field_type = ValueOrFieldCPPType::get_from_self(*value.type()); | ||||
| BLI_assert(cpp_type != nullptr); | BLI_assert(value_or_field_type != nullptr); | ||||
| const GField field = cpp_type->as_field(value.get()); | const GField field = value_or_field_type->as_field(value.get()); | ||||
| const bNodeSocket *interface_socket = (const bNodeSocket *)BLI_findlink( | const bNodeSocket *interface_socket = (const bNodeSocket *)BLI_findlink( | ||||
| &nmd.node_group->outputs, index); | &nmd.node_group->outputs, index); | ||||
| const eAttrDomain domain = (eAttrDomain)interface_socket->attribute_domain; | const eAttrDomain domain = (eAttrDomain)interface_socket->attribute_domain; | ||||
| OutputAttributeInfo output_info; | OutputAttributeInfo output_info; | ||||
| output_info.field = std::move(field); | output_info.field = std::move(field); | ||||
| output_info.name = attribute_name; | output_info.name = attribute_name; | ||||
| outputs_by_domain.add(domain, std::move(output_info)); | outputs_by_domain.add(domain, std::move(output_info)); | ||||
| ▲ Show 20 Lines • Show All 920 Lines • Show Last 20 Lines | |||||