For assets you could go for AssetActionUtility, an editor utility that exposes it self in the context menu when right clicking assets. You could opt for either Python or Blueprint, they should be able to do the same.
However it seem Unreal don’t see Folders as Assets so afraid this is a C++ thing.
I think a bunch of that could be done in python or a mix of blutility + python scripts (depending on how you want to do things) - If you want to do right click things, you’ll have to delve into menu making which is/was horrendous in UE4 last time I did it (which was a year or so ago)
Luckily though, @robberyman and I went through that a while ago and there’s some code around
Yeah, seem you can actually add menu items to folders also. Debugger told me there was no name or menu existing until the context menu was visible so gave up previous attempt.
import unreal
@unreal.uclass()
class MyEntry(unreal.ToolMenuEntryScript):
@unreal.ufunction(override=True)
def execute(self, context):
print("Hello!")
def main():
menus = unreal.ToolMenus.get()
menu_name = "ContentBrowser.FolderContextMenu"
section_name = "PathViewFolderOptions"
# create the tool menu entry script object,
script_object = MyEntry()
script_object.init_entry(
owner_name = menu_name,
menu = menu_name,
section = section_name,
name = "MyEntry",
label = "My Entry",
tool_tip = "This is a tool tip for My Entry"
)
script_object.register_menu_entry() # not sure if needed to register,
if __name__ == "__main__":
main()
This will create a menu entry in the folder context menu, then you can use EditorAssetUtility to do most of what you want.
Ok but how to do the call to a Blueprint Utility? with load_blueprint_class ?
And what I need to do in the blueprint to receive the path of the folder for example ?
Sorry but it’s very difficult to find any documentation about that…
Think you will have to give more context to what you’re attempting.
Do I understand you if you know have a menu, which you created from Python. And an Editor Utility Blueprint with a run method you want to call?
As for getting the Selected Folder Paths, Editor Utility Library has a method for this called just that. But why call this in a Blueprint when you also have it available in Python and can just call it in the menu you then have?
Edit: interesting, if I open a material, save it again, and close it before restart UE4, I’ve not problem of “white material” anymore. Maybe if save asset after move them ( specially materials ) : it could be works.
Edit2: YES! It was that, it works ! I added :
# force save asset to avoid f***g white materials !!
editorAssetLib.save_asset(_targetPathName)
… Now it could be cool to add all of that to your menu @robberyman to get my “workingPath” on the fly, but I don’t know how to get it