Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 675 - do not write UV channel count if we're not writing UVs #676

Merged
merged 3 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 22 additions & 20 deletions bouncer/src/repo/core/model/bson/repo_bson_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,9 +453,6 @@ MeshNode RepoBSONFactory::makeMeshNode(
// UV channels
if (uvChannels.size() > 0)
{
// Could be unsigned __int64 if BSON had such construct (the closest is only __int64)
builder.append(REPO_NODE_MESH_LABEL_UV_CHANNELS_COUNT, (uint32_t)(uvChannels.size()));

std::vector<repo::lib::RepoVector2D> concatenated;

for (auto it = uvChannels.begin(); it != uvChannels.end(); ++it)
Expand All @@ -471,25 +468,30 @@ MeshNode RepoBSONFactory::makeMeshNode(

uint64_t uvByteCount = concatenated.size() * sizeof(concatenated[0]);

if (uvByteCount + bytesize >= REPO_BSON_MAX_BYTE_SIZE)
{
std::string bName = uniqueID.toString() + "_uv";
//inclusion of this binary exceeds the maximum, store separately
binMapping[REPO_NODE_MESH_LABEL_UV_CHANNELS] =
std::pair<std::string, std::vector<uint8_t>>(bName, std::vector<uint8_t>());
binMapping[REPO_NODE_MESH_LABEL_UV_CHANNELS].second.resize(uvByteCount); //uint8_t will ensure it is a byte addrressing
memcpy(binMapping[REPO_NODE_MESH_LABEL_UV_CHANNELS].second.data(), &concatenated[0], uvByteCount);
if (uvByteCount > 0) {
// Could be unsigned __int64 if BSON had such construct (the closest is only __int64)
builder.append(REPO_NODE_MESH_LABEL_UV_CHANNELS_COUNT, (uint32_t)(uvChannels.size()));

bytesize += sizeof(bName);
}
else if(uvByteCount > 0)
{
builder.appendBinary(
REPO_NODE_MESH_LABEL_UV_CHANNELS,
&concatenated[0],
concatenated.size() * sizeof(concatenated[0]));
if (uvByteCount + bytesize >= REPO_BSON_MAX_BYTE_SIZE)
{
std::string bName = uniqueID.toString() + "_uv";
//inclusion of this binary exceeds the maximum, store separately
binMapping[REPO_NODE_MESH_LABEL_UV_CHANNELS] =
std::pair<std::string, std::vector<uint8_t>>(bName, std::vector<uint8_t>());
binMapping[REPO_NODE_MESH_LABEL_UV_CHANNELS].second.resize(uvByteCount); //uint8_t will ensure it is a byte addrressing
memcpy(binMapping[REPO_NODE_MESH_LABEL_UV_CHANNELS].second.data(), &concatenated[0], uvByteCount);

bytesize += sizeof(bName);
}
else
{
builder.appendBinary(
REPO_NODE_MESH_LABEL_UV_CHANNELS,
&concatenated[0],
concatenated.size() * sizeof(concatenated[0]));

bytesize += uvByteCount;
bytesize += uvByteCount;
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions test/src/system/st_3drepobouncerClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,10 @@ TEST(RepoClientTest, UploadTestSPM)
std::string spmUpload5 = produceUploadArgs(db, "synchroTest5", getDataPath(synchroVersion6_5));
EXPECT_EQ((int)REPOERR_OK, runProcess(spmUpload5));
EXPECT_TRUE(projectExists(db, "synchroTest5"));

std::string spmUpload6 = produceUploadArgs(db, "synchroTest6", getDataPath(synchroVersion6_5_3_7));
EXPECT_EQ((int)REPOERR_OK, runProcess(spmUpload6));
EXPECT_TRUE(projectExists(db, "synchroTest6"));
}

TEST(RepoClientTest, UploadTestRVTRegressionTests)
Expand Down
1 change: 1 addition & 0 deletions test/src/unit/repo_test_database_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const static std::string synchroOldVersion = "synchro6_1.spm";
const static std::string synchroVersion6_3 = "synchro6_3.spm";
const static std::string synchroVersion6_4 = "synchro6_4.spm";
const static std::string synchroVersion6_5 = "synchro6_5.spm";
const static std::string synchroVersion6_5_3_7 = "synchro6_5_3_7.spm";

const static std::string emptyFile = "empty.json";
const static std::string emptyJSONFile = "empty2.json";
Expand Down
3 changes: 0 additions & 3 deletions tools/release/git_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ def updateBouncerWorker(version):
updateSrcHeaders(majorV, minorTag);
updateBouncerWorker(version)

execExitOnFail("git clean -f -d", "Failed to clean directory")


execExitOnFail("git commit -m \"Version " + version + "\"", "Failed to commit")

execExitOnFail("git push origin :refs/tags/" + version, "Failed to push tag")
Expand Down
Loading