Skip to content

api

maintained_selection()

Maintain selection during context.

Source code in client/ayon_cinema4d/api/lib.py
84
85
86
87
88
89
90
91
92
93
@contextlib.contextmanager
def maintained_selection():
    """Maintain selection during context."""

    doc = active_document()
    previous_selection = doc.GetSelection()
    try:
        yield
    finally:
        set_selection(doc, previous_selection)