mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-11 21:38:56 -05:00
T-Poseボタンの表示位置を変更(T-Poseにしないと表示されなかった)
This commit is contained in:
@@ -77,10 +77,8 @@ namespace UniGLTF
|
||||
void OnGUI()
|
||||
{
|
||||
var modified = false;
|
||||
if (BeginGUI())
|
||||
{
|
||||
modified = DoGUI();
|
||||
}
|
||||
var isValid = BeginGUI();
|
||||
modified = DoGUI(isValid);
|
||||
EndGUI();
|
||||
|
||||
if (modified)
|
||||
@@ -89,7 +87,7 @@ namespace UniGLTF
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract bool DoGUI();
|
||||
protected abstract bool DoGUI(bool isValid);
|
||||
|
||||
protected virtual void OnLayout()
|
||||
{
|
||||
|
||||
@@ -50,8 +50,13 @@ namespace UniGLTF
|
||||
yield break;
|
||||
}
|
||||
}
|
||||
protected override bool DoGUI()
|
||||
protected override bool DoGUI(bool isValid)
|
||||
{
|
||||
if (!isValid)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_settings.Root = State.ExportRoot;
|
||||
m_settingsInspector.OnInspectorGUI();
|
||||
return true;
|
||||
|
||||
@@ -24,7 +24,6 @@ namespace VRM
|
||||
{
|
||||
Meta,
|
||||
Mesh,
|
||||
Humanoid,
|
||||
BlendShape,
|
||||
ExportSettings,
|
||||
}
|
||||
@@ -176,10 +175,71 @@ namespace VRM
|
||||
m_meshes.SetRoot(State.ExportRoot, m_settings);
|
||||
}
|
||||
|
||||
protected override bool DoGUI()
|
||||
protected override bool DoGUI(bool isValid)
|
||||
{
|
||||
if (State.ExportRoot == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// T-Pose
|
||||
//
|
||||
if (State.ExportRoot.GetComponent<Animator>() != null)
|
||||
{
|
||||
var backup = GUI.enabled;
|
||||
GUI.enabled = State.ExportRoot.scene.IsValid();
|
||||
if (GUI.enabled)
|
||||
{
|
||||
EditorGUILayout.HelpBox(EnableTPose.ENALBE_TPOSE_BUTTON.Msg(), MessageType.Info);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.HelpBox(EnableTPose.DISABLE_TPOSE_BUTTON.Msg(), MessageType.Warning);
|
||||
}
|
||||
|
||||
//
|
||||
// T-Pose
|
||||
//
|
||||
if (GUILayout.Button(VRMExportSettingsEditor.Options.DO_TPOSE.Msg()))
|
||||
{
|
||||
if (State.ExportRoot != null)
|
||||
{
|
||||
// fallback
|
||||
Undo.RecordObjects(State.ExportRoot.GetComponentsInChildren<Transform>(), "tpose");
|
||||
VRMBoneNormalizer.EnforceTPose(State.ExportRoot);
|
||||
Repaint();
|
||||
}
|
||||
}
|
||||
|
||||
if (GUILayout.Button(VRMExportSettingsEditor.Options.DO_TPOSE.Msg() + "(unity internal)"))
|
||||
{
|
||||
if (State.ExportRoot != null)
|
||||
{
|
||||
Undo.RecordObjects(State.ExportRoot.GetComponentsInChildren<Transform>(), "tpose.internal");
|
||||
if (InternalTPose.TryMakePoseValid(State.ExportRoot))
|
||||
{
|
||||
// done
|
||||
Repaint();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("not found");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GUI.enabled = backup;
|
||||
}
|
||||
|
||||
if (!isValid)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
EditorGUILayout.HelpBox($"Mesh size: {m_meshes.ExpectedExportByteSize / 1000000.0f:0.0} MByte", MessageType.Info);
|
||||
|
||||
|
||||
//
|
||||
// GUI
|
||||
//
|
||||
@@ -226,52 +286,6 @@ namespace VRM
|
||||
m_meshesInspector.OnInspectorGUI();
|
||||
break;
|
||||
|
||||
case Tabs.Humanoid:
|
||||
{
|
||||
var backup = GUI.enabled;
|
||||
GUI.enabled = State.ExportRoot.scene.IsValid();
|
||||
if (GUI.enabled)
|
||||
{
|
||||
EditorGUILayout.HelpBox(EnableTPose.ENALBE_TPOSE_BUTTON.Msg(), MessageType.Info);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.HelpBox(EnableTPose.DISABLE_TPOSE_BUTTON.Msg(), MessageType.Warning);
|
||||
}
|
||||
|
||||
//
|
||||
// T-Pose
|
||||
//
|
||||
if (GUILayout.Button(VRMExportSettingsEditor.Options.DO_TPOSE.Msg()))
|
||||
{
|
||||
if (State.ExportRoot != null)
|
||||
{
|
||||
// fallback
|
||||
Undo.RecordObjects(State.ExportRoot.GetComponentsInChildren<Transform>(), "tpose");
|
||||
VRMBoneNormalizer.EnforceTPose(State.ExportRoot);
|
||||
}
|
||||
}
|
||||
|
||||
if (GUILayout.Button(VRMExportSettingsEditor.Options.DO_TPOSE.Msg() + "(unity internal)"))
|
||||
{
|
||||
if (State.ExportRoot != null)
|
||||
{
|
||||
Undo.RecordObjects(State.ExportRoot.GetComponentsInChildren<Transform>(), "tpose.internal");
|
||||
if (InternalTPose.TryMakePoseValid(State.ExportRoot))
|
||||
{
|
||||
// done
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("not found");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GUI.enabled = backup;
|
||||
}
|
||||
break;
|
||||
|
||||
case Tabs.BlendShape:
|
||||
if (State.ExportRoot)
|
||||
{
|
||||
|
||||
@@ -26,7 +26,6 @@ namespace UniVRM10
|
||||
{
|
||||
Meta,
|
||||
Mesh,
|
||||
Humanoid,
|
||||
ExportSettings,
|
||||
}
|
||||
Tabs _tab;
|
||||
@@ -136,8 +135,64 @@ namespace UniVRM10
|
||||
yield return meta.Validate;
|
||||
}
|
||||
|
||||
protected override bool DoGUI()
|
||||
protected override bool DoGUI(bool isValid)
|
||||
{
|
||||
if (State.ExportRoot == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (State.ExportRoot.GetComponent<Animator>() != null)
|
||||
{
|
||||
//
|
||||
// T-Pose
|
||||
//
|
||||
// if (GUILayout.Button("T-Pose"))
|
||||
// {
|
||||
// if (State.ExportRoot != null)
|
||||
// {
|
||||
// // fallback
|
||||
// Undo.RecordObjects(State.ExportRoot.GetComponentsInChildren<Transform>(), "tpose");
|
||||
// VRMBoneNormalizer.EnforceTPose(State.ExportRoot);
|
||||
// }
|
||||
// }
|
||||
|
||||
var backup = GUI.enabled;
|
||||
GUI.enabled = State.ExportRoot.scene.IsValid();
|
||||
if (GUI.enabled)
|
||||
{
|
||||
EditorGUILayout.HelpBox(EnableTPose.ENALBE_TPOSE_BUTTON.Msg(), MessageType.Info);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.HelpBox(EnableTPose.DISABLE_TPOSE_BUTTON.Msg(), MessageType.Warning);
|
||||
}
|
||||
|
||||
if (GUILayout.Button("T-Pose" + "(unity internal)"))
|
||||
{
|
||||
if (State.ExportRoot != null)
|
||||
{
|
||||
Undo.RecordObjects(State.ExportRoot.GetComponentsInChildren<Transform>(), "tpose.internal");
|
||||
if (InternalTPose.TryMakePoseValid(State.ExportRoot))
|
||||
{
|
||||
// done
|
||||
Repaint();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("not found");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GUI.enabled = backup;
|
||||
}
|
||||
|
||||
if (!isValid)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_tmpMeta == null)
|
||||
{
|
||||
// disabled
|
||||
@@ -170,52 +225,6 @@ namespace UniVRM10
|
||||
case Tabs.Mesh:
|
||||
// m_meshesInspector.OnInspectorGUI();
|
||||
break;
|
||||
|
||||
case Tabs.Humanoid:
|
||||
{
|
||||
//
|
||||
// T-Pose
|
||||
//
|
||||
// if (GUILayout.Button("T-Pose"))
|
||||
// {
|
||||
// if (State.ExportRoot != null)
|
||||
// {
|
||||
// // fallback
|
||||
// Undo.RecordObjects(State.ExportRoot.GetComponentsInChildren<Transform>(), "tpose");
|
||||
// VRMBoneNormalizer.EnforceTPose(State.ExportRoot);
|
||||
// }
|
||||
// }
|
||||
|
||||
var backup = GUI.enabled;
|
||||
GUI.enabled = State.ExportRoot.scene.IsValid();
|
||||
if (GUI.enabled)
|
||||
{
|
||||
EditorGUILayout.HelpBox(EnableTPose.ENALBE_TPOSE_BUTTON.Msg(), MessageType.Info);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorGUILayout.HelpBox(EnableTPose.DISABLE_TPOSE_BUTTON.Msg(), MessageType.Warning);
|
||||
}
|
||||
|
||||
if (GUILayout.Button("T-Pose" + "(unity internal)"))
|
||||
{
|
||||
if (State.ExportRoot != null)
|
||||
{
|
||||
Undo.RecordObjects(State.ExportRoot.GetComponentsInChildren<Transform>(), "tpose.internal");
|
||||
if (InternalTPose.TryMakePoseValid(State.ExportRoot))
|
||||
{
|
||||
// done
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogWarning("not found");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GUI.enabled = backup;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user