Beispiel #1
0
 virtual bool run(void* objectPtr, osg::Parameters& inputParameters, osg::Parameters&) const
 {
     osgUI::Widget* widget = reinterpret_cast<osgUI::Widget*>(objectPtr);
     osgGA::EventVisitor* ev = (inputParameters.size()>=1) ? dynamic_cast<osgGA::EventVisitor*>(inputParameters[0].get()) : 0;
     osgGA::Event* event = (inputParameters.size()>=2) ? dynamic_cast<osgGA::Event*>(inputParameters[1].get()) : 0;
     if (!widget || !ev || !event) return false;
     widget->handleImplementation(ev, event);
     return true;
 }
Beispiel #2
0
 virtual bool run(void* objectPtr, osg::Parameters& inputParameters, osg::Parameters&) const
 {
     osgUI::Widget* widget = reinterpret_cast<osgUI::Widget*>(objectPtr);
     osg::NodeVisitor* nv = (inputParameters.size()>=1) ? dynamic_cast<osg::NodeVisitor*>(inputParameters[0].get()) : 0;
     if (!nv) return false;
     widget->traverse(*nv);
     return true;
 }
    virtual bool run(void* objectPtr, osg::Parameters& inputParameters, osg::Parameters& outputParameters) const
    {
        if (inputParameters.size()<2) return false;

        unsigned int index = 0;
        osg::ValueObject* indexObject = inputParameters[0]->asValueObject();
        if (indexObject) indexObject->getScalarValue(index);

        osg::Drawable* child = dynamic_cast<osg::Drawable*>(inputParameters[1].get());
        if (!child) return false;

        osg::Geode* geode = reinterpret_cast<osg::Geode*>(objectPtr);
        geode->setDrawable(index, child);

        return true;
    }
Beispiel #4
0
    virtual bool run(void* objectPtr, osg::Parameters& inputParameters, osg::Parameters& outputParameters) const
    {
        if (inputParameters.size()<2) return false;

        osg::Object* indexObject = inputParameters[0].get();

        unsigned int index = 0;
        osg::DoubleValueObject* dvo = dynamic_cast<osg::DoubleValueObject*>(indexObject);
        if (dvo) index = static_cast<unsigned int>(dvo->getValue());
        else
        {
            osg::UIntValueObject* uivo = dynamic_cast<osg::UIntValueObject*>(indexObject);
            if (uivo) index = uivo->getValue();
        }

        bool enabled = false;
        osg::Object* valueObject = inputParameters[1].get();
        if (!valueObject) return false;

        dvo = dynamic_cast<osg::DoubleValueObject*>(valueObject);
        if (dvo)
        {
            enabled = dvo->getValue()!=0.0;
        }
        else
        {
            osg::UIntValueObject* uivo = dynamic_cast<osg::UIntValueObject*>(valueObject);
            if (uivo)
            {
                enabled = uivo->getValue()!=0;
            }
            else
            {
                osg::BoolValueObject* bo = dynamic_cast<osg::BoolValueObject*>(valueObject);
                if (bo)
                {
                    enabled = bo->getValue();
                }
            }
        }

        osg::Switch* sw = reinterpret_cast<osg::Switch*>(objectPtr);
        sw->setValue(index, enabled);

        return true;
    }
    virtual bool run(void* objectPtr, osg::Parameters& inputParameters, osg::Parameters& outputParameters) const
    {
        if (inputParameters.size()<2) return false;

        unsigned int index = 0;
        osg::ValueObject* indexObject = inputParameters[0]->asValueObject();
        if (indexObject) indexObject->getScalarValue(index);

        bool enabled = false;
        osg::ValueObject* valueObject = inputParameters[1]->asValueObject();
        if (valueObject) valueObject->getScalarValue(enabled);

        osg::Switch* sw = reinterpret_cast<osg::Switch*>(objectPtr);
        sw->setValue(index, enabled);

        return true;
    }
Beispiel #6
0
    virtual bool run(void* objectPtr, osg::Parameters& inputParameters, osg::Parameters& outputParameters) const
    {
        if (inputParameters.size()<2) return false;

        osg::Object* indexObject = inputParameters[0].get();
        OSG_NOTICE<<"GeodeSetChild "<<indexObject->className()<<std::endl;

        unsigned int index = 0;
        osg::DoubleValueObject* dvo = dynamic_cast<osg::DoubleValueObject*>(indexObject);
        if (dvo) index = static_cast<unsigned int>(dvo->getValue());
        else
        {
            osg::UIntValueObject* uivo = dynamic_cast<osg::UIntValueObject*>(indexObject);
            if (uivo) index = uivo->getValue();
        }

        osg::Drawable* child = dynamic_cast<osg::Drawable*>(inputParameters[1].get());
        if (!child) return false;

        osg::Geode* geode = reinterpret_cast<osg::Geode*>(objectPtr);
        geode->setDrawable(index, child);

        return true;
    }