Пример #1
0
def ls():
    """List containers from active Fusion scene

    This is the host-equivalent of api.ls(), but instead of listing
    assets on disk, it lists assets already loaded in Fusion; once loaded
    they are called 'containers'

    Yields:
        dict: container

    """

    comp = get_current_comp()
    tools = comp.GetToolList(False, "Loader").values()

    has_metadata_collector = False
    config_host = find_submodule(api.registered_config(), "fusion")
    if hasattr(config_host, "collect_container_metadata"):
        has_metadata_collector = True

    for tool in tools:
        container = parse_container(tool)
        if container:

            if has_metadata_collector:
                metadata = config_host.collect_container_metadata(container)
                container.update(metadata)

            yield container
Пример #2
0
def ls():
    containers = []
    for identifier in (AVALON_CONTAINER_ID, "pyblish.mindbender.container"):
        containers += lib.lsattr("id", identifier)

    for container in sorted(containers):
        data = parse_container(container)

        # Collect custom data if attribute is present
        config = find_host_config(api.registered_config())
        if hasattr(config, "collect_container_metadata"):
            metadata = config.collect_container_metadata(container)
            data.update(metadata)

        yield data
Пример #3
0
def ls():
    containers = []
    for identifier in (AVALON_CONTAINER_ID, "pyblish.mindbender.container"):
        containers += lib.lsattr("id", identifier)

    has_metadata_collector = False
    config_host = find_submodule(api.registered_config(), "houdini")
    if hasattr(config_host, "collect_container_metadata"):
        has_metadata_collector = True

    for container in sorted(containers):
        data = parse_container(container)

        # Collect custom data if attribute is present
        if has_metadata_collector:
            metadata = config_host.collect_container_metadata(container)
            data.update(metadata)

        yield data
Пример #4
0
def ls() -> Iterator:
    """List containers from active Blender scene.

    This is the host-equivalent of api.ls(), but instead of listing assets on
    disk, it lists assets already loaded in Blender; once loaded they are
    called containers.
    """

    containers = _ls()

    config = find_submodule(api.registered_config(), "blender")
    has_metadata_collector = hasattr(config, "collect_container_metadata")

    for container in containers:
        data = parse_container(container)

        # Collect custom data if property is present
        if has_metadata_collector:
            metadata = config.collect_container_metadata(container)
            data.update(metadata)

        yield data
Пример #5
0
def ls():
    containers = []
    for identifier in (AVALON_CONTAINER_ID, "pyblish.mindbender.container"):
        containers += lib.lsattr("id", identifier)

    has_metadata_collector = False
    config_host = find_submodule(api.registered_config(), "houdini")
    if hasattr(config_host, "collect_container_metadata"):
        has_metadata_collector = True

    for container in sorted(
            containers,
            # Hou 19+ Python 3 hou.ObjNode are not
            # sortable due to not supporting greater
            # than comparisons
            key=lambda node: node.path()):
        data = parse_container(container)

        # Collect custom data if attribute is present
        if has_metadata_collector:
            metadata = config_host.collect_container_metadata(container)
            data.update(metadata)

        yield data