unity3d-jp / MeshSync

A package for synchronizing meshes/models editing in DCC tools into Unity in real time.
Other
1.55k stars 174 forks source link

Mesh::mergeMesh don't merge attributes correctly. #868

Closed Puppy-M closed 1 year ago

Puppy-M commented 1 year ago

For example, in this per-vertex judgment,base.size()== points.size() should be base.size()== num_points_old,because the points have been inserted above.

"msMesh.cpp"

auto expand_vertex_attribute = [&](auto& base, const auto& add) {
...
        if ((base.empty() || base.size()== points.size()) && (add.empty() || add.size() == v.points.size())) {
            // per-vertex attribute
            if (add.empty()) {
                base.resize(points.size(), {});
            }
            else {
                base.resize(num_points_old);
                base.insert(base.end(), add.begin(), add.end());
            }
        }
...
    };
sindharta commented 1 year ago

What is the actual problem that you are having ?

Puppy-M commented 1 year ago

meshA has normal info. Then do meshA.mergeMesh(meshB); , the normal info of meshB didn't merged into meshA.

sindharta commented 1 year ago

I mean, without looking at the code, do you have a sample DCC tool file that shows your problem ? Any screenshot ?

Puppy-M commented 1 year ago

No screeshot yet. I'm right tring to implent an plugin for SketchUp base on the MeshSyncClient. And when I try to use this merge function, I noticed this issue.

sindharta commented 1 year ago

After a bit of investigation, it turns out that Mesh::mergeMesh is a function that we are not using at all, so we are going to remove it.

sindharta-tanuwijaya commented 1 year ago

We removed the code in this PR, and this will be reflected in our next release. https://github.com/unity3d-jp/MeshSync/pull/872

You are free to keep the previous code, but we are not going to maintain it.