I (mostly Claude) created this radial menu Python script to create a radial menu to switch takes. I think it's handy.
To use it create a new radial script menu and paste this in.
import hou
import radialmenu
PAGE_SIZE = 7
MORE_SLOT = 7
def build_take_menu(parent_take=None, offset=0):
root_take = hou.takes.rootTake()
if parent_take is None:
parent_take = root_take
current_take = hou.takes.currentTake()
menu = {}
# Include parent_take itself first (so it's directly selectable),
# then its children. This applies at the top level (parent_take ==
# root_take) and equally for any submenu of a take that has children.
all_items = [parent_take] + list(parent_take.children())
page_items = all_items[offset:offset + PAGE_SIZE]
has_more = (offset + PAGE_SIZE) < len(all_items)
for i, take in enumerate(page_items):
label = ("* " if take == current_take else "") + take.name()
# The take this submenu belongs to should be directly selectable
if take == parent_take:
menu[i] = {
"type": "script_action",
"label": label,
"script": lambda take=take, **kwargs: hou.takes.setCurrentTake(take)
}
elif take.children():
menu[i] = {
"type": "script_submenu",
"label": label,
"script": lambda take=take, **kwargs: build_take_menu(take, 0)
}
else:
menu[i] = {
"type": "script_action",
"label": label,
"script": lambda take=take, **kwargs: hou.takes.setCurrentTake(take)
}
if has_more:
remaining = len(all_items) - (offset + PAGE_SIZE)
menu[MORE_SLOT] = {
"type": "script_submenu",
"label": "More... ({})".format(remaining),
"script": lambda parent_take=parent_take, next_offset=offset + PAGE_SIZE, **kwargs: build_take_menu(parent_take, next_offset)
}
radialmenu.setRadialMenu(menu)
build_take_menu()