예제 #1
0
파일: menu.py 프로젝트: 3dzayn/pype
def add_shortcuts_from_presets():
    menubar = nuke.menu("Nuke")
    nuke_presets = get_current_project_settings()["nuke"]["general"]

    if nuke_presets.get("menu"):
        menu_label_mapping = {
            "manage": "Manage...",
            "create": "Create...",
            "load": "Load...",
            "build_workfile": "Build Workfile",
            "publish": "Publish..."
        }

        for command_name, shortcut_str in nuke_presets.get("menu").items():
            log.info("menu_name `{}` | menu_label `{}`".format(
                command_name, menu_label))
            log.info("Adding Shortcut `{}` to `{}`".format(
                shortcut_str, command_name))
            try:
                menu = menubar.findItem(menu_label)
                item_label = menu_label_mapping[command_name]
                menuitem = menu.findItem(item_label)
                menuitem.setShortcut(shortcut_str)
            except AttributeError as e:
                log.error(e)
예제 #2
0
파일: plugin.py 프로젝트: 3dzayn/pype
 def __init__(self, *args, **kwargs):
     super(PypeCreator, self).__init__(*args, **kwargs)
     self.presets = get_current_project_settings()["nuke"]["create"].get(
         self.__class__.__name__, {})
     if check_subsetname_exists(nuke.allNodes(), self.data["subset"]):
         msg = ("The subset name `{0}` is already used on a node in"
                "this workfile.".format(self.data["subset"]))
         self.log.error(msg + '\n\nPlease use other subset name!')
         raise NameError("`{0}: {1}".format(__name__, msg))
     return
예제 #3
0
    def refresh(self):

        listing = self.data["Listing"]
        asset = self.data["Asset"]
        asset.setText(api.Session["AVALON_ASSET"])

        listing.clear()

        has_families = False

        creators = api.discover(api.Creator)

        for creator in creators:
            label = creator.label or creator.family
            item = QtWidgets.QListWidgetItem(label)
            item.setData(QtCore.Qt.ItemIsEnabled, True)
            item.setData(HelpRole, creator.__doc__)
            item.setData(FamilyRole, creator.family)
            item.setData(PluginRole, creator)
            item.setData(ExistsRole, False)
            listing.addItem(item)

            has_families = True

        if not has_families:
            item = QtWidgets.QListWidgetItem("No registered families")
            item.setData(QtCore.Qt.ItemIsEnabled, False)
            listing.addItem(item)

        pype_project_setting = (get_current_project_settings()["global"]
                                ["tools"]["creator"]["families_smart_select"])
        item = None
        family_type = None
        task_name = io.Session.get('AVALON_TASK', None)
        if task_name:
            for key, value in pype_project_setting.items():
                for t_name in value:
                    if t_name in task_name.lower():
                        family_type = key
                        break
                if family_type:
                    break
            if family_type:
                items = listing.findItems(family_type, QtCore.Qt.MatchExactly)
                if len(items) > 0:
                    item = items[0]
                    listing.setCurrentItem(item)
        if not item:
            listing.setCurrentItem(listing.item(0))
예제 #4
0
    def __init__(self, *args, **kwargs):
        import openpype.hosts.hiero.api as phiero
        super(Creator, self).__init__(*args, **kwargs)
        self.presets = pype.get_current_project_settings(
        )["hiero"]["create"].get(self.__class__.__name__, {})

        # adding basic current context resolve objects
        self.project = phiero.get_current_project()
        self.sequence = phiero.get_current_sequence()

        if (self.options or {}).get("useSelection"):
            self.selected = phiero.get_track_items(selected=True)
        else:
            self.selected = phiero.get_track_items()

        self.widget = CreatorWidget
