void OnDisable() { m_state.Dispose(); // Debug.Log("OnDisable"); Selection.selectionChanged -= Repaint; Undo.willFlushUndoRecord -= Repaint; // m_metaEditor UnityEditor.Editor.DestroyImmediate(m_metaEditor); m_metaEditor = null; // m_settingsInspector UnityEditor.Editor.DestroyImmediate(m_settingsInspector); m_settingsInspector = null; // m_meshesInspector UnityEditor.Editor.DestroyImmediate(m_meshesInspector); m_meshesInspector = null; // Meta Meta = null; ScriptableObject.DestroyImmediate(m_tmpMeta); m_tmpMeta = null; // m_settings ScriptableObject.DestroyImmediate(m_settings); m_settings = null; // m_meshes ScriptableObject.DestroyImmediate(m_meshes); m_meshes = null; }
void OnDisable() { ExportRoot = null; // Debug.Log("OnDisable"); Selection.selectionChanged -= OnWizardUpdate; Undo.willFlushUndoRecord -= OnWizardUpdate; // m_metaEditor UnityEditor.Editor.DestroyImmediate(m_metaEditor); m_metaEditor = null; // m_settingsInspector UnityEditor.Editor.DestroyImmediate(m_settingsInspector); m_settingsInspector = null; // m_meshesInspector UnityEditor.Editor.DestroyImmediate(m_meshesInspector); m_meshesInspector = null; // Meta Meta = null; ScriptableObject.DestroyImmediate(m_tmpMeta); m_tmpMeta = null; // m_settings ScriptableObject.DestroyImmediate(m_settings); m_settings = null; // m_meshes ScriptableObject.DestroyImmediate(m_meshes); m_meshes = null; }
void OnEnable() { // Debug.Log("OnEnable"); Undo.willFlushUndoRecord += OnWizardUpdate; Selection.selectionChanged += OnWizardUpdate; m_tmpMeta = ScriptableObject.CreateInstance <VRMMetaObject>(); m_settings = ScriptableObject.CreateInstance <VRMExportSettings>(); m_settingsInspector = Editor.CreateEditor(m_settings); m_meshes = ScriptableObject.CreateInstance <VRMExportMeshes>(); m_meshesInspector = Editor.CreateEditor(m_meshes); }
void OnEnable() { // Debug.Log("OnEnable"); Undo.willFlushUndoRecord += Repaint; Selection.selectionChanged += Repaint; m_tmpMeta = ScriptableObject.CreateInstance <VRMMetaObject>(); m_settings = ScriptableObject.CreateInstance <VRMExportSettings>(); m_settingsInspector = Editor.CreateEditor(m_settings); m_meshes = ScriptableObject.CreateInstance <VRMExportMeshes>(); m_meshesInspector = Editor.CreateEditor(m_meshes); m_state = new MeshUtility.ExporterDialogState(); m_state.ExportRootChanged += (root) => { // update meta if (root == null) { Meta = null; } else { var meta = root.GetComponent <VRMMeta>(); if (meta != null) { Meta = meta.Meta; } else { Meta = null; } // default setting m_settings.PoseFreeze = MeshUtility.Validators.HumanoidValidator.HasRotationOrScale(root) || m_meshes.Meshes.Any(x => x.ExportBlendShapeCount > 0 && !x.HasSkinning) ; } Repaint(); }; m_state.ExportRoot = Selection.activeObject as GameObject; }
protected override void Clear() { // m_metaEditor UnityEditor.Editor.DestroyImmediate(m_metaEditor); m_metaEditor = null; // m_settingsInspector UnityEditor.Editor.DestroyImmediate(m_settingsInspector); m_settingsInspector = null; // m_meshesInspector UnityEditor.Editor.DestroyImmediate(m_meshesInspector); m_meshesInspector = null; // Meta Meta = null; ScriptableObject.DestroyImmediate(m_tmpMeta); m_tmpMeta = null; // m_settings ScriptableObject.DestroyImmediate(m_settings); m_settings = null; // m_meshes ScriptableObject.DestroyImmediate(m_meshes); m_meshes = null; }
protected override void Initialize() { m_tmpMeta = ScriptableObject.CreateInstance <VRMMetaObject>(); m_settings = ScriptableObject.CreateInstance <VRMExportSettings>(); m_settingsInspector = Editor.CreateEditor(m_settings); m_meshes = ScriptableObject.CreateInstance <VRMExportMeshes>(); m_meshesInspector = Editor.CreateEditor(m_meshes); State.ExportRootChanged += (root) => { // update meta if (root == null) { Meta = null; } else { var meta = root.GetComponent <VRMMeta>(); if (meta != null) { Meta = meta.Meta; } else { Meta = null; } // default setting m_settings.PoseFreeze = HumanoidValidator.HasRotationOrScale(root) || m_meshes.Meshes.Any(x => x.ExportBlendShapeCount > 0 && !x.HasSkinning) ; } }; }
private void OnEnable() { m_target = target as VRMExportMeshes; }
static void OnExportClicked(GameObject root, VRMMetaObject meta, VRMExportSettings settings, VRMExportMeshes meshes) { string directory; if (string.IsNullOrEmpty(m_lastExportDir)) { directory = Directory.GetParent(Application.dataPath).ToString(); } else { directory = m_lastExportDir; } // save dialog var path = EditorUtility.SaveFilePanel( "Save vrm", directory, root.name + EXTENSION, EXTENSION.Substring(1)); if (string.IsNullOrEmpty(path)) { return; } m_lastExportDir = Path.GetDirectoryName(path).Replace("\\", "/"); // export VRMEditorExporter.Export(path, root, meta, settings, meshes.Meshes); }