Read / write metadata using the inspector

Hi everybody,

Maybe it’s already possible but i don’t find it.

I think it could be great to have a button in the inspector which shows the metadata of the clicked mesh.
We could add or delete metadata and save them in the mesh using the inspector.

Thanks,

Boris

1 Like

cc @carolhmj and @RaananW

@bvaisman it might be hard as they are fully untyped and it would only be raw JSON I guess

Yes you’re right, it could be only a big editable text input on an opening window.
I’m a little bit fed up with the console.log on my clicked meshes. :wink:

But maybe it’s not a good idea.

Tell me.

Thanks for you answer.

I don’t see a reason why we can’t display it, but I don’t think adding an editor is so trivial. What will we save? json? string? will the editor validate the JSON you provide?
What if you add a very complex object to the mesh’s metadata?

I don’t know exactly what happens if the JSON string is not valid. I thought that metadatas were only additional informations about meshes with no influence on their display. If it is, I mean that it does not matter if the JSON string is valid or not. Maybe, in a first step, you could add a message to prevent the user that the JSON string won’t be validated automatically.

I am mainly talking about editing a javascript object :slight_smile:

the node’s metadata object can hold anything you want. not only primitives. It can be a different mesh, can be an object holding the entire scene, whatever you want it to be. We should probably be able to display it using some form of a serialization method (my assumption is that it will be a very simple json serialization, avoiding complex objects), but editing it is not an easy task.

Ok, if it is not trivial to edit it, and I really believe you, it could be displayed in a beautiful way, may be with the stringify function with parameters such as stringify(mymetadata,null,4).

I think that would be a good first step.

Sure, want to add an issue on the repository? you can reference this forum conversation to the featur request, and we’ll take it from there :slight_smile:

2 Likes

Done… :wink:

And thanks for your answer.

2 Likes