Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_nodes.cc
| Show First 20 Lines • Show All 373 Lines • ▼ Show 20 Lines | for (const DOutputSocket *output_socket : node.outputs()) { | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| void execute_node(const DNode &node, GeoNodeExecParams params) | void execute_node(const DNode &node, GeoNodeExecParams params) | ||||
| { | { | ||||
| const bNode &bnode = params.node(); | const bNode &bnode = params.node(); | ||||
| this->store_ui_hints(node, params); | |||||
| /* Use the geometry-node-execute callback if it exists. */ | /* Use the geometry-node-execute callback if it exists. */ | ||||
| if (bnode.typeinfo->geometry_node_execute != nullptr) { | if (bnode.typeinfo->geometry_node_execute != nullptr) { | ||||
| bnode.typeinfo->geometry_node_execute(params); | bnode.typeinfo->geometry_node_execute(params); | ||||
| return; | return; | ||||
| } | } | ||||
| /* Use the multi-function implementation if it exists. */ | /* Use the multi-function implementation if it exists. */ | ||||
| const MultiFunction *multi_function = mf_by_node_.lookup_default(&node, nullptr); | const MultiFunction *multi_function = mf_by_node_.lookup_default(&node, nullptr); | ||||
| if (multi_function != nullptr) { | if (multi_function != nullptr) { | ||||
| this->execute_multi_function_node(node, params, *multi_function); | this->execute_multi_function_node(node, params, *multi_function); | ||||
| return; | return; | ||||
| } | } | ||||
| /* Just output default values if no implementation exists. */ | /* Just output default values if no implementation exists. */ | ||||
| this->execute_unknown_node(node, params); | this->execute_unknown_node(node, params); | ||||
| } | } | ||||
| void store_ui_hints(const DNode &node, GeoNodeExecParams params) const | |||||
| { | |||||
| for (const DInputSocket *dsocket : node.inputs()) { | |||||
| if (!dsocket->is_available()) { | |||||
| continue; | |||||
| } | |||||
| if (dsocket->bsocket()->type != SOCK_GEOMETRY) { | |||||
| continue; | |||||
| } | |||||
| bNodeTree *btree_cow = node.node_ref().tree().btree(); | |||||
| bNodeTree *btree_original = (bNodeTree *)DEG_get_original_id((ID *)btree_cow); | |||||
| const NodeTreeEvaluationContext context(*self_object_, *modifier_); | |||||
| const GeometrySet &geometry_set = params.get_input<GeometrySet>(dsocket->identifier()); | |||||
| const Vector<const GeometryComponent *> components = geometry_set.get_components_for_read(); | |||||
| for (const GeometryComponent *component : components) { | |||||
| for (StringRef attribute_name : component->attribute_names()) { | |||||
| BKE_nodetree_attribute_hint_add(*btree_original, context, *node.bnode(), attribute_name); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| void execute_multi_function_node(const DNode &node, | void execute_multi_function_node(const DNode &node, | ||||
| GeoNodeExecParams params, | GeoNodeExecParams params, | ||||
| const MultiFunction &fn) | const MultiFunction &fn) | ||||
| { | { | ||||
| MFContextBuilder fn_context; | MFContextBuilder fn_context; | ||||
| MFParamsBuilder fn_params{fn, 1}; | MFParamsBuilder fn_params{fn, 1}; | ||||
| Vector<GMutablePointer> input_data; | Vector<GMutablePointer> input_data; | ||||
| for (const DInputSocket *dsocket : node.inputs()) { | for (const DInputSocket *dsocket : node.inputs()) { | ||||
| ▲ Show 20 Lines • Show All 911 Lines • Show Last 20 Lines | |||||