Exemplo n.º 1
0
        void OnGUI()
        {
            EditorGUILayout.BeginVertical();
            EditorGUILayout.LabelField("Select Target FBX Source");
            m_ModelPrefab = EditorGUILayout.ObjectField(m_ModelPrefab, typeof(GameObject), false) as GameObject;

            ModelImporter importer = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(Selection.activeObject)) as ModelImporter;

            if (importer != null)
            {
                m_ModelPrefab = AssetDatabase.LoadAssetAtPath <GameObject>(AssetDatabase.GetAssetPath(Selection.activeObject));
            }
            else
            {
                importer = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(m_ModelPrefab)) as ModelImporter;
            }

            if (!importer)
            {
                EditorGUILayout.LabelField("<Color=#FF0000>Select FBX Model</Color>", UEGUIStyle_Window.m_ErrorLabel);
                return;
            }

            m_GenerateUV = (enum_VertexData)EditorGUILayout.EnumPopup("Generate UV:", m_GenerateUV);
            if (m_GenerateUV != enum_VertexData.None && GUILayout.Button("Generate"))
            {
                if (UEAsset.SaveFilePath(out string filePath, "prefab", UEPath.RemoveExtension(UEPath.GetPathName(AssetDatabase.GetAssetPath(m_ModelPrefab))) + "_SN"))
                {
                    GenerateSkinnedTarget(UEPath.FilePathToAssetPath(filePath), m_ModelPrefab, m_GenerateUV);
                }
            }

            EditorGUILayout.EndVertical();
        }
Exemplo n.º 2
0
        void ProceedGUI()
        {
            EditorGUILayout.LabelField("Select Optimize AnimationClip Asset");
            m_OptimizeAsset = (AnimationClip)EditorGUILayout.ObjectField(m_OptimizeAsset, typeof(AnimationClip), false);

            if (!m_OptimizeAsset)
            {
                return;
            }

            m_OptimizeScale     = EditorGUILayout.Toggle("Wipe Scale:", m_OptimizeScale);
            m_OptimizePresicion = EditorGUILayout.IntSlider("Float Presicion", m_OptimizePresicion, 2, 8);
            if (GUILayout.Button("Optimize"))
            {
                if (UEAsset.SaveFilePath(out string filePath, "anim", UEPath.RemoveExtension(UEPath.GetPathName(AssetDatabase.GetAssetPath(m_OptimizeAsset))) + "_O"))
                {
                    AnimationClip clip      = OptimizeAnimation(m_OptimizeAsset, m_OptimizePresicion, m_OptimizeScale);
                    string        assetPath = UEPath.FilePathToAssetPath(filePath);
                    AssetDatabase.CreateAsset(clip, assetPath);
                }
            }
        }