Skip to content
Permalink
Browse files

Merge branch 'master-3.0' into onecsproj_onexkpkg2

  • Loading branch information
xen2 committed Oct 26, 2018
2 parents 34c504e + c8f0765 commit 3a4e324c89c5574edb23a8a42e6d9853b37f1450
Showing with 498 additions and 114 deletions.
  1. +6 −8 BACKERS.md
  2. +1 −0 THIRD PARTY.md
  3. +1 −1 sources/core/Xenko.Core.Mathematics/ColorBGRA.cs
  4. +25 −1 ...r/Xenko.Core.Assets.Editor/Components/TemplateDescriptions/ViewModels/ExistingProjectViewModel.cs
  5. +13 −4 ....Editor/Components/TemplateDescriptions/ViewModels/NewOrOpenSessionTemplateCollectionViewModel.cs
  6. +1 −1 ...ssets.Editor/Components/TemplateDescriptions/ViewModels/TemplateDescriptionCollectionViewModel.cs
  7. +1 −1 ...itor/Xenko.Core.Assets.Editor/Components/TemplateDescriptions/Views/ObjectBrowserUserControl.xaml
  8. +4 −0 ...r/Xenko.Core.Assets.Editor/Components/TemplateDescriptions/Views/ObjectBrowserUserControl.xaml.cs
  9. +39 −12 ...or/Xenko.Core.Assets.Editor/Components/TemplateDescriptions/Views/TemplateBrowserUserControl.xaml
  10. +51 −7 sources/editor/Xenko.Core.Assets.Editor/ViewModel/EditorViewModel.cs
  11. +1 −1 sources/editor/Xenko.Core.Assets.Editor/ViewModel/SessionViewModel.cs
  12. +3 −0 sources/editor/Xenko.Core.Assets.Editor/Xenko.Core.Assets.Editor.csproj
  13. +20 −39 sources/editor/Xenko.Core.MostRecentlyUsedFiles/MostRecentlyUsedFileCollection.cs
  14. +2 −2 sources/editor/Xenko.GameStudio/GameStudioViewModel.cs
  15. +2 −2 sources/editor/Xenko.GameStudio/Program.cs
  16. +1 −1 sources/engine/Xenko.Assets.Models/AssimpAssetImporter.cs
  17. +1 −1 sources/engine/Xenko.Assets.Models/ImportAssimpCommand.cs
  18. +52 −0 sources/engine/Xenko.Assets/Entities/EntityHierarchyAssetBase.Upgraders.cs
  19. +2 −1 sources/engine/Xenko.Assets/Entities/PrefabAsset.cs
  20. +2 −1 sources/engine/Xenko.Assets/Entities/SceneAsset.cs
  21. +1 −1 sources/engine/Xenko.Games/Desktop/GameWindowWinforms.cs
  22. +1 −1 sources/engine/Xenko.Games/GameBase.cs
  23. +34 −4 sources/engine/Xenko.Graphics/Direct3D/Texture.Direct3D.cs
  24. +7 −2 sources/engine/Xenko.Graphics/FastTextRenderer.cs
  25. +23 −0 sources/engine/Xenko.Graphics/Texture.cs
  26. +6 −5 sources/engine/Xenko.Graphics/TextureDescription.Extensions2D.cs
  27. +5 −0 sources/engine/Xenko.Graphics/TextureDescription.cs
  28. +85 −0 sources/engine/Xenko.Graphics/TextureOptions.cs
  29. +7 −6 sources/engine/Xenko.Physics/Elements/CharacterComponent.cs
  30. +18 −0 sources/launcher/Xenko.Launcher/Resources/Strings.Designer.cs
  31. +8 −0 sources/launcher/Xenko.Launcher/Resources/Strings.resx
  32. +14 −5 sources/launcher/Xenko.Launcher/Services/GameStudioSettings.cs
  33. +8 −2 sources/launcher/Xenko.Launcher/ViewModels/LauncherViewModel.cs
  34. +29 −1 sources/launcher/Xenko.Launcher/ViewModels/RecentProjectViewModel.cs
  35. +2 −1 sources/launcher/Xenko.Launcher/Views/LauncherWindow.xaml
  36. +9 −0 sources/localization/Xenko.GameStudio.pot
  37. +10 −0 sources/localization/ja/Xenko.GameStudio.ja.po
  38. +3 −3 sources/tools/Xenko.Importer.Assimp/Xenko.Importer.Assimp.cpp
