nikolaj.kormushkin Posted April 20, 2020 Share Posted April 20, 2020 Добрый день, сотрудники компании Unigine. Хочу сделать проверку, имеется-ли нужный мне материал. В документации во многих местах (например тут) фигурирует код следующего плана: MaterialPtr mat = Materials::findMaterial("имя_материала"); У меня-же этот код приводит к ошибке компилятора: "a non static member reference must be relative to a specific object". Добавил необходимый #include (согласно документации): #include <UnigineMaterials.h> и объявлен using namespace Unigine; Подскажите пожалуйста, в чём может быть проблема? Link to comment
rohit.gonsalves Posted April 20, 2020 Share Posted April 20, 2020 Dear Nikolaj, Are you sure? You have this error on the same line? Regards, Rohit Link to comment
nikolaj.kormushkin Posted April 21, 2020 Author Share Posted April 21, 2020 10 hours ago, rohit.gonsalves said: Dear Nikolaj, Are you sure? You have this error on the same line? Regards, Rohit Yes, Rohit. This is an example of my code where i get a compilation error (VS 2017): MaterialPtr mat = Materials::findMaterial("water_mesh_base_0"); Screenshot of compile error: Link to comment
silent Posted April 21, 2020 Share Posted April 21, 2020 Hi Nikolaj, Can you reproduce that in a default C++ sample from SDK Browser? SDK Browser -> Samples -> C++ -> Systems -> Materials? I can't find any issues as well: 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
nikolaj.kormushkin Posted April 21, 2020 Author Share Posted April 21, 2020 (edited) 44 minutes ago, silent said: Hi Nikolaj, Can you reproduce that in a default C++ sample from SDK Browser? SDK Browser -> Samples -> C++ -> Systems -> Materials? I can't find any issues as well: Thanks, for the link on exaple in SDk Browser. From the example i got a variant that works well: Materials *materials = Materials::get(); MaterialPtr mat = materials->findMaterial("water_mesh_base_0"); It's strange that this code: MaterialPtr mat = Materials::findMaterial("water_mesh_base_0"); doesn't work for me, but it works for you. Edited April 21, 2020 by nikolaj.kormushkin Link to comment
silent Posted April 21, 2020 Share Posted April 21, 2020 Smart pointers behavior was redesigned in 2.10 and now ::get() is not required. It looks like you are still using pre-2.10 releases? 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
nikolaj.kormushkin Posted April 21, 2020 Author Share Posted April 21, 2020 7 minutes ago, silent said: Smart pointers behavior was redesigned in 2.10 and now ::get() is not required. It looks like you are still using pre-2.10 releases? Thanks! Yes, i use 2.9.0.2 sdk version. Link to comment
silent Posted April 21, 2020 Share Posted April 21, 2020 In that case you need to select correct documentation version in the drop-down list: 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
nikolaj.kormushkin Posted April 21, 2020 Author Share Posted April 21, 2020 4 minutes ago, silent said: In that case you need to select correct documentation version in the drop-down list: OK, thanks! Link to comment
Recommended Posts