Various minor improvements

This commit is contained in:
Wojtek Figat
2023-05-04 11:55:22 +02:00
parent 1c12e3d530
commit 273b6c0228
10 changed files with 18 additions and 32 deletions

View File

@@ -368,7 +368,7 @@ namespace FlaxEditor.Surface
} }
if (!asset.IsLoaded) if (!asset.IsLoaded)
{ {
layout.Label("Loading..."); layout.Label("Loading...", TextAlignment.Center);
return; return;
} }
var parameters = window.VisjectSurface.Parameters; var parameters = window.VisjectSurface.Parameters;

View File

@@ -166,10 +166,9 @@ namespace FlaxEditor.Windows.Assets
public override void Initialize(LayoutElementsContainer layout) public override void Initialize(LayoutElementsContainer layout)
{ {
var proxy = (PropertiesProxy)Values[0]; var proxy = (PropertiesProxy)Values[0];
if (proxy.Asset == null || !proxy.Asset.IsLoaded) if (proxy.Asset == null || !proxy.Asset.IsLoaded)
{ {
layout.Label("Loading..."); layout.Label("Loading...", TextAlignment.Center);
return; return;
} }

View File

@@ -233,7 +233,7 @@ namespace FlaxEditor.Windows.Assets
} }
if (!materialInstance.IsLoaded || (materialInstance.BaseMaterial && !materialInstance.BaseMaterial.IsLoaded)) if (!materialInstance.IsLoaded || (materialInstance.BaseMaterial && !materialInstance.BaseMaterial.IsLoaded))
{ {
layout.Label("Loading..."); layout.Label("Loading...", TextAlignment.Center);
return; return;
} }
var parameters = materialInstance.Parameters; var parameters = materialInstance.Parameters;

View File

@@ -157,7 +157,7 @@ namespace FlaxEditor.Windows.Assets
var proxy = (MeshesPropertiesProxy)Values[0]; var proxy = (MeshesPropertiesProxy)Values[0];
if (proxy.Asset == null || !proxy.Asset.IsLoaded) if (proxy.Asset == null || !proxy.Asset.IsLoaded)
{ {
layout.Label("Loading..."); layout.Label("Loading...", TextAlignment.Center);
return; return;
} }
proxy._materialSlotComboBoxes.Clear(); proxy._materialSlotComboBoxes.Clear();
@@ -402,7 +402,7 @@ namespace FlaxEditor.Windows.Assets
var proxy = (MaterialsPropertiesProxy)Values[0]; var proxy = (MaterialsPropertiesProxy)Values[0];
if (proxy.Asset == null || !proxy.Asset.IsLoaded) if (proxy.Asset == null || !proxy.Asset.IsLoaded)
{ {
layout.Label("Loading..."); layout.Label("Loading...", TextAlignment.Center);
return; return;
} }
@@ -464,7 +464,7 @@ namespace FlaxEditor.Windows.Assets
var proxy = (UVsPropertiesProxy)Values[0]; var proxy = (UVsPropertiesProxy)Values[0];
if (proxy.Asset == null || !proxy.Asset.IsLoaded) if (proxy.Asset == null || !proxy.Asset.IsLoaded)
{ {
layout.Label("Loading..."); layout.Label("Loading...", TextAlignment.Center);
return; return;
} }
@@ -713,7 +713,7 @@ namespace FlaxEditor.Windows.Assets
var proxy = (ImportPropertiesProxy)Values[0]; var proxy = (ImportPropertiesProxy)Values[0];
if (proxy.Asset == null || !proxy.Asset.IsLoaded) if (proxy.Asset == null || !proxy.Asset.IsLoaded)
{ {
layout.Label("Loading..."); layout.Label("Loading...", TextAlignment.Center);
return; return;
} }

View File

@@ -82,7 +82,7 @@ namespace FlaxEditor.Windows.Assets
var proxy = (PropertiesProxy)Values[0]; var proxy = (PropertiesProxy)Values[0];
if (proxy.Asset == null || !proxy.Asset.IsLoaded) if (proxy.Asset == null || !proxy.Asset.IsLoaded)
{ {
layout.Label("Loading..."); layout.Label("Loading...", TextAlignment.Center);
return; return;
} }

View File

