::Thyra::ModelEvaluatorBase::OutArgs<ScalarT> createOutArgsImpl() const { ::ThyraModelEvaluatorBase::OutArgsSetup<Scalar> outArgs(this->getUnderlyingModel()->createOutArgs()); if (outArgs.supports( ::Thyra::ModelEvaluatorBase::OUT_ARG_W_op)) return outArgs; outArgs.setSupports( ::Thyra::ModelEvaluatorBase::OUT_ARG_W_op,true); return outArgs; }
/** @brief The main entry for image effect overlays */ OfxStatus interactMainEntry( const char* actionRaw, const void* handleRaw, OfxPropertySetHandle inArgsRaw, OfxPropertySetHandle outArgsRaw, InteractDescriptor& desc ) { OFX::Log::print( "********************************************************************************" ); OFX::Log::print( "START overlayInteractMainEntry (%s)", actionRaw ); OFX::Log::indent(); OfxStatus stat = kOfxStatReplyDefault; try { // Cast the raw handle to be an image effect handle, because that is what it is OfxInteractHandle handle = (OfxInteractHandle) handleRaw; // Turn the arguments into wrapper objects to make our lives easier OFX::PropertySet inArgs( inArgsRaw ); OFX::PropertySet outArgs( outArgsRaw ); // turn the action into a std::string std::string action( actionRaw ); // figure the actions if( action == kOfxActionDescribe ) { OfxPropertySetHandle propHandle; OfxStatus stat = OFX::Private::gInteractSuite->interactGetPropertySet( handle, &propHandle ); throwSuiteStatusException( stat ); PropertySet interactProperties( propHandle ); desc.setPropertySet( &interactProperties ); desc.describe(); } else if( action == kOfxActionCreateInstance ) { // fetch the image effect we are being made for out of the interact's property handle ImageEffect* effect = retrieveEffectFromInteractHandle( handle ); /*OFX::Interact* interact = */ desc.createInstance( handle, effect ); // and all was well stat = kOfxStatOK; } else { stat = interactMainEntry( action, handle, inArgs, outArgs ); } } catch(... ) { stat = kOfxStatFailed; } OFX::Log::outdent(); OFX::Log::print( "STOP overlayInteractMainEntry (%s)", actionRaw ); return stat; }
bool StringAnimationManager::customInterpolation(double time, std::string* ret) const { QMutexLocker l(&_imp->keyframesMutex); assert(_imp->customInterpolation); ///if there's a single keyframe, return it if ( _imp->keyframes.empty() ) { return false; } if (_imp->keyframes.size() == 1) { *ret = _imp->keyframes.begin()->value; return true; } /// get the keyframes surrounding the time Keyframes::const_iterator upper = _imp->keyframes.end(); Keyframes::const_iterator lower = _imp->keyframes.end(); for (Keyframes::const_iterator it = _imp->keyframes.begin(); it != _imp->keyframes.end(); ++it) { if (it->time > time) { upper = it; break; } else if (it->time == time) { ///if there's a keyframe exactly at this time, return its value *ret = it->value; return true; } } if ( upper == _imp->keyframes.end() ) { ///if the time is greater than the time of all keyframes return the last --upper; *ret = upper->value; return true; } else if ( upper == _imp->keyframes.begin() ) { ///if the time is lesser than the time of all keyframes, return the first *ret = upper->value; return true; } else { ///general case, we're in-between 2 keyframes lower = upper; --lower; } OFX::Host::Property::PropSpec inArgsSpec[] = { { kOfxPropName, OFX::Host::Property::eString, 1, true, "" }, { kOfxPropTime, OFX::Host::Property::eDouble, 1, true, "" }, { kOfxParamPropCustomValue, OFX::Host::Property::eString, 2, true, ""}, { kOfxParamPropInterpolationTime, OFX::Host::Property::eDouble, 2, true, "" }, { kOfxParamPropInterpolationAmount, OFX::Host::Property::eDouble, 1, true, "" }, OFX::Host::Property::propSpecEnd }; OFX::Host::Property::Set inArgs(inArgsSpec); inArgs.setStringProperty( kOfxPropName, _imp->knob->getName() ); inArgs.setDoubleProperty(kOfxPropTime, time); inArgs.setStringProperty(kOfxParamPropCustomValue, lower->value, 0); inArgs.setStringProperty(kOfxParamPropCustomValue, upper->value, 1); inArgs.setDoubleProperty(kOfxParamPropInterpolationTime, lower->time, 0); inArgs.setDoubleProperty(kOfxParamPropInterpolationTime, upper->time, 1); inArgs.setDoubleProperty( kOfxParamPropInterpolationAmount, (time - lower->time) / (double)(upper->time - lower->time) ); OFX::Host::Property::PropSpec outArgsSpec[] = { { kOfxParamPropCustomValue, OFX::Host::Property::eString, 1, false, ""}, OFX::Host::Property::propSpecEnd }; OFX::Host::Property::Set outArgs(outArgsSpec); l.unlock(); _imp->customInterpolation( _imp->ofxParamHandle, inArgs.getHandle(), outArgs.getHandle() ); *ret = outArgs.getStringProperty(kOfxParamPropCustomValue, 0).c_str(); return true; } // customInterpolation