USD Import: USD Shapes Support #104707
|
@ -144,7 +144,7 @@ Mesh *USDShapeReader::read_mesh(struct Mesh *existing_mesh,
|
|||
const char should_smooth = prim_.IsA<pxr::UsdGeomCube>() ? 0 : ME_SMOOTH;
|
||||
CharlesWardlaw marked this conversation as resolved
|
||||
|
||||
CharlesWardlaw marked this conversation as resolved
Hans Goudey
commented
Same here with the unused arguments Same here with the unused arguments
Charles Wardlaw
commented
Changed. Changed.
|
||||
if (active_mesh != existing_mesh) {
|
||||
int loop_index = 0;
|
||||
int loop_index = 0;
|
||||
for (int i = 0; i < face_counts.size(); i++) {
|
||||
const int face_size = face_counts[i];
|
||||
|
||||
|
@ -172,20 +172,23 @@ Mesh *USDShapeReader::mesh_from_prim(Mesh *existing_mesh,
|
|||
{
|
||||
pxr::VtVec3fArray positions;
|
||||
|
||||
CharlesWardlaw marked this conversation as resolved
Hans Goudey
commented
Why do you need to calculate the edges if you didn't change anything above? Why do you need to calculate the edges if you didn't change anything above?
Charles Wardlaw
commented
mesh_from_prim() does not calculate edges; I deferred their calculation to this spot. mesh_from_prim() does not calculate edges; I deferred their calculation to this spot.
Hans Goudey
commented
Yes, but my point is, shouldn't it be in the Yes, but my point is, shouldn't it be in the `if (active_mesh != existing_mesh) {` where the corner vertices are actually set? Otherwise it looks like it's calculating edges unnecessarily.
Charles Wardlaw
commented
No, because No, because `active_mesh` was created by `mesh_from_prim()` which does not calculate the edges. They need to be calculated either way.
|
||||
Mesh *active_mesh = existing_mesh;
|
||||
|
||||
if (!read_mesh_values(motionSampleTime, positions, face_indices, face_counts)) {
|
||||
CharlesWardlaw marked this conversation as resolved
Hans Goudey
commented
No need to tag normals dirty on a new mesh. You aren't changing the positions here anyway, so it's not the correct update tag if any was actually needed. No need to tag normals dirty on a new mesh. You aren't changing the positions here anyway, so it's not the correct update tag if any was actually needed.
Charles Wardlaw
commented
Seems to be fine now without-- removed. Seems to be fine now without-- removed.
|
||||
return active_mesh;
|
||||
return existing_mesh;
|
||||
}
|
||||
|
||||
const bool poly_counts_match = existing_mesh ? face_counts.size() == existing_mesh->totpoly :
|
||||
false;
|
||||
const bool position_counts_match = existing_mesh ? positions.size() == existing_mesh->totvert :
|
||||
CharlesWardlaw marked this conversation as resolved
Hans Goudey
commented
Clang format! Clang format!
Charles Wardlaw
commented
Reformatted file. Reformatted file.
|
||||
false;
|
||||
|
||||
Mesh *active_mesh = nullptr;
|
||||
if (!position_counts_match || !poly_counts_match) {
|
||||
active_mesh = BKE_mesh_new_nomain_from_template(
|
||||
existing_mesh, positions.size(), 0, 0, face_indices.size(), face_counts.size());
|
||||
}
|
||||
else {
|
||||
active_mesh = existing_mesh;
|
||||
}
|
||||
|
||||
MutableSpan<float3> vert_positions = active_mesh->vert_positions_for_write();
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Declare
loop_index
at the smallest scope possible, right above thefor (int i = 0; i < face_counts.size(); i++) {
loop.