Jump to content

Editor Scripting suggestions


klepto2
 Share

Recommended Posts

I don't know exactly if this is the right place for this, but feel free to move it where ever you like,

After the debugging fix in the latest release, I have started to experiment with the Lua extension integration.

Some things I noticed:

  • Currently, there is no way to dynamically down cast an entity to its derived class, e.g.: Entity → Model
    • This is not supported by sol out of the box, but might be needed later as well for type checking.
    • Currently, you can access all entities in the world, but not determine if it is something other than an entity.
  • Some things are not yet accessible for extensions:
    • The objects in the scene (I found out how to add items, not very hard) but I can't find a way to access the already added items in the scene. (using the world property of the program is not very useful because of the first problem (cast/type check) I have mentioned)
  • Currently, there are no advanced extensions available, and as I understand that the focus lies on the release on bug fixing I would appreciate some documentation on how to properly script extensions (usage of the Undo/Redo, scene access) 

It would be nice to see some more advanced scripting options soon.

I especially like some of the syntaxes which are available through sol3:

local ent = world:GetEntitiesInArea(min,max)
for i = 1, #ent do
        local e = ent[i]
        local name = getmetatable(e).__type.name -- unfortunatly only returns "UltraEngine::Entity" and nothing else. No way to cast
        Print(name)
end

 

  • Windows 10 Pro 64-Bit-Version
  • NVIDIA Geforce 1080 TI
Link to comment
Share on other sites

  • 2 weeks later...
11 hours ago, klepto2 said:

program:OpenAsset is the only method to open the AssetEditor

How else would it work? Multiple asset windows can be opened, and they are never empty.

The Model.base member is a class that is an asset, though I am not sure if it is exposed to Lua. I don't see it in the documentation...

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

11 hours ago, Josh said:

How else would it work? Multiple asset windows can be opened, and they are never empty.

The Model.base member is a class that is an asset, though I am not sure if it is exposed to Lua. I don't see it in the documentation...

This is exactly what i meant. I guessed it should be only this one. 

Is the model.base already exposed in the editor? I can't access it after the latest update. 

This is what i have tried so far:

model.base (not available)

model:GetBase() (not available)

Asset(model) or Asset(model.base) (not working)

  • Windows 10 Pro 64-Bit-Version
  • NVIDIA Geforce 1080 TI
Link to comment
Share on other sites

Sorry about that. This will work now in build 246:

mdl = LoadModel(nil, "models/developer/crate/crate.gltf") program:OpenAsset(mdl.base)

Alternatively, you can just do this:

program:OpenAsset("models/developer/crate/crate.gltf")

 

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

that works.

I noticed, that sometimes when using CreateDir in the script, the assetbrowser is not updating the folder structure. Could you add a method which refreshes the nodes, or something like assetbrowser:RefreshFolder(folder) ? 

  • Windows 10 Pro 64-Bit-Version
  • NVIDIA Geforce 1080 TI
Link to comment
Share on other sites

8 hours ago, klepto2 said:

that works.

I noticed, that sometimes when using CreateDir in the script, the assetbrowser is not updating the folder structure. Could you add a method which refreshes the nodes, or something like assetbrowser:RefreshFolder(folder) ? 

It should detect a file system event. If not it is a bug...

A simple test works correctly:

CreateDir("Models/test")
CreateDir("Models/test/a/b/c", true)

 

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...