Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions meshroom/core/desc/attribute.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def __init__(self, name, label, description, value, range=None, group="allParams
self._valueType = int

def validateValue(self, value):
if value is None or isinstance(value, str):
if value is None:
return value
# Handle unsigned int values that are translated to int by shiboken and may overflow
try:
Expand Down Expand Up @@ -371,7 +371,7 @@ def __init__(self, name, label, description, value, range=None, group="allParams
self._valueType = float

def validateValue(self, value):
if value is None or isinstance(value, str):
if value is None:
return value
try:
return float(value)
Expand Down
15 changes: 4 additions & 11 deletions meshroom/ui/qml/GraphEditor/AttributeItemDelegate.qml
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,7 @@ RowLayout {
case "IntParam":
case "FloatParam":
// We don't set a number because we want to keep the invalid expression
// _reconstruction.setAttribute(root.attribute, Number(value))
_reconstruction.setAttribute(root.attribute, value)
_reconstruction.setAttribute(root.attribute, Number(value))
updateAttributeLabel()
break
case "File":
Expand Down Expand Up @@ -623,15 +622,11 @@ RowLayout {
isInt: attribute.type === "FloatParam" ? false : true

onEditingFinished: {
if (hasExprError)
setTextFieldAttribute(expressionTextField.text) // On the undo stack we keep the expression
else
if (!hasExprError)
setTextFieldAttribute(expressionTextField.evaluatedValue)
}
onAccepted: {
if (hasExprError)
setTextFieldAttribute(expressionTextField.text) // On the undo stack we keep the expression
else
if (!hasExprError)
setTextFieldAttribute(expressionTextField.evaluatedValue)
// When the text is too long, display the left part
// (with the most important values and cut the floating point details)
Expand All @@ -640,9 +635,7 @@ RowLayout {

Component.onDestruction: {
if (activeFocus) {
if (hasExprError)
setTextFieldAttribute(expressionTextField.text)
else
if (!hasExprError)
setTextFieldAttribute(expressionTextField.evaluatedValue)
}
}
Expand Down
Loading