-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Append Unreal ContentBrowser Folder Context Menu? #59
Comments
Hey, I find a way listed as follows, but not sure is this a proper solution to this problem. _abstract.py
......
elif self.items: # submenu
+ if self.label == self._get_parent_app_node_name(parent_app_node=parent_app_node):
+ for item in self.items:
+ item.setup(parent_app_node=parent_app_node)
+ else:
self.app_node = self._setup_sub_menu(parent_app_node=parent_app_node)
for item in self.items:
item.setup(parent_app_node=self.app_node)
......
+@abstractmethod
+def _get_parent_app_node_name(self, parent_app_node=None):
+ """get the default parent name for the root node, optional method"""
+ pass
unreal.py
+def _get_parent_app_node_name(self, parent_app_node: unreal.ToolMenu = None):
+ return parent_app_node.menu_name if parent_app_node else "" |
Hi, thank you for taking the time to post this issue. |
Sorry for not explaining clearly. What I hope to achieve is to directly place a MenuEntry under the root directory ContentBrowserFolderContext by configuring YAML, rather than as a SubMenuEntry. Specifically, let's say I have a MenuEntry called AssetCheck. Its location should be ContentBrowserFolderContext->AssetCheck instead of ContentBrowserFolderContext->AnyLabel->AssetCheck. So in the previous response, I modified the setup() method in abstract.py to ensure that in the implementation of unreal.py, it checks whether each label in items matches a specific unreal.ToolMenu's menu_name. If they match, the parent of that item is set to a specific unreal.ToolMenu. |
ah i see, so you want to add several menu items to an existing menu. i think this needs some more thought, since I can't think on what the YAML would look like for now. should be something like this probably existing parent
- child menuitem
- child menuitem but i believe the current setup is to only support this existing parent
- sub menu
- child menuitem
- child menuitem i wonder if something like this would work - label: TA Tool
separator: True
parent_path: ContentBrowser.FolderContextMenu
- label: SyncToAssetByPath
command: from utility.sync_to_asset_by_path import SyncToAssetByPath;SyncToAssetByPath()
parent_path: ContentBrowser.FolderContextMenu
- label: CheckAssets
command: from utility.asset_check import CheckAssets;CheckAssets()
parent_path: ContentBrowser.FolderContextMenu |
Thanks for your reply, I've tried your yaml, but got this error:
|
ye because it's an array and expects dict. i need to look into that tbh
but then i assume it ll also expect a label, will prob have to update the code also if i remember, separator was a special case in unreal. which might make all of this more complex 😅 |
Can you put this code in a PR, i can have a look at it. but atm I don't have time. |
Better to have no submenu here.
The text was updated successfully, but these errors were encountered: