-
-
Save rondreas/eeecb0fcf52f05e898e0e31b22658068 to your computer and use it in GitHub Desktop.
Is there a way to get the list of all menu identifiers? I've enabled the Display UI Extension Points
in Editor Preferences
but it doesn't show the fully qualified menu identifier. For example I'm trying to get the identifier for the content browser context menu when you press the add button on content browser or right click a folder in the content browser.
@wywarren I think that menu is created each time you spawn the context menu, setting a breakpoint in ..Engine/Plugins/Editor/ContentBrowser/ContentBrowserAssetDataSource/Source/ContentBrowserAssetDataSource/Private/NewAssetContextMenu.cpp
and looking where any of the section ContentBrowserNewBasicAsset
gets added, the UToolMenu is temp with no name etc
So pretty sure you need to edit the C++ to extent the context menu. Or somehow catch and add to the UToolMenu when it spawns.
hi,
im super new to python in unreal. can you give an example on how to run a python script when clicking on a custom menu entry?
@AnetteZellmoser was a while since I looked at it so hope it's not outdated. You could create a ToolMenuEntryScript like
import unreal
@unreal.uclass()
class MyEntryScript(unreal.ToolMenuEntryScript):
@unreal.ufunction(override=True)
def execute(self, context):
print("Hello, World!")
Then in the gist above add it as an entry to a tool menu like
...
entry = unreal.ToolMenuEntry(
name = "Hello",
type = unreal.MultiBlockType.MENU_ENTRY,
script_object = MyEntryScript()
)
...
thanks alot!
do you also know how to add a shortcut to a menu entry?
Sorry i have another question... so the first part would be a sperate .py ?
do you also know how to add a shortcut to a menu entry?
Off the top of my head, no sorry.
so the first part would be a sperate .py ?
If you wanted to sure, but there is nothing in python where you're forced to move classes into separate modules.
Thanks alot! you really helped me alot. I ran into another problem. When i add the script_object to the ToolMenuEntry the label and tool tip is not visible anymore
You will need to override and implement those methods, https://docs.unrealengine.com/4.26/en-US/PythonAPI/class/ToolMenuEntryScript.html
sorry i hope im not bothering you but could you give me an example on how to do that?
its not work with unreal 5.2 startup python file att all he cant find the Menus
You likely want extent menu when running on start up @amrSherifSrour, I made a post where I extend the menu on start up also.
Thanks worked out of the box for 5.4.4
Thx, useful.