Skip to content

Desuq Cafe

文档菜单

此翻译可能落后于最新的英文版本。 查看英文版

Editor Subsystem

UInhyeongOBSEditorSubsystem 让你在不进入运行模式的情况下,从编辑器代码控制 OBS(包括连接、切换场景、录制以及读取状态)。它镜像了运行时 Subsystem 的处理器访问方式,因此相同的域处理器(场景、音频、输出等)可在编辑器工具中使用。

如需对相同操作进行点选式控制,请改用自定义的 Details Panels

访问 Subsystem

UInhyeongOBSEditorSubsystem* EditorOBS = GEditor->GetEditorSubsystem<UInhyeongOBSEditorSubsystem>();

连接

EditorOBS->Connect("localhost", 4455, "password");
EditorOBS->Disconnect();
EditorOBS->IsConnected();
EditorOBS->GetConnectionState();

Editor Subsystem 会创建一次客户端并在重连期间保持其存活,因此针对它所做的绑定保持稳定。

处理器访问

处理器访问方式与运行时 Subsystem 相同:

EditorOBS->GetOutputs();
EditorOBS->GetScenes();
EditorOBS->GetMediaInputs();
EditorOBS->GetAudio();         // Audio inputs, volume, mute
EditorOBS->GetInputSettings(); // Source settings (text, browser, image, etc.)
EditorOBS->GetStudioMode();
EditorOBS->GetConfig();
EditorOBS->GetTransitions();
EditorOBS->GetScreenshots();
EditorOBS->GetFilters();

直接控制

EditorOBS->SetCurrentScene("MyScene");
EditorOBS->StartRecord();
EditorOBS->SaveReplayBuffer();
EditorOBS->SetInputMute("Mic/Aux", true);
EditorOBS->AdjustInputVolume("Desktop Audio", -3.0f);

Studio Mode

EditorOBS->SetStudioModeEnabled(true);
EditorOBS->IsStudioModeEnabled();
EditorOBS->SetCurrentPreviewScene("Preview Scene");
EditorOBS->GetPreviewSceneName();
EditorOBS->TriggerStudioModeTransition();

配置:场景集合

EditorOBS->GetSceneCollectionList();
EditorOBS->SetCurrentSceneCollection("My Collection");
EditorOBS->CreateSceneCollection("New Collection");
EditorOBS->GetCachedSceneCollections();
EditorOBS->GetCurrentSceneCollectionName();

配置:配置文件

EditorOBS->GetProfileList();
EditorOBS->SetCurrentProfile("Streaming");
EditorOBS->CreateProfile("New Profile");
EditorOBS->RemoveProfile("Old Profile");
EditorOBS->GetCachedProfiles();
EditorOBS->GetCurrentProfileName();

配置:视频设置

EditorOBS->GetVideoSettings();
EditorOBS->SetVideoSettings(Settings);
EditorOBS->SetBaseResolution(1920, 1080);
EditorOBS->SetOutputResolution(1280, 720);
EditorOBS->SetFPS(60, 1);
EditorOBS->GetCachedVideoSettings();

配置:推流服务设置

EditorOBS->GetConfig()->GetStreamServiceSettings();
EditorOBS->GetConfig()->SetStreamServiceSettings(Settings);
EditorOBS->GetConfig()->SetSimpleRTMPSettings("rtmp://server.com/live", "stream-key");
EditorOBS->GetConfig()->GetCachedStreamServiceSettings();

转场

EditorOBS->GetSceneTransitionList();
EditorOBS->GetCurrentSceneTransition();
EditorOBS->SetCurrentSceneTransition("Fade");
EditorOBS->SetCurrentSceneTransitionDuration(500);
EditorOBS->GetCurrentTransitionName();
EditorOBS->GetCurrentTransitionDuration();
EditorOBS->IsTransitionActive();

事件

EditorOBS->OnConnected.AddDynamic(...);
EditorOBS->OnRecordStateChanged.AddDynamic(...);