[SOLVED] finding material , case insensitive


photo

Recommended Posts

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 by michal
Link to post

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:

Link to post

No problem , thanks for letting me know

  • Thanks 1
Link to post
  • silent changed the title to [SOLVED] finding material , case insensitive