osg fbx 模型树结构

 

void Test::printOsgGroup(osg::ref_ptr<osg::Group> &groupParam)
{
    qDebug() <<groupParam->getNumChildren();
    //std::cout << groupParam->getNumChildren() << std::endl;
    for (int k = 0; k<groupParam->getNumChildren(); k++)
    {
        osg::ref_ptr<osg::Group> group_index = groupParam->getChild(k)->asGroup();
        if (group_index->getNumChildren()>1)
        {
            printOsgGroup(group_index);
        }
        //转换编
        //std::string name = w2m1(m2w1(groupParam->getChild(k)->getName(), CP_UTF8));
        //std::cout << k << "=" << name << std::endl;
        qDebug() <<QString::fromStdString(groupParam->getChild(k)->getName());
        QString item1 = QString::fromStdString(groupParam->getChild(k)->getName());
        QStandardItem* itemProject = new QStandardItem(item1);
        qStandardItemModel->appendRow(itemProject);
        //qStandardItemModel->setItem(qStandardItemModel->indexFromItem(itemProject).row(), 1, new QStandardItem(QStringLiteral("项目信息说明")));
        //sg->getChild(k)->setNodeMask(1);
        //std::cout << k << "  " << sg->getChild(k)->getName() << "  " << sg->getNodeMask() << std::endl;
    }
}

 

QStandardItemModel* Test::showTreeView()
{
    qStandardItemModel = new QStandardItemModel(this->tesla_manage_ui.treeView);
    qStandardItemModel->setHorizontalHeaderLabels(QStringList() << QStringLiteral("名称") << QStringLiteral("信息"));

    return qStandardItemModel;
}

 

posted @ 2019-07-14 10:18  西北逍遥  阅读(603)  评论(0编辑  收藏  举报