-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Perform path resolution function in Meshroom core #2881
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
Conversation
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.
Pull Request Overview
This PR refactors path resolution functionality from the UI layer to the core layer by implementing a new fileUtils.py module in meshroom core. The refactoring centralizes template-based path resolution logic that replaces field placeholders like <FIELD> with actual values extracted from file paths or viewpoints.
Key changes:
- Creates new
fileUtils.pywith functions for extracting file elements, view elements, and pattern replacement - Simplifies the UI
filepath.pyby removing duplicate path resolution logic and delegating to the new core functions - Optimizes replacement implementation using regex substitution instead of iterative string replacement
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| meshroom/core/fileUtils.py | New module implementing core path resolution functions with regex-based pattern matching |
| meshroom/ui/components/filepath.py | Simplified by removing path resolution logic and calling new core functions |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #2881 +/- ##
========================================
Coverage 79.55% 79.55%
========================================
Files 51 51
Lines 6974 6974
========================================
Hits 5548 5548
Misses 1426 1426 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
53b08ba to
9957293
Compare
9957293 to
d6c5bef
Compare
57e2061 to
b339973
Compare
b339973 to
cc4efe9
Compare
Description
This PR implements the path resolution function within meshroom core in the new file fileUtils.py. That resolution was formerly implemented in meshroom ui components. The original method still exists but has been cleaned up and calls the new ones.
The path resolution function replace all the fields in a template name by their corresponding value extracted whether from an input filepath or a viewpoint.
A dictionary is built from the input filepath or the viewpoint. The fields to be replaced in the template name are supposed to be found amongst the keys of that dictionary. In case a key does not exist the corresponding input field is discarded to build the resolved path. Such a case can occur for example if the field is used in the template whereas the input filepath does not contain any value corresponding to a frame number.
The way the replacement is done has also been optimized using regex sub function.
Features list
Implementation remarks