Merge remote-tracking branch 'origin/master'

This commit is contained in:
Robert committed 2020-09-29 19:30:31 +02:00
commit 882fe44c20
29 files changed
+319 -84

No files matched your search

@@ -32,9 +32,9 @@ namespace Artemis.UI.Screens.ProfileEditor.Dialogs
public void Accept()
{
_profileService.ImportProfile(Document.Text, ProfileModule);
var descriptor = _profileService.ImportProfile(Document.Text, ProfileModule);
_mainMessageQueue.Enqueue("Profile imported.");
Session.Close();
Session.Close(descriptor);
}
public void Cancel()
@@ -221,7 +221,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
NotifyOfPropertyChange(nameof(TimeCaretPosition));
}
private void ProfileEditorServiceOnSelectedDataBindingChanged(object? sender, EventArgs e)
private void ProfileEditorServiceOnSelectedDataBindingChanged(object sender, EventArgs e)
{
RightSideIndex = ProfileEditorService.SelectedDataBinding != null ? 1 : 0;
}
@@ -562,20 +562,23 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
Execute.PostToUIThread(() =>
{
var newTime = ProfileEditorService.CurrentTime.Add(TimeSpan.FromSeconds(e.DeltaTime));
if (Repeating && RepeatTimeline)
if (SelectedProfileElement != null)
{
if (newTime > SelectedProfileElement.TimelineLength)
newTime = TimeSpan.Zero;
}
else if (Repeating && RepeatSegment)
{
if (newTime > GetCurrentSegmentEnd())
newTime = GetCurrentSegmentStart();
}
else if (newTime > SelectedProfileElement.TimelineLength)
{
newTime = SelectedProfileElement.TimelineLength;
Pause();
if (Repeating && RepeatTimeline)
{
if (newTime > SelectedProfileElement.TimelineLength)
newTime = TimeSpan.Zero;
}
else if (Repeating && RepeatSegment)
{
if (newTime > GetCurrentSegmentEnd())
newTime = GetCurrentSegmentStart();
}
else if (newTime > SelectedProfileElement.TimelineLength)
{
newTime = SelectedProfileElement.TimelineLength;
Pause();
}
}
ProfileEditorService.CurrentTime = newTime;
@@ -10,14 +10,38 @@
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<converters:NullToVisibilityConverter x:Key="NullToVisibilityConverter" />
<converters:PropertyTreeMarginConverter Length="20" x:Key="PropertyTreeMarginConverter" />
<Style x:Key="DataBindingsButton" TargetType="shared:LockableToggleButton" BasedOn="{StaticResource MaterialDesignFlatToggleButton}">
<Style.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<EventTrigger.Actions>
<BeginStoryboard>
<Storyboard>
<BooleanAnimationUsingKeyFrames Storyboard.TargetProperty="IsEnabled">
<DiscreteBooleanKeyFrame KeyTime="00:00:00" Value="False" />
<DiscreteBooleanKeyFrame KeyTime="00:00:00.3" Value="True" />
</BooleanAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</EventTrigger.Actions>
</EventTrigger>
</Style.Triggers>
</Style>
</UserControl.Resources>
<Border Name="Bd"
BorderBrush="{DynamicResource MaterialDesignDivider}"
BorderThickness="0,0,0,1"
Height="25">
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<DataTrigger Binding="{Binding LayerPropertyViewModel.IsHighlighted, Mode=OneWay}" Value="True">
<Setter Property="Background" Value="{DynamicResource MaterialDesignPaper}" />
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<Grid Margin="{Binding Converter={StaticResource PropertyTreeMarginConverter}}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
@@ -55,7 +79,7 @@
</ContentControl>
<shared:LockableToggleButton Grid.Column="3"
Style="{StaticResource MaterialDesignFlatToggleButton}"
Style="{StaticResource DataBindingsButton}"
ToolTip="Change the property's data binding"
Width="20"
Height="20"
@@ -6,6 +6,7 @@ using System.Windows;
using Artemis.Core;
using Artemis.Core.Modules;
using Artemis.Core.Services;
using Artemis.UI.Extensions;
using Artemis.UI.Screens.ProfileEditor.Dialogs;
using Artemis.UI.Screens.ProfileEditor.DisplayConditions;
using Artemis.UI.Screens.ProfileEditor.LayerProperties;
@@ -58,7 +59,7 @@ namespace Artemis.UI.Screens.ProfileEditor
DialogService = dialogService;
Profiles = new BindableCollection<ProfileDescriptor>();
// Populate the panels
ProfileViewModel = profileViewModel;
ProfileTreeViewModel = profileTreeViewModel;
@@ -190,10 +191,17 @@ namespace Artemis.UI.Screens.ProfileEditor
public async Task ImportProfile()
{
await DialogService.ShowDialog<ProfileImportViewModel>(new Dictionary<string, object>
var result = await DialogService.ShowDialog<ProfileImportViewModel>(new Dictionary<string, object>
{
{"profileModule", Module}
});
if (result != null && result is ProfileDescriptor descriptor)
{
Profiles.Add(descriptor);
Profiles.Sort(p => p.Name);
SelectedProfile = descriptor;
}
}
public void Undo()