42 lines
964 B
C#
42 lines
964 B
C#
// SPDX-FileCopyrightText: 2023 Unity Technologies and the glTFast authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
#if NEWTONSOFT_JSON
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using GLTFast.Schema;
|
|
using Newtonsoft.Json;
|
|
using Newtonsoft.Json.Linq;
|
|
using UnityEngine.Scripting;
|
|
|
|
namespace GLTFast.Newtonsoft.Schema
|
|
{
|
|
public class Image : GLTFast.Schema.Image, IJsonObject
|
|
{
|
|
public UnclassifiedData extras;
|
|
public UnclassifiedData extensions;
|
|
|
|
[JsonExtensionData]
|
|
IDictionary<string, JToken> m_JsonExtensionData;
|
|
|
|
[Preserve]
|
|
public Image() {}
|
|
|
|
public bool TryGetValue<T>(string key, out T value)
|
|
{
|
|
if (m_JsonExtensionData != null
|
|
&& m_JsonExtensionData.TryGetValue(key, out var token))
|
|
{
|
|
value = token.ToObject<T>();
|
|
return true;
|
|
}
|
|
|
|
value = default;
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
#endif
|