mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Code style
This commit is contained in:
parent
74f9125b27
commit
96482398f5
2 changed files with 11 additions and 11 deletions
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (c) 2015 Ultimaker B.V.
|
# Copyright (c) 2020 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
import numpy
|
import numpy
|
||||||
|
@ -96,7 +96,7 @@ class ImageReader(MeshReader):
|
||||||
texel_width = 1.0 / (width_minus_one) * scale_vector.x
|
texel_width = 1.0 / (width_minus_one) * scale_vector.x
|
||||||
texel_height = 1.0 / (height_minus_one) * scale_vector.z
|
texel_height = 1.0 / (height_minus_one) * scale_vector.z
|
||||||
|
|
||||||
height_data = numpy.zeros((height, width), dtype=numpy.float32)
|
height_data = numpy.zeros((height, width), dtype = numpy.float32)
|
||||||
|
|
||||||
for x in range(0, width):
|
for x in range(0, width):
|
||||||
for y in range(0, height):
|
for y in range(0, height):
|
||||||
|
@ -112,7 +112,7 @@ class ImageReader(MeshReader):
|
||||||
height_data = 1 - height_data
|
height_data = 1 - height_data
|
||||||
|
|
||||||
for _ in range(0, blur_iterations):
|
for _ in range(0, blur_iterations):
|
||||||
copy = numpy.pad(height_data, ((1, 1), (1, 1)), mode= "edge")
|
copy = numpy.pad(height_data, ((1, 1), (1, 1)), mode = "edge")
|
||||||
|
|
||||||
height_data += copy[1:-1, 2:]
|
height_data += copy[1:-1, 2:]
|
||||||
height_data += copy[1:-1, :-2]
|
height_data += copy[1:-1, :-2]
|
||||||
|
@ -165,7 +165,7 @@ class ImageReader(MeshReader):
|
||||||
offsetsz = numpy.array(offsetsz, numpy.float32).reshape(-1, 1) * texel_height
|
offsetsz = numpy.array(offsetsz, numpy.float32).reshape(-1, 1) * texel_height
|
||||||
|
|
||||||
# offsets for each texel quad
|
# offsets for each texel quad
|
||||||
heightmap_vertex_offsets = numpy.concatenate([offsetsx, numpy.zeros((offsetsx.shape[0], offsetsx.shape[1]), dtype=numpy.float32), offsetsz], 1)
|
heightmap_vertex_offsets = numpy.concatenate([offsetsx, numpy.zeros((offsetsx.shape[0], offsetsx.shape[1]), dtype = numpy.float32), offsetsz], 1)
|
||||||
heightmap_vertices += heightmap_vertex_offsets.repeat(6, 0).reshape(-1, 6, 3)
|
heightmap_vertices += heightmap_vertex_offsets.repeat(6, 0).reshape(-1, 6, 3)
|
||||||
|
|
||||||
# apply height data to y values
|
# apply height data to y values
|
||||||
|
@ -174,7 +174,7 @@ class ImageReader(MeshReader):
|
||||||
heightmap_vertices[:, 2, 1] = heightmap_vertices[:, 3, 1] = height_data[1:, 1:].reshape(-1)
|
heightmap_vertices[:, 2, 1] = heightmap_vertices[:, 3, 1] = height_data[1:, 1:].reshape(-1)
|
||||||
heightmap_vertices[:, 4, 1] = height_data[:-1, 1:].reshape(-1)
|
heightmap_vertices[:, 4, 1] = height_data[:-1, 1:].reshape(-1)
|
||||||
|
|
||||||
heightmap_indices = numpy.array(numpy.mgrid[0:heightmap_face_count * 3], dtype=numpy.int32).reshape(-1, 3)
|
heightmap_indices = numpy.array(numpy.mgrid[0:heightmap_face_count * 3], dtype = numpy.int32).reshape(-1, 3)
|
||||||
|
|
||||||
mesh._vertices[0:(heightmap_vertices.size // 3), :] = heightmap_vertices.reshape(-1, 3)
|
mesh._vertices[0:(heightmap_vertices.size // 3), :] = heightmap_vertices.reshape(-1, 3)
|
||||||
mesh._indices[0:(heightmap_indices.size // 3), :] = heightmap_indices
|
mesh._indices[0:(heightmap_indices.size // 3), :] = heightmap_indices
|
||||||
|
@ -223,7 +223,7 @@ class ImageReader(MeshReader):
|
||||||
mesh.addFaceByPoints(geo_width, 0, y, geo_width, 0, ny, geo_width, he1, ny)
|
mesh.addFaceByPoints(geo_width, 0, y, geo_width, 0, ny, geo_width, he1, ny)
|
||||||
mesh.addFaceByPoints(geo_width, he1, ny, geo_width, he0, y, geo_width, 0, y)
|
mesh.addFaceByPoints(geo_width, he1, ny, geo_width, he0, y, geo_width, 0, y)
|
||||||
|
|
||||||
mesh.calculateNormals(fast=True)
|
mesh.calculateNormals(fast = True)
|
||||||
|
|
||||||
scene_node.setMeshData(mesh.build())
|
scene_node.setMeshData(mesh.build())
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (c) 2015 Ultimaker B.V.
|
# Copyright (c) 2020 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the LGPLv3 or higher.
|
# Cura is released under the terms of the LGPLv3 or higher.
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
@ -33,9 +33,9 @@ class ImageReaderUI(QObject):
|
||||||
self.base_height = 0.4
|
self.base_height = 0.4
|
||||||
self.peak_height = 2.5
|
self.peak_height = 2.5
|
||||||
self.smoothing = 1
|
self.smoothing = 1
|
||||||
self.lighter_is_higher = False;
|
self.lighter_is_higher = False
|
||||||
self.use_transparency_model = True;
|
self.use_transparency_model = True
|
||||||
self.transmittance_1mm = 50.0; # based on pearl PLA
|
self.transmittance_1mm = 50.0 # based on pearl PLA
|
||||||
|
|
||||||
self._ui_lock = threading.Lock()
|
self._ui_lock = threading.Lock()
|
||||||
self._cancelled = False
|
self._cancelled = False
|
||||||
|
@ -85,7 +85,7 @@ class ImageReaderUI(QObject):
|
||||||
Logger.log("d", "Creating ImageReader config UI")
|
Logger.log("d", "Creating ImageReader config UI")
|
||||||
path = os.path.join(PluginRegistry.getInstance().getPluginPath("ImageReader"), "ConfigUI.qml")
|
path = os.path.join(PluginRegistry.getInstance().getPluginPath("ImageReader"), "ConfigUI.qml")
|
||||||
self._ui_view = Application.getInstance().createQmlComponent(path, {"manager": self})
|
self._ui_view = Application.getInstance().createQmlComponent(path, {"manager": self})
|
||||||
self._ui_view.setFlags(self._ui_view.flags() & ~Qt.WindowCloseButtonHint & ~Qt.WindowMinimizeButtonHint & ~Qt.WindowMaximizeButtonHint);
|
self._ui_view.setFlags(self._ui_view.flags() & ~Qt.WindowCloseButtonHint & ~Qt.WindowMinimizeButtonHint & ~Qt.WindowMaximizeButtonHint)
|
||||||
self._disable_size_callbacks = False
|
self._disable_size_callbacks = False
|
||||||
|
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue