Merge branch 'master' into arrow-debug-draw-improviment
This commit is contained in:
@@ -7,9 +7,37 @@ using Real = System.Single;
|
||||
#endif
|
||||
|
||||
using FlaxEngine;
|
||||
using FlaxEditor.CustomEditors.Dedicated;
|
||||
using FlaxEditor.CustomEditors;
|
||||
using FlaxEditor.Scripting;
|
||||
|
||||
namespace FlaxEditor.SceneGraph.Actors
|
||||
{
|
||||
/// <summary>
|
||||
/// Dedicated custom editor for BoxCollider objects.
|
||||
/// </summary>
|
||||
[CustomEditor(typeof(BoxCollider)), DefaultEditor]
|
||||
public class BoxColliderEditor : ActorEditor
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override void Initialize(LayoutElementsContainer layout)
|
||||
{
|
||||
base.Initialize(layout);
|
||||
|
||||
layout.Space(20f);
|
||||
layout.Button("Resize to Fit", Editor.Instance.CodeDocs.GetTooltip(new ScriptMemberInfo(typeof(BoxCollider).GetMethod("AutoResize")))).Button.Clicked += OnResizeClicked;
|
||||
}
|
||||
|
||||
private void OnResizeClicked()
|
||||
{
|
||||
foreach (var value in Values)
|
||||
{
|
||||
if (value is BoxCollider collider)
|
||||
collider.AutoResize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Scene tree node for <see cref="BoxCollider"/> actor type.
|
||||
/// </summary>
|
||||
@@ -37,5 +65,13 @@ namespace FlaxEditor.SceneGraph.Actors
|
||||
|
||||
return base.RayCastSelf(ref ray, out distance, out normal);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void PostSpawn()
|
||||
{
|
||||
base.PostSpawn();
|
||||
|
||||
((BoxCollider)Actor).AutoResize();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -698,6 +698,10 @@ namespace FlaxEditor.SceneGraph.GUI
|
||||
if (thisHasScene != otherHasScene)
|
||||
return false;
|
||||
|
||||
// Reject dragging actors between prefab windows (different roots)
|
||||
if (!thisHasScene && ActorNode.Root != actorNode.Root)
|
||||
return false;
|
||||
|
||||
// Reject dragging parents and itself
|
||||
return actorNode.Actor != null && actorNode != ActorNode && actorNode.Find(Actor) == null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user