Example #1
0
/** @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;
}
Example #2
0
  /** @brief ctor */
  Interact::Interact(OfxInteractHandle handle)
    : _interactHandle(handle)
    , _effect(NULL)
  {
    // get the properties set on this handle
    OfxPropertySetHandle propHandle;
    OfxStatus stat = OFX::Private::gInteractSuite->interactGetPropertySet(handle, &propHandle);
    throwSuiteStatusException(stat);
    _interactProperties.propSetHandle(propHandle);

    // set othe instance data on the property handle to point to this interact
    _interactProperties.propSetPointer(kOfxPropInstanceData, (void *)this);

    // get the effect handle from this handle        
    _effect = retrieveEffectFromInteractHandle(handle);
  }