Jump to content

[SOLVED] engine.materials.findMaterialByGUID issue


photo

Recommended Posts

Hi, I have been writting a simple script to check if all .node files, of a given folder, have a certain material (or an inherit one) attached to each one of the surfaces (only for ObjectMesh* nodes). At the end, the script writes a report with all surfaces that don't have a material of the given family attached.

 The problem comes when I retrieve the GUID as an string from xml file and I call engine.materials.findMaterialByGUID code is something like this:

Xml node_xml; //Xml::load() from .node file
string guid_str = node_xml.getArg("material"); //retrieves an string like 'ab4535ec80b5de8e2fd2c3559f3cc474b2587b4d'

UGUID guid = new UGUID();
guid.setString(guid_str);
guid.isValid(); //returns true always

Material material = engine.materials.findMaterialByGUID(guid); //throws an error which says 'Variable::getGUIDSafe(): can't convert extern class to guid'

Script is run by a console command in Editor. SDK version is 2.7.2.1

Which is the good way to use 'findMaterialByGUID' ? Is there any other way to retrieve the material?

Regards, Javier

Link to comment

Hi, this is not urgent as is only for a material validation script (we are managing thousands of Objects).

I can workaround by instancing nodes and retrieving their material by Object::getMaterial().

Thanks for your quick response, Javier

Link to comment

In this particular project we won't update it because is on its final stages. We create new projects in last SDK version available so it is great to have the fix in 2.8 version.

I can workaround in 2.7.2 and use the fix in future projects.

Thanks 

Link to comment
  • 4 weeks later...
  • morbid changed the title to [SOLVED] engine.materials.findMaterialByGUID issue
×
×
  • Create New...