Skip to content

Commit b64dde1

Browse files
adds rendermaterial and rendermaterialproxy (#385)
1 parent d1b6755 commit b64dde1

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

src/specklepy/objects/other.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from dataclasses import dataclass
2+
3+
from specklepy.objects.base import Base
4+
5+
6+
@dataclass(kw_only=True)
7+
class RenderMaterial(
8+
Base,
9+
speckle_type="Objects.Other.RenderMaterial",
10+
serialize_ignore={"diffuse", "emissive"},
11+
):
12+
"""
13+
Minimal physically based material DTO class. Based on references from
14+
https://threejs.org/docs/index.html#api/en/materials/MeshStandardMaterial
15+
"""
16+
17+
name: str
18+
opacity: float = 1.0
19+
metalness: float = 0.0
20+
roughness: float = 1.0
21+
diffuse: int # ARGB color as int
22+
emissive: int = 0 # ARGB color as int, defaults to black

src/specklepy/objects/proxies.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from specklepy.objects.base import Base
55
from specklepy.objects.interfaces import IHasUnits
6+
from specklepy.objects.other import RenderMaterial
67

78

89
@dataclass(kw_only=True)
@@ -46,3 +47,21 @@ class InstanceDefinitionProxy(
4647
objects: List[str]
4748
max_depth: int
4849
name: str
50+
51+
52+
@dataclass(kw_only=True)
53+
class RenderMaterialProxy(
54+
Base,
55+
speckle_type="Objects.Other.RenderMaterialProxy",
56+
detachable={"objects"},
57+
):
58+
"""
59+
used to store render material to object relationships in root collections
60+
61+
Args:
62+
objects (list): the list of application ids of objects used by render material
63+
value (RenderMaterial): the render material used by the objects
64+
"""
65+
66+
objects: List[str]
67+
value: RenderMaterial

0 commit comments

Comments
 (0)