GLTF Metadata in Sandbox

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. :slight_smile:

2 Likes