Skip to content

Commit

Permalink
Move ImageErrorExtraDescription() from LoadReferenceImageButton.cs to…
Browse files Browse the repository at this point in the history
… ReferenceImage.cs
  • Loading branch information
eeropomell committed Jun 6, 2024
1 parent 9b5049a commit 4690246
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
6 changes: 1 addition & 5 deletions Assets/Scripts/GUI/LoadReferenceImageButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void RefreshDescription()
// displays "Image too large to load" under the file name.
if (ReferenceImage.Icon == ReferenceImageCatalog.m_Instance.ErrorImage)
{
SetDescriptionText(App.ShortenForDescriptionText(ReferenceImage.FileName), ImageErrorExtraDescription());
SetDescriptionText(App.ShortenForDescriptionText(ReferenceImage.FileName), ReferenceImage.ImageErrorExtraDescription());
}
else
{
Expand Down Expand Up @@ -88,9 +88,5 @@ override public void ResetState()
RefreshDescription();
}

public string ImageErrorExtraDescription()
{
return m_ErrorHelpText.GetLocalizedStringAsync().Result;
}
}
} // namespace TiltBrush
14 changes: 14 additions & 0 deletions Assets/Scripts/ReferenceImage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,20 @@ public bool NotLoaded
// Same meaning as Future.State.Running
public bool Running { get { return m_coroutine != null; } }

public string ImageErrorExtraDescription()
{

if (m_State == ImageState.Error || m_State == ImageState.ErrorGeneric)
{
return "Image failed to load";
}
else if (m_State == ImageState.ErrorImageTooLarge)
{
return "Image too large to load";
}

}

// An icon-sized version of the image, or an error icon if the file is unloadable.
// Often resampled into a square, so use ImageAspect instead of calculating the
// aspect ratio from this texture's size.
Expand Down

0 comments on commit 4690246

Please sign in to comment.