diff options
author | Hans Goudey <h.goudey@me.com> | 2021-09-06 18:39:05 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-09-06 18:39:05 +0300 |
commit | e70f9b0d0eb9e7e55310741a08a1d2002963b829 (patch) | |
tree | e0120d23afb8f7f224a8bdc7a02444ad07bc418f | |
parent | d2d10e63c97066e74512234e20eaeac999013b93 (diff) |
Cleanup: Rename functions
- "try" is not necessary / doesn't really make it clearer
- Fix incorrect name
8 files changed, 34 insertions, 34 deletions
diff --git a/source/blender/blenkernel/BKE_geometry_set.hh b/source/blender/blenkernel/BKE_geometry_set.hh index cd77d1570b9..d9da4b9fb01 100644 --- a/source/blender/blenkernel/BKE_geometry_set.hh +++ b/source/blender/blenkernel/BKE_geometry_set.hh @@ -618,9 +618,9 @@ class AttributeFieldInput : public fn::FieldInput { { } - const GVArray *try_get_varray_for_context(const fn::FieldContext &context, - IndexMask mask, - ResourceScope &scope) const override; + const GVArray *get_varray_for_context(const fn::FieldContext &context, + IndexMask mask, + ResourceScope &scope) const override; uint64_t hash() const override; bool is_equal_to(const fn::FieldNode &other) const override; @@ -636,9 +636,9 @@ class AnonymousAttributeFieldInput : public fn::FieldInput { { } - const GVArray *try_get_varray_for_context(const fn::FieldContext &context, - IndexMask mask, - ResourceScope &scope) const override; + const GVArray *get_varray_for_context(const fn::FieldContext &context, + IndexMask mask, + ResourceScope &scope) const override; uint64_t hash() const override; bool is_equal_to(const fn::FieldNode &other) const override; diff --git a/source/blender/blenkernel/intern/attribute_access.cc b/source/blender/blenkernel/intern/attribute_access.cc index 8416ca84340..08bd5dc5981 100644 --- a/source/blender/blenkernel/intern/attribute_access.cc +++ b/source/blender/blenkernel/intern/attribute_access.cc @@ -1303,9 +1303,9 @@ OutputAttribute GeometryComponent::attribute_try_get_for_output_only( namespace blender::bke { -const GVArray *AttributeFieldInput::try_get_varray_for_context(const fn::FieldContext &context, - IndexMask UNUSED(mask), - ResourceScope &scope) const +const GVArray *AttributeFieldInput::get_varray_for_context(const fn::FieldContext &context, + IndexMask UNUSED(mask), + ResourceScope &scope) const { if (const GeometryComponentFieldContext *geometry_context = dynamic_cast<const GeometryComponentFieldContext *>(&context)) { @@ -1331,7 +1331,7 @@ bool AttributeFieldInput::is_equal_to(const fn::FieldNode &other) const return false; } -const GVArray *AnonymousAttributeFieldInput::try_get_varray_for_context( +const GVArray *AnonymousAttributeFieldInput::get_varray_for_context( const fn::FieldContext &context, IndexMask UNUSED(mask), ResourceScope &scope) const { if (const GeometryComponentFieldContext *geometry_context = diff --git a/source/blender/functions/FN_field.hh b/source/blender/functions/FN_field.hh index e25903fb3ce..56bd9a43356 100644 --- a/source/blender/functions/FN_field.hh +++ b/source/blender/functions/FN_field.hh @@ -267,11 +267,11 @@ class FieldInput : public FieldNode { /** * Get the value of this specific input based on the given context. The returned virtual array, - * should live at least as long as the passed in #scope. + * should live at least as long as the passed in #scope. May return null. */ - virtual const GVArray *try_get_varray_for_context(const FieldContext &context, - IndexMask mask, - ResourceScope &scope) const = 0; + virtual const GVArray *get_varray_for_context(const FieldContext &context, + IndexMask mask, + ResourceScope &scope) const = 0; blender::StringRef debug_name() const { @@ -298,9 +298,9 @@ class FieldContext { public: ~FieldContext() = default; - virtual const GVArray *try_get_varray_for_context(const FieldInput &field_input, - IndexMask mask, - ResourceScope &scope) const; + virtual const GVArray *get_varray_for_input(const FieldInput &field_input, + IndexMask mask, + ResourceScope &scope) const; }; /** diff --git a/source/blender/functions/intern/field.cc b/source/blender/functions/intern/field.cc index c814ada29ac..042a12259c8 100644 --- a/source/blender/functions/intern/field.cc +++ b/source/blender/functions/intern/field.cc @@ -88,7 +88,7 @@ static Vector<const GVArray *> get_field_context_inputs( { Vector<const GVArray *> field_context_inputs; for (const FieldInput &field_input : field_inputs) { - const GVArray *varray = context.try_get_varray_for_context(field_input, mask, scope); + const GVArray *varray = context.get_varray_for_input(field_input, mask, scope); if (varray == nullptr) { const CPPType &type = field_input.cpp_type(); varray = &scope.construct<GVArray_For_SingleValueRef>( @@ -475,13 +475,13 @@ void evaluate_fields_to_spans(Span<GFieldRef> fields_to_evaluate, evaluate_fields(scope, fields_to_evaluate, mask, context, varrays); } -const GVArray *FieldContext::try_get_varray_for_context(const FieldInput &field_input, - IndexMask mask, - ResourceScope &scope) const +const GVArray *FieldContext::get_varray_for_input(const FieldInput &field_input, + IndexMask mask, + ResourceScope &scope) const { /* By default ask the field input to create the varray. Another field context might overwrite * the context here. */ - return field_input.try_get_varray_for_context(*this, mask, scope); + return field_input.get_varray_for_context(*this, mask, scope); } /* -------------------------------------------------------------------- diff --git a/source/blender/functions/tests/FN_field_test.cc b/source/blender/functions/tests/FN_field_test.cc index 54ef20fe322..81529c988c6 100644 --- a/source/blender/functions/tests/FN_field_test.cc +++ b/source/blender/functions/tests/FN_field_test.cc @@ -33,9 +33,9 @@ class IndexFieldInput final : public FieldInput { { } - const GVArray *try_get_varray_for_context(const FieldContext &UNUSED(context), - IndexMask mask, - ResourceScope &scope) const final + const GVArray *get_varray_for_context(const FieldContext &UNUSED(context), + IndexMask mask, + ResourceScope &scope) const final { auto index_func = [](int i) { return i; }; return &scope.construct< 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 2cba016d54c..e2287abe56c 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_index.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_index.cc @@ -29,9 +29,9 @@ class IndexFieldInput final : public fn::FieldInput { { } - const GVArray *try_get_varray_for_context(const fn::FieldContext &UNUSED(context), - IndexMask mask, - ResourceScope &scope) const final + 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; }; diff --git a/source/blender/nodes/geometry/nodes/node_geo_input_normal.cc b/source/blender/nodes/geometry/nodes/node_geo_input_normal.cc index 68b284ae671..e1e14eb367d 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_input_normal.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_input_normal.cc @@ -153,9 +153,9 @@ class NormalFieldInput final : public fn::FieldInput { { } - const GVArray *try_get_varray_for_context(const fn::FieldContext &context, - IndexMask mask, - ResourceScope &scope) const final + const GVArray *get_varray_for_context(const fn::FieldContext &context, + IndexMask mask, + ResourceScope &scope) const final { if (const GeometryComponentFieldContext *geometry_context = dynamic_cast<const GeometryComponentFieldContext *>(&context)) { diff --git a/source/blender/nodes/geometry/nodes/node_geo_point_translate.cc b/source/blender/nodes/geometry/nodes/node_geo_point_translate.cc index 6cc04770e0d..ad91cb2d377 100644 --- a/source/blender/nodes/geometry/nodes/node_geo_point_translate.cc +++ b/source/blender/nodes/geometry/nodes/node_geo_point_translate.cc @@ -63,9 +63,9 @@ class SpanFieldInput final : public fn::FieldInput { SpanFieldInput(GSpan span) : FieldInput(CPPType::get<float3>(), "Span"), span_(span) { } - const GVArray *try_get_varray_for_context(const fn::FieldContext &UNUSED(context), - IndexMask UNUSED(mask), - ResourceScope &scope) const final + const GVArray *get_varray_for_context(const fn::FieldContext &UNUSED(context), + IndexMask UNUSED(mask), + ResourceScope &scope) const final { return &scope.construct<fn::GVArray_For_GSpan>(__func__, span_); } |