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

43 lines
821 B
C#
Raw 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]
public VirtualCamera3D 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;
public override VirtualCamera3DSlot GetCameraSlot()
{
var vm = VirtualCamera3DManager.Get();
var slot = vm.GetSlot( virtualCamera );
if ( slot == null )
{
slot = vm.CreateChild<VirtualCamera3DSlot>();
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;
}
}
}