Example #1
0
        /// <summary>
        /// Constructs this sceneView with a list of files for exporting.
        /// </summary>
        /// <param name="filesToExport"></param>
        public AssetExporter(GUIProject project, ArrayList itemsToExport)
        {
            mProject       = project;
            mItemsToExport = itemsToExport;

            InitializeComponent();

            // Add the platforms to the listbox.
            for (int i = 0; i < mProject.Platforms.Count; i++)
            {
                mPlatformsListBox.Items.Add(mProject.Platforms[i], true);
            }

            // Add the items that we want to export.  Can be of any type.
            for (int i = 0; i < itemsToExport.Count; i++)
            {
                mFilesListBox.Items.Add(itemsToExport[i], true);
            }
        }
Example #2
0
        /// <summary>
        /// Processes the command line
        /// </summary>
        /// <param name="args"></param>
        private static void ProcessCommandLine(CommandLineArgs commandLineArgs)
        {
            // Perform some validation
            if (commandLineArgs.mExport)
            {
                Otter.Interface.Graphics.Instance = new Otter.Interface.Graphics(0);
                int renderContext = Otter.Interface.Graphics.Instance.CreateContext(0, 10, 10);

                ImporterExporter exporter = new ImporterExporter();

                // We need a valid project specified
                if (!System.IO.File.Exists(commandLineArgs.mProject))
                {
                    System.Console.WriteLine("Invalid or no project specified.");
                    Otter.Interface.Graphics.Instance.DestroyContext(renderContext);
                    return;
                }

                // Open the project
                GUIProject.CurrentProject = GUIProject.Load(commandLineArgs.mProject);

                // We need a valid platform specified
                Platform targetPlatform = null;
                foreach (Platform platform in GUIProject.CurrentProject.Platforms)
                {
                    if (platform.Name == commandLineArgs.mPlatform)
                    {
                        targetPlatform = platform;
                        break;
                    }
                }

                if (targetPlatform == null)
                {
                    System.Console.WriteLine("Invalid or no platform specified");
                    Otter.Interface.Graphics.Instance.DestroyContext(renderContext);
                    return;
                }

                // See if we have an output directory override
                string outputDir = targetPlatform.OutputDirectory;
                if (commandLineArgs.mOutputDir != "")
                {
                    outputDir = commandLineArgs.mOutputDir;
                    targetPlatform.OutputDirectory = outputDir;
                }

                // Determine the output directory.  If it's not rooted, we need to construct
                // the rooted path
                string projectDir = System.IO.Path.GetDirectoryName(commandLineArgs.mProject);
                if (!System.IO.Path.IsPathRooted(outputDir))
                {
                    outputDir = projectDir + "\\" + outputDir;
                }

                // Create the output directory and verify that it exists
                System.IO.Directory.CreateDirectory(outputDir);
                if (!System.IO.Directory.Exists(outputDir))
                {
                    System.Console.WriteLine("Invalid output directory for platform " + targetPlatform.Name + " : " + outputDir);
                    Otter.Interface.Graphics.Instance.DestroyContext(renderContext);
                    return;
                }

                ArrayList       itemsToExport = ImporterExporter.GetItemsToExport(GUIProject.CurrentProject.Entries);
                List <Platform> platforms     = new List <Platform>(new Platform[] { targetPlatform });

                // Finally, export.
                foreach (object item in itemsToExport)
                {
                    System.Console.Write("Exporting.. %s : " + item.ToString());
                    bool bSuccess = exporter.Export(item, platforms);
                    System.Console.WriteLine(bSuccess ? " success" : " FAILED");
                }

                Otter.Interface.Graphics.Instance.DestroyContext(renderContext);
            }
        }