Skip to content

Commit

Permalink
Bumped Dependencies (#215)
Browse files Browse the repository at this point in the history
* Updated dependencies

* black + isort
  • Loading branch information
JR-Morgan authored Dec 11, 2024
1 parent 4995f02 commit a3aaf44
Show file tree
Hide file tree
Showing 20 changed files with 447 additions and 933 deletions.
4 changes: 3 additions & 1 deletion bpy_speckle/blender_commit_object_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
from bpy.types import ID, Collection, Object
from specklepy.objects.base import Base
from specklepy.objects.graph_traversal.commit_object_builder import (
ROOT, CommitObjectBuilder)
ROOT,
CommitObjectBuilder,
)
from specklepy.objects.other import Collection as SCollection

from bpy_speckle.functions import _report
Expand Down
1 change: 1 addition & 0 deletions bpy_speckle/clients.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Permanent handle on all user clients
"""

from specklepy.core.api.client import SpeckleClient

speckle_clients: list[SpeckleClient] = []
63 changes: 41 additions & 22 deletions bpy_speckle/convert/to_native.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,43 @@
from mathutils import Quaternion as MQuaternion
from mathutils import Vector as MVector
from specklepy.objects.base import Base
from specklepy.objects.geometry import (Arc, Circle, Curve, Ellipse, Line,
Mesh, Plane, Polycurve, Polyline)
from specklepy.objects.geometry import (
Arc,
Circle,
Curve,
Ellipse,
Line,
Mesh,
Plane,
Polycurve,
Polyline,
)
from specklepy.objects.other import BlockDefinition
from specklepy.objects.other import Collection as SCollection
from specklepy.objects.other import Instance, Transform

from bpy_speckle.convert.constants import (DISPLAY_VALUE_PROPERTY_ALIASES,
ELEMENTS_PROPERTY_ALIASES,
OBJECT_NAME_MAX_LENGTH,
OBJECT_NAME_NUMERAL_SEPARATOR,
OBJECT_NAME_SPECKLE_SEPARATOR,
SPECKLE_ID_LENGTH)
from bpy_speckle.convert.constants import (
DISPLAY_VALUE_PROPERTY_ALIASES,
ELEMENTS_PROPERTY_ALIASES,
OBJECT_NAME_MAX_LENGTH,
OBJECT_NAME_NUMERAL_SEPARATOR,
OBJECT_NAME_SPECKLE_SEPARATOR,
SPECKLE_ID_LENGTH,
)
from bpy_speckle.convert.util import ConversionSkippedException
from bpy_speckle.functions import (_report, get_default_traversal_func,
get_scale_length)

from .util import (add_colors, add_custom_properties, add_faces,
add_to_hierarchy, add_uv_coords, add_vertices,
get_render_material, get_vertex_color_material,
render_material_to_native)
from bpy_speckle.functions import _report, get_default_traversal_func, get_scale_length

from .util import (
add_colors,
add_custom_properties,
add_faces,
add_to_hierarchy,
add_uv_coords,
add_vertices,
get_render_material,
get_vertex_color_material,
render_material_to_native,
)

SUPPORTED_CURVES = (Line, Polyline, Curve, Arc, Polycurve, Ellipse, Circle)
CAN_CONVERT_TO_NATIVE = (
Expand Down Expand Up @@ -59,7 +76,9 @@ def can_convert_to_native(speckle_object: Base) -> bool:
return False


convert_instances_as: str = "" # HACK: This is hacky, we need a better way to pass settings down to the converter
convert_instances_as: str = (
"" # HACK: This is hacky, we need a better way to pass settings down to the converter
)


def set_convert_instances_as(value: str):
Expand Down Expand Up @@ -682,9 +701,9 @@ def instance_to_native_object(instance: Instance, scale: float) -> Object:
native_instance = create_new_object(None, name)
native_instance.empty_display_size = 0

converted_objects[
"__ROOT"
] = native_instance # we create a dummy root to avoid id conflicts, since revit definitions have displayValues, they are convertible
converted_objects["__ROOT"] = (
native_instance # we create a dummy root to avoid id conflicts, since revit definitions have displayValues, they are convertible
)
traversal_root = Base(elements=definition, id="__ROOT")

# Convert definition + "elements" on definition
Expand Down Expand Up @@ -758,9 +777,9 @@ def _instance_definition_to_native(
native_def["applicationId"] = definition.applicationId

converted_objects = {}
converted_objects[
"__ROOT"
] = native_def # we create a dummy root to avoid id conflicts, since revit definitions have displayValues, they are convertible
converted_objects["__ROOT"] = (
native_def # we create a dummy root to avoid id conflicts, since revit definitions have displayValues, they are convertible
)
dummyRoot = Base(elements=definition, id="__ROOT")

_deep_conversion(dummyRoot, converted_objects, True)
Expand Down
44 changes: 31 additions & 13 deletions bpy_speckle/convert/to_speckle.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,40 @@
from mathutils import Vector as MVector
from mathutils.geometry import interpolate_bezier
from specklepy.objects import Base
from specklepy.objects.geometry import (Box, Curve, Interval, Mesh, Point,
Polyline, Vector)
from specklepy.objects.other import (BlockDefinition, BlockInstance,
RenderMaterial, Transform)

from bpy_speckle.blender_commit_object_builder import \
BlenderCommitObjectBuilder
from bpy_speckle.convert.constants import (OBJECT_NAME_SPECKLE_SEPARATOR,
SPECKLE_ID_LENGTH)
from bpy_speckle.convert.util import (ConversionSkippedException,
get_blender_custom_properties,
make_knots, nurb_make_curve, to_argb_int)
from specklepy.objects.geometry import (
Box,
Curve,
Interval,
Mesh,
Point,
Polyline,
Vector,
)
from specklepy.objects.other import (
BlockDefinition,
BlockInstance,
RenderMaterial,
Transform,
)

from bpy_speckle.blender_commit_object_builder import BlenderCommitObjectBuilder
from bpy_speckle.convert.constants import (
OBJECT_NAME_SPECKLE_SEPARATOR,
SPECKLE_ID_LENGTH,
)
from bpy_speckle.convert.util import (
ConversionSkippedException,
get_blender_custom_properties,
make_knots,
nurb_make_curve,
to_argb_int,
)
from bpy_speckle.functions import _report

Units: str = "m" # The desired final units to send
UnitsScale: float = 1 # The scale factor conversions need to apply to position data to get to the desired units
UnitsScale: float = (
1 # The scale factor conversions need to apply to position data to get to the desired units
)

CAN_CONVERT_TO_SPECKLE = ("MESH", "CURVE", "EMPTY", "CAMERA", "FONT", "SURFACE", "META")

Expand Down
6 changes: 2 additions & 4 deletions bpy_speckle/functions.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
from typing import Callable

from specklepy.objects.base import Base
from specklepy.objects.graph_traversal.traversal import (GraphTraversal,
TraversalRule)
from specklepy.objects.units import (get_scale_factor_to_meters,
get_units_from_string)
from specklepy.objects.graph_traversal.traversal import GraphTraversal, TraversalRule
from specklepy.objects.units import get_scale_factor_to_meters, get_units_from_string

from bpy_speckle.convert.constants import ELEMENTS_PROPERTY_ALIASES

Expand Down
1 change: 1 addition & 0 deletions bpy_speckle/installer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Provides uniform and consistent path helpers for `specklepy`
"""

