Skip to content

Commit

Permalink
Fix assertion failure when editing a light entity which has _color va…
Browse files Browse the repository at this point in the history
…lues specified as integers 0-255
  • Loading branch information
ericwa committed Aug 6, 2014
1 parent 2ecd7bd commit f77937a
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 f77937a

Please sign in to comment.