Fix material drag over highlights to not flicker
This commit is contained in:
@@ -787,10 +787,12 @@ namespace FlaxEditor.Viewport
|
||||
/// <inheritdoc />
|
||||
public override DragDropEffect OnDragMove(ref Float2 location, DragData data)
|
||||
{
|
||||
DragHandlers.ClearDragEffects();
|
||||
var result = base.OnDragMove(ref location, data);
|
||||
if (result != DragDropEffect.None)
|
||||
{
|
||||
DragHandlers.ClearDragEffects();
|
||||
return result;
|
||||
}
|
||||
return DragHandlers.DragEnter(ref location, data);
|
||||
}
|
||||
|
||||
|
||||
@@ -647,10 +647,12 @@ namespace FlaxEditor.Viewport
|
||||
/// <inheritdoc />
|
||||
public override DragDropEffect OnDragMove(ref Float2 location, DragData data)
|
||||
{
|
||||
DragHandlers.ClearDragEffects();
|
||||
var result = base.OnDragMove(ref location, data);
|
||||
if (result != DragDropEffect.None)
|
||||
{
|
||||
DragHandlers.ClearDragEffects();
|
||||
return result;
|
||||
}
|
||||
return DragHandlers.DragEnter(ref location, data);
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace FlaxEditor.Viewport
|
||||
{
|
||||
if (_previewStaticModel)
|
||||
debugDrawData.HighlightModel(_previewStaticModel, _previewModelEntryIndex);
|
||||
if (_previewBrushSurface.Brush != null)
|
||||
if (_previewBrushSurface.Brush)
|
||||
debugDrawData.HighlightBrushSurface(_previewBrushSurface);
|
||||
}
|
||||
|
||||
@@ -120,10 +120,12 @@ namespace FlaxEditor.Viewport
|
||||
if (_dragAssets.HasValidDrag && _dragAssets.Objects[0].IsOfType<MaterialBase>())
|
||||
{
|
||||
GetHitLocation(ref location, out var hit, out _, out _);
|
||||
ClearDragEffects();
|
||||
var material = FlaxEngine.Content.LoadAsync<MaterialBase>(_dragAssets.Objects[0].ID);
|
||||
if (material.IsDecal)
|
||||
if (material && material.IsDecal)
|
||||
{
|
||||
ClearDragEffects();
|
||||
return;
|
||||
}
|
||||
|
||||
if (hit is StaticModelNode staticModelNode)
|
||||
{
|
||||
@@ -135,6 +137,14 @@ namespace FlaxEditor.Viewport
|
||||
{
|
||||
_previewBrushSurface = brushSurfaceNode.Surface;
|
||||
}
|
||||
else
|
||||
{
|
||||
ClearDragEffects();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ClearDragEffects();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -80,6 +80,8 @@ namespace FlaxEditor
|
||||
/// <param name="surface">The surface.</param>
|
||||
public void HighlightBrushSurface(BrushSurface surface)
|
||||
{
|
||||
if (surface.Brush == null)
|
||||
return;
|
||||
surface.Brush.GetVertices(surface.Index, out var vertices);
|
||||
if (vertices.Length > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user