Skip to content

Commit

Permalink
Merge branch 'multiplane2'
Browse files Browse the repository at this point in the history
  • Loading branch information
devernay committed Jul 3, 2017
2 parents 58afe36 + bea27eb commit 97fe5c2
Show file tree
Hide file tree
Showing 21 changed files with 202 additions and 473 deletions.
2 changes: 2 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
[submodule "openfx"]
path = openfx
url = https://github.com/devernay/openfx.git
branch = multiplane2
[submodule "IOSupport/SequenceParsing"]
path = IOSupport/SequenceParsing
url = https://github.com/MrKepzie/SequenceParsing
[submodule "SupportExt"]
path = SupportExt
url = https://github.com/devernay/openfx-supportext.git
branch = multiplane2
16 changes: 11 additions & 5 deletions IOSupport/GenericReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include <tuttle/ofxReadWrite.h>
#endif
#include <ofxNatron.h>
#include <ofxsMultiPlane.h>

#include "SequenceParsing/SequenceParsing.h"
#ifdef OFX_IO_USING_OCIO
Expand Down Expand Up @@ -1696,11 +1697,16 @@ GenericReaderPlugin::render(const RenderArguments &args)
// if components are custom, remap it to a OFX components with the same number of channels
PixelComponentEnum remappedComponents;

