Hey,
I’m relatively new to using the python api for ue and I am trying to create a custom menu with multiple entries under the actor context menu. The menu works as I expect when right clicking on the view port. However, when I try to view the entries after right clicking on the outliner window, the dropdown function doesn’t work. So far I have tried changing the parameters and the various methods I use and the order in which I evoke those methods. I have only figured out how to NOT to solve this issue. I included an image of what this menu would like like as well as the method that I wrote to create this menu. Any suggestions would be appreciated!
def create_right_click_menus():
menus = unreal.ToolMenus.get()
right_click = menus.find_menu("LevelEditor.ActorContextMenu")
right_click.add_section(section_name="Pipeline", label="Pipeline", insert_type=unreal.ToolMenuInsertType.FIRST)
sub_menu = right_click.add_sub_menu("Pipeline", "Pipeline", "CreateGroupMesh", "Create Group Mesh")
entries = {'Center' : unreal.ToolMenuEntry(name="PivotCenter", type=unreal.MultiBlockType.MENU_ENTRY),
'Origin' : unreal.ToolMenuEntry(name="PivotOrigin", type=unreal.MultiBlockType.MENU_ENTRY),
'First Selected' : unreal.ToolMenuEntry(name="PivotFirstSelected", type=unreal.MultiBlockType.MENU_ENTRY)}
for key, entry in entries.items():
entry.set_label(unreal.Text(f"Pivot {key}"))
entry.set_string_command(unreal.ToolMenuStringCommandType.PYTHON, unreal.Name(), f"import menus.right_click.create_mesh_group as cm; cm.group_selected_actors('{key}')")
sub_menu.add_menu_entry(f"Pipeline", entry)