COLLADA2GLTF icon indicating copy to clipboard operation
COLLADA2GLTF copied to clipboard

Inconsistent ordering of GLTF JSON name property

Open ziriax opened this issue 6 years ago • 3 comments

It seems that sometimes the name property is written first, and sometimes last.

That's because the base class GLTF::Object::writeJSON is not always called in the beginning of each override writeJSON method.

GLTF::Object::writeJSON also writes other properties like extras and extensions.

I think it is easier to debug and read the JSON when the name property always comes first?

ziriax avatar Dec 05 '18 12:12 ziriax

Seems reasonable - I think we'll do this as part of #94.

lasalvavida avatar Dec 05 '18 17:12 lasalvavida

Okay, nice. I already patched the code in a fork, and I also noticed that many objects derive from GLTF::Object are not children-of-the-root, and according to the official GLTF schema, these should not have a name. So we might need to add an extra base-class GLTF::ChildOfRoot or something, like in the schema.

ziriax avatar Dec 05 '18 19:12 ziriax

Okay, nice. I already patched the code in a fork, and I also noticed that many objects derive from GLTF::Object are not children-of-the-root, and according to the official GLTF schema, these should not have a name.

Yes, I did see that conversation on the glTF repo - opened up #228 for tracking it here.

So we might need to add an extra base-class GLTF::ChildOfRoot or something, like in the schema.

I'd be open to that as a solution. ~~Inheritance-wise it's probably easier to remove the concept of name from GLTF::Object and create a subclass called GLTF::RootObject that has a name and all root objects inherit from that.~~ (edit: I misread, I think this is pretty much what you said above). Then, create a GLTF::NameExtra class that we can add to the extras on non-root objects with COLLADA names.

lasalvavida avatar Dec 05 '18 21:12 lasalvavida