예제 #1
0
            public MorphManifest GetManifestForCoreMesh(CoreMesh coreMesh, ManifestSelection selectionMethod)
            {
                string meshKey = selectionMethod.ToString();

                if (selectionMethod == ManifestSelection.AutoDetect)
                {
                    // There is no easy way to detect to which base avatar (MCSFemale/MCSMale) our asset belongs.
                    // The most reliable way I could find is to check their morphdata for blendshapes that are unique to one gender.
                    // Not all objects are affected by all blendshapes (e.g. shoes don't have face morphs), so we'll pick a couple that affect the whole body to cover our bases.
                    // If this still wrongly identifies a mesh, pick manual selectionMethod.
                    bool isFemale = (GetMorphData(coreMesh.runtimeMorphPath, "FBMGogoBody") != null || GetMorphData(coreMesh.runtimeMorphPath, "FHMGogoHead") != null);
                    meshKey = (isFemale) ? "MCSFemale" : "MCSMale";
                }

                if (_currentReport != null && _currentReport.name == coreMesh.name)
                {
                    _currentReport.manifest = meshKey;
                }
                return(streamingMorphs.GetManifest(meshKey, false));
            }
예제 #2
0
        void OnGUI()
        {
            _windowScroll = EditorGUILayout.BeginScrollView(_windowScroll, GUILayout.ExpandHeight(true));

            // Converter Group
            BeginFoldoutGroup("Morph Converter", ref _showConversionGroup);
            if (_showConversionGroup)
            {
                using (new EditorGUI.DisabledScope(_enableConvert == true && _showAdvancedConvertSettings == false)) {
                    if (GUILayout.Button(new GUIContent("Extract Vertex Maps", "Extract vertex maps from MCS content\n(intended for 2017.x)")) && !_activeProcess.isActive)
                    {
                        ExtractVertexMaps(_useSelection);
                    }
                    if (ProcessIsActive("Extract"))
                    {
                        ShowProgress();
                    }
                }
                using (new EditorGUI.DisabledScope(_enableConvert == false && _showAdvancedConvertSettings == false)) {
                    if (GUILayout.Button(new GUIContent("Fix Morph Data", "Convert morph data using extracted vertex maps\n(intended for 2018.4+)")) && !_activeProcess.isActive)
                    {
                        ConvertMorphData(_useSelection);
                    }
                    if (ProcessIsActive("Convert"))
                    {
                        ShowProgress();
                    }
                }

                // Advanced settings
                _showAdvancedConvertSettings = EditorGUILayout.Foldout(_showAdvancedConvertSettings, new GUIContent("Advanced", "Here be dragons!"));
                if (_showAdvancedConvertSettings)
                {
                    _useSelection            = EditorGUILayout.Toggle(new GUIContent("Use Selection", "Only process selected content"), _useSelection);
                    _manifestSelectionMethod = (ManifestSelection)EditorGUILayout.EnumPopup(new GUIContent("Manifest:", "Manually set base character manifest\nUSE ONLY IN CASE AUTODETECT FAILS"), _manifestSelectionMethod);
                }
            }
            EndFoldoutGroup();
            EditorGUILayout.Space();

            // Edit Group
            BeginFoldoutGroup("Morph Editor", ref _showEditGroup);
            if (_showEditGroup)
            {
                EditorGUILayout.LabelField("Enter Morph Names (separate by comma):");
                _editMorphScroll    = EditorGUILayout.BeginScrollView(_editMorphScroll, GUILayout.Height(48));
                _editMorphFieldText = EditorGUILayout.TextArea(_editMorphFieldText, GUILayout.ExpandHeight(true));
                EditorGUILayout.EndScrollView();
                if (GUILayout.Button(new GUIContent("Remove Morphs From Selected Assets", "")) && !_activeProcess.isActive)
                {
                    HashSet <string> morphList = new HashSet <string>();
                    string[]         input     = _editMorphFieldText.Replace(" ", "").Split(',');
                    foreach (string morph in input)
                    {
                        if (morph != "")
                        {
                            morphList.Add(morph);
                        }
                    }
                    RemoveMorphsFromSelected(new List <string>(morphList));
                }
                if (ProcessIsActive("Edit"))
                {
                    ShowProgress();
                }
            }
            EndFoldoutGroup();
            EditorGUILayout.Space();

            // Utility Group
            BeginFoldoutGroup("Utilities", ref _showUtilGroup);
            if (_showUtilGroup)
            {
                if (GUILayout.Button(new GUIContent("Remove LOD Groups", "Removes LOD Group components on all selected MCS Character Managers and attached costume items in scene")) && !_activeProcess.isActive)
                {
                    RemoveLOD();
                }
            }
            EndFoldoutGroup();

            EditorGUILayout.EndScrollView();
        }