Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue where images that are too large fail to load without any in… #722

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,15 @@ MonoBehaviour:
m_HoverScale: 1.2
m_HoverBoxColliderGrow: 0.2
m_AddOverlay: 0
m_ErrorHelpText:
m_TableReference:
m_TableCollectionName: GUID:c84355079ab3f3e4f8f3812258805f86
m_TableEntryReference:
m_KeyId: 238935604850335744
m_Key:
m_FallbackState: 0
m_WaitForCompletion: 0
m_LocalVariables: []
references:
version: 2
RefIds: []
162 changes: 162 additions & 0 deletions Assets/Prefabs/Panels/ReferencePanel/ReferencePanelTabImage.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,24 @@ MonoBehaviour:
m_HoverScale: 1.2
m_HoverBoxColliderGrow: 0.2
m_AddOverlay: 0
m_LoadHelpText:
m_TableReference:
m_TableCollectionName: GUID:c84355079ab3f3e4f8f3812258805f86
m_TableEntryReference:
m_KeyId: 238555522805800960
m_Key:
m_FallbackState: 0
m_WaitForCompletion: 0
m_LocalVariables: []
m_ErrorHelpText:
m_TableReference:
m_TableCollectionName: GUID:c84355079ab3f3e4f8f3812258805f86
m_TableEntryReference:
m_KeyId: 238556149774557184
m_Key:
m_FallbackState: 0
m_WaitForCompletion: 0
m_LocalVariables: []
references:
version: 2
RefIds: []
Expand Down Expand Up @@ -207,6 +225,24 @@ MonoBehaviour:
m_HoverScale: 1.2
m_HoverBoxColliderGrow: 0.2
m_AddOverlay: 0
m_LoadHelpText:
m_TableReference:
m_TableCollectionName: GUID:c84355079ab3f3e4f8f3812258805f86
m_TableEntryReference:
m_KeyId: 238555522805800960
m_Key:
m_FallbackState: 0
m_WaitForCompletion: 0
m_LocalVariables: []
m_ErrorHelpText:
m_TableReference:
m_TableCollectionName: GUID:c84355079ab3f3e4f8f3812258805f86
m_TableEntryReference:
m_KeyId: 238556149774557184
m_Key:
m_FallbackState: 0
m_WaitForCompletion: 0
m_LocalVariables: []
references:
version: 2
RefIds: []
Expand Down Expand Up @@ -262,6 +298,24 @@ MonoBehaviour:
m_HoverScale: 1.2
m_HoverBoxColliderGrow: 0.2
m_AddOverlay: 0
m_LoadHelpText:
m_TableReference:
m_TableCollectionName: GUID:c84355079ab3f3e4f8f3812258805f86
m_TableEntryReference:
m_KeyId: 238555522805800960
m_Key:
m_FallbackState: 0
m_WaitForCompletion: 0
m_LocalVariables: []
m_ErrorHelpText:
m_TableReference:
m_TableCollectionName: GUID:c84355079ab3f3e4f8f3812258805f86
m_TableEntryReference:
m_KeyId: 238556149774557184
m_Key:
m_FallbackState: 0
m_WaitForCompletion: 0
m_LocalVariables: []
references:
version: 2
RefIds: []
Expand Down Expand Up @@ -317,6 +371,24 @@ MonoBehaviour:
m_HoverScale: 1.2
m_HoverBoxColliderGrow: 0.2
m_AddOverlay: 0
m_LoadHelpText:
m_TableReference:
m_TableCollectionName: GUID:c84355079ab3f3e4f8f3812258805f86
m_TableEntryReference:
m_KeyId: 238555522805800960
m_Key:
m_FallbackState: 0
m_WaitForCompletion: 0
m_LocalVariables: []
m_ErrorHelpText:
m_TableReference:
m_TableCollectionName: GUID:c84355079ab3f3e4f8f3812258805f86
m_TableEntryReference:
m_KeyId: 238556149774557184
m_Key:
m_FallbackState: 0
m_WaitForCompletion: 0
m_LocalVariables: []
references:
version: 2
RefIds: []
Expand Down Expand Up @@ -372,6 +444,24 @@ MonoBehaviour:
m_HoverScale: 1.2
m_HoverBoxColliderGrow: 0.2
m_AddOverlay: 0
m_LoadHelpText:
m_TableReference:
m_TableCollectionName: GUID:c84355079ab3f3e4f8f3812258805f86
m_TableEntryReference:
m_KeyId: 238555522805800960
m_Key:
m_FallbackState: 0
m_WaitForCompletion: 0
m_LocalVariables: []
m_ErrorHelpText:
m_TableReference:
m_TableCollectionName: GUID:c84355079ab3f3e4f8f3812258805f86
m_TableEntryReference:
m_KeyId: 238556149774557184
m_Key:
m_FallbackState: 0
m_WaitForCompletion: 0
m_LocalVariables: []
references:
version: 2
RefIds: []
Expand Down Expand Up @@ -427,6 +517,24 @@ MonoBehaviour:
m_HoverScale: 1.2
m_HoverBoxColliderGrow: 0.2
m_AddOverlay: 0
m_LoadHelpText:
m_TableReference:
m_TableCollectionName: GUID:c84355079ab3f3e4f8f3812258805f86
m_TableEntryReference:
m_KeyId: 238555522805800960
m_Key:
m_FallbackState: 0
m_WaitForCompletion: 0
m_LocalVariables: []
m_ErrorHelpText:
m_TableReference:
m_TableCollectionName: GUID:c84355079ab3f3e4f8f3812258805f86
m_TableEntryReference:
m_KeyId: 238556149774557184
m_Key:
m_FallbackState: 0
m_WaitForCompletion: 0
m_LocalVariables: []
references:
version: 2
RefIds: []
Expand Down Expand Up @@ -482,6 +590,24 @@ MonoBehaviour:
m_HoverScale: 1.2
m_HoverBoxColliderGrow: 0.2
m_AddOverlay: 0
m_LoadHelpText:
m_TableReference:
m_TableCollectionName: GUID:c84355079ab3f3e4f8f3812258805f86
m_TableEntryReference:
m_KeyId: 238555522805800960
m_Key:
m_FallbackState: 0
m_WaitForCompletion: 0
m_LocalVariables: []
m_ErrorHelpText:
m_TableReference:
m_TableCollectionName: GUID:c84355079ab3f3e4f8f3812258805f86
m_TableEntryReference:
m_KeyId: 238556149774557184
m_Key:
m_FallbackState: 0
m_WaitForCompletion: 0
m_LocalVariables: []
references:
version: 2
RefIds: []
Expand Down Expand Up @@ -537,6 +663,24 @@ MonoBehaviour:
m_HoverScale: 1.2
m_HoverBoxColliderGrow: 0.2
m_AddOverlay: 0
m_LoadHelpText:
m_TableReference:
m_TableCollectionName: GUID:c84355079ab3f3e4f8f3812258805f86
m_TableEntryReference:
m_KeyId: 238555522805800960
m_Key:
m_FallbackState: 0
m_WaitForCompletion: 0
m_LocalVariables: []
m_ErrorHelpText:
m_TableReference:
m_TableCollectionName: GUID:c84355079ab3f3e4f8f3812258805f86
m_TableEntryReference:
m_KeyId: 238556149774557184
m_Key:
m_FallbackState: 0
m_WaitForCompletion: 0
m_LocalVariables: []
references:
version: 2
RefIds: []
Expand Down Expand Up @@ -592,6 +736,24 @@ MonoBehaviour:
m_HoverScale: 1.2
m_HoverBoxColliderGrow: 0.2
m_AddOverlay: 0
m_LoadHelpText:
m_TableReference:
m_TableCollectionName: GUID:c84355079ab3f3e4f8f3812258805f86
m_TableEntryReference:
m_KeyId: 238555522805800960
m_Key:
m_FallbackState: 0
m_WaitForCompletion: 0
m_LocalVariables: []
m_ErrorHelpText:
m_TableReference:
m_TableCollectionName: GUID:c84355079ab3f3e4f8f3812258805f86
m_TableEntryReference:
m_KeyId: 238556149774557184
m_Key:
m_FallbackState: 0
m_WaitForCompletion: 0
m_LocalVariables: []
references:
version: 2
RefIds: []
19 changes: 17 additions & 2 deletions Assets/Scripts/GUI/LoadBackgroundImageButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
// limitations under the License.

