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

Commit e73d343

Browse files
committed
Re-disabled DX10 saving :(
Added loading thing for long load times.
1 parent 0b38f5d commit e73d343

3 files changed

Lines changed: 34 additions & 18 deletions

File tree

CSharpImageLibrary/ImageFormats.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public partial class ImageFormats
173173
/// <summary>
174174
/// Contains formats not yet capable of saving.
175175
/// </summary>
176-
public static List<ImageEngineFormat> SaveUnsupported = new List<ImageEngineFormat>() { ImageEngineFormat.TGA, ImageEngineFormat.Unknown };
176+
public static List<ImageEngineFormat> SaveUnsupported = new List<ImageEngineFormat>() { ImageEngineFormat.DDS_DX10, ImageEngineFormat.TGA, ImageEngineFormat.Unknown };
177177

178178

179179
/// <summary>

UI_Project/NewMainWindow.xaml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,8 @@
435435
</VisualStateGroup>
436436
</VisualStateManager.VisualStateGroups>
437437

438+
439+
438440
<StackPanel x:Name="ChannelSelectorBox" Grid.Row="3" Orientation="Horizontal" VerticalAlignment="Top" Style="{StaticResource UnloadedOpacityStyle}">
439441
<StackPanel.Resources>
440442
<Style TargetType="ToggleButton">
@@ -813,7 +815,7 @@
813815
</Line>
814816
</Grid>
815817
</ToggleButton>
816-
<Label x:Name="SaveRegeneratingLabel" Grid.Row="1" Grid.Column="2" VerticalAlignment="Bottom" HorizontalAlignment="Center" Content="Regenerating..." Foreground="LightSalmon" Visibility="{Binding SaveRegenerating, Converter={StaticResource BoolToVisConverter}}"/>
818+
<Label x:Name="SaveRegeneratingLabel" Grid.Row="1" Grid.Column="2" VerticalAlignment="Bottom" HorizontalAlignment="Center" Content="Regenerating..." Foreground="LightSalmon" Visibility="{Binding Busy, Converter={StaticResource BoolToVisConverter}}"/>
817819
<!--END Save Image Box-->
818820

819821

@@ -1435,5 +1437,32 @@
14351437
</StackPanel>
14361438
</Border>
14371439
</Border>
1440+
1441+
<DockPanel Grid.RowSpan="5" Grid.ColumnSpan="5" Background="#7F000000" Visibility="{Binding Busy, Converter={StaticResource BoolToVisConverter}}">
1442+
<DockPanel VerticalAlignment="Center" HorizontalAlignment="Center">
1443+
<Border x:Name="LoadingBorder" BorderBrush="Red" BorderThickness="10" Padding="20,5">
1444+
<Border.Style>
1445+
<Style TargetType="Border">
1446+
<Style.Triggers>
1447+
<DataTrigger Binding="{Binding Busy}" Value="True">
1448+
<DataTrigger.EnterActions>
1449+
<BeginStoryboard>
1450+
<Storyboard>
1451+
<DoubleAnimationUsingKeyFrames RepeatBehavior="Forever" Storyboard.TargetProperty="BorderBrush.Opacity">
1452+
<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
1453+
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
1454+
<EasingDoubleKeyFrame KeyTime="0:0:1" Value="1"/>
1455+
</DoubleAnimationUsingKeyFrames>
1456+
</Storyboard>
1457+
</BeginStoryboard>
1458+
</DataTrigger.EnterActions>
1459+
</DataTrigger>
1460+
</Style.Triggers>
1461+
</Style>
1462+
</Border.Style>
1463+
<Label Content="LOADING..." FontSize="50" Foreground="Red" FontWeight="Bold"/>
1464+
</Border>
1465+
</DockPanel>
1466+
</DockPanel>
14381467
</Grid>
14391468
</Window>

UI_Project/NewViewModel.cs

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -927,19 +927,6 @@ public WriteableBitmap SavePreview
927927
}
928928
}
929929

930-
bool saveRegenerating = false;
931-
public bool SaveRegenerating
932-
{
933-
get
934-
{
935-
return saveRegenerating;
936-
}
937-
set
938-
{
939-
SetProperty(ref saveRegenerating, value);
940-
}
941-
}
942-
943930
public bool IsSaveSmaller
944931
{
945932
get
@@ -1226,6 +1213,8 @@ internal async Task<bool> LoadImage(byte[] data)
12261213
{
12271214
LoadFailed = false;
12281215

1216+
Busy = true;
1217+
12291218
if (!timer.IsRunning)
12301219
timer.Restart();
12311220

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

12561245
IsImageLoaded = true;
1246+
Busy = false;
12571247
return true;
12581248
}
12591249

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

1578-
SaveRegenerating = true;
15791567

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

16031591

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

16071594
// Update Properties
16081595
OnPropertyChanged(nameof(SavePreview));

0 commit comments

Comments
 (0)