Skip to content

Commit

Permalink
Merge pull request #685 from pypeclub/hotfix/684-nuke-favorite-direct…
Browse files Browse the repository at this point in the history
…ories-shot-dir-project-dir-not-working

Nuke Favorite directories "shot dir" "project dir" - not working #684
  • Loading branch information
mkolar committed Nov 5, 2020
2 parents 608c2d1 + 3ace44b commit 2761ec0
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions pype/hosts/nuke/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -978,24 +978,30 @@ def set_context_settings(self):
self.set_colorspace()

def set_favorites(self):
anatomy = get_anatomy()
work_template = anatomy.templates["work"]["path"]
projects_root = anatomy.root_value_for_template(work_template)
work_dir = os.getenv("AVALON_WORKDIR")
asset = os.getenv("AVALON_ASSET")
project = os.getenv("AVALON_PROJECT")
hierarchy = os.getenv("AVALON_HIERARCHY")
favorite_items = OrderedDict()

# project
favorite_items.update({"Project dir": os.path.join(
projects_root, project).replace("\\", "/")})
# shot
favorite_items.update({"Shot dir": os.path.join(
projects_root, project,
hierarchy, asset).replace("\\", "/")})
# get project's root and split to parts
projects_root = os.path.normpath(work_dir.split(
project)[0])
# add project name
project_dir = os.path.join(projects_root, project) + "/"
# add to favorites
favorite_items.update({"Project dir": project_dir.replace("\\", "/")})

# asset
asset_root = os.path.normpath(work_dir.split(
asset)[0])
# add asset name
asset_dir = os.path.join(asset_root, asset) + "/"
# add to favorites
favorite_items.update({"Shot dir": asset_dir.replace("\\", "/")})

# workdir
favorite_items.update({"Work dir": work_dir})
favorite_items.update({"Work dir": work_dir.replace("\\", "/")})

set_context_favorites(favorite_items)

Expand Down

0 comments on commit 2761ec0

Please sign in to comment.