Skip to content

Commit

Permalink
Revert "Merge branch 'distortion'"
Browse files Browse the repository at this point in the history
This reverts commit 5fd6a5c, reversing
changes made to 55f4281.
  • Loading branch information
devernay committed Jan 10, 2017
1 parent 5fd6a5c commit e1c8ac4
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 268 deletions.
9 changes: 1 addition & 8 deletions HostSupport/include/ofxhClip.h
Expand Up @@ -107,17 +107,10 @@ namespace OFX {
bool supportsTiles() const;

#ifdef OFX_EXTENSIONS_NUKE
/// can a matrix be attached to images on this clip
// This is deprecated but maintained for compat with older plug-ins.
// canDistort should be preferred for newer plug-ins.
/// can a kFnOfxPropMatrix2D be attached to images on this clip
bool canTransform() const;
#endif

#ifdef OFX_EXTENSIONS_NATRON
// can a distorsion be attached to images on this clip
bool canDistort() const;
#endif

/// get property set, const version
const Property::Set &getProps() const;

Expand Down
27 changes: 1 addition & 26 deletions HostSupport/include/ofxhImageEffect.h
Expand Up @@ -42,10 +42,6 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "ofxhMemory.h"
#include "ofxhInteract.h"

#ifdef OFX_EXTENSIONS_NATRON
#include "ofxNatron.h"
#endif

#ifdef _MSC_VER
//Use visual studio extension
#define __PRETTY_FUNCTION__ __FUNCSIG__
Expand Down Expand Up @@ -272,8 +268,6 @@ namespace OFX {

#ifdef OFX_EXTENSIONS_NUKE
/// does this effect handle transform effects
// This is deprecated but maintained for compat with older plug-ins.
// canDistort should be preferred for newer plug-ins.
bool canTransform() const;

/// Indicates that a host or plugin can fetch more than a type of image from a clip
Expand Down Expand Up @@ -303,10 +297,6 @@ namespace OFX {
#endif

#ifdef OFX_EXTENSIONS_NATRON

/// does this effect handle distorsion effects
bool canDistort() const;

/// is this effect deprecated
bool isDeprecated() const;

Expand Down Expand Up @@ -760,8 +750,6 @@ namespace OFX {
);

#ifdef OFX_EXTENSIONS_NUKE
// This is deprecated but maintained for compat with older plug-ins.
// getDistorsionAction should be preferred for newer plug-ins.
virtual OfxStatus getTransformAction(OfxTime time,
const std::string& field,
OfxPointD renderScale,
Expand All @@ -770,23 +758,10 @@ namespace OFX {
double transform[9]);
#endif

#ifdef OFX_EXTENSIONS_NATRON
virtual OfxStatus getDistorsionAction(OfxTime time,
const std::string& field,
OfxPointD renderScale,
int view,
std::string& clip,
double transform[9],
OfxDistorsionFunctionV1* distorsionFunc,
void** distorsionFunctionData,
int* distorsionFunctionDataSize,
OfxDistorsionFreeDataFunctionV1* freeDataFunction);
#endif

/// Call the region of definition action the plugin at the given time
/// and with the given render scales. The value is returned in rod.
/// Note that if the plugin does not trap the action the default
/// RoD is calculated and returned.
/// RoD is calculated and returned.
virtual OfxStatus getRegionOfDefinitionAction(OfxTime time,
OfxPointD renderScale,
#ifdef OFX_EXTENSIONS_NUKE
Expand Down
23 changes: 4 additions & 19 deletions HostSupport/src/ofxhClip.cpp
Expand Up @@ -75,10 +75,7 @@ namespace OFX {
{ kOfxImageClipPropFieldExtraction, Property::eString, 1, false, kOfxImageFieldDoubled },
{ kOfxImageEffectPropSupportsTiles, Property::eInt, 1, false, "1" },
#ifdef OFX_EXTENSIONS_NUKE
{ kFnOfxImageEffectCanTransform, Property::eInt, 1, false, "0" }, // can a matrix be attached to images on this clip
#endif
#ifdef OFX_EXTENSIONS_NATRON
{ kOfxImageEffectPropCanDistort, Property::eInt, 1, false, "0" }, // can a distorsion be attached to images on this clip
{ kFnOfxImageEffectCanTransform, Property::eInt, 1, false, "0" }, // can a kFnOfxPropMatrix2D be attached to images on this clip
#endif
Property::propSpecEnd,
};
Expand Down Expand Up @@ -195,27 +192,19 @@ namespace OFX {
}

#ifdef OFX_EXTENSIONS_NUKE
/// can a matrix be attached to images on this clip
/// can a kFnOfxPropMatrix2D be attached to images on this clip
bool ClipBase::canTransform() const
{
return _properties.getIntProperty(kFnOfxImageEffectCanTransform) != 0;
}
#endif

#ifdef OFX_EXTENSIONS_NATRON
/// can a distorsion be attached to images on this clip
bool ClipBase::canDistort() const
{
return _properties.getIntProperty(kOfxImageEffectPropCanDistort) != 0;
}
#endif

const Property::Set& ClipBase::getProps() const
{
return _properties;
}

Property::Set& ClipBase::getProps()
Property::Set& ClipBase::getProps()
{
return _properties;
}
Expand Down Expand Up @@ -663,11 +652,7 @@ namespace OFX {
{ kOfxImagePropField, Property::eString, 1, true, "", },
{ kOfxImagePropUniqueIdentifier, Property::eString, 1, true, "" },
#ifdef OFX_EXTENSIONS_NUKE
{ kFnOfxPropMatrix2D, Property::eDouble, 9, true, "0" }, // If the clip descriptor has kFnOfxImageEffectCanTransform set to 1, this property contains a 3x3 matrix corresponding to a transform, going from the source image to the destination, defaults to the identity matrix. A matrix filled with zeroes is considered as the identity matrix (i.e. no transform).
#endif
#ifdef OFX_EXTENSIONS_NATRON
{ kOfxPropDistorsionFunction, Property::ePointer, 1, true, NULL }, // If the clip descriptor has kOfxImageEffectPropCanDistort set to 1, this property contains a pointer to a distorsion function going from the source image to the destination that should be applied on any pixel. If the effect that called clipGetImage on the clip is also kOfxImageEffectPropCanDistort set to 1, it's distorsion function is already concatenated in the function pointed to by this property and does not need to be applied after this distorsion function.
{ kOfxPropDistorsionFunctionData, Property::ePointer, 1, true, NULL }, // if kOfxPropDistorsionFunction is set, this a pointer to the data that must be passed to the distorsion function
{ kFnOfxPropMatrix2D, Property::eDouble, 9, true, "0" }, // If the clip descriptor has kFnOfxImageEffectCanTransform set to 1, this property contains a 3x3 matrix corresponding to a transform in pixel coordinate space, going from the source image to the destination, defaults to the identity matrix. A matrix filled with zeroes is considered as the identity matrix (i.e. no transform)
#endif
Property::propSpecEnd
};
Expand Down
79 changes: 0 additions & 79 deletions HostSupport/src/ofxhImageEffect.cpp
Expand Up @@ -145,7 +145,6 @@ namespace OFX {
{ kNatronOfxImageEffectPropInViewerContextShortcutHasAltModifier, Property::eInt, 0, true, "" },
{ kNatronOfxImageEffectPropInViewerContextShortcutHasMetaModifier, Property::eInt, 0, true, "" },
{ kNatronOfxPropNativeOverlays, Property::eString, 0, false, ""},
{ kOfxImageEffectPropCanDistort, Property::eInt, 1, false, "0" },
#endif
Property::propSpecEnd
};
Expand Down Expand Up @@ -382,12 +381,6 @@ namespace OFX {
#endif

#ifdef OFX_EXTENSIONS_NATRON

bool Base::canDistort() const
{
return _properties.getIntProperty(kOfxImageEffectPropCanDistort) != 0;
}

/// does this effect handle transform effects
bool Base::isDeprecated() const
{
Expand Down Expand Up @@ -1562,77 +1555,6 @@ namespace OFX {
}
#endif // OFX_EXTENSIONS_NUKE

#ifdef OFX_EXTENSIONS_NATRON
OfxStatus Instance::getDistorsionAction(OfxTime time,
const std::string& field,
OfxPointD renderScale,
int view,
std::string& clip,
double transform[9],
OfxDistorsionFunctionV1* distorsionFunc,
void** distorsionFunctionData,
int* distorsionFunctionDataSize,
OfxDistorsionFreeDataFunctionV1* freeDataFunction)
{
if (time != time) {
// time is NaN
return kOfxStatFailed;
}
static const Property::PropSpec inStuff[] = {
{ kOfxPropTime, Property::eDouble, 1, true, "0" },
{ kOfxImageEffectPropFieldToRender, Property::eString, 1, true, "" },
{ kOfxImageEffectPropRenderScale, Property::eDouble, 2, true, "0" },
{ kFnOfxImageEffectPropView, Property::eInt, 1, true, "0" },
Property::propSpecEnd
};

static const Property::PropSpec outStuff[] = {
{ kOfxPropName, Property::eString, 1, false, "" },
{ kOfxPropMatrix3x3, Property::eDouble, 9, false, "0.0" },
{ kOfxPropDistorsionFunction, Property::ePointer, 1, false, NULL },
{ kOfxPropDistorsionFunctionData, Property::ePointer, 1, false, NULL },
{ kOfxPropDistorsionFunctionDataSize, Property::eInt, 1, false, "0" },
{ kOfxPropDistorsionFreeDataFunction, Property::ePointer, 1, false, NULL },
Property::propSpecEnd
};

Property::Set inArgs(inStuff);
Property::Set outArgs(outStuff);

inArgs.setStringProperty(kOfxImageEffectPropFieldToRender,field);
inArgs.setDoubleProperty(kOfxPropTime,time);
inArgs.setDoublePropertyN(kOfxImageEffectPropRenderScale, &renderScale.x, 2);
inArgs.setIntProperty(kFnOfxImageEffectPropView, view);
for(std::map<std::string, ClipInstance*>::iterator it=_clips.begin();
it!=_clips.end();
++it) {
it->second->setView(view);
}

# ifdef OFX_DEBUG_ACTIONS
OfxPlugin *ofxp = _plugin->getPluginHandle()->getOfxPlugin();
const char* id = ofxp->pluginIdentifier;
std::cout << "OFX: "<<id<<"("<<(void*)ofxp<<")->"<<kOfxImageEffectActionGetDistorsion<<"("<<time<<","<<field<<",("<<renderScale.x<<","<<renderScale.y<<"),"<<view<<")"<<std::endl;
# endif

OfxStatus st = mainEntry(kOfxImageEffectActionGetDistorsion,this->getHandle(), &inArgs, &outArgs);
# ifdef OFX_DEBUG_ACTIONS
std::cout << "OFX: "<<id<<"("<<(void*)ofxp<<")->"<<kOfxImageEffectActionGetDistorsion<<"("<<time<<","<<field<<",("<<renderScale.x<<","<<renderScale.y<<"),"<<view<<")->"<<StatStr(st)<<std::endl;
# endif

if (st == kOfxStatOK) {
clip = outArgs.getStringProperty(kOfxPropName);
outArgs.getDoublePropertyN(kOfxPropMatrix3x3, transform, 9);
*distorsionFunc = (OfxDistorsionFunctionV1)outArgs.getPointerProperty(kOfxPropDistorsionFunction);
*distorsionFunctionData = outArgs.getPointerProperty(kOfxPropDistorsionFunctionData);
*distorsionFunctionDataSize = outArgs.getIntProperty(kOfxPropDistorsionFunctionDataSize);
*freeDataFunction = (OfxDistorsionFreeDataFunctionV1)outArgs.getPointerProperty(kOfxPropDistorsionFreeDataFunction);
}

return st;
}
#endif // OFX_EXTENSIONS_NATRON

/// calculate the default rod for this effect instance
OfxRectD Instance::calcDefaultRegionOfDefinition(OfxTime time,
OfxPointD /*renderScale*/
Expand Down Expand Up @@ -4133,7 +4055,6 @@ namespace OFX {
{ kNatronOfxPropDescriptionIsMarkdown, Property::eInt, 1, true, "0" },
{ kNatronOfxImageEffectPropDefaultCursors, Property::eString, 0, true, "" },
{ kNatronOfxPropNativeOverlays, Property::eString, 0, true, ""},
{ kOfxImageEffectPropCanDistort, Property::eInt, 1, true, "0" },
# endif
Property::propSpecEnd
};
Expand Down
52 changes: 0 additions & 52 deletions Support/Library/ofxsImageEffect.cpp
Expand Up @@ -747,14 +747,6 @@ namespace OFX {
_clipProps.propSetInt(kOfxImageClipPropIsMask, int(v));
}

#ifdef OFX_EXTENSIONS_NATRON
/** @brief say whether this clip may contain images with a transform attached */
void ClipDescriptor::setCanDistort(bool v)
{
_clipProps.propSetInt(kOfxImageEffectPropCanDistort, int(v), false);
}
#endif

#ifdef OFX_EXTENSIONS_NUKE
/** @brief say whether this clip may contain images with a transform attached */
void ClipDescriptor::setCanTransform(bool v)
Expand Down Expand Up @@ -1321,16 +1313,6 @@ namespace OFX {
}

#ifdef OFX_EXTENSIONS_NATRON

/** @brief indicate that a plugin or host can handle transform effects */
void ImageEffectDescriptor::setCanDistort(bool v)
{
// the header says this property is on the effect instance, but on Nuke it only exists on the effect descriptor
if (gHostDescription.canDistort) {
_effectProps.propSetInt(kOfxImageEffectPropCanDistort, int(v), false);
}
}

/** @brief indicate if the host may add a channel selector */
void ImageEffectDescriptor::setChannelSelector(PixelComponentEnum v)
{
Expand Down Expand Up @@ -1453,12 +1435,6 @@ namespace OFX {

_renderScale.x = _renderScale.y = 1.;
_imageProps.propGetDoubleN(kOfxImageEffectPropRenderScale, &_renderScale.x, 2, false);
#ifdef OFX_EXTENSIONS_NATRON
_distorsionFunction = (OfxDistorsionFunctionV1)_imageProps.propGetPointer(kOfxPropDistorsionFunction, false);
_distorsionFunctionData = _imageProps.propGetPointer(kOfxPropDistorsionFunctionData, false);

#endif

#ifdef OFX_EXTENSIONS_NUKE
std::fill(_transform, _transform + 9, 0.);
if (_imageProps.propGetDimension(kFnOfxPropMatrix2D, false) == 0) {
Expand All @@ -1474,7 +1450,6 @@ namespace OFX {
_transform[0] == _transform[2] && _transform[0] == _transform[8]);
}
#endif

}

ImageBase::~ImageBase()
Expand Down Expand Up @@ -2215,19 +2190,7 @@ namespace OFX {
{
return _effectProps.propGetInt(kOfxImageEffectPropSupportsTiles) != 0;
}
#ifdef OFX_EXTENSIONS_NATRON
void
ImageEffect::setCanDistort(bool v)
{
_effectProps.propSetInt(kOfxImageEffectPropCanDistort, int(v), false);
}

bool
ImageEffect::getCanDistort() const
{
return _effectProps.propGetInt(kOfxImageEffectPropCanDistort, false) != 0;
}
#endif
#ifdef OFX_EXTENSIONS_NUKE
void
ImageEffect::setCanTransform(bool v)
Expand Down Expand Up @@ -2552,21 +2515,6 @@ namespace OFX {
}
#endif

#ifdef OFX_EXTENSIONS_NATRON

/** @brief recover a transform matrix from an effect */
bool ImageEffect::getDistorsion(const DistorsionArguments &/*args*/, Clip * &/*transformClip*/, double /*transformMatrix*/[9],
OfxDistorsionFunctionV1* /*distorsionFunction*/,
void** /*distorsionFunctionData*/,
int* /*distorsionFunctionDataSizeHintInBytes*/,
OfxDistorsionFreeDataFunctionV1* /*freeDataFunction*/)
{
// by default, do the default
return false;
}

#endif

#ifdef OFX_EXTENSIONS_NUKE
void ImageEffect::getClipComponents(const ClipComponentsArguments& /*args*/, ClipComponentsSetter& /*clipComponents*/)
{
Expand Down

0 comments on commit e1c8ac4

Please sign in to comment.