-
Notifications
You must be signed in to change notification settings - Fork 34
SG-40163 Make FPTR menu work for Houdini version 21.0+ #90
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
Workaround for odd behavior in Houdini 21.0+ not seeing the menu file if created by a startup script
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 adds support for Houdini version 21.0+ by refactoring menu creation and removing version-specific checks throughout the codebase. The main changes include creating a new engine-agnostic MenuBuilder class for menu XML generation and cleaning up legacy version compatibility code.
Key Changes:
- Extracted menu creation logic into a dedicated
MenuBuilderclass for Houdini 21.0+ compatibility - Removed version-specific checks and legacy code for older Houdini versions
- Updated import structure to expose the new
MenuBuilderclass - Removed unused Python packages (urllib2.py, httplib.py, LICENSE)
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| startup.py | Added menu creation logic for Houdini 21.0+ using new MenuBuilder class |
| python/tk_houdini/ui_generation.py | Refactored menu code into MenuBuilder class, removed legacy menu methods |
| python/tk_houdini/init.py | Added MenuBuilder import to expose the class |
| python/packages/*.py | Removed unused Python 2 compatibility packages |
| engine.py | Removed version-specific checks and legacy compatibility code |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| # TODO - only for Houdini version 21.0+ | ||
| enable_sg_menu = self.get_setting("enable_sg_menu", True) | ||
| if enable_sg_menu: |
Copilot
AI
Sep 16, 2025
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.
The TODO comment indicates this is only for Houdini 21.0+, but there's no version check in the code. Either add the version check or update the comment to reflect the actual implementation.
| # TODO - only for Houdini version 21.0+ | |
| enable_sg_menu = self.get_setting("enable_sg_menu", True) | |
| if enable_sg_menu: | |
| # Only enable SG menu for Houdini version 21.0+ | |
| enable_sg_menu = self.get_setting("enable_sg_menu", True) | |
| if enable_sg_menu and self.version.version_tuple[0] >= 21: |
| # execution | ||
| main_dynamic_menu_script = ET.SubElement(main_dynamic_menu, "scriptCode") | ||
| main_dynamic_menu_script.text = ( | ||
| "CDATA_START" + _g_dynamic_menu_script + "CDATA_END" |
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.
TODO replace that by inspect.getsource(test)
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.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
This pull request refactors the Houdini menu XML generation logic to improve modularity and maintainability.
The main goal is to be able to use the class out of an engine context since we need to call it in startup.py starting with Houdini 21.0+
Based on #89