void getDescendants(spActor actor, std::vector<spActor> &actors) { actors.push_back(actor); spActor child = actor->getFirstChild(); while (child) { getDescendants(child, actors); child = child->getNextSibling(); } //actor->removeChildren(); }
void TreeInspectorPage::init(spActor item) { OX_ASSERT(item); setSize(Vector2(0,0)); _line = new TreeInspectorLine(); _line->setPosition(Vector2(5, 5)); _line->init(this, item); addChild(_line); float y = _line->getHeight() + _line->getY() + 5.0f; if (item->getFirstChild()) { spButton button; if (_parentPage)// && item->getFirstChild() != item->getLastChild()) { button = new Button(); button->setResAnim(_tree->_resSystem->getResAnim("checkbox")); button->setPosition(Vector2(15.0f, y)); button->addEventListener(TouchEvent::CLICK, CLOSURE(this, &TreeInspectorPage::_onMinMaxClick)); addChild(button); } _pages = new Actor(); _pages->setInputEnabled(false); _pages->setX(-15); _pages->setY((float)y); spActor child = item->getFirstChild(); while (child) { if (!child->isName("tree_inspector") && !child->isName("debug_actor")) { spTreeInspectorPage page = new TreeInspectorPage(_tree, this); page->init(child); _pages->addChild(page); } child = child->getNextSibling(); } if (item->getVisible()) { addChild(_pages); if (button) button->setRow(1); } else { if (button) button->setRow(0); } } updateInternalSize(); }