Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_nodes.cc
| Show First 20 Lines • Show All 298 Lines • ▼ Show 20 Lines | public: | ||||
| } | } | ||||
| private: | private: | ||||
| Vector<GMutablePointer> get_input_values(const DInputSocket socket_to_compute) | Vector<GMutablePointer> get_input_values(const DInputSocket socket_to_compute) | ||||
| { | { | ||||
| Vector<DSocket> from_sockets; | Vector<DSocket> from_sockets; | ||||
| socket_to_compute.foreach_origin_socket([&](DSocket socket) { from_sockets.append(socket); }); | socket_to_compute.foreach_origin_socket([&](DSocket socket) { from_sockets.append(socket); }); | ||||
| /* Multi-input sockets contain a vector of inputs. */ | |||||
| if (socket_to_compute->is_multi_input_socket()) { | |||||
| return this->get_inputs_from_incoming_links(socket_to_compute, from_sockets); | |||||
| } | |||||
| if (from_sockets.is_empty()) { | if (from_sockets.is_empty()) { | ||||
| /* The input is not connected, use the value from the socket itself. */ | /* The input is not connected, use the value from the socket itself. */ | ||||
| const CPPType &type = *blender::nodes::socket_cpp_type_get(*socket_to_compute->typeinfo()); | const CPPType &type = *blender::nodes::socket_cpp_type_get(*socket_to_compute->typeinfo()); | ||||
| return {get_unlinked_input_value(socket_to_compute, type)}; | return {get_unlinked_input_value(socket_to_compute, type)}; | ||||
| } | } | ||||
fabian_schempp: @JacquesLucke You had concerns about this change before but for other sockets then geometry it… | |||||
Done Inline ActionsIt's more fine for input sockets that have a value. Is there a way to say that such a multi-input has no inputs (i.e. the vector is empty)? It's not really needed for this specific socket, but might be useful for others maybe? JacquesLucke: It's more fine for input sockets that have a value. Is there a way to say that such a multi… | |||||
| /* Multi-input sockets contain a vector of inputs. */ | |||||
| if (socket_to_compute->is_multi_input_socket()) { | |||||
| return this->get_inputs_from_incoming_links(socket_to_compute, from_sockets); | |||||
| } | |||||
| const DSocket from_socket = from_sockets[0]; | const DSocket from_socket = from_sockets[0]; | ||||
| GMutablePointer value = this->get_input_from_incoming_link(socket_to_compute, from_socket); | GMutablePointer value = this->get_input_from_incoming_link(socket_to_compute, from_socket); | ||||
| return {value}; | return {value}; | ||||
| } | } | ||||
| Vector<GMutablePointer> get_inputs_from_incoming_links(const DInputSocket socket_to_compute, | Vector<GMutablePointer> get_inputs_from_incoming_links(const DInputSocket socket_to_compute, | ||||
| const Span<DSocket> from_sockets) | const Span<DSocket> from_sockets) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 1,071 Lines • Show Last 20 Lines | |||||
@Jacques Lucke (JacquesLucke) You had concerns about this change before but for other sockets then geometry it seems nice to get the default value from the input field if no socket is connected.