Skip to content

usd_chunks.chunk_resources

Locators for bundled resource files (icons).

These resolve inside the installed package through importlib.resources, never relative to the package directory: a resources directory beside the package exists in a checkout but not in site-packages once pip-installed.

get_icon ⚓︎

get_icon(name, ext='.png')

Path of a bundled icon, given its name without extension.

Source code in usd_chunks/chunk_resources.py
def get_icon(name, ext=".png"):
    """Path of a bundled icon, given its name without extension."""
    res = Path(get_icons_path() / name).with_suffix(ext)
    return res

get_icons_path ⚓︎

get_icons_path()

The directory holding the bundled icons.

Source code in usd_chunks/chunk_resources.py
def get_icons_path():
    """The directory holding the bundled icons."""
    return get_resource_path() / "icons"

get_node_icon ⚓︎

get_node_icon(name)

The built-in node-graph icon of this name (resources/icons/node/.svg), if any.

Parameters:

Name Type Description Default
name str

An icon name such as "sun" or "move".

required

Returns:

Type Description
Path | None

The icon's path, or None when there is no built-in icon of that name.

Source code in usd_chunks/chunk_resources.py
def get_node_icon(name: str) -> Path | None:
    """The built-in node-graph icon of this name (resources/icons/node/<name>.svg), if any.

    Args:
        name: An icon name such as "sun" or "move".

    Returns:
        The icon's path, or None when there is no built-in icon of that name.
    """
    if not name or "/" in name or "\\" in name:
        return None
    path = get_icons_path() / "node" / f"{name}.svg"
    return path if path.is_file() else None

get_resource_path ⚓︎

get_resource_path()

The package's bundled resources directory.

Source code in usd_chunks/chunk_resources.py
def get_resource_path():
    """The package's bundled ``resources`` directory."""
    return Path(files("usd_chunks")) / "resources"