Better code reload
This commit is contained in:
BIN
Content/Luprex/InputActions/IA_ReloadSource.uasset
LFS
Normal file
BIN
Content/Luprex/InputActions/IA_ReloadSource.uasset
LFS
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -77,22 +77,10 @@ void AlxPlayerControllerBase::BeginPlay()
|
|||||||
RootWidget->AddToViewport(0);
|
RootWidget->AddToViewport(0);
|
||||||
|
|
||||||
Super::BeginPlay();
|
Super::BeginPlay();
|
||||||
|
|
||||||
if (FSlateApplication::IsInitialized())
|
|
||||||
{
|
|
||||||
FocusChangingHandle = FSlateApplication::Get().OnFocusChanging().AddUObject(
|
|
||||||
this, &AlxPlayerControllerBase::HandleFocusChanging);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlxPlayerControllerBase::EndPlay(const EEndPlayReason::Type EndPlayReason)
|
void AlxPlayerControllerBase::EndPlay(const EEndPlayReason::Type EndPlayReason)
|
||||||
{
|
{
|
||||||
if (FocusChangingHandle.IsValid() && FSlateApplication::IsInitialized())
|
|
||||||
{
|
|
||||||
FSlateApplication::Get().OnFocusChanging().Remove(FocusChangingHandle);
|
|
||||||
FocusChangingHandle.Reset();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (IsValid(RootWidget))
|
if (IsValid(RootWidget))
|
||||||
{
|
{
|
||||||
RootWidget->RemoveFromParent();
|
RootWidget->RemoveFromParent();
|
||||||
@@ -103,20 +91,6 @@ void AlxPlayerControllerBase::EndPlay(const EEndPlayReason::Type EndPlayReason)
|
|||||||
Super::EndPlay(EndPlayReason);
|
Super::EndPlay(EndPlayReason);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlxPlayerControllerBase::HandleFocusChanging(
|
|
||||||
const FFocusEvent &FocusEvent,
|
|
||||||
const FWeakWidgetPath &OldPath,
|
|
||||||
const TSharedPtr<SWidget> &OldFocusedWidget,
|
|
||||||
const FWidgetPath &NewPath,
|
|
||||||
const TSharedPtr<SWidget> &NewFocusedWidget)
|
|
||||||
{
|
|
||||||
UE_LOG(LogLuprexIntegration, Display,
|
|
||||||
TEXT("Focus changing: '%s' -> '%s' (cause: %s)"),
|
|
||||||
OldFocusedWidget.IsValid() ? *OldFocusedWidget->GetTypeAsString() : TEXT("<none>"),
|
|
||||||
NewFocusedWidget.IsValid() ? *NewFocusedWidget->GetTypeAsString() : TEXT("<none>"),
|
|
||||||
*UEnum::GetValueAsString(FocusEvent.GetCause()));
|
|
||||||
}
|
|
||||||
|
|
||||||
UInputComponent* AlxPlayerControllerBase::GetWidgetInputComponent(UUserWidget *Widget)
|
UInputComponent* AlxPlayerControllerBase::GetWidgetInputComponent(UUserWidget *Widget)
|
||||||
{
|
{
|
||||||
if (!IsValid(Widget)) return nullptr;
|
if (!IsValid(Widget)) return nullptr;
|
||||||
|
|||||||
@@ -48,15 +48,6 @@ public:
|
|||||||
virtual void BeginPlay() override;
|
virtual void BeginPlay() override;
|
||||||
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
|
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override;
|
||||||
|
|
||||||
private:
|
|
||||||
FDelegateHandle FocusChangingHandle;
|
|
||||||
void HandleFocusChanging(
|
|
||||||
const struct FFocusEvent &FocusEvent,
|
|
||||||
const class FWeakWidgetPath &OldPath,
|
|
||||||
const TSharedPtr<class SWidget> &OldFocusedWidget,
|
|
||||||
const class FWidgetPath &NewPath,
|
|
||||||
const TSharedPtr<class SWidget> &NewFocusedWidget);
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual void BuildInputStack(TArray<UInputComponent*>& InputStack) override;
|
virtual void BuildInputStack(TArray<UInputComponent*>& InputStack) override;
|
||||||
|
|||||||
@@ -536,25 +536,30 @@ void World::probe_lua_call(int64_t actor_id, int64_t place_id, std::string_view
|
|||||||
// in top-level code.
|
// in top-level code.
|
||||||
//
|
//
|
||||||
bool World::rebuild_sourcedb(int64_t actor_id) {
|
bool World::rebuild_sourcedb(int64_t actor_id) {
|
||||||
bool ok = true;
|
int successes = 0;
|
||||||
|
int failures = 0;
|
||||||
for (const eng::string &mod: source_db_.modules()) {
|
for (const eng::string &mod: source_db_.modules()) {
|
||||||
open_lthread_state(0, 0, 0, false);
|
open_lthread_state(0, 0, 0, false);
|
||||||
eng::string err = source_db_.rebuild_module(mod);
|
eng::string err = source_db_.rebuild_module(mod);
|
||||||
eng::string prints = lthread_prints_.str();
|
eng::string prints = lthread_prints_.str();
|
||||||
clear_lthread_state();
|
clear_lthread_state();
|
||||||
if (!err.empty()) ok = false;
|
if (err.empty()) successes ++;
|
||||||
if (actor_id >= 0) {
|
else failures ++;
|
||||||
lthread_prints_ << "Compiling " << mod << std::endl;
|
if ((!err.empty()) || (!prints.empty())) {
|
||||||
|
lthread_prints_ << "Compiling " << mod << ":" << std::endl;
|
||||||
if (!err.empty()) lthread_prints_ << err << std::endl;
|
if (!err.empty()) lthread_prints_ << err << std::endl;
|
||||||
if (!prints.empty()) lthread_prints_ << prints;
|
if (!prints.empty()) lthread_prints_ << prints;
|
||||||
lthread_prints_to_actor(actor_id);
|
util::dprintview(lthread_prints_.view());
|
||||||
|
if (actor_id != 0) lthread_prints_to_actor(actor_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (actor_id > 0) {
|
lthread_prints_ << "Compiled " << successes << " modules successfully." << std::endl;
|
||||||
lthread_prints_ << (ok ? "Compilation Successful." : "Compilation Failed.") << std::endl;
|
if (failures > 0) {
|
||||||
lthread_prints_to_actor(actor_id);
|
lthread_prints_ << "Compiled " << failures << " modules with errors." << std::endl;
|
||||||
}
|
}
|
||||||
return ok;
|
util::dprintview(lthread_prints_.view());
|
||||||
|
if (actor_id > 0) lthread_prints_to_actor(actor_id);
|
||||||
|
return (failures == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool World::update_source(const util::LuaSourceVec &source, int64_t actor_id) {
|
bool World::update_source(const util::LuaSourceVec &source, int64_t actor_id) {
|
||||||
@@ -698,7 +703,7 @@ HttpServerResponse World::http_serve(const HttpParser &request) {
|
|||||||
open_lthread_state(0, 0, 0, false);
|
open_lthread_state(0, 0, 0, false);
|
||||||
eng::string msg = traceback_pcall(L, 1, LUA_MULTRET);
|
eng::string msg = traceback_pcall(L, 1, LUA_MULTRET);
|
||||||
if (!msg.empty()) lthread_prints_ << msg << std::endl;
|
if (!msg.empty()) lthread_prints_ << msg << std::endl;
|
||||||
lthread_prints_to_actor(0);
|
util::dprintview(lthread_prints_.view());
|
||||||
clear_lthread_state();
|
clear_lthread_state();
|
||||||
|
|
||||||
// If the call threw an error, return
|
// If the call threw an error, return
|
||||||
@@ -1167,13 +1172,9 @@ void World::lthread_prints_to_actor(int64_t actor_id)
|
|||||||
{
|
{
|
||||||
const eng::string &output = lthread_prints_.str();
|
const eng::string &output = lthread_prints_.str();
|
||||||
if (output.size() > 0) {
|
if (output.size() > 0) {
|
||||||
if (actor_id >= 0) {
|
|
||||||
Tangible *actor = tangible_get(actor_id);
|
Tangible *actor = tangible_get(actor_id);
|
||||||
if (actor != nullptr) {
|
if (actor != nullptr) {
|
||||||
actor->print_buffer_.add_string(output, is_authoritative());
|
actor->print_buffer_.add_string(output, is_authoritative());
|
||||||
} else {
|
|
||||||
util::dprintview(output);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
lthread_prints_.str("");
|
lthread_prints_.str("");
|
||||||
lthread_prints_.clear();
|
lthread_prints_.clear();
|
||||||
|
|||||||
@@ -292,7 +292,7 @@ void World::patch_source(StreamBuffer *sb, DebugCollector *dbc) {
|
|||||||
DebugBlock dbb(dbc, "patch_source");
|
DebugBlock dbb(dbc, "patch_source");
|
||||||
bool modified = source_db_.patch(sb, dbc);
|
bool modified = source_db_.patch(sb, dbc);
|
||||||
if (modified) {
|
if (modified) {
|
||||||
rebuild_sourcedb(-1);
|
rebuild_sourcedb(0);
|
||||||
DebugLine(dbc) << "Source DB rebuilt";
|
DebugLine(dbc) << "Source DB rebuilt";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ public:
|
|||||||
|
|
||||||
// Rebuild the global environment from the source database.
|
// Rebuild the global environment from the source database.
|
||||||
//
|
//
|
||||||
// Error messages go to the specified actor.
|
// Error messages go to the specified actor, and also dprint.
|
||||||
//
|
//
|
||||||
// Returns true if the rebuild goes without errors.
|
// Returns true if the rebuild goes without errors.
|
||||||
//
|
//
|
||||||
@@ -292,7 +292,7 @@ public:
|
|||||||
|
|
||||||
// Update the source database from disk, then rebuild the global environment.
|
// Update the source database from disk, then rebuild the global environment.
|
||||||
//
|
//
|
||||||
// Error messages go to the specified actor.
|
// Error messages go to the specified actor, and also dprint.
|
||||||
//
|
//
|
||||||
// Returns true if the update goes without errors.
|
// Returns true if the update goes without errors.
|
||||||
//
|
//
|
||||||
@@ -378,9 +378,7 @@ public:
|
|||||||
|
|
||||||
// Send the lthread_prints output to the specified actor.
|
// Send the lthread_prints output to the specified actor.
|
||||||
//
|
//
|
||||||
// If actor_id == (-1) prints are discarded.
|
// Send prints to the specified actor's printbuffer.
|
||||||
// If actor_id == (0) prints go to dprint.
|
|
||||||
// Anything else, and the prints go to a specific actor.
|
|
||||||
//
|
//
|
||||||
void lthread_prints_to_actor(int64_t actor_id);
|
void lthread_prints_to_actor(int64_t actor_id);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user