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

feat: Adding Yeti support #101

Merged
merged 2 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from typing import Any, Dict, List, Optional

import maya.cmds
import maya.mel

from ..dir_map import DirectoryMapping

Expand Down Expand Up @@ -218,3 +219,10 @@ def set_scene_file(self, data: dict):
if not os.path.isfile(file_path):
raise FileNotFoundError(f"The scene file '{file_path}' does not exist")
maya.cmds.file(file_path, open=True, force=True)

pre_render_mel = maya.cmds.getAttr("defaultRenderGlobals.preMel")
if pre_render_mel:
try:
maya.mel.eval(pre_render_mel)
except Exception as e:
print("Warning: preMel Failed: %s" % e)
17 changes: 17 additions & 0 deletions src/deadline/maya_submitter/assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ def parse_scene_assets(self) -> set[Path]:
# Grab tx files (if we need to)
assets: set[Path] = set()

# Grab any yeti files
assets.update(self._get_yeti_files())

if Scene.renderer() == RendererNames.arnold.value:
assets.update(self._get_tx_files())
elif Scene.renderer() == RendererNames.renderman.value:
Expand All @@ -47,6 +50,20 @@ def parse_scene_assets(self) -> set[Path]:

return assets

def _get_yeti_files(self) -> set[Path]:
"""
If Yeti plugin nodes are in the scene, searches for fur cache files
Returns:
set[Path]: A set of yeti files
"""
yeti_files: set[Path] = set()
cache_files = Scene.yeti_cache_files()
for cache_path in cache_files:
for expanded_path in self._expand_path(cache_path):
yeti_files.add(expanded_path)

return yeti_files

def _get_tex_files(self) -> set[Path]:
"""
Searches for Renderman .tex files
Expand Down
10 changes: 10 additions & 0 deletions src/deadline/maya_submitter/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,16 @@ def error_on_arnold_license_fail() -> bool:
else:
return True

@staticmethod
def yeti_cache_files() -> list[str]:
files = []
nodes = maya.cmds.ls(type="pgYetiMaya")
for node in nodes:
cache_file = maya.cmds.getAttr("%s.cacheFileName" % node)
if cache_file:
files.append(cache_file)
return files


@dataclass
class FrameRange:
Expand Down