Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Asset Forge

Create your own 3D models and 2D sprites! · By Kenney

Lua - UI Integration

A topic by prozacgod created Sep 02, 2020 Views: 229 Replies: 1
Viewing posts 1 to 2

I think exposing a UI interface for Lua could open up a lot of "quick fixes" for rough edges within the application.

Current lua scripts are "run and done" - this does make it harder to maintain compatibility with them, but I think
the described path works well.  (I can elaborate a more desirable path, if you're willing to consider imperfect backward compatibilty)

I think the path to making something like this usable would be adding a function like a " forge.uiGetOptions "

local opts = forge.ui.getOptions({
  radius = forge.ui.field.int("Radius", 0, 100),
  text = forge.ui.field.string("Text"),
  position = forge.ui.field.vector3("Position"),
});

This function would pause script execution, present the user interface into the left panel allowing the user to input data into those
fields, and click an action to commit that data to the script  (the allocated Lua_State would just be waiting for ever, I have some more ideas there too)

After the user finalizies their input - this function would return to the lua state, a table with the matching keys filled with the user input values

Allowing the script to continue execution, and interacting with the Asset Forge state.I was thinking a nice "bonus" as I've implemented stuff like this in the past, having the ability to discern between "actions" or "purpose" is super nice.

So, maybe adding a button/action component that returns the value of the button label as the results "action" prop

forge.ui.action.button("Draw") 

Multiple action buttons could be specified by the action.button, when an action.button is defined, the text in the button will be returned to the lua app opts.action when selected by a user.

if (opts.action == "Draw") {

}

I hope this proposal isn't a big ask, I'd love to start writing content scripts for asset forge ;)


Would be amazing to see