diff options
author | Jacques Lucke <jacques@blender.org> | 2021-12-06 21:05:29 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-12-06 21:13:24 +0300 |
commit | 2d4c7fa896ab4a6de163cd33746b54e67c7f8bac (patch) | |
tree | 71a0839f33a68172b15594dc76b83fe05315c273 /source/blender/functions | |
parent | 2814740f5be86fc389ba82ffbb3a40c43f47a9f5 (diff) |
Geometry Nodes: reduce code duplication with new GeometyrFieldInput
Most of our field inputs are currently specific to geometry. This patch introduces
a new `GeometryFieldInput` that reduces the overhead of adding new geometry
field input.
Differential Revision: https://developer.blender.org/D13489
Diffstat (limited to 'source/blender/functions')
-rw-r--r-- | source/blender/functions/FN_field.hh | 2 | ||||
-rw-r--r-- | source/blender/functions/intern/field.cc | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/functions/FN_field.hh b/source/blender/functions/FN_field.hh index 28bb120bb17..da8e820c42a 100644 --- a/source/blender/functions/FN_field.hh +++ b/source/blender/functions/FN_field.hh @@ -440,7 +440,7 @@ class IndexFieldInput final : public FieldInput { public: IndexFieldInput(); - static GVArray get_index_varray(IndexMask mask, ResourceScope &scope); + static GVArray get_index_varray(IndexMask mask); GVArray get_varray_for_context(const FieldContext &context, IndexMask mask, diff --git a/source/blender/functions/intern/field.cc b/source/blender/functions/intern/field.cc index 297df3c15cf..27f213f2ba3 100644 --- a/source/blender/functions/intern/field.cc +++ b/source/blender/functions/intern/field.cc @@ -531,7 +531,7 @@ IndexFieldInput::IndexFieldInput() : FieldInput(CPPType::get<int>(), "Index") category_ = Category::Generated; } -GVArray IndexFieldInput::get_index_varray(IndexMask mask, ResourceScope &UNUSED(scope)) +GVArray IndexFieldInput::get_index_varray(IndexMask mask) { auto index_func = [](int i) { return i; }; return VArray<int>::ForFunc(mask.min_array_size(), index_func); @@ -539,10 +539,10 @@ GVArray IndexFieldInput::get_index_varray(IndexMask mask, ResourceScope &UNUSED( GVArray IndexFieldInput::get_varray_for_context(const fn::FieldContext &UNUSED(context), IndexMask mask, - ResourceScope &scope) const + ResourceScope &UNUSED(scope)) const { /* TODO: Investigate a similar method to IndexRange::as_span() */ - return get_index_varray(mask, scope); + return get_index_varray(mask); } uint64_t IndexFieldInput::hash() const |