Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,3 @@ Defaults:
DetailSamplingDistance: 6.0
MaxDetailSamplingError: 1.0
Groups: []
Overrides: []
PlatformFilters:
- PowerVR SGX 54[0-9]
- Adreno \(TM\) 2[0-9][0-9]
- Adreno (TM) 320
- Adreno (TM) 330
- Adreno \(TM\) 4[0-9][0-9]
- NVIDIA Tegra
- Intel(R) HD Graphics
- ^Mali\-4
- ^Mali\-T6
- ^Mali\-T7
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,6 @@ protected override void UpdateNode(IAssetNodePresenter node)
node.DisplayName = DisplayAttribute.GetDisplayName(node.Value?.GetType()) ?? DisplayAttribute.GetDisplayName(typeof(Configuration));
}

if (typeof(ConfigurationOverride).IsAssignableFrom(node.Type))
{
node.DisplayName = $"Override {node.Index}";
node.AttachedProperties.Add(CategoryData.Key, true);
}

if (node.Parent != null && typeof(ConfigurationOverride).IsAssignableFrom(node.Parent.Type) && node.Name == nameof(ConfigurationOverride.SpecificFilter))
{
if (node.Commands.All(x => x.Name != "ClearSelection"))
{
node.Commands.Add(new SyncAnonymousNodePresenterCommand("ClearSelection", (n, x) => n.UpdateValue(-1)));
}
}

