rj-action-library/Runtime/Cameras/CameraSlotSelectors/SetActiveCamera.cs

43 lines
792 B
C#
Raw Permalink Normal View History

using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
using System;
using Godot;
namespace Rokojori
{
[Tool]
[GlobalClass]
public partial class SetActiveCamera:CameraSlotSelector
{
[Export]
2025-08-31 06:05:39 +00:00
public VirtualCamera virtualCamera;
2025-06-12 09:03:02 +00:00
[ExportGroup( "Create Slot")]
[Export]
public bool createSlotIfNotPresent = true;
2025-06-12 09:03:02 +00:00
[Export]
public SelectorFlag[] slotFlags;
2025-08-31 06:05:39 +00:00
public override CameraSlot GetCameraSlot()
{
2025-08-31 06:05:39 +00:00
var vm = CameraManager.Get();
var slot = vm.GetSlot( virtualCamera );
if ( slot == null )
{
2025-08-31 06:05:39 +00:00
slot = vm.CreateChild<CameraSlot>();
slot.camera = virtualCamera;
2025-06-12 09:03:02 +00:00
slot.flags = slotFlags;
2025-06-19 17:22:25 +00:00
vm.RefreshSlots( true );
}
return slot;
}
}
}