michal Posted October 23, 2020 Share Posted October 23, 2020 (edited) hi I would like to find material in Materials list, but case-convention for material can differ. I am interested in way how to find material in case insensitive manner. Now I am using fore approach. void chane_material_on_object(Unigine::ObjectPtr& objPtr, std::string_view materialName) { for (int material_id = 0 ; material_id< Materials::getNumMaterials() ; ++material_id ) { if (aux::to_lower_case(Materials::getMaterialName(material_id)) == aux::to_lower_case(materialName)) { MaterialPtr const & material = Materials::getMaterial(material_id); for (int i = 0; i < objPtr->getNumSurfaces(); i++) { objPtr->setMaterial(material, i); } } } } Thanks for any help Edited October 23, 2020 by michal 1 Link to comment
silent Posted October 26, 2020 Share Posted October 26, 2020 Hi Michal, I guess that's the only valid way to do it for now. We do have a minor priority task in our bug tracker system to add case-insensitive option to all the find* methods, but when it would be done I can't say. 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
michal Posted October 26, 2020 Author Share Posted October 26, 2020 No problem , thanks for letting me know 1 Link to comment
Recommended Posts