Exemplo n.º 1
0
# disclosure, copying or reproduction, without the prior written authorization
# of DDPI is strictly prohibited.
#
# Copyright (c) [2013] Digital Domain Productions, Inc. All rights reserved.
#

#  STANDARD
import os
import errno
import stat
import shutil
import subprocess

#  DD
from dd.runtime import api
api.load('jstools')
import jstools

# SETUP LOGGING
from ..log import LogManager
logger = LogManager.get_logger(__name__)


def _do_makedir_with_os_makedirs(path, permissions):
    """
    Helper function
    """
    if os.path.isdir(path): return

    logger.debug("Creating folder with os.makedirs: %s", path)
    try:
import sgtk
import os
import pickle
import sys
import subprocess
from sgtk.platform.qt import QtCore

try:
    import nuke
except ImportError:
    nuke = None

# DD imports
from dd.runtime import api
api.load('wam')
from wam.utils.proc import formCleanEnv


class Renderer(object):
    def __init__(self):
        """
        Construction
        """
        self.__app = sgtk.platform.current_bundle()
        self._font = os.path.join(self.__app.disk_location, "resources",
                                  "liberationsans_regular.ttf")
        self._context_fields = self.__app.context.as_template_fields()

        self._burnin_nk = ''
        burnin_template = self.__app.get_template("burnin_path")
Exemplo n.º 3
0
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
# not expressly granted therein are reserved by Shotgun Software Inc.

import os
import tempfile
import maya.cmds as cmds
import maya.mel as mel
import sgtk
from sgtk import TankError
from sgtk.util.filesystem import ensure_folder_exists

# A convenience wrapper on top of alembic's Python api
from dd.runtime import api
api.load("cask")
import cask

HookBaseClass = sgtk.get_hook_baseclass()


MAYA_GEOMETRY_ITEM_TYPE_SETTINGS = {
    "maya.geometry": {
        "publish_type": "Alembic Cache",
        "publish_name_template": None,
        "publish_path_template": None
    }
}


class MayaPublishGeometryPlugin(HookBaseClass):
Exemplo n.º 4
0
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
# not expressly granted therein are reserved by Shotgun Software Inc.

import os
import maya.cmds as cmds
import maya.mel as mel
import sgtk
from sgtk.platform.qt import QtGui

from dd.runtime import api
api.load('frangetools')
import frangetools

HookBaseClass = sgtk.get_hook_baseclass()

GROUP_NODES = ['WORLDSCALE',
               'SET_TO_WORLD',
               'TRACK_GEO']

CAMERA_NAME = 'CAM'

DEFAULT_CAMERAS = ['persp',
                   'top',
                   'front',
                   'side']
Exemplo n.º 5
0
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
# not expressly granted therein are reserved by Shotgun Software Inc.

import os
import glob
import random
import nuke
import sgtk
import fnmatch
from dd.runtime import api
api.load("frangetools")
import frangetools

api.load('qt_py')
from Qt import QtWidgets, QtGui, QtCore

HookBaseClass = sgtk.get_hook_baseclass()

USER_FILE_SETTING_NAME = "Error On User File"
NODE_CLASSES_TO_EXCLUDE = "Node Classes To Exclude"


class DisplayUnpublishedFiles(QtWidgets.QWidget):
    def __init__(self, message, unpublished, gif_path):
        self.message = message
        self.message_label = QtWidgets.QLabel(self.message)
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
# not expressly granted therein are reserved by Shotgun Software Inc.

import os
import maya.cmds as cmds
import maya.mel as mel

import sgtk
from sgtk.platform.qt import QtGui

HookClass = sgtk.get_hook_baseclass()

from dd.runtime import api
api.load("preferences")
import preferences


