Improvements to C++/Python tool gemplates
Signed-off-by: Chris Galvan <chgalvan@amazon.com>
This commit is contained in:
@@ -27,7 +27,7 @@ def get_editor_main_window():
|
||||
return editor_main_window
|
||||
|
||||
# Helper method for registering a Python widget as a tool/view pane with the Editor
|
||||
def register_view_pane(name, widget_type, options=editor.ViewPaneOptions()):
|
||||
def register_view_pane(name, widget_type, category="Tools", options=editor.ViewPaneOptions()):
|
||||
global view_pane_handlers
|
||||
|
||||
# The view pane names are unique in the Editor, so make sure one with the same name doesn't exist already
|
||||
@@ -45,10 +45,10 @@ def register_view_pane(name, widget_type, options=editor.ViewPaneOptions()):
|
||||
|
||||
return new_widget.winId()
|
||||
|
||||
def on_notify_register_views(parameters, my_name=name, my_options=options):
|
||||
def on_notify_register_views(parameters, my_name=name, my_category=category, my_options=options):
|
||||
# Register our widget as an Editor view pane
|
||||
print('Calling on_notify_register_views RegisterCustomViewPane')
|
||||
editor.EditorRequestBus(azlmbr.bus.Broadcast, 'RegisterCustomViewPane', my_name, 'Tools', my_options)
|
||||
editor.EditorRequestBus(azlmbr.bus.Broadcast, 'RegisterCustomViewPane', my_name, my_category, my_options)
|
||||
|
||||
# We keep a handler around in case a request for registering custom view panes comes later
|
||||
print('Initializing callback for RegisterCustomViewPane')
|
||||
@@ -57,7 +57,7 @@ def register_view_pane(name, widget_type, options=editor.ViewPaneOptions()):
|
||||
registration_handler.add_callback("NotifyRegisterViews", on_notify_register_views)
|
||||
global registration_handlers
|
||||
registration_handlers[name] = registration_handler
|
||||
editor.EditorRequestBus(azlmbr.bus.Broadcast, 'RegisterCustomViewPane', name, 'Tools', options)
|
||||
editor.EditorRequestBus(azlmbr.bus.Broadcast, 'RegisterCustomViewPane', name, category, options)
|
||||
|
||||
# Connect to the ViewPaneCallbackBus in order to respond to requests to create our widget
|
||||
# We also need to store our handler so it will exist for the life of the Editor
|
||||
|
||||
Reference in New Issue
Block a user