Accessing custom properties in complex gltf scenes

I have created a complex model of a building including all structural steel, internal walls and floors. When I import the gltf I traverse the model and add userData attributes: uName, uIndex, uMaterial, uVolume, uWeight, uSelected and uSelectable (all strings). These attributes are used to set the meshes visibility property to simulate the construction (or demolition) sequence of the building, and to provide access to element data (weight,volume, material etc) in a custom GUI.
I can access the ‘first order attributes’ such as ‘name,’ ‘type’, ‘uuid’, ‘visible’ using getObjectProperty(‘type’,‘Mesh’) or getObjectProperty(‘uuid’,‘ID’) for example and this works as expected (and I can then access the ‘second order attributes’ in userData (e.g. userData.uIndex) without issue. However if I try to retrieve a mesh based on its ‘uIndex’ value directly using getObjectProperty(‘userData.uIndex’, ‘2’) it returns undefined. Any suggestions what I’m doing wrong?

getObjectByProperty does not evaluate nested properties or other JavaScript expressions, just a single property specified by name. I would recommend just traversing the scene graph to find the object(s) you need. It will be faster to do the traverse and store any lookup maps you need up front, rather than calling getObjectByProperty many times.

Thanks for this. As I have approx. 600 meshes the traverse method had to much overhead. I’ve worked around it by populating a myUserData array with first order data uuid and an arbitrary index value based upon an i++ as the traverse is executed the one time on import. I then use that array to identify any uuid based on a given index and then use the uuid to set the myObject directly using myObject = getObjectByProperty(‘uuid’,‘myIndex’). I can then access (get and set) the mesh object properties using dot notation as required: myObject.userData.name, myObject.userData.material.name, myObject.userData.Volume, myObject.userData.Weight , myObject.userData.Index etc. The index values are then set to more appropriate values via a custom GUI as the model is interrogated and manipulated, but the Indexes were never going to be right form the outset anyway. I then save the values to a file which is loaded on subsequent visits.