diff --git a/src/Gui/propertyeditor/PropertyItem.cpp b/src/Gui/propertyeditor/PropertyItem.cpp index 7ebe9db4bd..f780e9010d 100644 --- a/src/Gui/propertyeditor/PropertyItem.cpp +++ b/src/Gui/propertyeditor/PropertyItem.cpp @@ -3752,37 +3752,33 @@ void PropertyMaterialItem::setValue(const QVariant& value) auto mat = value.value(); Base::Color dc; dc.setValue(mat.diffuseColor); + uint32_t dcp = dc.getPackedValue(); Base::Color ac; ac.setValue(mat.ambientColor); + uint32_t acp = ac.getPackedValue(); Base::Color sc; sc.setValue(mat.specularColor); + uint32_t scp = sc.getPackedValue(); Base::Color ec; ec.setValue(mat.emissiveColor); + uint32_t ecp = ec.getPackedValue(); float s = mat.shininess; float t = mat.transparency; QString data = QStringLiteral("App.Material(" - "DiffuseColor=(%1,%2,%3)," - "AmbientColor=(%4,%5,%6)," - "SpecularColor=(%7,%8,%9)," - "EmissiveColor=(%10,%11,%12)," - "Shininess=(%13)," - "Transparency=(%14)," - ")") - .arg(dc.r, 0, 'f', decimals()) - .arg(dc.g, 0, 'f', decimals()) - .arg(dc.b, 0, 'f', decimals()) - .arg(ac.r, 0, 'f', decimals()) - .arg(ac.g, 0, 'f', decimals()) - .arg(ac.b, 0, 'f', decimals()) - .arg(sc.r, 0, 'f', decimals()) - .arg(sc.g, 0, 'f', decimals()) - .arg(sc.b, 0, 'f', decimals()) - .arg(ec.r, 0, 'f', decimals()) - .arg(ec.g, 0, 'f', decimals()) - .arg(ec.b, 0, 'f', decimals()) - .arg(s, 0, 'f', decimals()) - .arg(t, 0, 'f', decimals()); + "DiffuseColor = %1," + "AmbientColor = %2," + "SpecularColor = %3," + "EmissiveColor = %4," + "Shininess = %5," + "Transparency = %6," + ")") + .arg(dcp) + .arg(acp) + .arg(scp) + .arg(ecp) + .arg(s, 0, 'f', 10) + .arg(t, 0, 'f', 10); setPropertyValue(data); } @@ -4258,37 +4254,33 @@ void PropertyMaterialListItem::setValue(const QVariant& value) auto mat = list[0].value(); Base::Color dc; dc.setValue(mat.diffuseColor); + uint32_t dcp = dc.getPackedValue(); Base::Color ac; ac.setValue(mat.ambientColor); + uint32_t acp = ac.getPackedValue(); Base::Color sc; sc.setValue(mat.specularColor); + uint32_t scp = sc.getPackedValue(); Base::Color ec; ec.setValue(mat.emissiveColor); + uint32_t ecp = ec.getPackedValue(); float s = mat.shininess; float t = mat.transparency; QString item = QStringLiteral("App.Material(" - "DiffuseColor=(%1,%2,%3)," - "AmbientColor=(%4,%5,%6)," - "SpecularColor=(%7,%8,%9)," - "EmissiveColor=(%10,%11,%12)," - "Shininess=(%13)," - "Transparency=(%14)," - ")") - .arg(dc.r, 0, 'f', decimals()) - .arg(dc.g, 0, 'f', decimals()) - .arg(dc.b, 0, 'f', decimals()) - .arg(ac.r, 0, 'f', decimals()) - .arg(ac.g, 0, 'f', decimals()) - .arg(ac.b, 0, 'f', decimals()) - .arg(sc.r, 0, 'f', decimals()) - .arg(sc.g, 0, 'f', decimals()) - .arg(sc.b, 0, 'f', decimals()) - .arg(ec.r, 0, 'f', decimals()) - .arg(ec.g, 0, 'f', decimals()) - .arg(ec.b, 0, 'f', decimals()) - .arg(s, 0, 'f', decimals()) - .arg(t, 0, 'f', decimals()); + "DiffuseColor = %1," + "AmbientColor = %2," + "SpecularColor = %3," + "EmissiveColor = %4," + "Shininess = %5," + "Transparency = %6," + ")") + .arg(dcp) + .arg(acp) + .arg(scp) + .arg(ecp) + .arg(s, 0, 'f', 10) + .arg(t, 0, 'f', 10); str << item << ")"; setPropertyValue(data);