示例#1
0
文件: Program.cs 项目: nesrak1/UABEA
        public bool SelectionValidForPlugin(AssetsManager am, UABEAPluginAction action, List <AssetContainer> selection, out string name)
        {
            name = "Batch import .png";

            if (action != UABEAPluginAction.Import)
            {
                return(false);
            }

            if (selection.Count <= 1)
            {
                return(false);
            }

            int classId = AssetHelper.FindAssetClassByName(am.classFile, "Texture2D").classId;

            foreach (AssetContainer cont in selection)
            {
                if (cont.ClassId != classId)
                {
                    return(false);
                }
            }
            return(true);
        }
示例#2
0
        public bool SelectionValidForPlugin(AssetsManager am, UABEAPluginAction action, List <AssetExternal> selection, out string name)
        {
            name = "Export .png";

            if (action != UABEAPluginAction.Export)
            {
                return(false);
            }

            //temporary
            if (selection.Count != 1)
            {
                return(false);
            }

            int classId = AssetHelper.FindAssetClassByName(am.classFile, "Texture2D").classId;

            foreach (AssetExternal ext in selection)
            {
                if (ext.info.curFileType != classId)
                {
                    return(false);
                }
            }
            return(true);
        }
示例#3
0
        public List <UABEAPluginMenuInfo> GetPluginsThatSupport(AssetsManager am, List <AssetExternal> selectedAssets)
        {
            List <UABEAPluginMenuInfo> menuInfos = new List <UABEAPluginMenuInfo>();

            foreach (var pluginInf in loadedPlugins)
            {
                foreach (var option in pluginInf.options)
                {
                    for (int i = 0; i < 2; i++)
                    {
                        //these are separate actions even though they always work the same
                        UABEAPluginAction action = i == 0 ? UABEAPluginAction.Import : UABEAPluginAction.Export;
                        bool supported           = option.SelectionValidForPlugin(am, action, selectedAssets, out string entryName);
                        if (supported)
                        {
                            UABEAPluginMenuInfo menuInf = new UABEAPluginMenuInfo(pluginInf, option, entryName);
                            menuInfos.Add(menuInf);
                        }
                    }
                }
            }
            return(menuInfos);
            //List<IElementDescriptor> selectedDescriptors = new List<IElementDescriptor>();
            //foreach (AssetExternal ext in selectedAssets)
            //{
            //    selectedDescriptors.Add(new ImportDescriptor());
            //    selectedDescriptors.Add(new ExportDescriptor());
            //}
            //
            //List<PluginInfo> supportedPlugins = new List<PluginInfo>();
            //foreach (var plugin in loadedPlugins)
            //{
            //    foreach (var option in plugin.options)
            //    {
            //        option.supportCallback(pluginInterface, selectedDescriptors, new string[0], out string desc, out bool supportsBatch);
            //    }
            //}
            //return supportedPlugins;
        }
示例#4
0
        public List <UABEAPluginMenuInfo> GetPluginsThatSupport(AssetsManager am, List <AssetContainer> selectedAssets)
        {
            List <UABEAPluginMenuInfo> menuInfos = new List <UABEAPluginMenuInfo>();

            foreach (var pluginInf in loadedPlugins)
            {
                foreach (var option in pluginInf.options)
                {
                    for (int i = 0; i < 2; i++)
                    {
                        //these are separate actions even though they always work the same
                        UABEAPluginAction action = i == 0 ? UABEAPluginAction.Import : UABEAPluginAction.Export;
                        bool supported           = option.SelectionValidForPlugin(am, action, selectedAssets, out string entryName);
                        if (supported)
                        {
                            UABEAPluginMenuInfo menuInf = new UABEAPluginMenuInfo(pluginInf, option, entryName);
                            menuInfos.Add(menuInf);
                        }
                    }
                }
            }
            return(menuInfos);
        }