Esempio n. 1
0
        private bool PromptFileSave(IGeometryModel model, out string fileName, out string formatId)
        {
            var getExportFormats = Substrate.GetSharedFunction <GetExportFormats>("Reclaimer.Plugins.ModelViewerPlugin.GetExportFormats");

            var exportFormats = getExportFormats()
                                .Select(f => new
            {
                FormatId    = f,
                Extension   = ModelViewerPlugin.GetFormatExtension(f),
                Description = ModelViewerPlugin.GetFormatDescription(f)
            }).ToList();

            var filter = string.Join("|", exportFormats.Select(f => $"{f.Description}|*.{f.Extension}"));

            var sfd = new SaveFileDialog
            {
                OverwritePrompt = true,
                FileName        = model.Name,
                Filter          = filter,
                FilterIndex     = 1 + exportFormats.TakeWhile(f => f.FormatId != ArchitectSettingsPlugin.Settings.DefaultSaveFormat).Count(),
                AddExtension    = true
            };

            if (sfd.ShowDialog() != true)
            {
                fileName = formatId = null;
                return(false);
            }

            fileName = sfd.FileName;
            formatId = exportFormats[sfd.FilterIndex - 1].FormatId;
            ArchitectSettingsPlugin.Settings.DefaultSaveFormat = formatId;
            return(true);
        }
Esempio n. 2
0
        public override void Initialise()
        {
            Settings = LoadSettings <PluginSettings>();
            LogOutput("Loaded example settings");

            NotALocalFunction = Substrate.GetSharedFunction <ForeignFunction>("PluginNamespace.PluginClass.FunctionName");
        }
Esempio n. 3
0
        private void btnExportSelectedBitmaps_Click(object sender, RoutedEventArgs e)
        {
            var export     = Substrate.GetSharedFunction <ExportSelectedBitmaps>(Constants.SharedFuncExportSelectedBitmaps);
            var matIndices = GetSelectedPermutations()
                             .SelectMany(p => Enumerable.Range(p.MeshIndex, p.MeshCount))
                             .Select(i => model.Meshes.ElementAtOrDefault(i))
                             .Where(m => m != null)
                             .SelectMany(m => m.Submeshes.Select(s => (int)s.MaterialIndex))
                             .Distinct();

            export.Invoke(geometry, matIndices);
        }
Esempio n. 4
0
        private void btnExportAll_Click(object sender, RoutedEventArgs e)
        {
            using (var model = renderGeometry.ReadGeometry(SelectedLod))
            {
                var writeModelFile = Substrate.GetSharedFunction <WriteModelFile>("Reclaimer.Plugins.ModelViewerPlugin.WriteModelFile");

                string fileName, formatId;
                if (!PromptFileSave(model, out fileName, out formatId))
                {
                    return;
                }

                writeModelFile(model, fileName, formatId);
            }
        }
Esempio n. 5
0
        private void btnExportSelectedBitmaps_Click(object sender, RoutedEventArgs e)
        {
            using (var model = renderGeometry.ReadGeometry(SelectedLod))
            {
                var export     = Substrate.GetSharedFunction <ExportSelectedBitmaps>("Reclaimer.Plugins.ModelViewerPlugin.ExportSelectedBitmaps");
                var matIndices = GetSelectedPermutations(model)
                                 .SelectMany(p => Enumerable.Range(p.MeshIndex, p.MeshCount))
                                 .Select(i => model.Meshes.ElementAtOrDefault(i))
                                 .Where(m => m != null)
                                 .SelectMany(m => m.Submeshes.Select(s => (int)s.MaterialIndex))
                                 .Distinct()
                                 .ToList();

                export.Invoke(renderGeometry, matIndices);
            }
        }
Esempio n. 6
0
        private void btnExportBitmaps_Click(object sender, RoutedEventArgs e)
        {
            var export = Substrate.GetSharedFunction <ExportBitmaps>("Reclaimer.Plugins.ModelViewerPlugin.ExportBitmaps");

            export?.Invoke(renderGeometry);
        }
Esempio n. 7
0
        private void btnExportBitmaps_Click(object sender, RoutedEventArgs e)
        {
            var export = Substrate.GetSharedFunction <ExportBitmaps>(Constants.SharedFuncExportBitmaps);

            export.Invoke(geometry);
        }