mesh empty

This commit is contained in:
ousttrue
2023-11-06 19:47:06 +09:00
parent 12c5f9a7d2
commit f917b8f372
2 changed files with 20 additions and 5 deletions

View File

@@ -356,10 +356,6 @@ namespace UniGLTF.MeshUtility
}
}
if (report.Count > 0)
{
Debug.LogFormat("{0}", report.ToString());
}
// restore blendshape weights
for (int i = 0; i < backcup.Count; ++i)
{

View File

@@ -152,6 +152,23 @@ namespace UniVRM10
}
}
static GameObject GetOrCreateEmpty(GameObject go, string name)
{
foreach (var child in go.transform.GetChildren())
{
if (child.name == name
&& child.localPosition == Vector3.zero
&& child.localScale == Vector3.one
&& child.localRotation == Quaternion.identity)
{
return child.gameObject;
}
}
var empty = new GameObject(name);
empty.transform.SetParent(go.transform, false);
return empty;
}
public void Process(GameObject go)
{
var vrmInstance = go.GetComponent<Vrm10Instance>();
@@ -226,6 +243,8 @@ namespace UniVRM10
}
{
var empty = GetOrCreateEmpty(go, "mesh");
// TODO: UNDO
var results = new List<MeshIntegrationResult>();
foreach (var group in copy)
@@ -235,7 +254,7 @@ namespace UniVRM10
: MeshIntegrator.BlendShapeOperation.None);
results.Add(result);
result.AddIntegratedRendererTo(go);
result.AddIntegratedRendererTo(empty);
if (generateFirstPerson && group.Name == "auto")
{