コード例 #1
0
ファイル: ofxsInteract.cpp プロジェクト: morphimac/TuttleOFX
/** @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;
}
コード例 #2
0
ファイル: ofxsInteract.cpp プロジェクト: MrKepzie/openfx
  /** @brief retrieves the image effect pointer from the interact handle */
  static ImageEffect *retrieveEffectFromInteractHandle(OfxInteractHandle handle)
  {
    // get the properties set on this handle
    OfxPropertySetHandle propHandle;
    OfxStatus stat = OFX::Private::gInteractSuite->interactGetPropertySet(handle, &propHandle);
    throwSuiteStatusException(stat);
    PropertySet interactProperties(propHandle);

    // get the effect handle from this handle
    OfxImageEffectHandle effectHandle = (OfxImageEffectHandle) interactProperties.propGetPointer(kOfxPropEffectInstance);

    // get the effect properties 
    return OFX::Private::retrieveImageEffectPointer(effectHandle);
  }