Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/nodes/NOD_geometry_exec.hh')
-rw-r--r--source/blender/nodes/NOD_geometry_exec.hh22
1 files changed, 22 insertions, 0 deletions
diff --git a/source/blender/nodes/NOD_geometry_exec.hh b/source/blender/nodes/NOD_geometry_exec.hh
index 2b95f76d06b..a7df4bc3e1b 100644
--- a/source/blender/nodes/NOD_geometry_exec.hh
+++ b/source/blender/nodes/NOD_geometry_exec.hh
@@ -26,6 +26,8 @@
namespace blender::nodes {
+using bke::Color4fReadAttribute;
+using bke::Color4fWriteAttribute;
using bke::Float3ReadAttribute;
using bke::Float3WriteAttribute;
using bke::FloatReadAttribute;
@@ -146,6 +148,26 @@ class GeoNodeExecParams {
return self_object_;
}
+ /**
+ * Creates a read-only attribute based on node inputs. The method automatically detects which
+ * input with the given name is available.
+ */
+ ReadAttributePtr get_input_attribute(const StringRef name,
+ const GeometryComponent &component,
+ const AttributeDomain domain,
+ const CustomDataType type,
+ const void *default_value) const;
+
+ template<typename T>
+ bke::TypedReadAttribute<T> get_input_attribute(const StringRef name,
+ const GeometryComponent &component,
+ const AttributeDomain domain,
+ const T &default_value) const
+ {
+ const CustomDataType type = bke::cpp_type_to_custom_data_type(CPPType::get<T>());
+ return this->get_input_attribute(name, component, domain, type, &default_value);
+ }
+
private:
/* Utilities for detecting common errors at when using this class. */
void check_extract_input(StringRef identifier, const CPPType *requested_type = nullptr) const;