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

#45365 Camera publish in maya #63

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
40 changes: 40 additions & 0 deletions hooks/tk-multi-publish2/basic/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ def process_current_session(self, settings, parent_item):
if cmds.ls(geometry=True, noIntermediate=True):
self._collect_session_geometry(item)

self._collect_session_cameras(item)

def collect_current_maya_session(self, settings, parent_item):
"""
Creates an item that represents the current maya session.
Expand Down Expand Up @@ -241,6 +243,44 @@ def _collect_session_geometry(self, parent_item):

geo_item.set_icon_from_path(icon_path)

def _collect_session_cameras(self, parent_item):
"""
Creates items for each camera to be exported.

:param parent_item:
:return:
"""

# get the icon path to display for camera items
icon_path = os.path.join(
self.disk_location,
os.pardir,
"icons",
"camera.png"
)

for camera_shape in cmds.ls(cameras=True):

# try to determine the camera display name
try:
camera_name = cmds.listRelatives(camera_shape, parent=True)[0]
except Exception:
# could not determine the name, just use the shape
camera_name = camera_shape

cam_item = parent_item.create_item(
"maya.session.camera",
"Camera",
camera_name
)

cam_item.set_icon_from_path(icon_path)

# store the camera name so that any attached plugin knows which
# camera this item represents!
cam_item.properties["camera_name"] = camera_name
cam_item.properties["camera_shape"] = camera_shape

def collect_playblasts(self, parent_item, project_root):
"""
Creates items for quicktime playblasts.
Expand Down
Loading