adds rendermaterial and rendermaterialproxy (#385)

This commit is contained in:
Dogukan Karatas
2025-02-18 17:03:08 +01:00
committed by GitHub
parent d1b6755997
commit b64dde152a
2 changed files with 41 additions and 0 deletions
+22
View File
@@ -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
+19
View File
@@ -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