Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing mesh names from jgltf-model #23

Closed
laserallan opened this issue Oct 6, 2017 · 6 comments
Closed

Accessing mesh names from jgltf-model #23

laserallan opened this issue Oct 6, 2017 · 6 comments

Comments

@laserallan
Copy link

It seems like mesh names are not available when accessing a scene using the jgltf-model. It seems like they are available in jgltf-impl-v2.
Is this by design or is there a way to find them that I have overlooked?

@javagl
Copy link
Owner

javagl commented Oct 6, 2017

The names are indeed not accessible. The name is part of the glTFChildOfRootProperty schema But right now, this name is not passed through the "model" interfaces.

There is no striking reason to not do this, except for my general tendency to start with a small interface and extend it later (when necessary), rather than having methods in an interface that have to be omitted/deprecated in a subsequent release.

For the case of the names, I think it could be justifiable to also pass it through the interface. The names may be useful for identifying the objects. Although, on implementation level, this may tempt users to attach some sort of semantics to these names (which is certainly not a good idea), it may at least be useful for some sort of user feedback in a UI. Additionally, the names exist in glTF 1.0 and 2.0, will certainly not be omitted in a future release, and have rather trivial constraints: They may be an arbitrary string (or null).

So introducing a high-level interface (involving names like Named and/or ModelElement) that only declares the getName() method may be one solution here. What do you think?

@laserallan
Copy link
Author

laserallan commented Oct 6, 2017 via email

@javagl
Copy link
Owner

javagl commented Oct 7, 2017

presenting and editing the the scene graph in a treeview

Right now, there is a tree shown in the jgltf-browser, but this only presents the file structure (and it is implemented in a very crude and "pragmatic" way, without any real knowledge of what glTF or its structure is). An additional tree view that presents the scene structure is already on my TODO list. (There already are similar tools, but nevertheless). However, this immediately raises the question of how much editing should actually be possible in this context. After all, glTF is intended as a runtime format, and not really supposed to be edited. The JglTF infrastructure currently aims at simplifying the rendering in Java, and (via the jgltf-browser) some basic inspection/debugging. For editing, the preferred file format would be COLLADA, and there are authoring tools like Blender, Maya and MAX, going slightly beyond what I tried to accomplish with JglTF ;-)

However, retaining the names certainly makes sense. I'll tackle this ASAP.

@laserallan
Copy link
Author

laserallan commented Oct 8, 2017 via email

@javagl
Copy link
Owner

javagl commented Oct 10, 2017

As of 82bb96b , there is a NamedModelElement interface that the relevant model interfaces (including the MeshModel) inherit from, and it offers a getName() method that returns the name that the element had in the glTF asset.

(Note: The CameraModel interface already had a getName method. This has now been renamed to getInstanceName, as it returns a string identifying the actual camera instance, which is created from the combination of the node and the camera itself)

Closing here for now, but feel free to add further comments.

@javagl javagl closed this as completed Oct 10, 2017
@laserallan
Copy link
Author

laserallan commented Oct 12, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants