Cleanup: use "num" as a suffix in: source/blender/nodes
This commit is contained in:
parent
556384ca1d
commit
24839fdefa
|
@ -1189,7 +1189,7 @@ typedef struct NodeCryptomatte {
|
|||
|
||||
/** Legacy attributes */
|
||||
/* Number of input sockets. */
|
||||
int num_inputs;
|
||||
int inputs_num;
|
||||
|
||||
char _pad[4];
|
||||
NodeCryptomatte_Runtime runtime;
|
||||
|
|
|
@ -82,6 +82,7 @@ DNA_STRUCT_RENAME_ELEM(LineartGpencilModifierData, transparency_mask, material_m
|
|||
DNA_STRUCT_RENAME_ELEM(MaskLayer, restrictflag, visibility_flag)
|
||||
DNA_STRUCT_RENAME_ELEM(MaterialLineArt, transparency_mask, material_mask_bits)
|
||||
DNA_STRUCT_RENAME_ELEM(MovieClip, name, filepath)
|
||||
DNA_STRUCT_RENAME_ELEM(NodeCryptomatte, num_inputs, inputs_num)
|
||||
DNA_STRUCT_RENAME_ELEM(Object, col, color)
|
||||
DNA_STRUCT_RENAME_ELEM(Object, dup_group, instance_collection)
|
||||
DNA_STRUCT_RENAME_ELEM(Object, dupfacesca, instance_faces_scale)
|
||||
|
|
|
@ -323,8 +323,8 @@ bNodeSocket *ntreeCompositCryptomatteAddSocket(bNodeTree *ntree, bNode *node)
|
|||
BLI_assert(node->type == CMP_NODE_CRYPTOMATTE_LEGACY);
|
||||
NodeCryptomatte *n = static_cast<NodeCryptomatte *>(node->storage);
|
||||
char sockname[32];
|
||||
n->num_inputs++;
|
||||
BLI_snprintf(sockname, sizeof(sockname), "Crypto %.2d", n->num_inputs - 1);
|
||||
n->inputs_num++;
|
||||
BLI_snprintf(sockname, sizeof(sockname), "Crypto %.2d", n->inputs_num - 1);
|
||||
bNodeSocket *sock = nodeAddStaticSocket(
|
||||
ntree, node, SOCK_IN, SOCK_RGBA, PROP_NONE, nullptr, sockname);
|
||||
return sock;
|
||||
|
@ -334,12 +334,12 @@ int ntreeCompositCryptomatteRemoveSocket(bNodeTree *ntree, bNode *node)
|
|||
{
|
||||
BLI_assert(node->type == CMP_NODE_CRYPTOMATTE_LEGACY);
|
||||
NodeCryptomatte *n = static_cast<NodeCryptomatte *>(node->storage);
|
||||
if (n->num_inputs < 2) {
|
||||
if (n->inputs_num < 2) {
|
||||
return 0;
|
||||
}
|
||||
bNodeSocket *sock = static_cast<bNodeSocket *>(node->inputs.last);
|
||||
nodeRemoveSocket(ntree, node, sock);
|
||||
n->num_inputs--;
|
||||
n->inputs_num--;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,25 +30,25 @@ static Mesh *hull_from_bullet(const Mesh *mesh, Span<float3> coords)
|
|||
{
|
||||
plConvexHull hull = plConvexHullCompute((float(*)[3])coords.data(), coords.size());
|
||||
|
||||
const int num_verts = plConvexHullNumVertices(hull);
|
||||
const int num_faces = num_verts <= 2 ? 0 : plConvexHullNumFaces(hull);
|
||||
const int num_loops = num_verts <= 2 ? 0 : plConvexHullNumLoops(hull);
|
||||
const int verts_num = plConvexHullNumVertices(hull);
|
||||
const int faces_num = verts_num <= 2 ? 0 : plConvexHullNumFaces(hull);
|
||||
const int loops_num = verts_num <= 2 ? 0 : plConvexHullNumLoops(hull);
|
||||
/* Half as many edges as loops, because the mesh is manifold. */
|
||||
const int num_edges = num_verts == 2 ? 1 : num_verts < 2 ? 0 : num_loops / 2;
|
||||
const int edges_num = verts_num == 2 ? 1 : verts_num < 2 ? 0 : loops_num / 2;
|
||||
|
||||
/* Create Mesh *result with proper capacity. */
|
||||
Mesh *result;
|
||||
if (mesh) {
|
||||
result = BKE_mesh_new_nomain_from_template(
|
||||
mesh, num_verts, num_edges, 0, num_loops, num_faces);
|
||||
mesh, verts_num, edges_num, 0, loops_num, faces_num);
|
||||
}
|
||||
else {
|
||||
result = BKE_mesh_new_nomain(num_verts, num_edges, 0, num_loops, num_faces);
|
||||
result = BKE_mesh_new_nomain(verts_num, edges_num, 0, loops_num, faces_num);
|
||||
BKE_id_material_eval_ensure_default_slot(&result->id);
|
||||
}
|
||||
|
||||
/* Copy vertices. */
|
||||
for (const int i : IndexRange(num_verts)) {
|
||||
for (const int i : IndexRange(verts_num)) {
|
||||
float co[3];
|
||||
int original_index;
|
||||
plConvexHullGetVertex(hull, i, co, &original_index);
|
||||
|
@ -73,9 +73,9 @@ static Mesh *hull_from_bullet(const Mesh *mesh, Span<float3> coords)
|
|||
/* NOTE: ConvexHull from Bullet uses a half-edge data structure
|
||||
* for its mesh. To convert that, each half-edge needs to be converted
|
||||
* to a loop and edges need to be created from that. */
|
||||
Array<MLoop> mloop_src(num_loops);
|
||||
Array<MLoop> mloop_src(loops_num);
|
||||
uint edge_index = 0;
|
||||
for (const int i : IndexRange(num_loops)) {
|
||||
for (const int i : IndexRange(loops_num)) {
|
||||
int v_from;
|
||||
int v_to;
|
||||
plConvexHullGetLoop(hull, i, &v_from, &v_to);
|
||||
|
@ -95,7 +95,7 @@ static Mesh *hull_from_bullet(const Mesh *mesh, Span<float3> coords)
|
|||
edge_index++;
|
||||
}
|
||||
}
|
||||
if (num_edges == 1) {
|
||||
if (edges_num == 1) {
|
||||
/* In this case there are no loops. */
|
||||
MEdge &edge = result->medge[0];
|
||||
edge.v1 = 0;
|
||||
|
@ -103,13 +103,13 @@ static Mesh *hull_from_bullet(const Mesh *mesh, Span<float3> coords)
|
|||
edge.flag |= ME_EDGEDRAW | ME_EDGERENDER | ME_LOOSEEDGE;
|
||||
edge_index++;
|
||||
}
|
||||
BLI_assert(edge_index == num_edges);
|
||||
BLI_assert(edge_index == edges_num);
|
||||
|
||||
/* Copy faces. */
|
||||
Array<int> loops;
|
||||
int j = 0;
|
||||
MLoop *loop = result->mloop;
|
||||
for (const int i : IndexRange(num_faces)) {
|
||||
for (const int i : IndexRange(faces_num)) {
|
||||
const int len = plConvexHullGetFaceSize(hull, i);
|
||||
|
||||
BLI_assert(len > 2);
|
||||
|
|
|
@ -551,8 +551,8 @@ static std::unique_ptr<CurveEval> fillet_curve(const CurveEval &input_curve,
|
|||
Span<SplinePtr> input_splines = input_curve.splines();
|
||||
|
||||
std::unique_ptr<CurveEval> output_curve = std::make_unique<CurveEval>();
|
||||
const int num_splines = input_splines.size();
|
||||
output_curve->resize(num_splines);
|
||||
const int splines_num = input_splines.size();
|
||||
output_curve->resize(splines_num);
|
||||
MutableSpan<SplinePtr> output_splines = output_curve->splines();
|
||||
Array<int> spline_offsets = input_curve.control_point_offsets();
|
||||
|
||||
|
|
|
@ -168,12 +168,12 @@ static void copy_attributes_based_on_map(const Map<AttributeIDRef, AttributeKind
|
|||
static void copy_face_corner_attributes(const Map<AttributeIDRef, AttributeKind> &attributes,
|
||||
const GeometryComponent &in_component,
|
||||
GeometryComponent &out_component,
|
||||
const int num_selected_loops,
|
||||
const int selected_loops_num,
|
||||
const Span<int> selected_poly_indices,
|
||||
const Mesh &mesh_in)
|
||||
{
|
||||
Vector<int64_t> indices;
|
||||
indices.reserve(num_selected_loops);
|
||||
indices.reserve(selected_loops_num);
|
||||
for (const int src_poly_index : selected_poly_indices) {
|
||||
const MPoly &src_poly = mesh_in.mpoly[src_poly_index];
|
||||
const int src_loop_start = src_poly.loopstart;
|
||||
|
@ -546,47 +546,47 @@ static void separate_instance_selection(GeometrySet &geometry_set,
|
|||
static void compute_selected_vertices_from_vertex_selection(const Span<bool> vertex_selection,
|
||||
const bool invert,
|
||||
MutableSpan<int> r_vertex_map,
|
||||
int *r_num_selected_vertices)
|
||||
int *r_selected_vertices_num)
|
||||
{
|
||||
BLI_assert(vertex_selection.size() == r_vertex_map.size());
|
||||
|
||||
int num_selected_vertices = 0;
|
||||
int selected_verts_num = 0;
|
||||
for (const int i : r_vertex_map.index_range()) {
|
||||
if (vertex_selection[i] != invert) {
|
||||
r_vertex_map[i] = num_selected_vertices;
|
||||
num_selected_vertices++;
|
||||
r_vertex_map[i] = selected_verts_num;
|
||||
selected_verts_num++;
|
||||
}
|
||||
else {
|
||||
r_vertex_map[i] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
*r_num_selected_vertices = num_selected_vertices;
|
||||
*r_selected_vertices_num = selected_verts_num;
|
||||
}
|
||||
|
||||
static void compute_selected_edges_from_vertex_selection(const Mesh &mesh,
|
||||
const Span<bool> vertex_selection,
|
||||
const bool invert,
|
||||
MutableSpan<int> r_edge_map,
|
||||
int *r_num_selected_edges)
|
||||
int *r_selected_edges_num)
|
||||
{
|
||||
BLI_assert(mesh.totedge == r_edge_map.size());
|
||||
|
||||
int num_selected_edges = 0;
|
||||
int selected_edges_num = 0;
|
||||
for (const int i : IndexRange(mesh.totedge)) {
|
||||
const MEdge &edge = mesh.medge[i];
|
||||
|
||||
/* Only add the edge if both vertices will be in the new mesh. */
|
||||
if (vertex_selection[edge.v1] != invert && vertex_selection[edge.v2] != invert) {
|
||||
r_edge_map[i] = num_selected_edges;
|
||||
num_selected_edges++;
|
||||
r_edge_map[i] = selected_edges_num;
|
||||
selected_edges_num++;
|
||||
}
|
||||
else {
|
||||
r_edge_map[i] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
*r_num_selected_edges = num_selected_edges;
|
||||
*r_selected_edges_num = selected_edges_num;
|
||||
}
|
||||
|
||||
static void compute_selected_polygons_from_vertex_selection(const Mesh &mesh,
|
||||
|
@ -594,15 +594,15 @@ static void compute_selected_polygons_from_vertex_selection(const Mesh &mesh,
|
|||
const bool invert,
|
||||
Vector<int> &r_selected_poly_indices,
|
||||
Vector<int> &r_loop_starts,
|
||||
int *r_num_selected_polys,
|
||||
int *r_num_selected_loops)
|
||||
int *r_selected_polys_num,
|
||||
int *r_selected_loops_num)
|
||||
{
|
||||
BLI_assert(mesh.totvert == vertex_selection.size());
|
||||
|
||||
r_selected_poly_indices.reserve(mesh.totpoly);
|
||||
r_loop_starts.reserve(mesh.totloop);
|
||||
|
||||
int num_selected_loops = 0;
|
||||
int selected_loops_num = 0;
|
||||
for (const int i : IndexRange(mesh.totpoly)) {
|
||||
const MPoly &poly_src = mesh.mpoly[i];
|
||||
|
||||
|
@ -617,13 +617,13 @@ static void compute_selected_polygons_from_vertex_selection(const Mesh &mesh,
|
|||
|
||||
if (all_verts_in_selection) {
|
||||
r_selected_poly_indices.append_unchecked(i);
|
||||
r_loop_starts.append_unchecked(num_selected_loops);
|
||||
num_selected_loops += poly_src.totloop;
|
||||
r_loop_starts.append_unchecked(selected_loops_num);
|
||||
selected_loops_num += poly_src.totloop;
|
||||
}
|
||||
}
|
||||
|
||||
*r_num_selected_polys = r_selected_poly_indices.size();
|
||||
*r_num_selected_loops = num_selected_loops;
|
||||
*r_selected_polys_num = r_selected_poly_indices.size();
|
||||
*r_selected_loops_num = selected_loops_num;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -636,25 +636,25 @@ static void compute_selected_vertices_and_edges_from_edge_selection(
|
|||
const bool invert,
|
||||
MutableSpan<int> r_vertex_map,
|
||||
MutableSpan<int> r_edge_map,
|
||||
int *r_num_selected_vertices,
|
||||
int *r_num_selected_edges)
|
||||
int *r_selected_vertices_num,
|
||||
int *r_selected_edges_num)
|
||||
{
|
||||
BLI_assert(mesh.totedge == edge_selection.size());
|
||||
|
||||
int num_selected_edges = 0;
|
||||
int num_selected_vertices = 0;
|
||||
int selected_edges_num = 0;
|
||||
int selected_verts_num = 0;
|
||||
for (const int i : IndexRange(mesh.totedge)) {
|
||||
const MEdge &edge = mesh.medge[i];
|
||||
if (edge_selection[i] != invert) {
|
||||
r_edge_map[i] = num_selected_edges;
|
||||
num_selected_edges++;
|
||||
r_edge_map[i] = selected_edges_num;
|
||||
selected_edges_num++;
|
||||
if (r_vertex_map[edge.v1] == -1) {
|
||||
r_vertex_map[edge.v1] = num_selected_vertices;
|
||||
num_selected_vertices++;
|
||||
r_vertex_map[edge.v1] = selected_verts_num;
|
||||
selected_verts_num++;
|
||||
}
|
||||
if (r_vertex_map[edge.v2] == -1) {
|
||||
r_vertex_map[edge.v2] = num_selected_vertices;
|
||||
num_selected_vertices++;
|
||||
r_vertex_map[edge.v2] = selected_verts_num;
|
||||
selected_verts_num++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -662,8 +662,8 @@ static void compute_selected_vertices_and_edges_from_edge_selection(
|
|||
}
|
||||
}
|
||||
|
||||
*r_num_selected_vertices = num_selected_vertices;
|
||||
*r_num_selected_edges = num_selected_edges;
|
||||
*r_selected_vertices_num = selected_verts_num;
|
||||
*r_selected_edges_num = selected_edges_num;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -673,22 +673,22 @@ static void compute_selected_edges_from_edge_selection(const Mesh &mesh,
|
|||
const Span<bool> edge_selection,
|
||||
const bool invert,
|
||||
MutableSpan<int> r_edge_map,
|
||||
int *r_num_selected_edges)
|
||||
int *r_selected_edges_num)
|
||||
{
|
||||
BLI_assert(mesh.totedge == edge_selection.size());
|
||||
|
||||
int num_selected_edges = 0;
|
||||
int selected_edges_num = 0;
|
||||
for (const int i : IndexRange(mesh.totedge)) {
|
||||
if (edge_selection[i] != invert) {
|
||||
r_edge_map[i] = num_selected_edges;
|
||||
num_selected_edges++;
|
||||
r_edge_map[i] = selected_edges_num;
|
||||
selected_edges_num++;
|
||||
}
|
||||
else {
|
||||
r_edge_map[i] = -1;
|
||||
}
|
||||
}
|
||||
|
||||
*r_num_selected_edges = num_selected_edges;
|
||||
*r_selected_edges_num = selected_edges_num;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -700,13 +700,13 @@ static void compute_selected_polygons_from_edge_selection(const Mesh &mesh,
|
|||
const bool invert,
|
||||
Vector<int> &r_selected_poly_indices,
|
||||
Vector<int> &r_loop_starts,
|
||||
int *r_num_selected_polys,
|
||||
int *r_num_selected_loops)
|
||||
int *r_selected_polys_num,
|
||||
int *r_selected_loops_num)
|
||||
{
|
||||
r_selected_poly_indices.reserve(mesh.totpoly);
|
||||
r_loop_starts.reserve(mesh.totloop);
|
||||
|
||||
int num_selected_loops = 0;
|
||||
int selected_loops_num = 0;
|
||||
for (const int i : IndexRange(mesh.totpoly)) {
|
||||
const MPoly &poly_src = mesh.mpoly[i];
|
||||
|
||||
|
@ -721,13 +721,13 @@ static void compute_selected_polygons_from_edge_selection(const Mesh &mesh,
|
|||
|
||||
if (all_edges_in_selection) {
|
||||
r_selected_poly_indices.append_unchecked(i);
|
||||
r_loop_starts.append_unchecked(num_selected_loops);
|
||||
num_selected_loops += poly_src.totloop;
|
||||
r_loop_starts.append_unchecked(selected_loops_num);
|
||||
selected_loops_num += poly_src.totloop;
|
||||
}
|
||||
}
|
||||
|
||||
*r_num_selected_polys = r_selected_poly_indices.size();
|
||||
*r_num_selected_loops = num_selected_loops;
|
||||
*r_selected_polys_num = r_selected_poly_indices.size();
|
||||
*r_selected_loops_num = selected_loops_num;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -740,21 +740,21 @@ static void compute_selected_mesh_data_from_vertex_selection_edge_face(
|
|||
MutableSpan<int> r_edge_map,
|
||||
Vector<int> &r_selected_poly_indices,
|
||||
Vector<int> &r_loop_starts,
|
||||
int *r_num_selected_edges,
|
||||
int *r_num_selected_polys,
|
||||
int *r_num_selected_loops)
|
||||
int *r_selected_edges_num,
|
||||
int *r_selected_polys_num,
|
||||
int *r_selected_loops_num)
|
||||
{
|
||||
|
||||
compute_selected_edges_from_vertex_selection(
|
||||
mesh, vertex_selection, invert, r_edge_map, r_num_selected_edges);
|
||||
mesh, vertex_selection, invert, r_edge_map, r_selected_edges_num);
|
||||
|
||||
compute_selected_polygons_from_vertex_selection(mesh,
|
||||
vertex_selection,
|
||||
invert,
|
||||
r_selected_poly_indices,
|
||||
r_loop_starts,
|
||||
r_num_selected_polys,
|
||||
r_num_selected_loops);
|
||||
r_selected_polys_num,
|
||||
r_selected_loops_num);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -768,24 +768,24 @@ static void compute_selected_mesh_data_from_vertex_selection(const Mesh &mesh,
|
|||
MutableSpan<int> r_edge_map,
|
||||
Vector<int> &r_selected_poly_indices,
|
||||
Vector<int> &r_loop_starts,
|
||||
int *r_num_selected_vertices,
|
||||
int *r_num_selected_edges,
|
||||
int *r_num_selected_polys,
|
||||
int *r_num_selected_loops)
|
||||
int *r_selected_vertices_num,
|
||||
int *r_selected_edges_num,
|
||||
int *r_selected_polys_num,
|
||||
int *r_selected_loops_num)
|
||||
{
|
||||
compute_selected_vertices_from_vertex_selection(
|
||||
vertex_selection, invert, r_vertex_map, r_num_selected_vertices);
|
||||
vertex_selection, invert, r_vertex_map, r_selected_vertices_num);
|
||||
|
||||
compute_selected_edges_from_vertex_selection(
|
||||
mesh, vertex_selection, invert, r_edge_map, r_num_selected_edges);
|
||||
mesh, vertex_selection, invert, r_edge_map, r_selected_edges_num);
|
||||
|
||||
compute_selected_polygons_from_vertex_selection(mesh,
|
||||
vertex_selection,
|
||||
invert,
|
||||
r_selected_poly_indices,
|
||||
r_loop_starts,
|
||||
r_num_selected_polys,
|
||||
r_num_selected_loops);
|
||||
r_selected_polys_num,
|
||||
r_selected_loops_num);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -799,19 +799,19 @@ static void compute_selected_mesh_data_from_edge_selection_edge_face(
|
|||
MutableSpan<int> r_edge_map,
|
||||
Vector<int> &r_selected_poly_indices,
|
||||
Vector<int> &r_loop_starts,
|
||||
int *r_num_selected_edges,
|
||||
int *r_num_selected_polys,
|
||||
int *r_num_selected_loops)
|
||||
int *r_selected_edges_num,
|
||||
int *r_selected_polys_num,
|
||||
int *r_selected_loops_num)
|
||||
{
|
||||
compute_selected_edges_from_edge_selection(
|
||||
mesh, edge_selection, invert, r_edge_map, r_num_selected_edges);
|
||||
mesh, edge_selection, invert, r_edge_map, r_selected_edges_num);
|
||||
compute_selected_polygons_from_edge_selection(mesh,
|
||||
edge_selection,
|
||||
invert,
|
||||
r_selected_poly_indices,
|
||||
r_loop_starts,
|
||||
r_num_selected_polys,
|
||||
r_num_selected_loops);
|
||||
r_selected_polys_num,
|
||||
r_selected_loops_num);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -825,10 +825,10 @@ static void compute_selected_mesh_data_from_edge_selection(const Mesh &mesh,
|
|||
MutableSpan<int> r_edge_map,
|
||||
Vector<int> &r_selected_poly_indices,
|
||||
Vector<int> &r_loop_starts,
|
||||
int *r_num_selected_vertices,
|
||||
int *r_num_selected_edges,
|
||||
int *r_num_selected_polys,
|
||||
int *r_num_selected_loops)
|
||||
int *r_selected_vertices_num,
|
||||
int *r_selected_edges_num,
|
||||
int *r_selected_polys_num,
|
||||
int *r_selected_loops_num)
|
||||
{
|
||||
r_vertex_map.fill(-1);
|
||||
compute_selected_vertices_and_edges_from_edge_selection(mesh,
|
||||
|
@ -836,15 +836,15 @@ static void compute_selected_mesh_data_from_edge_selection(const Mesh &mesh,
|
|||
invert,
|
||||
r_vertex_map,
|
||||
r_edge_map,
|
||||
r_num_selected_vertices,
|
||||
r_num_selected_edges);
|
||||
r_selected_vertices_num,
|
||||
r_selected_edges_num);
|
||||
compute_selected_polygons_from_edge_selection(mesh,
|
||||
edge_selection,
|
||||
invert,
|
||||
r_selected_poly_indices,
|
||||
r_loop_starts,
|
||||
r_num_selected_polys,
|
||||
r_num_selected_loops);
|
||||
r_selected_polys_num,
|
||||
r_selected_loops_num);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -855,26 +855,26 @@ static void compute_selected_polygons_from_poly_selection(const Mesh &mesh,
|
|||
const bool invert,
|
||||
Vector<int> &r_selected_poly_indices,
|
||||
Vector<int> &r_loop_starts,
|
||||
int *r_num_selected_polys,
|
||||
int *r_num_selected_loops)
|
||||
int *r_selected_polys_num,
|
||||
int *r_selected_loops_num)
|
||||
{
|
||||
BLI_assert(mesh.totpoly == poly_selection.size());
|
||||
|
||||
r_selected_poly_indices.reserve(mesh.totpoly);
|
||||
r_loop_starts.reserve(mesh.totloop);
|
||||
|
||||
int num_selected_loops = 0;
|
||||
int selected_loops_num = 0;
|
||||
for (const int i : IndexRange(mesh.totpoly)) {
|
||||
const MPoly &poly_src = mesh.mpoly[i];
|
||||
/* We keep this one. */
|
||||
if (poly_selection[i] != invert) {
|
||||
r_selected_poly_indices.append_unchecked(i);
|
||||
r_loop_starts.append_unchecked(num_selected_loops);
|
||||
num_selected_loops += poly_src.totloop;
|
||||
r_loop_starts.append_unchecked(selected_loops_num);
|
||||
selected_loops_num += poly_src.totloop;
|
||||
}
|
||||
}
|
||||
*r_num_selected_polys = r_selected_poly_indices.size();
|
||||
*r_num_selected_loops = num_selected_loops;
|
||||
*r_selected_polys_num = r_selected_poly_indices.size();
|
||||
*r_selected_loops_num = selected_loops_num;
|
||||
}
|
||||
/**
|
||||
* Checks for every polygon if it is in `poly_selection`. If it is, the edges
|
||||
|
@ -887,9 +887,9 @@ static void compute_selected_mesh_data_from_poly_selection_edge_face(
|
|||
MutableSpan<int> r_edge_map,
|
||||
Vector<int> &r_selected_poly_indices,
|
||||
Vector<int> &r_loop_starts,
|
||||
int *r_num_selected_edges,
|
||||
int *r_num_selected_polys,
|
||||
int *r_num_selected_loops)
|
||||
int *r_selected_edges_num,
|
||||
int *r_selected_polys_num,
|
||||
int *r_selected_loops_num)
|
||||
{
|
||||
BLI_assert(mesh.totpoly == poly_selection.size());
|
||||
BLI_assert(mesh.totedge == r_edge_map.size());
|
||||
|
@ -898,30 +898,30 @@ static void compute_selected_mesh_data_from_poly_selection_edge_face(
|
|||
r_selected_poly_indices.reserve(mesh.totpoly);
|
||||
r_loop_starts.reserve(mesh.totloop);
|
||||
|
||||
int num_selected_loops = 0;
|
||||
int num_selected_edges = 0;
|
||||
int selected_loops_num = 0;
|
||||
int selected_edges_num = 0;
|
||||
for (const int i : IndexRange(mesh.totpoly)) {
|
||||
const MPoly &poly_src = mesh.mpoly[i];
|
||||
/* We keep this one. */
|
||||
if (poly_selection[i] != invert) {
|
||||
r_selected_poly_indices.append_unchecked(i);
|
||||
r_loop_starts.append_unchecked(num_selected_loops);
|
||||
num_selected_loops += poly_src.totloop;
|
||||
r_loop_starts.append_unchecked(selected_loops_num);
|
||||
selected_loops_num += poly_src.totloop;
|
||||
|
||||
/* Add the vertices and the edges. */
|
||||
Span<MLoop> loops_src(&mesh.mloop[poly_src.loopstart], poly_src.totloop);
|
||||
for (const MLoop &loop : loops_src) {
|
||||
/* Check first if it has not yet been added. */
|
||||
if (r_edge_map[loop.e] == -1) {
|
||||
r_edge_map[loop.e] = num_selected_edges;
|
||||
num_selected_edges++;
|
||||
r_edge_map[loop.e] = selected_edges_num;
|
||||
selected_edges_num++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*r_num_selected_edges = num_selected_edges;
|
||||
*r_num_selected_polys = r_selected_poly_indices.size();
|
||||
*r_num_selected_loops = num_selected_loops;
|
||||
*r_selected_edges_num = selected_edges_num;
|
||||
*r_selected_polys_num = r_selected_poly_indices.size();
|
||||
*r_selected_loops_num = selected_loops_num;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -935,10 +935,10 @@ static void compute_selected_mesh_data_from_poly_selection(const Mesh &mesh,
|
|||
MutableSpan<int> r_edge_map,
|
||||
Vector<int> &r_selected_poly_indices,
|
||||
Vector<int> &r_loop_starts,
|
||||
int *r_num_selected_vertices,
|
||||
int *r_num_selected_edges,
|
||||
int *r_num_selected_polys,
|
||||
int *r_num_selected_loops)
|
||||
int *r_selected_vertices_num,
|
||||
int *r_selected_edges_num,
|
||||
int *r_selected_polys_num,
|
||||
int *r_selected_loops_num)
|
||||
{
|
||||
BLI_assert(mesh.totpoly == poly_selection.size());
|
||||
BLI_assert(mesh.totedge == r_edge_map.size());
|
||||
|
@ -948,36 +948,36 @@ static void compute_selected_mesh_data_from_poly_selection(const Mesh &mesh,
|
|||
r_selected_poly_indices.reserve(mesh.totpoly);
|
||||
r_loop_starts.reserve(mesh.totloop);
|
||||
|
||||
int num_selected_loops = 0;
|
||||
int num_selected_vertices = 0;
|
||||
int num_selected_edges = 0;
|
||||
int selected_loops_num = 0;
|
||||
int selected_verts_num = 0;
|
||||
int selected_edges_num = 0;
|
||||
for (const int i : IndexRange(mesh.totpoly)) {
|
||||
const MPoly &poly_src = mesh.mpoly[i];
|
||||
/* We keep this one. */
|
||||
if (poly_selection[i] != invert) {
|
||||
r_selected_poly_indices.append_unchecked(i);
|
||||
r_loop_starts.append_unchecked(num_selected_loops);
|
||||
num_selected_loops += poly_src.totloop;
|
||||
r_loop_starts.append_unchecked(selected_loops_num);
|
||||
selected_loops_num += poly_src.totloop;
|
||||
|
||||
/* Add the vertices and the edges. */
|
||||
Span<MLoop> loops_src(&mesh.mloop[poly_src.loopstart], poly_src.totloop);
|
||||
for (const MLoop &loop : loops_src) {
|
||||
/* Check first if it has not yet been added. */
|
||||
if (r_vertex_map[loop.v] == -1) {
|
||||
r_vertex_map[loop.v] = num_selected_vertices;
|
||||
num_selected_vertices++;
|
||||
r_vertex_map[loop.v] = selected_verts_num;
|
||||
selected_verts_num++;
|
||||
}
|
||||
if (r_edge_map[loop.e] == -1) {
|
||||
r_edge_map[loop.e] = num_selected_edges;
|
||||
num_selected_edges++;
|
||||
r_edge_map[loop.e] = selected_edges_num;
|
||||
selected_edges_num++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*r_num_selected_vertices = num_selected_vertices;
|
||||
*r_num_selected_edges = num_selected_edges;
|
||||
*r_num_selected_polys = r_selected_poly_indices.size();
|
||||
*r_num_selected_loops = num_selected_loops;
|
||||
*r_selected_vertices_num = selected_verts_num;
|
||||
*r_selected_edges_num = selected_edges_num;
|
||||
*r_selected_polys_num = r_selected_poly_indices.size();
|
||||
*r_selected_loops_num = selected_loops_num;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -993,8 +993,8 @@ static void do_mesh_separation(GeometrySet &geometry_set,
|
|||
/* Needed in all cases. */
|
||||
Vector<int> selected_poly_indices;
|
||||
Vector<int> new_loop_starts;
|
||||
int num_selected_polys = 0;
|
||||
int num_selected_loops = 0;
|
||||
int selected_polys_num = 0;
|
||||
int selected_loops_num = 0;
|
||||
|
||||
const Mesh &mesh_in = *in_component.get_for_read();
|
||||
Mesh *mesh_out;
|
||||
|
@ -1007,10 +1007,10 @@ static void do_mesh_separation(GeometrySet &geometry_set,
|
|||
switch (mode) {
|
||||
case GEO_NODE_DELETE_GEOMETRY_MODE_ALL: {
|
||||
Array<int> vertex_map(mesh_in.totvert);
|
||||
int num_selected_vertices = 0;
|
||||
int selected_verts_num = 0;
|
||||
|
||||
Array<int> edge_map(mesh_in.totedge);
|
||||
int num_selected_edges = 0;
|
||||
int selected_edges_num = 0;
|
||||
|
||||
/* Fill all the maps based on the selection. */
|
||||
switch (domain) {
|
||||
|
@ -1022,10 +1022,10 @@ static void do_mesh_separation(GeometrySet &geometry_set,
|
|||
edge_map,
|
||||
selected_poly_indices,
|
||||
new_loop_starts,
|
||||
&num_selected_vertices,
|
||||
&num_selected_edges,
|
||||
&num_selected_polys,
|
||||
&num_selected_loops);
|
||||
&selected_verts_num,
|
||||
&selected_edges_num,
|
||||
&selected_polys_num,
|
||||
&selected_loops_num);
|
||||
break;
|
||||
case ATTR_DOMAIN_EDGE:
|
||||
compute_selected_mesh_data_from_edge_selection(mesh_in,
|
||||
|
@ -1035,10 +1035,10 @@ static void do_mesh_separation(GeometrySet &geometry_set,
|
|||
edge_map,
|
||||
selected_poly_indices,
|
||||
new_loop_starts,
|
||||
&num_selected_vertices,
|
||||
&num_selected_edges,
|
||||
&num_selected_polys,
|
||||
&num_selected_loops);
|
||||
&selected_verts_num,
|
||||
&selected_edges_num,
|
||||
&selected_polys_num,
|
||||
&selected_loops_num);
|
||||
break;
|
||||
case ATTR_DOMAIN_FACE:
|
||||
compute_selected_mesh_data_from_poly_selection(mesh_in,
|
||||
|
@ -1048,21 +1048,21 @@ static void do_mesh_separation(GeometrySet &geometry_set,
|
|||
edge_map,
|
||||
selected_poly_indices,
|
||||
new_loop_starts,
|
||||
&num_selected_vertices,
|
||||
&num_selected_edges,
|
||||
&num_selected_polys,
|
||||
&num_selected_loops);
|
||||
&selected_verts_num,
|
||||
&selected_edges_num,
|
||||
&selected_polys_num,
|
||||
&selected_loops_num);
|
||||
break;
|
||||
default:
|
||||
BLI_assert_unreachable();
|
||||
break;
|
||||
}
|
||||
mesh_out = BKE_mesh_new_nomain_from_template(&mesh_in,
|
||||
num_selected_vertices,
|
||||
num_selected_edges,
|
||||
selected_verts_num,
|
||||
selected_edges_num,
|
||||
0,
|
||||
num_selected_loops,
|
||||
num_selected_polys);
|
||||
selected_loops_num,
|
||||
selected_polys_num);
|
||||
out_component.replace(mesh_out, GeometryOwnershipType::Editable);
|
||||
|
||||
/* Copy the selected parts of the mesh over to the new mesh. */
|
||||
|
@ -1084,14 +1084,14 @@ static void do_mesh_separation(GeometrySet &geometry_set,
|
|||
copy_face_corner_attributes(attributes,
|
||||
in_component,
|
||||
out_component,
|
||||
num_selected_loops,
|
||||
selected_loops_num,
|
||||
selected_poly_indices,
|
||||
mesh_in);
|
||||
break;
|
||||
}
|
||||
case GEO_NODE_DELETE_GEOMETRY_MODE_EDGE_FACE: {
|
||||
Array<int> edge_map(mesh_in.totedge);
|
||||
int num_selected_edges = 0;
|
||||
int selected_edges_num = 0;
|
||||
|
||||
/* Fill all the maps based on the selection. */
|
||||
switch (domain) {
|
||||
|
@ -1102,9 +1102,9 @@ static void do_mesh_separation(GeometrySet &geometry_set,
|
|||
edge_map,
|
||||
selected_poly_indices,
|
||||
new_loop_starts,
|
||||
&num_selected_edges,
|
||||
&num_selected_polys,
|
||||
&num_selected_loops);
|
||||
&selected_edges_num,
|
||||
&selected_polys_num,
|
||||
&selected_loops_num);
|
||||
break;
|
||||
case ATTR_DOMAIN_EDGE:
|
||||
compute_selected_mesh_data_from_edge_selection_edge_face(mesh_in,
|
||||
|
@ -1113,9 +1113,9 @@ static void do_mesh_separation(GeometrySet &geometry_set,
|
|||
edge_map,
|
||||
selected_poly_indices,
|
||||
new_loop_starts,
|
||||
&num_selected_edges,
|
||||
&num_selected_polys,
|
||||
&num_selected_loops);
|
||||
&selected_edges_num,
|
||||
&selected_polys_num,
|
||||
&selected_loops_num);
|
||||
break;
|
||||
case ATTR_DOMAIN_FACE:
|
||||
compute_selected_mesh_data_from_poly_selection_edge_face(mesh_in,
|
||||
|
@ -1124,9 +1124,9 @@ static void do_mesh_separation(GeometrySet &geometry_set,
|
|||
edge_map,
|
||||
selected_poly_indices,
|
||||
new_loop_starts,
|
||||
&num_selected_edges,
|
||||
&num_selected_polys,
|
||||
&num_selected_loops);
|
||||
&selected_edges_num,
|
||||
&selected_polys_num,
|
||||
&selected_loops_num);
|
||||
break;
|
||||
default:
|
||||
BLI_assert_unreachable();
|
||||
|
@ -1134,10 +1134,10 @@ static void do_mesh_separation(GeometrySet &geometry_set,
|
|||
}
|
||||
mesh_out = BKE_mesh_new_nomain_from_template(&mesh_in,
|
||||
mesh_in.totvert,
|
||||
num_selected_edges,
|
||||
selected_edges_num,
|
||||
0,
|
||||
num_selected_loops,
|
||||
num_selected_polys);
|
||||
selected_loops_num,
|
||||
selected_polys_num);
|
||||
out_component.replace(mesh_out, GeometryOwnershipType::Editable);
|
||||
|
||||
/* Copy the selected parts of the mesh over to the new mesh. */
|
||||
|
@ -1158,7 +1158,7 @@ static void do_mesh_separation(GeometrySet &geometry_set,
|
|||
copy_face_corner_attributes(attributes,
|
||||
in_component,
|
||||
out_component,
|
||||
num_selected_loops,
|
||||
selected_loops_num,
|
||||
selected_poly_indices,
|
||||
mesh_in);
|
||||
break;
|
||||
|
@ -1172,8 +1172,8 @@ static void do_mesh_separation(GeometrySet &geometry_set,
|
|||
invert,
|
||||
selected_poly_indices,
|
||||
new_loop_starts,
|
||||
&num_selected_polys,
|
||||
&num_selected_loops);
|
||||
&selected_polys_num,
|
||||
&selected_loops_num);
|
||||
break;
|
||||
case ATTR_DOMAIN_EDGE:
|
||||
compute_selected_polygons_from_edge_selection(mesh_in,
|
||||
|
@ -1181,8 +1181,8 @@ static void do_mesh_separation(GeometrySet &geometry_set,
|
|||
invert,
|
||||
selected_poly_indices,
|
||||
new_loop_starts,
|
||||
&num_selected_polys,
|
||||
&num_selected_loops);
|
||||
&selected_polys_num,
|
||||
&selected_loops_num);
|
||||
break;
|
||||
case ATTR_DOMAIN_FACE:
|
||||
compute_selected_polygons_from_poly_selection(mesh_in,
|
||||
|
@ -1190,15 +1190,15 @@ static void do_mesh_separation(GeometrySet &geometry_set,
|
|||
invert,
|
||||
selected_poly_indices,
|
||||
new_loop_starts,
|
||||
&num_selected_polys,
|
||||
&num_selected_loops);
|
||||
&selected_polys_num,
|
||||
&selected_loops_num);
|
||||
break;
|
||||
default:
|
||||
BLI_assert_unreachable();
|
||||
break;
|
||||
}
|
||||
mesh_out = BKE_mesh_new_nomain_from_template(
|
||||
&mesh_in, mesh_in.totvert, mesh_in.totedge, 0, num_selected_loops, num_selected_polys);
|
||||
&mesh_in, mesh_in.totvert, mesh_in.totedge, 0, selected_loops_num, selected_polys_num);
|
||||
out_component.replace(mesh_out, GeometryOwnershipType::Editable);
|
||||
|
||||
/* Copy the selected parts of the mesh over to the new mesh. */
|
||||
|
@ -1217,7 +1217,7 @@ static void do_mesh_separation(GeometrySet &geometry_set,
|
|||
copy_face_corner_attributes(attributes,
|
||||
in_component,
|
||||
out_component,
|
||||
num_selected_loops,
|
||||
selected_loops_num,
|
||||
selected_poly_indices,
|
||||
mesh_in);
|
||||
break;
|
||||
|
|
|
@ -103,8 +103,8 @@ static void transform_volume(Volume &volume, const float4x4 &transform, const De
|
|||
memcpy(vdb_matrix.asPointer(), &scale_limited_transform, sizeof(float[4][4]));
|
||||
openvdb::Mat4d vdb_matrix_d{vdb_matrix};
|
||||
|
||||
const int num_grids = BKE_volume_num_grids(&volume);
|
||||
for (const int i : IndexRange(num_grids)) {
|
||||
const int grids_num = BKE_volume_num_grids(&volume);
|
||||
for (const int i : IndexRange(grids_num)) {
|
||||
VolumeGrid *volume_grid = BKE_volume_grid_get_for_write(&volume, i);
|
||||
|
||||
openvdb::GridBase::Ptr grid = BKE_volume_grid_openvdb_for_write(&volume, volume_grid, false);
|
||||
|
|
Loading…
Reference in New Issue