Example #1
0
int main( int argc, char **argv )
{
    KApplication a( argc, argv );
    KTopLevelWidget ktw;
    QWidget qw;
    QTimer t_toggle, t_color, t_look;
    //KLed l(KLed::red, &qw);				// create lamp
    //KLed l(KLed::blue, &qw);				// create lamp
    KLed l(KLed::green, &qw);				// create lamp
    //KLed l(KLed::yellow, &qw);				// create lamp
    //KLed l(KLed::orange, &qw);				// create lamp
    l.resize(16,30);
    //l.setLook(KLed::flat);
    l.setLook(KLed::round);
    //l.setLook(KLed::sunken);
    //    l.flat = TRUE;
    ktmp tmpobj(&l);
    
    t_toggle.start(1000, FALSE);
    t_color.start(3500, FALSE);
    t_look.start(10000, FALSE);
    QObject::connect(&t_toggle, SIGNAL(timeout()), &l, SLOT(toggle()));
    QObject::connect(&t_color, SIGNAL(timeout()), &tmpobj, SLOT(nextColor()));
    QObject::connect(&t_look, SIGNAL(timeout()), &tmpobj, SLOT(nextLook()));


    a.setMainWidget( &qw );
    ktw.setView(&qw);
    qw.show();					// show widget
    return a.exec();				// go
}
Example #2
0
bool AbcWriteJob::checkInstance(MDagPath dag, MayaTransformWriterPtr iParent)
{
    MFnDagNode fnDagNode(dag.node());
    if (fnDagNode.isInstanced(false))
    {
        MDagPathArray paths;
        fnDagNode.getAllPaths(paths);
        if (!(mCurDag == paths[0]))
        {
            MStringArray pathparts;
            paths[0].fullPathName().split('|', pathparts);
            Alembic::Abc::OObject rootobj = mRoot.getTop();
            Alembic::Abc::OObject tmpobj(rootobj);
            std::string tmpstring;
            unsigned partscount = pathparts.length();
            for (unsigned i(0); i < partscount; i++)
            {
                tmpstring = pathparts[i].asChar();
                tmpobj = tmpobj.getChild(tmpstring);

                // for selections of non-root objects, the first parts of a dag will not be a child of mRoot
                // traverse hierarchy until valid matching child is found, break loop only if each part of dag is invalid
                if (!tmpobj.valid())
                {
                    if (i == (partscount - 1))
                        break;
                    tmpobj = rootobj;
                }
            }
            if (tmpobj.valid())
            {
                iParent->getObject().addChildInstance(tmpobj, fnDagNode.name().asChar());
                return true;
            }
        }
    }
    return false;
}