Archive 17/01/2023.

Strange xml node deserialization error

Leith

I have exported a static object “by node” to an xml file.
When I instantiate the object using Scene::InstantiateXML, I get an error message in the console about my xml file not being a valid model.
The call returns successfully - the returned node has a staticmodel component with a valid model resource which works in the scene perfectly…

        if(ModelName.EndsWith(".xml"))
        {
            auto e = cache->GetResource<XMLFile>(ModelName)->GetRoot();
            Node* newnode = node_->GetScene()->InstantiateXML(e,Vector3::ZERO, Quaternion::IDENTITY);
Leith

This issue was resolved - it was a simple logical error in the code I use to instantiate models.
My code was attempting to locate named models in the resourcecache even when the filepath indicated that it should be loading from xml. Since my code was returning a valid object, I failed to notice the bug which resided early in the function in question.