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

Recursively search for library paths for Viewer and Editor #1293

Merged

Conversation

kwokcb
Copy link
Contributor

@kwokcb kwokcb commented Mar 20, 2023

Fix #1292

  • Add utility to iteratively search upwards for a libraries folder from a start path.
  • Use the module path as the start path for both the Viewer and Node Editor.

This fixes when the binary is in the same folder as the libraries folder.

Note that this does not affect MaterialX test since it already searches in the same folder as the test binary.

@jstone-lucasfilm jstone-lucasfilm changed the title Fix library search path for MaterialXView (Mac) Fix viewer search path on MacOS Mar 21, 2023
@jstone-lucasfilm
Copy link
Member

@kwokcb This might deserve some deeper investigation, as it's not an issue that's been reported on MacOS before. Does this only apply to developer builds, or does it apply to the shipping builds of the viewer in releases? If we can narrow this down further, then we should be able to implement a more targeted solution.

@kwokcb
Copy link
Contributor Author

kwokcb commented Mar 22, 2023

Hi @jstone-lucasfilm,
This does not occur with the installed folder as MaterialXView is in a subfolder below libraries. For builds,
with my current configuration MaterialXView is at the same level as libraries so always fails.

If anyone sets up MaterialXView at the same level as libraries then it will fail, so I think this is a suitable patch.
It also feels strange to always only look for libraries in the parent folder of the binary.

@ashwinbhat
Copy link
Contributor

Hi @kwokcb
What does the output layout look like on Ventura? Are you creating application bundle?

@kwokcb
Copy link
Contributor Author

kwokcb commented Mar 25, 2023

For builds which only create one build area, there is no subfolder for the build type (e.g. Release/RelWithDebugInfo/Debug).
Thus the executable is in the same folder as libraries. I was using -GXcode which created the separate build areas and am no longer doing so (I'm basically trying to build exactly as CI does as the multiple build case does not create Python executables with the correct architecture for M1/M2 etc.).

@ashwinbhat, neither the build area or installs create bundles so it's always possible to move files around and have libraries not found. I guess this would be the best way to handle this, but it's not currently being done.

@jstone-lucasfilm
Copy link
Member

@kwokcb I like the idea of generalizing this function further, and one option would be to traverse from the module path to each parent path (e.g. self, parent, grandparent, etc.), returning the first folder that contains the expected data libraries subfolder. This would remove the distinction between "install" and "development" paths in getDefaultSearchPath, and would theoretically maintain the current behavior for existing users of MaterialX example applications.

Consolidate this into a utility and use for both viewer and editor to avoid duplicate code.
@kwokcb
Copy link
Contributor Author

kwokcb commented Apr 11, 2023

@jstone-lucasfilm , this sounds like simple logic to add. As the Graph Editor also follows the same logic it will also need to be updated as it is also failing when in the same folder as libraries. I have created a utility which starts from any root to do the searching.

@kwokcb kwokcb changed the title Fix viewer search path on MacOS Recursively search for library paths for Viewer and Editor Apr 11, 2023
Use the interface name `getDefaultDataSearchPath()` for consistency with Python.
Copy link
Member

@jstone-lucasfilm jstone-lucasfilm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me, thanks @kwokcb!

@jstone-lucasfilm jstone-lucasfilm merged commit 91f5425 into AcademySoftwareFoundation:main Apr 13, 2023
12 checks passed
@kwokcb kwokcb deleted the mtlxview_searchpath branch April 16, 2023 02:25
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

Successfully merging this pull request may close these issues.

Definition Libraries cannot be found when running MaterialXView from build area (Mac)
3 participants