Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions Assets/Prefabs/Menu/Settings/Visuals/IPv4Setting.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -165,17 +165,6 @@ RectTransform:
m_CorrespondingSourceObject: {fileID: 7665614177142481491, guid: 8f25b12de267d7544aa2ff7993247fcd, type: 3}
m_PrefabInstance: {fileID: 6609846725191865157}
m_PrefabAsset: {fileID: 0}
--- !u!114 &4376046301004112940 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 7421987709479303017, guid: 8f25b12de267d7544aa2ff7993247fcd, type: 3}
m_PrefabInstance: {fileID: 6609846725191865157}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &8095148824242519626
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -288,6 +277,17 @@ RectTransform:
m_CorrespondingSourceObject: {fileID: 8331225728328382101, guid: 6f46741e648c07044852bd3391146600, type: 3}
m_PrefabInstance: {fileID: 8095148824242519626}
m_PrefabAsset: {fileID: 0}
--- !u!114 &3424729177075475668 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 6904207334484646558, guid: 6f46741e648c07044852bd3391146600, type: 3}
m_PrefabInstance: {fileID: 8095148824242519626}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &3786693973871400430 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 4961476867242781604, guid: 6f46741e648c07044852bd3391146600, type: 3}
Expand All @@ -310,7 +310,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: a836d42a330f95f409ae40738d33f68c, type: 3}
m_Name:
m_EditorClassIdentifier:
_settingLabel: {fileID: 4376046301004112940}
_settingLabel: {fileID: 3424729177075475668}
_evenBackground: {fileID: 3786693973871400430}
_advancedMarker: {fileID: 9042856458688905155}
_inputField: {fileID: 1887982916101165759}
Expand Down
10 changes: 7 additions & 3 deletions Assets/Script/Integration/Sacn/SacnHardware.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Net;
using Haukcode.sACN;
using UnityEngine;
using YARG.Core.Logging;
Expand Down Expand Up @@ -37,9 +38,12 @@ public void HandleEnabledChanged(bool isEnabled)
{
if (_sendClient != null) return;

var IPAddress = SACNCommon.GetFirstBindAddress().IPAddress;
string configuredAddress = SettingsManager.Settings.DMXLocalIP.Value;
IPAddress ipAddress = string.IsNullOrEmpty(configuredAddress)
? SACNCommon.GetFirstBindAddress().IPAddress
: IPAddress.Parse(configuredAddress);

if (IPAddress == null)
if (ipAddress == null)
{
if (!_toastShown)
{
Expand All @@ -56,7 +60,7 @@ public void HandleEnabledChanged(bool isEnabled)
SacnInterpreter.OnChannelSet += HandleChannelEvent;

_sendClient = new SACNClient(senderId: _acnSourceId, senderName: ACN_SOURCE_NAME,
localAddress: IPAddress);
localAddress: ipAddress);

_timer = 0f;
}
Expand Down
6 changes: 5 additions & 1 deletion Assets/Script/Menu/Settings/Visuals/IPv4SettingVisual.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ public void OnTextFieldChange()
{
try
{
if (IPAddress.TryParse(_inputField.text, out var ipAddress))
if (Setting.AllowEmpty && string.IsNullOrEmpty(_inputField.text))
{
Setting.Value = string.Empty;
}
else if (IPAddress.TryParse(_inputField.text, out var ipAddress))
{
if (IPv4Setting.IsValidIPv4(ipAddress))
{
Expand Down
2 changes: 2 additions & 0 deletions Assets/Script/Settings/SettingsManager.Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,8 @@ public void OpenExecutablePath()

public IntSetting DMXKeysChannel { get; } = new(32, 1, 512, v => SacnInterpreter.Instance.KeysChannel = v);

public IPv4Setting DMXLocalIP { get; } = new("", allowEmpty: true);

public IntSetting DMXUniverseChannel { get; } = new(1, 1, 65535);

public IntSetting DMXTargetFPS { get; } = new(44, 10, 60);
Expand Down
1 change: 1 addition & 0 deletions Assets/Script/Settings/SettingsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ public static partial class SettingsManager
nameof(Settings.DMXBassChannel),
nameof(Settings.DMXKeysChannel),
new HeaderMetadata("AdvancedDMXSettings"),
nameof(Settings.DMXLocalIP),
nameof(Settings.DMXUniverseChannel),
nameof(Settings.DMXDimmerValues),
nameof(Settings.DMXTargetFPS),
Expand Down
17 changes: 14 additions & 3 deletions Assets/Script/Settings/Types/IPv4Setting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,28 @@ public class IPv4Setting : AbstractSetting<string>
{
public override string AddressableName => "Setting/IPv4";

public IPv4Setting(string value, Action<string> onChange = null) : base(onChange)
private readonly string _defaultValue;

public bool AllowEmpty { get; }

public IPv4Setting(string value, Action<string> onChange = null, bool allowEmpty = false) : base(onChange)
{
_defaultValue = value;
AllowEmpty = allowEmpty;
_value = value;
}

protected override void SetValue(string value)
{
if (AllowEmpty && string.IsNullOrEmpty(value))
{
_value = string.Empty;
return;
}

if (!IsValidIPv4(value))
{
// If it's invalid, just default to this
_value = "255.255.255.255";
_value = _defaultValue;
}
else
{
Expand Down
4 changes: 4 additions & 0 deletions Assets/StreamingAssets/lang/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -1709,6 +1709,10 @@
"Name": "DMX Broadcast Universe",
"Description": "This is the universe that YARG will send the sACN packet to. Default is \"1\". Maximum is \"65535\"."
},
"DMXLocalIP": {
"Name": "sACN Local IP",
"Description": "The local IPv4 address used to send sACN packets. Leave blank to automatically select the first available Ethernet or Wi-Fi address."
},
"ReconnectProfiles": {
"Name": "Reconnect Profiles",
"Description": "At startup, reconnect previously connected profiles."
Expand Down