Compare commits

...

6 Commits

Author SHA1 Message Date
izzy lyseggen 1b67304cfc fix(converter): skip if not Pincipled BSDF (#85) 2022-03-09 11:07:35 +00:00
izzy lyseggen 25a1ec1cd1 ci: fix py 3.9 package install (#83)
* ci: test upgrade py

* ci: how about now?

* ci: we did it! 💃
2022-02-23 16:42:01 +00:00
izzy lyseggen 8296e48c28 Merge pull request #81 from specklesystems/izzy/displayvals
fix(convert): new `displayValue` to native & specklepy update
2022-02-23 11:56:15 +00:00
izzy lyseggen ca81ac6fd6 feat(convert): list displayvals to native 2022-02-23 11:50:33 +00:00
izzy lyseggen 88212b94b6 fix(users): none commit bug 2022-02-23 11:50:21 +00:00
izzy lyseggen 3375a04007 chore: update specklepy 2022-02-23 11:06:56 +00:00
7 changed files with 498 additions and 339 deletions
+4 -3
View File
@@ -33,12 +33,13 @@ jobs:
name: Install python 3.9 and specklepy
shell: powershell.exe
command: |
choco install python --version=3.9.2
$pyarr=(C:\Python39\python.exe --version).split(' ')[1].split('.')
choco upgrade python --version=3.9.7
refreshenv
$pyarr=(py --version).split(' ')[1].split('.')
$pyver=($pyarr[0..1] -join '.')
echo "using python version:" $pyver
$specklepy=(python patch_version.py)
C:\Python39\python.exe -m pip install --target=./modules-$pyver specklepy==$specklepy
py -m pip install --target=./modules-$pyver specklepy==$specklepy
- run:
name: Patch
shell: powershell.exe
+7 -5
View File
@@ -28,10 +28,9 @@ CAN_CONVERT_TO_NATIVE = (
def can_convert_to_native(speckle_object):
if type(speckle_object) in CAN_CONVERT_TO_NATIVE:
return True
display = getattr(
if getattr(
speckle_object, "displayMesh", getattr(speckle_object, "displayValue", None)
)
if display:
):
return True
_report(f"Could not convert unsupported Speckle object: {speckle_object}")
@@ -43,8 +42,9 @@ def convert_to_native(speckle_object, name=None):
speckle_name = (
name
or getattr(speckle_object, "name", None)
or speckle_object.speckle_type + f" -- {speckle_object.id}"
or f"{speckle_object.speckle_type} -- {speckle_object.id}"
)
if speckle_type not in CAN_CONVERT_TO_NATIVE:
display = getattr(
speckle_object, "displayMesh", getattr(speckle_object, "displayValue", None)
@@ -55,9 +55,11 @@ def convert_to_native(speckle_object, name=None):
# add parent type here so we can use it as a blender custom prop
# not making it hidden, so it will get added on send as i think it might be helpful? can reconsider
if isinstance(display, list):
converted = []
for item in display:
item.parent_speckle_type = speckle_object.speckle_type
convert_to_native(item)
converted.append(convert_to_native(item))
return converted
else:
display.parent_speckle_type = speckle_object.speckle_type
return convert_to_native(display, speckle_name)
+6 -1
View File
@@ -245,10 +245,15 @@ def material_to_speckle(blender_object) -> RenderMaterial:
return
blender_mat = blender_object.data.materials[0]
if not blender_mat:
return
speckle_mat = RenderMaterial()
speckle_mat.name = blender_mat.name
if blender_mat.use_nodes is True:
if blender_mat.use_nodes is True and blender_mat.node_tree.nodes.get(
"Principled BSDF"
):
inputs = blender_mat.node_tree.nodes["Principled BSDF"].inputs
speckle_mat.diffuse = to_argb_int(inputs["Base Color"].default_value)
speckle_mat.emissive = to_argb_int(inputs["Emission"].default_value)
+4 -2
View File
@@ -25,7 +25,7 @@ from bpy_speckle.clients import speckle_clients
from bpy_speckle.operators.users import add_user_stream
from specklepy.api import operations
from specklepy.api.credentials import StreamWrapper
from specklepy.api.wrapper import StreamWrapper
from specklepy.api.resources.stream import Stream
from specklepy.transports.server import ServerTransport
from specklepy.objects.geometry import *
@@ -127,7 +127,9 @@ def bases_to_native(context, collections, scale, stream_id, func=None):
def base_to_native(context, base, scale, stream_id, col, existing, func=None):
new_objects = [convert_to_native(base)]
new_objects = convert_to_native(base)
if not isinstance(new_objects, list):
new_objects = [new_objects]
if hasattr(base, "properties") and base.properties is not None:
new_objects.extend(get_speckle_subobjects(base.properties, scale, base.id))
+1 -1
View File
@@ -78,7 +78,7 @@ def add_user_stream(user, stream):
for c in b.commits.items:
commit = branch.commits.add()
commit.id = commit.name = c.id
commit.message = c.message
commit.message = c.message or ""
commit.author_name = c.authorName
commit.author_id = c.authorId
commit.created_at = c.createdAt
Generated
+474 -325
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -6,8 +6,8 @@ authors = ["izzy lyseggen <izzy.lyseggen@gmail.com>"]
license = "Apache-2.0"
[tool.poetry.dependencies]
python = ">=3.7,<3.8"
specklepy = "^2.5.1"
python = ">=3.7,<3.10"
specklepy = "^2.6.0"
[tool.poetry.dev-dependencies]
devtools = "^0.6.1"