Geometry Node: Index of Nearest #104619

Merged
Jacques Lucke merged 31 commits from mod_moder/blender:index_of_nearest into main 2023-04-22 13:12:03 +02:00
27 changed files with 90 additions and 313 deletions
Showing only changes of commit a7cb230973 - Show all commits

View File

@ -58,9 +58,6 @@ Static Source Code Checking
* check_cppcheck: Run blender source through cppcheck (C & C++).
* check_clang_array: Run blender source through clang array checking script (C & C++).
* check_deprecated: Check if there is any deprecated code to remove.
* check_splint: Run blenders source through splint (C only).
* check_sparse: Run blenders source through sparse (C only).
* check_smatch: Run blenders source through smatch (C only).
* check_descriptions: Check for duplicate/invalid descriptions.
* check_licenses: Check license headers follow the SPDX license specification,
using one of the accepted licenses in 'doc/license/SPDX-license-identifiers.txt'
@ -474,21 +471,6 @@ check_clang_array: .FORCE
@cd "$(BUILD_DIR)" ; \
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_clang_array.py"
check_splint: .FORCE
@$(CMAKE_CONFIG)
@cd "$(BUILD_DIR)" ; \
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_splint.py"
check_sparse: .FORCE
@$(CMAKE_CONFIG)
@cd "$(BUILD_DIR)" ; \
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_sparse.py"
check_smatch: .FORCE
@$(CMAKE_CONFIG)
@cd "$(BUILD_DIR)" ; \
$(PYTHON) "$(BLENDER_DIR)/build_files/cmake/cmake_static_check_smatch.py"
check_mypy: .FORCE
@$(PYTHON) "$(BLENDER_DIR)/tools/check_source/check_mypy.py"

View File

@ -1,58 +0,0 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
CHECKER_IGNORE_PREFIX = [
"extern",
"intern/moto",
]
CHECKER_BIN = "smatch"
CHECKER_ARGS = [
"--full-path",
"--two-passes",
]
import project_source_info
import subprocess
import sys
import os
USE_QUIET = (os.environ.get("QUIET", None) is not None)
def main():
source_info = project_source_info.build_info(use_cxx=False, ignore_prefix_list=CHECKER_IGNORE_PREFIX)
source_defines = project_source_info.build_defines_as_args()
check_commands = []
for c, inc_dirs, defs in source_info:
cmd = ([CHECKER_BIN] +
CHECKER_ARGS +
[c] +
[("-I%s" % i) for i in inc_dirs] +
[("-D%s" % d) for d in defs] +
source_defines
)
check_commands.append((c, cmd))
def my_process(i, c, cmd):
if not USE_QUIET:
percent = 100.0 * (i / len(check_commands))
percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
sys.stdout.flush()
sys.stdout.write("%s %s\n" % (percent_str, c))
return subprocess.Popen(cmd)
process_functions = []
for i, (c, cmd) in enumerate(check_commands):
process_functions.append((my_process, (i, c, cmd)))
project_source_info.queue_processes(process_functions)
if __name__ == "__main__":
main()

View File

@ -1,56 +0,0 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
CHECKER_IGNORE_PREFIX = [
"extern",
"intern/moto",
]
CHECKER_BIN = "sparse"
CHECKER_ARGS = [
]
import project_source_info
import subprocess
import sys
import os
USE_QUIET = (os.environ.get("QUIET", None) is not None)
def main():
source_info = project_source_info.build_info(use_cxx=False, ignore_prefix_list=CHECKER_IGNORE_PREFIX)
source_defines = project_source_info.build_defines_as_args()
check_commands = []
for c, inc_dirs, defs in source_info:
cmd = ([CHECKER_BIN] +
CHECKER_ARGS +
[c] +
[("-I%s" % i) for i in inc_dirs] +
[("-D%s" % d) for d in defs] +
source_defines
)
check_commands.append((c, cmd))
def my_process(i, c, cmd):
if not USE_QUIET:
percent = 100.0 * (i / len(check_commands))
percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
sys.stdout.flush()
sys.stdout.write("%s %s\n" % (percent_str, c))
return subprocess.Popen(cmd)
process_functions = []
for i, (c, cmd) in enumerate(check_commands):
process_functions.append((my_process, (i, c, cmd)))
project_source_info.queue_processes(process_functions)
if __name__ == "__main__":
main()

View File