@@ -177,7 +177,7 @@ namespace FlaxEditor.Windows.Assets
var proxy = (MeshesPropertiesProxy)Values[0]; var proxy = (MeshesPropertiesProxy)Values[0];
if (proxy.Asset == null || !proxy.Asset.IsLoaded) if (proxy.Asset == null || !proxy.Asset.IsLoaded)
{ {
layout.Label("Loading..."); layout.Label("Loading...", TextAlignment.Center);
return; return;
} }
proxy._materialSlotComboBoxes.Clear(); proxy._materialSlotComboBoxes.Clear();
@@ -289,7 +289,7 @@ namespace FlaxEditor.Windows.Assets
var proxy = (SkeletonPropertiesProxy)Values[0]; var proxy = (SkeletonPropertiesProxy)Values[0];
if (proxy.Asset == null || !proxy.Asset.IsLoaded) if (proxy.Asset == null || !proxy.Asset.IsLoaded)
{ {
layout.Label("Loading..."); layout.Label("Loading...", TextAlignment.Center);
return; return;
} }
var lods = proxy.Asset.LODs; var lods = proxy.Asset.LODs;
@@ -492,7 +492,7 @@ namespace FlaxEditor.Windows.Assets
var proxy = (MaterialsPropertiesProxy)Values[0]; var proxy = (MaterialsPropertiesProxy)Values[0];
if (proxy.Asset == null || !proxy.Asset.IsLoaded) if (proxy.Asset == null || !proxy.Asset.IsLoaded)
{ {
layout.Label("Loading..."); layout.Label("Loading...", TextAlignment.Center);
return; return;
} }
@@ -553,7 +553,7 @@ namespace FlaxEditor.Windows.Assets
var proxy = (UVsPropertiesProxy)Values[0]; var proxy = (UVsPropertiesProxy)Values[0];
if (proxy.Asset == null || !proxy.Asset.IsLoaded) if (proxy.Asset == null || !proxy.Asset.IsLoaded)
{ {
layout.Label("Loading..."); layout.Label("Loading...", TextAlignment.Center);
return; return;
} }
@@ -788,7 +788,7 @@ namespace FlaxEditor.Windows.Assets
var proxy = (RetargetPropertiesProxy)Values[0]; var proxy = (RetargetPropertiesProxy)Values[0];
if (proxy.Asset == null || !proxy.Asset.IsLoaded) if (proxy.Asset == null || !proxy.Asset.IsLoaded)
{ {
layout.Label("Loading..."); layout.Label("Loading...", TextAlignment.Center);
return; return;
} }
if (proxy.Setups == null) if (proxy.Setups == null)
@@ -998,7 +998,7 @@ namespace FlaxEditor.Windows.Assets
var proxy = (ImportPropertiesProxy)Values[0]; var proxy = (ImportPropertiesProxy)Values[0];
if (proxy.Asset == null || !proxy.Asset.IsLoaded) if (proxy.Asset == null || !proxy.Asset.IsLoaded)
{ {
layout.Label("Loading..."); layout.Label("Loading...", TextAlignment.Center);
return; return;
} }

View File

@@ -23,7 +23,7 @@ AnimSubGraph* AnimGraphBase::LoadSubGraph(const void* data, int32 dataLength, co
auto subGraph = New<AnimSubGraph>(_graph); auto subGraph = New<AnimSubGraph>(_graph);
// Load graph // Load graph
MemoryReadStream stream((byte*)data, dataLength); MemoryReadStream stream((const byte*)data, dataLength);
if (subGraph->Load(&stream, false)) if (subGraph->Load(&stream, false))
{ {
// Load failed // Load failed

View File

@@ -92,7 +92,6 @@ public:
} }
#if USE_PRECISE_MESH_INTERSECTS #if USE_PRECISE_MESH_INTERSECTS
/// <summary> /// <summary>
/// Gets the collision proxy used by the mesh. /// Gets the collision proxy used by the mesh.
/// </summary> /// </summary>
@@ -100,7 +99,6 @@ public:
{ {
return _collisionProxy; return _collisionProxy;
} }
#endif #endif
public: public:

View File

@@ -155,15 +155,6 @@ public:
/// <returns>True whether the two objects intersected</returns> /// <returns>True whether the two objects intersected</returns>
bool Intersects(const Ray& ray, const Transform& transform, Real& distance, Vector3& normal) const; bool Intersects(const Ray& ray, const Transform& transform, Real& distance, Vector3& normal) const;
/// <summary>
/// Retrieves the eight corners of the bounding box.
/// </summary>
/// <param name="corners">An array of points representing the eight corners of the bounding box.</param>
FORCE_INLINE void GetCorners(Vector3 corners[8]) const
{
_box.GetCorners(corners);
}
public: public:
/// <summary> /// <summary>
/// Draws the mesh. Binds vertex and index buffers and invokes the draw call. /// Draws the mesh. Binds vertex and index buffers and invokes the draw call.

View File

@@ -135,8 +135,7 @@ BoundingBox SkinnedModelLOD::GetBox(const Matrix& world) const
for (int32 j = 0; j < Meshes.Count(); j++) for (int32 j = 0; j < Meshes.Count(); j++)
{ {
const auto& mesh = Meshes[j]; const auto& mesh = Meshes[j];
mesh.GetCorners(corners); mesh.GetBox().GetCorners(corners);
for (int32 i = 0; i < 8; i++) for (int32 i = 0; i < 8; i++)
{ {
Vector3::Transform(corners[i], world, tmp); Vector3::Transform(corners[i], world, tmp);
@@ -154,7 +153,7 @@ BoundingBox SkinnedModelLOD::GetBox(const Matrix& world, int32 meshIndex) const
Vector3 tmp, min = Vector3::Maximum, max = Vector3::Minimum; Vector3 tmp, min = Vector3::Maximum, max = Vector3::Minimum;
Vector3 corners[8]; Vector3 corners[8];
const auto& mesh = Meshes[meshIndex]; const auto& mesh = Meshes[meshIndex];
mesh.GetCorners(corners); mesh.GetBox().GetCorners(corners);
for (int32 i = 0; i < 8; i++) for (int32 i = 0; i < 8; i++)
{ {
Vector3::Transform(corners[i], world, tmp); Vector3::Transform(corners[i], world, tmp);
@@ -172,8 +171,7 @@ BoundingBox SkinnedModelLOD::GetBox() const
Vector3 corners[8]; Vector3 corners[8];
for (int32 j = 0; j < Meshes.Count(); j++) for (int32 j = 0; j < Meshes.Count(); j++)
{ {
Meshes[j].GetCorners(corners); Meshes[j].GetBox().GetCorners(corners);
for (int32 i = 0; i < 8; i++) for (int32 i = 0; i < 8; i++)
{ {
min = Vector3::Min(min, corners[i]); min = Vector3::Min(min, corners[i]);