-
Notifications
You must be signed in to change notification settings - Fork 72
Added equals function to MaterialModelV2 #127
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
base: master
Are you sure you want to change the base?
Added equals function to MaterialModelV2 #127
Conversation
The added function returns true if the object is the very same one or if all attributes are the same.
|
I considered this. And a "JglTF 3.0.0" could be a chance to include such breaking changes. (There's no fixed timeline for that yet - I still hope that I can create a new release soon...). But establishing a concept for "equality" here is not straightforward. For now, this PR only changes to the For example, one could reasonably want to define such an In any case, there are general questions that come up for all model classes, including the So it's unlikely that this PR would be merged. Even if all these questions could be answered, I would not merge it in its current form. In every implementation,
and given that |
|
You make some strong points which I cannot easily refute. How about removing the "final" keyword from the class definitions? This would allow users to define their own equals functions to their liking as needed. |
|
This would just make it easier for people to "break" things by overriding functions inconsiderately (but maybe that shouldn't be too much of my concern). There are currently two things ... "in progress" (when I have time...) that will involve breaking changes:
The second one (for which I still haven't opened a PR with the current state) will involve some breaking changes in terms of the structures, e.g. some new functions in existing interfaces and such. And the last comment there already shows what could be the connection to the question about the I might close this PR later and open a dedicated issue for talking about |
Feel free to do as you like, I'll keep an eye open for when it is release. If you could mention the implementation in the release note of such a version, I'd very much appreciate it.
To be honest, I could implement another implementation of the MaterialModel interface , but I was just too lazy. This would break stuff too. Of course the decision is yours, but things are already "breakable" now. Extensions are a whole other beast that I didn't even consider, when creating this MR in the first place. I don't have enough experience to suggest a solution for that, at least for now an extensible class seems the least breaking to me. |
The transition between glTF 1.0 and 2.0, combined with some naivety and idealism on my side, led to the current state: All structures are defined via interfaces. Ideally, no internal code should rely on a particular implementation of the interface. But some of the code does rely on that (the |
The added function returns true if the object is the very same one or if all attributes are the same.
This function is very useful if one wishes to avoid multiple copies of the same material to one file. I found myself working very awkwardly with custom "contains" functions for maps and lists. Which breaks their strongly optimised usecases.