/// <summary>
        /// Spawns the import model dialog and walks through the full steps to import a model,
        /// with user interaction.
        /// </summary>
        /// <param name="item">Item to import to</param>
        /// <param name="race">Race to import to</param>
        /// <param name="windowOwner">Window parent, default uses TexTools main window.</param>
        /// <param name="onComplete">Function to be called after import completes, but before user has closed the window. (Task handler returns when window is closed)</param>
        /// <param name="dataOnly">If this should be just load the data to memory and not import the resultant MDL.  Data can be accessed with ImportModelView.GetData()</param>
        /// <param name="lastImportFilePath">The path to the file that was last imported for path auto-fill purposes in case the user repeatedly wants to import the same file</param>
        /// <returns>A tuple containing a boolean indicating whether or not the import was successful or not and a string containing the path to the imported model file</returns>
        public static async Task <(bool, string)> ImportModel(IItemModel item, XivRace race, string submeshId = null, Window windowOwner = null, Action onComplete = null, bool dataOnly = false, string lastImportFilePath = null)
        {
            if (windowOwner == null)
            {
                // Default to the main root window if we don't have an owner.
                windowOwner = MainWindow.GetMainWindow();
            }

            var imView = new ImportModelView(item, race, onComplete, submeshId, dataOnly, lastImportFilePath)
            {
                Owner = windowOwner
            };

            // This blocks until the dialog closes.
            var result = imView.ShowDialog();

            return(result == true, imView.FileNameTextBox.Text);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Spawns the import model dialog and walks through the full steps to import a model,
        /// with user interaction.
        /// </summary>
        /// <param name="item">Item to import to</param>
        /// <param name="race">Race to import to</param>
        /// <param name="windowOwner">Window parent, default uses TexTools main window.</param>
        /// <param name="onComplete">Function to be called after import completes, but before user has closed the window. (Task handler returns when window is closed)</param>
        /// <param name="dataOnly">If this should be just load the data to memory and not import the resultant MDL.  Data can be accessed with ImportModelView.GetData()</param>
        /// <returns></returns>
        public static async Task <bool> ImportModel(IItemModel item, XivRace race, string submeshId = null, Window windowOwner = null, Action onComplete = null, bool dataOnly = false)
        {
            if (windowOwner == null)
            {
                // Default to the main root window if we don't have an owner.
                windowOwner = MainWindow.GetMainWindow();
            }

            var imView = new ImportModelView(item, race, onComplete, submeshId, dataOnly)
            {
                Owner = windowOwner
            };

            // This blocks until the dialog closes.
            var result = imView.ShowDialog();

            // Coalesce
            bool ret = result == true ? true : false;

            return(ret);
        }