mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-03 08:48:40 +02:00
[nodes] add semantic to customize attibute UI
This commit is contained in:
parent
a0f12743a5
commit
dc3f4dd2be
3 changed files with 60 additions and 20 deletions
|
@ -145,7 +145,10 @@ RowLayout {
|
|||
{
|
||||
case "ChoiceParam": return attribute.desc.exclusive ? comboBox_component : multiChoice_component
|
||||
case "IntParam": return slider_component
|
||||
case "FloatParam": return slider_component
|
||||
case "FloatParam":
|
||||
if(attribute.desc.semantic === 'color/hue')
|
||||
return color_hue_component
|
||||
return slider_component
|
||||
case "BoolParam": return checkbox_component
|
||||
case "ListAttribute": return listAttribute_component
|
||||
case "GroupAttribute": return groupAttribute_component
|
||||
|
@ -379,5 +382,39 @@ RowLayout {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: color_hue_component
|
||||
Slider {
|
||||
readonly property int stepDecimalCount: 2
|
||||
readonly property real formattedValue: value.toFixed(stepDecimalCount)
|
||||
enabled: root.editable
|
||||
value: attribute.value
|
||||
from: 0
|
||||
to: 1
|
||||
stepSize: 0.01
|
||||
snapMode: Slider.SnapAlways
|
||||
onPressedChanged: {
|
||||
if(!pressed)
|
||||
_reconstruction.setAttribute(attribute, formattedValue)
|
||||
}
|
||||
|
||||
background: ShaderEffect {
|
||||
width: control.availableWidth
|
||||
height: control.availableHeight
|
||||
blending: false
|
||||
fragmentShader: "
|
||||
varying mediump vec2 qt_TexCoord0;
|
||||
vec3 hsv2rgb(vec3 c) {
|
||||
vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
|
||||
vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);
|
||||
return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);
|
||||
}
|
||||
void main() {
|
||||
gl_FragColor = vec4(hsv2rgb(vec3(qt_TexCoord0.x, 1.0, 1.0)), 1.0);
|
||||
}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue