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>2021-09-24 17:02:59 +0300
committerJacques Lucke <jacques@blender.org>2021-09-24 17:03:07 +0300
commit95ec6e4dd373f58eebf3119e470ead4156c724b4 (patch)
treef036e0d85b20397b8089aea8129d0c277015c8f6 /source/blender/nodes
parent1a1c54612472fd28e4c23b695aa73bd7f81ffeaf (diff)
Geometry Nodes: make index field more reusable
Some inputs will be the index field implicitly, so we want this class to be available outside of `node_geo_input_index.cc`.
Diffstat (limited to 'source/blender/nodes')
-rw-r--r--source/blender/nodes/geometry/nodes/node_geo_input_index.cc20
1 files changed, 1 insertions, 19 deletions
diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_index.cc b/source/blender/nodes/geometry/nodes/node_geo_input_index.cc
index f18b0ab090a..7fcbaf429dd 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_input_index.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_input_index.cc
@@ -23,27 +23,9 @@ static void geo_node_input_index_declare(NodeDeclarationBuilder &b)
b.add_output<decl::Int>("Index").field_source();
}
-class IndexFieldInput final : public fn::FieldInput {
- public:
- IndexFieldInput() : FieldInput(CPPType::get<int>(), "Index")
- {
- }
-
- const GVArray *get_varray_for_context(const fn::FieldContext &UNUSED(context),
- IndexMask mask,
- ResourceScope &scope) const final
- {
- /* TODO: Investigate a similar method to IndexRange::as_span() */
- auto index_func = [](int i) { return i; };
- return &scope.construct<
- fn::GVArray_For_EmbeddedVArray<int, VArray_For_Func<int, decltype(index_func)>>>(
- mask.min_array_size(), mask.min_array_size(), index_func);
- }
-};
-
static void geo_node_input_index_exec(GeoNodeExecParams params)
{
- Field<int> index_field{std::make_shared<IndexFieldInput>()};
+ Field<int> index_field{std::make_shared<fn::IndexFieldInput>()};
params.set_output("Index", std::move(index_field));
}