RenderMaterialProxy
This commit is contained in:
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user