The above code is just too vague for me to understanding, I can’t find any references to the existing icons available in engine or what the variables are looking for exactly.
Is there any further documentation or hints on this?
how to use custom icon, i make a toolbar plugin with py api, and i just found, it seems? all the icons are preset in ue souce code in which i dont want to relate.
import unreal
# =====================================================
# ===== ON A SEPARATE CLASS FILE SOMEHWHERE FOR ORDERELY Management
@unreal.uclass()
class ExampleClass(unreal.ToolMenuEntryScript):
@unreal.ufunction(override=True)
def execute(self, context):
print("Am about to change your whole work flow")
menus = unreal.ToolMenus.get()
MySubMenu = menus.extend_menu("LevelEditor.MainMenu")
# Init all the data at once!
menuScriptData = unreal.ToolMenuEntryScriptData( menu = MySubMenu.menu_name,
section = "YourSectionName",
name = "YourName",
label = "My New Python Tool",
tool_tip = "Tell Me what this tool/command does",
# Set the icon. You can use the Widget Reflector in Unreal to help locate
# the various icons. Use the Used By name when you hover.
icon = unreal.ScriptSlateIcon("EditorStyle", "Sequencer.CreateCamera"),
# insert_position = unreal.ToolMenuInsert("Section Name", unreal.ToolMenuInsertType.DEFAULT )
)
menuScript = ExampleClass()
menuScript.set_editor_property("data", menuScriptData)
# End Dummy class
# =====================================================
menus = unreal.ToolMenus.get()
mainMenu = menus.find_menu("LevelEditor.MainMenu")
myNewMenu = mainMenu.add_sub_menu(owner = mainMenu.get_name(),
section_name = "TheMenuSection",
name = "TheMenuName",
label = "Name Of the tool",
tool_tip = "Work Smart, Not Hard! Speed is king in today's age!")
MySubMenu = myNewMenu.add_sub_menu(owner = myNewMenu.get_name(),
section_name = "MySubMenuSection",
name = "MySubMenu",
label = "My Sub Menu",
tool_tip = "Tell me what this tool does! LOL")
entry = unreal.ToolMenuEntry( name = "ReImportCameraAnimation_Entry",
type = unreal.MultiBlockType.MENU_ENTRY,
insert_position = unreal.ToolMenuInsert("MySubMenuSection", unreal.ToolMenuInsertType.DEFAULT ),
script_object = menuScript )
MySubMenu.add_menu_entry("MySubMenuSection", entry)