diff --git a/RH-Engine/Program.cs b/RH-Engine/Program.cs
index f127687..d0988b9 100644
--- a/RH-Engine/Program.cs
+++ b/RH-Engine/Program.cs
@@ -106,11 +106,16 @@ namespace RH_Engine
Console.WriteLine(ReadPrefMessage(stream));
}
+ ///
+ /// gets the id of the object with the given name
+ ///
+ /// the name of the object
+ /// the network stream to send requests to
+ /// the create graphics object to create all the commands
+ /// the uuid of the object with the given name, null otherwise.
public static string GetId(string name, NetworkStream stream, CreateGraphics createGraphics)
{
- WriteTextMessage(stream, createGraphics.GetSceneInfoCommand());
- dynamic response = JsonConvert.DeserializeObject(ReadPrefMessage(stream));
- JArray children = response.data.data.data.children;
+ JArray children = GetChildren(stream, createGraphics);
foreach (dynamic child in children)
{
@@ -124,6 +129,41 @@ namespace RH_Engine
}
+ ///
+ /// gets all the children in the current scene
+ ///
+ /// the network stream to send requests to
+ /// the create graphics object to create all the commands
+ /// all the children objects in the current scene
+ public static JArray GetChildren(NetworkStream stream, CreateGraphics createGraphics)
+ {
+ WriteTextMessage(stream, createGraphics.GetSceneInfoCommand());
+ dynamic response = JsonConvert.DeserializeObject(ReadPrefMessage(stream));
+ return response.data.data.data.children;
+ }
+
+ ///
+ /// returns all objects in the current scene, as name-uuid tuples.
+ ///
+ /// the network stream to send requests to
+ /// the create graphics object to create all the commands
+ /// an array of name-uuid tuples for each object
+ public static (string,string)[] GetObjectsInScene(NetworkStream stream, CreateGraphics createGraphics)
+ {
+ JArray children = GetChildren(stream, createGraphics);
+ (string, string)[] res = new (string, string)[children.Count];
+
+ int i = 0;
+ foreach (dynamic child in children)
+ {
+ res[i] = (child.name, child.uuid);
+ i++;
+ }
+
+ return res;
+
+ }
+
}