Import fix update - bpy.utils, autoformat fix

While rearranging and cleaning up the utils imports in the initial 'Import fix' commit I deleted `utils.` from `bpy.utils.script_paths()` in the ops.py file.
This has been fixed, and I took the opportunity to reverse the autoformat issue (changed line length from 100 to 89 between commits), and restore all the code to its previous state.
I made one exception:
- comments that came at the end of the line that were moved to the line above

All functional code has been restored to its previous format.
pull/269/head
SpectralVectors 2024-03-23 11:18:14 -04:00 zatwierdzone przez GitHub
rodzic 2e3acdd750
commit f3abf4e303
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
2 zmienionych plików z 11 dodań i 22 usunięć

Wyświetl plik

@ -59,11 +59,9 @@ async def ocl_sample(operation, chunks, use_cached_mesh=False):
cutter = None
if op_cutter_type == 'END':
cutter = ocl.CylCutter(
(op_cutter_diameter + operation.skin * 2) * 1000, cutter_length)
cutter = ocl.CylCutter((op_cutter_diameter + operation.skin * 2) * 1000, cutter_length)
elif op_cutter_type == 'BALLNOSE':
cutter = ocl.BallCutter(
(op_cutter_diameter + operation.skin * 2) * 1000, cutter_length)
cutter = ocl.BallCutter((op_cutter_diameter + operation.skin * 2) * 1000, cutter_length)
elif op_cutter_type == 'VCARVE':
cutter = ocl.ConeCutter((op_cutter_diameter + operation.skin * 2)
* 1000, op_cutter_tip_angle, cutter_length)
@ -91,8 +89,7 @@ async def ocl_sample(operation, chunks, use_cached_mesh=False):
for chunk in chunks:
for coord in chunk.get_points_np():
bdc.appendPoint(ocl.CLPoint(
coord[0] * 1000, coord[1] * 1000, op_minz * 1000))
bdc.appendPoint(ocl.CLPoint(coord[0] * 1000, coord[1] * 1000, op_minz * 1000))
await progress_async("OpenCAMLib sampling")
bdc.run()

Wyświetl plik

@ -85,17 +85,14 @@ def exportModelsToSTL(operation):
bpy.ops.object.duplicate(linked=False)
# collision_object = bpy.context.scene.objects.active
# bpy.context.scene.objects.selected = collision_object
file_name = os.path.join(
tempfile.gettempdir(), "model{0}.stl".format(str(file_number)))
bpy.ops.object.transform_apply(
location=True, rotation=True, scale=True)
file_name = os.path.join(tempfile.gettempdir(), "model{0}.stl".format(str(file_number)))
bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
bpy.ops.transform.resize(value=(OCL_SCALE, OCL_SCALE, OCL_SCALE), constraint_axis=(False, False, False),
orient_type='GLOBAL', mirror=False, use_proportional_edit=False,
proportional_edit_falloff='SMOOTH', proportional_size=1, snap=False,
snap_target='CLOSEST', snap_point=(0, 0, 0), snap_align=False, snap_normal=(0, 0, 0),
texture_space=False, release_confirm=False)
bpy.ops.object.transform_apply(
location=True, rotation=True, scale=True)
bpy.ops.object.transform_apply(location=True, rotation=True, scale=True)
bpy.ops.export_mesh.stl(check_existing=True, filepath=file_name, filter_glob="*.stl", use_selection=True,
ascii=False, use_mesh_modifiers=True, axis_forward='Y', axis_up='Z', global_scale=1.0)
bpy.ops.object.delete()
@ -123,8 +120,7 @@ async def oclResampleChunks(operation, chunks_to_resample, use_cached_mesh):
sample_index = 0
for chunk, i_start, i_length in chunks_to_resample:
z = np.array(
[p.z for p in samples[sample_index:sample_index+i_length]]) / OCL_SCALE
z = np.array([p.z for p in samples[sample_index:sample_index+i_length]]) / OCL_SCALE
pts = chunk.get_points_np()
pt_z = pts[i_start:i_start+i_length, 2]
pt_z = np.where(z > pt_z, z, pt_z)
@ -154,8 +150,7 @@ def oclGetMedialAxis(operation, chunks):
oclWaterlineHeightsToOCL(operation)
operationSettingsToOCL(operation)
curvesToOCL(operation)
call([PYTHON_BIN, os.path.join(bpy.utils.script_path_pref(),
"addons", "cam", "opencamlib", "ocl.py")])
call([PYTHON_BIN, os.path.join(bpy.utils.script_path_pref(), "addons", "cam", "opencamlib", "ocl.py")])
waterlineChunksFromOCL(operation, chunks)
@ -174,11 +169,9 @@ async def oclGetWaterline(operation, chunks):
cutter_length = 150
if op_cutter_type == 'END':
cutter = ocl.CylCutter(
(op_cutter_diameter + operation.skin * 2) * 1000, cutter_length)
cutter = ocl.CylCutter((op_cutter_diameter + operation.skin * 2) * 1000, cutter_length)
elif op_cutter_type == 'BALLNOSE':
cutter = ocl.BallCutter(
(op_cutter_diameter + operation.skin * 2) * 1000, cutter_length)
cutter = ocl.BallCutter((op_cutter_diameter + operation.skin * 2) * 1000, cutter_length)
elif op_cutter_type == 'VCARVE':
cutter = ocl.ConeCutter((op_cutter_diameter + operation.skin * 2)
* 1000, op_cutter_tip_angle, cutter_length)
@ -201,8 +194,7 @@ async def oclGetWaterline(operation, chunks):
for l in wl_loops:
inpoints = []
for p in l:
inpoints.append(
(p.x / OCL_SCALE, p.y / OCL_SCALE, p.z / OCL_SCALE))
inpoints.append((p.x / OCL_SCALE, p.y / OCL_SCALE, p.z / OCL_SCALE))
inpoints.append(inpoints[0])
chunk = camPathChunk(inpoints=inpoints)
chunk.closed = True