ProwlEngine / Prowl

An Open Source C# 3D Game Engine under MIT license, inspired by Unity and featuring a complete editor and built on Silk.NET
MIT License
328 stars 27 forks source link

[Runtime/Gizmos] UI Runtime Solution #91

Closed recore67 closed 7 months ago

recore67 commented 7 months ago
    // Not a fan of these being here, their for the Editor but since they are used in Runtime and Runtime doesnt reference the Editor
    // It needs to be here :( need a better solution
    public static ImGuizmoOperation GizmosOperation = ImGuizmoOperation.Translate;
    public static ImGuizmoMode GizmosSpace = ImGuizmoMode.Local;

Maybe we move it to a new file within the Runtime Utils folder? called like RuntimeGizoms.cs or similar. It would add to the necessity to reference the folder/namespace when used globally, but it would remove the need for using HexaEngine.ImGuizmoNET; in Scenemanager.cs and other places if so.

michaelsakharov commented 7 months ago

I think the root of this issue is the GameObject gizmos stuff is handled In the GameObject class itself, that is the only reason that code needs to be in the runtime. Ideally, I think we remove ImGUI completely from the Runtime and make it Editor Only, then we make our own UI system for the runtime/games.

I've already started work on a custom UI solution for the runtime.

recore67 commented 7 months ago

oh ok cool, i agree with that solution. If i may ask, can you brief me through the idea of it?

michaelsakharov commented 7 months ago

Yeah, So the first thing needs to be moving the GameObject.DrawGizmos() function into the Editors ViewportWindow class, It gets called there so moving it over shouldn't be too hard.

Then move the ImGUI folder from the Runtime to the Editor and update the namespaces Prowl.Runtime.ImGUI -> Prowl.Editor.ImGUI

I just removed a reference to ImGUI in the runtime just now, So all thats left is GameObject/SceneManager and the ImGUI folder.

michaelsakharov commented 7 months ago

Ah theres also the ImGUI Attributes like [Header("")] and whatnot for components, will need to redesign that to handle its logic in the editor, and just have the attributes in the runtime.

michaelsakharov commented 7 months ago

Moved ImGUI to the Editor, solving the original problem posed by this issue so gonna close it, ill create a new issue later on for a Runtime UI solution once i decide what exactly i wanna do regarding that.