-
Notifications
You must be signed in to change notification settings - Fork 327
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
Improvements to document validation #1729
Improvements to document validation #1729
Conversation
…skipping if duplicate elements exist in a library document. Validate that the types used in the document have been registered as types in the document
e9b720e
to
e6c6221
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ld-kerley
A couple of background points:
-
This error condition did exist before and it sounds reasonable to add it back in but will defer to Jonathan.
-
There is a case to be made to allow the same libraries to be loaded in more than once and ignore duplicates. I think this came / comes up more when folks import libraries into 2 or more main documents and then try and merge them together. Also xincludes can do this -- though there is no "firewall" check to avoid duplicate xincludes.
-
There are some nodes without types. I left a note.
-
Type checking is useful to have but will fail validation if the std lib file is not loaded in which may be the case sometimes. I'm not sure what is the "best" way to handle this as types are not declared based on the stdlib file itself (data-driven). It's in C++ and also happens to be in the file. The same issue can occur for the unit typedef.
Thanks for the feedback @kwokcb. This was certainly not posted as final work, and I wanted to get input on what I had thrown together internally to get me unstuck. |
After a brief chat with @jstone-lucasfilm I added a |
Just on this specific build error, it looks like we'd need to add the new argument for |
…y for javascript bindings
I took a stab at resolving the JS bindings - but I don't have a local build setup to build them, and I also don't have a lot of experience with them either - perhaps someone with more JS chops could give me some pointers (or patch this PR) |
Thanks for taking a look, @ld-kerley, and either @kwokcb or I can help to resolve that last JavaScript issue. |
Signed-off-by: Jonathan Stone <jstone@lucasfilm.com>
Signed-off-by: Jonathan Stone <jstone@lucasfilm.com>
@ld-kerley We've now merged development work on MaterialX 1.39 back to the |
@ld-kerley I'll close out this pull request for now, since it's framed in terms of a branch that we're planning to delete, but feel free to propose a similar pull request for the |
This PR adds two new pieces to the correctness checking within MaterialX, these were discovered while doing work on MaterialX library files. I found them helpful, so I thought it might help to upstream the changes for others to benefit from too.
When loading libraries, there is now an optional boolean
errorOnDuplicates
, that will raise an error if a library contains an element is already present, previously this case would silently continue. I did wrestle with if this should just be calledstrict
, incase there are other cases we want to add in the future. Open to input there.Secondly I have added validation to
TypedElement
to validate if the type used has actually been registered in the document as a type. This very helpfully tracked down a couple of typos in work-in-progress code.Finally I added the ability for the
mxvalidate.py
script to directly accept a path to alternate library locations.