/* The following function exists to put the MCU to sleep when in the idle task. */ void vApplicationIdleHook(void) { Housekeeping(); /* Put the processor to sleep if the serial port indicates it is OK, * the command task does not have anything to process, and * all of the queues are empty. * * This will stop the OS scheduler. */ FreeBuffers = QueueHandles[FREE_QINDEX]->uxMessagesWaiting; if ( SerialPortReadyToSleep() && CommandTaskReadyToSleep() && GetTaskDelayLockCount() == 0 && (FreeBuffers == NUM_MSG_BUFFERS) ) { extern xTaskHandle IdleTaskHandle; CheckStackUsage(IdleTaskHandle,"Idle Task"); /* Call MSP430 Utility function to enable low power mode 3. */ /* Put OS and Processor to sleep. Will need an interrupt */ /* to wake us up from here. */ MSP430_LPM_ENTER(); } }
UEditorActorFolders& FActorFolders::InitializeForWorld(UWorld& InWorld) { // Clean up any stale worlds Housekeeping(); // We intentionally don't pass RF_Transactional to ConstructObject so that we don't record the creation of the object into the undo buffer // (to stop it getting deleted on undo as we manage its lifetime), but we still want it to be RF_Transactional so we can record any changes later UEditorActorFolders* Folders = NewObject<UEditorActorFolders>(GetTransientPackage(), NAME_None, RF_NoFlags); Folders->SetFlags(RF_Transactional); TemporaryWorldFolders.Add(&InWorld, Folders); // Ensure the list is entirely up to date with the world before we write our serialized properties into it. for (FActorIterator ActorIt(&InWorld); ActorIt; ++ActorIt) { AddFolderToWorld(InWorld, ActorIt->GetFolderPath()); } // Attempt to load the folder properties from this user's saved world state directory const auto Filename = GetWorldStateFilename(InWorld.GetOutermost()); TUniquePtr<FArchive> Ar(IFileManager::Get().CreateFileReader(*Filename)); if (Ar) { TSharedPtr<FJsonObject> RootObject = MakeShareable(new FJsonObject); auto Reader = TJsonReaderFactory<TCHAR>::Create(Ar.Get()); if (FJsonSerializer::Deserialize(Reader, RootObject)) { const TSharedPtr<FJsonObject>& JsonFolders = RootObject->GetObjectField(TEXT("Folders")); for (const auto& KeyValue : JsonFolders->Values) { // Only pull in the folder's properties if this folder still exists in the world. // This means that old stale folders won't re-appear in the world (they'll won't get serialized when the world is saved anyway) if (FActorFolderProps* FolderInWorld = Folders->Folders.Find(*KeyValue.Key)) { auto FolderProperties = KeyValue.Value->AsObject(); FolderInWorld->bIsExpanded = FolderProperties->GetBoolField(TEXT("bIsExpanded")); } } } Ar->Close(); } return *Folders; }
void FActorFolders::OnMapChange(uint32 MapChangeFlags) { Housekeeping(); check(GWorld); RebuildFolderListForWorld(*GWorld); }
void FActorFolders::OnLevelActorListChanged() { Housekeeping(); check(GWorld); RebuildFolderListForWorld(*GWorld); }