some breaking changes, mostly style stuff

This commit is contained in:
Cassandra de la Cruz-Munoz 2023-08-17 14:48:26 -04:00
parent 8923bd3f25
commit f3fac167e1
27 changed files with 510 additions and 524 deletions

View File

@ -18,17 +18,17 @@
using Godot;
using godotOscSharp;
using System.Collections.Generic;
namespace godotVmcSharp
{
public class VmcExtBlendVal : VmcMessage
{
public string name { get; }
public float value { get; }
public VmcExtBlendVal(godotOscSharp.OscMessage m) : base(m.Address)
public string Name { get; }
public float Value { get; }
public VmcExtBlendVal(OscMessage m) : base(m.Address)
{
if (m.Data.Count != 2) {
if (m.Data.Count != 2)
{
GD.Print($"Invalid number of arguments for /VMC/Ext/Blend/Val. Expected 2, received {m.Data.Count}.");
return;
}
@ -43,65 +43,65 @@ namespace godotVmcSharp
return;
}
var blendShape = (string)m.Data[0].Value;
if (isVrm0BlendShape(blendShape))
if (IsVrm0BlendShape(blendShape))
{
name = blendShape;
value = (float)m.Data[1].Value;
Name = blendShape;
Value = (float)m.Data[1].Value;
return;
}
if (isVrm1Expression(blendShape))
if (IsVrm1Expression(blendShape))
{
name = blendShape;
value = (float)m.Data[1].Value;
Name = blendShape;
Value = (float)m.Data[1].Value;
return;
}
if (isArkitBlendShape(blendShape))
if (IsArkitBlendShape(blendShape))
{
name = blendShape;
value = (float)m.Data[1].Value;
Name = blendShape;
Value = (float)m.Data[1].Value;
return;
}
GD.Print($"Invalid argument for {addr}. BlendShape \"{blendShape}\" not in list.");
}
public VmcExtBlendVal(string _name, float _value) : base(new godotOscSharp.Address("VMC/Ext/Blend/Val"))
public VmcExtBlendVal(string name, float value) : base(new OscAddress("VMC/Ext/Blend/Val"))
{
if (isVrm0BlendShape(_name))
if (IsVrm0BlendShape(name))
{
name = _name;
value = _value;
Name = name;
Value = value;
return;
}
if (isVrm1Expression(_name))
if (IsVrm1Expression(name))
{
name = _name;
value = _value;
Name = name;
Value = value;
return;
}
if (isArkitBlendShape(_name))
if (IsArkitBlendShape(name))
{
name = _name;
value = _value;
Name = name;
Value = value;
return;
}
GD.Print($"Invalid argument for {addr}. BlendShape \"{_name}\" not in list.");
GD.Print($"Invalid argument for {addr}. BlendShape \"{name}\" not in list.");
}
private bool isVrm0BlendShape(string name)
private bool IsVrm0BlendShape(string name)
{
return name == "Joy" || name == "Angry" || name == "Sorrow" || name == "Fun" ||
name == "A" || name == "I" || name == "U" || name == "E" || name == "O" ||
name == "Blink_L" || name == "Blink_R";
}
private bool isVrm1Expression(string name)
private bool IsVrm1Expression(string name)
{
return name == "happy" || name == "angry" || name == "sad" || name == "relaxed" ||
name == "aa" || name == "ih" || name == "ou" || name == "ee" || name == "oh" ||
name == "blinkLeft" || name == "blinkRight";
}
private bool isArkitBlendShape(string name)
private bool IsArkitBlendShape(string name)
{
return name == "browInnerUp" ||
name == "browDownLeft" || name == "browDownRight" ||
@ -132,9 +132,12 @@ namespace godotVmcSharp
name == "mouthStretchLeft" || name == "mouthStretchRight" ||
name == "tongueOut";
}
public godotOscSharp.OscMessage ToMessage()
public new OscMessage ToMessage()
{
return new godotOscSharp.OscMessage(addr, new List<godotOscSharp.OscArgument>{new godotOscSharp.OscArgument(name, 's'), new godotOscSharp.OscArgument(value, 'f')});
return new OscMessage(addr, new System.Collections.Generic.List<OscArgument> {
new OscArgument(Name, 's'),
new OscArgument(Value, 'f')
});
}
}
}

View File

