1
0
mirror of synced 2024-11-28 01:10:51 +01:00

Try to support cmb rigging

This commit is contained in:
KillzXGaming 2019-11-16 15:39:40 -05:00
parent 2f328a2664
commit 317e4f7367
2 changed files with 12 additions and 10 deletions

View File

@ -278,7 +278,7 @@ namespace FirstPlugin
mat = Materials[mesh.MaterialIndex];
CmbMeshWrapper genericMesh = new CmbMeshWrapper(mat);
genericMesh.Text = $"Mesh {MeshIndex++}";
genericMesh.Text = $"Mesh_{MeshIndex++}";
genericMesh.MaterialIndex = mesh.MaterialIndex;
//Wow this is long
@ -349,14 +349,14 @@ namespace FirstPlugin
&& shape.BoneIndices.Type == CmbDataType.UByte; //Noclip checks the type for ubyte so do the same
bool HasWeights = shape.Primatives[0].SkinningMode == SkinningMode.SMOOTH_SKINNING;
/*
if (shape.BoneIndices.VertexData != null && HasSkinning && shape.BoneIndices.VertexData.Length > v)
{
var BoneIndices = shape.BoneIndices.VertexData[v];
for (int j = 0; j < shape.boneDimension; j++)
{
ushort index = shape.Primatives[0].BoneIndexTable[(uint)BoneIndices[j]];
vert.boneIds.Add((int)index);
// ushort index = shape.Primatives[0].BoneIndexTable[(uint)BoneIndices[j]];
vert.boneIds.Add((int)BoneIndices[j]);
}
}
if (shape.BoneWeights.VertexData != null && HasWeights && shape.BoneWeights.VertexData.Length > v)
@ -366,7 +366,7 @@ namespace FirstPlugin
{
vert.boneWeights.Add(BoneWeights[j]);
}
}*/
}
genericMesh.vertices.Add(vert);
}

View File

@ -852,15 +852,17 @@ namespace Toolbox.Library.Collada
public string GetUniqueID(string id)
{
if (AttributeIdList.ContainsKey(id))
string name = id.Replace(" ", string.Empty);
if (AttributeIdList.ContainsKey(name))
{
AttributeIdList[id]++;
return $"{id}_{AttributeIdList[id]}";//
AttributeIdList[name]++;
return $"{name}_{AttributeIdList[name]}";//
}
else
{
AttributeIdList.Add(id, 0);
return id;
AttributeIdList.Add(name, 0);
return name;
}
}