from ._timeline import *


def get_timeline_interface(timeline_name: str='') -> Timeline:
    """Returns the timeline with the given name via cached :class:`omni.timeline.ITimeline` interface"""

    if not hasattr(get_timeline_interface, "timeline"):
        get_timeline_interface.timeline = acquire_timeline_interface()
    return get_timeline_interface.timeline.get_timeline(timeline_name)

def destroy_timeline(timeline_name: str):
    """Destroys a timeline object with the given name, if it is not the default timeline and it is not in use."""

    if not hasattr(get_timeline_interface, "timeline"):
        get_timeline_interface.timeline = acquire_timeline_interface()
    return get_timeline_interface.timeline.destroy_timeline(timeline_name)
