Class InspectorFieldBaseAbstract Public Self

The InspectorFieldBase displays UI elements for a single InspectableProperty. This is a base class that should be specialized for all supported types contained by InspectableProperty. Inspectable fields can and should be created recursively - normally complex types like objects and arrays will contain fields of their own, while primitive types like integer or boolean will consist of only a UI element.

Hierarchy (view full)

Constructors

  • Creates a new inspectable field UI for the specified property.

    Parameters

    • context: InspectorContext

      Context shared by all inspectable fields created by the same parent.

    • title: string

      Name of the property, or some other value to set as the title.

    • path: string

      Full path to this property (includes name of this property and all parent properties).

    • type: EnumValue<InspectablePropertyType, number>

      Type of property this field will be used for displaying.

    • depth: number

      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.

    • layout: InspectorFormLayoutSection

      Parent layout that all the field elements will be added to.

    • property: InspectableProperty

      Serializable property referencing the array whose contents to display.

    Returns InspectorFieldBase

Properties

_active: boolean
_depth: number
_disabled: boolean
_formLayoutSection: InspectorFormLayoutSection
_isReadOnly: boolean
_name: string
_path: string
_propertyType: EnumValue<InspectablePropertyType, number>
_title: string
endUndo: (() => void)

Finishes recording an undo command started via startUndoForPath. If any changes are detected on the field an undo command is recorded onto the undo-redo stack, otherwise nothing is done.

startUndo: (() => void)

Zero parameter wrapper for startUndoForPath

startUndoForPath: ((subPath?: string) => void)

Notifies the system to start recording a new undo command. Any changes to the field after this is called will be recorded in the command. User must call endUndo after field is done being changed.

Type declaration

    • (subPath?): void
    • Parameters

      • OptionalsubPath: string

        Optional path to append to the end of the current field path.

      Returns void

Accessors

  • get depth(): number
  • Gets the depth of the field.

    Returns number

  • get isActive(): boolean
  • Activates or deactivates the underlying UI elements.

    Returns boolean

  • set isActive(value): void
  • Parameters

    • value: boolean

    Returns void

  • get isDisabled(): boolean
  • Disables or enables the underlying UI elements. Disabled elements cannot be interacted with and have a faded out appearance.

    Returns boolean

  • set isDisabled(value): void
  • Parameters

    • value: boolean

    Returns void

  • get isFocused(): boolean
  • Determines if the field is in focused state.

    Returns boolean

  • get isReadOnly(): boolean
  • Disables or enables the underlying UI elements. Disabled elements cannot be interacted with and have a faded out appearance.

    Returns boolean

  • set isReadOnly(value): void
  • Parameters

    • value: boolean

    Returns void

  • get name(): string
  • Name portion of the field path.

    Returns string

  • get path(): string
  • Returns the path to the field.

    Returns string

Methods

  • Virtual

    Destroys all UI elements in the inspectable field.

    Returns void

  • Virtual

    Searches for a child field with the specified path.

    Parameters

    • path: string

      Path relative to the current field. Path entries are field names separated with /. Fields within categories are placed within a special category group, surrounded by []. Examples: - myField - myObject/myField - myObject/[myCategory]/myField

    Returns InspectorFieldBase

    Matching field if one is found, null otherwise.

  • Virtual

    Initializes the UI elements for the field.

    Returns any

  • Virtual

    Notifies the owning inspector that it needs to be refreshed on the next update loop.

    Returns void

  • Virtual

    Activates or deactivates the underlying UI elements.

    Parameters

    • active: boolean

    Returns void

  • Virtual

    Disables or enables the underlying UI elements. Disabled elements cannot be interacted with and have a faded out appearance.

    Parameters

    • disabled: boolean

    Returns void

  • Virtual

    Moves keyboard focus to this field.

    Parameters

    • OptionalsubFieldName: string

      Name of the sub-field to focus on. Only relevant if the inspectable field represents multiple UI input elements.

    Returns void

  • Virtual

    Set the element read only.

    Parameters

    • readOnly: boolean

      The new read only value

    Returns void

  • Assigns the field value to the underlying property and creates an undo operation.

    Type Parameters

    • T

    Parameters

    Returns void

  • Creates a new inspectable field, automatically detecting the most appropriate implementation for the type contained in the provided serializable property. This may be one of the built-in inspectable field implemetations (like ones for primitives like int or bool), or a user defined implementation defined with a CustomInspectorAttribute attribute.

    Parameters

    • context: InspectorContext

      Context shared by all inspectable fields created by the same parent.

    • title: string

      Name of the property, or some other value to set as the title.

    • path: string

      Full path to this property (includes name of this property and all parent properties).

    • layoutIndex: number

      Index into the parent layout at which to insert the UI elements for the field .

    • depth: number

      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.

    • layout: InspectorFormLayoutSection

      Parent layout that all the field elements will be added to.

    • property: InspectableProperty

      Serializable property referencing the array whose contents to display.

    • Optionalparent: InspectorFieldContainer
    • OptionalfnGetParentFieldConditionals: (() => InspectorFieldConditionalInfo[])

    Returns InspectorFieldBase

    Inspectable field that can be used for displaying the UI for an InspectableProperty of the provided type.

  • Searches for a field with the specified path.

    Parameters

    • path: string

      Path to search for. Path entries are readable field names separated with /. Fields within categories are placed within a special category group, surrounded by []. Examples: - myField - myObject/myField - myObject/[myCategory]/myField

    • depth: number

      Path depth at which the provided set of fields is at.

    • fields: InspectorFieldBase[]

      List of fields to search. Children will be searched recursively.

    Returns InspectorFieldBase

    Matching field if one is found, null otherwise.

  • Returns the top-most part of the provided field path. See findPath2 for more information about paths.

    Parameters

    • path: string

      Path to return the sub-path of.

    • count: number

      Number of path elements to retrieve.

    Returns string

    First count elements of the path.

  • A helper function that takes a state by reference. If the state has InspectableState.Modified set, the state is set to InspectableState.NotModified. Returns an object of the oldState (before modifying it) and the newState that should be set on the field.

    This method should usually be used as such:

    Parameters

    Returns {
        newState: EnumValue<InspectableState, number>;
        oldState: EnumValue<InspectableState, number>;
    }

    An object of the old state of the field and the new state that it should be set to.

    const [oldState, newState] = InspectorField.updateState(this._state);
    this._state = newState;
    return oldState;