Skip to content

Commit

Permalink
1.1.5 add niceName description and fix color check
Browse files Browse the repository at this point in the history
  • Loading branch information
benkuper committed Oct 2, 2024
1 parent b525de9 commit dc45230
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 6 deletions.
40 changes: 37 additions & 3 deletions Runtime/OSCQuery.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -370,7 +370,9 @@ JSONObject getObjectData(GameObject go, string baseAddress = "")
{
string ioName = SanitizeName(info.Name);
string fullPath = compAddress + "/" + ioName;

io.SetField("FULL_PATH", fullPath);
io.SetField("DESCRIPTION", getNiceName(info.Name));
ccco.SetField(ioName, io);
compInfoMap.Add(fullPath, new CompInfo(comp, info));
}
Expand Down Expand Up @@ -402,6 +404,7 @@ JSONObject getObjectData(GameObject go, string baseAddress = "")
string ioName = SanitizeName(info.Name);
string fullPath = compAddress + "/" + ioName;
io.SetField("FULL_PATH", fullPath);
io.SetField("DESCRIPTION", getNiceName(info.Name));
ccco.SetField(SanitizeName(info.Name), io);
compInfoMap.Add(fullPath, new CompInfo(comp, info));
}
Expand All @@ -421,6 +424,7 @@ JSONObject getObjectData(GameObject go, string baseAddress = "")
{
string sName = SanitizeName(p.name);
string fullPath = compAddress + "/" + sName;
io.SetField("DESCRIPTION", getNiceName(p.name));
io.SetField("FULL_PATH", fullPath);
ccco.SetField(SanitizeName(sName), io);
compInfoMap.Add(fullPath, new CompInfo(comp as VisualEffect, p.name, p.type));
Expand Down Expand Up @@ -460,6 +464,7 @@ JSONObject getObjectData(GameObject go, string baseAddress = "")
string fullPath = compAddress + "/" + ioName;
mo.SetField("TYPE", "N");
mo.SetField("FULL_PATH", fullPath);
mo.SetField("DESCRIPTION", getNiceName(info.Name));
ccco.SetField(ioName, mo);
compInfoMap.Add(fullPath, new CompInfo(comp, info));

Expand Down Expand Up @@ -868,8 +873,12 @@ void sendFeedback(string address, WSQuery query)
case "Vector4":
{
Color color = dataType == "Color" ? (Color)data : (Color)(Vector4)data;
Color oldColor = dataType == "Color" ? (Color)oldData : (Color)(Vector4)oldData;
if (oldData != null && color == (Color)oldColor) return;

if (oldData != null)
{
Color oldColor = dataType == "Color" ? (Color)oldData : (Color)(Vector4)oldData;
if(color == oldColor) return;
}
m.Append(color.r);
m.Append(color.g);
m.Append(color.b);
Expand Down Expand Up @@ -994,5 +1003,30 @@ float getFloatArg(object data)
{
return (data is int) ? (float)(int)data : (float)data;
}

string getNiceName(string name)
{
string niceName = "";
for (int i = 0; i < name.Length; i++)
{
if (i == 0)
{
niceName += char.ToUpper(name[i]);
}
else if (char.IsUpper(name[i]))
{
if (char.IsLower(name[i - 1]))
{
niceName += " ";
}
niceName += name[i];
}
else
{
niceName += name[i];
}
}
return niceName;
}
}
}
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"license": "GPL v3",
"name": "com.benkuper.oscquery",
"repository": "github:benkper/Unity-OSCQuery",
"unity": "2018.3",
"unityRelease": "0f1",
"version": "1.1.4"
"unity": "2023.2",
"unityRelease": "20f1",
"version": "1.1.5"
}

0 comments on commit dc45230

Please sign in to comment.