-
Notifications
You must be signed in to change notification settings - Fork 436
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #903 from ousttrue/feature10/export_dialog_validator
Feature10/export dialog validator
- Loading branch information
Showing
12 changed files
with
309 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
Assets/UniGLTF/Editor/UniGLTF/ExportDialog/MeshExportValidatorEditor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
|
||
using System; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace UniGLTF | ||
{ | ||
[CustomEditor(typeof(MeshExportValidator))] | ||
public class MeshExportValidatorEditor : Editor | ||
{ | ||
MeshExportValidator m_target; | ||
|
||
private void OnEnable() | ||
{ | ||
m_target = target as MeshExportValidator; | ||
} | ||
|
||
public override void OnInspectorGUI() | ||
{ | ||
for (int i = 0; i < m_target.Meshes.Count; ++i) | ||
{ | ||
DrawElement(i, m_target.Meshes[i]); | ||
} | ||
} | ||
|
||
static (Rect, Rect) LeftRight(float x, float y, float left, float right, float height) | ||
{ | ||
return ( | ||
new Rect(x, y, left, height), | ||
new Rect(x + left, y, right, height) | ||
); | ||
} | ||
|
||
void DrawElement(int i, UniGLTF.MeshExportInfo info) | ||
{ | ||
var r = GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, GUILayout.Height(EditorGUIUtility.singleLineHeight * 3 + 20)); | ||
var col0 = 32; | ||
var (left, right) = LeftRight(r.x, r.y, col0, r.width - col0, EditorGUIUtility.singleLineHeight); | ||
EditorGUI.LabelField(left, $"{i,3}"); | ||
|
||
GUI.enabled = false; | ||
EditorGUI.ObjectField(right, info.Renderer, info.Renderer.GetType(), true); | ||
|
||
right.y += EditorGUIUtility.singleLineHeight; | ||
EditorGUI.ObjectField(right, info.Mesh, info.Renderer.GetType(), true); | ||
GUI.enabled = true; | ||
|
||
right.y += EditorGUIUtility.singleLineHeight; | ||
EditorGUI.LabelField(right, info.Summary); | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
Assets/UniGLTF/Editor/UniGLTF/ExportDialog/MeshExportValidatorEditor.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,10 @@ | ||
|
||
using System; | ||
using UniGLTF; | ||
using UnityEditor; | ||
using UnityEngine; | ||
|
||
namespace VRM | ||
{ | ||
[CustomEditor(typeof(VRMExportMeshes))] | ||
public class VRMExportMeshesEditor : Editor | ||
public class VRMExportMeshesEditor : MeshExportValidatorEditor | ||
{ | ||
VRMExportMeshes m_target; | ||
|
||
private void OnEnable() | ||
{ | ||
m_target = target as VRMExportMeshes; | ||
} | ||
|
||
public override void OnInspectorGUI() | ||
{ | ||
for (int i = 0; i < m_target.Meshes.Count; ++i) | ||
{ | ||
DrawElement(i, m_target.Meshes[i]); | ||
} | ||
} | ||
|
||
static (Rect, Rect) LeftRight(float x, float y, float left, float right, float height) | ||
{ | ||
return ( | ||
new Rect(x, y, left, height), | ||
new Rect(x + left, y, right, height) | ||
); | ||
} | ||
|
||
void DrawElement(int i, UniGLTF.MeshExportInfo info) | ||
{ | ||
var r = GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, GUILayout.Height(EditorGUIUtility.singleLineHeight * 3 + 20)); | ||
var col0 = 32; | ||
var (left, right) = LeftRight(r.x, r.y, col0, r.width - col0, EditorGUIUtility.singleLineHeight); | ||
EditorGUI.LabelField(left, $"{i,3}"); | ||
|
||
GUI.enabled = false; | ||
EditorGUI.ObjectField(right, info.Renderer, info.Renderer.GetType(), true); | ||
|
||
right.y += EditorGUIUtility.singleLineHeight; | ||
EditorGUI.ObjectField(right, info.Mesh, info.Renderer.GetType(), true); | ||
GUI.enabled = true; | ||
|
||
right.y += EditorGUIUtility.singleLineHeight; | ||
EditorGUI.LabelField(right, info.Summary); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using UniGLTF; | ||
using UnityEngine; | ||
|
||
namespace UniVRM10 | ||
{ | ||
[Serializable] | ||
public class VRM10ExportSettings : ScriptableObject | ||
{ | ||
/// <summary> | ||
/// エクスポート時にBlendShapeClipから参照されないBlendShapeを削除する | ||
/// </summary> | ||
[Tooltip("Remove blendshape that is not used from BlendShapeClip")] | ||
public bool ReduceBlendshape = false; | ||
|
||
/// <summary> | ||
/// skip if BlendShapeClip.Preset == Unknown | ||
/// </summary> | ||
[Tooltip("Remove blendShapeClip that preset is Unknown")] | ||
public bool ReduceBlendshapeClip = false; | ||
|
||
public MeshExportSettings MeshExportSettings => new MeshExportSettings | ||
{ | ||
UseSparseAccessorForMorphTarget = true, | ||
ExportOnlyBlendShapePosition = true, | ||
DivideVertexBuffer = true, | ||
}; | ||
|
||
public GameObject Root { get; set; } | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.