Skip to content

Commit

Permalink
feat: adding the ability to clear primitives
Browse files Browse the repository at this point in the history
  • Loading branch information
dbirman committed Sep 10, 2023
1 parent 70a1abb commit 7591bfb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
7 changes: 6 additions & 1 deletion API/oursin/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,9 @@ def clear_volumes():
def clear_texts():
"""Clear all text
"""
client.sio.emit('Clear', 'texts')
client.sio.emit('Clear', 'texts')

def clear_primitives():
"""Clear all primitives
"""
client.sio.emit('Clear','primitives')
3 changes: 3 additions & 0 deletions UnityClient/Assets/Scripts/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,9 @@ private void Clear(string val)
case "texts":
_textManager.Clear();
break;
case "primitives":
_primitiveMeshManager.Clear();
break;
}
}

Expand Down
9 changes: 9 additions & 0 deletions UnityClient/Assets/Scripts/Managers/PrimitiveMeshManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ private void Awake()
}
}

public void Clear()
{
foreach (var kvp in _primMeshRenderers)
{
Destroy(kvp.Value.gameObject);
}
_primMeshRenderers.Clear();
}

public void DeleteMesh(List<string> meshes)
{
foreach (string mesh in meshes)
Expand Down

0 comments on commit 7591bfb

Please sign in to comment.