Changeset View
Changeset View
Standalone View
Standalone View
source/blender/nodes/NOD_geometry_exec.hh
| Show First 20 Lines • Show All 123 Lines • ▼ Show 20 Lines | template<typename T> Vector<T> extract_multi_input(StringRef identifier) | ||||
| while (true) { | while (true) { | ||||
| std::string sub_identifier = identifier; | std::string sub_identifier = identifier; | ||||
| if (index > 0) { | if (index > 0) { | ||||
| sub_identifier += "[" + std::to_string(index) + "]"; | sub_identifier += "[" + std::to_string(index) + "]"; | ||||
| } | } | ||||
| if (!input_values_.contains(sub_identifier)) { | if (!input_values_.contains(sub_identifier)) { | ||||
| break; | break; | ||||
| } | } | ||||
| values.append(input_values_.extract<T>(sub_identifier)); | values.append(input_values_.extract<T>(sub_identifier)); | ||||
| index++; | index++; | ||||
JacquesLucke: Moving from a const value doesn't really make sense usually.
Why is this change necessary? | |||||
Done Inline ActionsAgh, turns out the first part wasn't necessary, it's just adding the second template parameter that does it. values.append(input_values_.extract<T, StringRef>(sub_identifier)); HooglyBoogly: Agh, turns out the first part wasn't necessary, it's just adding the second template parameter… | |||||
| } | } | ||||
| return values; | return values; | ||||
| } | } | ||||
| /** | /** | ||||
| * Get the input value for the input socket with the given identifier. | * Get the input value for the input socket with the given identifier. | ||||
| */ | */ | ||||
| template<typename T> const T &get_input(StringRef identifier) const | template<typename T> const T &get_input(StringRef identifier) const | ||||
| { | { | ||||
| #ifdef DEBUG | #ifdef DEBUG | ||||
| this->check_extract_input(identifier, &CPPType::get<T>()); | this->check_extract_input(identifier, &CPPType::get<T>()); | ||||
| #endif | #endif | ||||
| return input_values_.lookup<T>(identifier); | return input_values_.lookup<T>(identifier); | ||||
| } | } | ||||
| /** | /** | ||||
| * Get input as vector for multi input socket with the given identifier. | |||||
| */ | |||||
| template<typename T> Vector<T> get_multi_input(StringRef identifier) | |||||
| { | |||||
| Vector<T> values; | |||||
| int index = 0; | |||||
| while (true) { | |||||
| std::string sub_identifier = identifier; | |||||
| if (index > 0) { | |||||
| sub_identifier += "[" + std::to_string(index) + "]"; | |||||
| } | |||||
| if (!input_values_.contains(sub_identifier)) { | |||||
| break; | |||||
| } | |||||
| values.append(input_values_.lookup<T>(sub_identifier)); | |||||
| index++; | |||||
| } | |||||
| return values; | |||||
| } | |||||
| /** | |||||
| * Move-construct a new value based on the given value and store it for the given socket | * Move-construct a new value based on the given value and store it for the given socket | ||||
| * identifier. | * identifier. | ||||
| */ | */ | ||||
| void set_output_by_move(StringRef identifier, GMutablePointer value) | void set_output_by_move(StringRef identifier, GMutablePointer value) | ||||
| { | { | ||||
| #ifdef DEBUG | #ifdef DEBUG | ||||
| BLI_assert(value.type() != nullptr); | BLI_assert(value.type() != nullptr); | ||||
| BLI_assert(value.get() != nullptr); | BLI_assert(value.get() != nullptr); | ||||
| ▲ Show 20 Lines • Show All 100 Lines • Show Last 20 Lines | |||||
Moving from a const value doesn't really make sense usually.
Why is this change necessary?