Jump to content

klepto2

Developers
  • Posts

    853
  • Joined

  • Last visited

Everything posted by klepto2

  1. Polyhaven.lua In this file i have changed the loading for the types and catagories to use curl and the inernal Command and LoadTable functions instead of the custom api dll. Replace this file in the Scripts\Start\Extensions folder. Hopefully this will resolve the initial problems. I will continue to replace the api calls with native curl requests to get rid of the external dll requirements. Let me know if this resolves some of the issues.
  2. So you was able to browse the items while debugging it? or was there just no error but still no treeview available? I am currently rewriting some internals to not rely on dlls that much. I will provide a small test later which rewrites the first step (treeview populating) using curl and Command an LoadTable instead of the custom dll for accessing the api. If that solves the problems i will rewrite the other api calls as well and remove all dll dependecies execept the pbr exe (this is needed for converting the HDR images and should not cause problems).
  3. Ok, you might need to allow access to some specific files. these are the files: in main directory: libcurl.dll then Modules/PolyHavenApiClient.dll and finally: Tools/pbr.exe and all dlls under plugins. Hopefully this will solve the issue. Otherwise i look forward for the debugging results.
  4. Hi, is it possible to debug the Editor for you? if you have installed VSCode you can go to the Ultraengine directory and run the Open with VSCode.bat and then Run -> Start Debugging. Also does the error occur just by opening the window (Polyhaven) or after selecting a node?
  5. Also some others are missing, I would suggest to add all possible default primitives, (Sphere, CubeSphere, Plane, etc.)
  6. The settings are more or less a prototype done shortly before the beta release. I have not used any dpi scaling in the plugin but i plan to include it in a refactored version. the stacksize error is new for me. Looks like a stack error with lua. could probably be a problem with either the dll for fetching the polyhaven api or the small json to lua extension i have added. I will investigate both. Also as Josh said the polyhaven is not an official plugin, so bug reports should be added here: or you could send me a PM.
  7. I will try the curl approach later. you can also add a refferer to curl.exe which could be used to fully support some api licenses.
  8. Not an important one, but some stricter compilers or parsers will break on line 258 in Math_.h inline unsigned int Rgba(const unsigned char r, unsigned const char g, unsigned const char b, unsigned const char a = 255) { return Clamp(r, 0, 255) | (Clamp(g, 0, 255) << 8) | (Clamp(b, 0, 255) << 16) | (Clamp(a, 0, 255) << 24);; } should be: inline unsigned int Rgba(const unsigned char r, const unsigned char g, const unsigned char b, const unsigned char a = 255) { return Clamp(r, 0, 255) | (Clamp(g, 0, 255) << 8) | (Clamp(b, 0, 255) << 16) | (Clamp(a, 0, 255) << 24);; } the const keyword is aligned wrong for the parameters g,b and a.
  9. You can change the tiling via the scale setting for each layer. in theory (which looks very ugly) you can assign a colormap covering the whole terrain.
  10. I have tried some approaches, but none of them is satisfying. I have an approach where i share the world between windows, but only create standalone ui_worlds. This is still laggy and i guess as Josh stated comes from the culling thread. For plane ui rendering it should be possible to disable culling on a camera or world at all. This would resolve this issue i think.
  11. Do you need multiple worlds? or is one world, but rendered on multiple windows (with different cameras) enough?
  12. instead of a panel you could maybe use a simple sprite and an orthographic camera.
  13. The editor does it, so it should be possible. Do you need different worlds? with one world I would create multiple cameras and rendertargets. And draw a panel in each window with the correct texture applied to it. i will come back with a sample in a few minutes.
  14. Open the project manager and click on the warning icon at your project (if there is one) this should trigger the project update.
  15. Just a sidenote: One thing that highly improves the editing (at least in my case) is to switch to single viewport while editing the terrain. Which makes absolutely sense, as only one viewport needs to handle the costly wireframe selection rendering.
  16. Here is a first version of the Polyhaven-extension polyhaven_browser.zip: This is an early release, but nearly everything should be working. Screenshot: Some notes: There might be some errors while converting some materials. this is due the fact that some materials have multiple diffuse files configured and i am currently assuming a "Diffuse" slot and not the other configured maps. This will be fixed and adressed in a later release. The settings dialog is a proof of concept extension which i plan to release as a standalone extension later and which might be a replacement for the current options dialog in the tools section. The scripts still have some garbage included which i will get rid of in a future release. Download: polyhaven_browser.zip Installation: Extract the content of the zip into your UltraEngine installation folder. The file structure in zip reflects the needed structure to get it working.
  17. I am currently working on the settings dialog for my Polyhaven browser. At first i wanted to use the defualt options dialog provided by the Editor itself, but for now this lacks some features and is not that easy to access. While you already can add your own options to the options dialog, you have no detailed enough control where these settings are stored. Lets take an example: I have a few settings for my extension and i want to have them stored this way: program.settings.extensions.polyhaven.model.folder = "Models/Polyhaven" program.settings.extensions.polyhaven.material.folder = "Materials/Polyhaven" program.settings.extensions.polyhaven.hdri.folder = "Materials/Environment/Polyhaven" program.settings.extensions.polyhaven.material.downloadSize = "2k" program.settings.extensions.polyhaven.model.downloadSize = "4k" program.settings.extensions.polyhaven.hdri.downloadSize = "4k" program.settings.extensions.polyhaven.material.displacement = true program.settings.extensions.polyhaven.material.displacement_settings = {} program.settings.extensions.polyhaven.material.displacement_settings[1] = 0.025 program.settings.extensions.polyhaven.material.displacement_settings[2] = -0.0125 this works nicely, and the editor correctly saves and load them correctly. But they are of course not visible in the options dialog of the editor itself. with this small piece you can add options to the editors options dialog: local opt = program.optionsdialog opt:AddSetting("extensions", "Displacement", PROPERTY_BOOLEAN) but this will just use "program.settings.extensions.displacement" in the settings.json instead of the original intended path. So what are my requirements for a good settings dialog: it should be as generic as possible this means it should be easy to extend functionality. eg: add a specific settings behaviour when it is not included already. each option should represent a path in the settings file it should be possible to have groups of settings it should still using the editors own settings.json This is what i have so far: First some sample code i use in my polyhaven extension: --Setups the settingsdialog or returns the already created one --the setting is more or less a simple singleton shared via the global table local assetsettings = require("assetsettings") --Now we define the settings layout and register settings --the option groups are created by the path and the order they are added --you can have multiple sub nodes local hdrnode = assetsettings.registerOptionGroup("Polyhaven/Hdri") assetsettings.addSettingFolder(hdrnode,"Storage-Path", "Materials/Environment/Polyhaven", "extensions.polyhaven.hdri.folder") assetsettings.addSettingCombobox(hdrnode,"Download-Size", "2k","1k;2k;4k;8k", "extensions.polyhaven.hdri.downloadSize") local material_node = assetsettings.registerOptionGroup("Polyhaven/Material") assetsettings.addSettingFolder(material_node,"Storage-Path", "Materials/Polyhaven", "extensions.polyhaven.material.folder") assetsettings.addSettingCombobox(material_node,"Download-Size", "2k","1k;2k;4k;8k", "extensions.polyhaven.material.downloadSize") assetsettings.addSettingCheckbox(material_node,"Displacement", true, "extensions.polyhaven.material.displacement") local model_node = assetsettings.registerOptionGroup("Polyhaven/Model") assetsettings.addSettingFolder(model_node,"Storage-Path", "Models/Polyhaven", "extensions.polyhaven.model.folder") assetsettings.addSettingCombobox(model_node,"Download-Size", "2k","1k;2k;4k;8k", "extensions.polyhaven.model.downloadSize") and this is how it looks like: you can even select toplevel nodes and then you get this: So if you want, you can get all settings in one place, or get a cleaner one by selecting the subgroup directly. Each addSettings...() method is responsable for its own to create the required widgets and to update the values which should be saved. sample implementation of the combox setting: function assetsettings.addSettingCombobox(node, description, defaultvalue, possibleValues, settingspath) assetsettings.addSetting(node, description, defaultvalue, settingspath, function(x,y, labelwidth, item, parent) local width = parent:ClientSize().x - 10 CreateLabel(item.description..":", x ,y + 5,labelwidth,25, parent) local combobox = CreateComboBox(x + labelwidth,y, width -labelwidth-5, 25, parent) local n = possibleValues:split(";") for i = 1, #n do combobox:AddItem(n[i], n[i] == item.valuetosave) end ListenEvent(EVENT_WIDGETSELECT, combobox, function() local w_item = combobox.items[combobox:GetSelectedItem()] item.valuetosave = w_item.text end, assetsettings) return combobox end ) end the underlying addsettings function already sets up all required properties to handle the updating and saving behaviour. If you close and save the dialog, the item.valuetosave is the applied to the correct parogram.settings path and stored as soon as the engine saves the settings.json.
  18. klepto2

    modular_export

    While working on the settings i have added a small addition: models like the ones having modular or set in their names. can now alternatively exported separately. If more than one child model is found it wll ask if you want to extract the individual models.
  19. If you drop a model from the assetbrowser into a viewport, the rotation is set to a weird value depending on the viewport you drop the model. Perspective: -90,0,0 Top : 90,0,0 Left : 0,90,0 Back : -90,0,0 I would expect that the initial orientation is always 0,0,0.
  20. 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) ?
  21. Yeah i also noticed that and also filed a bug report: An idea for @Josh: Maybe just render a simple plane with the terrain matrix applied to the selection buffer. This will not be optimal as the outline is just flat, but will hopefully solve the bottleneck. Or there must be some other indicator for terrain selection.
  22. made some major progress: 1. Processing is much faster now 2. Thanks to the AsyncDownloadfile function the whole process of navigating is nearly instant and fluent 3. HDRs are now converted silently 4. Added progress indicators 5. Added Joshs latest additions to the plugin - Models and Materials are selected in the project folder - AssetEditor is opend for both Materials and Models - GI is rebuilt when the generated HDR is applied to the scene 6. The tree is populated with more recognizable name patterns What todo: 1. fill the settings with live 2. cleanup the code 3 fix smaller bugs
  23. Hi, I have tried various JSON parsers for lua. And they are all slow as hell (at least if the json string is a larger one). In my API -Module for Polyhaven i have integrated a function which converts the nlohman:json object into a lua table and this is magnitudes faster than any lua json library. Also the usage is very easy and lua like. void jsonToLua(const nlohmann::json& json, lua_State* L) { switch (json.type()) { case nlohmann::json::value_t::null: lua_pushnil(L); break; case nlohmann::json::value_t::boolean: lua_pushboolean(L, json.get<bool>()); break; case nlohmann::json::value_t::number_integer: lua_pushinteger(L, json.get<int>()); break; case nlohmann::json::value_t::number_unsigned: lua_pushinteger(L, json.get<unsigned>()); break; case nlohmann::json::value_t::number_float: lua_pushnumber(L, json.get<double>()); break; case nlohmann::json::value_t::string: lua_pushstring(L, json.get<std::string>().c_str()); break; case nlohmann::json::value_t::array: lua_newtable(L); for (size_t i = 0; i < json.size(); ++i) { lua_pushinteger(L, i + 1); // Lua arrays are 1-indexed jsonToLua(json[i], L); lua_settable(L, -3); } break; case nlohmann::json::value_t::object: lua_newtable(L); for (auto it = json.begin(); it != json.end(); ++it) { lua_pushstring(L, it.key().c_str()); jsonToLua(it.value(), L); lua_settable(L, -3); } break; default: // Handle other types if needed break; } } int lua_JsonToLua(lua_State* L) { std::string jsonString; if (lua_isstring(L, -1)) { jsonString = lua_tostring(L, -1); } auto json = nlohmann::json::parse(jsonString); jsonToLua(json, L); return 1; } extern "C" { __declspec(dllexport) int luaopen_PolyHavenApiClient(lua_State* L) { // Load the DLL and create an instance of PolyHavenApiClient lua_newtable(L); int sz = lua_gettop(L); lua_pushcfunction(L, lua_JsonToLua); lua_setfield(L, -2, "JsonToLua"); lua_settop(L, sz); return 1; } } With this you can do something like this: local assets = extension.api.getAssets(type,cat) --just a sample api call i use to retrieve the json data local assetTable = extension.json.JsonToLua(assets) -- convert json string to lua table Print(assetTable.bark_brown_01.name) --or iterating sorted by keys function pairsByKeys (t, f) local a = {} for n in pairs(t) do table.insert(a, n) end table.sort(a, f) local i = 0 -- iterator variable local iter = function () -- iterator function i = i + 1 if a[i] == nil then return nil else return a[i], t[a[i]] end end return iter end for key,data in pairsByKeys(extension.currentAssets ) do Print(key.." Displayname: "..data.name) --Prints in this case eg: "bark_brown_01 Displayname: Bark Brown 01 end
  24. currently i only find LoadTable functions for a path or a stream, it would be nice to have a method to load the table structure by providing just a json string (eg: When Fetching a url request) In general this can be done by using the Stream method, but the stream override is not available in lua and might be a bit complicated to use.
  25. 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)
×
×
  • Create New...