// SPDX-FileCopyrightText: 2023 Unity Technologies and the glTFast authors
// SPDX-License-Identifier: Apache-2.0
using System;
using System.Collections.Generic;
using UnityEngine;
#if UNITY_ANIMATION
using UnityEngine.Playables;
#endif
namespace GLTFast
{
///
/// Descriptor of a glTF scene instance
///
public class GameObjectSceneInstance
{
///
/// List of instantiated cameras
///
public IReadOnlyList Cameras => m_Cameras;
///
/// List of instantiated lights
///
public IReadOnlyList Lights => m_Lights;
///
/// Enables controlling and applying materials variants.
///
public MaterialsVariantsControl MaterialsVariantsControl { get; private set; }
#if UNITY_ANIMATION
///
/// component. Is null if scene has no
/// animation clips.
/// Only available if the built-in Animation module is enabled.
///
public Animation LegacyAnimation { get; private set; }
///
/// Playables support has been removed since
/// it was not usable in builds. Use LegacyAnimation instead.
/// See: UseCaseCustomPlayablesAnimation
///
[Obsolete("Playables support has been removed since it was not usable in builds. Use LegacyAnimation instead. " +
"See: UseCaseCustomPlayablesAnimation")]
public Playable? Playable { get; internal set; }
#endif
List m_Cameras;
List m_Lights;
///
/// Adds a camera
///
/// Camera to be added
internal void AddCamera(Camera camera)
{
if (m_Cameras == null)
{
m_Cameras = new List();
}
m_Cameras.Add(camera);
}
internal void AddLight(Light light)
{
if (m_Lights == null)
{
m_Lights = new List();
}
m_Lights.Add(light);
}
internal void SetMaterialsVariantsControl(MaterialsVariantsControl control)
{
MaterialsVariantsControl = control;
}
#if UNITY_ANIMATION
internal void SetLegacyAnimation(Animation animation) {
LegacyAnimation = animation;
}
#endif
}
}