USD IO: Move to the new Mesh Attributes API for Colors #105347

Merged
Sybren A. Stüvel merged 11 commits from CharlesWardlaw/blender:feature/usd_colors into main 2023-04-14 11:05:38 +02:00
3 changed files with 7 additions and 7 deletions
Showing only changes of commit 9aaf1056fe - Show all commits

View File

@ -415,7 +415,7 @@ void USDMeshReader::read_uvs(Mesh *mesh, const double motionSampleTime, const bo
}
}
void USDMeshReader::read_color_data_all(Mesh *mesh, const double motionSampleTime)
void USDMeshReader::read_color_data_all_primvars(Mesh *mesh, const double motionSampleTime)
{
if (!(mesh && mesh_prim_ && mesh->totloop > 0)) {
return;
@ -457,7 +457,7 @@ void USDMeshReader::read_color_data_all(Mesh *mesh, const double motionSampleTim
continue;
}
read_color_data(mesh, pv, motionSampleTime);
read_color_data_primvar(mesh, pv, motionSampleTime);
}
if (!active_color_name.IsEmpty()) {
@ -465,7 +465,7 @@ void USDMeshReader::read_color_data_all(Mesh *mesh, const double motionSampleTim
}
}
void USDMeshReader::read_color_data(Mesh *mesh,
void USDMeshReader::read_color_data_primvar(Mesh *mesh,
const pxr::UsdGeomPrimvar &color_primvar,
const double motionSampleTime)
{
@ -765,7 +765,7 @@ void USDMeshReader::read_custom_data(const ImportSettings *settings,
const double motionSampleTime)
{
if ((settings->read_flag & MOD_MESHSEQ_READ_COLOR) != 0) {
read_color_data_all(mesh, motionSampleTime);
read_color_data_all_primvars(mesh, motionSampleTime);
}
/* TODO: Generic readers for custom data layers not listed above. */

View File

@ -77,8 +77,9 @@ class USDMeshReader : public USDGeomReader {
Mesh *mesh,
double motionSampleTime);
void read_color_data_all(Mesh *mesh, double motionSampleTime);
void read_color_data(Mesh *mesh, const pxr::UsdGeomPrimvar &color_primvar, double motionSampleTime);
void read_color_data_all_primvars(Mesh *mesh, const double motionSampleTime);
CharlesWardlaw marked this conversation as resolved Outdated

Now there is ..._data and ..._data_all. It's not immediately clear from the naming how these relate. read_color_data_primvar and read_color_data_all_primvars would be better, but if you feel that's getting too long, documentation of what they do would already help a lot.

Now there is `..._data` and `..._data_all`. It's not immediately clear from the naming how these relate. `read_color_data_primvar` and `read_color_data_all_primvars` would be better, but if you feel that's getting too long, documentation of what they do would already help a lot.
void read_color_data_primvar(Mesh *mesh, const pxr::UsdGeomPrimvar &color_primvar,
const double motionSampleTime);
};
} // namespace blender::io::usd

View File

@ -38,7 +38,6 @@ class USDGenericMeshWriter : public USDAbstractWriter {
void write_surface_velocity(const Mesh *mesh, pxr::UsdGeomMesh usd_mesh);
void write_custom_data(const Mesh *mesh, pxr::UsdGeomMesh usd_mesh);
void write_color_data(const Mesh *mesh,
CharlesWardlaw marked this conversation as resolved Outdated

At the moment write_custom_data() only writes color data, meaning that this function is strongly related to write_color_data(). Remove the empty line between the two to show this relation more visually.

At the moment `write_custom_data()` only writes color data, meaning that this function is strongly related to `write_color_data()`. Remove the empty line between the two to show this relation more visually.
pxr::UsdGeomMesh usd_mesh,
const bke::AttributeIDRef &attribute_id,