FText FBehaviorTreeDebugger::FindValueForKey(const FName& InKeyName, bool bUseCurrentState) const { #if USE_BEHAVIORTREE_DEBUGGER if (IsDebuggerRunning() && TreeInstance.IsValid()) { const TMap<FName, FString>* MapToQuery = nullptr; if(bUseCurrentState) { MapToQuery = &CurrentValues; } else if(TreeInstance->DebuggerSteps.IsValidIndex(ActiveStepIndex)) { MapToQuery = &TreeInstance->DebuggerSteps[ActiveStepIndex].BlackboardValues; } if(MapToQuery != nullptr) { const FString* FindValue = MapToQuery->Find(InKeyName); if(FindValue != nullptr) { return FText::FromString(*FindValue); } } } return FText(); #endif }
void FBehaviorTreeDebugger::UpdateDebuggerViewOnTick() { #if USE_BEHAVIORTREE_DEBUGGER if (IsDebuggerRunning() && TreeInstance.IsValid()) { const float GameTime = GEditor && GEditor->PlayWorld ? GEditor->PlayWorld->GetTimeSeconds() : 0.0f; CurrentTimestamp = GameTime; TreeInstance->StoreDebuggerBlackboard(CurrentValues); } #endif }
void FBehaviorTreeDebugger::UpdateDebuggerViewOnStepChange() { #if USE_BEHAVIORTREE_DEBUGGER if (IsDebuggerRunning() && TreeInstance.IsValid() && TreeInstance->DebuggerSteps.IsValidIndex(ActiveStepIndex)) { const FBehaviorTreeExecutionStep& ShowStep = TreeInstance->DebuggerSteps[ActiveStepIndex]; SavedTimestamp = ShowStep.TimeStamp; SavedValues = ShowStep.BlackboardValues; } #endif }
void Debugger::RunDebuggerShell() { if (IsDebuggerRunning()) { if (steps_ > 0) { // Finish stepping first. --steps_; return; } printf("Next: "); PrintInstructions(pc()); bool done = false; while (!done) { char buffer[kMaxDebugShellLine]; char* line = ReadCommandLine("vixl> ", buffer, kMaxDebugShellLine); if (line == NULL) continue; // An error occurred. DebugCommand* command = DebugCommand::Parse(line); if (command != NULL) { last_command_ = command; } if (last_command_ != NULL) { done = last_command_->Run(this); } else { printf("No previous command to run!\n"); } } if ((debug_parameters_ & DBG_BREAK) != 0) { // The break request has now been handled, move to next instruction. debug_parameters_ &= ~DBG_BREAK; increment_pc(); } } }