void AbstractAnimation::findSceneManager() { NodeSet::Ptr roots = NodeSet::create(targets()) ->roots() ->where([](NodePtr node) { return node->hasComponent<SceneManager>(); }); if (roots->nodes().size() > 1) throw std::logic_error("Renderer cannot be in two separate scenes."); else if (roots->nodes().size() == 1) setSceneManager(roots->nodes()[0]->component<SceneManager>()); else setSceneManager(nullptr); }
static std::shared_ptr<Node> getWrapper(NodeSet::Ptr nodeSet, int index) { return nodeSet->nodes().at(index - 1); }