Merge branch 'development' into LYN-3705-2
This commit is contained in:
@@ -163,6 +163,8 @@ ly_add_target(
|
||||
editor_files.cmake
|
||||
PLATFORM_INCLUDE_FILES
|
||||
Platform/${PAL_PLATFORM_NAME}/editor_${PAL_PLATFORM_NAME_LOWERCASE}.cmake
|
||||
TARGET_PROPERTIES
|
||||
LY_INSTALL_GENERATE_RUN_TARGET TRUE
|
||||
BUILD_DEPENDENCIES
|
||||
PRIVATE
|
||||
3rdParty::Qt::Core
|
||||
|
||||
@@ -415,33 +415,37 @@ namespace Editor
|
||||
}
|
||||
|
||||
// Ensure that the Windows WM_INPUT messages get passed through to the AzFramework input system.
|
||||
// These events are now consumed both in and out of game mode.
|
||||
if (msg->message == WM_INPUT)
|
||||
// These events are only broadcast in game mode. In Editor mode, RenderViewportWidget creates synthetic
|
||||
// keyboard and mouse events via Qt.
|
||||
if (GetIEditor()->IsInGameMode())
|
||||
{
|
||||
UINT rawInputSize;
|
||||
const UINT rawInputHeaderSize = sizeof(RAWINPUTHEADER);
|
||||
GetRawInputData((HRAWINPUT)msg->lParam, RID_INPUT, NULL, &rawInputSize, rawInputHeaderSize);
|
||||
|
||||
AZStd::array<BYTE, sizeof(RAWINPUT)> rawInputBytesArray;
|
||||
LPBYTE rawInputBytes = rawInputBytesArray.data();
|
||||
|
||||
const UINT bytesCopied = GetRawInputData((HRAWINPUT)msg->lParam, RID_INPUT, rawInputBytes, &rawInputSize, rawInputHeaderSize);
|
||||
CRY_ASSERT(bytesCopied == rawInputSize);
|
||||
|
||||
RAWINPUT* rawInput = (RAWINPUT*)rawInputBytes;
|
||||
CRY_ASSERT(rawInput);
|
||||
|
||||
AzFramework::RawInputNotificationBusWindows::Broadcast(&AzFramework::RawInputNotificationsWindows::OnRawInputEvent, *rawInput);
|
||||
|
||||
return false;
|
||||
}
|
||||
else if (msg->message == WM_DEVICECHANGE)
|
||||
{
|
||||
if (msg->wParam == 0x0007) // DBT_DEVNODES_CHANGED
|
||||
if (msg->message == WM_INPUT)
|
||||
{
|
||||
AzFramework::RawInputNotificationBusWindows::Broadcast(&AzFramework::RawInputNotificationsWindows::OnRawInputDeviceChangeEvent);
|
||||
UINT rawInputSize;
|
||||
const UINT rawInputHeaderSize = sizeof(RAWINPUTHEADER);
|
||||
GetRawInputData((HRAWINPUT)msg->lParam, RID_INPUT, NULL, &rawInputSize, rawInputHeaderSize);
|
||||
|
||||
AZStd::array<BYTE, sizeof(RAWINPUT)> rawInputBytesArray;
|
||||
LPBYTE rawInputBytes = rawInputBytesArray.data();
|
||||
|
||||
const UINT bytesCopied = GetRawInputData((HRAWINPUT)msg->lParam, RID_INPUT, rawInputBytes, &rawInputSize, rawInputHeaderSize);
|
||||
CRY_ASSERT(bytesCopied == rawInputSize);
|
||||
|
||||
RAWINPUT* rawInput = (RAWINPUT*)rawInputBytes;
|
||||
CRY_ASSERT(rawInput);
|
||||
|
||||
AzFramework::RawInputNotificationBusWindows::Broadcast(&AzFramework::RawInputNotificationsWindows::OnRawInputEvent, *rawInput);
|
||||
|
||||
return false;
|
||||
}
|
||||
else if (msg->message == WM_DEVICECHANGE)
|
||||
{
|
||||
if (msg->wParam == 0x0007) // DBT_DEVNODES_CHANGED
|
||||
{
|
||||
AzFramework::RawInputNotificationBusWindows::Broadcast(&AzFramework::RawInputNotificationsWindows::OnRawInputDeviceChangeEvent);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
+82
-15
@@ -581,6 +581,8 @@ public:
|
||||
{{"project-path", "Supplies the path to the project that the Editor should use", "project-path"}, dummyString},
|
||||
{{"engine-path", "Supplies the path to the engine", "engine-path"}, dummyString},
|
||||
{{"project-cache-path", "Path to the project cache", "project-cache-path"}, dummyString},
|
||||
{{"project-user-path", "Path to the project user path", "project-user-path"}, dummyString},
|
||||
{{"project-log-path", "Path to the project log path", "project-log-path"}, dummyString}
|
||||
// add dummy entries here to prevent QCommandLineParser error-ing out on cmd line args that will be parsed later
|
||||
};
|
||||
|
||||
@@ -1483,7 +1485,6 @@ struct PythonTestOutputHandler final
|
||||
{
|
||||
PythonOutputHandler::OnExceptionMessage(message);
|
||||
printf("EXCEPTION: %.*s\n", static_cast<int>(message.size()), message.data());
|
||||
AZ::Debug::Trace::Terminate(1);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1501,34 +1502,91 @@ void CCryEditApp::RunInitPythonScript(CEditCommandLineInfo& cmdInfo)
|
||||
using namespace AzToolsFramework;
|
||||
if (cmdInfo.m_bRunPythonScript || cmdInfo.m_bRunPythonTestScript)
|
||||
{
|
||||
// cmdInfo data is only available on startup, copy it
|
||||
QByteArray fileStr = cmdInfo.m_strFileName.toUtf8();
|
||||
|
||||
// We support specifying multiple files in the cmdline by separating them with ';'
|
||||
AZStd::vector<AZStd::string_view> fileList;
|
||||
AzFramework::StringFunc::TokenizeVisitor(
|
||||
fileStr.constData(),
|
||||
[&fileList](AZStd::string_view elem)
|
||||
{
|
||||
fileList.push_back(elem);
|
||||
}, ';', false /* keepEmptyStrings */
|
||||
);
|
||||
|
||||
if (cmdInfo.m_pythonArgs.length() > 0 || cmdInfo.m_bRunPythonTestScript)
|
||||
{
|
||||
AZStd::vector<AZStd::string> tokens;
|
||||
AzFramework::StringFunc::Tokenize(cmdInfo.m_pythonArgs.toUtf8().constData(), tokens, ' ');
|
||||
QByteArray pythonArgsStr = cmdInfo.m_pythonArgs.toUtf8();
|
||||
AZStd::vector<AZStd::string_view> pythonArgs;
|
||||
std::transform(tokens.begin(), tokens.end(), std::back_inserter(pythonArgs), [](auto& tokenData) { return tokenData.c_str(); });
|
||||
AzFramework::StringFunc::TokenizeVisitor(pythonArgsStr.constData(),
|
||||
[&pythonArgs](AZStd::string_view elem)
|
||||
{
|
||||
pythonArgs.push_back(elem);
|
||||
}, ' '
|
||||
);
|
||||
|
||||
if (cmdInfo.m_bRunPythonTestScript)
|
||||
{
|
||||
AZStd::string pythonTestCase;
|
||||
if (!cmdInfo.m_pythontTestCase.isEmpty())
|
||||
// Multiple testcases can be specified them with ';', these should match the files to run
|
||||
AZStd::vector<AZStd::string_view> testcaseList;
|
||||
testcaseList.resize(fileList.size());
|
||||
{
|
||||
pythonTestCase = cmdInfo.m_pythontTestCase.toUtf8().constData();
|
||||
int i = 0;
|
||||
AzFramework::StringFunc::TokenizeVisitor(
|
||||
fileStr.constData(),
|
||||
[&i, &testcaseList](AZStd::string_view elem)
|
||||
{
|
||||
testcaseList[i++] = (elem);
|
||||
}, ';', false /* keepEmptyStrings */
|
||||
);
|
||||
}
|
||||
|
||||
EditorPythonRunnerRequestBus::Broadcast(&EditorPythonRunnerRequestBus::Events::ExecuteByFilenameAsTest, cmdInfo.m_strFileName.toUtf8().constData(), pythonTestCase, pythonArgs);
|
||||
bool success = true;
|
||||
auto ExecuteByFilenamesTests = [&pythonArgs, &fileList, &testcaseList, &success](EditorPythonRunnerRequests* pythonRunnerRequests)
|
||||
{
|
||||
for (int i = 0; i < fileList.size(); ++i)
|
||||
{
|
||||
bool cur_success = pythonRunnerRequests->ExecuteByFilenameAsTest(fileList[i], testcaseList[i], pythonArgs);
|
||||
success = success && cur_success;
|
||||
}
|
||||
};
|
||||
EditorPythonRunnerRequestBus::Broadcast(ExecuteByFilenamesTests);
|
||||
|
||||
// Close the editor gracefully as the test has completed
|
||||
GetIEditor()->GetDocument()->SetModifiedFlag(false);
|
||||
QTimer::singleShot(0, qApp, &QApplication::closeAllWindows);
|
||||
if (success)
|
||||
{
|
||||
// Close the editor gracefully as the test has completed
|
||||
GetIEditor()->GetDocument()->SetModifiedFlag(false);
|
||||
QTimer::singleShot(0, qApp, &QApplication::closeAllWindows);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Close down the application with 0xF exit code indicating failure of the test
|
||||
AZ::Debug::Trace::Terminate(0xF);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorPythonRunnerRequestBus::Broadcast(&EditorPythonRunnerRequestBus::Events::ExecuteByFilenameWithArgs, cmdInfo.m_strFileName.toUtf8().constData(), pythonArgs);
|
||||
auto ExecuteByFilenamesWithArgs = [&pythonArgs, &fileList](EditorPythonRunnerRequests* pythonRunnerRequests)
|
||||
{
|
||||
for (AZStd::string_view filename : fileList)
|
||||
{
|
||||
pythonRunnerRequests->ExecuteByFilenameWithArgs(filename, pythonArgs);
|
||||
}
|
||||
};
|
||||
EditorPythonRunnerRequestBus::Broadcast(ExecuteByFilenamesWithArgs);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorPythonRunnerRequestBus::Broadcast(&EditorPythonRunnerRequestBus::Events::ExecuteByFilename, cmdInfo.m_strFileName.toUtf8().constData());
|
||||
auto ExecuteByFilenames = [&fileList](EditorPythonRunnerRequests* pythonRunnerRequests)
|
||||
{
|
||||
for (AZStd::string_view filename : fileList)
|
||||
{
|
||||
pythonRunnerRequests->ExecuteByFilename(filename);
|
||||
}
|
||||
};
|
||||
EditorPythonRunnerRequestBus::Broadcast(ExecuteByFilenames);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2271,7 +2329,9 @@ int CCryEditApp::IdleProcessing(bool bBackgroundUpdate)
|
||||
bool bIsAppWindow = IsWindowInForeground();
|
||||
bool bActive = false;
|
||||
int res = 0;
|
||||
if (bIsAppWindow || m_bForceProcessIdle || m_bKeepEditorActive)
|
||||
if (bIsAppWindow || m_bForceProcessIdle || m_bKeepEditorActive
|
||||
// Automated tests must always keep the editor active, or they can get stuck
|
||||
|| m_bAutotestMode)
|
||||
{
|
||||
res = 1;
|
||||
bActive = true;
|
||||
@@ -2841,7 +2901,14 @@ void CCryEditApp::OpenProjectManager(const AZStd::string& screen)
|
||||
{
|
||||
// provide the current project path for in case we want to update the project
|
||||
AZ::IO::FixedMaxPathString projectPath = AZ::Utils::GetProjectPath();
|
||||
const AZStd::string commandLineOptions = AZStd::string::format(" --screen %s --project-path %s", screen.c_str(), projectPath.c_str());
|
||||
#if !AZ_TRAIT_OS_PLATFORM_APPLE && !AZ_TRAIT_OS_USE_WINDOWS_FILE_PATHS
|
||||
const char* argumentQuoteString = R"(")";
|
||||
#else
|
||||
const char* argumentQuoteString = R"(\")";
|
||||
#endif
|
||||
const AZStd::string commandLineOptions = AZStd::string::format(R"( --screen %s --project-path %s%s%s)",
|
||||
screen.c_str(),
|
||||
argumentQuoteString, projectPath.c_str(), argumentQuoteString);
|
||||
bool launchSuccess = AzFramework::ProjectManager::LaunchProjectManager(commandLineOptions);
|
||||
if (!launchSuccess)
|
||||
{
|
||||
|
||||
@@ -463,7 +463,7 @@ void EditorViewportWidget::Update()
|
||||
|
||||
if (m_updateCameraPositionNextTick)
|
||||
{
|
||||
auto cameraState = m_renderViewport->GetCameraState();
|
||||
auto cameraState = GetCameraState();
|
||||
AZ::Matrix3x4 matrix;
|
||||
matrix.SetBasisAndTranslation(cameraState.m_side, cameraState.m_forward, cameraState.m_up, cameraState.m_position);
|
||||
auto m = AZMatrix3x4ToLYMatrix3x4(matrix);
|
||||
@@ -472,6 +472,12 @@ void EditorViewportWidget::Update()
|
||||
m_Camera.SetZRange(cameraState.m_nearClip, cameraState.m_farClip);
|
||||
}
|
||||
|
||||
// Ensure the FOV matches our internally stored setting if we're using the Editor camera
|
||||
if (!m_viewEntityId.IsValid() && !GetIEditor()->IsInGameMode())
|
||||
{
|
||||
SetFOV(GetFOV());
|
||||
}
|
||||
|
||||
// Reset the camera update flag now that we're finished updating our viewport context
|
||||
m_updateCameraPositionNextTick = false;
|
||||
|
||||
@@ -1138,6 +1144,17 @@ void EditorViewportWidget::OnMenuSelectCurrentCamera()
|
||||
|
||||
AzFramework::CameraState EditorViewportWidget::GetCameraState()
|
||||
{
|
||||
if (m_viewEntityId.IsValid())
|
||||
{
|
||||
bool cameraStateAcquired = false;
|
||||
AzFramework::CameraState cameraState;
|
||||
Camera::EditorCameraViewRequestBus::BroadcastResult(cameraStateAcquired,
|
||||
&Camera::EditorCameraViewRequestBus::Events::GetCameraState, cameraState);
|
||||
if (cameraStateAcquired)
|
||||
{
|
||||
return cameraState;
|
||||
}
|
||||
}
|
||||
return m_renderViewport->GetCameraState();
|
||||
}
|
||||
|
||||
@@ -1223,6 +1240,13 @@ AZStd::shared_ptr<AtomToolsFramework::ModularViewportCameraController> CreateMod
|
||||
AzFramework::ViewportId viewportId)
|
||||
{
|
||||
auto controller = AZStd::make_shared<AtomToolsFramework::ModularViewportCameraController>();
|
||||
|
||||
controller->SetCameraPriorityBuilderCallback(
|
||||
[](AtomToolsFramework::CameraControllerPriorityFn& cameraControllerPriorityFn)
|
||||
{
|
||||
cameraControllerPriorityFn = AtomToolsFramework::DefaultCameraControllerPriority;
|
||||
});
|
||||
|
||||
controller->SetCameraPropsBuilderCallback(
|
||||
[](AzFramework::CameraProps& cameraProps)
|
||||
{
|
||||
@@ -2613,8 +2637,6 @@ void EditorViewportWidget::DestroyRenderContext()
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void EditorViewportWidget::SetDefaultCamera()
|
||||
{
|
||||
// Ensure the FOV matches our internally stored setting
|
||||
SetFOV(GetFOV());
|
||||
if (IsDefaultCamera())
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -278,14 +278,9 @@ namespace
|
||||
PyExit();
|
||||
}
|
||||
|
||||
void PyReportTest(bool success, const AZStd::string& output)
|
||||
void PyTestOutput(const AZStd::string& output)
|
||||
{
|
||||
CCryEditApp::instance()->PrintAlways(output);
|
||||
if (!success)
|
||||
{
|
||||
gEnv->retCode = 0xF; // Special error code indicating a failure in tests
|
||||
}
|
||||
PyExitNoPrompt();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1956,7 +1951,7 @@ namespace AzToolsFramework
|
||||
addLegacyGeneral(behaviorContext->Method("get_pane_class_names", PyGetViewPaneNames, nullptr, "Get all available class names for use with open_pane & close_pane."));
|
||||
addLegacyGeneral(behaviorContext->Method("exit", PyExit, nullptr, "Exits the editor."));
|
||||
addLegacyGeneral(behaviorContext->Method("exit_no_prompt", PyExitNoPrompt, nullptr, "Exits the editor without prompting to save first."));
|
||||
addLegacyGeneral(behaviorContext->Method("report_test_result", PyReportTest, nullptr, "Report test information."));
|
||||
addLegacyGeneral(behaviorContext->Method("test_output", PyTestOutput, nullptr, "Report test information."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-30
@@ -321,42 +321,13 @@ bool CToolBoxManager::SetMacroTitle(int index, const QString& title, bool bToolb
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
void CToolBoxManager::Load(ActionManager* actionManager)
|
||||
void CToolBoxManager::Load([[maybe_unused]] ActionManager* actionManager)
|
||||
{
|
||||
Clear();
|
||||
|
||||
QString path;
|
||||
GetSaveFilePath(path);
|
||||
Load(path, nullptr, true, nullptr);
|
||||
|
||||
if (actionManager)
|
||||
{
|
||||
auto engineSourceAssetPath = AZ::IO::FixedMaxPath(AZ::Utils::GetEnginePath()) / "Assets";
|
||||
LoadShelves((engineSourceAssetPath / "Editor" / "Scripts").c_str(),
|
||||
(engineSourceAssetPath / "Editor" / "Scripts" / "Shelves").c_str(), actionManager);
|
||||
}
|
||||
}
|
||||
|
||||
void CToolBoxManager::LoadShelves(QString scriptPath, QString shelvesPath, ActionManager* actionManager)
|
||||
{
|
||||
IFileUtil::FileArray files;
|
||||
CFileUtil::ScanDirectory(shelvesPath, "*.xml", files);
|
||||
|
||||
const int shelfCount = files.size();
|
||||
for (int idx = 0; idx < shelfCount; ++idx)
|
||||
{
|
||||
if (Path::GetExt(files[idx].filename) != "xml")
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
QString shelfName(PathUtil::GetFileName(files[idx].filename.toUtf8().data()));
|
||||
|
||||
AmazonToolbar toolbar(shelfName, shelfName);
|
||||
Load(shelvesPath + QString("/") + files[idx].filename, &toolbar, false, actionManager);
|
||||
|
||||
m_toolbars.push_back(toolbar);
|
||||
}
|
||||
}
|
||||
|
||||
void CToolBoxManager::Load(QString xmlpath, AmazonToolbar* pToolbar, bool bToolbox, ActionManager* actionManager)
|
||||
|
||||
@@ -129,7 +129,6 @@ public:
|
||||
void Save() const;
|
||||
// Load macros configuration from registry.
|
||||
void Load(ActionManager* actionManager = nullptr);
|
||||
void LoadShelves(QString scriptPath, QString shelvesPath, ActionManager* actionManager);
|
||||
|
||||
//! Get the number of managed macros.
|
||||
int GetMacroCount(bool bToolbox) const;
|
||||
|
||||
@@ -20,11 +20,11 @@ struct AffineParts
|
||||
Vec3 scale; //!< Stretch factors.
|
||||
float fDet; //!< Sign of determinant.
|
||||
|
||||
/** Decompose matrix to its affnie parts.
|
||||
/** Decompose matrix to its affine parts.
|
||||
*/
|
||||
void Decompose(const Matrix34& mat);
|
||||
|
||||
/** Decompose matrix to its affnie parts.
|
||||
/** Decompose matrix to its affine parts.
|
||||
Assume there`s no stretch rotation.
|
||||
*/
|
||||
void SpectralDecompose(const Matrix34& mat);
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
static void Record(IUndoObject* undo);
|
||||
|
||||
private:
|
||||
static const uint32 scDescSize = 256;
|
||||
static const AZ::u32 scDescSize = 256;
|
||||
char m_description[scDescSize];
|
||||
bool m_bCancelled;
|
||||
bool m_bStartedRecord;
|
||||
|
||||
Reference in New Issue
Block a user