/****************************************************************************
* Copyright 2019 Nreal Techonology Limited. All rights reserved.
*
* This file is part of NRSDK.
*
* https://www.nreal.ai/
*
*****************************************************************************/
namespace NRKernal.NREditor
{
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
/// A nr serialized image target.
public class NRSerializedImageTarget : NRSerializedTrackable
{
/// The aspect ratio.
private readonly SerializedProperty m_AspectRatio;
/// The width.
private readonly SerializedProperty m_Width;
/// The height.
private readonly SerializedProperty m_Height;
/// The tracking image database.
private readonly SerializedProperty m_TrackingImageDatabase;
/// Zero-based index of the database.
private readonly SerializedProperty m_DatabaseIndex;
/// Gets the aspect ratio property.
/// The aspect ratio property.
public SerializedProperty AspectRatioProperty { get { return m_AspectRatio; } }
/// Gets or sets the aspect ratio.
/// The aspect ratio.
public float AspectRatio { get { return m_AspectRatio.floatValue; } set { m_AspectRatio.floatValue = value; } }
/// Gets the width property.
/// The width property.
public SerializedProperty WidthProperty { get { return m_Width; } }
/// Gets or sets the width.
/// The width.
public float Width { get { return m_Width.floatValue; } set { m_Width.floatValue = value; } }
/// Gets the height property.
/// The height property.
public SerializedProperty HeightProperty { get { return m_Height; } }
/// Gets or sets the height.
/// The height.
public float Height { get { return m_Height.floatValue; } set { m_Height.floatValue = value; } }
/// Gets the tracking image database property.
/// The tracking image database property.
public SerializedProperty TrackingImageDatabaseProperty { get { return m_TrackingImageDatabase; } }
/// Gets or sets the tracking image database.
/// The tracking image database.
public string TrackingImageDatabase { get { return m_TrackingImageDatabase.stringValue; } set { m_TrackingImageDatabase.stringValue = value; } }
/// Gets the database index property.
/// The database index property.
public SerializedProperty DatabaseIndexProperty { get { return m_DatabaseIndex; } }
/// Gets or sets the zero-based index of the database.
/// The database index.
public int DatabaseIndex { get { return m_DatabaseIndex.intValue; } set { m_DatabaseIndex.intValue = value; } }
/// Constructor.
/// Target for the.
public NRSerializedImageTarget(SerializedObject target) : base(target)
{
m_AspectRatio = target.FindProperty("m_AspectRatio");
m_Width = target.FindProperty("m_Width");
m_Height = target.FindProperty("m_Height");
m_DatabaseIndex = target.FindProperty("m_DatabaseIndex");
}
/// Gets the behaviours.
/// The behaviours.
public List GetBehaviours()
{
List list = new List();
Object[] targetObjs = m_SerializedObject.targetObjects;
for (int i = 0; i < targetObjs.Length; i++)
{
list.Add((NRTrackableImageBehaviour)targetObjs[i]);
}
return list;
}
}
}