mirror of
https://github.com/lighttransport/tinyusdz.git
synced 2026-01-18 01:11:17 +01:00
Fix build errors: use std::move for set_value() calls
Fixed template deduction issues where set_value() was being called with lvalue references, causing TypeTraits specialization errors. Changed all problematic calls to use std::move() to ensure correct non-reference type deduction. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -116,7 +116,7 @@ void CreateScene(tinyusdz::Stage *stage) {
|
||||
|
||||
tinyusdz::value::matrix4d transform = a0 * b0;
|
||||
|
||||
op.set_value(transform);
|
||||
op.set_value(std::move(transform));
|
||||
|
||||
// `xformOpOrder`(token[]) is represented as std::vector<XformOp>
|
||||
xform.xformOps.push_back(op);
|
||||
@@ -130,7 +130,7 @@ void CreateScene(tinyusdz::Stage *stage) {
|
||||
translate[0] = 1.0;
|
||||
translate[1] = 2.0;
|
||||
translate[2] = 3.0;
|
||||
op.set_value(translate);
|
||||
op.set_value(std::move(translate));
|
||||
|
||||
// `xformOpOrder`(token[]) is represented as std::vector<XformOp>
|
||||
xform.xformOps.push_back(op);
|
||||
@@ -172,7 +172,7 @@ void CreateScene(tinyusdz::Stage *stage) {
|
||||
pts.push_back({1.0f, 1.0f, 0.0f});
|
||||
pts.push_back({0.0f, 1.0f, 0.0f});
|
||||
|
||||
mesh.points.set_value(pts);
|
||||
mesh.points.set_value(std::move(pts));
|
||||
}
|
||||
|
||||
{
|
||||
@@ -181,7 +181,7 @@ void CreateScene(tinyusdz::Stage *stage) {
|
||||
std::vector<int> counts;
|
||||
counts.push_back(3);
|
||||
counts.push_back(3);
|
||||
mesh.faceVertexCounts.set_value(counts);
|
||||
mesh.faceVertexCounts.set_value(std::move(counts));
|
||||
|
||||
indices.push_back(0);
|
||||
indices.push_back(1);
|
||||
@@ -191,7 +191,7 @@ void CreateScene(tinyusdz::Stage *stage) {
|
||||
indices.push_back(2);
|
||||
indices.push_back(3);
|
||||
|
||||
mesh.faceVertexIndices.set_value(indices);
|
||||
mesh.faceVertexIndices.set_value(std::move(indices));
|
||||
}
|
||||
|
||||
// primvar and custom attribute can be added to generic Property container
|
||||
@@ -212,7 +212,7 @@ void CreateScene(tinyusdz::Stage *stage) {
|
||||
uvs.push_back({0.0f, 1.0f});
|
||||
|
||||
// Fast path. Set the value directly to Attribute.
|
||||
uvAttr.set_value(uvs);
|
||||
uvAttr.set_value(std::move(uvs));
|
||||
|
||||
// or we can first build primvar::PrimVar
|
||||
// tinyusdz::primvar::PrimVar uvVar;
|
||||
@@ -240,7 +240,7 @@ void CreateScene(tinyusdz::Stage *stage) {
|
||||
uvIndices.push_back(2);
|
||||
|
||||
tinyusdz::primvar::PrimVar uvIndexVar;
|
||||
uvIndexVar.set_value(uvIndices);
|
||||
uvIndexVar.set_value(std::move(uvIndices));
|
||||
uvIndexAttr.set_var(std::move(uvIndexVar));
|
||||
// Or you can use this approach(if you want to keep a copy of PrimVar
|
||||
// data)
|
||||
@@ -280,7 +280,7 @@ void CreateScene(tinyusdz::Stage *stage) {
|
||||
uvs.push_back({1.0f, 1.0f});
|
||||
uvs.push_back({0.0f, 1.0f});
|
||||
|
||||
uvPrimvar.set_value(uvs); // value at 'default' time
|
||||
uvPrimvar.set_value(std::move(uvs)); // value at 'default' time
|
||||
uvPrimvar.set_interpolation(tinyusdz::Interpolation::Vertex);
|
||||
|
||||
std::vector<int> uvIndices;
|
||||
@@ -407,7 +407,7 @@ void CreateScene(tinyusdz::Stage *stage) {
|
||||
redVariant.metas().comment = "red color";
|
||||
tinyusdz::value::color3f redColor({1.0f, 0.0f, 0.0f});
|
||||
tinyusdz::Attribute redColorAttr;
|
||||
redColorAttr.set_value(redColor);
|
||||
redColorAttr.set_value(std::move(redColor));
|
||||
redVariant.properties().emplace("mycolor", redColorAttr);
|
||||
// TODO: Add example to add childPrims under Variant
|
||||
// redVariant.primChildren().emplace(...)
|
||||
@@ -416,7 +416,7 @@ void CreateScene(tinyusdz::Stage *stage) {
|
||||
greenVariant.metas().comment = "green color";
|
||||
tinyusdz::value::color3f greenColor({0.0f, 1.0f, 0.0f});
|
||||
tinyusdz::Attribute greenColorAttr;
|
||||
greenColorAttr.set_value(greenColor);
|
||||
greenColorAttr.set_value(std::move(greenColor));
|
||||
greenVariant.properties().emplace("mycolor", greenColorAttr);
|
||||
|
||||
variantSet.name = "red";
|
||||
|
||||
@@ -158,7 +158,7 @@ static bool MyRead(const tinyusdz::Asset &asset,
|
||||
memcpy(&val, asset.data(), 4);
|
||||
|
||||
tinyusdz::Attribute attr;
|
||||
attr.set_value(val);
|
||||
attr.set_value(std::move(val));
|
||||
attr.set_name("myval");
|
||||
attr.variability() = tinyusdz::Variability::Uniform;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ void SimpleScene(tinyusdz::Stage *stage)
|
||||
translate[0] = 1.0;
|
||||
translate[1] = 2.0;
|
||||
translate[2] = 3.0;
|
||||
op.set_value(translate);
|
||||
op.set_value(std::move(translate));
|
||||
|
||||
xform.xformOps.push_back(op);
|
||||
|
||||
@@ -41,7 +41,7 @@ void SimpleScene(tinyusdz::Stage *stage)
|
||||
|
||||
pts.push_back({0.0f, 1.0f, 0.0f});
|
||||
|
||||
mesh.points.set_value(pts);
|
||||
mesh.points.set_value(std::move(pts));
|
||||
}
|
||||
|
||||
{
|
||||
@@ -50,7 +50,7 @@ void SimpleScene(tinyusdz::Stage *stage)
|
||||
std::vector<int> counts;
|
||||
counts.push_back(3);
|
||||
counts.push_back(3);
|
||||
mesh.faceVertexCounts.set_value(counts);
|
||||
mesh.faceVertexCounts.set_value(std::move(counts));
|
||||
|
||||
indices.push_back(0);
|
||||
indices.push_back(1);
|
||||
@@ -60,7 +60,7 @@ void SimpleScene(tinyusdz::Stage *stage)
|
||||
indices.push_back(2);
|
||||
indices.push_back(3);
|
||||
|
||||
mesh.faceVertexIndices.set_value(indices);
|
||||
mesh.faceVertexIndices.set_value(std::move(indices));
|
||||
}
|
||||
|
||||
// primvar and custom attribute can be added to generic Property container `props`
|
||||
@@ -80,7 +80,7 @@ void SimpleScene(tinyusdz::Stage *stage)
|
||||
uvs.push_back({0.0f, 1.0f});
|
||||
|
||||
// Fast path. Set the value directly to Attribute.
|
||||
uvAttr.set_value(uvs);
|
||||
uvAttr.set_value(std::move(uvs));
|
||||
|
||||
// or we can first build primvar::PrimVar
|
||||
//tinyusdz::primvar::PrimVar uvVar;
|
||||
@@ -109,7 +109,7 @@ void SimpleScene(tinyusdz::Stage *stage)
|
||||
|
||||
|
||||
tinyusdz::primvar::PrimVar uvIndexVar;
|
||||
uvIndexVar.set_value(uvIndices);
|
||||
uvIndexVar.set_value(std::move(uvIndices));
|
||||
uvIndexAttr.set_var(std::move(uvIndexVar));
|
||||
|
||||
tinyusdz::Property uvIndexProp(uvIndexAttr, /* custom*/false);
|
||||
|
||||
@@ -20,7 +20,7 @@ void primvar_test(void) {
|
||||
tinyusdz::GeomMesh mesh;
|
||||
std::vector<float> scalar_array = {1.0, 2.0, 3.0, 4.0};
|
||||
tinyusdz::Attribute attr;
|
||||
attr.set_value(scalar_array);
|
||||
attr.set_value(std::move(scalar_array));
|
||||
tinyusdz::Property prop(attr, /* custom */false);
|
||||
|
||||
mesh.props.emplace("primvars:myvar", prop);
|
||||
|
||||
Reference in New Issue
Block a user