Menu

kOfxImageEffectPropContext /SupportedContexts

Help
fab
2007-09-25
2012-09-15
  • fab

    fab - 2007-09-25

    Hello,

    I have a little problem with the C++ plugins examples that use the support library.

    When the plugin describes itself to the host, it uses :
    desc.addSupportedContext(eContextFilter);
    This function declares the property kOfxImageEffectPropSupportedContexts with kOfxImageEffectContextFilter.
    But in the action createInstance, the plugin requires the property kOfxImageEffectPropContext which is not defined.

    The action kOfxActionCreateInstance in the C++ support library is :
    else if(action == kOfxActionCreateInstance) {
    checkMainHandles(actionRaw, handleRaw, inArgsRaw, outArgsRaw, false, true, true);

    // fetch the effect props to figure the context
    PropertySet effectProps = fetchEffectProps(handle);
    
    // get the context and turn it into an enum
    std::string str = effectProps.propGetString(kOfxImageEffectPropContext); //<<<<
    ContextEnum context = mapToContextEnum(str);
    
    // make the image effect instance for this context
    ImageEffect *instance = OFX::Plugin::createInstance(handle, context);
    
    // validate the plugin handle's properties
    OFX::Validation::validatePluginInstanceProperties(fetchEffectProps(handle));
    
    // got here, must be good
    stat = kOfxStatOK;
    

    }

    Does the host add this property in the OfxImageEffect ? This property is already set in inArgs.

    Best regards

     
    • Bruno Nicoletti

      Bruno Nicoletti - 2008-06-30

      Hi Fab,

      stage 1 - kOfxActionDescribe
      In this call the plugin states which contexts it can work in...
      eg: plugin says it can be a filter, a generator and a general plugin

      stage 2 - kOfxImageEffectActionDescribeInContext
      This is called once for each of the contexts set in stage 1 that the host supports.
      eg: our host only support generator and filter contexts, so describe in context is called once for each of these and not for the general plugin

      stage 3 - kOfxActionCreateInstance
      At some point a user selects our plugin to be used, and it needs to be made in a single context. The plugin is told what context to make the instance for.
      eg: the user of our applications selects an image and say to apply the plug-in as a filter to it, so create instance will be called. The instance handle will already have a set of properties on it, one of these is the context that the plug-in was created for.

      b

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.