Changeset View
Changeset View
Standalone View
Standalone View
source/blender/modifiers/intern/MOD_nodes.cc
| Show First 20 Lines • Show All 345 Lines • ▼ Show 20 Lines | Vector<GMutablePointer> get_input_values(const DInputSocket socket_to_compute) | ||||
| 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) | ||||
| { | { | ||||
| Vector<GMutablePointer> values; | Vector<GMutablePointer> values; | ||||
| for (const int i : from_sockets.index_range()) { | for (const int i : iter_indices(from_sockets)) { | ||||
| const DSocket from_socket = from_sockets[i]; | const DSocket from_socket = from_sockets[i]; | ||||
| const int first_occurence = from_sockets.take_front(i).first_index_try(from_socket); | const int first_occurence = from_sockets.take_front(i).first_index_try(from_socket); | ||||
| if (first_occurence == -1) { | if (first_occurence == -1) { | ||||
| values.append(this->get_input_from_incoming_link(socket_to_compute, from_socket)); | values.append(this->get_input_from_incoming_link(socket_to_compute, from_socket)); | ||||
| } | } | ||||
| else { | else { | ||||
| /* If the same from-socket occurs more than once, we make a copy of the first value. This | /* If the same from-socket occurs more than once, we make a copy of the first value. This | ||||
| * can happen when a node linked to a multi-input-socket is muted. */ | * can happen when a node linked to a multi-input-socket is muted. */ | ||||
| ▲ Show 20 Lines • Show All 139 Lines • ▼ Show 20 Lines | for (const OutputSocketRef *socket_ref : node->outputs()) { | ||||
| output_data.append(GMutablePointer(type, buffer)); | output_data.append(GMutablePointer(type, buffer)); | ||||
| } | } | ||||
| } | } | ||||
| fn.call(IndexRange(1), fn_params, fn_context); | fn.call(IndexRange(1), fn_params, fn_context); | ||||
| for (GMutablePointer value : input_data) { | for (GMutablePointer value : input_data) { | ||||
| value.destruct(); | value.destruct(); | ||||
| } | } | ||||
| int output_index = 0; | int output_index = 0; | ||||
| for (const int i : node->outputs().index_range()) { | for (const int i : iter_indices(node->outputs())) { | ||||
| if (node->output(i).is_available()) { | if (node->output(i).is_available()) { | ||||
| GMutablePointer value = output_data[output_index]; | GMutablePointer value = output_data[output_index]; | ||||
| params.set_output_by_move(node->output(i).identifier(), value); | params.set_output_by_move(node->output(i).identifier(), value); | ||||
| value.destruct(); | value.destruct(); | ||||
| output_index++; | output_index++; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,094 Lines • Show Last 20 Lines | |||||