@ -18,16 +18,15 @@
using Godot;
using godotOscSharp;
using System.Collections.Generic;
namespace godotVmcSharp
{
public class VmcExtBonePos : VmcMessage
{
public string name { get; }
public Godot.Transform3D transform { get; }
public string Name { get; }
public Transform3D Transform { get; }
public VmcExtBonePos(godotOscSharp.OscMessage m) : base(m.Address)
public VmcExtBonePos(OscMessage m) : base(m.Address)
{
if (m.Data.Count != 8)
{
@ -74,28 +73,28 @@ namespace godotVmcSharp
GD.Print(InvalidArgumentType.GetErrorString(addr, "q.w", 'f', m.Data[7].Type));
return;
}
name = (string)m.Data[0].Value;
transform = new Godot.Transform3D(new Godot.Basis(new Godot.Quaternion((float)m.Data[4].Value, (float)m.Data[5].Value, (float)m.Data[6].Value, (float)m.Data[7].Value)), new Godot.Vector3((float)m.Data[1].Value, (float)m.Data[2].Value, (float)m.Data[3].Value));
Name = (string)m.Data[0].Value;
Transform = new Transform3D(new Basis(new Quaternion((float)m.Data[4].Value, (float)m.Data[5].Value, (float)m.Data[6].Value, (float)m.Data[7].Value)), new Vector3((float)m.Data[1].Value, (float)m.Data[2].Value, (float)m.Data[3].Value));
}
public VmcExtBonePos(string _name, Godot.Transform3D _transform) : base(new godotOscSharp.Address("/VMC/Ext/Bone/Pos"))
public VmcExtBonePos(string name, Transform3D transform) : base(new OscAddress("/VMC/Ext/Bone/Pos"))
{
name = _name;
transform = _transform;
Name = name;
Transform = transform;
}
public godotOscSharp.OscMessage ToMessage()
public new OscMessage ToMessage()
{
var quat = transform.Basis.GetRotationQuaternion();
return new godotOscSharp.OscMessage(addr, new List<godotOscSharp.OscArgument>{
new godotOscSharp.OscArgument(name, 's'),
new godotOscSharp.OscArgument(transform.Origin.X, 'f'),
new godotOscSharp.OscArgument(transform.Origin.Y, 'f'),
new godotOscSharp.OscArgument(transform.Origin.Z, 'f'),
new godotOscSharp.OscArgument(quat.X, 'f'),
new godotOscSharp.OscArgument(quat.Y, 'f'),
new godotOscSharp.OscArgument(quat.Z, 'f'),
new godotOscSharp.OscArgument(quat.W, 'f'),
var quat = Transform.Basis.GetRotationQuaternion();
return new OscMessage(addr, new System.Collections.Generic.List<OscArgument>{
new OscArgument(Name, 's'),
new OscArgument(Transform.Origin.X, 'f'),
new OscArgument(Transform.Origin.Y, 'f'),
new OscArgument(Transform.Origin.Z, 'f'),
new OscArgument(quat.X, 'f'),
new OscArgument(quat.Y, 'f'),
new OscArgument(quat.Z, 'f'),
new OscArgument(quat.W, 'f'),
});
}
}

View File

@ -17,6 +17,7 @@
*/
using Godot;
using godotOscSharp;
namespace godotVmcSharp
{
@ -27,7 +28,7 @@ namespace godotVmcSharp
public Transform3D Transform { get; }
public float Fov { get; }
public VmcExtCam(godotOscSharp.OscMessage m) : base(m.Address)
public VmcExtCam(OscMessage m) : base(m.Address)
{
if (m.Data.Count != 9)
{
@ -80,30 +81,30 @@ namespace godotVmcSharp
return;
}
Name = (string)m.Data[0].Value;
Transform = new Godot.Transform3D(new Godot.Basis(new Godot.Quaternion((float)m.Data[4].Value, (float)m.Data[5].Value, (float)m.Data[6].Value, (float)m.Data[7].Value)), new Godot.Vector3((float)m.Data[1].Value, (float)m.Data[2].Value, (float)m.Data[3].Value));
Transform = new Transform3D(new Basis(new Quaternion((float)m.Data[4].Value, (float)m.Data[5].Value, (float)m.Data[6].Value, (float)m.Data[7].Value)), new Vector3((float)m.Data[1].Value, (float)m.Data[2].Value, (float)m.Data[3].Value));
Fov = (float)m.Data[8].Value;
}
public VmcExtCam(string name, Transform3D transform, float fov) : base(new godotOscSharp.Address("/VMC/Ext/Cam"))
public VmcExtCam(string name, Transform3D transform, float fov) : base(new OscAddress("/VMC/Ext/Cam"))
{
Name = name;
Transform = transform;
Fov = fov;
}
public new godotOscSharp.OscMessage ToMessage()
public new OscMessage ToMessage()
{
var quat = Transform.Basis.GetRotationQuaternion();
return new godotOscSharp.OscMessage(addr, new System.Collections.Generic.List<godotOscSharp.OscArgument>{
new godotOscSharp.OscArgument(Name, 's'),
new godotOscSharp.OscArgument(Transform.Origin.X, 'f'),
new godotOscSharp.OscArgument(Transform.Origin.Y, 'f'),
new godotOscSharp.OscArgument(Transform.Origin.Z, 'f'),
new godotOscSharp.OscArgument(quat.X, 'f'),
new godotOscSharp.OscArgument(quat.Y, 'f'),
new godotOscSharp.OscArgument(quat.Z, 'f'),
new godotOscSharp.OscArgument(quat.W, 'f'),
new godotOscSharp.OscArgument(Fov, 'f')
return new OscMessage(addr, new System.Collections.Generic.List<OscArgument>{
new OscArgument(Name, 's'),
new OscArgument(Transform.Origin.X, 'f'),
new OscArgument(Transform.Origin.Y, 'f'),
new OscArgument(Transform.Origin.Z, 'f'),
new OscArgument(quat.X, 'f'),
new OscArgument(quat.Y, 'f'),
new OscArgument(quat.Z, 'f'),
new OscArgument(quat.W, 'f'),
new OscArgument(Fov, 'f')
});
}
}

View File

@ -18,20 +18,19 @@
using Godot;
using godotOscSharp;
using System.Collections.Generic;
namespace godotVmcSharp
{
public class VmcExtCon : VmcMessage
{
public int active { get; }
public string name { get; }
public int isLeft { get; }
public int isTouch { get; }
public int isAxis { get; }
public Godot.Vector3 axis { get; }
public VmcExtCon(godotOscSharp.OscMessage m) : base(m.Address)
public int Active { get; }
public string Name { get; }
public int IsLeft { get; }
public int IsTouch { get; }
public int IsAxis { get; }
public Vector3 Axis { get; }
public VmcExtCon(OscMessage m) : base(m.Address)
{
if (m.Data.Count != 8)
{
@ -77,40 +76,40 @@ namespace godotVmcSharp
GD.Print($"Invalid value for \"active\" 'i' argument of /VMC/Ext/Con. Expected 0-2, received {(int)m.Data[0].Value}");
return;
}
active = (int)m.Data[0].Value;
name = (string)m.Data[1].Value;
isLeft = (int)m.Data[2].Value;
isTouch = (int)m.Data[3].Value;
isAxis = (int)m.Data[4].Value;
axis = new Godot.Vector3((float)m.Data[5].Value, (float)m.Data[6].Value, (float)m.Data[7].Value);
Active = (int)m.Data[0].Value;
Name = (string)m.Data[1].Value;
IsLeft = (int)m.Data[2].Value;
IsTouch = (int)m.Data[3].Value;
IsAxis = (int)m.Data[4].Value;
Axis = new Vector3((float)m.Data[5].Value, (float)m.Data[6].Value, (float)m.Data[7].Value);
}
public VmcExtCon(int _active, string _name, int _isLeft, int _isTouch, int _isAxis, Godot.Vector3 _axis): base(new godotOscSharp.Address("/VMC/Ext/Con"))
public VmcExtCon(int active, string name, int isLeft, int isTouch, int isAxis, Vector3 axis) : base(new OscAddress("/VMC/Ext/Con"))
{
if (_active < 0 || _active > 2)
if (active < 0 || active > 2)
{
GD.Print($"Invalid value for \"active\" 'i' argument of {addr}. Expected 0-2, received {_active}");
GD.Print($"Invalid value for \"active\" 'i' argument of {addr}. Expected 0-2, received {active}");
return;
}
active = _active;
name = _name;
isLeft = _isLeft;
isTouch = _isTouch;
isAxis = _isAxis;
axis = _axis;
Active = active;
Name = name;
IsLeft = isLeft;
IsTouch = isTouch;
IsAxis = isAxis;
Axis = axis;
}
public godotOscSharp.OscMessage ToMessage()
public new OscMessage ToMessage()
{
return new godotOscSharp.OscMessage(addr, new List<godotOscSharp.OscArgument>{
new godotOscSharp.OscArgument(active, 'i'),
new godotOscSharp.OscArgument(name, 's'),
new godotOscSharp.OscArgument(isLeft, 'i'),
new godotOscSharp.OscArgument(isTouch, 'i'),
new godotOscSharp.OscArgument(isAxis, 'i'),
new godotOscSharp.OscArgument(axis.X, 'i'),
new godotOscSharp.OscArgument(axis.Y, 'i'),
new godotOscSharp.OscArgument(axis.Z, 'i'),
return new OscMessage(addr, new System.Collections.Generic.List<OscArgument>{
new OscArgument(Active, 'i'),
new OscArgument(Name, 's'),
new OscArgument(IsLeft, 'i'),
new OscArgument(IsTouch, 'i'),
new OscArgument(IsAxis, 'i'),
new OscArgument(Axis.X, 'i'),
new OscArgument(Axis.Y, 'i'),
new OscArgument(Axis.Z, 'i'),
});
}
}

View File

@ -18,15 +18,14 @@
using Godot;
using godotOscSharp;
using System.Collections.Generic;
namespace godotVmcSharp
{
public class VmcExtConfig : VmcMessage
{
public string path { get; }
public string Path { get; }
public VmcExtConfig(godotOscSharp.OscMessage m) : base(m.Address)
public VmcExtConfig(OscMessage m) : base(m.Address)
{
if (m.Data.Count != 1)
{
@ -38,17 +37,17 @@ namespace godotVmcSharp
GD.Print(InvalidArgumentType.GetErrorString(addr, "path", 's', m.Data[0].Type));
return;
}
path = (string)m.Data[0].Value;
Path = (string)m.Data[0].Value;
}
public VmcExtConfig(string _path) : base(new godotOscSharp.Address("/VMC/Ext/Config"))
public VmcExtConfig(string path) : base(new OscAddress("/VMC/Ext/Config"))
{
path = _path;
Path = path;
}
public godotOscSharp.OscMessage ToMessage()
public new OscMessage ToMessage()
{
return new godotOscSharp.OscMessage(addr, new List<godotOscSharp.OscArgument>{new godotOscSharp.OscArgument(path, 's')});
return new OscMessage(addr, new System.Collections.Generic.List<OscArgument> { new OscArgument(Path, 's') });
}
}
}

View File

@ -18,16 +18,15 @@
using Godot;
using godotOscSharp;
using System.Collections.Generic;
namespace godotVmcSharp
{
public class VmcExtDevicePos : VmcMessage
{
public string serial { get; }
public Godot.Transform3D transform { get; }
public string Serial { get; }
public Transform3D Transform { get; }
public VmcExtDevicePos(godotOscSharp.OscMessage m) : base(m.Address)
public VmcExtDevicePos(OscMessage m) : base(m.Address)
{
if (m.Data.Count != 8)
{
@ -74,28 +73,28 @@ namespace godotVmcSharp
GD.Print(InvalidArgumentType.GetErrorString(addr, "q.w", 'f', m.Data[7].Type));
return;
}
serial = (string)m.Data[0].Value;
transform = new Godot.Transform3D(new Godot.Basis(new Godot.Quaternion((float)m.Data[4].Value, (float)m.Data[5].Value, (float)m.Data[6].Value, (float)m.Data[7].Value)), new Godot.Vector3((float)m.Data[1].Value, (float)m.Data[2].Value, (float)m.Data[3].Value));
Serial = (string)m.Data[0].Value;
Transform = new Transform3D(new Basis(new Quaternion((float)m.Data[4].Value, (float)m.Data[5].Value, (float)m.Data[6].Value, (float)m.Data[7].Value)), new Vector3((float)m.Data[1].Value, (float)m.Data[2].Value, (float)m.Data[3].Value));
}
public VmcExtDevicePos(godotOscSharp.Address _addr, string _serial, Godot.Transform3D _transform) : base(_addr)
public VmcExtDevicePos(OscAddress addr, string serial, Transform3D transform) : base(addr)
{
serial = _serial;
transform = _transform;
Serial = serial;
Transform = transform;
}
public godotOscSharp.OscMessage ToMessage()
public new OscMessage ToMessage()
{
var quat = transform.Basis.GetRotationQuaternion();
return new godotOscSharp.OscMessage(addr, new List<godotOscSharp.OscArgument>{
new godotOscSharp.OscArgument(serial, 's'),
new godotOscSharp.OscArgument(transform.Origin.X, 'f'),
new godotOscSharp.OscArgument(transform.Origin.Y, 'f'),
new godotOscSharp.OscArgument(transform.Origin.Z, 'f'),
new godotOscSharp.OscArgument(quat.X, 'f'),
new godotOscSharp.OscArgument(quat.Y, 'f'),
new godotOscSharp.OscArgument(quat.Z, 'f'),
new godotOscSharp.OscArgument(quat.W, 'f')
var quat = Transform.Basis.GetRotationQuaternion();
return new OscMessage(addr, new System.Collections.Generic.List<OscArgument>{
new OscArgument(Serial, 's'),
new OscArgument(Transform.Origin.X, 'f'),
new OscArgument(Transform.Origin.Y, 'f'),
new OscArgument(Transform.Origin.Z, 'f'),
new OscArgument(quat.X, 'f'),
new OscArgument(quat.Y, 'f'),
new OscArgument(quat.Z, 'f'),
new OscArgument(quat.W, 'f')
});
}
}

View File

@ -18,16 +18,15 @@
using Godot;
using godotOscSharp;
using System.Collections.Generic;
namespace godotVmcSharp
{
public class VmcExtKey : VmcMessage
{
public int active { get; }
public string name { get; }
public int keycode { get; }
public VmcExtKey(godotOscSharp.OscMessage m) : base(m.Address)
public int Active { get; }
public string Name { get; }
public int Keycode { get; }
public VmcExtKey(OscMessage m) : base(m.Address)
{
if (m.Data[0].Type != 'i')
{
@ -49,29 +48,29 @@ namespace godotVmcSharp
GD.Print($"Invalid value for \"active\" 'i' argument of {addr}. Expected 0 or 1, received {(int)m.Data[0].Value}");
return;
}
active = (int)m.Data[0].Value;
name = (string)m.Data[1].Value;
keycode = (int)m.Data[2].Value;
Active = (int)m.Data[0].Value;
Name = (string)m.Data[1].Value;
Keycode = (int)m.Data[2].Value;
}
public VmcExtKey(int _active, string _name, int _keycode) : base(new godotOscSharp.Address("/VMC/Ext/Key"))
public VmcExtKey(int active, string name, int keycode) : base(new OscAddress("/VMC/Ext/Key"))
{
if (_active < 0 || _active > 1)
if (active < 0 || active > 1)
{
GD.Print($"Invalid value for \"active\" 'i' argument of {addr}. Expected 0 or 1, received {_active}");
GD.Print($"Invalid value for \"active\" 'i' argument of {addr}. Expected 0 or 1, received {active}");
return;
}
active = _active;
name = _name;
keycode = _keycode;
Active = active;
Name = name;
Keycode = keycode;
}
public godotOscSharp.OscMessage ToMessage()
public new OscMessage ToMessage()
{
return new godotOscSharp.OscMessage(addr, new List<godotOscSharp.OscArgument>{
new godotOscSharp.OscArgument(active, 'i'),
new godotOscSharp.OscArgument(name, 's'),
new godotOscSharp.OscArgument(keycode, 'i')
return new OscMessage(addr, new System.Collections.Generic.List<OscArgument>{
new OscArgument(Active, 'i'),
new OscArgument(Name, 's'),
new OscArgument(Keycode, 'i')
});
}
}

View File

@ -24,11 +24,11 @@ namespace godotVmcSharp
{
public class VmcExtLight : VmcMessage
{
public string name { get; }
public Godot.Transform3D transform { get; }
public Godot.Color color { get; }
public string Name { get; }
public Transform3D Transform { get; }
public Color Color { get; }
public VmcExtLight(godotOscSharp.OscMessage m) : base(m.Address)
public VmcExtLight(OscMessage m) : base(m.Address)
{
if (m.Data.Count != 12)
{
@ -95,34 +95,34 @@ namespace godotVmcSharp
GD.Print(InvalidArgumentType.GetErrorString(addr, "color.alpha", 'f', m.Data[11].Type));
return;
}
name = (string)m.Data[0].Value;
transform = new Godot.Transform3D(new Godot.Basis(new Godot.Quaternion((float)m.Data[4].Value, (float)m.Data[5].Value, (float)m.Data[6].Value, (float)m.Data[7].Value)), new Godot.Vector3((float)m.Data[1].Value, (float)m.Data[2].Value, (float)m.Data[3].Value));
color = new Godot.Color((float)m.Data[8].Value, (float)m.Data[9].Value, (float)m.Data[10].Value, (float)m.Data[11].Value);
Name = (string)m.Data[0].Value;
Transform = new Transform3D(new Basis(new Quaternion((float)m.Data[4].Value, (float)m.Data[5].Value, (float)m.Data[6].Value, (float)m.Data[7].Value)), new Vector3((float)m.Data[1].Value, (float)m.Data[2].Value, (float)m.Data[3].Value));
Color = new Color((float)m.Data[8].Value, (float)m.Data[9].Value, (float)m.Data[10].Value, (float)m.Data[11].Value);
}
public VmcExtLight(string _name, Godot.Transform3D _transform, Godot.Color _color) : base(new godotOscSharp.Address("/VMC/Ext/Light"))
public VmcExtLight(string name, Transform3D transform, Color color) : base(new OscAddress("/VMC/Ext/Light"))
{
name = _name;
transform = _transform;
color = _color;
Name = name;
Transform = transform;
Color = color;
}
public godotOscSharp.OscMessage ToMessage()
public new OscMessage ToMessage()
{
var quat = transform.Basis.GetRotationQuaternion();
return new godotOscSharp.OscMessage(addr, new List<godotOscSharp.OscArgument>{
new godotOscSharp.OscArgument(name, 's'),
new godotOscSharp.OscArgument(transform.Origin.X, 'f'),
new godotOscSharp.OscArgument(transform.Origin.Y, 'f'),
new godotOscSharp.OscArgument(transform.Origin.Z, 'f'),
new godotOscSharp.OscArgument(quat.X, 'f'),
new godotOscSharp.OscArgument(quat.Y, 'f'),
new godotOscSharp.OscArgument(quat.Z, 'f'),
new godotOscSharp.OscArgument(quat.W, 'f'),
new godotOscSharp.OscArgument(color.R, 'f'),
new godotOscSharp.OscArgument(color.G, 'f'),
new godotOscSharp.OscArgument(color.B, 'f'),
new godotOscSharp.OscArgument(color.A, 'f')
var quat = Transform.Basis.GetRotationQuaternion();
return new OscMessage(addr, new List<OscArgument>{
new OscArgument(Name, 's'),
new OscArgument(Transform.Origin.X, 'f'),
new OscArgument(Transform.Origin.Y, 'f'),
new OscArgument(Transform.Origin.Z, 'f'),
new OscArgument(quat.X, 'f'),
new OscArgument(quat.Y, 'f'),
new OscArgument(quat.Z, 'f'),
new OscArgument(quat.W, 'f'),
new OscArgument(Color.R, 'f'),
new OscArgument(Color.G, 'f'),
new OscArgument(Color.B, 'f'),
new OscArgument(Color.A, 'f')
});
}
}

View File

@ -18,15 +18,14 @@
using Godot;
using godotOscSharp;
using System.Collections.Generic;
namespace godotVmcSharp
{
public class VmcExtMidiCcBit : VmcMessage
{
public int knob { get; }
public int active { get; }
public VmcExtMidiCcBit(godotOscSharp.OscMessage m) : base(m.Address)
public int Knob { get; }
public int Active { get; }
public VmcExtMidiCcBit(OscMessage m) : base(m.Address)
{
if (m.Data[0].Type != 'i')
{
@ -43,26 +42,26 @@ namespace godotVmcSharp
GD.Print($"Invalid value for \"active\" argument of {addr}. Expected 0 or 1, received {(int)m.Data[1].Value}.");
return;
}
knob = (int)m.Data[0].Value;
active = (int)m.Data[1].Value;
Knob = (int)m.Data[0].Value;
Active = (int)m.Data[1].Value;
}
public VmcExtMidiCcBit(int _knob, int _active) : base(new godotOscSharp.Address("/VMC/Ext/Midi/CC/Bit"))
public VmcExtMidiCcBit(int knob, int active) : base(new OscAddress("/VMC/Ext/Midi/CC/Bit"))
{
if (_active < 0 || _active > 1)
if (active < 0 || active > 1)
{
GD.Print($"Invalid value for \"active\" argument of {addr}. Expected 0 or 1, received {_active}.");
GD.Print($"Invalid value for \"active\" argument of {addr}. Expected 0 or 1, received {active}.");
return;
}
knob = _knob;
active = _active;
Knob = knob;
Active = active;
}
public godotOscSharp.OscMessage ToMessage()
public new OscMessage ToMessage()
{
return new godotOscSharp.OscMessage(addr, new List<godotOscSharp.OscArgument>{
new godotOscSharp.OscArgument(knob, 'i'),
new godotOscSharp.OscArgument(active, 'i')
return new OscMessage(addr, new System.Collections.Generic.List<OscArgument>{
new OscArgument(Knob, 'i'),
new OscArgument(Active, 'i')
});
}
}

View File

@ -18,15 +18,14 @@
using Godot;
using godotOscSharp;
using System.Collections.Generic;
namespace godotVmcSharp
{
public class VmcExtMidiCcVal : VmcMessage
{
public int knob { get; }
public float value { get; }
public VmcExtMidiCcVal(godotOscSharp.OscMessage m) : base(m.Address)
public int Knob { get; }
public float Value { get; }
public VmcExtMidiCcVal(OscMessage m) : base(m.Address)
{
if (m.Data[0].Type != 'i')
{
@ -38,21 +37,21 @@ namespace godotVmcSharp
GD.Print(InvalidArgumentType.GetErrorString(addr, "value", 'f', m.Data[1].Type));
return;
}
knob = (int)m.Data[0].Value;
value = (int)m.Data[1].Value;
Knob = (int)m.Data[0].Value;
Value = (int)m.Data[1].Value;
}
public VmcExtMidiCcVal(int _knob, float _value) : base(new godotOscSharp.Address("/VMC/Ext/Midi/CC/Val"))
public VmcExtMidiCcVal(int knob, float value) : base(new OscAddress("/VMC/Ext/Midi/CC/Val"))
{
knob = _knob;
value = _value;
Knob = knob;
Value = value;
}
public godotOscSharp.OscMessage ToMessage()
public new OscMessage ToMessage()
{
return new godotOscSharp.OscMessage(addr, new List<godotOscSharp.OscArgument>{
new godotOscSharp.OscArgument(knob, 'i'),
new godotOscSharp.OscArgument(value, 'f')
return new OscMessage(addr, new System.Collections.Generic.List<OscArgument>{
new OscArgument(Knob, 'i'),
new OscArgument(Value, 'f')
});
}
}

View File

@ -18,18 +18,17 @@
using Godot;
using godotOscSharp;
using System.Collections.Generic;
namespace godotVmcSharp
{
public class VmcExtMidiNote : VmcMessage
{
public int active { get; }
public int channel { get; }
public int note { get; }
public float velocity { get; }
public int Active { get; }
public int Channel { get; }
public int Note { get; }
public float Velocity { get; }
public VmcExtMidiNote(godotOscSharp.OscMessage m) : base(m.Address)
public VmcExtMidiNote(OscMessage m) : base(m.Address)
{
if (m.Data[0].Type != 'i')
{
@ -56,32 +55,32 @@ namespace godotVmcSharp
GD.Print($"Invalid value for \"active\" 'i' argument of {addr}. Expected 0 or 1, received {(int)m.Data[0].Value}");
return;
}
active = (int)m.Data[0].Value;
channel = (int)m.Data[1].Value;
note = (int)m.Data[2].Value;
velocity = (int)m.Data[3].Value;
Active = (int)m.Data[0].Value;
Channel = (int)m.Data[1].Value;
Note = (int)m.Data[2].Value;
Velocity = (int)m.Data[3].Value;
}
public VmcExtMidiNote(int _active, int _channel, int _note, float _velocity) : base(new godotOscSharp.Address("/VMC/Ext/Midi/Note"))
public VmcExtMidiNote(int active, int channel, int note, float velocity) : base(new OscAddress("/VMC/Ext/Midi/Note"))
{
if (_active < 0 || _active > 1)
if (active < 0 || active > 1)
{
GD.Print($"Invalid value for \"active\" 'i' argument of {addr}. Expected 0 or 1, received {active}.");
GD.Print($"Invalid value for \"active\" 'i' argument of {addr}. Expected 0 or 1, received {Active}.");
return;
}
active = _active;
channel = _channel;
note = _note;
velocity = _velocity;
Active = active;
Channel = channel;
Note = note;
Velocity = velocity;
}
public godotOscSharp.OscMessage ToMessage()
public new OscMessage ToMessage()
{
return new godotOscSharp.OscMessage(addr, new List<godotOscSharp.OscArgument>{
new godotOscSharp.OscArgument(active, 'i'),
new godotOscSharp.OscArgument(channel, 'i'),
new godotOscSharp.OscArgument(note, 'i'),
new godotOscSharp.OscArgument(velocity, 'f')
return new OscMessage(addr, new System.Collections.Generic.List<OscArgument>{
new OscArgument(Active, 'i'),
new OscArgument(Channel, 'i'),
new OscArgument(Note, 'i'),
new OscArgument(Velocity, 'f')
});
}
}

View File

@ -24,169 +24,191 @@ namespace godotVmcSharp
{
public class VmcExtOk : VmcMessage
{
public int loaded { get; private set; }
public int? calibrationState { get; private set; }
public int? calibrationMode { get; private set; }
public int? trackingStatus { get; private set; }
public int Loaded { get; }
public int? CalibrationState { get; }
public int? CalibrationMode { get; }
public int? TrackingStatus { get; }
public VmcExtOk(int _loaded) : base(new godotOscSharp.Address("/VMC/Ext/OK"))
public VmcExtOk(int loaded) : base(new OscAddress("/VMC/Ext/OK"))
{
if (_loaded < 0 || _loaded > 1)
if (loaded < 0 || loaded > 1)
{
GD.Print($"Invalid value for loaded status. Expected 0 or 1, received {_loaded}.");
GD.Print($"Invalid value for loaded status. Expected 0 or 1, received {loaded}.");
return;
}
loaded = _loaded;
Loaded = loaded;
}
public VmcExtOk(int _loaded, int _calibrationState, int _calibrationMode) : base(new godotOscSharp.Address("/VMC/Ext/OK"))
public VmcExtOk(int loaded, int calibrationState, int calibrationMode) : base(new OscAddress("/VMC/Ext/OK"))
{
if (_loaded < 0 || _loaded > 1)
if (loaded < 0 || loaded > 1)
{
GD.Print($"Invalid value for loaded status. Expected 0 or 1, received {_loaded}.");
GD.Print($"Invalid value for loaded status. Expected 0 or 1, received {loaded}.");
return;
}
if (_calibrationState < 0 || _calibrationState > 3)
if (calibrationState < 0 || calibrationState > 3)
{
GD.Print($"Invalid value for calibration state. Expected 0-3, received {_calibrationState}");
GD.Print($"Invalid value for calibration state. Expected 0-3, received {calibrationState}");
return;
}
if (_calibrationMode < 0 || _calibrationMode > 2)
if (calibrationMode < 0 || calibrationMode > 2)
{
GD.Print($"Invalid value for calibration mode. Expected 0-2, received {_calibrationMode}");
GD.Print($"Invalid value for calibration mode. Expected 0-2, received {calibrationMode}");
return;
}
loaded = _loaded;
calibrationState = _calibrationState;
calibrationMode = _calibrationMode;
Loaded = loaded;
CalibrationState = calibrationState;
CalibrationMode = calibrationMode;
}
public VmcExtOk(int _loaded, int _calibrationState, int _calibrationMode, int _trackingStatus) : base(new godotOscSharp.Address("/VMC/Ext/OK"))
public VmcExtOk(int loaded, int calibrationState, int calibrationMode, int trackingStatus) : base(new OscAddress("/VMC/Ext/OK"))
{
if (_loaded < 0 || _loaded > 1)
if (loaded < 0 || loaded > 1)
{
GD.Print($"Invalid value for loaded status. Expected 0 or 1, received {_loaded}.");
GD.Print($"Invalid value for loaded status. Expected 0 or 1, received {loaded}.");
return;
}
if (_calibrationState < 0 || _calibrationState > 3)
if (calibrationState < 0 || calibrationState > 3)
{
GD.Print($"Invalid value for calibration state. Expected 0-3, received {_calibrationState}");
GD.Print($"Invalid value for calibration state. Expected 0-3, received {calibrationState}");
return;
}
if (_calibrationMode < 0 || _calibrationMode > 2)
if (calibrationMode < 0 || calibrationMode > 2)
{
GD.Print($"Invalid value for calibration mode. Expected 0-2, received {_calibrationMode}");
GD.Print($"Invalid value for calibration mode. Expected 0-2, received {calibrationMode}");
return;
}
if (_trackingStatus < 0 || _trackingStatus > 1)
if (trackingStatus < 0 || trackingStatus > 1)
{
GD.Print($"Invalid value for tracking status. Expected 0-1, received {_trackingStatus}");
GD.Print($"Invalid value for tracking status. Expected 0-1, received {trackingStatus}");
return;
}
loaded = _loaded;
calibrationState = _calibrationState;
calibrationMode = _calibrationMode;
trackingStatus = _trackingStatus;
Loaded = loaded;
CalibrationState = calibrationState;
CalibrationMode = calibrationMode;
TrackingStatus = trackingStatus;
}
public VmcExtOk(godotOscSharp.OscMessage m) : base(m.Address)
public VmcExtOk(OscMessage m) : base(m.Address)
{
switch (m.Data.Count)
{
case 1:
OkParam0(m.Data[0]);
if (!OkParam0(m.Data[0]))
{
return;
}
Loaded = (int)m.Data[0].Value;
break;
case 3:
OkParam1And2(m.Data[0], m.Data[1], m.Data[2]);
if (!OkParam1And2(m.Data[0], m.Data[1], m.Data[2]))
{
return;
}
Loaded = (int)m.Data[0].Value;
CalibrationState = (int)m.Data[1].Value;
CalibrationMode = (int)m.Data[2].Value;
break;
case 4:
OkParam3(m.Data[0], m.Data[1], m.Data[2], m.Data[3]);
if (!OkParam3(m.Data[0], m.Data[1], m.Data[2], m.Data[3]))
{
return;
}
Loaded = (int)m.Data[0].Value;
CalibrationState = (int)m.Data[1].Value;
CalibrationMode = (int)m.Data[2].Value;
TrackingStatus = (int)m.Data[3].Value;
break;
default:
GD.Print($"Invalid number of arguments for /VMC/Ext/OK message. Expected 1, 3, or 4 but received {m.Data.Count}");
break;
return;
}
}
private void OkParam0(godotOscSharp.OscArgument arg)
private bool OkParam0(OscArgument arg)
{
if (arg.Type != 'i')
{
GD.Print($"Invalid argument type for /VMC/Ext/OK message. Expected int in argument 0, received {arg.Type}");
return;
return false;
}
if ((int)arg.Value < 0 && (int)arg.Value > 1)
{
GD.Print($"Invalid value for loaded status. Expected 0-1, received {(int)arg.Value}");
return;
return false;
}
loaded = (int)arg.Value;
return true;
}
private void OkParam1And2(godotOscSharp.OscArgument arg0, godotOscSharp.OscArgument arg1, godotOscSharp.OscArgument arg2)
private bool OkParam1And2(OscArgument arg0, OscArgument arg1, OscArgument arg2)
{
OkParam0(arg0);
if (!OkParam0(arg0))
{
return false;
}
if (arg1.Type != 'i')
{
GD.Print($"Invalid argument type for /VMC/Ext/OK message. Expected int in argument 1, received {arg1.Type}");
return;
return false;
}
if (arg2.Type != 'i')
{
GD.Print($"Invalid argument type for /VMC/Ext/OK message. Expected int in argument 2, received {arg2.Type}");
return;
return false;
}
if ((int)arg1.Value < 0 && (int)arg1.Value > 3)
{
GD.Print($"Invalid value for calibration state. Expected 0-3, received {(int)arg1.Value}");
return;
return false;
}
if ((int)arg2.Value < 0 && (int)arg2.Value > 2)
{
GD.Print($"Invalid value for calibration mode. Expected 0-2, received {(int)arg2.Value}");
return;
return false;
}
calibrationState = (int)arg1.Value;
calibrationMode = (int)arg2.Value;
return true;
}
private void OkParam3(godotOscSharp.OscArgument arg0, godotOscSharp.OscArgument arg1, godotOscSharp.OscArgument arg2, godotOscSharp.OscArgument arg)
private bool OkParam3(OscArgument arg0, OscArgument arg1, OscArgument arg2, OscArgument arg)
{
OkParam1And2(arg0, arg1, arg2);
if (!OkParam1And2(arg0, arg1, arg2))
{
return false;
}
if (arg.Type != 'i')
{
GD.Print($"Invalid argument type for /VMC/Ext/OK message. Expected int in argument 3, received {arg.Type}");
return;
return false;
}
if ((int)arg.Value < 0 && (int)arg.Value > 1)
{
GD.Print($"Invalid value for tracking status. Expected 0-1, received {(int)arg.Value}");
return;
return false;
}
trackingStatus = (int)arg.Value;
return true;
}
public godotOscSharp.OscMessage ToMessage()
public new OscMessage ToMessage()
{
if (calibrationState == null)
if (CalibrationState == null)
{
return new godotOscSharp.OscMessage(addr, new List<godotOscSharp.OscArgument>{
new godotOscSharp.OscArgument(loaded, 'i')
return new OscMessage(addr, new List<OscArgument>{
new OscArgument(Loaded, 'i')
});
}
if (trackingStatus == null)
if (TrackingStatus == null)
{
return new godotOscSharp.OscMessage(addr, new List<godotOscSharp.OscArgument>{
new godotOscSharp.OscArgument(loaded, 'i'),
new godotOscSharp.OscArgument(calibrationState, 'i'),
new godotOscSharp.OscArgument(calibrationMode, 'i')
return new OscMessage(addr, new List<OscArgument>{
new OscArgument(Loaded, 'i'),
new OscArgument(CalibrationState, 'i'),
new OscArgument(CalibrationMode, 'i')
});
}
return new godotOscSharp.OscMessage(addr, new List<godotOscSharp.OscArgument>{
new godotOscSharp.OscArgument(loaded, 'i'),
new godotOscSharp.OscArgument(calibrationState, 'i'),
new godotOscSharp.OscArgument(calibrationMode, 'i'),
new godotOscSharp.OscArgument(trackingStatus, 'i')
return new OscMessage(addr, new List<OscArgument>{
new OscArgument(Loaded, 'i'),
new OscArgument(CalibrationState, 'i'),
new OscArgument(CalibrationMode, 'i'),
new OscArgument(TrackingStatus, 'i')
});
}
}

View File

@ -18,7 +18,6 @@
using Godot;
using godotOscSharp;
using System.Collections.Generic;
namespace godotVmcSharp
{
@ -26,7 +25,7 @@ namespace godotVmcSharp
{
public string option { get; }
public VmcExtOpt(godotOscSharp.OscMessage m) : base(m.Address)
public VmcExtOpt(OscMessage m) : base(m.Address)
{
if (m.Data.Count != 1)
{
@ -41,14 +40,14 @@ namespace godotVmcSharp
option = (string)m.Data[0].Value;
}
public VmcExtOpt(string _option) : base(new godotOscSharp.Address("/VMC/Ext/Opt"))
public VmcExtOpt(string _option) : base(new OscAddress("/VMC/Ext/Opt"))
{
option = _option;
}
public godotOscSharp.OscMessage ToMessage()
public new OscMessage ToMessage()
{
return new godotOscSharp.OscMessage(addr, new List<godotOscSharp.OscArgument>{new godotOscSharp.OscArgument(option, 's')});
return new OscMessage(addr, new System.Collections.Generic.List<OscArgument>{new OscArgument(option, 's')});
}
}
}

View File

@ -24,11 +24,11 @@ namespace godotVmcSharp
{
public class VmcExtRcv : VmcMessage
{
public int enable { get; }
public int port { get; }
public string? ipAddress { get; }
public int Enable { get; }
public int Port { get; }
public string IpAddress { get; }
public VmcExtRcv(godotOscSharp.OscMessage m) : base(m.Address)
public VmcExtRcv(OscMessage m) : base(m.Address)
{
if (m.Data.Count > 3 || m.Data.Count < 2)
{
@ -55,10 +55,11 @@ namespace godotVmcSharp
GD.Print($"Invalid value for \"port\" argument of {addr}. Expected 0-65535, received {(int)m.Data[1].Value}.");
return;
}
enable = (int)m.Data[0].Value;
port = (int)m.Data[1].Value;
Enable = (int)m.Data[0].Value;
Port = (int)m.Data[1].Value;
if (m.Data.Count != 3)
{
IpAddress = "";
return;
}
if (m.Data[2].Type != 's')
@ -66,55 +67,56 @@ namespace godotVmcSharp
GD.Print(InvalidArgumentType.GetErrorString(addr, "IpAddress", 's', m.Data[2].Type));
return;
}
ipAddress = (string)m.Data[2].Value;
IpAddress = (string)m.Data[2].Value;
}
public VmcExtRcv(int _enable, int _port) : base(new godotOscSharp.Address("/VMC/Ext/Rcv"))
public VmcExtRcv(int enable, int port) : base(new OscAddress("/VMC/Ext/Rcv"))
{
if (_enable < 0 || _enable > 1)
if (enable < 0 || enable > 1)
{
GD.Print($"Invalid value for \"enable\" argument of {addr}. Expected 0 or 1, received {_enable}.");
GD.Print($"Invalid value for \"enable\" argument of {addr}. Expected 0 or 1, received {enable}.");
return;
}
if (_port < 0 || _port > 65535)
if (port < 0 || port > 65535)
{
GD.Print($"Invalid value for \"port\" argument of {addr}. Expected 0-65535, received {_port}.");
GD.Print($"Invalid value for \"port\" argument of {addr}. Expected 0-65535, received {port}.");
return;
}
enable = _enable;
port = _port;
Enable = enable;
Port = port;
IpAddress = "";
}
public VmcExtRcv(int _enable, int _port, string _ipAddress) : base(new godotOscSharp.Address("/VMC/Ext/Rcv"))
public VmcExtRcv(int enable, int port, string ipAddress) : base(new OscAddress("/VMC/Ext/Rcv"))
{
if (_enable < 0 || _enable > 1)
if (enable < 0 || enable > 1)
{
GD.Print($"Invalid value for \"enable\" argument of {addr}. Expected 0 or 1, received {_enable}.");
GD.Print($"Invalid value for \"enable\" argument of {addr}. Expected 0 or 1, received {enable}.");
return;
}
if (_port < 0 || _port > 65535)
if (port < 0 || port > 65535)
{
GD.Print($"Invalid value for \"port\" argument of {addr}. Expected 0-65535, received {_port}.");
GD.Print($"Invalid value for \"port\" argument of {addr}. Expected 0-65535, received {port}.");
return;
}
enable = _enable;
port = _port;
ipAddress = _ipAddress;
Enable = enable;
Port = port;
IpAddress = ipAddress;
}
public godotOscSharp.OscMessage ToMessage()
public new OscMessage ToMessage()
{
if (ipAddress == null)
if (IpAddress == "")
{
return new godotOscSharp.OscMessage(addr, new List<godotOscSharp.OscArgument>{
new godotOscSharp.OscArgument(enable, 'i'),
new godotOscSharp.OscArgument(port, 'i'),
return new OscMessage(addr, new List<OscArgument>{
new OscArgument(Enable, 'i'),
new OscArgument(Port, 'i'),
});
}
return new godotOscSharp.OscMessage(addr, new List<godotOscSharp.OscArgument>{
new godotOscSharp.OscArgument(enable, 'i'),
new godotOscSharp.OscArgument(port, 'i'),
new godotOscSharp.OscArgument(ipAddress, 's'),
return new OscMessage(addr, new List<OscArgument>{
new OscArgument(Enable, 'i'),
new OscArgument(Port, 'i'),
new OscArgument(IpAddress, 's'),
});
}
}

View File

@ -18,16 +18,15 @@
using Godot;
using godotOscSharp;
using System.Collections.Generic;
namespace godotVmcSharp
{
public class VmcExtRemote : VmcMessage
{
public string service { get; }
public string json { get; }
public string Service { get; }
public string Json { get; }
public VmcExtRemote(godotOscSharp.OscMessage m) : base(m.Address)
public VmcExtRemote(OscMessage m) : base(m.Address)
{
if (m.Data.Count != 2)
{
@ -44,21 +43,21 @@ namespace godotVmcSharp
GD.Print(InvalidArgumentType.GetErrorString(addr, "json", 's', m.Data[1].Type));
return;
}
service = (string)m.Data[0].Value;
json = (string)m.Data[1].Value;
Service = (string)m.Data[0].Value;
Json = (string)m.Data[1].Value;
}
public VmcExtRemote(string _service, string _json) : base(new godotOscSharp.Address("/VMC/Ext/Remote"))
public VmcExtRemote(string service, string json) : base(new OscAddress("/VMC/Ext/Remote"))
{
service = _service;
json = _json;
Service = service;
Json = json;
}
public godotOscSharp.OscMessage ToMessage()
public new OscMessage ToMessage()
{
return new godotOscSharp.OscMessage(addr, new List<godotOscSharp.OscArgument>{
new godotOscSharp.OscArgument(service, 's'),
new godotOscSharp.OscArgument(json, 's')
return new OscMessage(addr, new System.Collections.Generic.List<OscArgument>{
new OscArgument(Service, 's'),
new OscArgument(Json, 's')
});
}
}

View File

@ -19,202 +19,175 @@
using Godot;
using godotOscSharp;
using System.Collections.Generic;
using System.Threading;
namespace godotVmcSharp
{
public class VmcExtRootPos : VmcMessage
{
public string name { get; private set; }
public Godot.Transform3D transform { get; private set;}
public string Name { get; }
public Transform3D Transform { get; }
public Godot.Vector3? scale { get; private set; }
public Godot.Vector3? offset { get; private set; }
public Vector3? Scale { get; }
public Vector3? Offset { get; }
public VmcExtRootPos(godotOscSharp.OscMessage m) : base(m.Address)
public VmcExtRootPos(OscMessage m) : base(m.Address)
{
switch (m.Data.Count)
{
case 8:
Transform8(m.Data);
if (!Transform8(m.Data))
{
return;
}
Name = (string)m.Data[0].Value;
Transform = new Transform3D(new Basis(new Quaternion((float)m.Data[4].Value, (float)m.Data[5].Value, (float)m.Data[6].Value, (float)m.Data[7].Value)), new Vector3((float)m.Data[1].Value, (float)m.Data[2].Value, (float)m.Data[3].Value));
break;
case 14:
Transform14(m.Data);
if (!Transform14(m.Data))
{
return;
}
Name = (string)m.Data[0].Value;
Transform = new Transform3D(new Basis(new Quaternion((float)m.Data[4].Value, (float)m.Data[5].Value, (float)m.Data[6].Value, (float)m.Data[7].Value)), new Vector3((float)m.Data[1].Value, (float)m.Data[2].Value, (float)m.Data[3].Value));
Scale = new Vector3((float)m.Data[8].Value, (float)m.Data[9].Value, (float)m.Data[10].Value);
Offset = new Vector3((float)m.Data[11].Value, (float)m.Data[12].Value, (float)m.Data[13].Value);
break;
default:
GD.Print($"Invalid number of arguments for {base.addr}. Expected 8 or 14, received {m.Data.Count}.");
break;
GD.Print($"Invalid number of arguments for {addr}. Expected 8 or 14, received {m.Data.Count}.");
return;
}
}
public VmcExtRootPos(string _name, Godot.Transform3D _transform) : base(new godotOscSharp.Address("/VMC/Ext/Root/Pos"))
public VmcExtRootPos(string name, Transform3D transform) : base(new OscAddress("/VMC/Ext/Root/Pos"))
{
name = _name;
transform = _transform;
Name = name;
Transform = transform;
}
public VmcExtRootPos(string _name, Godot.Transform3D _transform, Godot.Vector3 _scale, Godot.Vector3 _offset) : base(new godotOscSharp.Address("/VMC/Ext/Root/Pos"))
public VmcExtRootPos(string name, Transform3D transform, Vector3 scale, Vector3 offset) : base(new OscAddress("/VMC/Ext/Root/Pos"))
{
name = _name;
transform = _transform;
scale = _scale;
offset = _offset;
Name = name;
Transform = transform;
Scale = scale;
Offset = offset;
}
private void Transform8(List<godotOscSharp.OscArgument> data)
private bool Transform8(List<OscArgument> data)
{
if (data[0].Type != 's')
{
GD.Print(InvalidArgumentType.GetErrorString(addr, "name", 's', data[0].Type));
return;
return false;
}
if (data[1].Type != 'f')
{
GD.Print(InvalidArgumentType.GetErrorString(addr, "p.x", 'f', data[1].Type));
return;
return false;
}
if (data[2].Type != 'f')
{
GD.Print(InvalidArgumentType.GetErrorString(addr, "p.y", 'f', data[2].Type));
return;
return false;
}
if (data[3].Type != 'f')
{
GD.Print(InvalidArgumentType.GetErrorString(addr, "p.z", 'f', data[3].Type));
return;
return false;
}
if (data[4].Type != 'f')
{
GD.Print(InvalidArgumentType.GetErrorString(addr, "q.x", 'f', data[4].Type));
return;
return false;
}
if (data[5].Type != 'f')
{
GD.Print(InvalidArgumentType.GetErrorString(addr, "q.y", 'f', data[5].Type));
return;
return false;
}
if (data[6].Type != 'f')
{
GD.Print(InvalidArgumentType.GetErrorString(addr, "q.z", 'f', data[6].Type));
return;
return false;
}
if (data[7].Type != 'f')
{
GD.Print(InvalidArgumentType.GetErrorString(addr, "q.w", 'f', data[7].Type));
return;
return false;
}
name = (string)data[0].Value;
transform = new Godot.Transform3D(new Godot.Basis(new Godot.Quaternion((float)data[4].Value, (float)data[5].Value, (float)data[6].Value, (float)data[7].Value)), new Godot.Vector3((float)data[1].Value, (float)data[2].Value, (float)data[3].Value));
return true;
}
private void Transform14(List<godotOscSharp.OscArgument> data)
private bool Transform14(List<OscArgument> data)
{
if (data[0].Type != 's')
if (!Transform8(data))
{
GD.Print(InvalidArgumentType.GetErrorString(addr, "name", 's', data[0].Type));
return;
}
if (data[1].Type != 'f')
{
GD.Print(InvalidArgumentType.GetErrorString(addr, "p.x", 'f', data[1].Type));
return;
}
if (data[2].Type != 'f')
{
GD.Print(InvalidArgumentType.GetErrorString(addr, "p.y", 'f', data[2].Type));
return;
}
if (data[3].Type != 'f')
{
GD.Print(InvalidArgumentType.GetErrorString(addr, "p.z", 'f', data[3].Type));
return;
}
if (data[4].Type != 'f')
{
GD.Print(InvalidArgumentType.GetErrorString(addr, "q.x", 'f', data[4].Type));
return;
}
if (data[5].Type != 'f')
{
GD.Print(InvalidArgumentType.GetErrorString(addr, "q.y", 'f', data[5].Type));
return;
}
if (data[6].Type != 'f')
{
GD.Print(InvalidArgumentType.GetErrorString(addr, "q.z", 'f', data[6].Type));
return;
}
if (data[7].Type != 'f')
{
GD.Print(InvalidArgumentType.GetErrorString(addr, "q.w", 'f', data[7].Type));
return;
return false;
}
if (data[8].Type != 'f')
{
GD.Print(InvalidArgumentType.GetErrorString(addr, "s.x", 'f', data[8].Type));
return;
return false;
}
if (data[9].Type != 'f')
{
GD.Print(InvalidArgumentType.GetErrorString(addr, "s.y", 'f', data[9].Type));
return;
return false;
}
if (data[10].Type != 'f')
{
GD.Print(InvalidArgumentType.GetErrorString(addr, "s.z", 'f', data[10].Type));
return;
return false;
}
if (data[11].Type != 'f')
{
GD.Print(InvalidArgumentType.GetErrorString(addr, "o.x", 'f', data[11].Type));
return;
return false;
}
if (data[12].Type != 'f')
{
GD.Print(InvalidArgumentType.GetErrorString(addr, "o.y", 'f', data[12].Type));
return;
return false;
}
if (data[13].Type != 'f')
{
GD.Print(InvalidArgumentType.GetErrorString(addr, "o.z", 'f', data[13].Type));
return;
return false;
}
name = (string)data[0].Value;
transform = new Godot.Transform3D(new Godot.Basis(new Godot.Quaternion((float)data[4].Value, (float)data[5].Value, (float)data[6].Value, (float)data[7].Value)), new Godot.Vector3((float)data[1].Value, (float)data[2].Value, (float)data[3].Value));
scale = new Godot.Vector3((float)data[8].Value, (float)data[9].Value, (float)data[10].Value);
offset = new Godot.Vector3((float)data[11].Value, (float)data[12].Value, (float)data[13].Value);
return true;
}
public godotOscSharp.OscMessage ToMessage()
public new OscMessage ToMessage()
{
var quat = transform.Basis.GetRotationQuaternion();
if (!scale.HasValue)
var quat = Transform.Basis.GetRotationQuaternion();
if (!Scale.HasValue)
{
return new godotOscSharp.OscMessage(addr, new List<godotOscSharp.OscArgument>{
new godotOscSharp.OscArgument(name, 's'),
new godotOscSharp.OscArgument(transform.Origin.X, 'f'),
new godotOscSharp.OscArgument(transform.Origin.Y, 'f'),
new godotOscSharp.OscArgument(transform.Origin.Z, 'f'),
new godotOscSharp.OscArgument(quat.X, 'f'),
new godotOscSharp.OscArgument(quat.Y, 'f'),
new godotOscSharp.OscArgument(quat.Z, 'f'),
new godotOscSharp.OscArgument(quat.W, 'f'),
return new OscMessage(addr, new List<OscArgument>{
new OscArgument(Name, 's'),
new OscArgument(Transform.Origin.X, 'f'),
new OscArgument(Transform.Origin.Y, 'f'),
new OscArgument(Transform.Origin.Z, 'f'),
new OscArgument(quat.X, 'f'),
new OscArgument(quat.Y, 'f'),
new OscArgument(quat.Z, 'f'),
new OscArgument(quat.W, 'f'),
});
}
return new godotOscSharp.OscMessage(addr, new List<godotOscSharp.OscArgument>{
new godotOscSharp.OscArgument(name, 's'),
new godotOscSharp.OscArgument(transform.Origin.X, 'f'),
new godotOscSharp.OscArgument(transform.Origin.Y, 'f'),
new godotOscSharp.OscArgument(transform.Origin.Z, 'f'),
new godotOscSharp.OscArgument(quat.X, 'f'),
new godotOscSharp.OscArgument(quat.Y, 'f'),
new godotOscSharp.OscArgument(quat.Z, 'f'),
new godotOscSharp.OscArgument(quat.W, 'f'),
new godotOscSharp.OscArgument(scale.Value.X, 'f'),
new godotOscSharp.OscArgument(scale.Value.Y, 'f'),
new godotOscSharp.OscArgument(scale.Value.Z, 'f'),
new godotOscSharp.OscArgument(offset.Value.X, 'f'),
new godotOscSharp.OscArgument(offset.Value.Y, 'f'),
new godotOscSharp.OscArgument(offset.Value.Z, 'f'),
return new OscMessage(addr, new List<OscArgument>{
new OscArgument(Name, 's'),
new OscArgument(Transform.Origin.X, 'f'),
new OscArgument(Transform.Origin.Y, 'f'),
new OscArgument(Transform.Origin.Z, 'f'),
new OscArgument(quat.X, 'f'),
new OscArgument(quat.Y, 'f'),
new OscArgument(quat.Z, 'f'),
new OscArgument(quat.W, 'f'),
new OscArgument(Scale.Value.X, 'f'),
new OscArgument(Scale.Value.Y, 'f'),
new OscArgument(Scale.Value.Z, 'f'),
new OscArgument(Offset.Value.X, 'f'),
new OscArgument(Offset.Value.Y, 'f'),
new OscArgument(Offset.Value.Z, 'f'),
});
}
}

View File

@ -18,15 +18,14 @@
using Godot;
using godotOscSharp;
using System.Collections.Generic;
namespace godotVmcSharp
{
public class VmcExtSetCalibExec : VmcMessage
{
public int mode { get; }
public int Mode { get; }
public VmcExtSetCalibExec(godotOscSharp.OscMessage m) : base(m.Address)
public VmcExtSetCalibExec(OscMessage m) : base(m.Address)
{
if (m.Data.Count != 1)
{
@ -43,22 +42,22 @@ namespace godotVmcSharp
GD.Print($"Invalid value for argument \"mode\" of \"/VMC/Ext/Set/Calib/Exec\". Expected in range 0-2, received {(int)m.Data[0].Value}");
return;
}
mode = (int)m.Data[0].Value;
Mode = (int)m.Data[0].Value;
}
public VmcExtSetCalibExec(int _mode) : base(new godotOscSharp.Address("/VMC/Ext/Set/Calib/Exec"))
public VmcExtSetCalibExec(int mode) : base(new OscAddress("/VMC/Ext/Set/Calib/Exec"))
{
if (_mode < 0 || _mode > 2)
if (mode < 0 || mode > 2)
{
GD.Print($"Invalid value for argument \"mode\" of \"/VMC/Ext/Set/Calib/Exec\". Expected in range 0-2, received {_mode}");
GD.Print($"Invalid value for argument \"mode\" of \"/VMC/Ext/Set/Calib/Exec\". Expected in range 0-2, received {mode}");
return;
}
mode = _mode;
Mode = mode;
}
public godotOscSharp.OscMessage ToMessage()
public new OscMessage ToMessage()
{
return new godotOscSharp.OscMessage(addr, new List<godotOscSharp.OscArgument>{new godotOscSharp.OscArgument(mode, 'i')});
return new OscMessage(addr, new System.Collections.Generic.List<OscArgument>{new OscArgument(Mode, 'i')});
}
}
}

View File

@ -18,15 +18,14 @@
using Godot;
using godotOscSharp;
using System.Collections.Generic;
namespace godotVmcSharp
{
public class VmcExtSetConfig : VmcMessage
{
public string path { get; }
public string Path { get; }
public VmcExtSetConfig(godotOscSharp.OscMessage m) : base(m.Address)
public VmcExtSetConfig(OscMessage m) : base(m.Address)
{
if (m.Data.Count != 1)
{
@ -38,17 +37,17 @@ namespace godotVmcSharp
GD.Print(InvalidArgumentType.GetErrorString(addr, "path", 's', m.Data[0].Type));
return;
}
path = (string)m.Data[0].Value;
Path = (string)m.Data[0].Value;
}
public VmcExtSetConfig(string _path) : base(new godotOscSharp.Address("/VMC/Ext/Set/Config"))
public VmcExtSetConfig(string path) : base(new OscAddress("/VMC/Ext/Set/Config"))
{
path = _path;
Path = path;
}
public godotOscSharp.OscMessage ToMessage()
public new OscMessage ToMessage()
{
return new godotOscSharp.OscMessage(addr, new List<godotOscSharp.OscArgument>{new godotOscSharp.OscArgument(path, 's')});
return new OscMessage(addr, new System.Collections.Generic.List<OscArgument>{new OscArgument(Path, 's')});
}
}
}

View File

@ -18,16 +18,15 @@
using Godot;
using godotOscSharp;
using System.Collections.Generic;
namespace godotVmcSharp
{
public class VmcExtSetEye : VmcMessage
{
public int enable { get; }
public Godot.Vector3 position { get; }
public int Enable { get; }
public Vector3 Position { get; }
public VmcExtSetEye(godotOscSharp.OscMessage m) : base(m.Address)
public VmcExtSetEye(OscMessage m) : base(m.Address)
{
if (m.Data.Count != 4)
{
@ -54,23 +53,23 @@ namespace godotVmcSharp
GD.Print(InvalidArgumentType.GetErrorString(addr, "p.z", 'f', m.Data[3].Type));
return;
}
enable = (int)m.Data[0].Value;
position = new Godot.Vector3((float)m.Data[1].Value, (float)m.Data[2].Value, (float)m.Data[3].Value);
Enable = (int)m.Data[0].Value;
Position = new Vector3((float)m.Data[1].Value, (float)m.Data[2].Value, (float)m.Data[3].Value);
}
public VmcExtSetEye(int _enable, Godot.Vector3 _position) : base(new godotOscSharp.Address("/VMC/Ext/Set/Eye"))
public VmcExtSetEye(int enable, Vector3 position) : base(new OscAddress("/VMC/Ext/Set/Eye"))
{
enable = _enable;
position = _position;
Enable = enable;
Position = position;
}
public godotOscSharp.OscMessage ToMessage()
public new OscMessage ToMessage()
{
return new godotOscSharp.OscMessage(addr, new List<godotOscSharp.OscArgument>{
new godotOscSharp.OscArgument(enable, 'i'),
new godotOscSharp.OscArgument(position.X, 'f'),
new godotOscSharp.OscArgument(position.Y, 'f'),
new godotOscSharp.OscArgument(position.Z, 'f'),
return new OscMessage(addr, new System.Collections.Generic.List<OscArgument>{
new OscArgument(Enable, 'i'),
new OscArgument(Position.X, 'f'),
new OscArgument(Position.Y, 'f'),
new OscArgument(Position.Z, 'f'),
});
}
}

View File

@ -18,20 +18,19 @@
using Godot;
using godotOscSharp;
using System.Collections.Generic;
namespace godotVmcSharp
{
public class VmcExtSetPeriod : VmcMessage
{
public int status { get; }
public int root { get; }
public int bone { get; }
public int blendShape { get; }
public int camera { get; }
public int devices { get; }
public int Status { get; }
public int Root { get; }
public int Bone { get; }
public int BlendShape { get; }
public int Camera { get; }
public int Devices { get; }
public VmcExtSetPeriod(godotOscSharp.OscMessage m) : base(m.Address)
public VmcExtSetPeriod(OscMessage m) : base(m.Address)
{
if (m.Data.Count != 6)
{
@ -68,33 +67,33 @@ namespace godotVmcSharp
GD.Print(InvalidArgumentType.GetErrorString(addr, "devices", 'i', m.Data[5].Type));
return;
}
status = (int)m.Data[0].Value;
root = (int)m.Data[1].Value;
bone = (int)m.Data[2].Value;
blendShape = (int)m.Data[3].Value;
camera = (int)m.Data[4].Value;
devices = (int)m.Data[5].Value;
Status = (int)m.Data[0].Value;
Root = (int)m.Data[1].Value;
Bone = (int)m.Data[2].Value;
BlendShape = (int)m.Data[3].Value;
Camera = (int)m.Data[4].Value;
Devices = (int)m.Data[5].Value;
}
public VmcExtSetPeriod(int _status, int _root, int _bone, int _blendShape, int _camera, int _devices) : base(new godotOscSharp.Address("/VMC/Ext/Set/Period"))
public VmcExtSetPeriod(int status, int root, int bone, int blendShape, int camera, int devices) : base(new OscAddress("/VMC/Ext/Set/Period"))
{
status = _status;
root = _root;
bone = _bone;
blendShape = _blendShape;
camera = _camera;
devices = _devices;
Status = status;
Root = root;
Bone = bone;
BlendShape = blendShape;
Camera = camera;
Devices = devices;
}
public godotOscSharp.OscMessage ToMessage()
public new OscMessage ToMessage()
{
return new godotOscSharp.OscMessage(addr, new List<godotOscSharp.OscArgument>{
new godotOscSharp.OscArgument(status, 'i'),
new godotOscSharp.OscArgument(root, 'i'),
new godotOscSharp.OscArgument(bone, 'i'),
new godotOscSharp.OscArgument(blendShape, 'i'),
new godotOscSharp.OscArgument(camera, 'i'),
new godotOscSharp.OscArgument(devices, 'i'),
return new OscMessage(addr, new System.Collections.Generic.List<OscArgument>{
new OscArgument(Status, 'i'),
new OscArgument(Root, 'i'),
new OscArgument(Bone, 'i'),
new OscArgument(BlendShape, 'i'),
new OscArgument(Camera, 'i'),
new OscArgument(Devices, 'i'),
});
}
}

View File

@ -18,15 +18,15 @@
using Godot;
using godotOscSharp;
using System.Collections.Generic;
namespace godotVmcSharp
{
public class VmcExtSetRes : VmcMessage
{
public string response { get; }
public string Response { get; }
public VmcExtSetRes(godotOscSharp.OscMessage m) : base(m.Address)
public VmcExtSetRes(OscMessage m) : base(m.Address)
{
if (m.Data.Count != 1)
{
@ -38,17 +38,17 @@ namespace godotVmcSharp
GD.Print(InvalidArgumentType.GetErrorString(addr, "response", 's', m.Data[0].Type));
return;
}
response = (string)m.Data[0].Value;
Response = (string)m.Data[0].Value;
}
public VmcExtSetRes(string _response) : base(new godotOscSharp.Address("/VMC/Ext/Set/Res"))
public VmcExtSetRes(string response) : base(new OscAddress("/VMC/Ext/Set/Res"))
{
response = _response;
Response = response;
}
public godotOscSharp.OscMessage ToMessage()
public new OscMessage ToMessage()
{
return new godotOscSharp.OscMessage(addr, new List<godotOscSharp.OscArgument>{new godotOscSharp.OscArgument(response, 's')});
return new OscMessage(addr, new System.Collections.Generic.List<OscArgument>{new OscArgument(Response, 's')});
}
}
}

View File

@ -18,7 +18,6 @@
using Godot;
using godotOscSharp;
using System.Collections.Generic;
namespace godotVmcSharp
{
@ -26,7 +25,7 @@ namespace godotVmcSharp
{
public string shortcut { get; }
public VmcExtSetShortcut(godotOscSharp.OscMessage m) : base(m.Address)
public VmcExtSetShortcut(OscMessage m) : base(m.Address)
{
if (m.Data.Count != 1)
{
@ -41,14 +40,14 @@ namespace godotVmcSharp
shortcut = (string)m.Data[0].Value;
}
public VmcExtSetShortcut(string _shortcut) : base(new godotOscSharp.Address("/VMC/Ext/Set/Shortcut"))
public VmcExtSetShortcut(string _shortcut) : base(new OscAddress("/VMC/Ext/Set/Shortcut"))
{
shortcut = _shortcut;
}
public godotOscSharp.OscMessage ToMessage()
public new OscMessage ToMessage()
{
return new godotOscSharp.OscMessage(addr, new List<godotOscSharp.OscArgument>{new godotOscSharp.OscArgument(shortcut, 's')});
return new OscMessage(addr, new System.Collections.Generic.List<OscArgument>{new OscArgument(shortcut, 's')});
}
}
}

View File

@ -56,7 +56,7 @@ namespace godotVmcSharp
color = new Godot.Color((float)m.Data[0].Value, (float)m.Data[1].Value, (float)m.Data[2].Value, (float)m.Data[3].Value);
}
public VmcExtSettingColor(Godot.Color _color) : base(new godotOscSharp.Address("/VMC/Ext/Setting/Color"))
public VmcExtSettingColor(Godot.Color _color) : base(new godotOscSharp.OscAddress("/VMC/Ext/Setting/Color"))
{
color = _color;
}

View File

@ -82,7 +82,7 @@ namespace godotVmcSharp
hideBorder = (int)m.Data[3].Value;
}
public VmcExtSettingWin(int _isTopMost, int _isTransparent, int _windowClickThrough, int _hideBorder) : base(new godotOscSharp.Address("/VMC/Ext/Setting/Win"))
public VmcExtSettingWin(int _isTopMost, int _isTransparent, int _windowClickThrough, int _hideBorder) : base(new godotOscSharp.OscAddress("/VMC/Ext/Setting/Win"))
{
if (_isTopMost < 0 || _isTopMost > 1)
{

View File

@ -39,7 +39,7 @@ namespace godotVmcSharp
time = (float)m.Data[0].Value;
}
public VmcExtT(float _time) : base(new godotOscSharp.Address("/VMC/Ext/T"))
public VmcExtT(float _time) : base(new godotOscSharp.OscAddress("/VMC/Ext/T"))
{
time = _time;
}

View File

@ -72,13 +72,13 @@ namespace godotVmcSharp
}
}
public VmcExtVrm(string _path, string _title) : base(new godotOscSharp.Address("/VMC/Ext/VRM"))
public VmcExtVrm(string _path, string _title) : base(new godotOscSharp.OscAddress("/VMC/Ext/VRM"))
{
path = _path;
title = _title;
}
public VmcExtVrm(string _path, string _title, string _hash) : base(new godotOscSharp.Address("/VMC/Ext/VRM"))
public VmcExtVrm(string _path, string _title, string _hash) : base(new godotOscSharp.OscAddress("/VMC/Ext/VRM"))
{
path = _path;
title = _title;

View File

@ -22,9 +22,9 @@ namespace godotVmcSharp
{
public class VmcMessage
{
public godotOscSharp.Address addr { get; }
public godotOscSharp.OscAddress addr { get; }
public VmcMessage(godotOscSharp.Address address)
public VmcMessage(godotOscSharp.OscAddress address)
{
addr = address;
}