Skip to content

Commit

Permalink
feat: CNX-19 adds render material proxy class (#50)
Browse files Browse the repository at this point in the history
* adds render material proxy class

* Update RenderMaterial.cs

* Update RenderMaterial.cs

* refactors IProxyCollection interface

* Update RenderMaterial.cs
  • Loading branch information
clairekuang authored Jul 24, 2024
1 parent 059253f commit ce3e591
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 7 deletions.
5 changes: 4 additions & 1 deletion src/Speckle.Core/Models/Instances/GroupProxy.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Speckle.Core.Models.Instances;
namespace Speckle.Core.Models.Instances;

/// <summary>
/// Grouped objects with a meaningful way for host application so use this proxy if you want to group object references for any purpose.
Expand All @@ -8,5 +8,8 @@ public class GroupProxy : Base, IProxyCollection
{
public List<string> objects { get; set; }

/// <summary>
/// Name of the group proxy collection which is unique for rhino, autocad and sketchup
/// </summary>
public string name { get; set; }
}
7 changes: 1 addition & 6 deletions src/Speckle.Core/Models/Instances/IProxyCollection.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Speckle.Core.Models.Instances;
namespace Speckle.Core.Models.Instances;

/// <summary>
/// Collection to proxy objects that lies in definitions, groups or whatever logic in the host app.
Expand All @@ -10,9 +10,4 @@ public interface IProxyCollection
/// On receive, they will be mapped to corresponding newly created definition ids.
/// </summary>
public List<string> objects { get; set; }

/// <summary>
/// Name of the proxy collection which is unique for rhino, autocad and sketchup
/// </summary>
public string name { get; set; }
}
3 changes: 3 additions & 0 deletions src/Speckle.Core/Models/Instances/InstanceDefinitionProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,8 @@ public class InstanceDefinitionProxy : Base, IInstanceComponent, IProxyCollectio

public int maxDepth { get; set; }

/// <summary>
/// Name of the instance definition proxy collection which is unique for rhino, autocad and sketchup
/// </summary>
public string name { get; set; }
}
25 changes: 25 additions & 0 deletions src/Speckle.Objects/Other/RenderMaterial.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Drawing;
using Speckle.Core.Kits;
using Speckle.Core.Models;
using Speckle.Core.Models.Instances;
using Speckle.Newtonsoft.Json;

namespace Objects.Other;
Expand Down Expand Up @@ -58,3 +59,27 @@ public Color emissiveColor
set => diffuse = value.ToArgb();
}
}

/// <summary>
/// Used to store render material to object relationships in root collections
/// </summary>
public class RenderMaterialProxy : Base, IProxyCollection
{
public RenderMaterialProxy() { }

public RenderMaterialProxy(RenderMaterial renderMaterial, List<string> objects)
{
value = renderMaterial;
this.objects = objects;
}

/// <summary>
/// The list of application ids of objects that use this render material
/// </summary>
public List<string> objects { get; set; }

/// <summary>
/// The render material used by <see cref="objects"/>
/// </summary>
public RenderMaterial value { get; set; }
}

0 comments on commit ce3e591

Please sign in to comment.