@ -1,86 +0,0 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later
CHECKER_IGNORE_PREFIX = [
"extern",
"intern/moto",
]
CHECKER_BIN = "splint"
CHECKER_ARGS = [
"-weak",
"-posix-lib",
"-linelen", "10000",
"+ignorequals",
"+relaxtypes",
"-retvalother",
"+matchanyintegral",
"+longintegral",
"+ignoresigns",
"-nestcomment",
"-predboolothers",
"-ifempty",
"-unrecogcomments",
# we may want to remove these later
"-type",
"-fixedformalarray",
"-fullinitblock",
"-fcnuse",
"-initallelements",
"-castfcnptr",
# -forcehints,
"-bufferoverflowhigh", # warns a lot about sprintf()
# re-definitions, rna causes most of these
"-redef",
"-syntax",
# dummy, witjout this splint complains with:
# /usr/include/bits/confname.h:31:27: *** Internal Bug at cscannerHelp.c:2428: Unexpanded macro not function or constant: int _PC_MAX_CANON
"-D_PC_MAX_CANON=0",
]
import project_source_info
import subprocess
import sys
import os
USE_QUIET = (os.environ.get("QUIET", None) is not None)
def main():
source_info = project_source_info.build_info(use_cxx=False, ignore_prefix_list=CHECKER_IGNORE_PREFIX)
check_commands = []
for c, inc_dirs, defs in source_info:
cmd = ([CHECKER_BIN] +
CHECKER_ARGS +
[c] +
[("-I%s" % i) for i in inc_dirs] +
[("-D%s" % d) for d in defs]
)
check_commands.append((c, cmd))
def my_process(i, c, cmd):
if not USE_QUIET:
percent = 100.0 * (i / len(check_commands))
percent_str = "[" + ("%.2f]" % percent).rjust(7) + " %:"
sys.stdout.write("%s %s\n" % (percent_str, c))
sys.stdout.flush()
return subprocess.Popen(cmd)
process_functions = []
for i, (c, cmd) in enumerate(check_commands):
process_functions.append((my_process, (i, c, cmd)))
project_source_info.queue_processes(process_functions)
if __name__ == "__main__":
main()

View File

