Materials: Set array quantity format (#21647)
* Materials: Set array quantity format When setting quantity formats, the default format is not actually the default. Instead fixed format is, which causes issues for very small and very large values. This was fixed for C++ but arrays created in Python were not setting the format correctly. * Apply suggestions from code review Co-authored-by: Benjamin Nauck <benjamin@nauck.se>
This commit is contained in:
@@ -159,7 +159,9 @@ PyObject* Array2DPy::setValue(PyObject* args)
|
||||
if (PyArg_ParseTuple(args, "iiO!", &row, &column, &PyUnicode_Type, &valueObj)) {
|
||||
Py::String item(valueObj);
|
||||
try {
|
||||
QVariant variant = QVariant::fromValue(Base::Quantity::parse(item.as_string()));
|
||||
auto quantity = Base::Quantity::parse(item.as_string());
|
||||
quantity.setFormat(MaterialValue::getQuantityFormat());
|
||||
QVariant variant = QVariant::fromValue(quantity);
|
||||
getArray2DPtr()->setValue(row, column, variant);
|
||||
}
|
||||
catch (const InvalidIndex&) {
|
||||
|
||||
Reference in New Issue
Block a user