Compare commits

...

43 Commits

Author SHA1 Message Date
izzy lyseggen 409adda784 Merge pull request #77 from specklesystems/izzy/nulls-fix
fix(convert): nulls on receive
2022-01-03 17:11:40 +00:00
izzylys f5f1c6a8d0 fix(convert): handle list display val 2022-01-03 17:09:57 +00:00
izzylys 1eca91a030 chore: bump specklepy 2022-01-03 17:09:29 +00:00
izzy lyseggen 6b872f11d9 Merge pull request #75 from specklesystems/izzy/add-parent-type
feat(convert): add parent type to display meshes
2021-12-09 10:59:28 +00:00
izzy lyseggen fd3742b800 feat(convert): add parent type to display meshes
makes it easier to work w geo from places like revit
2021-12-09 10:58:22 +00:00
izzy lyseggen 870174a969 Merge pull request #73 from specklesystems/ci/fix-install-platform
ci: fix install platform
2021-12-07 16:26:58 +00:00
izzy lyseggen 2c6dfcb340 ci: grab py version to ensure all is working 2021-12-07 16:22:42 +00:00
izzy lyseggen 4d3eacbe52 ci: no need to persist now i think 2021-12-07 16:05:51 +00:00
izzy lyseggen df7d631b54 ci: bump to 3.9.2 2021-12-07 16:05:23 +00:00
izzy lyseggen 07ceb07058 ci: try ths install again! 2021-12-07 16:01:16 +00:00
izzy lyseggen 112bc56ded ci: remove install specklepy step 2021-12-07 15:54:59 +00:00
izzy lyseggen 88e2744e93 ci: test in win exe 2021-12-07 15:53:52 +00:00
izzy lyseggen ad1c201c79 Merge pull request #72 from specklesystems/ci/install-changes
ci: preinstall specklepy
2021-12-07 14:54:26 +00:00
Gergő Jedlicska e18569f738 (ci) wait for install 2021-12-07 15:18:03 +01:00
Gergő Jedlicska f7e563f500 (ci) new glob 2021-12-07 15:15:13 +01:00
Gergő Jedlicska 7e56c21395 (ci) what is attached? 2021-12-07 15:01:47 +01:00
Gergő Jedlicska 30b701ee27 Merge branch 'ci/install-changes' of github.com:specklesystems/speckle-blender into ci/install-changes 2021-12-07 14:48:50 +01:00
Gergő Jedlicska 3cdbc09fc0 (ci) update job order 2021-12-07 14:48:43 +01:00
Gergő Jedlicska 656e41f03c (ci) update job order 2021-12-07 14:41:09 +01:00
Gergő Jedlicska 7da26e44b6 Update config.yml
try with glob pattern
2021-12-07 14:27:30 +01:00
izzy lyseggen 830ba842e0 ci: remove unecessary steps 2021-12-07 13:01:31 +00:00
izzy lyseggen d38f990e75 ci: fix modules path 2021-12-07 12:42:51 +00:00
izzy lyseggen c01836806c ci: persist to workspace 2021-12-07 12:38:20 +00:00
izzy lyseggen bf416dd228 ci: remove pip upgrade step? 2021-12-07 12:28:48 +00:00
izzy lyseggen a2e2c489b4 ci: change branch filter 2021-12-07 12:17:12 +00:00
izzy lyseggen c40c2d7955 ci: add specklepy install step 2021-12-07 12:08:37 +00:00
izzy lyseggen b45aa0d6c1 chore: return specklepy V in patch script w no arg
should allow us to grab the version for manual specklepy install in the ci env
2021-12-07 12:07:27 +00:00
izzy lyseggen 667616b1fb Merge pull request #68 from specklesystems/izzy/bump-deps
chore: bump to specklepy 2.4.2
2021-11-30 11:56:52 +00:00
izzy lyseggen 87cb69090a chore: bump to specklepy 2.4.2
attempting to resolve Plugin activation error due to `typing_extensions` #67
2021-11-30 11:56:10 +00:00
izzy lyseggen 4a8a0ca6c7 Merge pull request #66 from specklesystems/jm/ngons
Ngon Support
2021-11-29 10:54:20 +00:00
izzy lyseggen 3c0d1eba65 style: remove old comment re face error
(was resolved in #35)
2021-11-29 10:52:02 +00:00
JR-Morgan 14aaf4f064 N-gon ToSpeckle should now work! 2021-11-25 16:54:35 +00:00
JR-Morgan 10bf3e3af5 Experimenting with n-gon sending 2021-11-25 13:55:18 +00:00
izzy lyseggen 936d573510 Merge pull request #63 from specklesystems/izzy/read-receipts
feat(streams): add read reciepts + update to specklepy 2.4
2021-11-15 11:17:33 +00:00
izzy lyseggen 1f886202ec feat(streams): add commit received call 2021-11-15 11:14:51 +00:00
izzy lyseggen 479e5b5b98 fix(streams): update stream transport constructor 2021-11-15 11:14:29 +00:00
izzy lyseggen bed1ecf2cc chore: update specklepy to 2.4 2021-11-15 11:02:35 +00:00
izzy lyseggen a6cbce977f ci: remove pip install specklepy step 2021-10-14 17:07:08 +01:00
izzy lyseggen 376a90c5cf Merge pull request #59 from specklesystems/izzy/texture-coords
feat(convert): texture coords out and material receive fix
2021-10-14 18:03:52 +02:00
izzy lyseggen b0f8dbd63e fix(ui): diff fix for hiding globals
this is acting kinda weird, but it's taking up too much time for me
and it works as is so whatever
2021-10-14 17:03:19 +01:00
izzy lyseggen 89a8232a47 chore: update specklepy 2021-10-14 16:23:15 +01:00
izzy lyseggen 985f23b015 fix(convert): temp fix for materials w no name/id 2021-10-14 16:22:35 +01:00
izzy lyseggen d15a480e64 feat(uvs): try adding active uv layer 2021-10-14 16:22:35 +01:00
11 changed files with 857 additions and 334 deletions
+50 -31
View File
@@ -20,9 +20,25 @@ jobs:
- checkout
- attach_workspace:
at: ./
- run:
name: upgrade pip and install specklepy
command: python -m pip install --upgrade pip & python -m pip install --target=.\modules specklepy
- run:
name: Install specklepy with python 3.7
shell: powershell.exe
command: |
$pyarr=(python --version).split(' ')[1].split('.')
$pyver=($pyarr[0..1] -join '.')
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
shell: powershell.exe
command: |
choco install python --version=3.9.2
$pyarr=(C:\Python39\python.exe --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
- run:
name: Patch
shell: powershell.exe
@@ -36,13 +52,34 @@ jobs:
# only create the yml if we have a tag
New-Item -Force "speckle-sharp-ci-tools/Installers/blender/$channel.yml" -ItemType File -Value "version: $version"
echo $version
ls
python patch_version.py $version
speckle-sharp-ci-tools\InnoSetup\ISCC.exe speckle-sharp-ci-tools\blender.iss
- persist_to_workspace:
root: ./
paths:
- speckle-sharp-ci-tools/Installers
install-specklepy: # due to ujson dep, we need to match the py version to the install
docker:
- image: "cimg/python:<<parameters.tag>>"
parameters:
tag:
default: "3.9"
type: string
steps:
- checkout
- run:
name: upgrade pip and install specklepy
command: |
specklepyver=$(python patch_version.py)
echo installing specklepy $specklepyver
python -m pip install --target=./modules-<<parameters.tag>> specklepy==$specklepyver
- persist_to_workspace:
root: ./
paths:
- modules-*
get-ci-tools: # Clones our ci tools and persists them to the workspace
docker:
- image: cimg/base:2021.01
@@ -54,10 +91,6 @@ jobs:
root: ./
paths:
- speckle-sharp-ci-tools
- persist_to_workspace:
root: ./
paths:
- speckle-sharp-ci-tools
deploy: # Uploads all installers found to S3
docker:
@@ -77,41 +110,27 @@ jobs:
to: s3://speckle-releases/installers/
workflows:
build:
jobs:
- get-ci-tools:
filters:
branches:
only:
- main
- /ci\/.*/
- build-connector:
slug: blender
requires:
- get-ci-tools
filters:
branches:
only:
- main
- /ci\/.*/
deploy:
main:
jobs:
- get-ci-tools:
filters:
tags:
only: /[0-9]+(\.[0-9]+)*/
only: /.*/
branches:
ignore: /.*/ # For testing only! /ci\/.*/
only:
- main
- /ci\/.*/
- build-connector:
slug: blender
requires:
- get-ci-tools
filters:
tags:
only: /[0-9]+(\.[0-9]+)*/
only: /.*/
branches:
ignore: /.*/ # For testing only! /ci\/.*/
only:
- main
- /ci\/.*/
- deploy:
requires:
- get-ci-tools
+1
View File
@@ -5,6 +5,7 @@ __pycache__/
# editor
.vscode
.idea
# dev
.venv
+13 -6
View File
@@ -55,8 +55,7 @@ def add_blender_material(smesh, blender_object) -> None:
speckle_mat = getattr(smesh, "renderMaterial", None) or smesh["@renderMaterial"]
mat_name = getattr(speckle_mat, "name", None) or speckle_mat.__dict__.get("@name")
if not mat_name:
mat_name = speckle_mat.applicationId or speckle_mat.id
mat_name = speckle_mat.applicationId or speckle_mat.id or speckle_mat.get_id()
blender_mat = bpy.data.materials.get(mat_name)
if not blender_mat:
blender_mat = bpy.data.materials.new(mat_name)
@@ -209,17 +208,25 @@ def from_speckle_object(speckle_object, scale, name=None):
add_custom_properties(speckle_object, blender_object)
add_blender_material(speckle_object, blender_object)
# TODO: chat with tom re transforms
# TODO: transforms
# set_transform(speckle_object, blender_object)
return blender_object
# try display mesh
mesh = getattr(
display = getattr(
speckle_object, "displayMesh", getattr(speckle_object, "displayValue", None)
)
if mesh:
return from_speckle_object(mesh, scale, speckle_name)
if display:
# 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):
for item in display:
item.parent_speckle_type = speckle_object.speckle_type
from_speckle_object(item, scale)
else:
display.parent_speckle_type = speckle_object.speckle_type
return from_speckle_object(display, scale, speckle_name)
# return none if fail
_report("Invalid input: {}".format(speckle_object))
+11 -33
View File
@@ -24,40 +24,18 @@ def add_faces(smesh, bmesh, smooth=False):
if sfaces and len(sfaces) > 0:
i = 0
# TODO: why does `faces.new()` seem to fail so often?
while i < len(sfaces):
if sfaces[i] == 0:
i += 1
try:
f = bmesh.faces.new(
(
bmesh.verts[int(sfaces[i])],
bmesh.verts[int(sfaces[i + 1])],
bmesh.verts[int(sfaces[i + 2])],
)
)
f.smooth = smooth
except Exception as e:
_report(f"Failed to create face for mesh {smesh.id} \n{e}")
i += 3
elif sfaces[i] == 1:
i += 1
try:
f = bmesh.faces.new(
(
bmesh.verts[int(sfaces[i])],
bmesh.verts[int(sfaces[i + 1])],
bmesh.verts[int(sfaces[i + 2])],
bmesh.verts[int(sfaces[i + 3])],
)
)
f.smooth = smooth
except Exception as e:
_report(f"Failed to create face for mesh {smesh.id} \n{e}")
i += 4
else:
print("Invalid face length.\n" + str(sfaces[i]))
break
n = sfaces[i]
if n < 3:
n += 3 # 0 -> 3, 1 -> 4
i += 1
try:
f = bmesh.faces.new([bmesh.verts[int(x)] for x in sfaces[i : i + n]])
f.smooth = smooth
except Exception as e:
_report(f"Failed to create face for mesh {smesh.id} \n{e}")
i += n
bmesh.faces.ensure_lookup_table()
bmesh.verts.index_update()
+9 -5
View File
@@ -14,8 +14,6 @@ def export_mesh(blender_object, data, scale=1.0):
verts = [tuple(mat @ x.co * scale) for x in data.vertices]
# TODO: add n-gon support, using tessfaces for now
# faces = [x.vertices for x in data.loop_triangles]
faces = [p.vertices for p in data.polygons]
unit_system = bpy.context.scene.unit_settings.system
@@ -24,17 +22,23 @@ def export_mesh(blender_object, data, scale=1.0):
vertices=list(sum(verts, ())),
faces=[],
colors=[],
textureCoordinates=[],
units="m" if unit_system == "METRIC" else "ft",
bbox=Box(area=0.0, volume=0.0),
)
if data.uv_layers.active:
for vt in data.uv_layers.active.data:
sm.textureCoordinates.extend([vt.uv.x, vt.uv.y])
for f in faces:
if len(f) == 3:
n = len(f)
if n == 3:
sm.faces.append(0)
elif len(f) == 4:
elif n == 4:
sm.faces.append(1)
else:
continue
sm.faces.append(n)
sm.faces.extend(f)
return [sm]
+8 -2
View File
@@ -269,8 +269,14 @@ class ReceiveStreamObjects(bpy.types.Operator):
commit = branch.commits.items[int(bbranch.commit)]
transport = ServerTransport(client, stream.id)
transport = ServerTransport(stream.id, client)
stream_data = operations.receive(commit.referencedObject, transport)
client.commit.received(
bstream.id,
commit.id,
source_application="blender",
message="received commit from Speckle Blender",
)
"""
Create or get Collection for stream objects
@@ -434,7 +440,7 @@ class SendStreamObjects(bpy.types.Operator):
hierarchy = get_collection_hierarchy(collection)
create_nested_hierarchy(base, hierarchy, objects)
transport = ServerTransport(client, stream.id)
transport = ServerTransport(stream.id, client)
obj_id = operations.send(
base,
+1 -4
View File
@@ -79,10 +79,8 @@ def add_user_stream(user, stream):
if not stream.branches:
return
# branches = [branch for branch in stream.branches.items if branch.name != "globals"]
for b in stream.branches.items:
if b.name == "globals":
continue
branch = s.branches.add()
branch.name = b.name
@@ -132,7 +130,6 @@ class LoadUserStreams(bpy.types.Operator):
user.streams.clear()
streams = sorted(streams, key=lambda x: x.name, reverse=False)
default_units = "Meters"
for s in streams:
+2 -1
View File
@@ -48,10 +48,11 @@ class SpeckleBranchObject(bpy.types.PropertyGroup):
class SpeckleStreamObject(bpy.types.PropertyGroup):
def get_branches(self, context):
if len(self.branches) > 0:
if self.branches:
return [
(str(i), branch.name, branch.name, i)
for i, branch in enumerate(self.branches)
if branch.name != "globals"
]
return [("0", "<none>", "<none>", 0)]
+1
View File
@@ -50,6 +50,7 @@ def get_specklepy_version():
def main():
if len(sys.argv) < 2:
print(get_specklepy_version())
return
tag = sys.argv[1]
Generated
+758 -251
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -7,13 +7,15 @@ license = "Apache-2.0"
[tool.poetry.dependencies]
python = ">=3.7,<3.8"
specklepy = "2.3.4"
specklepy = "^2.5.1"
[tool.poetry.dev-dependencies]
devtools = "^0.6.1"
numpy = "^1.20.2"
bpy = "^2.82.1"
bpy-build = "^2.1.0"
black = "^21.12b0"
pylint = "^2.12.2"
[build-system]
requires = ["poetry-core>=1.0.0"]