| 924 | } |
| 925 | |
| 926 | void WorldInstance::exportWorld(json& j, std::set<Handle::EntityHandle> skip) |
| 927 | { |
| 928 | // Write initial ZEN for loading the worldmesh later |
| 929 | j["zenfile"] = m_ZenFile; |
| 930 | |
| 931 | // Write Vobs |
| 932 | { |
| 933 | json& jvobs = j["vobs"]; |
| 934 | |
| 935 | size_t num = getComponentAllocator().getNumObtainedElements(); |
| 936 | const auto& ctuple = getComponentDataBundle().m_Data; |
| 937 | |
| 938 | Components::EntityComponent* ents = std::get<Components::EntityComponent*>(ctuple); |
| 939 | Components::LogicComponent* logics = std::get<Components::LogicComponent*>(ctuple); |
| 940 | Components::VisualComponent* visuals = std::get<Components::VisualComponent*>(ctuple); |
| 941 | |
| 942 | // TODO: This could be done in parallel |
| 943 | for (size_t i = 0; i < num; i++) |
| 944 | { |
| 945 | if (skip.find(ents[i].m_ThisEntity) != skip.end()) |
| 946 | continue; |
| 947 | Logic::Controller* logicController = nullptr; |
| 948 | Logic::VisualController* visualController = nullptr; |
| 949 | if (Components::hasComponent<Components::LogicComponent>(ents[i])) |
| 950 | logicController = logics[i].m_pLogicController; |
| 951 | if (Components::hasComponent<Components::VisualComponent>(ents[i])) |
| 952 | visualController = visuals[i].m_pVisualController; |
| 953 | |
| 954 | // Do the actual export |
| 955 | exportControllers(logicController, visualController, jvobs["controllers"][i]); |
| 956 | } |
| 957 | } |
| 958 | } |
| 959 | |
| 960 | Handle::EntityHandle WorldInstance::importSingleVob(const json& j) |
| 961 | { |
no test coverage detected