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:
authorJacques Lucke <jacques@blender.org>2020-12-09 18:20:48 +0300
committerJacques Lucke <jacques@blender.org>2020-12-09 18:20:57 +0300
commit4a5f36638b0244b586607e76451669ffbc3c1174 (patch)
treec38ffdd8035e029b0c0451d91336b58fdf6bdffe /source/blender/nodes/NOD_geometry_exec.hh
parent25e151cc34715f4f27f2cecad252b02d1498ba15 (diff)
Geometry Nodes: simplify supporting different input socket types for attributes
This is a non-functional change. The functionality introduced in this commit is not used in master yet. It is used by nodes that are being developed in other branches though.
Diffstat (limited to 'source/blender/nodes/NOD_geometry_exec.hh')
-rw-r--r--source/blender/nodes/NOD_geometry_exec.hh20
1 files changed, 20 insertions, 0 deletions
diff --git a/source/blender/nodes/NOD_geometry_exec.hh b/source/blender/nodes/NOD_geometry_exec.hh
index fde576d7429..a7df4bc3e1b 100644
--- a/source/blender/nodes/NOD_geometry_exec.hh
+++ b/source/blender/nodes/NOD_geometry_exec.hh
@@ -148,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;