karim.salama Posted December 9, 2021 Posted December 9, 2021 Hi, In 2.15-alpha, there was a function called Unigine::Render::getPostMaterials(). Apparently, this function got removed in 2.15-beta. Is there an alternative to get the postmaterials in 2.15-beta+ ? Thanks
silent Posted December 9, 2021 Posted December 9, 2021 Hi Karim, Yeah, this method was removed. Now everything is called Scriptable material. So you need to use following methods: getNumScriptableMaterials() getScriptableMaterial(index) You can find full API changeset in migration section: https://developer.unigine.com/en/docs/future/upgrade/migration_api?rlang=cpp Thanks! 1 How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
karim.salama Posted December 9, 2021 Author Posted December 9, 2021 Ok thank you. I will try this out. I have noticed that getName for materials has been removed. I think the best replacement is getGUID, right? But can getManualName be a temporary replacement for now? Thanks
silent Posted December 10, 2021 Posted December 10, 2021 getManualName can only return name of the base material (for example, mesh_base) or manual material. If that's what you need - you can use it. If you want to get the name of any material, it's now become a bit complicated (it's being taken directly from filename now): const UGUID &file_mat_guid = Unigine::FileSystem::getGUID(mat->getPath()); const UGUID &asset_guid = Unigine::FileSystemAssets::resolveAsset(file_mat_guid); const Unigine::String &virtual_path = Unigine::FileSystem::getVirtualPath(asset_guid); const Unigine::StringStack<> material_filename = Unigine::String::filename(virtual_path); Thanks! 1 1 How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN
Amerio.Stephane Posted December 10, 2021 Posted December 10, 2021 3 hours ago, silent said: If you want to get the name of any material, it's now become a bit complicated Yeah, I too feel this should be in the migration guide, or better in the documentation... or even better a new API function that does exactly that. We too have code that search for a specific material name on a surface to tweak its parameters at run-time. 1
Recommended Posts