Integrating latest 47acbe8
This commit is contained in:
-15
@@ -1,15 +0,0 @@
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
ly_add_external_target(
|
||||
NAME pyside2
|
||||
3RDPARTY_ROOT_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/pyside2
|
||||
VERSION
|
||||
)
|
||||
@@ -1,17 +0,0 @@
|
||||
#
|
||||
# All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
# its licensors.
|
||||
#
|
||||
# For complete copyright and license terms please see the LICENSE at the root of this
|
||||
# distribution (the "License"). All use of this software is governed by the License,
|
||||
# or, if provided, by the license below or the license accompanying this file. Do not
|
||||
# remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
set(pyside2_SHARED_LIB_PATH ${BASE_PATH}/windows/$<IF:$<CONFIG:Debug>,debug,release>)
|
||||
|
||||
# Adding Shared libs
|
||||
set(pyside2_RUNTIME_DEPENDENCIES
|
||||
${pyside2_SHARED_LIB_PATH}/PySide2/$<IF:$<CONFIG:Debug>,pyside2_d.cp37-win_amd64.dll,pyside2.abi3.dll>
|
||||
${pyside2_SHARED_LIB_PATH}/shiboken2/$<IF:$<CONFIG:Debug>,shiboken2_d.cp37-win_amd64.dll,shiboken2.abi3.dll>
|
||||
${pyside2_SHARED_LIB_PATH}/shiboken2/$<IF:$<CONFIG:Debug>,shiboken2_d.cp37-win_amd64.pyd,shiboken2.pyd>)
|
||||
@@ -9,5 +9,4 @@
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
#
|
||||
|
||||
ly_add_external_target_path(${CMAKE_CURRENT_LIST_DIR}/3rdParty)
|
||||
add_subdirectory(Code)
|
||||
|
||||
@@ -32,9 +32,6 @@ namespace QtForPython
|
||||
|
||||
//! The 'winId' of the main Qt window in the Lumberyard editor
|
||||
AZ::u64 m_mainWindowId;
|
||||
|
||||
//! PySide package folder to attach to the Python system path
|
||||
AZStd::string m_pySidePackageFolder;
|
||||
};
|
||||
|
||||
//! Used to fetch tools framework data
|
||||
|
||||
@@ -165,7 +165,6 @@ namespace QtForPython
|
||||
->Property("qtBinaryFolder", BehaviorValueProperty(&QtBootstrapParameters::m_qtBinaryFolder))
|
||||
->Property("qtPluginsFolder", BehaviorValueProperty(&QtBootstrapParameters::m_qtPluginsFolder))
|
||||
->Property("mainWindowId", BehaviorValueProperty(&QtBootstrapParameters::m_mainWindowId))
|
||||
->Property("pySidePackageFolder", BehaviorValueProperty(&QtBootstrapParameters::m_pySidePackageFolder))
|
||||
;
|
||||
}
|
||||
}
|
||||
@@ -211,22 +210,10 @@ namespace QtForPython
|
||||
char devroot[AZ_MAX_PATH_LEN];
|
||||
AZ::IO::FileIOBase::GetInstance()->ResolvePath("@devroot@", devroot, AZ_MAX_PATH_LEN);
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
const char* platform = "windows";
|
||||
#else
|
||||
#if !defined(Q_OS_WIN)
|
||||
#error Unsupported OS platform for this QtForPython gem
|
||||
#endif
|
||||
|
||||
#if defined(AZ_DEBUG_BUILD)
|
||||
const char* build = "debug";
|
||||
#else
|
||||
const char* build = "release";
|
||||
#endif
|
||||
// prepare the platform and build specific PySide2 package folder
|
||||
AZ::StringFunc::Path::Join(devroot, "Gems/QtForPython/3rdParty/pyside2", params.m_pySidePackageFolder);
|
||||
AZ::StringFunc::Path::Join(params.m_pySidePackageFolder.c_str(), platform, params.m_pySidePackageFolder);
|
||||
AZ::StringFunc::Path::Join(params.m_pySidePackageFolder.c_str(), build, params.m_pySidePackageFolder);
|
||||
|
||||
params.m_mainWindowId = 0;
|
||||
using namespace AzToolsFramework;
|
||||
QWidget* activeWindow = nullptr;
|
||||
|
||||
@@ -20,6 +20,7 @@ from shiboken2 import wrapInstance, getCppPointer
|
||||
# The `view_pane_handlers` holds onto the callback handlers that get created
|
||||
# for responding to requests for when the Editor needs to construct the view pane
|
||||
view_pane_handlers = {}
|
||||
registration_handlers = {}
|
||||
|
||||
# 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()):
|
||||
@@ -42,7 +43,18 @@ def register_view_pane(name, widget_type, options=editor.ViewPaneOptions()):
|
||||
|
||||
return new_widget.winId()
|
||||
|
||||
# Register our widget as an Editor view pane
|
||||
def on_notify_register_views(parameters, my_name=name, 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)
|
||||
|
||||
# We keep a handler around in case a request for registering custom view panes comes later
|
||||
print('Initializing callback for RegisterCustomViewPane')
|
||||
registration_handler = azlmbr.bus.NotificationHandler("EditorEventBus")
|
||||
registration_handler.connect()
|
||||
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)
|
||||
|
||||
# Connect to the ViewPaneCallbackBus in order to respond to requests to create our widget
|
||||
|
||||
@@ -11,40 +11,30 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
||||
import sys
|
||||
import os
|
||||
import pathlib
|
||||
import azlmbr
|
||||
import azlmbr.bus
|
||||
|
||||
# establishes python paths to find PySide2 libraries
|
||||
if (azlmbr.qt.QtForPythonRequestBus(azlmbr.bus.Broadcast, 'IsActive')):
|
||||
|
||||
params = azlmbr.qt.QtForPythonRequestBus(azlmbr.bus.Broadcast, 'GetQtBootstrapParameters')
|
||||
|
||||
# add PySide2 base folder to sys.path
|
||||
# Ideally, the current directory or the directory of the script is the first
|
||||
# always the first element: https://tinyurl.com/yysfw8pb
|
||||
sys.path.insert(1, pathlib.PureWindowsPath(params.pySidePackageFolder).as_posix())
|
||||
sys.path.insert(1, pathlib.PureWindowsPath(params.qtBinaryFolder).as_posix())
|
||||
params = azlmbr.qt.QtForPythonRequestBus(azlmbr.bus.Broadcast, 'GetQtBootstrapParameters')
|
||||
|
||||
if len(params.qtPluginsFolder):
|
||||
# add the Qt plugins to the environment
|
||||
os.environ['QT_PLUGIN_PATH'] = params.qtPluginsFolder
|
||||
|
||||
# add Qt binaries to the Windows path to handle findings DLL file dependencies
|
||||
if sys.platform.startswith('win'):
|
||||
path = os.environ['PATH']
|
||||
newPath = ''
|
||||
newPath += params.qtBinaryFolder + os.pathsep
|
||||
newPath += os.path.join(params.pySidePackageFolder, 'shiboken2') + os.pathsep
|
||||
newPath += os.path.join(params.pySidePackageFolder, 'PySide2') + os.pathsep
|
||||
newPath += path
|
||||
os.environ['PATH'] = newPath
|
||||
print('PySide2 bootstrapped PATH for Windows.')
|
||||
# add Qt binaries to the Windows path to handle findings DLL file dependencies
|
||||
if len(params.qtBinaryFolder) and sys.platform.startswith('win'):
|
||||
path = os.environ['PATH']
|
||||
newPath = ''
|
||||
newPath += params.qtBinaryFolder + os.pathsep
|
||||
newPath += path
|
||||
os.environ['PATH'] = newPath
|
||||
print('PySide2 bootstrapped PATH for Windows.')
|
||||
|
||||
# Once PySide2 has been bootstrapped, register our Object Tree visualizer with the Editor
|
||||
try:
|
||||
import az_qt_helpers
|
||||
from show_object_tree import ObjectTreeDialog
|
||||
az_qt_helpers.register_view_pane('Object Tree', ObjectTreeDialog)
|
||||
except:
|
||||
print ('Skipping register our Object Tree visualizer with the Editor.')
|
||||
# Once PySide2 has been bootstrapped, register our Object Tree visualizer with the Editor
|
||||
try:
|
||||
import az_qt_helpers
|
||||
from show_object_tree import ObjectTreeDialog
|
||||
az_qt_helpers.register_view_pane('Object Tree', ObjectTreeDialog)
|
||||
except:
|
||||
print('Skipping register our Object Tree visualizer with the Editor.')
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"gem_name": "QtForPython",
|
||||
"GemFormatVersion": 4,
|
||||
"Uuid": "cd50c7a1e31f4c9495dcffdacc3bde92",
|
||||
"Name": "QtForPython",
|
||||
|
||||
Reference in New Issue
Block a user