fabre.cedric Posted March 28, 2022 Share Posted March 28, 2022 Hello, I have rewrited a big part of my materials functions for the 2.15.1 version of Unigine. I would like to know how to force the guid of a loaded material because I need to reuse the previous material's guid to get compatibility with my previous scene format. Thanks. Link to comment
silent Posted March 29, 2022 Share Posted March 29, 2022 Hi Fabre, There is no way to force a specific GUID from API. You can, however, change it directly in the XML of loaded material. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
fabre.cedric Posted March 29, 2022 Author Share Posted March 29, 2022 Hi Silent, When I inherit a material from Unigine::mesh_base there is no way to force the guid :-/ ? Thanks Link to comment
silent Posted March 29, 2022 Share Posted March 29, 2022 In that case I think you can use Material::inherit(const UGUID&guid) method. For some reason it's not documented (we will fix this ASAP). So if you already have some material you can do the following: MaterialPtr m = Materials::findManualMaterial("Unigine::mesh_base"); // loading UGUID new_guid; // different ways for GUIDs generation new_guid.generate(); // 1 - random guid new_guid.generate("seed"); // 2 - seed-based guid generation new_guid("50beb449ed1431141cf7696393a7bf66432c4f8d"); // 3 - construct from string new_guid.setFileSystemString("guid://50beb449ed1431141cf7696393a7bf66432c4f8d"); // 4 - construct from fs string // setting new guid to inherited material MaterialPtr m2 = m->inherit(new_guid); Hope that helps. 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 Link to comment
fabre.cedric Posted March 29, 2022 Author Share Posted March 29, 2022 Perfect!! You saved my life Silent :D !!! Thanks Link to comment
Recommended Posts