├── BetterMultiview
├── BetterMultiview
│ ├── Assets
│ │ └── icon.ico
│ ├── ControlPad.axaml.cs
│ ├── Data
│ │ ├── Configuration.cs
│ │ ├── SceneMetadata.cs
│ │ ├── View
│ │ │ ├── ViewItem.cs
│ │ │ └── LiveViewItem.cs
│ │ └── Presets
│ │ │ ├── PresetBase.cs
│ │ │ ├── PresetScene.cs
│ │ │ ├── PresetFactory.cs
│ │ │ └── PresetSlot.cs
│ ├── App.axaml
│ ├── Extensions.cs
│ ├── ControlPad.axaml
│ ├── Dialogs
│ │ ├── Dialog.axaml
│ │ ├── ScenePresetSlot.axaml
│ │ ├── Dialog.axaml.cs
│ │ └── ScenePresetSlot.axaml.cs
│ ├── App.axaml.cs
│ ├── Parts
│ │ ├── Item.cs
│ │ └── DrawUtils.cs
│ ├── Multiview.axaml
│ ├── BetterMultiview - Backup.csproj
│ ├── BetterMultiview.csproj
│ ├── Controls
│ │ ├── PresetGroup.axaml
│ │ ├── PresetButton.axaml.cs
│ │ ├── PresetGroup.axaml.cs
│ │ └── PresetButton.axaml
│ ├── Plugin.cs
│ └── Multiview.axaml.cs
├── Directory.Build.props
├── BetterMultiview.Design
│ ├── BetterMultiview.Design.csproj
│ └── Program.cs
├── BetterMultiview.sln
└── .gitignore
├── .gitmodules
├── Readme.md
├── .gitignore
└── LICENSE.md
/BetterMultiview/BetterMultiview/Assets/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/CShark/obs-better-multiview/HEAD/BetterMultiview/BetterMultiview/Assets/icon.ico
--------------------------------------------------------------------------------
/BetterMultiview/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | enable
4 | 11.0.2
5 |
6 |
7 |
--------------------------------------------------------------------------------
/BetterMultiview/BetterMultiview/ControlPad.axaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Controls;
2 |
3 | namespace BetterMultiview {
4 | public partial class ControlPad : UserControl {
5 | public ControlPad() {
6 | InitializeComponent();
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "obs-websocket-dotnet"]
2 | path = obs-websocket-dotnet
3 | url = git@github.com:CShark/obs-websocket-dotnet.git
4 | [submodule "BetterMultiview/NetObsBindings"]
5 | path = BetterMultiview/NetObsBindings
6 | url = https://github.com/kostya9/NetObsBindings.git
7 | branch = main
8 |
--------------------------------------------------------------------------------
/BetterMultiview/BetterMultiview/Data/Configuration.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace BetterMultiview.Data {
8 | internal class Configuration {
9 | public uint Rows { get; set; }
10 | public uint Columns { get; set; }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Readme.md:
--------------------------------------------------------------------------------
1 | # Better Multiview
2 | An enhanced version of the OBS-Multiview with support for controlling more than just OBS. It allows arbitrary layouting your scenes in a custom grid and adding custom actions that will trigger when activating that scene.
3 |
4 | This project is archived because it is no longer needed. Switched to a Blackmagic Atem.
5 |
6 | ## Requirements
7 | OBS >= 27.0.0
8 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | #Ignore thumbnails created by Windows
3 | Thumbs.db
4 | #Ignore files built by Visual Studio
5 | *.obj
6 | *.exe
7 | *.pdb
8 | *.user
9 | *.aps
10 | *.pch
11 | *.vspscc
12 | *_i.c
13 | *_p.c
14 | *.ncb
15 | *.suo
16 | *.tlb
17 | *.tlh
18 | *.bak
19 | *.cache
20 | *.ilk
21 | *.log
22 | [Bb]in
23 | [Dd]ebug*/
24 | *.lib
25 | *.sbr
26 | obj/
27 | [Rr]elease*/
28 | _ReSharper*/
29 | [Tt]est[Rr]esult*
30 | .vs/
31 | #Nuget packages folder
32 | packages/
33 | *.zip
34 |
--------------------------------------------------------------------------------
/BetterMultiview/BetterMultiview/Data/SceneMetadata.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace BetterMultiview.Data {
8 | public class SceneMetadata {
9 | public Guid UUID { get; }
10 | public string Name { get; }
11 |
12 | public SceneMetadata(Guid uuid, string name) {
13 | UUID = uuid;
14 | Name = name;
15 | }
16 | }
17 | }
--------------------------------------------------------------------------------
/BetterMultiview/BetterMultiview.Design/BetterMultiview.Design.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net7.0
5 | enable
6 | enable
7 | WinExe
8 | BetterMultiview.Design.Program
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/BetterMultiview/BetterMultiview/Data/View/ViewItem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Avalonia;
7 | using BetterMultiview.Parts;
8 |
9 | namespace BetterMultiview.Data.View {
10 | public abstract class ViewItem {
11 | public Rect Position { get; set; }
12 |
13 | public abstract void Render();
14 |
15 | protected ViewItem(Rect position) {
16 | Position = position;
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/BetterMultiview/BetterMultiview.Design/Program.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using System.Reflection.PortableExecutable;
3 |
4 | namespace BetterMultiview.Design {
5 | class Program {
6 | [STAThread]
7 | public static void Main(string[] args) => BuildAvaloniaApp()
8 | .StartWithClassicDesktopLifetime(args);
9 |
10 | public static AppBuilder BuildAvaloniaApp()
11 | => AppBuilder.Configure()
12 | .UsePlatformDetect()
13 | .WithInterFont()
14 | .LogToTrace();
15 | }
16 | }
--------------------------------------------------------------------------------
/BetterMultiview/BetterMultiview/Data/View/LiveViewItem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Avalonia;
7 | using BetterMultiview.Parts;
8 | using ObsInterop;
9 |
10 | namespace BetterMultiview.Data.View {
11 | internal class LiveViewItem : ViewItem {
12 | public override void Render() {
13 | Obs.obs_render_main_texture();
14 | }
15 |
16 | public LiveViewItem(Rect position) : base(position) {
17 | }
18 | }
19 | }
--------------------------------------------------------------------------------
/BetterMultiview/BetterMultiview/App.axaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/BetterMultiview/BetterMultiview/Data/Presets/PresetBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Avalonia.Controls;
7 |
8 | namespace BetterMultiview.Data.Presets
9 | {
10 | public abstract class PresetBase
11 | {
12 | public int SlotId { get; set; }
13 |
14 | public string Title { get; set; }
15 |
16 | public string Tooltip { get; set; }
17 |
18 | public abstract UserControl CreateEditor();
19 |
20 | public abstract PresetBase Clone();
21 |
22 | protected void CloneInto(PresetBase target)
23 | {
24 | target.SlotId = SlotId;
25 | target.Title = Title;
26 | target.Tooltip = Tooltip;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/BetterMultiview/BetterMultiview/Data/Presets/PresetScene.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using Avalonia.Controls;
7 | using BetterMultiview.Dialogs;
8 |
9 | namespace BetterMultiview.Data.Presets
10 | {
11 | public class PresetScene : PresetBase
12 | {
13 | public string ObsSceneUUID { get; set; }
14 |
15 |
16 | public override UserControl CreateEditor()
17 | {
18 | return new ScenePresetSlot { PresetScene = this };
19 | }
20 |
21 | public override PresetScene Clone()
22 | {
23 | var clone = new PresetScene();
24 | CloneInto(clone);
25 | clone.ObsSceneUUID = ObsSceneUUID;
26 | return clone;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/BetterMultiview/BetterMultiview/Extensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Runtime.InteropServices;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using Avalonia.Data.Core.Plugins;
8 |
9 | namespace BetterMultiview {
10 | internal static class Extensions {
11 | public static sbyte[] GetBytes(this string self) {
12 | return Encoding.UTF8.GetBytes(self).Select(x => (sbyte)x).ToArray();
13 | }
14 |
15 | public static unsafe string GetString(sbyte* data) {
16 | var result = new StringBuilder();
17 |
18 | if (data != null) {
19 | while (*data != 0) {
20 | result.Append((char)*data);
21 | data++;
22 | }
23 | }
24 |
25 | return result.ToString();
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/BetterMultiview/BetterMultiview/ControlPad.axaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 | Control Pad
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/BetterMultiview/BetterMultiview/Dialogs/Dialog.axaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/BetterMultiview/BetterMultiview/App.axaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using Avalonia.Controls.ApplicationLifetimes;
3 | using Avalonia.Data.Core.Plugins;
4 | using Avalonia.Markup.Xaml;
5 | namespace BetterMultiview;
6 |
7 | public partial class App : Application
8 | {
9 | public override void Initialize()
10 | {
11 | AvaloniaXamlLoader.Load(this);
12 | }
13 |
14 | public override void OnFrameworkInitializationCompleted()
15 | {
16 | // Line below is needed to remove Avalonia data validation.
17 | // Without this line you will get duplicate validations from both Avalonia and CT
18 | BindingPlugins.DataValidators.RemoveAt(0);
19 |
20 | if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
21 | {
22 | desktop.MainWindow = new Multiview();
23 | }
24 | else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatform)
25 | {
26 | singleViewPlatform.MainView = new Multiview();
27 | }
28 |
29 | base.OnFrameworkInitializationCompleted();
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/BetterMultiview/BetterMultiview/Parts/Item.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Media;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using ObsInterop;
8 |
9 | namespace BetterMultiview.Parts
10 | {
11 | internal class Item {
12 | public uint Row { get; set; }
13 | public uint Column { get; set; }
14 | public uint RowSpan { get; set; } = 1;
15 | public uint ColSpan { get; set; } = 1;
16 |
17 | public unsafe void Render(uint x, uint y, uint width, uint height) {
18 | ObsGraphics.gs_matrix_push();
19 | ObsGraphics.gs_matrix_translate3f(x, y, 0);
20 |
21 | DrawUtils.DrawBox(width, height, Colors.Black);
22 |
23 | obs_video_info ovi = new obs_video_info();
24 | Obs.obs_get_video_info(&ovi);
25 |
26 | ObsGraphics.gs_matrix_scale3f((float)width / ovi.base_width, (float)height / ovi.base_height, 1);
27 |
28 | Obs.obs_render_main_texture();
29 |
30 | ObsGraphics.gs_matrix_pop();
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/BetterMultiview/BetterMultiview/Data/Presets/PresetFactory.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using BetterMultiview.Data.Presets;
7 |
8 | namespace BetterMultiview.Data.Presets
9 | {
10 | internal static class PresetFactory
11 | {
12 | private static Dictionary> _generators = new();
13 |
14 | public static void RegisterPreset() where T : PresetBase, new()
15 | {
16 | _generators[typeof(T).Name] = () => new T();
17 | }
18 |
19 | public static bool PresetRegistered(string type)
20 | {
21 | return _generators.ContainsKey(type);
22 | }
23 |
24 | public static PresetBase CreateInstance(string type)
25 | {
26 | if (_generators.ContainsKey(type))
27 | {
28 | return _generators[type]();
29 | }
30 | else
31 | {
32 | throw new ArgumentException($"Type {type} not registered");
33 | }
34 | }
35 | }
36 | }
--------------------------------------------------------------------------------
/BetterMultiview/BetterMultiview/Multiview.axaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/BetterMultiview/BetterMultiview/BetterMultiview - Backup.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net7.0
4 | enable
5 | latest
6 | True
7 | true
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 | PresetButton.axaml
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/BetterMultiview/BetterMultiview/BetterMultiview.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net7.0
4 | enable
5 | latest
6 | True
7 | true
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | PresetButton.axaml
34 |
35 |
36 |
37 |
--------------------------------------------------------------------------------
/BetterMultiview/BetterMultiview/Dialogs/ScenePresetSlot.axaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
14 |
17 |
18 |
21 | OBS Scene:
22 |
24 |
25 | Display Text:
26 |
27 |
28 |
--------------------------------------------------------------------------------
/BetterMultiview/BetterMultiview/Parts/DrawUtils.cs:
--------------------------------------------------------------------------------
1 | using Avalonia.Media;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Numerics;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 | using Avalonia;
9 | using BetterMultiview.Data;
10 | using ObsInterop;
11 | using Effect = Avalonia.Media.Effect;
12 |
13 | namespace BetterMultiview.Parts
14 | {
15 | internal static unsafe class DrawUtils {
16 | public static void DrawBox(Rect rect, Color color) {
17 | DrawBox((uint)rect.X, (uint)rect.Y, (uint)rect.Width, (uint)rect.Height, color);
18 | }
19 |
20 | public static void DrawBox(uint width, uint height, Color color) {
21 | if (width > 0 && height > 0) {
22 | gs_effect* effect = Obs.obs_get_base_effect(obs_base_effect.OBS_EFFECT_SOLID);
23 | gs_effect_param* param;
24 | var text = Encoding.UTF8.GetBytes("color").Select(x => (sbyte)x).ToArray();
25 | fixed (sbyte* textPtr = text) {
26 | param = ObsGraphics.gs_effect_get_param_by_name(effect, textPtr);
27 | }
28 |
29 | ObsGraphics.gs_effect_set_color(param, color.ToUInt32());
30 | fixed (sbyte* textPtr = "Solid".GetBytes()) {
31 | while (ObsGraphics.gs_effect_loop(effect, textPtr) != 0) {
32 | ObsGraphics.gs_draw_sprite(null, 0, width, height);
33 | }
34 | }
35 | }
36 | }
37 |
38 | public static void DrawBox(uint x, uint y, uint width, uint height, Color color) {
39 | ObsGraphics.gs_matrix_push();
40 | ObsGraphics.gs_matrix_translate3f(x, y, 0);
41 | DrawBox(width, height, color);
42 | ObsGraphics.gs_matrix_pop();
43 | }
44 | }
45 | }
--------------------------------------------------------------------------------
/BetterMultiview/BetterMultiview/Dialogs/Dialog.axaml.cs:
--------------------------------------------------------------------------------
1 | using Avalonia;
2 | using Avalonia.Controls;
3 | using Avalonia.Interactivity;
4 | using Avalonia.Markup.Xaml.Templates;
5 | using System.Threading.Tasks;
6 |
7 | namespace BetterMultiview.Dialogs {
8 | public partial class Dialog : Window {
9 | public static readonly StyledProperty