{LYN-2336} Fix: Python Console script help opens empty (#3060)

* {LYN-2336} Fix: Python Console script help opens empty

Fixes: Python Console: Script Help opens empty in AutomatedTesting project
This fixes the missing Python symbols in the Editor
This also fixes the PYI files to write out for the AutomatedTesting project

Signed-off-by: Jackson <23512001+jackalbe@users.noreply.github.com>

* Fixing proper symbol log execution times


Signed-off-by: Jackson <23512001+jackalbe@users.noreply.github.com>

* annotating input values with const

Signed-off-by: Jackson <23512001+jackalbe@users.noreply.github.com>
This commit is contained in:
jackalbe
2021-08-12 11:19:15 -05:00
committed by GitHub
parent 288d366c2a
commit 117bd0e680
8 changed files with 113 additions and 30 deletions
@@ -90,6 +90,11 @@ namespace EditorPythonBindings
PythonSymbolEventBus::Handler::BusConnect();
EditorPythonBindingsNotificationBus::Handler::BusConnect();
AZ::Interface<AzToolsFramework::EditorPythonConsoleInterface>::Register(this);
if (PythonSymbolEventBus::GetTotalNumOfEventHandlers() > 1)
{
OnPostInitialize();
}
}
void PythonLogSymbolsComponent::Deactivate()
@@ -111,6 +116,7 @@ namespace EditorPythonBindings
m_basePath = pythonSymbolsPath;
}
EditorPythonBindingsNotificationBus::Handler::BusDisconnect();
PythonSymbolEventBus::ExecuteQueuedEvents();
}
void PythonLogSymbolsComponent::WriteMethod(AZ::IO::HandleType handle, AZStd::string_view methodName, const AZ::BehaviorMethod& behaviorMethod, const AZ::BehaviorClass* behaviorClass)
@@ -206,12 +212,12 @@ namespace EditorPythonBindings
AZ::IO::FileIOBase::GetInstance()->Write(handle, buffer.c_str(), buffer.size());
}
void PythonLogSymbolsComponent::LogClass(AZStd::string_view moduleName, AZ::BehaviorClass* behaviorClass)
void PythonLogSymbolsComponent::LogClass(const AZStd::string moduleName, const AZ::BehaviorClass* behaviorClass)
{
LogClassWithName(moduleName, behaviorClass, behaviorClass->m_name.c_str());
}
void PythonLogSymbolsComponent::LogClassWithName(AZStd::string_view moduleName, AZ::BehaviorClass* behaviorClass, AZStd::string_view className)
void PythonLogSymbolsComponent::LogClassWithName(const AZStd::string moduleName, const AZ::BehaviorClass* behaviorClass, const AZStd::string className)
{
Internal::FileHandle fileHandle(OpenModuleAt(moduleName));
if (fileHandle.IsValid())
@@ -255,7 +261,11 @@ namespace EditorPythonBindings
}
}
void PythonLogSymbolsComponent::LogClassMethod(AZStd::string_view moduleName, AZStd::string_view globalMethodName, AZ::BehaviorClass* behaviorClass, AZ::BehaviorMethod* behaviorMethod)
void PythonLogSymbolsComponent::LogClassMethod(
const AZStd::string moduleName,
const AZStd::string globalMethodName,
const AZ::BehaviorClass* behaviorClass,
const AZ::BehaviorMethod* behaviorMethod)
{
AZ_UNUSED(behaviorClass);
Internal::FileHandle fileHandle(OpenModuleAt(moduleName));
@@ -265,7 +275,7 @@ namespace EditorPythonBindings
}
}
void PythonLogSymbolsComponent::LogBus(AZStd::string_view moduleName, AZStd::string_view busName, AZ::BehaviorEBus* behaviorEBus)
void PythonLogSymbolsComponent::LogBus(const AZStd::string moduleName, const AZStd::string busName, const AZ::BehaviorEBus* behaviorEBus)
{
if (behaviorEBus->m_events.empty())
{
@@ -404,7 +414,7 @@ namespace EditorPythonBindings
}
}
void PythonLogSymbolsComponent::LogGlobalMethod(AZStd::string_view moduleName, AZStd::string_view methodName, AZ::BehaviorMethod* behaviorMethod)
void PythonLogSymbolsComponent::LogGlobalMethod(const AZStd::string moduleName, const AZStd::string methodName, const AZ::BehaviorMethod* behaviorMethod)
{
Internal::FileHandle fileHandle(OpenModuleAt(moduleName));
if (fileHandle.IsValid())
@@ -428,7 +438,10 @@ namespace EditorPythonBindings
}
}
void PythonLogSymbolsComponent::LogGlobalProperty(AZStd::string_view moduleName, AZStd::string_view propertyName, AZ::BehaviorProperty* behaviorProperty)
void PythonLogSymbolsComponent::LogGlobalProperty(
const AZStd::string moduleName,
const AZStd::string propertyName,
const AZ::BehaviorProperty* behaviorProperty)
{
if (!behaviorProperty->m_getter || !behaviorProperty->m_getter->GetResult())
{