Skip to content

Commit

Permalink
adds rendermaterial and rendermaterialproxy (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
dogukankaratas authored Feb 18, 2025
1 parent d1b6755 commit b64dde1
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/specklepy/objects/other.py
Original file line number Diff line number Diff line change
@@ -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 changes: 19 additions & 0 deletions src/specklepy/objects/proxies.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from specklepy.objects.base import Base
from specklepy.objects.interfaces import IHasUnits
from specklepy.objects.other import RenderMaterial


@dataclass(kw_only=True)
Expand Down Expand Up @@ -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

0 comments on commit b64dde1

Please sign in to comment.