diff --git a/src/specklepy/objects/other.py b/src/specklepy/objects/other.py new file mode 100644 index 0000000..ec46f2e --- /dev/null +++ b/src/specklepy/objects/other.py @@ -0,0 +1,22 @@ +from dataclasses import dataclass + +from specklepy.objects.base import Base + + +@dataclass(kw_only=True) +class RenderMaterial( + Base, + speckle_type="Objects.Other.RenderMaterial", + serialize_ignore={"diffuse", "emissive"}, +): + """ + Minimal physically based material DTO class. Based on references from + https://threejs.org/docs/index.html#api/en/materials/MeshStandardMaterial + """ + + name: str + opacity: float = 1.0 + metalness: float = 0.0 + roughness: float = 1.0 + diffuse: int # ARGB color as int + emissive: int = 0 # ARGB color as int, defaults to black diff --git a/src/specklepy/objects/proxies.py b/src/specklepy/objects/proxies.py index c47e307..1712411 100644 --- a/src/specklepy/objects/proxies.py +++ b/src/specklepy/objects/proxies.py @@ -3,6 +3,7 @@ from typing import List, Optional from specklepy.objects.base import Base from specklepy.objects.interfaces import IHasUnits +from specklepy.objects.other import RenderMaterial @dataclass(kw_only=True) @@ -46,3 +47,21 @@ class InstanceDefinitionProxy( objects: List[str] max_depth: int name: str + + +@dataclass(kw_only=True) +class RenderMaterialProxy( + Base, + speckle_type="Objects.Other.RenderMaterialProxy", + detachable={"objects"}, +): + """ + used to store render material to object relationships in root collections + + Args: + objects (list): the list of application ids of objects used by render material + value (RenderMaterial): the render material used by the objects + """ + + objects: List[str] + value: RenderMaterial