klepto2 Posted November 3, 2023 Share Posted November 3, 2023 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 Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
Josh Posted November 3, 2023 Share Posted November 3, 2023 To downcast just call Model(entity). This works for most types but since it is a function I have to declare there may be some missing. Quote 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 More sharing options...
Josh Posted November 13, 2023 Share Posted November 13, 2023 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... Quote 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 More sharing options...
Josh Posted November 14, 2023 Share Posted November 14, 2023 model.base is now added to the Lua API and can be used as the asset to open a model. Quote 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 More sharing options...
klepto2 Posted November 14, 2023 Author Share Posted November 14, 2023 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) Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
Josh Posted November 14, 2023 Share Posted November 14, 2023 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") Quote 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 More sharing options...
klepto2 Posted November 17, 2023 Author Share Posted November 17, 2023 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) ? Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
Josh Posted November 17, 2023 Share Posted November 17, 2023 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) Quote 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 More sharing options...
Recommended Posts
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.