Add small code optimizations

This commit is contained in:
Wojtek Figat
2024-05-10 12:27:28 +02:00
parent 44006dd533
commit 68653fa91f
4 changed files with 7 additions and 9 deletions

View File

@@ -351,6 +351,8 @@ namespace FlaxEditor.Viewport
private void OnCollectDrawCalls(ref RenderContext renderContext) private void OnCollectDrawCalls(ref RenderContext renderContext)
{ {
if (renderContext.View.Pass == DrawPass.Depth)
return;
DragHandlers.CollectDrawCalls(_debugDrawData, ref renderContext); DragHandlers.CollectDrawCalls(_debugDrawData, ref renderContext);
if (ShowNavigation) if (ShowNavigation)
Editor.Internal_DrawNavMesh(); Editor.Internal_DrawNavMesh();

View File

@@ -98,7 +98,6 @@ namespace FlaxEditor.Viewport
ShowDebugDraw = true; ShowDebugDraw = true;
ShowEditorPrimitives = true; ShowEditorPrimitives = true;
Gizmos = new GizmosCollection(this); Gizmos = new GizmosCollection(this);
var inputOptions = window.Editor.Options.Options.Input;
// Prepare rendering task // Prepare rendering task
Task.ActorsSource = ActorsSources.CustomActors; Task.ActorsSource = ActorsSources.CustomActors;
@@ -219,6 +218,8 @@ namespace FlaxEditor.Viewport
private void OnCollectDrawCalls(ref RenderContext renderContext) private void OnCollectDrawCalls(ref RenderContext renderContext)
{ {
if (renderContext.View.Pass == DrawPass.Depth)
return;
DragHandlers.CollectDrawCalls(_debugDrawData, ref renderContext); DragHandlers.CollectDrawCalls(_debugDrawData, ref renderContext);
_debugDrawData.OnDraw(ref renderContext); _debugDrawData.OnDraw(ref renderContext);
} }

View File

@@ -132,7 +132,7 @@ public:
static ScriptingObject* ToNative(MObject* obj); static ScriptingObject* ToNative(MObject* obj);
static MObject* ToManaged(ScriptingObject* obj) FORCE_INLINE static MObject* ToManaged(const ScriptingObject* obj)
{ {
return obj ? obj->GetOrCreateManagedInstance() : nullptr; return obj ? obj->GetOrCreateManagedInstance() : nullptr;
} }

View File

@@ -1991,13 +1991,8 @@ namespace Flax.Build.Bindings
} }
contents.Append(')').AppendLine(); contents.Append(')').AppendLine();
contents.Append(" {").AppendLine(); contents.Append(" {").AppendLine();
if (buildData.Target.IsEditor && false) contents.Append(" static MMethod* method = nullptr;").AppendLine();
contents.Append(" MMethod* method = nullptr;").AppendLine(); // TODO: find a better way to cache event method in editor and handle C# hot-reload contents.AppendFormat(" if (!method) {{ method = {1}::TypeInitializer.GetClass()->GetMethod(\"Internal_{0}_Invoke\", {2}); CHECK(method); }}", eventInfo.Name, classTypeNameNative, paramsCount).AppendLine();
else
contents.Append(" static MMethod* method = nullptr;").AppendLine();
contents.Append(" if (!method)").AppendLine();
contents.AppendFormat(" method = {1}::TypeInitializer.GetClass()->GetMethod(\"Internal_{0}_Invoke\", {2});", eventInfo.Name, classTypeNameNative, paramsCount).AppendLine();
contents.Append(" CHECK(method);").AppendLine();
contents.Append(" MObject* exception = nullptr;").AppendLine(); contents.Append(" MObject* exception = nullptr;").AppendLine();
if (paramsCount == 0) if (paramsCount == 0)
contents.AppendLine(" void** params = nullptr;"); contents.AppendLine(" void** params = nullptr;");