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

Handle Hiero API deprecated projectRoot methods #73

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
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
24 changes: 22 additions & 2 deletions engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -764,12 +764,32 @@ def set_project_root(self, event):
"""
import hiero

# Since some Hiero projectRoot methods are deprecated in Nuke 12, we use the wrapper methods
# below to call the appropriate Hiero methods according to the Nuke version being used.
# Cf. https://learn.foundry.com/hiero/developers/12.0/hieropythondevguide/api/api_core.html

# Project.projectRoot() will be removed in Nuke 12
def project_root_wrapper(p):
if nuke.env.get("NukeVersionMajor") < 12:
return p.projectRoot()
return p.exportRootDirectory()

# Project.setProjectRoot() will be removed in Nuke 12
def set_project_root_wrapper(p, tank_project_path):
if nuke.env.get("NukeVersionMajor") < 12:
p.setProjectRoot(tank_project_path)
else:
if p.useCustomExportDirectory():
p.setCustomExportDirectory(tank_project_path)
else:
p.setProjectDirectory(tank_project_path)

for p in hiero.core.projects():
if not p.projectRoot():
if not project_root_wrapper(p):
self.logger.debug(
"Setting projectRoot on %s to: %s", p.name(), self.tank.project_path
)
p.setProjectRoot(self.tank.project_path)
set_project_root_wrapper(p, self.tank.project_path)

def _get_dialog_parent(self):
"""
Expand Down