ok let me try get everything stright for updating :
I already discovered i need to use “merge_materials”: 0,“graph_optimizer”: 0 for the utility to work, i was just passing these in in the constructor but there is a defaults object “clientInitObject” within the utility itself ( the constructor argument object is merged with this one ) which was currently empty so i just added these to that object now as it has to be set for the tool to work.
the utility was updated recently and now builds the internals from calling “getSceneGraph”. All the objects are sorted into objects matching their types but thye also each have a parent property and store a reference to their parent. I abstract adding listeners so that i can do some additional logic when a click event happens. So when a mouse event occurs i firstly get the node of the event object instanceID returned from sketchfab, then i simply transverse the parent structure till the first “Group” node and first node of type “MatrixTransform” is found. These references are then added to the event object.
this.onClick = function (e) {
var node = classScope.getNodeObject(e.instanceID);
var parentGroup = node.parent;
if(parentGroup !== null && parentGroup !== undefined){
while(parentGroup.type !== classScope.nodeTypeGroup ){
parentGroup = parentGroup.parent;
}
}
var parentMatrixTransform = node.parent;
if(parentMatrixTransform !== null && parentMatrixTransform !== undefined){
while(parentMatrixTransform.type !== classScope.nodeTypeMatrixtransform ){
parentMatrixTransform = parentMatrixTransform.parent;
}
}
e.node = node;
e.parentGroup = parentGroup;
e.parentMatrixTransform = parentMatrixTransform;
for (var i = 0; i < classScope.eventListeners.click.length; i++) {
classScope.eventListeners.click[i](e);
}
};
This works well let me know if you see anything that can be a problem… I obviously need to think about the null thing now… so will the event object argument be null then?
for the slow thing it is not documented any where but from you code example above can i presume it should be like this :
classScope.api.addEventListener("click", classScope.onClick,{ pick: 'slow' });
I dont know how this is related to the untility , this is a bug when uploading .blend files with multiple uv sets , i have encountered this bug over and over again even since that post.
This is not a problem to the utility and i have a optional argument when calling to update a material eg :
classScope.updateMaterial(classScope.sict.materialName, classScope.sketchfabAPIUtility.AlbedoPBR,{"texCoordUnit":1});
classScope.updateMaterial(classScope.sict.materialName, classScope.sketchfabAPIUtility.Opacity,{"internalFormat":"ALPHA","texCoordUnit":1,"type":"alphaBlend"});
So i can just change the texCoordUnit value to get around this bug. The huge problem is that many materials have textures set in the editor and when the uv is switched those textures all map incorrectly and I have to manually change every material, ~30 to fix it. and it switches a lot - sometimes every time i upload. In a day of editing and testing i can update a model several times and this switching is causing me 20-30 minutes of unneeded work each time.
anyway thank for the info , i will get to updating the utility where needed , i want to be as compliant to the latest viewer code as can be 