Beispiel #1
0
def plot_publish(families, targets=None, identifiers=None, keys=None):
    """Parse and plot all plugins by families and targets

    Args:
        families (list): List of interested instance family names
        targets (list, optional): List of target names
        identifiers (list, optional): List of interested dict names, take
            ["context.data", "instance.data"] if not provided.
        keys (list, optional): List of interested key names, return all dict
            keys if not provided.

    """
    if not targets:
        targets = ["default"] + api.registered_targets()

    plugins = api.discover()
    plugins = logic.plugins_by_families(plugins, families)
    plugins = logic.plugins_by_targets(plugins, targets)

    reports = list()

    for plugin in plugins:
        report = plot_plugin(plugin, identifiers, keys)
        if report:
            reports.append(report)

    return reports
Beispiel #2
0
def register_process_deadline_plugins():
    import pyblish_deadline

    # Deadline plugins
    paths = [
        os.path.join(os.path.dirname(pyblish_deadline.__file__), "plugins")
    ]
    for plugin in api.discover(paths=paths):
        # Skip in-memory plugins
        if plugin.__module__ == "pyblish.plugin":
            continue

        SubClass = type(plugin.__name__ + "process", (plugin, ),
                        {'targets': ["process.deadline"]})
        api.register_plugin(SubClass)
Beispiel #3
0
    def process(self, context, plugin):

        # Get the errored instances
        failed = []
        for result in context.data["results"]:
            if (result["error"] is not None and result["instance"] is not None
                    and result["instance"] not in failed):
                failed.append(result["instance"])

        # Apply pyblish.logic to get the instances for the plug-in
        instances = pyblish.api.instances_by_plugin(failed, plugin)

        for instance in instances:

            data = toml.loads(instance[0]["avalon"].value())
            data["name"] = instance[0].name()
            data["xpos"] = instance[0].xpos()
            data["ypos"] = instance[0].ypos()
            data["extension"] = os.path.splitext(
                instance[0]["file"].value())[1][1:]

            data["connections"] = []
            for d in instance[0].dependent():
                for i in range(d.inputs()):
                    if d.input(i) == instance[0]:
                        data["connections"].append([i, d])

            nuke.delete(instance[0])

            loader_name = "LoadSequence"
            if data["extension"] == "mov":
                loader_name = "LoadMov"

            loader_plugin = None
            for Loader in api.discover(api.Loader):
                if Loader.__name__ != loader_name:
                    continue

                loader_plugin = Loader

            api.load(Loader=loader_plugin,
                     representation=ObjectId(data["representation"]))

            node = nuke.toNode(data["name"])
            for connection in data["connections"]:
                connection[1].setInput(connection[0], node)

            node.setXYpos(data["xpos"], data["ypos"])
Beispiel #4
0
def test_extracted_traceback_contains_correct_backtrace():
    api.register_plugin_path(os.path.dirname(__file__))

    context = api.Context()
    context.create_instance('test instance')

    plugins = api.discover()
    plugins = [p for p in plugins if p.__name__ in
               ('FailingExplicitPlugin', 'FailingImplicitPlugin')]
    util.publish(context, plugins)

    for result in context.data['results']:
        assert result["error"].traceback[0] == plugins[0].__module__
        formatted_tb = result['error'].formatted_traceback
        assert formatted_tb.startswith('Traceback (most recent call last):\n')
        assert formatted_tb.endswith('\nException: A test exception\n')
        assert 'File "{0}",'.format(plugins[0].__module__) in formatted_tb
Beispiel #5
0
def get_all_plugins():

    search_directory = os.path.abspath(
        os.path.join(__file__, "..", "..", "pyblish_bumpybox", "plugins"))
    directories = [search_directory]
    for root, dirs, files in os.walk(search_directory):
        for d in dirs:
            directories.append(os.path.join(root, d))

    hosts = [
        "nukeassist", "nuke", "maya", "nukestudio", "hiero", "houdini",
        "celaction", "ftrack"
    ]
    for host in hosts:
        api.register_host(host)

    return api.discover(paths=directories)
Beispiel #6
0
def register_process_plugins():

    api.deregister_all_plugins()

    paths = []

    try:
        import pyblish_nuke
        paths.append(
            os.path.join(os.path.dirname(pyblish_nuke.__file__), "plugins"))
    except ImportError:
        pass

    try:
        import pyblish_nukeassist
        paths.append(
            os.path.join(os.path.dirname(pyblish_nukeassist.__file__),
                         "plugins"))
    except ImportError:
        pass

    try:
        import pyblish_maya
        paths.append(
            os.path.join(os.path.dirname(pyblish_maya.__file__), "plugins"))
    except ImportError:
        pass

    try:
        import pyblish_ftrack
        paths.append(
            os.path.join(os.path.dirname(pyblish_ftrack.__file__), "plugins"))
    except ImportError:
        pass

    # process plugins
    for plugin in api.discover(paths=paths):
        SubClass = type(plugin.__name__ + "process", (plugin, ),
                        {'targets': ["process"]})
        api.register_plugin(SubClass)
Beispiel #7
0
def get_all_plugins():

    search_directory = os.path.abspath(
        os.path.join(__file__, "..", "..", "pyblish_bumpybox", "plugins")
    )
    directories = [search_directory]
    for root, dirs, files in os.walk(search_directory):
        for d in dirs:
            directories.append(os.path.join(root, d))

    hosts = [
        "nukeassist",
        "nuke",
        "maya",
        "nukestudio",
        "hiero",
        "houdini",
        "celaction",
        "ftrack"
    ]
    for host in hosts:
        api.register_host(host)

    return api.discover(paths=directories)