import os
import sys
from importlib import import_module, invalidate_caches
Expand Down
31 changes: 10 additions & 21 deletions bpy_speckle/operators/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
from .commit import DeleteCommit
from .misc import OpenSpeckleForum, OpenSpeckleGuide, OpenSpeckleTutorials
from .object import (DeleteObject, ResetObject, SelectIfHasCustomProperty,
SelectIfSameCustomProperty, UpdateObject,
UploadNgonsAsPolylines)
from .streams import (AddStreamFromURL, CopyBranchName, CopyCommitId,
CopyModelId, CopyStreamId, CreateStream, DeleteStream,
ReceiveStreamObjects, SelectOrphanObjects,
SendStreamObjects, ViewStreamDataApi)
from .streams import (
AddStreamFromURL,
CopyCommitId,
CopyModelId,
CopyStreamId,
CreateStream,
ReceiveStreamObjects,
SendStreamObjects,
ViewStreamDataApi,
)
from .users import LoadUsers, LoadUserStreams, ResetUsers

operator_classes = [
Expand All @@ -17,28 +20,14 @@
LoadUserStreams,
CopyStreamId,
CopyCommitId,
CopyBranchName,
CopyModelId,
]

operator_classes.extend([DeleteCommit])

operator_classes.extend(
[
UpdateObject,
ResetObject,
DeleteObject,
UploadNgonsAsPolylines,
SelectIfSameCustomProperty,
SelectIfHasCustomProperty,
]
)

operator_classes.extend(
[
ViewStreamDataApi,
DeleteStream,
SelectOrphanObjects,
AddStreamFromURL,
CreateStream,
OpenSpeckleGuide,
Expand Down
1 change: 1 addition & 0 deletions bpy_speckle/operators/commit.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Commit operators
"""

import bpy
from bpy.props import BoolProperty
from specklepy.logging import metrics
Expand Down
Loading

0 comments on commit a3aaf44

Please sign in to comment.