bool isColor;
bool isColor = true;
bool isCustom;
if (it->comps == ePixelComponentCustom) {
std::vector<string> channelNames = mapPixelComponentCustomToLayerChannels(it->rawComps);
isColor = channelNames.size() >= 4 && channelNames[1] == "R" && channelNames[2] == "G" && channelNames[3] == "B";

MultiPlane::ImagePlaneDesc plane, pairedPlane;
MultiPlane::ImagePlaneDesc::mapOFXComponentsTypeStringToPlanes(it->rawComps, &plane, &pairedPlane);
const std::vector<std::string>& channels = plane.getChannels();
if (channels.size() < 3 || (channels[0] != "R" && channels[1] != "G" && channels[2] != "B")) {
isColor = false;
}
isCustom = true;
if (isColor) {
#ifdef OFX_IO_USING_OCIO
Expand All @@ -1722,7 +1728,6 @@ GenericReaderPlugin::render(const RenderArguments &args)
remappedComponents = ePixelComponentAlpha;
}
} else {
isColor = true;
isCustom = false;
#ifdef OFX_IO_USING_OCIO
isOCIOIdentity = _ocio->isIdentity(args.time);
Expand Down Expand Up @@ -2439,7 +2444,8 @@ GenericReaderPlugin::purgeCaches()
bool
GenericReaderPlugin::isIdentity(const IsIdentityArguments &args,
Clip * &identityClip,
double &identityTime)
double &identityTime
, int& /*view*/, std::string& /*plane*/)
{
if ( !kSupportsRenderScale && ( (args.renderScale.x != 1.) || (args.renderScale.y != 1.) ) ) {
throwSuiteStatusException(kOfxStatFailed);
Expand Down
2 changes: 1 addition & 1 deletion IOSupport/GenericReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ class GenericReaderPlugin
virtual void changedParam(const OFX::InstanceChangedArgs &args, const std::string &paramName) OVERRIDE;

/* override is identity */
virtual bool isIdentity(const OFX::IsIdentityArguments &args, OFX::Clip * &identityClip, double &identityTime) OVERRIDE;
virtual bool isIdentity(const OFX::IsIdentityArguments &args, OFX::Clip * &identityClip, double &identityTime, int& view, std::string& plane) OVERRIDE;

/**
* @brief Set the output components and premultiplication state for the input image automatically.
Expand Down
26 changes: 17 additions & 9 deletions IOSupport/GenericWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@ GenericWriterPlugin::checkExtension(const string& ext)
bool
GenericWriterPlugin::isIdentity(const IsIdentityArguments &args,
Clip * & /*identityClip*/,
double & /*identityTime*/)
double & /*identityTime*/
, int& /*view*/, std::string& /*plane*/)
{
if ( !kSupportsRenderScale && ( (args.renderScale.x != 1.) || (args.renderScale.y != 1.) ) ) {
throwSuiteStatusException(kOfxStatFailed);
Expand Down Expand Up @@ -349,9 +350,9 @@ getPixelsComponentsCount(const string& rawComponents,
{
string layer, pairedLayer;

vector<string> channels;
MultiPlane::Utils::extractChannelsFromComponentString(rawComponents, &layer, &pairedLayer, &channels);
switch ( channels.size() ) {
MultiPlane::ImagePlaneDesc plane, pairedPlane;
MultiPlane::ImagePlaneDesc::mapOFXComponentsTypeStringToPlanes(rawComponents, &plane, &pairedPlane);
switch ( plane.getNumComponents() ) {
case 0:
*mappedComponents = ePixelComponentNone;
break;
Expand All @@ -372,7 +373,7 @@ getPixelsComponentsCount(const string& rawComponents,
break;
}

return (int)channels.size();
return (int)plane.getNumComponents();
}

void
Expand Down Expand Up @@ -417,10 +418,13 @@ GenericWriterPlugin::fetchPlaneConvertAndCopy(const string& plane,
if (failIfNoSrcImg) {
stringstream ss;
ss << "Input layer ";
string layerName, pairedLayer;
vector<string> channels;
MultiPlane::Utils::extractChannelsFromComponentString(plane, &layerName, &pairedLayer, &channels);
ss << layerName;
MultiPlane::ImagePlaneDesc planeToFetch;
if (plane == kFnOfxImagePlaneColour) {
planeToFetch = MultiPlane::ImagePlaneDesc::mapNCompsToColorPlane(_inputClip->getPixelComponentCount());
} else {
planeToFetch = MultiPlane::ImagePlaneDesc::mapOFXPlaneStringToPlane(plane);
}
ss << planeToFetch.getPlaneLabel();
ss << " could not be fetched";

setPersistentMessage( Message::eMessageError, "", ss.str() );
Expand Down Expand Up @@ -2113,6 +2117,8 @@ GenericWriterPlugin::changedParam(const InstanceChangedArgs &args,
#ifdef OFX_IO_USING_OCIO
_ocio->changedParam(args, paramName);
#endif

MultiPlaneEffect::changedParam(args, paramName);
} // GenericWriterPlugin::changedParam

void
Expand All @@ -2121,6 +2127,7 @@ GenericWriterPlugin::changedClip(const InstanceChangedArgs &args,
{
// must clear persistent message, or render() is not called by Nuke after an error
clearPersistentMessage();
MultiPlaneEffect::changedClip(args, clipName);
if ( (clipName == kOfxImageEffectSimpleSourceClipName) && _inputClip && (args.reason == eChangeUserEdit) ) {
PreMultiplicationEnum premult = _inputClip->getPreMultiplication();
# ifdef DEBUG
Expand Down Expand Up @@ -2157,6 +2164,7 @@ GenericWriterPlugin::changedClip(const InstanceChangedArgs &args,
void
GenericWriterPlugin::getClipPreferences(ClipPreferencesSetter &clipPreferences)
{
MultiPlaneEffect::getClipPreferences(clipPreferences);
if ( !_outputComponents->getIsSecret() ) {
int index;
_outputComponents->getValue(index);
Expand Down
2 changes: 1 addition & 1 deletion IOSupport/GenericWriter.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class GenericWriterPlugin
virtual void render(const OFX::RenderArguments &args) OVERRIDE FINAL;

/* override is identity */
virtual bool isIdentity(const OFX::IsIdentityArguments &args, OFX::Clip * &identityClip, double &identityTime) OVERRIDE;
virtual bool isIdentity(const OFX::IsIdentityArguments &args, OFX::Clip * &identityClip, double &identityTime, int& view, std::string& plane) OVERRIDE;

/** @brief client begin sequence render function */
virtual void beginSequenceRender(const OFX::BeginSequenceRenderArguments &args) OVERRIDE;
Expand Down
5 changes: 3 additions & 2 deletions OCIO/OCIOCDLTransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class OCIOCDLTransformPlugin
virtual void render(const RenderArguments &args) OVERRIDE FINAL;

/* override is identity */
virtual bool isIdentity(const IsIdentityArguments &args, Clip * &identityClip, double &identityTime) OVERRIDE FINAL;
virtual bool isIdentity(const IsIdentityArguments &args, Clip * &identityClip, double &identityTime, int& view, std::string& plane) OVERRIDE FINAL;

/** @brief the effect is about to be actively edited by a user, called when the first user interface is opened on an instance */
virtual void beginEdit(void) OVERRIDE FINAL;
Expand Down Expand Up @@ -975,7 +975,8 @@ OCIOCDLTransformPlugin::render(const RenderArguments &args)
bool
OCIOCDLTransformPlugin::isIdentity(const IsIdentityArguments &args,
Clip * &identityClip,
double & /*identityTime*/)
double & /*identityTime*/
, int& /*view*/, std::string& /*plane*/)
{
const double time = args.time;
float sop[9];
Expand Down
5 changes: 3 additions & 2 deletions OCIO/OCIOColorSpace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class OCIOColorSpacePlugin
virtual void render(const RenderArguments &args) OVERRIDE FINAL;

/* override is identity */
virtual bool isIdentity(const IsIdentityArguments &args, Clip * &identityClip, double &identityTime) OVERRIDE FINAL;
virtual bool isIdentity(const IsIdentityArguments &args, Clip * &identityClip, double &identityTime, int& view, std::string& plane) OVERRIDE FINAL;

/* override changedParam */
virtual void changedParam(const InstanceChangedArgs &args, const string &paramName) OVERRIDE FINAL;
Expand Down Expand Up @@ -760,7 +760,8 @@ OCIOColorSpacePlugin::render(const RenderArguments &args)
bool
OCIOColorSpacePlugin::isIdentity(const IsIdentityArguments &args,
Clip * &identityClip,
double & /*identityTime*/)
double & /*identityTime*/
, int& /*view*/, std::string& /*plane*/)
{
if ( _ocio->isIdentity(args.time) ) {
identityClip = _srcClip;
Expand Down
3 changes: 2 additions & 1 deletion OCIO/OCIODisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ class OCIODisplayPlugin
/* override is identity */
virtual bool isIdentity(const IsIdentityArguments & /*args*/,
Clip * & /*identityClip*/,
double & /*identityTime*/) OVERRIDE FINAL
double & /*identityTime*/
, int& /*view*/, std::string& /*plane*/) OVERRIDE FINAL
{
return false;
}
Expand Down
5 changes: 3 additions & 2 deletions OCIO/OCIOFileTransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class OCIOFileTransformPlugin
virtual void render(const RenderArguments &args) OVERRIDE FINAL;

/* override is identity */
virtual bool isIdentity(const IsIdentityArguments &args, Clip * &identityClip, double &identityTime) OVERRIDE FINAL;
virtual bool isIdentity(const IsIdentityArguments &args, Clip * &identityClip, double &identityTime, int& view, std::string& plane) OVERRIDE FINAL;

/* override changedParam */
virtual void changedParam(const InstanceChangedArgs &args, const string &paramName) OVERRIDE FINAL;
Expand Down Expand Up @@ -891,7 +891,8 @@ OCIOFileTransformPlugin::render(const RenderArguments &args)
bool
OCIOFileTransformPlugin::isIdentity(const IsIdentityArguments &args,
Clip * &identityClip,
double & /*identityTime*/)
double & /*identityTime*/
, int& /*view*/, std::string& /*plane*/)
{
string file;
_file->getValue(file);
Expand Down
5 changes: 3 additions & 2 deletions OCIO/OCIOLogConvert.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class OCIOLogConvertPlugin
virtual void render(const RenderArguments &args) OVERRIDE FINAL;

/* override is identity */
virtual bool isIdentity(const IsIdentityArguments &args, Clip * &identityClip, double &identityTime) OVERRIDE FINAL;
virtual bool isIdentity(const IsIdentityArguments &args, Clip * &identityClip, double &identityTime, int& view, std::string& plane) OVERRIDE FINAL;

/* override changedParam */
virtual void changedParam(const InstanceChangedArgs &args, const string &paramName) OVERRIDE FINAL;
Expand Down Expand Up @@ -844,7 +844,8 @@ OCIOLogConvertPlugin::render(const RenderArguments &args)
bool
OCIOLogConvertPlugin::isIdentity(const IsIdentityArguments &args,
Clip * &identityClip,
double & /*identityTime*/)
double & /*identityTime*/
, int& /*view*/, std::string& /*plane*/)
{
double mix;
_mix->getValueAtTime(args.time, mix);
Expand Down
5 changes: 3 additions & 2 deletions OCIO/OCIOLookTransform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class OCIOLookTransformPlugin
virtual void render(const RenderArguments &args) OVERRIDE FINAL;

/* override is identity */
virtual bool isIdentity(const IsIdentityArguments &args, Clip * &identityClip, double &identityTime) OVERRIDE FINAL;
virtual bool isIdentity(const IsIdentityArguments &args, Clip * &identityClip, double &identityTime, int& view, std::string& plane) OVERRIDE FINAL;

/* override changedParam */
virtual void changedParam(const InstanceChangedArgs &args, const string &paramName) OVERRIDE FINAL;
Expand Down Expand Up @@ -931,7 +931,8 @@ OCIOLookTransformPlugin::render(const RenderArguments &args)
bool
OCIOLookTransformPlugin::isIdentity(const IsIdentityArguments &args,
Clip * &identityClip,
double & /*identityTime*/)
double & /*identityTime*/
, int& /*view*/, std::string& /*plane*/)
{
if ( _ocio->isIdentity(args.time) ) {
bool singleLook;
Expand Down
5 changes: 3 additions & 2 deletions OIIO/OIIOResize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ class OIIOResizePlugin
virtual void render(const RenderArguments &args) OVERRIDE FINAL;

/* override is identity */
virtual bool isIdentity(const IsIdentityArguments &args, Clip * &identityClip, double &identityTime) OVERRIDE FINAL;
virtual bool isIdentity(const IsIdentityArguments &args, Clip * &identityClip, double &identityTime, int& view, std::string& plane) OVERRIDE FINAL;

/* override changedParam */
virtual void changedParam(const InstanceChangedArgs &args, const string &paramName) OVERRIDE FINAL;
Expand Down Expand Up @@ -502,7 +502,8 @@ OIIOResizePlugin::fillWithBlack(PixelProcessorFilterBase & processor,
bool
OIIOResizePlugin::isIdentity(const IsIdentityArguments &args,
Clip * &identityClip,
double & /*identityTime*/)
double & /*identityTime*/
, int& /*view*/, std::string& /*plane*/)
{
int type_i;
_type->getValue(type_i);
Expand Down
5 changes: 3 additions & 2 deletions OIIO/OIIOText.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class OIIOTextPlugin
virtual void render(const RenderArguments &args) OVERRIDE FINAL;

/* override is identity */
virtual bool isIdentity(const IsIdentityArguments &args, Clip * &identityClip, double &identityTime) OVERRIDE FINAL;
virtual bool isIdentity(const IsIdentityArguments &args, Clip * &identityClip, double &identityTime, int& view, std::string& plane) OVERRIDE FINAL;

/* override changedParam */
virtual void changedParam(const InstanceChangedArgs &args, const string &paramName) OVERRIDE FINAL;
Expand Down Expand Up @@ -474,7 +474,8 @@ OIIOTextPlugin::render(const RenderArguments &args)
bool
OIIOTextPlugin::isIdentity(const IsIdentityArguments &args,
Clip * &identityClip,
double & /*identityTime*/)
double & /*identityTime*/
, int& /*view*/, std::string& /*plane*/)
{
if ( !kSupportsRenderScale && ( (args.renderScale.x != 1.) || (args.renderScale.y != 1.) ) ) {
throwSuiteStatusException(kOfxStatFailed);
Expand Down
Loading

0 comments on commit 97fe5c2

Please sign in to comment.