@@ -7,15 +7,13 @@ Xenko is a MIT-licensed opensource project, supported by generous [sponsors and

Thank you everybody for your generous contributions!

## Sponsor

* Chance McDonald

## Super Backers

* Robert Campbell
* [vvvv.org](https://vvvv.org/)
* Jason Kinzer
* [Marshmallow Laser Feast](http://www.marshmallowlaserfeast.com/)
* Jean-Baptiste Perrier

## Backers

@@ -31,17 +29,17 @@ Thank you everybody for your generous contributions!
* Nathan Warden
* Empty Keys
* Dmitry Terentev
* Shane
* Chris Beckwith
* Harald Mühleder
* Szymon Kobalczyk
* Philippe Monteil
* Cobalt
* Matthias Hölzl
* Ryan Galkowski
* Jon Stelly
* Jean-Baptiste Perrier
* Antony K. Jones
* Thomas Tang
* Beliar
* Robert Iadanza
* SleepyMode

## Mini Backers

@@ -39,6 +39,7 @@ Xenko uses the following open-source products.
### License gift to Xenko

* [Advanced Installer](https://www.advancedinstaller.com/) graciously offered us an Enterprise license. Thanks!
* [NDepend](https://www.ndepend.com/) for static code analysis. Thanks for providing us an Open Source license!

### Opensource

@@ -7,7 +7,7 @@
namespace Xenko.Core.Mathematics
{
/// <summary>
/// Represents a 32-bit color (4 bytes) in the form of BGRA (in byte order: B, G, B, A).
/// Represents a 32-bit color (4 bytes) in the form of BGRA (in byte order: B, G, R, A).
/// </summary>
[DataContract("ColorBGRA")]
[DataStyle(DataStyle.Compact)]
@@ -2,21 +2,29 @@
// Distributed under the MIT license. See the LICENSE.md file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Windows.Media.Imaging;
using Xenko.Core.Assets.Editor.ViewModel;
using Xenko.Core.Assets.Templates;
using Xenko.Core.IO;
using Xenko.Core.Presentation.Commands;
using Xenko.Core.Presentation.ViewModel;

namespace Xenko.Core.Assets.Editor.Components.TemplateDescriptions.ViewModels
{
public class ExistingProjectViewModel : DispatcherViewModel, ITemplateDescriptionViewModel
{
public ExistingProjectViewModel(IViewModelServiceProvider serviceProvider, UFile path)
private Action<ExistingProjectViewModel> RemoveAction;

public ExistingProjectViewModel(IViewModelServiceProvider serviceProvider, UFile path, Action<ExistingProjectViewModel> removeAction)
: base(serviceProvider)
{
Path = path;
Id = Guid.NewGuid();
RemoveAction = removeAction ?? throw new ArgumentNullException(nameof(removeAction));
ExploreCommand = new AnonymousCommand(serviceProvider, Explore);
RemoveCommand = new AnonymousCommand(serviceProvider, Remove);
}

public string Name => Path.GetFileNameWithoutExtension();
@@ -37,9 +45,25 @@ public ExistingProjectViewModel(IViewModelServiceProvider serviceProvider, UFile

public IEnumerable<BitmapImage> Screenshots => Enumerable.Empty<BitmapImage>();

public ICommandBase ExploreCommand { get; }

public ICommandBase RemoveCommand { get; }

public TemplateDescription GetTemplate()
{
return null;
}

private void Explore()
{
var startInfo = new ProcessStartInfo("explorer.exe", $"/select,{this.Path.ToWindowsPath()}") { UseShellExecute = true };
var explorer = new Process { StartInfo = startInfo };
explorer.Start();
}

private void Remove()
{
RemoveAction(this);
}
}
}
@@ -40,10 +40,9 @@ public NewOrOpenSessionTemplateCollectionViewModel(IViewModelServiceProvider ser
}

recentGroup = new TemplateDescriptionGroupViewModel(serviceProvider, "Recent projects");
var mru = EditorViewModel.Instance.MRU;
foreach (var file in mru.MostRecentlyUsedFiles)
foreach (var file in EditorViewModel.Instance.RecentFiles)
{
var viewModel = new ExistingProjectViewModel(ServiceProvider, file.FilePath);
var viewModel = new ExistingProjectViewModel(ServiceProvider, file.FilePath, RemoveExistingProjects);
recentGroup.Templates.Add(viewModel);
}

@@ -91,12 +90,22 @@ protected override string UpdateNameFromSelectedTemplate()
return GenerateUniqueNameAtLocation();
}

private void RemoveExistingProjects(ExistingProjectViewModel item)
{
if (item == null)
return;

EditorViewModel.Instance.RemoveRecentFile(item.Path);
SelectedGroup.Templates.Remove(item);
UpdateTemplateList();
}

private async Task BrowseForExistingProject()
{
var filePath = await EditorDialogHelper.BrowseForExistingProject(ServiceProvider);
if (filePath != null)
{
SelectedTemplate = new ExistingProjectViewModel(ServiceProvider, filePath);
SelectedTemplate = new ExistingProjectViewModel(ServiceProvider, filePath, RemoveExistingProjects);
dialog?.RequestClose(DialogResult.Ok);
}
}
@@ -45,7 +45,7 @@ protected static TemplateDescriptionGroupViewModel ProcessGroup(TemplateDescript

protected abstract string UpdateNameFromSelectedTemplate();

private void UpdateTemplateList()
protected void UpdateTemplateList()
{
templates.Clear();
if (SelectedGroup != null)
@@ -33,7 +33,7 @@
<ListBox Grid.Column="2"
ItemsSource="{Binding ObjectItemsSource, ElementName=ObjectBrowser, Mode=TwoWay}"
SelectedItem="{Binding SelectedObjectItem, ElementName=ObjectBrowser, Mode=TwoWay}"
ItemTemplate="{Binding ObjectItemTemplate, ElementName=ObjectBrowser, Mode=TwoWay}"
ItemTemplateSelector="{Binding ObjectItemTemplateSelector, ElementName=ObjectBrowser, Mode=TwoWay }"
ItemContainerStyle="{Binding ObjectItemContainerStyle, ElementName=ObjectBrowser, Mode=TwoWay}"
ScrollViewer.HorizontalScrollBarVisibility="Disabled"/>

@@ -26,6 +26,8 @@ public partial class ObjectBrowserUserControl

public static readonly DependencyProperty ObjectItemTemplateProperty = DependencyProperty.Register("ObjectItemTemplate", typeof(DataTemplate), typeof(ObjectBrowserUserControl));

public static readonly DependencyProperty ObjectItemTemplateSelectorProperty = DependencyProperty.Register("ObjectItemTemplateSelector", typeof(DataTemplateSelector), typeof(ObjectBrowserUserControl));

public static readonly DependencyProperty ObjectItemContainerStyleProperty = DependencyProperty.Register("ObjectItemContainerStyle", typeof(Style), typeof(ObjectBrowserUserControl));

public static readonly DependencyProperty ObjectDescriptionTemplateProperty = DependencyProperty.Register("ObjectDescriptionTemplate", typeof(DataTemplate), typeof(ObjectBrowserUserControl));
@@ -51,6 +53,8 @@ public ObjectBrowserUserControl()

public DataTemplate ObjectItemTemplate { get { return (DataTemplate)GetValue(ObjectItemTemplateProperty); } set { SetValue(ObjectItemTemplateProperty, value); } }

public DataTemplate ObjectItemTemplateSelector { get { return (DataTemplate)GetValue(ObjectItemTemplateSelectorProperty); } set { SetValue(ObjectItemTemplateSelectorProperty, value); } }

public Style ObjectItemContainerStyle { get { return (Style)GetValue(ObjectItemContainerStyleProperty); } set { SetValue(ObjectItemContainerStyleProperty, value); } }

public DataTemplate ObjectDescriptionTemplate { get { return (DataTemplate)GetValue(ObjectDescriptionTemplateProperty); } set { SetValue(ObjectDescriptionTemplateProperty, value); } }
@@ -5,6 +5,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:xk="http://schemas.xenko.com/xaml/presentation"
xmlns:views="clr-namespace:Xenko.Core.Assets.Editor.Components.TemplateDescriptions.Views"
xmlns:providers="clr-namespace:Xenko.Core.Assets.Editor.View.TemplateProviders"
xmlns:viewModels="clr-namespace:Xenko.Core.Assets.Editor.Components.TemplateDescriptions.ViewModels"
mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModels:TemplateDescriptionCollectionViewModel}"
d:DesignHeight="300" d:DesignWidth="300">
@@ -13,13 +14,50 @@
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../../../View/CommonResources.xaml"/>
</ResourceDictionary.MergedDictionaries>

<providers:DataTypeTemplateSelector x:Key="dataTypeTemplateSelector" >
<providers:DataTypeTemplateSelector.TemplateDefinitions>
<providers:TemplateDefinition DataType="viewModels:ExistingProjectViewModel">
<providers:TemplateDefinition.DataTemplate>
<DataTemplate>
<DockPanel Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=ListBox}, Converter={xk:SumNum}, ConverterParameter={xk:Double -10}}" Margin="0,0,-5,0" Height="56">
<Image Source="{Binding Icon}" DockPanel.Dock="Left" Width="48" Height="48" Margin="2"/>
<DockPanel Margin="18,0">
<TextBlock DockPanel.Dock="Top" FontSize="16" Text="{Binding Name}"/>
<TextBlock Text="{Binding Description}" TextWrapping="Wrap" TextTrimming="WordEllipsis"/>
</DockPanel>
<DockPanel.ContextMenu>
<ContextMenu>
<MenuItem Header="{xk:Localize Show in Explorer, Context=Menu}" Command="{Binding ExploreCommand}" />
<MenuItem Header="{xk:Localize Remove From List, Context=Menu}" Command="{Binding RemoveCommand}" />
</ContextMenu>
</DockPanel.ContextMenu>
</DockPanel>
</DataTemplate>
</providers:TemplateDefinition.DataTemplate>
</providers:TemplateDefinition>
<providers:TemplateDefinition DataType="viewModels:ITemplateDescriptionViewModel">
<providers:TemplateDefinition.DataTemplate>
<DataTemplate>
<DockPanel Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=ListBox}, Converter={xk:SumNum}, ConverterParameter={xk:Double -10}}" Margin="0,0,-5,0" Height="56">
<Image Source="{Binding Icon}" DockPanel.Dock="Left" Width="48" Height="48" Margin="2"/>
<DockPanel Margin="18,0">
<TextBlock DockPanel.Dock="Top" FontSize="16" Text="{Binding Name}"/>
<TextBlock Text="{Binding Description}" TextWrapping="Wrap" TextTrimming="WordEllipsis"/>
</DockPanel>
</DockPanel>
</DataTemplate>
</providers:TemplateDefinition.DataTemplate>
</providers:TemplateDefinition>
</providers:DataTypeTemplateSelector.TemplateDefinitions>
</providers:DataTypeTemplateSelector>
</ResourceDictionary>
</UserControl.Resources>
<views:ObjectBrowserUserControl HierarchyItemsSource="{Binding RootGroups}"
SelectedHierarchyItem="{Binding SelectedGroup, Mode=TwoWay}"
ObjectItemsSource="{Binding Templates}"
SelectedObjectItem="{Binding SelectedTemplate}"
>
ObjectItemTemplateSelector="{StaticResource dataTypeTemplateSelector}">
<views:ObjectBrowserUserControl.HierarchyItemContainerStyle>
<Style TargetType="xk:TreeViewItem" BasedOn="{StaticResource {x:Type xk:TreeViewItem}}">
<Setter Property="IsExpanded" Value="True"/>
@@ -41,17 +79,6 @@
</Setter>
</Style>
</views:ObjectBrowserUserControl.ObjectItemContainerStyle>
<views:ObjectBrowserUserControl.ObjectItemTemplate>
<DataTemplate DataType="viewModels:ITemplateDescriptionViewModel">
<DockPanel Width="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=ListBox}, Converter={xk:SumNum}, ConverterParameter={xk:Double -10}}" Margin="0,0,-5,0" Height="56">
<Image Source="{Binding Icon}" DockPanel.Dock="Left" Width="48" Height="48" Margin="2"/>
<DockPanel Margin="18,0">
<TextBlock DockPanel.Dock="Top" FontSize="16" Text="{Binding Name}"/>
<TextBlock Text="{Binding Description}" TextWrapping="Wrap" TextTrimming="WordEllipsis"/>
</DockPanel>
</DockPanel>
</DataTemplate>
</views:ObjectBrowserUserControl.ObjectItemTemplate>
<views:ObjectBrowserUserControl.ObjectDescriptionTemplate>
<DataTemplate DataType="viewModels:ITemplateDescriptionViewModel">
<StackPanel DockPanel.Dock="Top">
@@ -27,13 +27,13 @@ public abstract class EditorViewModel : ViewModelBase
public const string SolutionFileExtension = ".sln";
private SessionViewModel session;

protected EditorViewModel(IViewModelServiceProvider serviceProvider, MostRecentlyUsedFileCollection mru, string editorName)
protected EditorViewModel(IViewModelServiceProvider serviceProvider, MostRecentlyUsedFileCollection mru, string editorName, string editorVersionMajor)
: base(serviceProvider)
{
AssetsPlugin.RegisterPlugin(typeof(AssetsEditorPlugin));
serviceProvider.Get<IEditorDialogService>();

ClearMRUCommand = new AnonymousCommand(serviceProvider, () => MRU.Clear());
ClearMRUCommand = new AnonymousCommand(serviceProvider, () => ClearRecentFiles());
OpenSettingsWindowCommand = new AnonymousCommand(serviceProvider, OpenSettingsWindow);
OpenWebPageCommand = new AnonymousTaskCommand<string>(serviceProvider, OpenWebPage);
#if DEBUG
@@ -42,11 +42,12 @@ protected EditorViewModel(IViewModelServiceProvider serviceProvider, MostRecentl

MRU = mru;
MRU.MostRecentlyUsedFiles.CollectionChanged += MostRecentlyUsedFiles_CollectionChanged;
UpdateRecentFiles();

serviceProvider.Get<IEditorDialogService>().RegisterDefaultTemplateProviders();

EditorName = editorName;
EditorVersionMajor = editorVersionMajor;
UpdateRecentFiles();
if (Instance != null)
throw new InvalidOperationException("The EditorViewModel class can be instanced only once.");

@@ -71,6 +72,11 @@ private void MostRecentlyUsedFiles_CollectionChanged(object sender, System.Colle
/// </summary>
public string EditorName { get; set; }

/// <summary>
/// Gets the version major of this editor.
/// </summary>
public string EditorVersionMajor { get; set; }

/// <summary>
/// Gets the current active session.
/// </summary>
@@ -111,7 +117,7 @@ public async Task<bool> NewSession(NewSessionParameters newSessionParameters)
if (newSession != null)
{
Session = newSession;
MRU.AddFile(Session.SolutionPath);
MRU.AddFile(Session.SolutionPath, EditorVersionMajor);
}

return Session != null;
@@ -161,7 +167,8 @@ public async Task<bool> NewSession(NewSessionParameters newSessionParameters)

if (filePath != null && !File.Exists(filePath))
{
MRU.RemoveFile(filePath);
RemoveRecentFile(filePath);

await ServiceProvider.Get<IDialogService>().MessageBox(string.Format(Tr._p("Message", @"The file '{0}' does not exist."), filePath), MessageBoxButton.OK, MessageBoxImage.Information);
return false;
}
@@ -176,7 +183,8 @@ public async Task<bool> NewSession(NewSessionParameters newSessionParameters)
return sessionResult.OperationCancelled ? (bool?)null : false;
}

MRU.AddFile(filePath);
RemoveRecentFile(filePath);
MRU.AddFile(filePath, EditorVersionMajor);
Session = loadedSession;

InternalSettings.FileDialogLastOpenSessionDirectory.SetValue(new UFile(filePath).GetFullDirectory());
@@ -227,11 +235,47 @@ private async Task OpenWebPage(string url)
}
}

public void RemoveRecentFile(UFile filePath)
{
var packageVersion = PackageSessionHelper.GetPackageVersion(filePath);
//Remove considering old projects that have been deleted or upgraded from older versions
if (packageVersion == null || string.Compare(packageVersion.ToString(), "3.0", StringComparison.Ordinal) <= 0)
{
//Get all versions of showing on recent files
var xenkoVersions = RecentFiles?.Select(x => x.Version).ToList();
if (xenkoVersions != null)
{
foreach (var item in xenkoVersions)
{
MRU.RemoveFile(filePath, item);
}
}
}
else
{
MRU.RemoveFile(filePath, packageVersion.ToString());
}
}

private void ClearRecentFiles()
{
//Clear considering old projects that have been deleted or upgraded from older versions
var xenkoVersions = RecentFiles?.Select(x => x.Version).ToList();
if (xenkoVersions != null)
{
foreach (var item in xenkoVersions)
{
MRU.Clear(item);
}
}
}

private void UpdateRecentFiles()
{
RecentFiles.Clear();

foreach (var item in MRU.MostRecentlyUsedFiles.Take(10))
//Get only files that is current version or older
foreach (var item in MRU.MostRecentlyUsedFiles.Where(x => string.Compare(x.Version, EditorVersionMajor, StringComparison.Ordinal) <= 0).Take(10))
{
RecentFiles.Add(new MostRecentlyUsedFile() { FilePath = item.FilePath, Timestamp = item.Timestamp, Version = item.Version });
}
@@ -914,7 +914,7 @@ public async Task<bool> SaveSession()
}
if (mruPath != null)
{
Editor.MRU.AddFile(mruPath);
Editor.MRU.AddFile(mruPath, Editor.EditorVersionMajor);
}

AllPackages.ForEach(x => x.OnSessionSaved());

0 comments on commit 3a4e324

Please sign in to comment.
You can’t perform that action at this time.