예제 #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;
 }
예제 #2
0
    virtual bool run(void* objectPtr, osg::Parameters& inputParameters, osg::Parameters& outputParameters) const
    {
        if (inputParameters.empty()) return false;

        osg::Object* indexObject = inputParameters[0].get();
        osg::UIntValueObject* uivo = dynamic_cast<osg::UIntValueObject*>(indexObject);
        if (!uivo) return false;

        osg::Geode* geode = reinterpret_cast<osg::Geode*>(objectPtr);
        outputParameters.push_back(geode->getDrawable(uivo->getValue()));

        return true;
    }
예제 #3
0
    virtual bool run(void* objectPtr, osg::Parameters& inputParameters, osg::Parameters& outputParameters) const
    {
        if (inputParameters.empty()) return false;

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

        osg::Geode* geode = reinterpret_cast<osg::Geode*>(objectPtr);
        outputParameters.push_back(geode->getDrawable(index));

        return true;
    }
예제 #4
0
    virtual bool run(void* objectPtr, osg::Parameters& inputParameters, osg::Parameters& outputParameters) const
    {
        if (inputParameters.empty()) return false;

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

        osg::Switch* sw = reinterpret_cast<osg::Switch*>(objectPtr);
        outputParameters.push_back(new osg::BoolValueObject("return", sw->getValue(index)));

        return true;
    }
예제 #5
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;
 }
예제 #6
0
    virtual bool run(void* objectPtr, osg::Parameters& inputParameters, osg::Parameters& outputParameters) const
    {
        if (inputParameters.empty()) 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();
        }

        osg::Switch* sw = reinterpret_cast<osg::Switch*>(objectPtr);
        outputParameters.push_back(new osg::BoolValueObject("return", sw->getValue(index)));

        return true;
    }
예제 #7
0
    virtual bool run(void* objectPtr, osg::Parameters& inputParameters, osg::Parameters& outputParameters) const
    {
        if (inputParameters.empty()) return false;

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

        osg::Geode* geode = reinterpret_cast<osg::Geode*>(objectPtr);
        geode->addDrawable(child);

        return true;
    }
예제 #8
0
    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;
    }
예제 #9
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;
    }
예제 #10
0
    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;
    }
예제 #11
0
파일: TabWidget.cpp 프로젝트: yueying/osg
    virtual bool run(void* objectPtr, osg::Parameters& inputParameters, osg::Parameters& outputParameters) const
    {
        if (inputParameters.empty()) 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();
        }
        osgUI::TabWidget* cb = reinterpret_cast<osgUI::TabWidget*>(objectPtr);
        cb->currentIndexChangedImplementation(index);

        return true;
    }
예제 #12
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;
    }
예제 #13
0
 virtual bool run(void* objectPtr, osg::Parameters& inputParameters, osg::Parameters& outputParameters) const
 {
     osg::Geode* geode = reinterpret_cast<osg::Geode*>(objectPtr);
     outputParameters.push_back(new osg::UIntValueObject("return", geode->getNumDrawables()));
     return true;
 }
 virtual bool run(osg::Object* object, osg::Parameters& inputParameters, osg::Parameters& outputParameters) const
 {
     inputParameters.insert(inputParameters.begin(), object);
     return _scriptEngine->run(_script.get(), getName(), inputParameters, outputParameters);
 }