void GuiActivityInventorySheet::RefreshTable() { Cleaner(); vector<Activity> currentAISActivities = ActivityInAIS::get<Activity>(*(mpDatabase),Expr(), ActivityInAIS::ActivityInventorySheet==mpAis->id).all(); for (vector<Activity>::iterator i = currentAISActivities.begin(); i != currentAISActivities.end(); i++) { int tablePosition= ui->ais->rowCount(); this->ui->ais->insertRow(tablePosition); this->ui->ais->setColumnWidth(0, 0); this->ui->ais->setColumnWidth(1, 440); QTableWidgetItem *currentActivity=new QTableWidgetItem[7]; currentActivity[0].setText(QString((toString((*i).id)).c_str())); currentActivity[1].setText(QString((toString((*i).mDescription)).c_str())); currentActivity[2].setText(QString(((*i).GetInsertionDate()).c_str())); currentActivity[3].setText(QString(((*i).GetDeadline()).c_str())); currentActivity[4].setText(QString((toString((*i).mOrder)).c_str())); currentActivity[5].setText(QString((toString((*i).mNumPomodoro)).c_str())); currentActivity[6].setText(((*i).mIsFinished)?"finished":"not finished"); currentActivity[0].setFlags(Qt::NoItemFlags | Qt::ItemIsEnabled | Qt::ItemIsSelectable); currentActivity[1].setFlags(Qt::NoItemFlags | Qt::ItemIsEnabled | Qt::ItemIsSelectable); currentActivity[2].setFlags(Qt::NoItemFlags | Qt::ItemIsEnabled | Qt::ItemIsSelectable); currentActivity[3].setFlags(Qt::NoItemFlags | Qt::ItemIsEnabled | Qt::ItemIsSelectable); currentActivity[4].setFlags(Qt::NoItemFlags | Qt::ItemIsEnabled | Qt::ItemIsSelectable); currentActivity[5].setFlags(Qt::NoItemFlags | Qt::ItemIsEnabled | Qt::ItemIsSelectable); currentActivity[6].setFlags(Qt::NoItemFlags | Qt::ItemIsEnabled | Qt::ItemIsSelectable); for (int k=0; k<7; k++) ui->ais->setItem(tablePosition,k,¤tActivity[k]); } }
static bool LoadBIN(const char* filename, SurfaceManager& test, const float* scale=null, bool mergeMeshes=false, udword tesselation=0, TesselationScheme ts = TESS_BUTTERFLY) { IceFile BinFile(filename); if(!BinFile.IsValid()) return false; const udword NbMeshes = BinFile.LoadDword(); printf("LoadBIN: loading %d meshes...\n", NbMeshes); AABB GlobalBounds; GlobalBounds.SetEmpty(); udword TotalNbTris = 0; udword TotalNbVerts = 0; if(!mergeMeshes) { for(udword i=0;i<NbMeshes;i++) { const udword Collidable = BinFile.LoadDword(); const udword Renderable = BinFile.LoadDword(); const udword NbVerts = BinFile.LoadDword(); const udword NbFaces = BinFile.LoadDword(); // TotalNbTris += NbFaces; // TotalNbVerts += NbVerts; IndexedSurface* IS = test.CreateManagedSurface(); bool Status = IS->Init(NbFaces, NbVerts); ASSERT(Status); Point* Verts = IS->GetVerts(); for(udword j=0;j<NbVerts;j++) { Verts[j].x = BinFile.LoadFloat(); Verts[j].y = BinFile.LoadFloat(); Verts[j].z = BinFile.LoadFloat(); if(scale) Verts[j] *= *scale; if(0) { Matrix3x3 RotX; RotX.RotX(HALFPI*0.5f); Verts[j] *= RotX; Verts[j] += Point(0.1f, -0.2f, 0.3f); } GlobalBounds.Extend(Verts[j]); } IndexedTriangle* F = IS->GetFaces(); for(udword j=0;j<NbFaces;j++) { F[j].mRef[0] = BinFile.LoadDword(); F[j].mRef[1] = BinFile.LoadDword(); F[j].mRef[2] = BinFile.LoadDword(); } /* if(tesselation) { for(udword j=0;j<tesselation;j++) { if(ts==TESS_BUTTERFLY) { ButterflyScheme BS; IS->Subdivide(BS); } else if(ts==TESS_POLYHEDRAL) { PolyhedralScheme PS; IS->Subdivide(PS); } } }*/ if(tesselation) Tesselate(IS, tesselation, ts); if(gUseMeshCleaner) { MeshCleaner Cleaner(IS->GetNbVerts(), IS->GetVerts(), IS->GetNbFaces(), IS->GetFaces()->mRef); IS->Init(Cleaner.mNbTris, Cleaner.mNbVerts, Cleaner.mVerts, (const IndexedTriangle*)Cleaner.mIndices); } TotalNbTris += IS->GetNbFaces(); TotalNbVerts += IS->GetNbVerts(); // SaveBIN("c:\\TessBunny.bin", *IS); } } else { IndexedSurface* IS = test.CreateManagedSurface(); for(udword i=0;i<NbMeshes;i++) { const udword Collidable = BinFile.LoadDword(); const udword Renderable = BinFile.LoadDword(); const udword NbVerts = BinFile.LoadDword(); const udword NbFaces = BinFile.LoadDword(); IndexedSurface LocalIS; bool Status = LocalIS.Init(NbFaces, NbVerts); ASSERT(Status); Point* Verts = LocalIS.GetVerts(); for(udword j=0;j<NbVerts;j++) { Verts[j].x = BinFile.LoadFloat(); Verts[j].y = BinFile.LoadFloat(); Verts[j].z = BinFile.LoadFloat(); if(scale) Verts[j] *= *scale; GlobalBounds.Extend(Verts[j]); } IndexedTriangle* F = LocalIS.GetFaces(); for(udword j=0;j<NbFaces;j++) { F[j].mRef[0] = BinFile.LoadDword(); F[j].mRef[1] = BinFile.LoadDword(); F[j].mRef[2] = BinFile.LoadDword(); } IS->Merge(&LocalIS); } /* if(tesselation) { for(udword j=0;j<tesselation;j++) { ButterflyScheme BS; IS->Subdivide(BS); } }*/ if(tesselation) Tesselate(IS, tesselation, ts); TotalNbTris = IS->GetNbFaces(); TotalNbVerts = IS->GetNbVerts(); } test.SetGlobalBounds(GlobalBounds); const udword GrandTotal = sizeof(Point)*TotalNbVerts + sizeof(IndexedTriangle)*TotalNbTris; printf("LoadBIN: loaded %d tris and %d verts, for a total of %d Kb.\n", TotalNbTris, TotalNbVerts, GrandTotal/1024); printf("LoadBIN: min bounds: %f | %f | %f\n", GlobalBounds.GetMin(0), GlobalBounds.GetMin(1), GlobalBounds.GetMin(2)); printf("LoadBIN: max bounds: %f | %f | %f\n", GlobalBounds.GetMax(0), GlobalBounds.GetMax(1), GlobalBounds.GetMax(2)); return true; }
/** * Uses test maps in Engine and/or game content folder which are populated with a few blueprint instances * See InstanceTestMaps entries in the [Automation.Blueprint] config sections * For all blueprint instances in the map: * Duplicates the instance * Compares the duplicated instance properties to the original instance properties */ bool FBlueprintInstancesTest::RunTest(const FString& InParameters) { FBlueprintAutomationTestUtilities::LoadMap(InParameters); // Pause before running test ADD_LATENT_AUTOMATION_COMMAND(FDelayLatentCommand(2.f)); // Grab BP instances from map TSet<AActor*> BlueprintInstances; for ( FActorIterator It(GWorld); It; ++It ) { AActor* Actor = *It; UClass* ActorClass = Actor->GetClass(); if (ActorClass->ClassGeneratedBy && ActorClass->ClassGeneratedBy->IsA( UBlueprint::StaticClass() ) ) { BlueprintInstances.Add(Actor); } } bool bPropertiesMatch = true; FCompilerResultsLog ResultLog; TSet<UPackage*> PackagesUserRefusedToFullyLoad; ObjectTools::FPackageGroupName PGN; for (auto BpIter = BlueprintInstances.CreateIterator(); BpIter; ++BpIter ) { AActor* BPInstance = *BpIter; UObject* BPInstanceOuter = BPInstance ? BPInstance->GetOuter() : NULL; TMap<FString,FString> BPNativePropertyValues; BPInstance->GetNativePropertyValues(BPNativePropertyValues); // Grab the package and save out its dirty state UPackage* ActorPackage = BPInstance->GetOutermost(); FBlueprintAutomationTestUtilities::FPackageCleaner Cleaner(ActorPackage); // Use this when duplicating the object to keep a list of everything that was duplicated //TMap<UObject*, UObject*> DuplicatedObjectList; FObjectDuplicationParameters Parameters(BPInstance, BPInstanceOuter); //Parameters.CreatedObjects = &DuplicatedObjectList; Parameters.DestName = MakeUniqueObjectName( BPInstanceOuter, AActor::StaticClass(), BPInstance->GetFName() ); // Duplicate the object AActor* ClonedInstance = Cast<AActor>(StaticDuplicateObjectEx(Parameters)); if (!FBlueprintAutomationTestUtilities::CompareObjects(BPInstance, ClonedInstance, ResultLog)) { bPropertiesMatch = false; break; } // Ensure we can't save package in editor FBlueprintAutomationTestUtilities::DontSavePackage(ActorPackage); } // Start a new map for now // @todo find a way return to previous map thats a 100% reliably GEditor->CreateNewMapForEditing(); ADD_LATENT_AUTOMATION_COMMAND(FDelayLatentCommand(2.f)); return bPropertiesMatch; }