Skip to content

Commit

Permalink
Use materials to set appearance
Browse files Browse the repository at this point in the history
  • Loading branch information
davesrocketshop committed Mar 16, 2024
1 parent 8bbc04e commit 8535cef
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions src/Mod/Material/App/Materials.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,32 @@ QString MaterialProperty::getDictionaryString() const
return getValue().toString();
}

App::Color MaterialProperty::getColor() const
{
auto colorString = getValue().toString();
std::stringstream stream(colorString.toStdString());

char c;
stream >> c; // read "("
float red;
stream >> red;
stream >> c; // ","
float green;
stream >> green;
stream >> c; // ","
float blue;
stream >> blue;
stream >> c; // ","
float alpha = 1.0;
if (c == ',') {
stream >> alpha;
}

App::Color color(red, green, blue, alpha);
return color;
}


void MaterialProperty::setPropertyType(const QString& type)
{
ModelProperty::setPropertyType(type);
Expand Down

0 comments on commit 8535cef

Please sign in to comment.