
using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
using System;
using Godot;


namespace Rokojori
{  
  [Tool]
  [GlobalClass]
  public partial class SetActiveCamera:CameraSlotSelector
  {
    [Export]
    public VirtualCamera3D virtualCamera;

    [ExportGroup( "Create Slot")]
    [Export]
    public bool createSlotIfNotPresent = true;

    [Export]
    public SelectorFlag[] slotFlags;

    public override VirtualCamera3DSlot GetCameraSlot()
    {
      var vm = VirtualCamera3DManager.Get();
      var slot = vm.GetSlot( virtualCamera );

      if ( slot == null )
      {
        slot = vm.CreateChild<VirtualCamera3DSlot>();
        slot.camera = virtualCamera;
        slot.flags = slotFlags;
        
        vm.RefreshSlots( true );
      }

      return slot;
    }

  }
}