//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
//**************** Copyright (c) 2016 Marko Pintera (marko.pintera@gmail.com). All rights reserved. **********************//
using System.Collections.Generic;
using System;
using BansheeEngine;
namespace BansheeEditor
{
/** @addtogroup Inspector
* @{
*/
///
/// Displays GUI for a serializable property containing a generic object. Inspectable object fields are displayed
/// in separate rows.
///
public class InspectableObject : InspectableField
{
private const int IndentAmount = 5;
private object propertyValue;
private List children = new List();
private GUILayoutY guiLayout;
private GUILayoutX guiChildLayout;
private GUILayoutX guiTitleLayout;
private GUILayoutX guiInternalTitleLayout;
private bool isExpanded;
private bool forceUpdate = true;
private State state;
///
/// Creates a new inspectable array GUI for the specified property.
///
/// Parent Inspector this field belongs to.
/// Name of the property, or some other value to set as the title.
/// Full path to this property (includes name of this property and all parent properties).
/// Determines how deep within the inspector nesting hierarchy is this field. Some fields may
/// contain other fields, in which case you should increase this value by one.
/// Parent layout that all the field elements will be added to.
/// Serializable property referencing the object whose contents to display.
public InspectableObject(Inspector parent, string title, string path, int depth, InspectableFieldLayout layout,
SerializableProperty property)
: base(parent, title, path, SerializableProperty.FieldType.Object, depth, layout, property)
{
isExpanded = parent.Persistent.GetBool(path + "_Expanded");
}
///
public override GUILayoutX GetTitleLayout()
{
return guiTitleLayout;
}
///
public override InspectableState Refresh(int layoutIndex)
{
// Check if modified internally and rebuild if needed
object newPropertyValue = property.GetValue