Skip to content

Commit

Permalink
fix building without OFX_EXTENSIONS_NATRON
Browse files Browse the repository at this point in the history
  • Loading branch information
devernay committed Jan 11, 2018
1 parent 65b34fd commit cd66143
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
20 changes: 15 additions & 5 deletions ofxsGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@
// Some hosts (e.g. Resolve) may not support normalized defaults (setDefaultCoordinateSystem(eCoordinatesNormalised))
#define kParamDefaultsNormalised "defaultsNormalisedGenerator"

#ifdef OFX_EXTENSIONS_NATRON
#define OFX_COMPONENTS_OK(c) ((c)== ePixelComponentAlpha || (c) == ePixelComponentXY || (c) == ePixelComponentRGB || (c) == ePixelComponentRGBA)
#else
#define OFX_COMPONENTS_OK(c) ((c)== ePixelComponentAlpha || (c) == ePixelComponentRGB || (c) == ePixelComponentRGBA)
#endif


using namespace OFX;

using std::string;
Expand Down Expand Up @@ -70,10 +77,7 @@ GeneratorPlugin::GeneratorPlugin(OfxImageEffectHandle handle,
, _supportsAlpha(false)
{
_dstClip = fetchClip(kOfxImageEffectOutputClipName);
assert( _dstClip && (!_dstClip->isConnected() || _dstClip->getPixelComponents() == ePixelComponentRGBA ||
_dstClip->getPixelComponents() == ePixelComponentRGB ||
_dstClip->getPixelComponents() == ePixelComponentXY ||
_dstClip->getPixelComponents() == ePixelComponentAlpha) );
assert( _dstClip && (!_dstClip->isConnected() || OFX_COMPONENTS_OK(_dstClip->getPixelComponents())) );

_extent = fetchChoiceParam(kParamGeneratorExtent);
_format = fetchChoiceParam(kParamGeneratorFormat);
Expand Down Expand Up @@ -137,9 +141,11 @@ GeneratorPlugin::GeneratorPlugin(OfxImageEffectHandle handle,
case ePixelComponentRGB:
_supportsRGB = supported;
break;
case ePixelComponentXY:
#ifdef OFX_EXTENSIONS_NATRON
case ePixelComponentXY:
_supportsXY = supported;
break;
#endif
case ePixelComponentAlpha:
_supportsAlpha = supported;
break;
Expand Down Expand Up @@ -838,9 +844,11 @@ generatorDescribeInContext(PageParamDescriptor *page,
case ePixelComponentRGB:
supportsRGB = supported;
break;
#ifdef OFX_EXTENSIONS_NATRON
case ePixelComponentXY:
supportsXY = supported;
break;
#endif
case ePixelComponentAlpha:
supportsAlpha = supported;
break;
Expand Down Expand Up @@ -895,12 +903,14 @@ generatorDescribeInContext(PageParamDescriptor *page,
++nOptions;
}
if (supportsXY) {
#ifdef OFX_EXTENSIONS_NATRON
assert(outputComponentsMap[param->getNOptions()] == ePixelComponentXY);
param->appendOption(kParamGeneratorOutputComponentsOptionXY);
if (defaultComponents == ePixelComponentXY) {
defIndex = nOptions;
}
++nOptions;
#endif
}
if (supportsAlpha) {
assert(outputComponentsMap[param->getNOptions()] == ePixelComponentAlpha);
Expand Down
6 changes: 2 additions & 4 deletions ofxsTransform3x3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1337,11 +1337,10 @@ Transform3x3DescribeInContextBegin(ImageEffectDescriptor &desc,

srcClip->addSupportedComponent(ePixelComponentRGBA);
srcClip->addSupportedComponent(ePixelComponentRGB);
srcClip->addSupportedComponent(ePixelComponentXY);
srcClip->addSupportedComponent(ePixelComponentAlpha);
#ifdef OFX_EXTENSIONS_NATRON
srcClip->addSupportedComponent(ePixelComponentXY);
#endif
srcClip->addSupportedComponent(ePixelComponentAlpha);
srcClip->setTemporalClipAccess(false);
srcClip->setSupportsTiles(kSupportsTiles);
srcClip->setIsMask(false);
Expand All @@ -1368,11 +1367,10 @@ Transform3x3DescribeInContextBegin(ImageEffectDescriptor &desc,
ClipDescriptor *dstClip = desc.defineClip(kOfxImageEffectOutputClipName);
dstClip->addSupportedComponent(ePixelComponentRGBA);
dstClip->addSupportedComponent(ePixelComponentRGB);
dstClip->addSupportedComponent(ePixelComponentXY);
dstClip->addSupportedComponent(ePixelComponentAlpha);
#ifdef OFX_EXTENSIONS_NATRON
dstClip->addSupportedComponent(ePixelComponentXY);
#endif
dstClip->addSupportedComponent(ePixelComponentAlpha);
dstClip->setSupportsTiles(kSupportsTiles);


Expand Down

0 comments on commit cd66143

Please sign in to comment.