fix scene tools

This commit is contained in:
Green Sky 2022-03-30 23:01:39 +02:00
parent 3dc66de3bc
commit 15ab73909f

View File

@ -1,5 +1,4 @@
#include "./scene_tools.hpp" #include "./scene_tools.hpp"
#include "mm/components/velocity2d_rotation.hpp"
#include <mm/engine.hpp> #include <mm/engine.hpp>
@ -32,10 +31,11 @@
namespace MM::Services { namespace MM::Services {
bool ImGuiSceneToolsService::enable(Engine& engine, std::vector<UpdateStrategies::TaskInfo>& task_array) { bool ImGuiSceneToolsService::enable(Engine& engine, std::vector<UpdateStrategies::TaskInfo>& task_array) {
if (!engine.tryService<MM::Services::SceneServiceInterface>()) { // enable anyway
LOGIGS("error: no SceneServiceInterface"); //if (!engine.tryService<MM::Services::SceneServiceInterface>()) {
return false; //LOGIGS("error: no SceneServiceInterface");
} //return false;
//}
// setup entity editor defaults // setup entity editor defaults
{ {
@ -102,6 +102,10 @@ namespace MM::Services {
} }
void ImGuiSceneToolsService::renderImGui(Engine& engine) { void ImGuiSceneToolsService::renderImGui(Engine& engine) {
if (engine.tryService<MM::Services::SceneServiceInterface>() == nullptr) {
return; // no scene, nothing to see
}
auto& scene = engine.tryService<MM::Services::SceneServiceInterface>()->getScene(); auto& scene = engine.tryService<MM::Services::SceneServiceInterface>()->getScene();
if (_show_scene_metrics) { if (_show_scene_metrics) {