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 = HumanoidValidator.HasRotationOrScale(root) || m_meshes.Meshes.Any(x => x.ExportBlendShapeCount > 0 && !x.HasSkinning) ; } Repaint(); }; m_state.ExportRoot = Selection.activeObject as GameObject; }
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) ; } }; }