@ -29,7 +29,7 @@ namespace blender::bke {
*
* Once created, #AnonymousAttributeID is immutable. Also it is intrinsically reference counted so
* that it can have shared ownership. `std::shared_ptr` can't be used for that purpose here,
* because that is not available in C code. If possible, the #AutoAnonymousAttributeID wrapper
* because that is not available in C code. If possible, the #AnonymousAttributeIDPtr wrapper
* should be used to avoid manual reference counting in C++ code.
*/
class AnonymousAttributeID : public ImplicitSharingMixin {
@ -54,7 +54,7 @@ class AnonymousAttributeID : public ImplicitSharingMixin {
};
/** Wrapper for #AnonymousAttributeID that avoids manual reference counting. */
using AutoAnonymousAttributeID = ImplicitSharingPtr<const AnonymousAttributeID>;
using AnonymousAttributeIDPtr = ImplicitSharingPtr<const AnonymousAttributeID>;
/**
* A set of anonymous attribute names that is passed around in geometry nodes.

View File

@ -259,11 +259,11 @@ class NormalFieldInput : public GeometryFieldInput {
class AnonymousAttributeFieldInput : public GeometryFieldInput {
private:
AutoAnonymousAttributeID anonymous_id_;
AnonymousAttributeIDPtr anonymous_id_;
std::string producer_name_;
public:
AnonymousAttributeFieldInput(AutoAnonymousAttributeID anonymous_id,
AnonymousAttributeFieldInput(AnonymousAttributeIDPtr anonymous_id,
const CPPType &type,
std::string producer_name)
: GeometryFieldInput(type, anonymous_id->user_name()),
@ -274,7 +274,7 @@ class AnonymousAttributeFieldInput : public GeometryFieldInput {
}
template<typename T>
static fn::Field<T> Create(AutoAnonymousAttributeID anonymous_id, std::string producer_name)
static fn::Field<T> Create(AnonymousAttributeIDPtr anonymous_id, std::string producer_name)
{
const CPPType &type = CPPType::get<T>();
auto field_input = std::make_shared<AnonymousAttributeFieldInput>(
@ -282,7 +282,7 @@ class AnonymousAttributeFieldInput : public GeometryFieldInput {
return fn::Field<T>{field_input};
}
const AutoAnonymousAttributeID &anonymous_id() const
const AnonymousAttributeIDPtr &anonymous_id() const
{
return anonymous_id_;
}

View File

@ -833,8 +833,7 @@ static BVHTree *bvhtree_from_editmesh_edges_create_tree(float epsilon,
}
static BVHTree *bvhtree_from_mesh_edges_create_tree(const float (*positions)[3],
const blender::int2 *edge,
const int edge_num,
blender::Span<blender::int2> edges,
const BitSpan edges_mask,
int edges_num_active,
float epsilon,
@ -842,10 +841,10 @@ static BVHTree *bvhtree_from_mesh_edges_create_tree(const float (*positions)[3],
int axis)
{
if (!edges_mask.is_empty()) {
BLI_assert(IN_RANGE_INCL(edges_num_active, 0, edge_num));
BLI_assert(IN_RANGE_INCL(edges_num_active, 0, edges.size()));
}
else {
edges_num_active = edge_num;
edges_num_active = edges.size();
}
if (edges_num_active == 0) {
return nullptr;
@ -857,13 +856,13 @@ static BVHTree *bvhtree_from_mesh_edges_create_tree(const float (*positions)[3],
return nullptr;
}
for (int i = 0; i < edge_num; i++) {
for (const int i : edges.index_range()) {
if (!edges_mask.is_empty() && !edges_mask[i]) {
continue;
}
float co[2][3];
copy_v3_v3(co[0], positions[edge[i][0]]);
copy_v3_v3(co[1], positions[edge[i][1]]);
copy_v3_v3(co[0], positions[edges[i][0]]);
copy_v3_v3(co[1], positions[edges[i][1]]);
BLI_bvhtree_insert(tree, i, co[0], 2);
}
@ -908,7 +907,7 @@ BVHTree *bvhtree_from_mesh_edges_ex(BVHTreeFromMesh *data,
int axis)
{
BVHTree *tree = bvhtree_from_mesh_edges_create_tree(
vert_positions, edge, edges_num, edges_mask, edges_num_active, epsilon, tree_type, axis);
vert_positions, {edge, edges_num}, edges_mask, edges_num_active, epsilon, tree_type, axis);
bvhtree_balance(tree, false);
@ -1166,14 +1165,6 @@ static BitVector<> loose_verts_map_get(const Span<blender::int2> edges,
return loose_verts_mask;
}
static BitVector<> loose_edges_map_get(const Mesh &mesh, int *r_loose_edge_len)
{
using namespace blender::bke;
const LooseEdgeCache &loose_edges = mesh.loose_edges();
*r_loose_edge_len = loose_edges.count;
return loose_edges.is_loose_bits;
}
static BitVector<> looptri_no_hidden_map_get(const blender::OffsetIndices<int> polys,
const VArray<bool> &hide_poly,
const int looptri_len,
@ -1243,27 +1234,32 @@ BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
}
/* Create BVHTree. */
BitVector<> mask;
int mask_bits_act_len = -1;
switch (bvh_cache_type) {
case BVHTREE_FROM_LOOSEVERTS:
mask = loose_verts_map_get(edges, mesh->totvert, &mask_bits_act_len);
ATTR_FALLTHROUGH;
case BVHTREE_FROM_VERTS:
case BVHTREE_FROM_LOOSEVERTS: {
int mask_bits_act_len = -1;
const BitVector<> mask = loose_verts_map_get(edges, mesh->totvert, &mask_bits_act_len);
data->tree = bvhtree_from_mesh_verts_create_tree(
0.0f, tree_type, 6, positions, mesh->totvert, mask, mask_bits_act_len);
break;
case BVHTREE_FROM_LOOSEEDGES:
mask = loose_edges_map_get(*mesh, &mask_bits_act_len);
ATTR_FALLTHROUGH;
case BVHTREE_FROM_EDGES:
data->tree = bvhtree_from_mesh_edges_create_tree(
positions, edges.data(), mesh->totedge, mask, mask_bits_act_len, 0.0f, tree_type, 6);
}
case BVHTREE_FROM_VERTS: {
data->tree = bvhtree_from_mesh_verts_create_tree(
0.0f, tree_type, 6, positions, mesh->totvert, {}, -1);
break;
case BVHTREE_FROM_FACES:
}
case BVHTREE_FROM_LOOSEEDGES: {
const blender::bke::LooseEdgeCache &loose_edges = mesh->loose_edges();
data->tree = bvhtree_from_mesh_edges_create_tree(
positions, edges, loose_edges.is_loose_bits, loose_edges.count, 0.0f, tree_type, 6);
break;
}
case BVHTREE_FROM_EDGES: {
data->tree = bvhtree_from_mesh_edges_create_tree(
positions, edges, {}, -1, 0.0f, tree_type, 6);
break;
}
case BVHTREE_FROM_FACES: {
BLI_assert(!(mesh->totface == 0 && mesh->totpoly != 0));
data->tree = bvhtree_from_mesh_faces_create_tree(
0.0f,
@ -1275,25 +1271,29 @@ BVHTree *BKE_bvhtree_from_mesh_get(struct BVHTreeFromMesh *data,
{},
-1);
break;
}
case BVHTREE_FROM_LOOPTRI_NO_HIDDEN: {
blender::bke::AttributeAccessor attributes = mesh->attributes();
mask = looptri_no_hidden_map_get(
int mask_bits_act_len = -1;
const BitVector<> mask = looptri_no_hidden_map_get(
mesh->polys(),
*attributes.lookup_or_default(".hide_poly", ATTR_DOMAIN_FACE, false),
looptris.size(),
&mask_bits_act_len);
ATTR_FALLTHROUGH;
}
case BVHTREE_FROM_LOOPTRI:
data->tree = bvhtree_from_mesh_looptri_create_tree(
0.0f, tree_type, 6, positions, corner_verts.data(), looptris, mask, mask_bits_act_len);
break;
}
case BVHTREE_FROM_LOOPTRI: {
data->tree = bvhtree_from_mesh_looptri_create_tree(
0.0f, tree_type, 6, positions, corner_verts.data(), looptris, {}, -1);
break;
}
case BVHTREE_FROM_EM_VERTS:
case BVHTREE_FROM_EM_EDGES:
case BVHTREE_FROM_EM_LOOPTRI:
case BVHTREE_MAX_ITEM:
BLI_assert(false);
BLI_assert_unreachable();
break;
}

View File

@ -198,7 +198,7 @@ static void collection_foreach_id(ID *id, LibraryForeachIDData *data)
* anyway... */
const int cb_flag = ((parent->collection != NULL &&
(parent->collection->id.flag & LIB_EMBEDDED_DATA) != 0) ?
IDWALK_CB_EMBEDDED :
IDWALK_CB_EMBEDDED_NOT_OWNING :
IDWALK_CB_NOP);
BKE_LIB_FOREACHID_PROCESS_IDSUPER(
data, parent->collection, IDWALK_CB_NEVER_SELF | IDWALK_CB_LOOPBACK | cb_flag);

View File

@ -413,7 +413,9 @@ char32_t BLI_str_utf32_char_to_upper(const char32_t wc)
{
if (wc < U'\xFF') { /* Latin. */
if ((wc <= U'z' && wc >= U'a') || (wc <= U'\xF6' && wc >= U'\xE0') ||
(wc <= U'\xFE' && wc >= U'\xF8')) {
/* Correct but the first case is know, only check the second */
// (wc <= U'\xFE' && wc >= U'\xF8')
(wc >= U'\xF8')) {
return wc - 32;
}
return wc;

View File

@ -73,7 +73,7 @@ static void add_new_edges(Mesh &mesh,
/* Store a copy of the IDs locally since we will remove the existing attributes which
* can also free the names, since the API does not provide pointer stability. */
Vector<std::string> named_ids;
Vector<bke::AutoAnonymousAttributeID> anonymous_ids;
Vector<bke::AnonymousAttributeIDPtr> anonymous_ids;
for (const bke::AttributeIDRef &id : attributes.all_ids()) {
if (attributes.lookup_meta_data(id)->domain != ATTR_DOMAIN_EDGE) {
continue;
@ -95,7 +95,7 @@ static void add_new_edges(Mesh &mesh,
for (const StringRef name : named_ids) {
local_edge_ids.append(name);
}
for (const bke::AutoAnonymousAttributeID &id : anonymous_ids) {
for (const bke::AnonymousAttributeIDPtr &id : anonymous_ids) {
local_edge_ids.append(*id);
}

View File

@ -116,9 +116,6 @@ static bool meshcache_read_mdd_range_from_time(FILE *fp,
return false;
}
if (i == mdd_head.frame_tot) {
frame = (float)(mdd_head.frame_tot - 1);
}
if (UNLIKELY(f_time_prev == FLT_MAX)) {
frame = 0.0f;
}

View File

@ -18,6 +18,7 @@ namespace blender::nodes {
using bke::AnonymousAttributeFieldInput;
using bke::AnonymousAttributeID;
using bke::AnonymousAttributeIDPtr;
using bke::AnonymousAttributePropagationInfo;
using bke::AttributeAccessor;
using bke::AttributeFieldInput;
@ -26,7 +27,6 @@ using bke::AttributeKind;
using bke::AttributeMetaData;
using bke::AttributeReader;
using bke::AttributeWriter;
using bke::AutoAnonymousAttributeID;
using bke::GAttributeReader;
using bke::GAttributeWriter;
using bke::GSpanAttributeWriter;
@ -259,7 +259,7 @@ class GeoNodeExecParams {
* Return a new anonymous attribute id for the given output. None is returned if the anonymous
* attribute is not needed.
*/
AutoAnonymousAttributeID get_output_anonymous_attribute_id_if_needed(
AnonymousAttributeIDPtr get_output_anonymous_attribute_id_if_needed(
const StringRef output_identifier, const bool force_create = false)
{
if (!this->anonymous_attribute_output_is_required(output_identifier) && !force_create) {

View File

@ -56,10 +56,10 @@ Mesh *create_grid_mesh(
int verts_x, int verts_y, float size_x, float size_y, const AttributeIDRef &uv_map_id);
struct ConeAttributeOutputs {
AutoAnonymousAttributeID top_id;
AutoAnonymousAttributeID bottom_id;
AutoAnonymousAttributeID side_id;
AutoAnonymousAttributeID uv_map_id;
AnonymousAttributeIDPtr top_id;
AnonymousAttributeIDPtr bottom_id;
AnonymousAttributeIDPtr side_id;
AnonymousAttributeIDPtr uv_map_id;
};
Mesh *create_cylinder_or_cone_mesh(float radius_top,

View File

@ -142,7 +142,7 @@ static void node_geo_exec(GeoNodeExecParams params)
const eAttrDomain domain = eAttrDomain(storage.domain);
const std::string output_identifier = "Attribute" + identifier_suffix(data_type);
AutoAnonymousAttributeID attribute_id = params.get_output_anonymous_attribute_id_if_needed(
AnonymousAttributeIDPtr attribute_id = params.get_output_anonymous_attribute_id_if_needed(
output_identifier);
if (!attribute_id) {

View File

@ -30,7 +30,7 @@ static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
}
struct AttributeOutputs {
AutoAnonymousAttributeID intersecting_edges_id;
AnonymousAttributeIDPtr intersecting_edges_id;
};
static void node_update(bNodeTree *ntree, bNode *node)

View File

@ -59,7 +59,7 @@ static Curves *create_star_curve(const float inner_radius,
}
static void create_selection_output(CurveComponent &component,
AutoAnonymousAttributeID &r_attribute)
AnonymousAttributeIDPtr &r_attribute)
{
SpanAttributeWriter<bool> selection =
component.attributes_for_write()->lookup_or_add_for_write_only_span<bool>(*r_attribute,
@ -78,8 +78,8 @@ static void node_geo_exec(GeoNodeExecParams params)
std::max(params.extract_input<int>("Points"), 3));
GeometrySet output = GeometrySet::create_with_curves(curves);
if (AutoAnonymousAttributeID outer_points_id =
params.get_output_anonymous_attribute_id_if_needed("Outer Points")) {
if (AnonymousAttributeIDPtr outer_points_id = params.get_output_anonymous_attribute_id_if_needed(
"Outer Points")) {
create_selection_output(output.get_component_for_write<CurveComponent>(), outer_points_id);
params.set_output("Outer Points",
AnonymousAttributeFieldInput::Create<bool>(

View File

@ -43,15 +43,15 @@ static void node_declare(NodeDeclarationBuilder &b)
node_storage(node).use_all_curves = false;
});
b.add_output<decl::Float>(N_("Value"), "Value_Float").dependent_field();
b.add_output<decl::Int>(N_("Value"), "Value_Int").dependent_field();
b.add_output<decl::Vector>(N_("Value"), "Value_Vector").dependent_field();
b.add_output<decl::Color>(N_("Value"), "Value_Color").dependent_field();
b.add_output<decl::Bool>(N_("Value"), "Value_Bool").dependent_field();
b.add_output<decl::Float>(N_("Value"), "Value_Float").dependent_field({6, 7, 8});
b.add_output<decl::Int>(N_("Value"), "Value_Int").dependent_field({6, 7, 8});
b.add_output<decl::Vector>(N_("Value"), "Value_Vector").dependent_field({6, 7, 8});
b.add_output<decl::Color>(N_("Value"), "Value_Color").dependent_field({6, 7, 8});
b.add_output<decl::Bool>(N_("Value"), "Value_Bool").dependent_field({6, 7, 8});
b.add_output<decl::Vector>(N_("Position")).dependent_field();
b.add_output<decl::Vector>(N_("Tangent")).dependent_field();
b.add_output<decl::Vector>(N_("Normal")).dependent_field();
b.add_output<decl::Vector>(N_("Position")).dependent_field({6, 7, 8});
b.add_output<decl::Vector>(N_("Tangent")).dependent_field({6, 7, 8});
b.add_output<decl::Vector>(N_("Normal")).dependent_field({6, 7, 8});
}
static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)

View File

@ -135,13 +135,13 @@ static void node_geo_exec(GeoNodeExecParams params)
GeometryComponentEditData::remember_deformed_curve_positions_if_necessary(geometry_set);
AutoAnonymousAttributeID rotation_anonymous_id =
AnonymousAttributeIDPtr rotation_anonymous_id =
params.get_output_anonymous_attribute_id_if_needed("Rotation");
const bool need_tangent_and_normal = bool(rotation_anonymous_id);
AutoAnonymousAttributeID tangent_anonymous_id =
AnonymousAttributeIDPtr tangent_anonymous_id =
params.get_output_anonymous_attribute_id_if_needed("Tangent", need_tangent_and_normal);
AutoAnonymousAttributeID normal_anonymous_id =
params.get_output_anonymous_attribute_id_if_needed("Normal", need_tangent_and_normal);
AnonymousAttributeIDPtr normal_anonymous_id = params.get_output_anonymous_attribute_id_if_needed(
"Normal", need_tangent_and_normal);
geometry::ResampleCurvesOutputAttributeIDs resample_attributes;
resample_attributes.tangent_id = tangent_anonymous_id.get();

View File

@ -322,8 +322,8 @@ BLI_NOINLINE static void propagate_existing_attributes(
namespace {
struct AttributeOutputs {
AutoAnonymousAttributeID normal_id;
AutoAnonymousAttributeID rotation_id;
AnonymousAttributeIDPtr normal_id;
AnonymousAttributeIDPtr rotation_id;
};
} // namespace

View File

@ -57,7 +57,7 @@ static void node_layout(uiLayout *layout, bContext * /*C*/, PointerRNA *ptr)
}
struct IndexAttributes {
AutoAnonymousAttributeID duplicate_index;
AnonymousAttributeIDPtr duplicate_index;
};
/* -------------------------------------------------------------------- */

View File

@ -62,8 +62,8 @@ static void node_update(bNodeTree *ntree, bNode *node)
}
struct AttributeOutputs {
AutoAnonymousAttributeID top_id;
AutoAnonymousAttributeID side_id;
AnonymousAttributeIDPtr top_id;
AnonymousAttributeIDPtr side_id;
};
static void save_selection_as_attribute(Mesh &mesh,

View File

@ -593,8 +593,8 @@ static void interpolate_curve_attributes(bke::CurvesGeometry &child_curves,
}
static void store_output_attributes(bke::CurvesGeometry &child_curves,
const AutoAnonymousAttributeID weight_attribute_id,
const AutoAnonymousAttributeID index_attribute_id,
const AnonymousAttributeIDPtr weight_attribute_id,
const AnonymousAttributeIDPtr index_attribute_id,
const int max_neighbors,
const Span<int> all_neighbor_counts,
const Span<int> all_neighbor_indices,
@ -658,8 +658,8 @@ static GeometrySet generate_interpolated_curves(
const VArray<int> &point_group_ids,
const int max_neighbors,
const AnonymousAttributePropagationInfo &propagation_info,
const AutoAnonymousAttributeID &index_attribute_id,
const AutoAnonymousAttributeID &weight_attribute_id)
const AnonymousAttributeIDPtr &index_attribute_id,
const AnonymousAttributeIDPtr &weight_attribute_id)
{
const bke::CurvesGeometry &guide_curves = guide_curves_id.geometry.wrap();
@ -813,10 +813,10 @@ static void node_geo_exec(GeoNodeExecParams params)
const AnonymousAttributePropagationInfo propagation_info = params.get_output_propagation_info(
"Curves");
AutoAnonymousAttributeID index_attribute_id = params.get_output_anonymous_attribute_id_if_needed(
AnonymousAttributeIDPtr index_attribute_id = params.get_output_anonymous_attribute_id_if_needed(
"Closest Index");
AutoAnonymousAttributeID weight_attribute_id =
params.get_output_anonymous_attribute_id_if_needed("Closest Weight");
AnonymousAttributeIDPtr weight_attribute_id = params.get_output_anonymous_attribute_id_if_needed(
"Closest Weight");
GeometrySet new_curves = generate_interpolated_curves(guide_curves_id,
*points_component->attributes(),

View File

@ -107,8 +107,7 @@ static void node_geo_exec(GeoNodeExecParams params)
return;
}
AutoAnonymousAttributeID uv_map_id = params.get_output_anonymous_attribute_id_if_needed(
"UV Map");
AnonymousAttributeIDPtr uv_map_id = params.get_output_anonymous_attribute_id_if_needed("UV Map");
Mesh *mesh = create_cube_mesh(size, verts_x, verts_y, verts_z, uv_map_id.get());

View File

@ -198,8 +198,7 @@ static void node_geo_exec(GeoNodeExecParams params)
return;
}
AutoAnonymousAttributeID uv_map_id = params.get_output_anonymous_attribute_id_if_needed(
"UV Map");
AnonymousAttributeIDPtr uv_map_id = params.get_output_anonymous_attribute_id_if_needed("UV Map");
Mesh *mesh = create_grid_mesh(verts_x, verts_y, size_x, size_y, uv_map_id.get());
BKE_id_material_eval_ensure_default_slot(&mesh->id);

View File

@ -111,8 +111,7 @@ static void node_geo_exec(GeoNodeExecParams params)
const int subdivisions = std::min(params.extract_input<int>("Subdivisions"), 10);
const float radius = params.extract_input<float>("Radius");
AutoAnonymousAttributeID uv_map_id = params.get_output_anonymous_attribute_id_if_needed(
"UV Map");
AnonymousAttributeIDPtr uv_map_id = params.get_output_anonymous_attribute_id_if_needed("UV Map");
Mesh *mesh = create_ico_sphere_mesh(subdivisions, radius, uv_map_id.get());
params.set_output("Mesh", GeometrySet::create_with_mesh(mesh));

View File

@ -358,8 +358,7 @@ static void node_geo_exec(GeoNodeExecParams params)
const float radius = params.extract_input<float>("Radius");
AutoAnonymousAttributeID uv_map_id = params.get_output_anonymous_attribute_id_if_needed(
"UV Map");
AnonymousAttributeIDPtr uv_map_id = params.get_output_anonymous_attribute_id_if_needed("UV Map");
Mesh *mesh = create_uv_sphere_mesh(radius, segments_num, rings_num, uv_map_id.get());
params.set_output("Mesh", GeometrySet::create_with_mesh(mesh));

View File

@ -342,7 +342,7 @@ static void create_attributes(GeoNodeExecParams &params,
{
MutableAttributeAccessor attributes = instances.attributes_for_write();
if (AutoAnonymousAttributeID line_id = params.get_output_anonymous_attribute_id_if_needed(
if (AnonymousAttributeIDPtr line_id = params.get_output_anonymous_attribute_id_if_needed(
"Line")) {
SpanAttributeWriter<int> line_attribute = attributes.lookup_or_add_for_write_only_span<int>(
*line_id, ATTR_DOMAIN_INSTANCE);
@ -353,7 +353,7 @@ static void create_attributes(GeoNodeExecParams &params,
params.attribute_producer_name()));
}
if (AutoAnonymousAttributeID pivot_id = params.get_output_anonymous_attribute_id_if_needed(
if (AnonymousAttributeIDPtr pivot_id = params.get_output_anonymous_attribute_id_if_needed(
"Pivot Point")) {
SpanAttributeWriter<float3> pivot_attribute =
attributes.lookup_or_add_for_write_only_span<float3>(*pivot_id, ATTR_DOMAIN_INSTANCE);