MCPcopy Create free account
hub / github.com/bumptop/BumpTop / crossReference

Method crossReference

trunk/win/Source/BT_SceneManager.cpp:1063–1175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1061#endif
1062
1063void SceneManager::crossReference()
1064{
1065 // get the list of objects in the working directory (use both the global & user desktops in the desktop case)
1066 vector<QString> workingDirFiles = fsManager->getWorkingDirectoryContents();
1067 if (winOS->GetSystemPath(DesktopDirectory) == native(currentWorkingDirectory))
1068 workingDirFiles = mergeVectors(workingDirFiles, fsManager->getDirectoryContents(winOS->GetSystemPath(AllUsersDesktopDir)));
1069
1070 // add all the active widget's working directories
1071 vector<Widget *> widgets = widgetManager->getActiveWidgets();
1072 for (int i = 0; i < widgets.size(); ++i)
1073 workingDirFiles = mergeVectors(workingDirFiles, fsManager->getDirectoryContents(widgets[i]->workingDirectory));
1074
1075 // put it into a set so lookups are quicker later
1076 set<QString> workingDirFilesSet;
1077 for (int i = 0; i < workingDirFiles.size(); ++i)
1078 workingDirFilesSet.insert(workingDirFiles[i]);
1079
1080 // remove all items in the scene that don't exist in the filesystem
1081 BumpObject * parent = NULL;
1082 vector<BumpObject *> objs = _bumpObjects;
1083 for (int i = 0; i < objs.size(); ++i)
1084 {
1085 // skip items in hard piles
1086 parent = objs[i]->getParent();
1087 if (!parent || !(parent->getObjectType() == ObjectType(BumpPile, HardPile)))
1088 {
1089 // skip non-fsactors, or photo frames and virtual actors
1090 // also skip logical volumes
1091 ObjectType objType = objs[i]->getObjectType();
1092 if (objType == ObjectType(BumpActor, FileSystem))
1093 {
1094 FileSystemActor * actor = (FileSystemActor *) objs[i];
1095 if (!actor->isFileSystemType(PhotoFrame) &&
1096 !actor->isFileSystemType(Virtual) &&
1097 !actor->isFileSystemType(LogicalVolume))
1098 {
1099 QString filePath = actor->getFullPath();
1100 QFileInfo actorPath(filePath);
1101 set<QString>::iterator iter = workingDirFilesSet.begin();
1102 bool exists = false;
1103 while (iter != workingDirFilesSet.end())
1104 {
1105 if (fsManager->isIdenticalPath(*iter, filePath))
1106 {
1107 workingDirFilesSet.erase(iter++);
1108 exists = true;
1109 }
1110 else
1111 iter++;
1112 }
1113
1114 if (!exists)
1115 {
1116 if (parent && parent->isObjectType(BumpPile))
1117 {
1118 // remove it from the parent's pile if necessary
1119 Pile * p = (Pile *) parent;
1120 p->removeFromPile(actor);

Callers 2

loadSceneDataMethod · 0.80
loadSceneMethod · 0.80

Calls 15

ObjectTypeClass · 0.85
GetSystemPathMethod · 0.80
getDirectoryContentsMethod · 0.80
getParentMethod · 0.80
isFileSystemTypeMethod · 0.80
getFullPathMethod · 0.80
isIdenticalPathMethod · 0.80
isVolumeADiscMethod · 0.80
setTextureIDMethod · 0.80
setMountedMethod · 0.80
resolveVolumeNameMethod · 0.80

Tested by

no test coverage detected