mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
make naming of Logarithmic Conversion Function intelligible
This commit is contained in:
parent
2b55b85a12
commit
a8b3d7e49d
3 changed files with 13 additions and 13 deletions
|
@ -146,21 +146,21 @@ UM.Dialog
|
|||
UM.TooltipArea {
|
||||
Layout.fillWidth:true
|
||||
height: childrenRect.height
|
||||
text: catalog.i18nc("@info:tooltip","For lithophanes a logarithmic function is more appropriate for most materials. For height maps the pixel values correspond to heights linearly.")
|
||||
text: catalog.i18nc("@info:tooltip","For lithophanes a simple logarithmic model for translucency is available. For height maps the pixel values correspond to heights linearly.")
|
||||
Row {
|
||||
width: parent.width
|
||||
|
||||
Label {
|
||||
text: "Conversion"
|
||||
text: "Color Model"
|
||||
width: 150 * screenScaleFactor
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
ComboBox {
|
||||
id: conversion
|
||||
objectName: "Conversion"
|
||||
model: [ catalog.i18nc("@item:inlistbox","Logarithmic"), catalog.i18nc("@item:inlistbox","Linear") ]
|
||||
id: color_model
|
||||
objectName: "ColorModel"
|
||||
model: [ catalog.i18nc("@item:inlistbox","Translucency"), catalog.i18nc("@item:inlistbox","Linear") ]
|
||||
width: 180 * screenScaleFactor
|
||||
onCurrentIndexChanged: { manager.onConvertFunctionChanged(currentIndex) }
|
||||
onCurrentIndexChanged: { manager.onColorModelChanged(currentIndex) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,9 +48,9 @@ class ImageReader(MeshReader):
|
|||
|
||||
def _read(self, file_name):
|
||||
size = max(self._ui.getWidth(), self._ui.getDepth())
|
||||
return self._generateSceneNode(file_name, size, self._ui.peak_height, self._ui.base_height, self._ui.smoothing, 512, self._ui.lighter_is_higher, self._ui.use_logarithmic_function, self._ui.transmittance_1mm)
|
||||
return self._generateSceneNode(file_name, size, self._ui.peak_height, self._ui.base_height, self._ui.smoothing, 512, self._ui.lighter_is_higher, self._ui.use_transparency_model, self._ui.transmittance_1mm)
|
||||
|
||||
def _generateSceneNode(self, file_name, xz_size, peak_height, base_height, blur_iterations, max_size, lighter_is_higher, use_logarithmic_function, transmittance_1mm):
|
||||
def _generateSceneNode(self, file_name, xz_size, peak_height, base_height, blur_iterations, max_size, lighter_is_higher, use_transparency_model, transmittance_1mm):
|
||||
scene_node = SceneNode()
|
||||
|
||||
mesh = MeshBuilder()
|
||||
|
@ -101,7 +101,7 @@ class ImageReader(MeshReader):
|
|||
for x in range(0, width):
|
||||
for y in range(0, height):
|
||||
qrgb = img.pixel(x, y)
|
||||
if use_logarithmic_function:
|
||||
if use_transparency_model:
|
||||
height_data[y, x] = (0.299 * math.pow(qRed(qrgb) / 255.0, 2.2) + 0.587 * math.pow(qGreen(qrgb) / 255.0, 2.2) + 0.114 * math.pow(qBlue(qrgb) / 255.0, 2.2))
|
||||
else:
|
||||
height_data[y, x] = (0.212655 * qRed(qrgb) + 0.715158 * qGreen(qrgb) + 0.072187 * qBlue(qrgb)) / 255 # fast computation ignoring gamma and degamma
|
||||
|
@ -128,7 +128,7 @@ class ImageReader(MeshReader):
|
|||
|
||||
Job.yieldThread()
|
||||
|
||||
if use_logarithmic_function:
|
||||
if use_transparency_model:
|
||||
p = 1.0 / math.log(transmittance_1mm / 100.0, 2)
|
||||
min_luminance = 2.0 ** ((peak_height - base_height) / p)
|
||||
for (y, x) in numpy.ndindex(height_data.shape):
|
||||
|
|
|
@ -34,7 +34,7 @@ class ImageReaderUI(QObject):
|
|||
self.peak_height = 2.5
|
||||
self.smoothing = 1
|
||||
self.lighter_is_higher = False;
|
||||
self.use_logarithmic_function = False;
|
||||
self.use_transparency_model = True;
|
||||
self.transmittance_1mm = 40.0;
|
||||
|
||||
self._ui_lock = threading.Lock()
|
||||
|
@ -149,8 +149,8 @@ class ImageReaderUI(QObject):
|
|||
self.lighter_is_higher = (value == 1)
|
||||
|
||||
@pyqtSlot(int)
|
||||
def onConvertFunctionChanged(self, value):
|
||||
self.use_logarithmic_function = (value == 0)
|
||||
def onColorModelChanged(self, value):
|
||||
self.use_transparency_model = (value == 0)
|
||||
|
||||
@pyqtSlot(int)
|
||||
def onTransmittanceChanged(self, value):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue