mirror of https://github.com/vitalif/openscad
Merge pull request #190 from openscad/colorwarn
color>1.0 warning (color([255,0,0]) per Joel Bodenmann rept to mail listfelipesanches-svg
commit
0e9d66f532
|
@ -64,8 +64,11 @@ AbstractNode *ColorModule::evaluate(const Context *ctx, const ModuleInstantiatio
|
|||
|
||||
Value v = c.lookup_variable("c");
|
||||
if (v.type() == Value::VECTOR) {
|
||||
for (size_t i = 0; i < 4; i++)
|
||||
for (size_t i = 0; i < 4; i++) {
|
||||
node->color[i] = i < v.toVector().size() ? v.toVector()[i].toDouble() : 1.0;
|
||||
if (node->color[i] > 1)
|
||||
PRINTB_NOCACHE("WARNING: color() expects numbers between 0.0 and 1.0. Value of %.1f is too large.", node->color[i]);
|
||||
}
|
||||
} else if (v.type() == Value::STRING) {
|
||||
std::string colorname = v.toString();
|
||||
boost::algorithm::to_lower(colorname);
|
||||
|
|
Loading…
Reference in New Issue