Changeset View
Changeset View
Standalone View
Standalone View
source/blender/functions/intern/field.cc
| Show First 20 Lines • Show All 525 Lines • ▼ Show 20 Lines | GVArray FieldContext::get_varray_for_input(const FieldInput &field_input, | ||||
| return field_input.get_varray_for_context(*this, mask, scope); | return field_input.get_varray_for_context(*this, mask, scope); | ||||
| } | } | ||||
| IndexFieldInput::IndexFieldInput() : FieldInput(CPPType::get<int>(), "Index") | IndexFieldInput::IndexFieldInput() : FieldInput(CPPType::get<int>(), "Index") | ||||
| { | { | ||||
| category_ = Category::Generated; | 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; }; | auto index_func = [](int i) { return i; }; | ||||
| return VArray<int>::ForFunc(mask.min_array_size(), index_func); | return VArray<int>::ForFunc(mask.min_array_size(), index_func); | ||||
| } | } | ||||
| GVArray IndexFieldInput::get_varray_for_context(const fn::FieldContext &UNUSED(context), | GVArray IndexFieldInput::get_varray_for_context(const fn::FieldContext &UNUSED(context), | ||||
| IndexMask mask, | IndexMask mask, | ||||
| ResourceScope &scope) const | ResourceScope &UNUSED(scope)) const | ||||
| { | { | ||||
| /* TODO: Investigate a similar method to IndexRange::as_span() */ | /* 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 | uint64_t IndexFieldInput::hash() const | ||||
| { | { | ||||
| /* Some random constant hash. */ | /* Some random constant hash. */ | ||||
| return 128736487678; | return 128736487678; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 148 Lines • Show Last 20 Lines | |||||