Skip to content

Commit e37dd58

Browse files
author
eadf
committed
Fixed a python import issue
1 parent 90e0a33 commit e37dd58

File tree

5 files changed

+42
-33
lines changed

5 files changed

+42
-33
lines changed

blender_addon/hallr_2d_delaunay_triangulation.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import bpy
88
from . import hallr_ffi_utils
9-
from hallr_ffi_utils import MeshFormat
109

1110
# Define the choices for the search pattern property
1211
bounding_props_items = [
@@ -79,7 +78,8 @@ def execute(self, context):
7978
return {'CANCELLED'}
8079

8180
if settings.point_cloud is not None and bpy.context.active_object == settings.point_cloud:
82-
self.report({'ERROR'}, "This object is already selected as the point cloud. Please select a different object.")
81+
self.report({'ERROR'},
82+
"This object is already selected as the point cloud. Please select a different object.")
8383
return {'CANCELLED'}
8484

8585
settings.bounding_shape = bounding_shape
@@ -104,7 +104,8 @@ def execute(self, context):
104104
return {'CANCELLED'}
105105

106106
if settings.bounding_shape is not None and bpy.context.active_object == settings.bounding_shape:
107-
self.report({'ERROR'}, "This object is already selected as the bounding shape. Please select a different object.")
107+
self.report({'ERROR'},
108+
"This object is already selected as the bounding shape. Please select a different object.")
108109
return {'CANCELLED'}
109110

110111
settings.point_cloud = bpy.context.active_object
@@ -135,8 +136,8 @@ def execute(self, context):
135136
# Call the Rust function
136137
hallr_ffi_utils.process_mesh_with_rust(config, primary_object=point_cloud,
137138
secondary_object=bounding_shape,
138-
primary_format=MeshFormat.POINT_CLOUD,
139-
secondary_format=MeshFormat.POINT_CLOUD,
139+
primary_format=hallr_ffi_utils.MeshFormat.POINT_CLOUD,
140+
secondary_format=hallr_ffi_utils.MeshFormat.POINT_CLOUD,
140141
create_new=True)
141142
except Exception as e:
142143
import traceback

blender_addon/hallr_baby_shark_operators.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,9 @@
55
"""
66

77
import bpy
8-
import os
98
import bmesh
10-
from . import hallr_ffi_utils
11-
from hallr_ffi_utils import MeshFormat
12-
139
import os
10+
from . import hallr_ffi_utils
1411

1512
# Cache the boolean status of HALLR_ALLOW_NON_MANIFOLD (set or not)
1613
_DENY_NON_MANIFOLD = os.getenv("HALLR_ALLOW_NON_MANIFOLD") is None
@@ -25,12 +22,14 @@ def is_mesh_non_manifold(obj):
2522
bm.free()
2623
return not is_manifold
2724

25+
2826
class BaseOperatorMixin:
2927
@classmethod
3028
def poll(cls, context):
3129
ob = context.active_object
3230
return ob is not None and ob.type == 'MESH' and context.mode == 'EDIT_MESH'
3331

32+
3433
# Baby Shark Decimate mesh operator
3534
class MESH_OT_baby_shark_decimate(bpy.types.Operator, BaseOperatorMixin):
3635
bl_idname = "mesh.hallr_meshtools_bs_decimate"
@@ -92,7 +91,8 @@ def execute(self, context):
9291

9392
try:
9493
# Call the Rust function
95-
hallr_ffi_utils.process_single_mesh(config, obj, mesh_format=MeshFormat.TRIANGULATED, create_new=False)
94+
hallr_ffi_utils.process_single_mesh(config, obj, mesh_format=hallr_ffi_utils.MeshFormat.TRIANGULATED,
95+
create_new=False)
9696
except Exception as e:
9797
import traceback
9898
traceback.print_exc()
@@ -208,7 +208,8 @@ def execute(self, context):
208208

209209
try:
210210
# Call the Rust function
211-
hallr_ffi_utils.process_single_mesh(config, obj, mesh_format=MeshFormat.TRIANGULATED, create_new=False)
211+
hallr_ffi_utils.process_single_mesh(config, obj, mesh_format=hallr_ffi_utils.MeshFormat.TRIANGULATED,
212+
create_new=False)
212213
except Exception as e:
213214
import traceback
214215
traceback.print_exc()
@@ -296,7 +297,8 @@ def execute(self, context):
296297

297298
try:
298299
# Call the Rust function
299-
hallr_ffi_utils.process_single_mesh(config, obj, mesh_format=MeshFormat.TRIANGULATED, create_new=False)
300+
hallr_ffi_utils.process_single_mesh(config, obj, mesh_format=hallr_ffi_utils.MeshFormat.TRIANGULATED,
301+
create_new=False)
300302
except Exception as e:
301303
import traceback
302304
traceback.print_exc()
@@ -399,8 +401,8 @@ def execute(self, context):
399401
# Call the Rust function
400402
hallr_ffi_utils.process_mesh_with_rust(config, primary_object=mesh_1,
401403
secondary_object=mesh_2,
402-
primary_format=MeshFormat.TRIANGULATED,
403-
secondary_format=MeshFormat.TRIANGULATED,
404+
primary_format=hallr_ffi_utils.MeshFormat.TRIANGULATED,
405+
secondary_format=hallr_ffi_utils.MeshFormat.TRIANGULATED,
404406
create_new=True)
405407
except Exception as e:
406408
import traceback

blender_addon/hallr_ffi_utils.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ def handle_new_object(return_options: Dict[str, str], mesh_obj: bpy.types.Object
178178
bpy.context.view_layer.objects.active = mesh_obj
179179

180180
bpy.ops.object.mode_set(mode='EDIT')
181-
181+
182182
bpy.ops.mesh.faces_shade_flat()
183183

184184
# Ensure object mode
@@ -485,10 +485,8 @@ def process_mesh_with_rust(config: Dict[str, str],
485485
values_array = (ctypes.c_char_p * len(values_list))(*[v.encode('utf-8') for v in values_list])
486486
map_data = StringMap(keys_array, values_array, len(keys_list))
487487

488-
print(f"Python: command: '{config.get('command', '')}'")
489-
print(f"Python: sending {len(vertices)} vertices")
490-
print(f"Python: sending {len(indices)} indices")
491-
print(f"Python: sending {len(matrices)} matrices")
488+
print(f"Python: {COMMAND_TAG} '{config.get(COMMAND_TAG, '')}'")
489+
print(f"Python: sending {len(vertices)} vertices, {len(indices)} indices, {len(matrices)} matrices")
492490

493491
# Fetch Rust library
494492
rust_lib = load_latest_dylib()

blender_addon/hallr_meander_toolpath.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import bpy
88
import math
99
from . import hallr_ffi_utils
10-
from hallr_ffi_utils import MeshFormat
1110

1211
# Define the choices for the tool/probe property
1312
probes_props_items = [
@@ -200,8 +199,8 @@ def execute(self, context):
200199
# Call the Rust function
201200
hallr_ffi_utils.process_mesh_with_rust(config, primary_object=model,
202201
secondary_object=bounding_shape,
203-
primary_format=MeshFormat.TRIANGULATED,
204-
secondary_format=MeshFormat.POINT_CLOUD,
202+
primary_format=hallr_ffi_utils.MeshFormat.TRIANGULATED,
203+
secondary_format=hallr_ffi_utils.MeshFormat.POINT_CLOUD,
205204
create_new=True)
206205
except Exception as e:
207206
import traceback

blender_addon/hallr_mesh_operators.py

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import array
1212
from collections import defaultdict
1313
from . import hallr_ffi_utils
14-
from hallr_ffi_utils import MeshFormat
1514

1615

1716
def angle_between_edges(p0, p1, p2):
@@ -63,7 +62,8 @@ def execute(self, context):
6362

6463
try:
6564
# Call the Rust function
66-
hallr_ffi_utils.process_single_mesh(config, obj, mesh_format=MeshFormat.TRIANGULATED, create_new=False)
65+
hallr_ffi_utils.process_single_mesh(config, obj, mesh_format=hallr_ffi_utils.MeshFormat.TRIANGULATED,
66+
create_new=False)
6767
except Exception as e:
6868
self.report({'ERROR'}, f"Error: {e}")
6969
return {'CANCELLED'}
@@ -99,7 +99,8 @@ def execute(self, context):
9999

100100
try:
101101
# Call the Rust function
102-
hallr_ffi_utils.process_single_mesh(config, obj, mesh_format=MeshFormat.LINE_CHUNKS, create_new=False)
102+
hallr_ffi_utils.process_single_mesh(config, obj, mesh_format=hallr_ffi_utils.MeshFormat.LINE_CHUNKS,
103+
create_new=False)
103104
except Exception as e:
104105
import traceback
105106
traceback.print_exc()
@@ -130,7 +131,8 @@ def execute(self, context):
130131

131132
try:
132133
# Call the Rust function
133-
hallr_ffi_utils.process_single_mesh(config, obj, mesh_format=MeshFormat.POINT_CLOUD, create_new=False)
134+
hallr_ffi_utils.process_single_mesh(config, obj, mesh_format=hallr_ffi_utils.MeshFormat.POINT_CLOUD,
135+
create_new=False)
134136
except Exception as e:
135137
import traceback
136138
traceback.print_exc()
@@ -178,7 +180,8 @@ def execute(self, context):
178180

179181
try:
180182
# Call the Rust function
181-
hallr_ffi_utils.process_single_mesh(config, obj, mesh_format=MeshFormat.LINE_CHUNKS, create_new=False)
183+
hallr_ffi_utils.process_single_mesh(config, obj, mesh_format=hallr_ffi_utils.MeshFormat.LINE_CHUNKS,
184+
create_new=False)
182185
except Exception as e:
183186
import traceback
184187
traceback.print_exc()
@@ -511,7 +514,8 @@ def execute(self, context):
511514
}
512515
try:
513516
# Call the Rust function
514-
hallr_ffi_utils.process_single_mesh(config, obj, mesh_format=MeshFormat.LINE_CHUNKS, create_new=False)
517+
hallr_ffi_utils.process_single_mesh(config, obj, mesh_format=hallr_ffi_utils.MeshFormat.LINE_CHUNKS,
518+
create_new=False)
515519
except Exception as e:
516520
import traceback
517521
traceback.print_exc()
@@ -591,7 +595,8 @@ def execute(self, context):
591595
}
592596
try:
593597
# Call the Rust function
594-
hallr_ffi_utils.process_single_mesh(config, obj, mesh_format=MeshFormat.LINE_CHUNKS, create_new=False)
598+
hallr_ffi_utils.process_single_mesh(config, obj, mesh_format=hallr_ffi_utils.MeshFormat.LINE_CHUNKS,
599+
create_new=False)
595600
except Exception as e:
596601
import traceback
597602
traceback.print_exc()
@@ -681,7 +686,8 @@ def execute(self, context):
681686
}
682687
try:
683688
# Call the Rust function
684-
hallr_ffi_utils.process_single_mesh(config, obj, mesh_format=MeshFormat.LINE_CHUNKS, create_new=False)
689+
hallr_ffi_utils.process_single_mesh(config, obj, mesh_format=hallr_ffi_utils.MeshFormat.LINE_CHUNKS,
690+
create_new=False)
685691
except Exception as e:
686692
import traceback
687693
traceback.print_exc()
@@ -772,7 +778,8 @@ def execute(self, context):
772778
}
773779
try:
774780
# Call the Rust function
775-
hallr_ffi_utils.process_single_mesh(config, obj, mesh_format=MeshFormat.LINE_CHUNKS, create_new=False)
781+
hallr_ffi_utils.process_single_mesh(config, obj, mesh_format=hallr_ffi_utils.MeshFormat.LINE_CHUNKS,
782+
create_new=False)
776783
except Exception as e:
777784
import traceback
778785
traceback.print_exc()
@@ -925,7 +932,8 @@ def execute(self, context):
925932

926933
try:
927934
# Call the Rust function
928-
hallr_ffi_utils.process_single_mesh(config, obj, mesh_format=MeshFormat.LINE_CHUNKS, create_new=False)
935+
hallr_ffi_utils.process_single_mesh(config, obj, mesh_format=hallr_ffi_utils.MeshFormat.LINE_CHUNKS,
936+
create_new=False)
929937
except Exception as e:
930938
import traceback
931939
traceback.print_exc()
@@ -1042,7 +1050,8 @@ def execute(self, context):
10421050
}
10431051
try:
10441052
# Call the Rust function
1045-
hallr_ffi_utils.process_single_mesh(config, obj, mesh_format=MeshFormat.LINE_CHUNKS, create_new=False)
1053+
hallr_ffi_utils.process_single_mesh(config, obj, mesh_format=hallr_ffi_utils.MeshFormat.LINE_CHUNKS,
1054+
create_new=False)
10461055
except Exception as e:
10471056
import traceback
10481057
traceback.print_exc()

0 commit comments

Comments
 (0)