Compare commits

..

3 Commits

Author SHA1 Message Date
izzy lyseggen 03f94d6371 fix(convert): breps and dates (#87) 2022-03-28 15:03:27 +01:00
izzy lyseggen c220337aec chore: upgrade specklepy and add Blender v3.1 to ci (#86)
* chore(specklepy): upgrade to 2.6.3

* ci: add py 3.10 for blender 3.1
2022-03-28 11:47:56 +01:00
izzy lyseggen 1b67304cfc fix(converter): skip if not Pincipled BSDF (#85) 2022-03-09 11:07:35 +00:00
7 changed files with 38 additions and 33 deletions
+16 -5
View File
@@ -20,8 +20,8 @@ jobs:
- checkout
- attach_workspace:
at: ./
- run:
name: Install specklepy with python 3.7
- run:
name: Install specklepy with python 3.7 for Blender v2.93
shell: powershell.exe
command: |
$pyarr=(python --version).split(' ')[1].split('.')
@@ -29,8 +29,8 @@ jobs:
echo "using python version:" $pyver
$specklepy=(python patch_version.py)
python -m pip install --target=./modules-$pyver specklepy==$specklepy
- run:
name: Install python 3.9 and specklepy
- run:
name: Install python 3.9 and specklepy for Blender v3.0
shell: powershell.exe
command: |
choco upgrade python --version=3.9.7
@@ -40,6 +40,17 @@ jobs:
echo "using python version:" $pyver
$specklepy=(python patch_version.py)
py -m pip install --target=./modules-$pyver specklepy==$specklepy
- run:
name: Install python 3.10 and specklepy for Blender v3.1
shell: powershell.exe
command: |
choco upgrade python --version=3.10.2
refreshenv
$pyarr=(py --version).split(' ')[1].split('.')
$pyver=($pyarr[0..1] -join '.')
echo "using python version:" $pyver
$specklepy=(python patch_version.py)
py -m pip install --target=./modules-$pyver specklepy==$specklepy
- run:
name: Patch
shell: powershell.exe
@@ -80,7 +91,7 @@ jobs:
root: ./
paths:
- modules-*
get-ci-tools: # Clones our ci tools and persists them to the workspace
docker:
- image: cimg/base:2021.01
-10
View File
@@ -17,7 +17,6 @@ SUPPORTED_CURVES = (Line, Polyline, Curve, Arc, Polycurve)
CAN_CONVERT_TO_NATIVE = (
Mesh,
Brep,
*SUPPORTED_CURVES,
Transform,
BlockDefinition,
@@ -71,8 +70,6 @@ def convert_to_native(speckle_object, name=None):
try:
if speckle_type is Mesh:
obj_data = mesh_to_native(speckle_object, name=speckle_name, scale=scale)
elif speckle_type is Brep:
obj_data = brep_to_native(speckle_object, name=speckle_name, scale=scale)
elif speckle_type in SUPPORTED_CURVES:
obj_data = icurve_to_native(speckle_object, name=speckle_name, scale=scale)
elif speckle_type is Transform:
@@ -115,13 +112,6 @@ def convert_to_native(speckle_object, name=None):
return blender_object
def brep_to_native(speckle_brep, name, scale=1.0):
display = getattr(
speckle_brep, "displayMesh", getattr(speckle_brep, "displayValue", None)
)
return mesh_to_native(display, name, scale) if display else None
def mesh_to_native(speckle_mesh, name, scale=1.0):
if name in bpy.data.meshes.keys():
+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)
+2 -1
View File
@@ -6,6 +6,7 @@ from bpy_speckle.functions import _report
from bpy_speckle.clients import speckle_clients
from specklepy.api.client import SpeckleClient
from specklepy.api.credentials import get_local_accounts
from datetime import datetime
class LoadUsers(bpy.types.Operator):
@@ -81,7 +82,7 @@ def add_user_stream(user, stream):
commit.message = c.message or ""
commit.author_name = c.authorName
commit.author_id = c.authorId
commit.created_at = c.createdAt
commit.created_at = datetime.strftime(c.createdAt, "%Y-%m-%d %H:%M:%S.%f%Z")
commit.source_application = str(c.sourceApplication)
if hasattr(s, "baseProperties"):
+6 -8
View File
@@ -12,7 +12,7 @@ from bpy.props import (
EnumProperty,
)
import datetime
from datetime import datetime
"""
Compatibility
@@ -177,7 +177,7 @@ class VIEW3D_PT_SpeckleActiveStream(bpy.types.Panel):
stream = user.streams[user.active_stream]
# user.active_stream = min(user.active_stream, len(user.streams) - 1)
row = col.row()
row.label(text="{} ({})".format(stream.name, stream.id))
row.label(text=f"{stream.name} ({stream.id})")
row.operator("speckle.stream_copy_id", text="", icon="COPY_ID")
col.separator()
@@ -205,13 +205,11 @@ class VIEW3D_PT_SpeckleActiveStream(bpy.types.Panel):
row.label(text=line)
area.separator()
dt = datetime.datetime.strptime(
commit.created_at, "%Y-%m-%dT%H:%M:%S.%fZ"
)
col.label(text="{}".format(dt.ctime()))
col.label(
text="{} ({})".format(commit.author_name, commit.author_id)
dt = datetime.strptime(
commit.created_at, "%Y-%m-%d %H:%M:%S.%f%Z"
)
col.label(text=f"{dt.ctime()}")
col.label(text=f"{commit.author_name} ({commit.author_id})")
col.label(text=commit.source_application)
else:
col.label(text="No branches found!")
Generated
+7 -7
View File
@@ -273,7 +273,7 @@ typing-extensions = {version = ">=3.7.4.3", markers = "python_version < \"3.8\""
[[package]]
name = "gql"
version = "3.0.0"
version = "3.1.0"
description = "GraphQL client for Python"
category = "main"
optional = false
@@ -512,7 +512,7 @@ python-versions = ">=3.6"
[[package]]
name = "specklepy"
version = "2.6.0"
version = "2.6.3"
description = "The Python SDK for Speckle 2.0"
category = "main"
optional = false
@@ -633,8 +633,8 @@ testing = ["pytest (>=6)", "pytest-checkdocs (>=2.4)", "pytest-flake8", "pytest-
[metadata]
lock-version = "1.1"
python-versions = ">=3.7,<3.8"
content-hash = "1fbb640a545c9eb64fbad0eaa1025402af1bc4350d0cbefe010f990a9850f514"
python-versions = ">=3.7,<3.10"
content-hash = "d8608212eef2ce8f7f2e598556d2e6231572595e586121657f0c392409f4bf5b"
[metadata.files]
aiohttp = [
@@ -871,7 +871,7 @@ gitpython = [
{file = "GitPython-3.1.27.tar.gz", hash = "sha256:1c885ce809e8ba2d88a29befeb385fcea06338d3640712b59ca623c220bb5704"},
]
gql = [
{file = "gql-3.0.0.tar.gz", hash = "sha256:a21ff880a69caec8786be5cc6de7de6fc2f2b87547af8cd30746b9401ffd47b2"},
{file = "gql-3.1.0.tar.gz", hash = "sha256:4b33029e9214aabd2609f3457b8a158b29a3134b193998c9b701785ba31c7ed3"},
]
graphql-core = [
{file = "graphql-core-3.2.0.tar.gz", hash = "sha256:86e2a0be008bfde19ef78388de8a725a1d942a9190ca431c24a60837973803ce"},
@@ -1108,8 +1108,8 @@ smmap = [
{file = "smmap-5.0.0.tar.gz", hash = "sha256:c840e62059cd3be204b0c9c9f74be2c09d5648eddd4580d9314c3ecde0b30936"},
]
specklepy = [
{file = "specklepy-2.6.0-py3-none-any.whl", hash = "sha256:39a875828f94dbcc87616be96a2a2067d9dcd40cc0a0a8a98b678da1e7f7d5ce"},
{file = "specklepy-2.6.0.tar.gz", hash = "sha256:c74f936f5375a77e7a6b40776f633833c03cdfe712079dc5cb9531feaafa054b"},
{file = "specklepy-2.6.3-py3-none-any.whl", hash = "sha256:9f1db623877f7214e6434f255da6bb524f9cb73ef00574cbc3496c625b3074a1"},
{file = "specklepy-2.6.3.tar.gz", hash = "sha256:dfb15e3d8197f453823793c80033e9c49187bb2dc676f3723738858f42be12f1"},
]
svn = [
{file = "svn-1.0.1.tar.gz", hash = "sha256:55f81f07853cc1d66d4800b0cfe2d3376ff02361a2b2361459dc22a0fab95247"},
+1 -1
View File
@@ -7,7 +7,7 @@ license = "Apache-2.0"
[tool.poetry.dependencies]
python = ">=3.7,<3.10"
specklepy = "^2.6.0"
specklepy = "^2.6.3"
[tool.poetry.dev-dependencies]
devtools = "^0.6.1"