if (typeof(ICollection<Configuration>).IsAssignableFrom(node.Type))
{
var types = node.AttachedProperties.Get(AbstractNodeEntryData.Key);
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Stride.Core.Assets.Editor;component/View/CommonResources.xaml"/>
<!-- Platform DrawingImage resources keyed by ConfigPlatforms.<Platform>; used by the
<!-- Platform DrawingImage resources keyed by PlatformType.<Platform>; used by the
specialized 'platforms' row to show OS icons next to each checkbox. -->
<ResourceDictionary Source="../View/ImageDictionary.xaml"/>
</ResourceDictionary.MergedDictionaries>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Stride.Core.Presentation.Controls;
using Stride.Data;
using SDDialogResult = Stride.Core.Presentation.Services.DialogResult;
using Stride.Core;

namespace Stride.Assets.Presentation.Templates;

Expand Down Expand Up @@ -199,33 +200,33 @@ private UIElement BuildOneRow(ITemplateParameter p)
/// <summary>
/// Builds a CheckBox.Content payload for a multi-choice row. For the 'platforms' parameter,
/// returns a horizontal stack with the OS icon (from the shared ImageDictionary, keyed by
/// <see cref="ConfigPlatforms"/> enum value) + the descriptive label. For everything else,
/// <see cref="PlatformType"/> enum value) + the descriptive label. For everything else,
/// just the label string — WPF unboxes it as text.
/// </summary>
private object BuildChoiceContent(string paramName, string choiceKey, string? description)
{
var label = string.IsNullOrEmpty(description) ? Humanize(choiceKey) : description;
if (!string.Equals(paramName, "platforms", StringComparison.Ordinal))
return label;
// dotnet new's lowercase choice keys vs ConfigPlatforms PascalCase enum names — explicit
// dotnet new's lowercase choice keys vs PlatformType PascalCase enum names — explicit
// map both because Enum.TryParse(ignoreCase) can't reconcile "macos" → "macOS".
var platform = choiceKey switch
PlatformType? platform = choiceKey switch
{
"windows" => ConfigPlatforms.Windows,
"linux" => ConfigPlatforms.Linux,
"macos" => ConfigPlatforms.macOS,
"ios" => ConfigPlatforms.iOS,
"android" => ConfigPlatforms.Android,
_ => ConfigPlatforms.None,
"windows" => PlatformType.Windows,
"linux" => PlatformType.Linux,
"macos" => PlatformType.macOS,
"ios" => PlatformType.iOS,
"android" => PlatformType.Android,
_ => null,
};
if (platform == ConfigPlatforms.None)
if (!platform.HasValue)
return label;
// SetResourceReference resolves lazily against the full merged-dictionary chain (window
// → app → themes), so it picks up the platform DrawingImage from ImageDictionary.xaml
// regardless of which scope owns it. Falls back gracefully (no image) if missing.
var stack = new StackPanel { Orientation = Orientation.Horizontal };
var img = new Image { Width = 16, Height = 16, Margin = new Thickness(0, 0, 6, 0) };
img.SetResourceReference(Image.SourceProperty, platform);
img.SetResourceReference(Image.SourceProperty, platform.Value);
stack.Children.Add(img);
stack.Children.Add(new TextBlock { Text = label, VerticalAlignment = VerticalAlignment.Center });
return stack;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,17 +246,6 @@
</DataTemplate>
</tp:ModelNodeNameTemplateProvider>

<tp:GameSettingsFiltersTemplateProvider x:Key="GameSettingsFiltersTemplateProvider" sd:PropertyViewHelper.TemplateCategory="PropertyEditor" OverrideRule="All">
<DataTemplate>
<DockPanel>
<Button Style="{StaticResource ImageButtonStyle}" DockPanel.Dock="Right" Command="{Binding ClearSelection}">
<Image Source="{StaticResource ImageClear}" Width="16" Height="16" Margin="-1"/>
</Button>
<ComboBox ItemsSource="{Binding Root.PlatformFilters.NodeValue}" x:Name="FilterComboBox" SelectedIndex="{Binding NodeValue}"/>
</DockPanel>
</DataTemplate>
</tp:GameSettingsFiltersTemplateProvider>

<tp:GameSettingAddConfigurationTemplateProvider x:Key="GameSettingAddConfigurationTemplateProvider" OverrideRule="All"
sd:PropertyViewHelper.TemplateCategory="PropertyHeader">
<DataTemplate>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:components="clr-namespace:Stride.Particles.Components;assembly=Stride.Particles"
xmlns:data="clr-namespace:Stride.Data;assembly=Stride.Foundation"
xmlns:core="clr-namespace:Stride.Core;assembly=Stride.Core"
xmlns:engine="clr-namespace:Stride.Engine;assembly=Stride.Engine"
xmlns:engine-ui="clr-namespace:Stride.Engine;assembly=Stride.UI"
xmlns:font="clr-namespace:Stride.Graphics.Font;assembly=Stride.Graphics"
Expand Down Expand Up @@ -400,7 +400,7 @@
</DrawingImage.Drawing>
</DrawingImage>

<DrawingImage x:Key="{x:Static data:ConfigPlatforms.Android}">
<DrawingImage x:Key="{x:Static core:PlatformType.Android}">
<DrawingImage.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="#7CB342" Geometry="M12,29c0,1.1-0.9,2-2,2s-2-0.9-2-2v-9c0-1.1,0.9-2,2-2s2,0.9,2,2V29z"/>
Expand All @@ -416,7 +416,7 @@
</DrawingImage.Drawing>
</DrawingImage>

<DrawingImage x:Key="{x:Static data:ConfigPlatforms.iOS}">
<DrawingImage x:Key="{x:Static core:PlatformType.iOS}">
<DrawingImage.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="#ECEFF1" Geometry="M 16 42 L 32 42 C 37.523438 42 42 37.523438 42 32 L 42 16 C 42 10.476563 37.523438 6 32 6 L 16 6 C 10.476563 6 6 10.476563 6 16 L 6 32 C 6 37.523438 10.476563 42 16 42 Z "/>
Expand Down Expand Up @@ -446,7 +446,7 @@
</DrawingImage.Drawing>
</DrawingImage>

<DrawingImage x:Key="{x:Static data:ConfigPlatforms.Linux}">
<DrawingImage x:Key="{x:Static core:PlatformType.Linux}">
<DrawingImage.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="#ECEFF1" Geometry="M 20.101563 16.199219 L 20.199219 18.5 L 18.601563 21.5 L 16.101563 26.398438 L 15.601563 30.5 L 17.398438 36.300781 L 21.5 38.601563 L 27.699219 38.601563 L 33.5 34.199219 L 36.101563 27.300781 L 30.101563 20 L 28.398438 15.898438 Z "/>
Expand All @@ -466,7 +466,7 @@
</DrawingImage.Drawing>
</DrawingImage>

<DrawingImage x:Key="{x:Static data:ConfigPlatforms.macOS}">
<DrawingImage x:Key="{x:Static core:PlatformType.macOS}">
<DrawingImage.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="#42A5F5" Geometry="M 40.085938 32.613281 C 39.234375 34.449219 38.828125 35.269531 37.742188 36.886719 C 36.222656 39.152344 34.070313 41.976563 31.414063 41.996094 C 29.054688 42.015625 28.445313 40.488281 25.238281 40.515625 C 22.035156 40.53125 21.367188 42.023438 19.003906 41.996094 C 16.347656 41.976563 14.316406 39.429688 12.792969 37.171875 C 8.535156 30.832031 8.085938 23.402344 10.71875 19.449219 C 12.578125 16.648438 15.523438 15.003906 18.289063 15.003906 C 21.105469 15.003906 22.878906 16.515625 25.203125 16.515625 C 27.46875 16.515625 28.84375 15 32.101563 15 C 34.566406 15 37.171875 16.3125 39.03125 18.574219 C 32.941406 21.835938 33.929688 30.335938 40.085938 32.613281 Z "/>
Expand All @@ -476,7 +476,7 @@
</DrawingImage.Drawing>
</DrawingImage>

<DrawingImage x:Key="{x:Static data:ConfigPlatforms.Windows}">
<DrawingImage x:Key="{x:Static core:PlatformType.Windows}">
<DrawingImage.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="#03A9F4" Geometry="M 22.808594 24.511719 L 19.320313 36.589844 C 16.289063 34.535156 12.992188 32.84375 6 35.757813 L 9.410156 23.8125 L 9.449219 23.792969 C 16.414063 20.90625 19.785156 22.445313 22.808594 24.511719 Z "/>
Expand All @@ -487,7 +487,7 @@
</DrawingImage.Drawing>
</DrawingImage>

<DrawingImage x:Key="{x:Static data:ConfigPlatforms.UWP}">
<DrawingImage x:Key="{x:Static core:PlatformType.UWP}">
<DrawingImage.Drawing>
<DrawingGroup>
<GeometryDrawing Brush="#03A9F4" Geometry="M 20 25 L 6 25 L 6 37.074219 L 20 38.992188 Z "/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
using Stride.Core.Assets.Editor.Annotations;
using Stride.Core.Assets.Editor.ViewModel;
using Stride.Core.Serialization;
using Stride.Core.Transactions;
using Stride.Core.Quantum;
using Stride.Data;
using Stride.Engine;
using Stride.Graphics;

Expand All @@ -26,98 +23,6 @@ public GameSettingsViewModel(AssetViewModelConstructionParameters parameters)
{
gameSettingsAsset = (GameSettingsAsset)AssetItem.Asset;
displayOrientation = gameSettingsAsset.GetOrCreate<RenderingSettings>().DisplayOrientation;

var platformFiltersNode = AssetRootNode[nameof(GameSettingsAsset.PlatformFilters)].Target;
platformFiltersNode.ItemChanging += PlatformFiltersNodeChanging;
platformFiltersNode.ItemChanged += PlatformFiltersNodeChanged;
}

private void PlatformFiltersNodeChanging(object sender, ItemChangeEventArgs e)
{
if (e.ChangeType == ContentChangeType.CollectionUpdate)
{
var index = e.Index.Int;
using (var transaction = UndoRedoService.CreateTransaction())
{
foreach (var platformOverride in Asset.Overrides)
{
var node = Session.AssetNodeContainer.GetNode(platformOverride);
var filterNode = node[nameof(ConfigurationOverride.SpecificFilter)];

if (platformOverride.SpecificFilter == index)
{
// This is a hack to force refreshing the display of the filter in override. We clear and reset it before and after the name change.
filterNode.Update(-1);
filterNode.Update(index);
}
}
UndoRedoService.SetName(transaction, "Force filter refresh");
}
}
}

private void PlatformFiltersNodeChanged(object sender, ItemChangeEventArgs e)
{
var index = e.Index.Int;

ITransaction transaction = null;
try
{
if (e.ChangeType == ContentChangeType.CollectionUpdate)
transaction = UndoRedoService.CreateTransaction();

foreach (var platformOverride in Asset.Overrides)
{
var node = Session.AssetNodeContainer.GetNode(platformOverride);
var filterNode = node[nameof(ConfigurationOverride.SpecificFilter)];

switch (e.ChangeType)
{
case ContentChangeType.CollectionUpdate:
{
// This is a hack to force refreshing the display of the filter in override. We clear and reset it before and after the name change.
if (platformOverride.SpecificFilter == index)
{
filterNode.Update(-1);
filterNode.Update(index);
}
break;
}
case ContentChangeType.CollectionAdd:
{
var filterIndex = (int)filterNode.Retrieve();
if (filterIndex >= index)
{
filterNode.Update(filterIndex + 1);
}
break;
}
case ContentChangeType.CollectionRemove:
{
var filterIndex = (int)filterNode.Retrieve();
if (filterIndex > index)
{
filterNode.Update(filterIndex - 1);
}
else if (filterIndex == index)
{
filterNode.Update(-1);
}
break;
}
}
}


}
finally
{
if (transaction != null)
{
UndoRedoService.SetName(transaction, "Force filter refresh");
transaction.Complete();
}
}
}

protected override void OnSessionSaved()
Expand Down
Loading
Loading