Exemplo n.º 1
0
    void run() {
        foldnodeplot.reset(new PlotPoints());
        env->add(foldnodeplot);
        folddirplot.reset(new PlotLines(3));
        env->add(folddirplot);
        pickplot.reset(new PlotSpheres());
        env->add(pickplot);
        tofoldplot.reset(new PlotPoints());
        env->add(tofoldplot);
        destplot.reset(new PlotPoints());
        env->add(destplot);
        pickedNode = pickedNode2 = NULL;

        setupScene();
        initStandardCloth();

        facepicker.reset(new SoftBodyFacePicker(*this, viewer.getCamera(), cloth->softBody.get()));
        facepicker->setPickCallback(boost::bind(&CustomScene::pickCallback, this, _1));

        addVoidKeyCallback('f', boost::bind(&CustomScene::doFold, this));
        addVoidKeyCallback('g', boost::bind(&CustomScene::doRandomFolds, this, 3));
        addVoidKeyCallback('h', boost::bind(&CustomScene::pickUpAndDrop, this));
        addVoidKeyCallback('s', boost::bind(&CustomScene::saveCloth, this));
        addVoidKeyCallback('l', boost::bind(&CustomScene::loadCloth, this));

        addPreDrawCallback(boost::bind(&CustomScene::markFolds, this));
        addPreDrawCallback(boost::bind(&CustomScene::drawPick, this));
        addPreDrawCallback(boost::bind(&CustomScene::markNodesToFold, this));

        startViewer();
        setSyncTime(false);
        startFixedTimestepLoop(BulletConfig::dt);
    }
Exemplo n.º 2
0
bool Syncer::getLogsAndFiles(QStringList& logs, QStringList& files)
{
    QSqlQuery qry;
    bool finished = setSyncTime();
    QString condition = QString("created_at > '%1' and created_at <= '%2'").arg(formatDateTime(lastSync), formatDateTime(syncTime));

    qry.exec("select table_name, row_op, row_id, user_id, created_at, row_data from logs where "+ condition);
    while (qry.next())
        logs.append(QString("%1,%2,%3,%4,%5|%6").arg(qry.value(0).toString(), qry.value(1).toString(), qry.value(2).toString(), qry.value(3).toString(), qry.value(4).toString(), qry.value(5).toString()));

    // extract new filenames
    qry.exec("select row_id, row_data from logs where table_name = 'files' and "+ condition);
    while (qry.next())
        files.append(QString("%1/files/").arg(dataFolder()) + qry.value(0).toString() +"."+ qry.value(1).toString().mid(1,3));

    return finished;
}