mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-31 17:53:32 +00:00
Display conditions - Events UI WIP
This commit is contained in:
parent
d115d41a80
commit
5b4188ed12
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.CompilerServices;
|
using System.Runtime.CompilerServices;
|
||||||
@ -58,8 +59,8 @@ namespace Artemis.UI.Shared.Controls
|
|||||||
/// A list of extra modules to show data models of
|
/// A list of extra modules to show data models of
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly DependencyProperty ModulesProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty ModulesProperty = DependencyProperty.Register(
|
||||||
nameof(Modules), typeof(BindableCollection<Module>), typeof(DataModelPicker),
|
nameof(Modules), typeof(ObservableCollection<Module>), typeof(DataModelPicker),
|
||||||
new FrameworkPropertyMetadata(new BindableCollection<Module>(), FrameworkPropertyMetadataOptions.None, ModulesPropertyChangedCallback)
|
new FrameworkPropertyMetadata(new ObservableCollection<Module>(), FrameworkPropertyMetadataOptions.None, ModulesPropertyChangedCallback)
|
||||||
);
|
);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -74,16 +75,16 @@ namespace Artemis.UI.Shared.Controls
|
|||||||
/// A list of data model view models to show
|
/// A list of data model view models to show
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly DependencyProperty ExtraDataModelViewModelsProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty ExtraDataModelViewModelsProperty = DependencyProperty.Register(
|
||||||
nameof(ExtraDataModelViewModels), typeof(BindableCollection<DataModelPropertiesViewModel>), typeof(DataModelPicker),
|
nameof(ExtraDataModelViewModels), typeof(ObservableCollection<DataModelPropertiesViewModel>), typeof(DataModelPicker),
|
||||||
new FrameworkPropertyMetadata(new BindableCollection<DataModelPropertiesViewModel>(), FrameworkPropertyMetadataOptions.None, ExtraDataModelViewModelsPropertyChangedCallback)
|
new FrameworkPropertyMetadata(new ObservableCollection<DataModelPropertiesViewModel>(), FrameworkPropertyMetadataOptions.None, ExtraDataModelViewModelsPropertyChangedCallback)
|
||||||
);
|
);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A list of data model view models to show
|
/// A list of data model view models to show
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly DependencyProperty FilterTypesProperty = DependencyProperty.Register(
|
public static readonly DependencyProperty FilterTypesProperty = DependencyProperty.Register(
|
||||||
nameof(FilterTypes), typeof(BindableCollection<Type>), typeof(DataModelPicker),
|
nameof(FilterTypes), typeof(ObservableCollection<Type>), typeof(DataModelPicker),
|
||||||
new FrameworkPropertyMetadata(new BindableCollection<Type>())
|
new FrameworkPropertyMetadata(new ObservableCollection<Type>())
|
||||||
);
|
);
|
||||||
|
|
||||||
public DataModelPicker()
|
public DataModelPicker()
|
||||||
@ -143,9 +144,9 @@ namespace Artemis.UI.Shared.Controls
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a list of extra modules to show data models of
|
/// Gets or sets a list of extra modules to show data models of
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public BindableCollection<Module>? Modules
|
public ObservableCollection<Module>? Modules
|
||||||
{
|
{
|
||||||
get => (BindableCollection<Module>) GetValue(ModulesProperty);
|
get => (ObservableCollection<Module>) GetValue(ModulesProperty);
|
||||||
set => SetValue(ModulesProperty, value);
|
set => SetValue(ModulesProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,18 +162,18 @@ namespace Artemis.UI.Shared.Controls
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a list of data model view models to show
|
/// Gets or sets a list of data model view models to show
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public BindableCollection<DataModelPropertiesViewModel>? ExtraDataModelViewModels
|
public ObservableCollection<DataModelPropertiesViewModel>? ExtraDataModelViewModels
|
||||||
{
|
{
|
||||||
get => (BindableCollection<DataModelPropertiesViewModel>) GetValue(ExtraDataModelViewModelsProperty);
|
get => (ObservableCollection<DataModelPropertiesViewModel>) GetValue(ExtraDataModelViewModelsProperty);
|
||||||
set => SetValue(ExtraDataModelViewModelsProperty, value);
|
set => SetValue(ExtraDataModelViewModelsProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the types of properties this view model will allow to be selected
|
/// Gets or sets the types of properties this view model will allow to be selected
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public BindableCollection<Type>? FilterTypes
|
public ObservableCollection<Type>? FilterTypes
|
||||||
{
|
{
|
||||||
get => (BindableCollection<Type>) GetValue(FilterTypesProperty);
|
get => (ObservableCollection<Type>) GetValue(FilterTypesProperty);
|
||||||
set => SetValue(FilterTypesProperty, value);
|
set => SetValue(FilterTypesProperty, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,150 @@
|
|||||||
|
<UserControl x:Class="Artemis.UI.Screens.ProfileEditor.DisplayConditions.DisplayConditionEventView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:Artemis.UI.Screens.ProfileEditor.DisplayConditions"
|
||||||
|
xmlns:core="clr-namespace:Artemis.Core;assembly=Artemis.Core"
|
||||||
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
xmlns:converters="clr-namespace:Artemis.UI.Converters"
|
||||||
|
xmlns:s="https://github.com/canton7/Stylet"
|
||||||
|
xmlns:controls="clr-namespace:Artemis.VisualScripting.Editor.Controls;assembly=Artemis.VisualScripting"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800"
|
||||||
|
d:DataContext="{d:DesignInstance {x:Type local:DisplayConditionEventViewModel}}">
|
||||||
|
<UserControl.Resources>
|
||||||
|
<converters:ComparisonConverter x:Key="ComparisonConverter" />
|
||||||
|
</UserControl.Resources>
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="22" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<Grid Grid.Row="0" MouseUp="{s:Action ScriptGridMouseUp}" Cursor="Hand">
|
||||||
|
<controls:VisualScriptPresenter Script="{Binding RenderProfileElement.DisplayCondition}"
|
||||||
|
AutoFitScript="True"
|
||||||
|
Visibility="{Binding RenderProfileElement.DisplayCondition, Converter={StaticResource NullToVisibilityConverter}}" />
|
||||||
|
<Border Opacity="0">
|
||||||
|
<Border.Background>
|
||||||
|
<SolidColorBrush Color="{Binding Color, Source={StaticResource MaterialDesignCardBackground}}" Opacity="0.75" />
|
||||||
|
</Border.Background>
|
||||||
|
<Border.Style>
|
||||||
|
<Style>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource AncestorType={x:Type Grid}, Mode=FindAncestor}}" Value="True">
|
||||||
|
<DataTrigger.EnterActions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.25" />
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</DataTrigger.EnterActions>
|
||||||
|
<DataTrigger.ExitActions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.25" />
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</DataTrigger.ExitActions>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Border.Style>
|
||||||
|
<Grid HorizontalAlignment="Center">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Style="{StaticResource MaterialDesignHeadline5TextBlock}" VerticalAlignment="Center" Grid.Column="0">
|
||||||
|
Click to edit script
|
||||||
|
</TextBlock>
|
||||||
|
<materialDesign:PackIcon Kind="OpenInNew" Margin="10 " Width="30" Height="30" Grid.Column="1" VerticalAlignment="Center" />
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<!-- Trigger mode -->
|
||||||
|
<TextBlock Grid.Row="1" Grid.Column="0" Text="Trigger mode" VerticalAlignment="Center">
|
||||||
|
<TextBlock.ToolTip>
|
||||||
|
<ToolTip Placement="Center" VerticalOffset="-30">
|
||||||
|
<TextBlock>
|
||||||
|
Configure how the layer should act when the event(s) trigger
|
||||||
|
</TextBlock>
|
||||||
|
</ToolTip>
|
||||||
|
</TextBlock.ToolTip>
|
||||||
|
</TextBlock>
|
||||||
|
|
||||||
|
<materialDesign:ColorZone Grid.Row="2" Grid.Column="0" Mode="Standard" CornerRadius="3">
|
||||||
|
<Grid HorizontalAlignment="Stretch">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<RadioButton Grid.Column="0"
|
||||||
|
Style="{StaticResource MaterialDesignTabRadioButton}"
|
||||||
|
IsChecked="{Binding Path=EventOverlapMode, Converter={StaticResource ComparisonConverter}, ConverterParameter={x:Static core:TimeLineEventOverlapMode.Restart}}">
|
||||||
|
<TextBlock VerticalAlignment="Center" FontSize="12">
|
||||||
|
<materialDesign:PackIcon Kind="Repeat" VerticalAlignment="Center" Margin="-3 0 0 -3" />
|
||||||
|
RESTART
|
||||||
|
</TextBlock>
|
||||||
|
<RadioButton.ToolTip>
|
||||||
|
<ToolTip Placement="Center" VerticalOffset="-40">
|
||||||
|
<TextBlock>
|
||||||
|
Stop the current run and restart the timeline
|
||||||
|
</TextBlock>
|
||||||
|
</ToolTip>
|
||||||
|
</RadioButton.ToolTip>
|
||||||
|
</RadioButton>
|
||||||
|
<RadioButton Grid.Column="1"
|
||||||
|
Style="{StaticResource MaterialDesignTabRadioButton}"
|
||||||
|
IsChecked="{Binding Path=EventOverlapMode, Converter={StaticResource ComparisonConverter}, ConverterParameter={x:Static core:TimeLineEventOverlapMode.Toggle}}">
|
||||||
|
<TextBlock VerticalAlignment="Center" FontSize="12">
|
||||||
|
<materialDesign:PackIcon Kind="TrafficLight" VerticalAlignment="Center" Margin="-3 0 0 -3" />
|
||||||
|
TOGGLE
|
||||||
|
</TextBlock>
|
||||||
|
<RadioButton.ToolTip>
|
||||||
|
<ToolTip Placement="Center" VerticalOffset="-40">
|
||||||
|
<TextBlock>
|
||||||
|
Repeat the timeline until the event fires again
|
||||||
|
</TextBlock>
|
||||||
|
</ToolTip>
|
||||||
|
</RadioButton.ToolTip>
|
||||||
|
</RadioButton>
|
||||||
|
<RadioButton Grid.Column="2"
|
||||||
|
Style="{StaticResource MaterialDesignTabRadioButton}"
|
||||||
|
IsChecked="{Binding Path=EventOverlapMode, Converter={StaticResource ComparisonConverter}, ConverterParameter={x:Static core:TimeLineEventOverlapMode.Ignore}}">
|
||||||
|
<TextBlock VerticalAlignment="Center" FontSize="12">
|
||||||
|
<materialDesign:PackIcon Kind="EarHearingOff" VerticalAlignment="Center" Margin="-3 0 0 -3" />
|
||||||
|
IGNORE
|
||||||
|
</TextBlock>
|
||||||
|
<RadioButton.ToolTip>
|
||||||
|
<ToolTip Placement="Center" VerticalOffset="-40">
|
||||||
|
<TextBlock>
|
||||||
|
Ignore subsequent event fires until the timeline finishes
|
||||||
|
</TextBlock>
|
||||||
|
</ToolTip>
|
||||||
|
</RadioButton.ToolTip>
|
||||||
|
</RadioButton>
|
||||||
|
<RadioButton Grid.Column="3"
|
||||||
|
Style="{StaticResource MaterialDesignTabRadioButton}"
|
||||||
|
IsChecked="{Binding Path=EventOverlapMode, Converter={StaticResource ComparisonConverter}, ConverterParameter={x:Static core:TimeLineEventOverlapMode.Copy}}">
|
||||||
|
<TextBlock VerticalAlignment="Center" FontSize="12">
|
||||||
|
<materialDesign:PackIcon Kind="ContentCopy" VerticalAlignment="Center" Margin="-3 0 0 -3" />
|
||||||
|
COPY
|
||||||
|
</TextBlock>
|
||||||
|
<RadioButton.ToolTip>
|
||||||
|
<ToolTip Placement="Center" VerticalOffset="-40">
|
||||||
|
<TextBlock>
|
||||||
|
Play another copy of the timeline on top of the current run
|
||||||
|
</TextBlock>
|
||||||
|
</ToolTip>
|
||||||
|
</RadioButton.ToolTip>
|
||||||
|
</RadioButton>
|
||||||
|
</Grid>
|
||||||
|
</materialDesign:ColorZone>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Stylet;
|
||||||
|
|
||||||
|
namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
|
||||||
|
{
|
||||||
|
public class DisplayConditionEventViewModel : Screen
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -25,269 +25,253 @@
|
|||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="*" />
|
<RowDefinition Height="*" />
|
||||||
<RowDefinition Height="Auto" />
|
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<DockPanel Grid.Row="0" Margin="0 -2">
|
<DockPanel Grid.Row="0" Margin="0 -2">
|
||||||
<TextBlock Style="{StaticResource MaterialDesignSubtitle1TextBlock}" VerticalAlignment="Center">
|
<TextBlock Style="{StaticResource MaterialDesignSubtitle1TextBlock}" VerticalAlignment="Center">
|
||||||
Display conditions
|
Display conditions
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
<TextBlock Style="{StaticResource MaterialDesignSubtitle2TextBlock}"
|
|
||||||
Foreground="{DynamicResource MaterialDesignBodyLight}"
|
<materialDesign:ColorZone Mode="Standard" CornerRadius="3" Margin="0 -2" HorizontalAlignment="Right">
|
||||||
VerticalAlignment="Center"
|
<Grid>
|
||||||
HorizontalAlignment="Right"
|
<Grid.ColumnDefinitions>
|
||||||
FontSize="13">
|
<ColumnDefinition />
|
||||||
Not applied during editing
|
<ColumnDefinition />
|
||||||
</TextBlock>
|
</Grid.ColumnDefinitions>
|
||||||
|
<RadioButton Grid.Column="0"
|
||||||
|
Style="{StaticResource MaterialDesignTabRadioButton}"
|
||||||
|
IsChecked="{Binding IsEventCondition, Converter={StaticResource InverseBooleanConverter}}"
|
||||||
|
MinWidth="0"
|
||||||
|
Padding="10 0">
|
||||||
|
<RadioButton.ToolTip>
|
||||||
|
<ToolTip Placement="Center" VerticalOffset="-40">
|
||||||
|
<TextBlock>
|
||||||
|
A condition that constantly checks and is either 'on' or 'off'
|
||||||
|
</TextBlock>
|
||||||
|
</ToolTip>
|
||||||
|
</RadioButton.ToolTip>
|
||||||
|
<TextBlock VerticalAlignment="Center" FontSize="12">
|
||||||
|
<materialDesign:PackIcon Kind="Check" VerticalAlignment="Center" Margin="0 0 2 -3" />
|
||||||
|
CONSTANT
|
||||||
|
</TextBlock>
|
||||||
|
</RadioButton>
|
||||||
|
<RadioButton Grid.Column="1"
|
||||||
|
Style="{StaticResource MaterialDesignTabRadioButton}"
|
||||||
|
IsChecked="{Binding IsEventCondition}"
|
||||||
|
MinWidth="0"
|
||||||
|
Padding="10 0">
|
||||||
|
<RadioButton.ToolTip>
|
||||||
|
<ToolTip Placement="Center" VerticalOffset="-40">
|
||||||
|
<TextBlock>
|
||||||
|
A condition that checks whenever one or more events fire and acts in a configurable way
|
||||||
|
</TextBlock>
|
||||||
|
</ToolTip>
|
||||||
|
</RadioButton.ToolTip>
|
||||||
|
<TextBlock VerticalAlignment="Center" FontSize="12">
|
||||||
|
<materialDesign:PackIcon Kind="LightningBolt" VerticalAlignment="Center" Margin="0 0 2 -3" />
|
||||||
|
EVENTS
|
||||||
|
</TextBlock>
|
||||||
|
</RadioButton>
|
||||||
|
</Grid>
|
||||||
|
</materialDesign:ColorZone>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
|
||||||
<Separator Grid.Row="1" Grid.Column="0" Style="{StaticResource MaterialDesignDarkSeparator}" Margin="-2 0" />
|
<Separator Grid.Row="1" Grid.Column="0" Style="{StaticResource MaterialDesignDarkSeparator}" Margin="-2 0" />
|
||||||
|
|
||||||
<Grid Grid.Row="2" Grid.Column="0" MouseUp="{s:Action ScriptGridMouseUp}" Cursor="Hand">
|
<Grid Grid.Row="2" Visibility="{Binding IsEventCondition, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}, Mode=OneWay}">
|
||||||
<controls:VisualScriptPresenter Script="{Binding RenderProfileElement.DisplayCondition}"
|
|
||||||
AutoFitScript="True"
|
|
||||||
Visibility="{Binding RenderProfileElement.DisplayCondition, Converter={StaticResource NullToVisibilityConverter}}" />
|
|
||||||
<Border Opacity="0">
|
|
||||||
<Border.Background>
|
|
||||||
<SolidColorBrush Color="{Binding Color, Source={StaticResource MaterialDesignCardBackground}}" Opacity="0.75" />
|
|
||||||
</Border.Background>
|
|
||||||
<Border.Style>
|
|
||||||
<Style>
|
|
||||||
<Style.Triggers>
|
|
||||||
<DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource AncestorType={x:Type Grid}, Mode=FindAncestor}}" Value="True">
|
|
||||||
<DataTrigger.EnterActions>
|
|
||||||
<BeginStoryboard>
|
|
||||||
<Storyboard>
|
|
||||||
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.25" />
|
|
||||||
</Storyboard>
|
|
||||||
</BeginStoryboard>
|
|
||||||
</DataTrigger.EnterActions>
|
|
||||||
<DataTrigger.ExitActions>
|
|
||||||
<BeginStoryboard>
|
|
||||||
<Storyboard>
|
|
||||||
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.25" />
|
|
||||||
</Storyboard>
|
|
||||||
</BeginStoryboard>
|
|
||||||
</DataTrigger.ExitActions>
|
|
||||||
</DataTrigger>
|
|
||||||
</Style.Triggers>
|
|
||||||
</Style>
|
|
||||||
</Border.Style>
|
|
||||||
<Grid HorizontalAlignment="Center">
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition />
|
|
||||||
<ColumnDefinition />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<TextBlock Style="{StaticResource MaterialDesignHeadline5TextBlock}" VerticalAlignment="Center" Grid.Column="0">
|
|
||||||
Click to edit script
|
|
||||||
</TextBlock>
|
|
||||||
<materialDesign:PackIcon Kind="OpenInNew" Margin="10 " Width="30" Height="30" Grid.Column="1" VerticalAlignment="Center" />
|
|
||||||
</Grid>
|
|
||||||
</Border>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Grid Grid.Row="3" Visibility="{Binding IsEventCondition, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}, Mode=OneWay}">
|
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="18" />
|
<RowDefinition Height="*" />
|
||||||
<RowDefinition />
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="*" MinWidth="140" />
|
|
||||||
<ColumnDefinition Width="*" MinWidth="170" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
|
|
||||||
<!-- Play mode -->
|
|
||||||
<TextBlock Grid.Column="0" Text="Play mode">
|
|
||||||
<TextBlock.ToolTip>
|
|
||||||
<ToolTip Placement="Center" VerticalOffset="-30">
|
|
||||||
<TextBlock>
|
|
||||||
Configure how the layer should act while the conditions above are met
|
|
||||||
</TextBlock>
|
|
||||||
</ToolTip>
|
|
||||||
</TextBlock.ToolTip>
|
|
||||||
</TextBlock>
|
|
||||||
<materialDesign:ColorZone Grid.Row="1" Grid.Column="0" Mode="Standard" CornerRadius="3" Margin="0 0 2 0">
|
|
||||||
<Grid>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition />
|
|
||||||
<ColumnDefinition />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<RadioButton Grid.Column="0"
|
|
||||||
Style="{StaticResource MaterialDesignTabRadioButton}"
|
|
||||||
IsChecked="{Binding DisplayContinuously}"
|
|
||||||
MinWidth="0"
|
|
||||||
Padding="5 0">
|
|
||||||
<RadioButton.ToolTip>
|
|
||||||
<ToolTip Placement="Center" VerticalOffset="-40">
|
|
||||||
<TextBlock>
|
|
||||||
Continue repeating the main segment of the timeline while the condition is met
|
|
||||||
</TextBlock>
|
|
||||||
</ToolTip>
|
|
||||||
</RadioButton.ToolTip>
|
|
||||||
<TextBlock VerticalAlignment="Center" FontSize="12">
|
|
||||||
<materialDesign:PackIcon Kind="Repeat" VerticalAlignment="Center" Margin="-3 0 0 -3" />
|
|
||||||
REPEAT
|
|
||||||
</TextBlock>
|
|
||||||
</RadioButton>
|
|
||||||
<RadioButton Grid.Column="1"
|
|
||||||
Style="{StaticResource MaterialDesignTabRadioButton}"
|
|
||||||
IsChecked="{Binding DisplayContinuously, Converter={StaticResource InverseBooleanConverter}}"
|
|
||||||
MinWidth="0"
|
|
||||||
Padding="5 0">
|
|
||||||
<RadioButton.ToolTip>
|
|
||||||
<ToolTip Placement="Center" VerticalOffset="-40">
|
|
||||||
<TextBlock>
|
|
||||||
Only play the timeline once when the condition is met
|
|
||||||
</TextBlock>
|
|
||||||
</ToolTip>
|
|
||||||
</RadioButton.ToolTip>
|
|
||||||
<TextBlock VerticalAlignment="Center" FontSize="12">
|
|
||||||
<materialDesign:PackIcon Kind="StopwatchOutline" VerticalAlignment="Center" Margin="-3 0 0 -3" />
|
|
||||||
ONCE
|
|
||||||
</TextBlock>
|
|
||||||
</RadioButton>
|
|
||||||
</Grid>
|
|
||||||
</materialDesign:ColorZone>
|
|
||||||
|
|
||||||
<!-- Stop mode -->
|
|
||||||
<TextBlock Grid.Row="0" Grid.Column="1" Text="Stop mode">
|
|
||||||
<TextBlock.ToolTip>
|
|
||||||
<ToolTip Placement="Center" VerticalOffset="-30">
|
|
||||||
<TextBlock>
|
|
||||||
Configure how the layer should act when the conditions above are no longer met
|
|
||||||
</TextBlock>
|
|
||||||
</ToolTip>
|
|
||||||
</TextBlock.ToolTip>
|
|
||||||
</TextBlock>
|
|
||||||
<materialDesign:ColorZone Grid.Row="1" Grid.Column="1" Mode="Standard" CornerRadius="3" Margin="2 0 0 0" HorizontalAlignment="Stretch">
|
|
||||||
<Grid>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition />
|
|
||||||
<ColumnDefinition MinWidth="100" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<RadioButton Grid.Column="0"
|
|
||||||
Style="{StaticResource MaterialDesignTabRadioButton}"
|
|
||||||
IsChecked="{Binding AlwaysFinishTimeline}"
|
|
||||||
MinWidth="0"
|
|
||||||
Padding="5 0">
|
|
||||||
<RadioButton.ToolTip>
|
|
||||||
<ToolTip Placement="Center" VerticalOffset="-40">
|
|
||||||
<TextBlock>
|
|
||||||
When conditions are no longer met, finish the the current run of the main timeline
|
|
||||||
</TextBlock>
|
|
||||||
</ToolTip>
|
|
||||||
</RadioButton.ToolTip>
|
|
||||||
<TextBlock VerticalAlignment="Center" FontSize="12">
|
|
||||||
<materialDesign:PackIcon Kind="PlayOutline" VerticalAlignment="Center" Margin="-3 0 0 -3" />
|
|
||||||
FINISH
|
|
||||||
</TextBlock>
|
|
||||||
</RadioButton>
|
|
||||||
<RadioButton Grid.Column="1"
|
|
||||||
Style="{StaticResource MaterialDesignTabRadioButton}"
|
|
||||||
IsChecked="{Binding AlwaysFinishTimeline, Converter={StaticResource InverseBooleanConverter}}"
|
|
||||||
MinWidth="0"
|
|
||||||
Padding="5 0">
|
|
||||||
<RadioButton.ToolTip>
|
|
||||||
<ToolTip Placement="Center" VerticalOffset="-40">
|
|
||||||
<TextBlock>
|
|
||||||
When conditions are no longer met, skip to the end segment of the timeline
|
|
||||||
</TextBlock>
|
|
||||||
</ToolTip>
|
|
||||||
</RadioButton.ToolTip>
|
|
||||||
<TextBlock VerticalAlignment="Center" FontSize="12">
|
|
||||||
<materialDesign:PackIcon Kind="SkipNextOutline" VerticalAlignment="Center" Margin="-3 0 0 -3" />
|
|
||||||
SKIP TO END
|
|
||||||
</TextBlock>
|
|
||||||
</RadioButton>
|
|
||||||
</Grid>
|
|
||||||
</materialDesign:ColorZone>
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Grid Grid.Row="3" Visibility="{Binding IsEventCondition, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}">
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="18" />
|
|
||||||
<RowDefinition />
|
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<!-- Trigger mode -->
|
<Grid Grid.Row="0" MouseUp="{s:Action ScriptGridMouseUp}" Cursor="Hand">
|
||||||
<TextBlock Grid.Column="0" Text="Trigger mode">
|
<controls:VisualScriptPresenter Script="{Binding RenderProfileElement.DisplayCondition}"
|
||||||
<TextBlock.ToolTip>
|
AutoFitScript="True"
|
||||||
<ToolTip Placement="Center" VerticalOffset="-30">
|
Visibility="{Binding RenderProfileElement.DisplayCondition, Converter={StaticResource NullToVisibilityConverter}}" />
|
||||||
<TextBlock>
|
<Border Opacity="0">
|
||||||
Configure how the layer should act when the event(s) trigger
|
<Border.Background>
|
||||||
|
<SolidColorBrush Color="{Binding Color, Source={StaticResource MaterialDesignCardBackground}}" Opacity="0.75" />
|
||||||
|
</Border.Background>
|
||||||
|
<Border.Style>
|
||||||
|
<Style>
|
||||||
|
<Style.Triggers>
|
||||||
|
<DataTrigger Binding="{Binding IsMouseOver, RelativeSource={RelativeSource AncestorType={x:Type Grid}, Mode=FindAncestor}}" Value="True">
|
||||||
|
<DataTrigger.EnterActions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:0.25" />
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</DataTrigger.EnterActions>
|
||||||
|
<DataTrigger.ExitActions>
|
||||||
|
<BeginStoryboard>
|
||||||
|
<Storyboard>
|
||||||
|
<DoubleAnimation Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:0.25" />
|
||||||
|
</Storyboard>
|
||||||
|
</BeginStoryboard>
|
||||||
|
</DataTrigger.ExitActions>
|
||||||
|
</DataTrigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</Border.Style>
|
||||||
|
<Grid HorizontalAlignment="Center">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<TextBlock Style="{StaticResource MaterialDesignHeadline5TextBlock}" VerticalAlignment="Center" Grid.Column="0">
|
||||||
|
Click to edit script
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
</ToolTip>
|
<materialDesign:PackIcon Kind="OpenInNew" Margin="10 " Width="30" Height="30" Grid.Column="1" VerticalAlignment="Center" />
|
||||||
</TextBlock.ToolTip>
|
</Grid>
|
||||||
</TextBlock>
|
</Border>
|
||||||
<materialDesign:ColorZone Grid.Row="1" Grid.Column="0" Mode="Standard" CornerRadius="3">
|
</Grid>
|
||||||
<Grid HorizontalAlignment="Stretch">
|
<Grid Grid.Row="1">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<ColumnDefinition />
|
<RowDefinition Height="22" />
|
||||||
<ColumnDefinition />
|
<RowDefinition />
|
||||||
<ColumnDefinition />
|
</Grid.RowDefinitions>
|
||||||
<ColumnDefinition />
|
<Grid.ColumnDefinitions>
|
||||||
</Grid.ColumnDefinitions>
|
<ColumnDefinition Width="*" MinWidth="140" />
|
||||||
<RadioButton Grid.Column="0"
|
<ColumnDefinition Width="*" MinWidth="170" />
|
||||||
Style="{StaticResource MaterialDesignTabRadioButton}"
|
</Grid.ColumnDefinitions>
|
||||||
IsChecked="{Binding Path=EventOverlapMode, Converter={StaticResource ComparisonConverter}, ConverterParameter={x:Static core:TimeLineEventOverlapMode.Restart}}">
|
|
||||||
<TextBlock VerticalAlignment="Center" FontSize="12">
|
<!-- Play mode -->
|
||||||
<materialDesign:PackIcon Kind="Repeat" VerticalAlignment="Center" Margin="-3 0 0 -3" />
|
<TextBlock Grid.Column="0" Text="Play mode" VerticalAlignment="Center">
|
||||||
RESTART
|
<TextBlock.ToolTip>
|
||||||
</TextBlock>
|
<ToolTip Placement="Center" VerticalOffset="-30">
|
||||||
<RadioButton.ToolTip>
|
<TextBlock>
|
||||||
<ToolTip Placement="Center" VerticalOffset="-40">
|
Configure how the layer should act while the conditions above are met
|
||||||
<TextBlock>
|
</TextBlock>
|
||||||
Stop the current run and restart the timeline
|
</ToolTip>
|
||||||
</TextBlock>
|
</TextBlock.ToolTip>
|
||||||
</ToolTip>
|
</TextBlock>
|
||||||
</RadioButton.ToolTip>
|
<materialDesign:ColorZone Grid.Row="1" Grid.Column="0" Mode="Standard" CornerRadius="3" Margin="0 0 2 0">
|
||||||
</RadioButton>
|
<Grid>
|
||||||
<RadioButton Grid.Column="1"
|
<Grid.ColumnDefinitions>
|
||||||
Style="{StaticResource MaterialDesignTabRadioButton}"
|
<ColumnDefinition />
|
||||||
IsChecked="{Binding Path=EventOverlapMode, Converter={StaticResource ComparisonConverter}, ConverterParameter={x:Static core:TimeLineEventOverlapMode.Toggle}}">
|
<ColumnDefinition />
|
||||||
<TextBlock VerticalAlignment="Center" FontSize="12">
|
</Grid.ColumnDefinitions>
|
||||||
<materialDesign:PackIcon Kind="TrafficLight" VerticalAlignment="Center" Margin="-3 0 0 -3" />
|
<RadioButton Grid.Column="0"
|
||||||
TOGGLE
|
Style="{StaticResource MaterialDesignTabRadioButton}"
|
||||||
</TextBlock>
|
IsChecked="{Binding DisplayContinuously}"
|
||||||
<RadioButton.ToolTip>
|
MinWidth="0"
|
||||||
<ToolTip Placement="Center" VerticalOffset="-40">
|
Padding="5 0">
|
||||||
<TextBlock>
|
<RadioButton.ToolTip>
|
||||||
Repeat the timeline until the event fires again
|
<ToolTip Placement="Center" VerticalOffset="-40">
|
||||||
</TextBlock>
|
<TextBlock>
|
||||||
</ToolTip>
|
Continue repeating the main segment of the timeline while the condition is met
|
||||||
</RadioButton.ToolTip>
|
</TextBlock>
|
||||||
</RadioButton>
|
</ToolTip>
|
||||||
<RadioButton Grid.Column="2"
|
</RadioButton.ToolTip>
|
||||||
Style="{StaticResource MaterialDesignTabRadioButton}"
|
<TextBlock VerticalAlignment="Center" FontSize="12">
|
||||||
IsChecked="{Binding Path=EventOverlapMode, Converter={StaticResource ComparisonConverter}, ConverterParameter={x:Static core:TimeLineEventOverlapMode.Ignore}}">
|
<materialDesign:PackIcon Kind="Repeat" VerticalAlignment="Center" Margin="-3 0 0 -3" />
|
||||||
<TextBlock VerticalAlignment="Center" FontSize="12">
|
REPEAT
|
||||||
<materialDesign:PackIcon Kind="EarHearingOff" VerticalAlignment="Center" Margin="-3 0 0 -3" />
|
</TextBlock>
|
||||||
IGNORE
|
</RadioButton>
|
||||||
</TextBlock>
|
<RadioButton Grid.Column="1"
|
||||||
<RadioButton.ToolTip>
|
Style="{StaticResource MaterialDesignTabRadioButton}"
|
||||||
<ToolTip Placement="Center" VerticalOffset="-40">
|
IsChecked="{Binding DisplayContinuously, Converter={StaticResource InverseBooleanConverter}}"
|
||||||
<TextBlock>
|
MinWidth="0"
|
||||||
Ignore subsequent event fires until the timeline finishes
|
Padding="5 0">
|
||||||
</TextBlock>
|
<RadioButton.ToolTip>
|
||||||
</ToolTip>
|
<ToolTip Placement="Center" VerticalOffset="-40">
|
||||||
</RadioButton.ToolTip>
|
<TextBlock>
|
||||||
</RadioButton>
|
Only play the timeline once when the condition is met
|
||||||
<RadioButton Grid.Column="3"
|
</TextBlock>
|
||||||
Style="{StaticResource MaterialDesignTabRadioButton}"
|
</ToolTip>
|
||||||
IsChecked="{Binding Path=EventOverlapMode, Converter={StaticResource ComparisonConverter}, ConverterParameter={x:Static core:TimeLineEventOverlapMode.Copy}}">
|
</RadioButton.ToolTip>
|
||||||
<TextBlock VerticalAlignment="Center" FontSize="12">
|
<TextBlock VerticalAlignment="Center" FontSize="12">
|
||||||
<materialDesign:PackIcon Kind="ContentCopy" VerticalAlignment="Center" Margin="-3 0 0 -3" />
|
<materialDesign:PackIcon Kind="StopwatchOutline" VerticalAlignment="Center" Margin="-3 0 0 -3" />
|
||||||
COPY
|
ONCE
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
<RadioButton.ToolTip>
|
</RadioButton>
|
||||||
<ToolTip Placement="Center" VerticalOffset="-40">
|
</Grid>
|
||||||
<TextBlock>
|
</materialDesign:ColorZone>
|
||||||
Play another copy of the timeline on top of the current run
|
|
||||||
</TextBlock>
|
<!-- Stop mode -->
|
||||||
</ToolTip>
|
<TextBlock Grid.Row="0" Grid.Column="1" Text="Stop mode">
|
||||||
</RadioButton.ToolTip>
|
<TextBlock.ToolTip>
|
||||||
</RadioButton>
|
<ToolTip Placement="Center" VerticalOffset="-30">
|
||||||
</Grid>
|
<TextBlock>
|
||||||
</materialDesign:ColorZone>
|
Configure how the layer should act when the conditions above are no longer met
|
||||||
|
</TextBlock>
|
||||||
|
</ToolTip>
|
||||||
|
</TextBlock.ToolTip>
|
||||||
|
</TextBlock>
|
||||||
|
<materialDesign:ColorZone Grid.Row="1" Grid.Column="1" Mode="Standard" CornerRadius="3" Margin="2 0 0 0" HorizontalAlignment="Stretch">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition MinWidth="100" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<RadioButton Grid.Column="0"
|
||||||
|
Style="{StaticResource MaterialDesignTabRadioButton}"
|
||||||
|
IsChecked="{Binding AlwaysFinishTimeline}"
|
||||||
|
MinWidth="0"
|
||||||
|
Padding="5 0">
|
||||||
|
<RadioButton.ToolTip>
|
||||||
|
<ToolTip Placement="Center" VerticalOffset="-40">
|
||||||
|
<TextBlock>
|
||||||
|
When conditions are no longer met, finish the the current run of the main timeline
|
||||||
|
</TextBlock>
|
||||||
|
</ToolTip>
|
||||||
|
</RadioButton.ToolTip>
|
||||||
|
<TextBlock VerticalAlignment="Center" FontSize="12">
|
||||||
|
<materialDesign:PackIcon Kind="PlayOutline" VerticalAlignment="Center" Margin="-3 0 0 -3" />
|
||||||
|
FINISH
|
||||||
|
</TextBlock>
|
||||||
|
</RadioButton>
|
||||||
|
<RadioButton Grid.Column="1"
|
||||||
|
Style="{StaticResource MaterialDesignTabRadioButton}"
|
||||||
|
IsChecked="{Binding AlwaysFinishTimeline, Converter={StaticResource InverseBooleanConverter}}"
|
||||||
|
MinWidth="0"
|
||||||
|
Padding="5 0">
|
||||||
|
<RadioButton.ToolTip>
|
||||||
|
<ToolTip Placement="Center" VerticalOffset="-40">
|
||||||
|
<TextBlock>
|
||||||
|
When conditions are no longer met, skip to the end segment of the timeline
|
||||||
|
</TextBlock>
|
||||||
|
</ToolTip>
|
||||||
|
</RadioButton.ToolTip>
|
||||||
|
<TextBlock VerticalAlignment="Center" FontSize="12">
|
||||||
|
<materialDesign:PackIcon Kind="SkipNextOutline" VerticalAlignment="Center" Margin="-3 0 0 -3" />
|
||||||
|
SKIP TO END
|
||||||
|
</TextBlock>
|
||||||
|
</RadioButton>
|
||||||
|
</Grid>
|
||||||
|
</materialDesign:ColorZone>
|
||||||
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
<TabControl Grid.Row="2"
|
||||||
|
Visibility="{Binding IsEventCondition, Converter={x:Static s:BoolToVisibilityConverter.Instance}, Mode=OneWay}"
|
||||||
|
ItemsSource="{Binding Items}"
|
||||||
|
SelectedItem="{Binding ActiveItem}"
|
||||||
|
Style="{StaticResource MaterialDesignTabControl}"
|
||||||
|
Background="{DynamicResource MaterialDesignPaper}">
|
||||||
|
<TabControl.ItemTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<DockPanel LastChildFill="True" Margin="-15 0">
|
||||||
|
<Button DockPanel.Dock="Right"
|
||||||
|
Style="{StaticResource MaterialDesignIconForegroundButton}"
|
||||||
|
Width="25"
|
||||||
|
Height="25">
|
||||||
|
<materialDesign:PackIcon Kind="Close" Width="15" Height="15" Foreground="{DynamicResource MaterialDesignBody}" />
|
||||||
|
</Button>
|
||||||
|
<Label Content="{Binding DisplayName}" DockPanel.Dock="Left" />
|
||||||
|
</DockPanel>
|
||||||
|
</DataTemplate>
|
||||||
|
</TabControl.ItemTemplate>
|
||||||
|
<TabControl.ContentTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<ContentControl s:View.Model="{Binding IsAsync=True}"
|
||||||
|
VerticalContentAlignment="Stretch"
|
||||||
|
HorizontalContentAlignment="Stretch"
|
||||||
|
IsTabStop="False"
|
||||||
|
TextElement.Foreground="{DynamicResource MaterialDesignBody}" />
|
||||||
|
</DataTemplate>
|
||||||
|
</TabControl.ContentTemplate>
|
||||||
|
</TabControl>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@ -8,7 +8,7 @@ using Stylet;
|
|||||||
|
|
||||||
namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
|
namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
|
||||||
{
|
{
|
||||||
public class DisplayConditionsViewModel : Screen, IProfileEditorPanelViewModel
|
public class DisplayConditionsViewModel : Conductor<DisplayConditionEventViewModel>.Collection.OneActive, IProfileEditorPanelViewModel
|
||||||
{
|
{
|
||||||
private readonly INodeVmFactory _nodeVmFactory;
|
private readonly INodeVmFactory _nodeVmFactory;
|
||||||
private readonly IProfileEditorService _profileEditorService;
|
private readonly IProfileEditorService _profileEditorService;
|
||||||
@ -21,6 +21,11 @@ namespace Artemis.UI.Screens.ProfileEditor.DisplayConditions
|
|||||||
_profileEditorService = profileEditorService;
|
_profileEditorService = profileEditorService;
|
||||||
_windowManager = windowManager;
|
_windowManager = windowManager;
|
||||||
_nodeVmFactory = nodeVmFactory;
|
_nodeVmFactory = nodeVmFactory;
|
||||||
|
|
||||||
|
Items.Add(new DisplayConditionEventViewModel() { DisplayName = "Event 1"});
|
||||||
|
Items.Add(new DisplayConditionEventViewModel() { DisplayName = "Event 2"});
|
||||||
|
Items.Add(new DisplayConditionEventViewModel() { DisplayName = "Event 3"});
|
||||||
|
Items.Add(new DisplayConditionEventViewModel() { DisplayName = "Event 4"});
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsEventCondition
|
public bool IsEventCondition
|
||||||
|
|||||||
@ -1492,6 +1492,7 @@
|
|||||||
"Artemis.Core": "1.0.0",
|
"Artemis.Core": "1.0.0",
|
||||||
"Artemis.UI.Shared": "2.0.0",
|
"Artemis.UI.Shared": "2.0.0",
|
||||||
"JetBrains.Annotations": "2021.1.0",
|
"JetBrains.Annotations": "2021.1.0",
|
||||||
|
"MaterialDesignThemes": "4.1.0",
|
||||||
"Ninject": "3.3.4",
|
"Ninject": "3.3.4",
|
||||||
"NoStringEvaluating": "2.2.1",
|
"NoStringEvaluating": "2.2.1",
|
||||||
"SkiaSharp": "2.80.3",
|
"SkiaSharp": "2.80.3",
|
||||||
|
|||||||
@ -62,6 +62,9 @@
|
|||||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Update="Nodes\DataModel\CustomViews\DataModelEventNodeCustomView.xaml">
|
||||||
|
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||||
|
</Page>
|
||||||
<Page Update="Nodes\CustomViews\StaticFloatValueNodeCustomView.xaml">
|
<Page Update="Nodes\CustomViews\StaticFloatValueNodeCustomView.xaml">
|
||||||
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
<XamlRuntime>$(DefaultXamlRuntime)</XamlRuntime>
|
||||||
</Page>
|
</Page>
|
||||||
|
|||||||
@ -198,8 +198,6 @@ namespace Artemis.VisualScripting.Editor.Controls
|
|||||||
_canvas.RenderTransform = _canvasViewPortTransform = new TranslateTransform(0, 0);
|
_canvas.RenderTransform = _canvasViewPortTransform = new TranslateTransform(0, 0);
|
||||||
_canvas.MouseLeftButtonDown += OnCanvasMouseLeftButtonDown;
|
_canvas.MouseLeftButtonDown += OnCanvasMouseLeftButtonDown;
|
||||||
_canvas.MouseLeftButtonUp += OnCanvasMouseLeftButtonUp;
|
_canvas.MouseLeftButtonUp += OnCanvasMouseLeftButtonUp;
|
||||||
_canvas.MouseRightButtonDown += OnCanvasMouseRightButtonDown;
|
|
||||||
_canvas.MouseRightButtonUp += OnCanvasMouseRightButtonUp;
|
|
||||||
_canvas.PreviewMouseRightButtonDown += OnCanvasPreviewMouseRightButtonDown;
|
_canvas.PreviewMouseRightButtonDown += OnCanvasPreviewMouseRightButtonDown;
|
||||||
_canvas.MouseMove += OnCanvasMouseMove;
|
_canvas.MouseMove += OnCanvasMouseMove;
|
||||||
_canvas.MouseWheel += OnCanvasMouseWheel;
|
_canvas.MouseWheel += OnCanvasMouseWheel;
|
||||||
@ -292,6 +290,27 @@ namespace Artemis.VisualScripting.Editor.Controls
|
|||||||
|
|
||||||
private void OnCanvasMouseLeftButtonDown(object sender, MouseButtonEventArgs args)
|
private void OnCanvasMouseLeftButtonDown(object sender, MouseButtonEventArgs args)
|
||||||
{
|
{
|
||||||
|
if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
|
||||||
|
{
|
||||||
|
if (AutoFitScript)
|
||||||
|
{
|
||||||
|
args.Handled = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_dragCanvas = true;
|
||||||
|
_dragCanvasStartLocation = args.GetPosition(this);
|
||||||
|
_dragCanvasStartOffset = _viewportCenter;
|
||||||
|
|
||||||
|
_movedDuringDrag = false;
|
||||||
|
|
||||||
|
_canvas.CaptureMouse();
|
||||||
|
|
||||||
|
args.Handled = true;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
VisualScript.DeselectAllNodes();
|
VisualScript.DeselectAllNodes();
|
||||||
|
|
||||||
_boxSelect = true;
|
_boxSelect = true;
|
||||||
@ -317,29 +336,7 @@ namespace Artemis.VisualScripting.Editor.Controls
|
|||||||
SelectWithinRectangle(new Rect(Canvas.GetLeft(_selectionBorder), Canvas.GetTop(_selectionBorder), _selectionBorder.Width, _selectionBorder.Height));
|
SelectWithinRectangle(new Rect(Canvas.GetLeft(_selectionBorder), Canvas.GetTop(_selectionBorder), _selectionBorder.Width, _selectionBorder.Height));
|
||||||
args.Handled = _movedDuringDrag;
|
args.Handled = _movedDuringDrag;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void OnCanvasMouseRightButtonDown(object sender, MouseButtonEventArgs args)
|
|
||||||
{
|
|
||||||
if (AutoFitScript)
|
|
||||||
{
|
|
||||||
args.Handled = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
_dragCanvas = true;
|
|
||||||
_dragCanvasStartLocation = args.GetPosition(this);
|
|
||||||
_dragCanvasStartOffset = _viewportCenter;
|
|
||||||
|
|
||||||
_movedDuringDrag = false;
|
|
||||||
|
|
||||||
_canvas.CaptureMouse();
|
|
||||||
|
|
||||||
args.Handled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void OnCanvasMouseRightButtonUp(object sender, MouseButtonEventArgs args)
|
|
||||||
{
|
|
||||||
if (_dragCanvas)
|
if (_dragCanvas)
|
||||||
{
|
{
|
||||||
_dragCanvas = false;
|
_dragCanvas = false;
|
||||||
@ -353,7 +350,7 @@ namespace Artemis.VisualScripting.Editor.Controls
|
|||||||
{
|
{
|
||||||
if (_dragCanvas)
|
if (_dragCanvas)
|
||||||
{
|
{
|
||||||
if (args.RightButton == MouseButtonState.Pressed)
|
if (args.LeftButton == MouseButtonState.Pressed && (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)))
|
||||||
{
|
{
|
||||||
Vector newLocation = _dragCanvasStartOffset - (((args.GetPosition(this) - _dragCanvasStartLocation)) * (1.0 / Scale));
|
Vector newLocation = _dragCanvasStartOffset - (((args.GetPosition(this) - _dragCanvasStartLocation)) * (1.0 / Scale));
|
||||||
CenterAt(newLocation);
|
CenterAt(newLocation);
|
||||||
@ -541,7 +538,7 @@ namespace Artemis.VisualScripting.Editor.Controls
|
|||||||
List<IPin> pins = node.Pins.ToList();
|
List<IPin> pins = node.Pins.ToList();
|
||||||
pins.AddRange(node.PinCollections.SelectMany(c => c));
|
pins.AddRange(node.PinCollections.SelectMany(c => c));
|
||||||
pins = pins.Where(p => p.Type == typeof(object) || p.Type == SourcePin.Pin.Type).OrderBy(p => p.Type != typeof(object)).ToList();
|
pins = pins.Where(p => p.Type == typeof(object) || p.Type == SourcePin.Pin.Type).OrderBy(p => p.Type != typeof(object)).ToList();
|
||||||
|
|
||||||
IPin preferredPin = SourcePin.Pin.Direction == PinDirection.Input
|
IPin preferredPin = SourcePin.Pin.Direction == PinDirection.Input
|
||||||
? pins.FirstOrDefault(p => p.Direction == PinDirection.Output)
|
? pins.FirstOrDefault(p => p.Direction == PinDirection.Output)
|
||||||
: pins.FirstOrDefault(p => p.Direction == PinDirection.Input);
|
: pins.FirstOrDefault(p => p.Direction == PinDirection.Input);
|
||||||
|
|||||||
@ -0,0 +1,74 @@
|
|||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using Artemis.Core;
|
||||||
|
using Artemis.Core.Modules;
|
||||||
|
using Artemis.Core.Services;
|
||||||
|
using Stylet;
|
||||||
|
|
||||||
|
namespace Artemis.VisualScripting.Nodes.CustomViewModels
|
||||||
|
{
|
||||||
|
public class DataModelEventNodeCustomViewModel : CustomNodeViewModel
|
||||||
|
{
|
||||||
|
private readonly DataModelEventNode _node;
|
||||||
|
private BindableCollection<Module> _modules;
|
||||||
|
|
||||||
|
public DataModelEventNodeCustomViewModel(DataModelEventNode node, ISettingsService settingsService) : base(node)
|
||||||
|
{
|
||||||
|
_node = node;
|
||||||
|
|
||||||
|
ShowFullPaths = settingsService.GetSetting("ProfileEditor.ShowFullPaths", true);
|
||||||
|
ShowDataModelValues = settingsService.GetSetting("ProfileEditor.ShowDataModelValues", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PluginSetting<bool> ShowFullPaths { get; }
|
||||||
|
public PluginSetting<bool> ShowDataModelValues { get; }
|
||||||
|
public BindableCollection<Type> FilterTypes { get; } = new() { typeof(DataModelEvent) };
|
||||||
|
|
||||||
|
public BindableCollection<Module> Modules
|
||||||
|
{
|
||||||
|
get => _modules;
|
||||||
|
set => SetAndNotify(ref _modules, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DataModelPath DataModelPath
|
||||||
|
{
|
||||||
|
get => _node.DataModelPath;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (ReferenceEquals(_node.DataModelPath, value))
|
||||||
|
return;
|
||||||
|
|
||||||
|
_node.DataModelPath?.Dispose();
|
||||||
|
_node.DataModelPath = value;
|
||||||
|
_node.DataModelPath.Save();
|
||||||
|
|
||||||
|
_node.Storage = _node.DataModelPath.Entity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnActivate()
|
||||||
|
{
|
||||||
|
if (Modules != null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Modules = new BindableCollection<Module>();
|
||||||
|
if (_node.Script.Context is Profile scriptProfile && scriptProfile.Configuration.Module != null)
|
||||||
|
Modules.Add(scriptProfile.Configuration.Module);
|
||||||
|
else if (_node.Script.Context is ProfileConfiguration profileConfiguration && profileConfiguration.Module != null)
|
||||||
|
Modules.Add(profileConfiguration.Module);
|
||||||
|
|
||||||
|
_node.PropertyChanged += NodeOnPropertyChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnDeactivate()
|
||||||
|
{
|
||||||
|
_node.PropertyChanged -= NodeOnPropertyChanged;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void NodeOnPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.PropertyName == nameof(DataModelNode.DataModelPath))
|
||||||
|
OnPropertyChanged(nameof(DataModelPath));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
<UserControl x:Class="Artemis.VisualScripting.Nodes.CustomViews.DataModelEventNodeCustomView"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:local="clr-namespace:Artemis.VisualScripting.Nodes.CustomViews"
|
||||||
|
xmlns:s="https://github.com/canton7/Stylet"
|
||||||
|
xmlns:controls="clr-namespace:Artemis.UI.Shared.Controls;assembly=Artemis.UI.Shared"
|
||||||
|
xmlns:editor="clr-namespace:Artemis.VisualScripting.Editor.Controls"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<StackPanel Orientation="Vertical">
|
||||||
|
<controls:DataModelPicker DataModelPath="{Binding DataModelPath}"
|
||||||
|
Modules="{Binding Modules}"
|
||||||
|
ShowFullPath="{Binding ShowFullPaths.Value}"
|
||||||
|
ShowDataModelValues="{Binding ShowDataModelValues.Value}"
|
||||||
|
FilterTypes="{Binding FilterTypes}"
|
||||||
|
ButtonBrush="#434343"/>
|
||||||
|
<editor:VisualScriptPresenter Script="{Binding ChildScript}" IsEnabled="False" ></editor:VisualScriptPresenter>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</UserControl>
|
||||||
51
src/Artemis.VisualScripting/Nodes/DataModelEventNode.cs
Normal file
51
src/Artemis.VisualScripting/Nodes/DataModelEventNode.cs
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
using System;
|
||||||
|
using Artemis.Core;
|
||||||
|
using Artemis.Storage.Entities.Profile;
|
||||||
|
using Artemis.VisualScripting.Nodes.CustomViewModels;
|
||||||
|
|
||||||
|
namespace Artemis.VisualScripting.Nodes
|
||||||
|
{
|
||||||
|
[Node("Data Model-Event", "Responds to a data model event trigger", "External", OutputType = typeof(bool))]
|
||||||
|
public class DataModelEventNode : Node<DataModelEventNodeCustomViewModel>, IDisposable
|
||||||
|
{
|
||||||
|
private DataModelPath _dataModelPath;
|
||||||
|
|
||||||
|
public DataModelEventNode() : base("Data Model-Event", "Responds to a data model event trigger")
|
||||||
|
{
|
||||||
|
Output = CreateOutputPin<bool>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public OutputPin<bool> Output { get; }
|
||||||
|
public INodeScript Script { get; set; }
|
||||||
|
|
||||||
|
public DataModelPath DataModelPath
|
||||||
|
{
|
||||||
|
get => _dataModelPath;
|
||||||
|
set => SetAndNotify(ref _dataModelPath, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Initialize(INodeScript script)
|
||||||
|
{
|
||||||
|
Script = script;
|
||||||
|
|
||||||
|
if (Storage is not DataModelPathEntity pathEntity)
|
||||||
|
return;
|
||||||
|
|
||||||
|
DataModelPath = new DataModelPath(null, pathEntity);
|
||||||
|
DataModelPath.PathValidated += DataModelPathOnPathValidated;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Evaluate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DataModelPathOnPathValidated(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
public void Dispose()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -84,7 +84,7 @@ namespace Artemis.VisualScripting.Nodes
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
DataModelPath.Dispose();
|
DataModelPath?.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user