Is it possible to view the metadata (specifically the “extras” section) of a GLTF model within the Sandbox? I can’t seem to find where that would be and haven’t found an old forum post asking for this. Thanks
Hi.
You just need register extension for loader before load:
GLTFLoader.RegisterExtension("tagsExtension", function (loader) { return new TagsExtension(loader); });
and add tags as you need:
class TagsExtension implements IGLTFLoaderExtension{
public name = "custom";
public enabled = true;
constructor(private loader:GLTFLoader){}
public loadNodeAsync(context: string, node: INode, assign: (babylonMesh: TransformNode) => void) {
return this.loader.loadNodeAsync(context, node, function (babylonMesh:any) {
if (node.extras){
for (let i in node.extras){
babylonMesh.metadata.YOURTAG = node.extras;
}
}
assign(babylonMesh);
});
}
public dispose(): void {}
}
i was search anything solve and catch it on old forum. It work for me
aaah–I’ll have to edit from source. I should have been more clear–I was hopeful it was already
implemented within sandbox.babylonjs.com Looks like that isn’t the case. Thank you for the solution!
i don’t know about sanbox features, sorry. Perhaps it supported
This should be added to the Inspector cc @bghgary
Maybe we can add the ability to view the metadata in general to the inspector?
@Blax There is already a loader extension that adds extras to the metadata. There is no need to add another extension.
Hi @bghgary - I still wasn’t sure if this was the case? I am not seeing the metadata listed on the sandbox inspector.
exporter lists them as present -
GLB file confirms they are there
When I drag this into the babylon sandbox I can’t find them listed on any section of the inspector on the mesh mode. Unless i’ve misunderstood and it’s not a feature of the sandbox without adding an extension?
Many thanks in advance.
Pete
As a follow up to this, I’ve added the asset to a playground to illustrate the process from 3dsMax, was just wondering if the sandbox could do the same, that’s all!
Was also curious if this is the correct way to access the metadata in javascript?
This hasn’t been implemented. I was saying that it might be good to add it as a feature. Feel free to file a feature request on GitHub.
Thank you for the clarification @bghgary - it’s really not an issue since it’s fairly trivial to test with a simple playground setup.