NRTrackableImagetAccessor.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /****************************************************************************
  2. * Copyright 2019 Nreal Techonology Limited. All rights reserved.
  3. *
  4. * This file is part of NRSDK.
  5. *
  6. * https://www.nreal.ai/
  7. *
  8. *****************************************************************************/
  9. namespace NRKernal.NREditor
  10. {
  11. using System.Collections;
  12. using System.Collections.Generic;
  13. using UnityEngine;
  14. using UnityEditor;
  15. /// <summary> A nr image target accessor. </summary>
  16. internal class NRImageTargetAccessor : NRTrackableAccessor
  17. {
  18. /// <summary> The serialized object. </summary>
  19. private readonly NRSerializedImageTarget m_SerializedObject;
  20. /// <summary> Constructor. </summary>
  21. /// <param name="target"> Target for the.</param>
  22. public NRImageTargetAccessor(NRTrackableImageBehaviour target)
  23. {
  24. m_Target = target;
  25. m_SerializedObject = new NRSerializedImageTarget(new SerializedObject(m_Target));
  26. }
  27. /// <summary> Applies the data appearance. </summary>
  28. public override void ApplyDataAppearance()
  29. {
  30. NRTrackableImageEditor.UpdateAspectRatio(m_SerializedObject);
  31. NRTrackableImageEditor.UpdateMaterial(m_SerializedObject);
  32. }
  33. /// <summary> Applies the data properties. </summary>
  34. public override void ApplyDataProperties()
  35. {
  36. NRTrackableImageEditor.UpdateScale(m_SerializedObject);
  37. }
  38. }
  39. /// <summary> An image target data. </summary>
  40. public struct ImageTargetData
  41. {
  42. /// <summary> The size. </summary>
  43. public Vector2 Size;
  44. /// <summary> The preview image. </summary>
  45. public string PreviewImage;
  46. }
  47. }