Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

Commit

Permalink
Re-disabled DX10 saving :(
Browse files Browse the repository at this point in the history
Added loading thing for long load times.
  • Loading branch information
KFreon committed May 21, 2017
1 parent 0b38f5d commit e73d343
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 18 deletions.
2 changes: 1 addition & 1 deletion CSharpImageLibrary/ImageFormats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public partial class ImageFormats
/// <summary>
/// Contains formats not yet capable of saving.
/// </summary>
public static List<ImageEngineFormat> SaveUnsupported = new List<ImageEngineFormat>() { ImageEngineFormat.TGA, ImageEngineFormat.Unknown };
public static List<ImageEngineFormat> SaveUnsupported = new List<ImageEngineFormat>() { ImageEngineFormat.DDS_DX10, ImageEngineFormat.TGA, ImageEngineFormat.Unknown };


/// <summary>
Expand Down
31 changes: 30 additions & 1 deletion UI_Project/NewMainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,8 @@
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>



<StackPanel x:Name="ChannelSelectorBox" Grid.Row="3" Orientation="Horizontal" VerticalAlignment="Top" Style="{StaticResource UnloadedOpacityStyle}">
<StackPanel.Resources>
<Style TargetType="ToggleButton">
Expand Down Expand Up @@ -813,7 +815,7 @@
</Line>
</Grid>
</ToggleButton>
<Label x:Name="SaveRegeneratingLabel" Grid.Row="1" Grid.Column="2" VerticalAlignment="Bottom" HorizontalAlignment="Center" Content="Regenerating..." Foreground="LightSalmon" Visibility="{Binding SaveRegenerating, Converter={StaticResource BoolToVisConverter}}"/>
<Label x:Name="SaveRegeneratingLabel" Grid.Row="1" Grid.Column="2" VerticalAlignment="Bottom" HorizontalAlignment="Center" Content="Regenerating..." Foreground="LightSalmon" Visibility="{Binding Busy, Converter={StaticResource BoolToVisConverter}}"/>
<!--END Save Image Box-->


Expand Down Expand Up @@ -1435,5 +1437,32 @@
</StackPanel>
</Border>
</Border>

<DockPanel Grid.RowSpan="5" Grid.ColumnSpan="5" Background="#7F000000" Visibility="{Binding Busy, Converter={StaticResource BoolToVisConverter}}">
<DockPanel VerticalAlignment="Center" HorizontalAlignment="Center">
<Border x:Name="LoadingBorder" BorderBrush="Red" BorderThickness="10" Padding="20,5">
<Border.Style>
<Style TargetType="Border">
<Style.Triggers>
<DataTrigger Binding="{Binding Busy}" Value="True">
<DataTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimationUsingKeyFrames RepeatBehavior="Forever" Storyboard.TargetProperty="BorderBrush.Opacity">
<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="1"/>
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</DataTrigger.EnterActions>
</DataTrigger>
</Style.Triggers>
</Style>
</Border.Style>
<Label Content="LOADING..." FontSize="50" Foreground="Red" FontWeight="Bold"/>
</Border>
</DockPanel>
</DockPanel>
</Grid>
</Window>
19 changes: 3 additions & 16 deletions UI_Project/NewViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -927,19 +927,6 @@ public WriteableBitmap SavePreview
}
}

bool saveRegenerating = false;
public bool SaveRegenerating
{
get
{
return saveRegenerating;
}
set
{
SetProperty(ref saveRegenerating, value);
}
}

public bool IsSaveSmaller
{
get
Expand Down Expand Up @@ -1226,6 +1213,8 @@ internal async Task<bool> LoadImage(byte[] data)
{
LoadFailed = false;

Busy = true;

if (!timer.IsRunning)
timer.Restart();

Expand Down Expand Up @@ -1254,6 +1243,7 @@ internal async Task<bool> LoadImage(byte[] data)
Trace.WriteLine($"Preview of {LoadedFormat} ({Width}x{Height}, {(MipCount > 1 ? "Mips Present" : "No Mips")}) = {timer.ElapsedMilliseconds}ms.");

IsImageLoaded = true;
Busy = false;
return true;
}

Expand Down Expand Up @@ -1297,7 +1287,6 @@ void CloseImage(bool updateUI)
SavePath = null;
SaveError = null;
SaveAttempted = false;
SaveRegenerating = false;
MipIndex = 0;
WindowTitle = "Image Engine";
RemoveGeneralAlpha = false; // Other alpha settings not reset because they're specific, but this one spans formats.
Expand Down Expand Up @@ -1575,7 +1564,6 @@ public async Task UpdateSavePreview(bool needRegenerate = true)
if (!IsImageLoaded)
return;

SaveRegenerating = true;

// Don't bother regenerating things. Just show what it looks like.
if (SaveFormatDetails.Format == LoadedFormat)
Expand All @@ -1602,7 +1590,6 @@ await Task.Run(() =>


UpdatePreview(ref savePreview, savePreviewIMG.Width, savePreviewIMG.Height, savePreviewIMG.MipMaps[0].Pixels, SaveFormatDetails, true);
SaveRegenerating = false;

// Update Properties
OnPropertyChanged(nameof(SavePreview));
Expand Down

0 comments on commit e73d343

Please sign in to comment.