예제 #5
0
파일: __init__.py 프로젝트: 3dzayn/pype
def get_asset_settings():
    """Get settings on current asset from database.

    Returns:
        dict: Scene data.

    """
    asset_data = lib.get_asset()["data"]
    fps = asset_data.get("fps")
    frame_start = asset_data.get("frameStart")
    frame_end = asset_data.get("frameEnd")
    handle_start = asset_data.get("handleStart")
    handle_end = asset_data.get("handleEnd")
    resolution_width = asset_data.get("resolutionWidth")
    resolution_height = asset_data.get("resolutionHeight")
    entity_type = asset_data.get("entityType")

    scene_data = {
        "fps": fps,
        "frameStart": frame_start,
        "frameEnd": frame_end,
        "handleStart": handle_start,
        "handleEnd": handle_end,
        "resolutionWidth": resolution_width,
        "resolutionHeight": resolution_height
    }
    settings = get_current_project_settings()

    try:
        skip_resolution_check = \
            settings["harmony"]["general"]["skip_resolution_check"]
        skip_timelines_check = \
            settings["harmony"]["general"]["skip_timelines_check"]
    except KeyError:
        skip_resolution_check = []
        skip_timelines_check = []

    if os.getenv('AVALON_TASK') in skip_resolution_check:
        scene_data.pop("resolutionWidth")
        scene_data.pop("resolutionHeight")

    if entity_type in skip_timelines_check:
        scene_data.pop('frameStart', None)
        scene_data.pop('frameEnd', None)

    return scene_data
예제 #6
0
    def on_start(self):
        project_name = io.Session['AVALON_PROJECT']
        project_query = 'Project where full_name is "{}"'.format(project_name)
        if self.session is None:
            session = ftrack_api.Session()
            self.session = session
        else:
            session = self.session
        ft_project = session.query(project_query).one()
        schema_name = ft_project['project_schema']['name']
        # Load config
        schemas_items = get_current_project_settings().get('ftrack', {}).get(
            'project_schemas', {}
        )
        # Get info if it is silo project
        self.silos = io.distinct("silo")
        if self.silos and None in self.silos:
            self.silos = None

        key = "default"
        if schema_name in schemas_items:
            key = schema_name

        self.config_data = schemas_items[key]

        # set outlink
        input_outlink = self.data['inputs']['outlink']
        checkbox_outlink = self.data['inputs']['outlink_cb']
        outlink_text = io.Session.get('AVALON_ASSET', '')
        checkbox_outlink.setChecked(True)
        if outlink_text == '':
            outlink_text = '< No context >'
            checkbox_outlink.setChecked(False)
            checkbox_outlink.hide()
        input_outlink.setText(outlink_text)

        # load asset build types
        self.load_assetbuild_types()

        # Load task templates
        self.load_task_templates()
        self.data["model"]["assets"].refresh()
        self.on_asset_changed()
예제 #7
0
파일: plugin.py 프로젝트: 3dzayn/pype
    def __init__(self, *args, **kwargs):
        super(Creator, self).__init__(*args, **kwargs)
        from openpype.api import get_current_project_settings
        resolve_p_settings = get_current_project_settings().get("resolve")
        self.presets = dict()
        if resolve_p_settings:
            self.presets = resolve_p_settings["create"].get(
                self.__class__.__name__, {})

        # adding basic current context resolve objects
        self.project = resolve.get_current_project()
        self.timeline = resolve.get_current_timeline()

        if (self.options or {}).get("useSelection"):
            self.selected = resolve.get_current_timeline_items(filter=True)
        else:
            self.selected = resolve.get_current_timeline_items(filter=False)

        self.widget = CreatorWidget
예제 #8
0
def add_review_presets_config():
    returning = {
        "families": list(),
        "representations": list()
    }
    settings = get_current_project_settings()
    review_profiles = (
        settings["global"]
                ["publish"]
                ["ExtractReview"]
                ["profiles"]
    )

    outputs = {}
    for profile in review_profiles:
        outputs.update(profile.get("outputs", {}))

    for output, properities in outputs.items():
        returning["representations"].append(output)
        returning["families"] += properities.get("families", [])

    return returning
예제 #9
0
 def process(self, context):
     context.data["project_settings"] = get_current_project_settings()
     context.data["system_settings"] = get_system_settings()