RenderMaterialProxy

This commit is contained in:
KatKatKateryna
2024-12-06 18:41:48 +00:00
parent 71ca5318b6
commit 0fcc3053ca
2 changed files with 35 additions and 0 deletions
+12
View File
@@ -37,6 +37,18 @@ class RenderMaterial(Base, speckle_type=OTHER + "RenderMaterial"):
emissive: int = -16777216 # black arbg
class RenderMaterialProxy(
Base,
speckle_type="Speckle.Core.Models.Proxies.RenderMaterialProxy",
):
"""
Used to store render material to object relationships in root collections.
"""
objects: list[str]
value: RenderMaterial
class Transform(
Base,
speckle_type=OTHER + "Transform",
+23
View File
@@ -2,6 +2,7 @@
import pytest
from specklepy.core.api.models.proxies import ColorProxy, GroupProxy
from specklepy.objects.other import RenderMaterial, RenderMaterialProxy
@pytest.fixture()
@@ -16,6 +17,18 @@ def group_proxy():
return GroupProxy(objects=["app_id_1", "app_id_2"], name="group_proxy_name")
@pytest.fixture()
def material():
return RenderMaterial(
name="name", opacity=0.3, metalness=0, roughness=0, diffuse=1, emissive=1
)
@pytest.fixture()
def material_proxy():
return RenderMaterialProxy(objects=["app_id_1", "app_id_2"], value=material())
def test_create_color_proxy():
try:
ColorProxy(objects="", value=2, name="") # wrong type
@@ -34,3 +47,13 @@ def test_create_group_proxy():
assert True
except:
assert False
def test_create_material_proxy():
try:
RenderMaterialProxy(objects="", name="") # wrong type
assert False
except TypeError:
assert True
except:
assert False