示例#1
0
    //美术
    static void InitAritstTool()
    {
        if (GUILayout.Button("贴图工具", GUILayout.Height(35f)))
        {
            window.Close();
            Indra.TextureTool.TextureListWindow.OpenTexWindow();
        }
        GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
        GUILayout.Label("请在Project界面选择文件或目录!");
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("刷新模型顶部到底部的顶点色", GUILayout.Width(200), GUILayout.Height(30)))
        {
            CharacterGlintVertexColorTool.Open();
        }
        GUILayout.EndHorizontal();
        GUILayout.Label("禁用模型读写");
        GUILayout.BeginHorizontal();
        GUI.Label(GUILayoutUtility.GetRect(0, 20f, GUILayout.Width(100)), "当前路径:");
        modelRect = GUILayoutUtility.GetRect(0, 22f, GUILayout.ExpandWidth(true));
        GUI.TextField(modelRect, modelPath);
        if (GUILayout.Button("选择路径", GUILayout.Width(100), GUILayout.Height(30)))
        {
            modelPath = EditorUtility.OpenFolderPanel("选择需要检查的文件路径", string.Empty, string.Empty);
        }
        GUILayout.EndHorizontal();
        if (GUILayout.Button("禁用模型读写"))
        {
            if (!string.IsNullOrEmpty(modelPath))
            {
                string cPath = ConversionPath(modelPath);
                if (string.IsNullOrEmpty(cPath))
                {
                    return;
                }
                string[] prefabs = AssetDatabase.FindAssets("t:model", new string[] { cPath });
                FbxSimplify.CheckVertexColor(prefabs);
                FbxSimplify.CheckMultiUVs(prefabs);
            }
            else
            {
                EditorUtility.DisplayDialog("提醒", "路径为空!请选择你需要检查的路径!", "OK");
            }
        }

        GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
        GUILayout.Label("根据路径提供检测资源大小");
        GUILayout.BeginHorizontal();
        GUI.Label(GUILayoutUtility.GetRect(0, 20f, GUILayout.Width(100)), "当前路径:");
        assetRect = GUILayoutUtility.GetRect(0, 22f, GUILayout.ExpandWidth(true));
        GUI.TextField(assetRect, assetPath);
        if (GUILayout.Button("选择路径", GUILayout.Width(100), GUILayout.Height(30)))
        {
            assetPath = EditorUtility.OpenFolderPanel("选择需要检查的文件路径", string.Empty, string.Empty);
        }
        GUILayout.EndHorizontal();
        if (GUILayout.Button("检测资源大小"))
        {
            if (!string.IsNullOrEmpty(assetPath))
            {
                string cPath = ConversionPath(assetPath);
                if (string.IsNullOrEmpty(cPath))
                {
                    return;
                }
                string[] prefabs = AssetDatabase.FindAssets("t:Texture", new string[] { cPath });
                CheckTool._CheckAssetsSize(prefabs);
            }
            else
            {
                EditorUtility.DisplayDialog("提醒", "路径为空!请选择你需要检查的路径!", "OK");
            }
        }
    }
    static Rect modelNormalAndTangentRect; //预设脚本以及音效对象

    void Init()
    {
        if (string.IsNullOrEmpty(modelDvPath))
        {
            modelDvPath = @"Assets\Resources";
        }
        if (string.IsNullOrEmpty(modelNormalAndTangentPath))
        {
            modelNormalAndTangentPath = @"Assets\Resources";
        }
        if (GUILayout.Button("贴图工具", GUILayout.Height(35f)))
        {
            window.Close();
            Indra.TextureTool.TextureListWindow.OpenTexWindow();
        }
        if (GUILayout.Button("刷新模型顶部到底部的顶点色", GUILayout.Height(35)))
        {
            CharacterGlintVertexColorTool.Open();
        }

        GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
        GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));

        GUILayout.Label("移除模型法线和切线信息");
        GUILayout.BeginHorizontal();
        GUI.Label(GUILayoutUtility.GetRect(0, 20f, GUILayout.Width(100)), "当前路径:");
        modelDvRect = GUILayoutUtility.GetRect(0, 22f, GUILayout.ExpandWidth(true));
        GUI.TextField(modelDvRect, modelDvPath);
        if (GUILayout.Button("选择路径", GUILayout.Width(100), GUILayout.Height(30)))
        {
            modelDvPath = EditorUtility.OpenFolderPanel("选择需要检查的文件路径", string.Empty, string.Empty);
        }
        GUILayout.EndHorizontal();
        if (GUILayout.Button("移除模型法线和切线信息"))
        {
            if (!string.IsNullOrEmpty(modelDvPath))
            {
                string cPath = ConversionPath(modelDvPath);
                if (string.IsNullOrEmpty(cPath))
                {
                    return;
                }
                string[] prefabs = AssetDatabase.FindAssets("t:model", new string[] { cPath });
                FbxSimplify.RemoveNormalAndTangent(prefabs);
            }
            else
            {
                EditorUtility.DisplayDialog("提醒", "路径为空!请选择你需要检查的路径!", "OK");
            }
        }

        GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
        GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));

        GUILayout.Label("禁用模型读写");
        GUILayout.BeginHorizontal();
        GUI.Label(GUILayoutUtility.GetRect(0, 20f, GUILayout.Width(100)), "当前路径:");
        modelNormalAndTangentRect = GUILayoutUtility.GetRect(0, 22f, GUILayout.ExpandWidth(true));
        GUI.TextField(modelNormalAndTangentRect, modelNormalAndTangentPath);
        if (GUILayout.Button("选择路径", GUILayout.Width(100), GUILayout.Height(30)))
        {
            modelNormalAndTangentPath = EditorUtility.OpenFolderPanel("选择需要检查的文件路径", string.Empty, string.Empty);
        }
        GUILayout.EndHorizontal();
        if (GUILayout.Button("禁用模型读写"))
        {
            if (!string.IsNullOrEmpty(modelNormalAndTangentPath))
            {
                string cPath = ConversionPath(modelNormalAndTangentPath);
                if (string.IsNullOrEmpty(cPath))
                {
                    return;
                }
                string[] prefabs = AssetDatabase.FindAssets("t:model", new string[] { cPath });
                FbxSimplify.RemoveTangents(prefabs);
            }
            else
            {
                EditorUtility.DisplayDialog("提醒", "路径为空!请选择你需要检查的路径!", "OK");
            }
        }
    }