TuttleOFX  1
SeExprPluginFactory.cpp
Go to the documentation of this file.
00001 #include "SeExprPluginFactory.hpp"
00002 #include "SeExprPlugin.hpp"
00003 #include "SeExprDefinitions.hpp"
00004 #include "ofxsImageEffect.h"
00005 
00006 #include <tuttle/plugin/context/GeneratorPluginFactory.hpp>
00007 
00008 #include <limits>
00009 
00010 namespace tuttle {
00011 namespace plugin {
00012 namespace seExpr {
00013 
00014 static const bool kSupportTiles = false;
00015 
00016 
00017 /**
00018  * @brief Function called to describe the plugin main features.
00019  * @param[in, out] desc Effect descriptor
00020  */
00021 void SeExprPluginFactory::describe( OFX::ImageEffectDescriptor& desc )
00022 {
00023         desc.setLabels(
00024                 "TuttleSeExpr",
00025                 "SeExpr",
00026                 "SeExpr" );
00027         desc.setPluginGrouping( "tuttle/image/generator" );
00028 
00029         desc.setDescription( "SeExpr is a simple expression language that we use to provide"
00030                                                  "artistic control and customization to our core software.\n"
00031                                                  "We use it for procedural geometry synthesis, image synthesis,"
00032                                                  "simulation control, and much more.\n\n"
00033                                                  "language documentation: http://wdas.github.io/SeExpr/doxygen/userdoc.html"
00034                                                  "\n\n"
00035                                                  "projet website: http://www.disneyanimation.com/technology/seexpr.html" );
00036 
00037         // add the supported contexts, only filter at the moment
00038         desc.addSupportedContext( OFX::eContextGenerator );
00039         desc.addSupportedContext( OFX::eContextGeneral );
00040 
00041         // add supported pixel depths
00042         desc.addSupportedBitDepth( OFX::eBitDepthUByte );
00043         desc.addSupportedBitDepth( OFX::eBitDepthUShort );
00044         desc.addSupportedBitDepth( OFX::eBitDepthFloat );
00045 
00046         // plugin flags
00047         desc.setRenderThreadSafety( OFX::eRenderFullySafe );
00048         desc.setHostFrameThreading( false );
00049         desc.setSupportsMultiResolution( true );
00050         desc.setSupportsMultipleClipDepths( true );
00051         desc.setSupportsTiles( kSupportTiles );
00052 }
00053 
00054 /**
00055  * @brief Function called to describe the plugin controls and features.
00056  * @param[in, out]   desc       Effect descriptor
00057  * @param[in]        context    Application context
00058  */
00059 void SeExprPluginFactory::describeInContext( OFX::ImageEffectDescriptor& desc,
00060                                                                                          OFX::EContext context )
00061 {
00062         describeGeneratorParamsInContext( desc, context );
00063 
00064         OFX::ChoiceParamDescriptor* chooseInput = desc.defineChoiceParam( kParamChooseInput );
00065         chooseInput->appendOption( kParamChooseInputCode );
00066         chooseInput->appendOption( kParamChooseInputFile );
00067         chooseInput->setDefault( eParamChooseInputCode );
00068 
00069         OFX::StringParamDescriptor* code = desc.defineStringParam( kParamSeExprCode );
00070         code->setLabel( "SeExpr code" );
00071         code->setHint ( "Write your SeExpr code." );
00072         code->setStringType( OFX::eStringTypeMultiLine );
00073         code->setDefault( "cfbm([10*u,10*v,.5])" );
00074 
00075         OFX::StringParamDescriptor* file = desc.defineStringParam( kTuttlePluginFilename );
00076         file->setLabel( kTuttlePluginFilenameLabel );
00077         file->setHint ( "SeExpr source code file." );
00078         file->setStringType( OFX::eStringTypeFilePath );
00079 
00080         OFX::Double2DParamDescriptor* textureOffset = desc.defineDouble2DParam( kParamTextureOffset );
00081         textureOffset->setLabel( "Texture Offset (u, v)" );
00082         textureOffset->setHint( "Set the u,v offset texture parameters." );
00083         textureOffset->setDisplayRange( -100, -100, 100, 100 );
00084         textureOffset->setDefault( 0.0, 0.0 );
00085 }
00086 
00087 /**
00088  * @brief Function called to create a plugin effect instance
00089  * @param[in] handle  Effect handle
00090  * @param[in] context Application context
00091  * @return  plugin instance
00092  */
00093 OFX::ImageEffect* SeExprPluginFactory::createInstance( OfxImageEffectHandle handle,
00094                                                                                                            OFX::EContext context )
00095 {
00096         return new SeExprPlugin( handle );
00097 }
00098 
00099 }
00100 }
00101 }
00102