Jump to content

[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
  • Like 1
Link to comment
  • silent changed the title to [SOLVED] finding material , case insensitive
×
×
  • Create New...