Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,33 @@ def prepare_launch(self, exec_path, args, file_to_open=None):

self.logger.debug("Launch environment: %s" % (required_env,))

# TODO - only for Houdini version 21.0+
Copy link

Copilot AI Sep 4, 2025

Choose a reason for hiding this comment

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

The TODO comment should specify what needs to be done when this workaround is no longer needed and include a reference to when/how this version check should be implemented.

Suggested change
# TODO - only for Houdini version 21.0+
# TODO: Remove or refactor this block when support for Houdini versions prior to 21.0 is dropped.
# Implement a Houdini version check (see VERSION_OLDEST_COMPATIBLE or use SoftwareVersion)
# to ensure this code only runs for Houdini 21.0 and above.

Copilot uses AI. Check for mistakes.
enable_sg_menu = self.get_setting("enable_sg_menu", True)
if enable_sg_menu:

class MockEngine:
pass

mock_engine = MockEngine()
mock_engine.logger = self.logger

mock_engine._menu_name = "Flow Production Tracking"
if self.get_setting("use_short_menu_name", False):
mock_engine._menu_name = "FPTR"
Comment on lines +139 to +146
Copy link

Copilot AI Sep 4, 2025

Choose a reason for hiding this comment

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

The MockEngine class is defined inline and lacks proper initialization. Consider moving this to a proper class with an init method or create a factory function to ensure all required attributes are consistently set.

Suggested change
pass
mock_engine = MockEngine()
mock_engine.logger = self.logger
mock_engine._menu_name = "Flow Production Tracking"
if self.get_setting("use_short_menu_name", False):
mock_engine._menu_name = "FPTR"
def __init__(self, logger, menu_name):
self.logger = logger
self._menu_name = menu_name
menu_name = "Flow Production Tracking"
if self.get_setting("use_short_menu_name", False):
menu_name = "FPTR"
mock_engine = MockEngine(self.logger, menu_name)

Copilot uses AI. Check for mistakes.

import tk_houdini
Copy link

Copilot AI Sep 4, 2025

Choose a reason for hiding this comment

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

The import should be moved to the top of the file with other imports to follow Python import conventions and improve code readability.

Copilot uses AI. Check for mistakes.

xml_tmp_dir = required_env[bootstrap.g_temp_env]
menu_file = os.path.join(xml_tmp_dir, "MainMenuCommon.xml").replace(
os.path.sep, "/"
)

menu = tk_houdini.AppCommandsMenu(mock_engine, [])
self.logger.debug(
"Constructing dynamic PTR menu - before starting Houdini - special 21.0 behaviour"
)
menu._create_dynamic_menu(menu_file)

return LaunchInformation(exec_path, args, required_env)

def scan_software(self):
Expand Down