111 {
113
114 try {
115 m_root =
XFILE(path.c_str()).getRoot();
116 }
117 catch (int e) {
118 return nullptr;
119 }
120
121 auto scene =
new SScene();
122
123 XNode sce_scene = m_root->getChild(
"CSESCENE");
124
125 auto node_gameobjects = sce_scene.children;
126 std::vector<NodeKey*> gameobjects;
127 std::vector<ComponentValue*> components;
128
129 for (const auto& node_obj: node_gameobjects) {
130 if (node_obj.name == "gameobject") {
131 ExploringScene(node_obj, gameobjects, components);
132 } else if (node_obj.name == "prefab") {
133 ExploringPrefab(node_obj, gameobjects, components, scene);
134 }
135 }
136
137 LinkingID(gameobjects, scene->GetRoot());
138 LinkingReference(components);
139
140 for (auto gameobj: gameobjects) {
141 SAFE_DELETE(gameobj);
142 }
143
144 for (auto comp: components) {
145 SAFE_DELETE(comp);
146 }
147
148
149 SAFE_DELETE(m_root);
150
151 return scene;
152}