Merge pull request #401 from ousttrue/fix_export_nonactive_mesh

Fix export nonactive mesh
This commit is contained in:
hiroj 2020-05-19 13:34:48 +09:00 committed by GitHub
commit d949f7852f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 41 additions and 1 deletions

View File

@ -25,6 +25,18 @@ namespace VRM
wiz.OnWizardUpdate();
}
void OnEnable()
{
// Debug.Log("OnEnable");
EditorApplication.hierarchyWindowChanged += OnWizardUpdate;
}
void OnDisable()
{
// Debug.Log("OnDisable");
EditorApplication.hierarchyWindowChanged -= OnWizardUpdate;
}
void OnWizardCreate()
{
// save dialog

View File

@ -83,6 +83,11 @@ namespace VRM
{
yield return "ReduceBlendshapeSize is need VRMBlendShapeProxy, you need to convert to VRM once.";
}
if(Source.GetComponentsInChildren<Renderer>().All(x => !x.gameObject.activeInHierarchy))
{
yield return "No active mesh";
}
}
public void InitializeFrom(GameObject go)

View File

@ -19,8 +19,22 @@ namespace VRM
{
var transform = UniGLTF.UnityExtensions.GetFromPath(root.transform, binding.RelativePath);
var renderer = transform.GetComponent<SkinnedMeshRenderer>();
if (renderer == null)
{
return null;
}
if(!renderer.gameObject.activeInHierarchy)
{
return null;
}
var mesh = renderer.sharedMesh;
var meshIndex = meshes.IndexOf(mesh);
if (meshIndex == -1)
{
return null;
}
return new glTF_VRM_BlendShapeBind
{
@ -36,7 +50,16 @@ namespace VRM
var list = new List<glTF_VRM_BlendShapeBind>();
if (clip.Values != null)
{
list.AddRange(clip.Values.Select(y => Create(transform, meshes.ToList(), y)));
foreach (var value in clip.Values)
{
var bind = Create(transform, meshes, value);
if (bind == null)
{
// Debug.LogFormat("{0}: skip blendshapebind", clip.name);
continue;
}
list.Add(bind);
}
}
var materialList = new List<glTF_VRM_MaterialValueBind>();