private void ImportCarInterior_Execute(object parameter) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Gltf files|*.glb;*.gltf|All files|*.*"; dialog.Title = "Select a gltf model file"; if (!string.IsNullOrEmpty(mainView.FilePath)) { dialog.FileName = Path.GetFileNameWithoutExtension(mainView.FilePath); dialog.InitialDirectory = Path.GetDirectoryName(mainView.FilePath); } if (dialog.ShowDialog() == true) { try { var gltf = ModelRoot.Load(dialog.FileName); var conv = new GltfCarInteriorPssgConverter(); conv.Convert(gltf, _pssg); mainView.LoadPssg(null); } catch (Exception ex) { MessageBox.Show("Could not import the model!" + Environment.NewLine + Environment.NewLine + ex.Message, Properties.Resources.AppTitleLong, MessageBoxButton.OK, MessageBoxImage.Error); } } }
private bool ImportCarInterior_CanExecute(object parameter) { try { return(_pssg != null && GltfCarInteriorPssgConverter.SupportsPssg(_pssg)); } catch { return(false); } }