Part 6: It's time for some Menu Game Theory.

Part 6: It's time for some Menu Game Theory.

The next victim on my quest to iPad-ificate Godot was the top-level menu. Despite having a slender menu in an industry dominated by uncontrolled menu bloat, on the iPad, this menu still looks like ordering a burrito at a French restaurant.

I am not a UI designer, so I rely on Apple's guidance from the last few years of WWDC, as I am taking inspiration from Apple's applications and some of my favorites on the iPad. In particular, Apple has identified an idiom for Godot-style class applications called "Editors," and when you adopt this idiom in SwiftUI, various spots on the screen are assigned standard roles.

After surveying every menu item and what they do, we found new homes for everything in iPad-friendly locations on the "Editor" mode for SwiftUI.

The scene menu looks like this:

After a strict diet, I re-hosted this menu into this Editor-styled menu on the iPad, and this is what is left of it, in all of its glory:

Creating a Scene


Godot has three ways of creating a scene from the UI:

Menu/New Scene:  This creates an empty scene with no name or root node. It then resets the ScenePad to an initial state, and you must pick your root node.

FilePad/Create New Scene: This option pops up a dialog that lets you pick an initial node yet assigns no name to your scene:

New Inherited Scene: This option creates a scene based on an existing one.  The UI lets you pick a file, and that is what you inherit from: 

A file picker lets you pick which scene you will inherit

Since I wanted to have a name that I could automatically save, I merged all these capabilities into a UI that I think is vastly simpler, and it looks like this:

New Scene Dialog in Godot for iPad

This UI steers you towards assigning a name and choosing a starting node (3D, 2D, UI). The name is important, and this is different than the existing Godot workflow, and I will discuss why in the next section.

You can still choose your own adventure by picking "Empty." In that case, your scene will have a name, but no root node, which the ScenePad will still help you initialize for you

ScenePad contents on an empty Scene

For the "New Inherited Scene" option, rather than dumping the user into a file picker, I populate the list with possible scenes, so the user just needs to change from "New" to one of the valid scenes to inherit from:

Open Menu Options

This UI steers you towards assigning a name and choosing a starting node (3D, 2D, UI). You can still choose your own adventure by picking "Empty.".

If you want to inherit a scene, you would use the picker on "New" and select one of the valid scenes in the project instead:

If you were to go with the "Empty" node, later on, you could pick your root node from the ScenePad:

Open

There are too many open options surfaced. Three of them pop up a quick-open dialog to select a file by fuzzy searching, scoped to a particular kind of file, and another one brings up a full file dialog.

I replaced all four options with a single sheet that lets you filter the file type:

Since I have been using Xcode and Visual Studio Code extensively, my file filtering mimics those, rather than the Godot system. So you can type things like "ft" and that would filter to "Foo.tscn" on the list above.

If you want to pick a file from all of the project files instead of being limited to the three buckets above, you can tap on that folder icon, and this hand-crafted SwiftUI UI shows up. SwiftUI really shines at letting you write UIs like this with very little code:

Saving

On iPad, it is rare to have an application surface the Save command. The contents should be saved automatically for you. With Godot, things do not work this way. Instead, Scenes in Godot are created in memory, and only when you try to save them do you pick a name for them.

That is why steering the user to provide a name for the scene was so valuable. Now, I can save it without interrupting your workflow.

I have not yet wired up automatic saving, so in the meantime, I added a menu, along with shortcuts to save your project:

One neat feature of SwiftUI on the iPad is that it surfaces your keyboard shortcuts on this overlay when you press hold the Command key:

Undo and Redo

I moved Undo and Redo from this menu into the toolbar. I might move them later into the design surface, but for now, they reset into SwiftUI's "secondary action" region for editors:

Undo and Redo Menu items go into the secondary region

Other Menu Entries

The last survivor was the "Export" option, which I tucked in the [...] application menu—everything else has been yeeted.

"Reload Saved Scene" might be helpful to desktop users, but it will become worthless in a world that embraces automatic scene saving. The closing scene option exists, but merely as a power-user keyboard shortcut (for those of you using a keyboard). Ordinary people like me will tap the [x] icon on a tab to close a scene.

Resources

Subscribe to La Terminal Blog

Sign up now to be the first to know.
Guenter Gibbon
Subscribe