-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathSceneUtils.cpp
More file actions
25 lines (22 loc) · 813 Bytes
/
SceneUtils.cpp
File metadata and controls
25 lines (22 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "SceneUtils.h"
SceneUtils::SceneUtils() {
}
void SceneUtils::getRootObjects(const std::vector<Core::WeakPointer<Core::Object3D>>& objects, std::vector<Core::WeakPointer<Core::Object3D>>& roots) {
for (unsigned int i = 0; i < objects.size(); i++) {
Core::WeakPointer<Core::Object3D> object = objects[i];
Core::WeakPointer<Core::Object3D> parent = object->getParent();
bool isRoot = true;
while (isRoot && parent) {
for (unsigned int j = 0; j < objects.size(); j++) {
if(objects[j]->getID() == parent->getID()) {
isRoot = false;
break;
}
}
parent = parent->getParent();
}
if (isRoot) {
roots.push_back(object);
}
}
}