Merge branch 'master' into ImprovementSlider
This commit is contained in:
@@ -909,7 +909,7 @@ void Foliage::RebuildClusters()
|
||||
_box = BoundingBox(_transform.Translation, _transform.Translation);
|
||||
_sphere = BoundingSphere(_transform.Translation, 0.0f);
|
||||
if (_sceneRenderingKey != -1)
|
||||
GetSceneRendering()->UpdateActor(this, _sceneRenderingKey);
|
||||
GetSceneRendering()->UpdateActor(this, _sceneRenderingKey, ISceneRenderingListener::Bounds);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -372,7 +372,7 @@ void ParticleEffect::UpdateBounds()
|
||||
_box = bounds;
|
||||
BoundingSphere::FromBox(bounds, _sphere);
|
||||
if (_sceneRenderingKey != -1)
|
||||
GetSceneRendering()->UpdateActor(this, _sceneRenderingKey);
|
||||
GetSceneRendering()->UpdateActor(this, _sceneRenderingKey, ISceneRenderingListener::Bounds);
|
||||
}
|
||||
|
||||
void ParticleEffect::Sync()
|
||||
|
||||
@@ -404,8 +404,17 @@ public:
|
||||
// Dirty static objects to redraw when changed (eg. material modification)
|
||||
if (a->HasStaticFlag(StaticFlags::Shadow))
|
||||
{
|
||||
DirtyStaticBounds(prevBounds);
|
||||
DirtyStaticBounds(a->GetSphere());
|
||||
// TODO: skip actors that don't cast shadows (eg. particles)
|
||||
BoundingSphere bounds = a->GetSphere();
|
||||
if (bounds != prevBounds)
|
||||
{
|
||||
// Avoid dirtying twice when bounds are close to each other
|
||||
if (BoundingSphere::NearEqual(bounds, prevBounds, METERS_TO_UNITS_SCALE))
|
||||
BoundingSphere::Merge(bounds, prevBounds, bounds);
|
||||
else
|
||||
DirtyStaticBounds(prevBounds);
|
||||
}
|
||||
DirtyStaticBounds(bounds);
|
||||
}
|
||||
else if (flags & StaticFlags)
|
||||
{
|
||||
|
||||
@@ -72,6 +72,33 @@ namespace FlaxEngine.GUI
|
||||
[EditorOrder(10), Tooltip("The text to show on a panel header.")]
|
||||
public string HeaderText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The active search text query used to highlight matching parts of the header text.
|
||||
/// </summary>
|
||||
public string SearchText = string.Empty;
|
||||
|
||||
private string _lastSearchText;
|
||||
private string _lastHeaderText;
|
||||
private int _highlightIndex = -1;
|
||||
|
||||
private void UpdateHighlights()
|
||||
{
|
||||
if (_lastSearchText == SearchText && _lastHeaderText == HeaderText)
|
||||
return;
|
||||
|
||||
_lastSearchText = SearchText;
|
||||
_lastHeaderText = HeaderText;
|
||||
|
||||
if (!string.IsNullOrEmpty(SearchText) && !string.IsNullOrEmpty(HeaderText))
|
||||
{
|
||||
_highlightIndex = HeaderText.IndexOf(SearchText, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
else
|
||||
{
|
||||
_highlightIndex = -1;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the height of the header.
|
||||
/// </summary>
|
||||
@@ -411,6 +438,21 @@ namespace FlaxEngine.GUI
|
||||
|
||||
Render2D.PushClip(textRect);
|
||||
Render2D.DrawText(HeaderTextFont.GetFont(), HeaderTextMaterial, HeaderText, textRect, textColor, TextAlignment.Near, TextAlignment.Center);
|
||||
UpdateHighlights();
|
||||
if (_highlightIndex >= 0)
|
||||
{
|
||||
var font = HeaderTextFont.GetFont();
|
||||
if (font != null)
|
||||
{
|
||||
var highlightColor = Style.Current.ProgressNormal * 0.6f;
|
||||
var textSize = font.MeasureText(HeaderText);
|
||||
var textY = (HeaderHeight - textSize.Y) * 0.5f;
|
||||
var start = font.GetCharPosition(HeaderText, _highlightIndex);
|
||||
var end = font.GetCharPosition(HeaderText, _highlightIndex + SearchText.Length);
|
||||
var highlightRect = new Rectangle(start.X + textRect.X, textY, end.X - start.X, textSize.Y);
|
||||
Render2D.FillRectangle(highlightRect, highlightColor);
|
||||
}
|
||||
}
|
||||
Render2D.PopClip();
|
||||
|
||||
if (!_isClosed && EnableContainmentLines)
|
||||
|
||||
@@ -86,7 +86,8 @@ public:
|
||||
StringAsUTF8(const Char* text, int32 length)
|
||||
{
|
||||
int32 lengthUtf8;
|
||||
if (length + 1 < InlinedSize)
|
||||
// UTF-8 can use up to 3 bytes per UTF-16 code unit
|
||||
if (length * 3 + 1 < InlinedSize)
|
||||
{
|
||||
StringUtils::ConvertUTF162UTF8(text, this->_inlined, length, lengthUtf8);
|
||||
this->_inlined[lengthUtf8] = 0;
|
||||
|
||||
Reference in New Issue
Block a user