Skip to content

Commit

Permalink
Merge pull request TrenchBroom#813 from ericwa/color-editor-crash-fix
Browse files Browse the repository at this point in the history
Fix assertion failure when editing a light w/ _color value in the 0-255 format
  • Loading branch information
kduske committed Aug 7, 2014
2 parents 2ecd7bd + f77937a commit b3da176
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Source/View/ColorEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,15 @@ namespace TrenchBroom {
const Model::Entity& entity = **entityIt;
const Model::PropertyValue* value = entity.propertyForKey(property());
if (value != NULL)
colorSet.insert(Vec3f(*value));
{
Vec3f color = Vec3f(*value);

// YIQOrder requires color values in the range [0..1]
if (color.x() > 1.0f || color.y() > 1.0f || color.z() > 1.0f)
color /= 255.0f;

colorSet.insert(color);
}
}

m_colorHistory->setColors(Utility::makeList(colorSet));
Expand Down

0 comments on commit b3da176

Please sign in to comment.