save loaded and appended models

This commit is contained in:
iAmAsval 2021-11-22 22:46:26 +01:00
parent 214f0a519d
commit 2dc8ae98fb
3 changed files with 30 additions and 8 deletions

View File

@ -133,7 +133,10 @@ namespace FModel.ViewModels
ModelAndCam p;
if (AppendMode && CanAppend)
{
p = SelectedModel;
_loadedModels.Add(new ModelAndCam(export) {IsVisible = false});
}
else
{
p = new ModelAndCam(export);
@ -505,6 +508,13 @@ namespace FModel.ViewModels
public Geometry3D ZAxis { get; set; }
public int TriangleCount { get; set; }
private bool _isVisible = true;
public bool IsVisible
{
get => _isVisible;
set => SetProperty(ref _isVisible, value);
}
private MeshGeometryModel3D _selectedGeometry; // selected material
public MeshGeometryModel3D SelectedGeometry
{

View File

@ -44,14 +44,7 @@
</Grid.ColumnDefinitions>
<TextBlock Grid.Row="0" Grid.Column="0" Text="Models" VerticalAlignment="Center" Margin="0 0 0 10" />
<ComboBox Grid.Row="0" Grid.Column="2" ItemsSource="{Binding ModelViewer.LoadedModelsView, IsAsync=True}"
SelectedItem="{Binding ModelViewer.SelectedModel, Mode=TwoWay}">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Export.Name}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<ComboBox Grid.Row="0" Grid.Column="2" Style="{StaticResource ModelsComboBox}" />
<TextBlock Grid.Row="1" Grid.Column="0" Text="Triangles" VerticalAlignment="Center" Margin="0 0 0 10" />
<TextBlock Grid.Row="1" Grid.Column="2" Text="{Binding ModelViewer.SelectedModel.TriangleCount, FallbackValue=0, StringFormat={}{0:### ### ### ###}}" VerticalAlignment="Center" HorizontalAlignment="Right" />

View File

@ -618,6 +618,25 @@
</Style.Triggers>
</Style>
<Style x:Key="ModelsComboBox" TargetType="ComboBox" BasedOn="{StaticResource {x:Type ComboBox}}">
<Setter Property="ItemsSource" Value="{Binding ModelViewer.LoadedModelsView, IsAsync=True}" />
<Setter Property="SelectedItem" Value="{Binding ModelViewer.SelectedModel, Mode=TwoWay}" />
<Setter Property="ItemTemplate">
<Setter.Value>
<DataTemplate>
<TextBlock Text="{Binding Export.Name}" />
</DataTemplate>
</Setter.Value>
</Setter>
<Setter Property="ItemContainerStyle">
<Setter.Value>
<Style TargetType="{x:Type ComboBoxItem}" BasedOn="{StaticResource {x:Type ComboBoxItem}}">
<Setter Property="Visibility" Value="{Binding IsVisible, Converter={StaticResource BoolToVisibilityConverter}}" />
</Style>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="MaterialsListBox" TargetType="ListBox" BasedOn="{StaticResource {x:Type ListBox}}">
<Setter Property="ItemsSource" Value="{Binding ModelViewer.SelectedModel.Group3d, IsAsync=True}" />
<Setter Property="SelectedItem" Value="{Binding ModelViewer.SelectedModel.SelectedGeometry}" />