Base: Add fromPercent and toPercent helpers

This commit is contained in:
Kacper Donat
2025-02-20 00:02:06 +01:00
parent 8dbc4042b3
commit 36195d1981
12 changed files with 67 additions and 93 deletions

View File

@@ -329,7 +329,7 @@ void ViewProviderMesh::onChanged(const App::Property* prop)
pcMatBinding->value = SoMaterialBinding::OVERALL;
}
if (prop == &LineTransparency) {
float trans = LineTransparency.getValue() / 100.0F;
float trans = Base::fromPercent(LineTransparency.getValue());
pLineColor->transparency = trans;
}
else if (prop == &LineWidth) {
@@ -590,7 +590,7 @@ void ViewProviderMesh::tryColorPerVertexOrFace(bool on)
pcMatBinding->value = SoMaterialBinding::OVERALL;
const App::Color& c = ShapeAppearance.getDiffuseColor();
pcShapeMaterial->diffuseColor.setValue(c.r, c.g, c.b);
pcShapeMaterial->transparency.setValue(Transparency.getValue() / 100.0F);
pcShapeMaterial->transparency.setValue(Base::fromPercent(Transparency.getValue()));
}
}