MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / tryInitializeOverlayInteracts

Method tryInitializeOverlayInteracts

Engine/OfxEffectInstance.cpp:675–765  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

673}
674
675void
676OfxEffectInstance::tryInitializeOverlayInteracts()
677{
678 assert(_imp->context != eContextNone);
679 if (_imp->overlayInteract) {
680 // already created
681 return;
682 }
683
684 QString pluginID = QString::fromUtf8( getPluginID().c_str() );
685 /*
686 Currently genarts plug-ins do not handle render scale properly for overlays
687 */
688 if ( pluginID.startsWith( QString::fromUtf8("com.genarts.") ) ) {
689 _imp->overlaysCanHandleRenderScale = false;
690 }
691
692 /*create overlay instance if any*/
693 assert(_imp->effect);
694 OfxPluginEntryPoint *overlayEntryPoint = _imp->effect->getOverlayInteractMainEntry();
695 if (overlayEntryPoint) {
696 _imp->overlayInteract.reset( new OfxOverlayInteract(*_imp->effect, 8, true) );
697 double sx, sy;
698 effectInstance()->getRenderScaleRecursive(sx, sy);
699 RenderScale s(sx, sy);
700
701 {
702 ClipsThreadStorageSetter clipSetter(effectInstance(),
703 ViewIdx(0),
704 0);
705
706
707 {
708 SET_CAN_SET_VALUE(true);
709 ///Take the preferences lock so that it cannot be modified throughout the action.
710 QReadLocker preferencesLocker(&_imp->preferencesLock);
711 _imp->overlayInteract->createInstanceAction();
712 }
713 }
714
715 ///Fetch all parameters that are overlay slave
716 std::vector<std::string> slaveParams;
717 _imp->overlayInteract->getSlaveToParam(slaveParams);
718 for (U32 i = 0; i < slaveParams.size(); ++i) {
719 KnobIPtr param;
720 const std::vector<KnobIPtr> & knobs = getKnobs();
721 for (std::vector<KnobIPtr>::const_iterator it = knobs.begin(); it != knobs.end(); ++it) {
722 if ( (*it)->getOriginalName() == slaveParams[i] ) {
723 param = *it;
724 break;
725 }
726 }
727 if (!param) {
728 qDebug() << "OfxEffectInstance::tryInitializeOverlayInteracts(): slaveToParam " << slaveParams[i].c_str() << " not available";
729 } else {
730 addOverlaySlaveParam(param);
731 }
732 }

Callers

nothing calls this directly

Calls 15

getAppFunction · 0.85
ViewIdxClass · 0.70
getNodeFunction · 0.70
getPluginIDFunction · 0.50
resetMethod · 0.45
createInstanceActionMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
redrawAllViewersMethod · 0.45

Tested by

no test coverage detected