using UnityEngine;
using UnityEngine.Localization;

namespace TiltBrush
{

Expand All @@ -24,10 +26,21 @@ public void RefreshDescription()
{
if (ReferenceImage != null)
{
SetDescriptionText(ReferenceImage.FileName);

// null if image doesn't have error
string errorMessage = ReferenceImage.ImageErrorExtraDescription();

if (errorMessage != null)
{
SetDescriptionText(App.ShortenForDescriptionText(ReferenceImage.FileName), errorMessage);
}
else
{
SetDescriptionText(App.ShortenForDescriptionText(ReferenceImage.FileName));
}

}
}

override protected void OnButtonPressed()
{
if (ReferenceImage == null)
Expand All @@ -52,6 +65,8 @@ override public void ResetState()
{
SetButtonAvailable(available);
}

RefreshDescription();
}

public void Set360ButtonTexture(Texture2D rTexture, float aspect = -1)
Expand Down
19 changes: 18 additions & 1 deletion Assets/Scripts/GUI/LoadReferenceImageButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using UnityEngine.Localization;
using UnityEngine;

namespace TiltBrush
{

Expand All @@ -23,7 +26,19 @@ public void RefreshDescription()
{
if (ReferenceImage != null)
{
SetDescriptionText(ReferenceImage.FileName);

// null if image doesn't have error
string errorMessage = ReferenceImage.ImageErrorExtraDescription();

if (errorMessage != null)
{
SetDescriptionText(App.ShortenForDescriptionText(ReferenceImage.FileName), errorMessage);
}
else
{
SetDescriptionText(App.ShortenForDescriptionText(ReferenceImage.FileName));
}

}
}

Expand Down Expand Up @@ -68,6 +83,8 @@ override public void ResetState()
{
SetButtonAvailable(available);
}

RefreshDescription();
}
}
} // namespace TiltBrush
Loading
Loading