class SceneOperation(HookClass):
    """
    Hook called to perform an operation with the
    current scene
    """
    def execute(self, operation, file_path, context, parent_action,
                file_version, read_only, **kwargs):
        """
        Main hook entry point

        :param operation:       String
                                Scene operation to perform
Exemplo n.º 7
0
# Copyright (c) 2017 Shotgun Software Inc.
#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
# not expressly granted therein are reserved by Shotgun Software Inc.

import os
import nuke
import sgtk
import itertools
from dd.runtime import api
api.load("frangetools")
import frangetools

HookBaseClass = sgtk.get_hook_baseclass()


class NukePublishDDValidationPlugin(HookBaseClass):
    """
    Inherits from NukePublishFilesPlugin
    """
    def __init__(self, parent, **kwargs):
        """
        Construction
        """
        # call base init
        super(NukePublishDDValidationPlugin, self).__init__(parent, **kwargs)
Exemplo n.º 8
0
# Copyright (c) 2017 Shotgun Software Inc.
#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
# not expressly granted therein are reserved by Shotgun Software Inc.

import os
import nuke
import sgtk
from dd.runtime import api
api.load('preferences')
import preferences

HookBaseClass = sgtk.get_hook_baseclass()


class NukePublishDDIntegValidationPlugin(HookBaseClass):
    """
    Inherits from NukePublishSessionPlugin
    """
    def _bbsize(self, item):
        """
        Checks for oversized bounding box for shotgun write nodes.

        :param item: Item to process
        :return:True if all the write nodes have bounding boxes within limits
        """
Exemplo n.º 9
0
# Copyright (c) 2017 Shotgun Software Inc.
#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
# not expressly granted therein are reserved by Shotgun Software Inc.

import os
import nuke
import sgtk
import itertools
from dd.runtime import api
api.load("frangetools")
import frangetools
api.load("preferences")
import preferences

HookBaseClass = sgtk.get_hook_baseclass()


class NukePublishDDCompValidationPlugin(HookBaseClass):
    """
    Inherits from NukePublishSessionPlugin
    """
    def _build_dict(self, seq, key):
        """
        Creating a dictionary based on a key.
Exemplo n.º 10
0
# version of the code is associated with the currently running project
# configuration.
#
# However, in the case when a cloned configuration has been localized,
# the API proxy has been replaced by the actual core API code.
# In this case, we will set the TANK_CURRENT_PC explicitly.
#
# The logic below is fundamentally to avoid the issue that when a cloned localized
# configuration has its python sgtk/tank module imported directly, it will associate
# itself with the primary config rather than with the config where the code is located.

import os
import sys

from dd.runtime import api
api.load("ordereddict")

if "TANK_CURRENT_PC" not in os.environ:
    # find the pipeline configuration root, probe for a key file
    # (templates.yml) and use this test to determine if this code is
    # a core API located inside a pipeline configuration.
    #
    # NOTE! This is a very particular piece of logic, which is also
    # duplicated inside the tank command and the python proxy wrappers.
    # it is intentionally left here in the init method to highlight that
    # is unique and special.
    #
    from . import constants
    current_folder = os.path.abspath(os.path.dirname(__file__))
    pipeline_config = os.path.abspath(
        os.path.join(current_folder, "..", "..", "..", ".."))
Exemplo n.º 11
0
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
# not expressly granted therein are reserved by Shotgun Software Inc.
"""
Encapsulates the pipeline configuration and helps navigate and resolve paths
across storages, configurations etc.
"""

from __future__ import with_statement

import os

from dd.runtime import api
api.load('prez')
import prez

from tank_vendor import yaml

from . import constants
from . import LogManager

from .util import yaml_cache
from .util import StorageRoots
from .util import ShotgunPath
from .util.singleton import Threaded
from .util.shotgun import get_deferred_sg_connection, get_sg_connection

from .errors import TankError
Exemplo n.º 12
0
from dd.runtime import api
api.load('openimageio')

import sgtk

HookBaseClass = sgtk.get_hook_baseclass()


# Stub class to allow api.load of openimageio package
class FileDDCollectorPlugin(HookBaseClass):
    pass
Exemplo n.º 13
0
# Copyright (c) 2016 Shotgun Software Inc.
#
# CONFIDENTIAL AND PROPRIETARY
#
# This work is provided "AS IS" and subject to the Shotgun Pipeline Toolkit
# Source Code License included in this distribution package. See LICENSE.
# By accessing, using, copying or modifying this work you indicate your
# agreement to the Shotgun Pipeline Toolkit Source Code License. All rights
# not expressly granted therein are reserved by Shotgun Software Inc.

import re

from dd.runtime import api

api.load("setuptools")

from pkg_resources import parse_version as Version


def is_version_head(version):
    """
    Returns if the specified version is HEAD or MASTER. The comparison is case insensitive.

    :param version: Version to test.

    :returns: True if version is HEAD or MASTER, false otherwise.
    """
    return version.lower() in ["head", "master"]


def is_version_newer(a, b):