Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After Effects and Photoshop plug-in updates #1373

Merged
merged 21 commits into from
Jun 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions vendor/aftereffects/OpenColorIO_AE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ static PF_Err GlobalSetup(
PF_OutFlag2_FLOAT_COLOR_AWARE |
PF_OutFlag2_PPRO_DO_NOT_CLONE_SEQUENCE_DATA_FOR_RENDER |
PF_OutFlag2_SUPPORTS_GET_FLATTENED_SEQUENCE_DATA |
PF_OutFlag2_SUPPORTS_THREADED_RENDERING;
PF_OutFlag2_SUPPORTS_THREADED_RENDERING |
PF_OutFlag2_MUTABLE_RENDER_SEQUENCE_DATA_SLOWER;


GlobalSetup_GL();
Expand Down Expand Up @@ -389,7 +390,7 @@ static PF_Err SequenceResetup(
PF_UNLOCK_HANDLE(in_data->sequence_data);
}
else
assert(FALSE);
err = SequenceSetup(in_data, out_data, params, output); // getting this after pasting the effect

return err;
}
Expand Down
118 changes: 65 additions & 53 deletions vendor/aftereffects/OpenColorIO_AE_Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,15 +336,7 @@ OpenColorIO_AE_Context::OpenColorIO_AE_Context(const std::string &path, OCIO_Sou
{
const char *colorSpaceName = _config->getColorSpaceNameByIndex(i);

OCIO::ConstColorSpaceRcPtr colorSpace = _config->getColorSpace(colorSpaceName);

const char *family = colorSpace->getFamily();

_inputs.push_back(colorSpaceName);

const std::string fullPath = (family == NULL ? colorSpaceName : std::string(family) + "/" + colorSpaceName);

_inputsFullPath.push_back(fullPath);
_colorSpaces.push_back(colorSpaceName);
}


Expand All @@ -359,7 +351,7 @@ OpenColorIO_AE_Context::OpenColorIO_AE_Context(const std::string &path, OCIO_Sou
const char *defaultInputName = (defaultInput ? defaultInput->getName() : OCIO::ROLE_DEFAULT);


setupConvert(defaultInputName, defaultInputName);
setupConvert(defaultInputName, defaultInputName, OCIO_INVERT_OFF);


const char *defaultDisplay = _config->getDefaultDisplay();
Expand All @@ -372,7 +364,7 @@ OpenColorIO_AE_Context::OpenColorIO_AE_Context(const std::string &path, OCIO_Sou
{
_config = OCIO::Config::Create();

setupLUT(false, OCIO_INTERP_LINEAR);
setupLUT(OCIO_INVERT_OFF, OCIO_INTERP_LINEAR);
}
}
else
Expand Down Expand Up @@ -439,15 +431,7 @@ OpenColorIO_AE_Context::OpenColorIO_AE_Context(const ArbitraryData *arb_data, co
{
const char *colorSpaceName = _config->getColorSpaceNameByIndex(i);

OCIO::ConstColorSpaceRcPtr colorSpace = _config->getColorSpace(colorSpaceName);

const char *family = colorSpace->getFamily();

_inputs.push_back(colorSpaceName);

const std::string fullPath = (family == NULL ? colorSpaceName : std::string(family) + "/" + colorSpaceName);

_inputsFullPath.push_back(fullPath);
_colorSpaces.push_back(colorSpaceName);
}


Expand All @@ -458,14 +442,14 @@ OpenColorIO_AE_Context::OpenColorIO_AE_Context(const ArbitraryData *arb_data, co

if(arb_data->action == OCIO_ACTION_CONVERT)
{
setupConvert(arb_data->input, arb_data->output);
setupConvert(arb_data->input, arb_data->output, arb_data->invert);

_display = arb_data->display;
_view = arb_data->view;
}
else
{
setupDisplay(arb_data->input, arb_data->display, arb_data->view);
setupDisplay(arb_data->input, arb_data->display, arb_data->view, arb_data->invert);

_output = arb_data->output;
}
Expand Down Expand Up @@ -550,19 +534,21 @@ bool OpenColorIO_AE_Context::Verify(const ArbitraryData *arb_data, const std::st
{
if(_input != arb_data->input ||
_output != arb_data->output ||
_invert != arb_data->invert ||
force_reset)
{
setupConvert(arb_data->input, arb_data->output);
setupConvert(arb_data->input, arb_data->output, arb_data->invert);
}
}
else if(arb_data->action == OCIO_ACTION_DISPLAY)
{
if(_input != arb_data->input ||
_display != arb_data->display ||
_view != arb_data->view ||
_invert != arb_data->invert ||
force_reset)
{
setupDisplay(arb_data->input, arb_data->display, arb_data->view);
setupDisplay(arb_data->input, arb_data->display, arb_data->view, arb_data->invert);
}
}
else
Expand All @@ -573,29 +559,39 @@ bool OpenColorIO_AE_Context::Verify(const ArbitraryData *arb_data, const std::st
}


void OpenColorIO_AE_Context::setupConvert(const char *input, const char *output)
void OpenColorIO_AE_Context::setupConvert(const char *input, const char *output, OCIO_Invert invert)
{
OCIO::ColorSpaceTransformRcPtr transform = OCIO::ColorSpaceTransform::Create();

transform->setSrc(input);
transform->setDst(output);
transform->setDirection(OCIO::TRANSFORM_DIR_FORWARD);
transform->setDirection(invert == OCIO_INVERT_OFF ? OCIO::TRANSFORM_DIR_FORWARD : OCIO::TRANSFORM_DIR_INVERSE);

_input = input;
_output = output;
_invert = invert;

_processor = _config->getProcessor(transform);

_cpu_processor = _processor->getDefaultCPUProcessor();
_gpu_processor = _processor->getDefaultGPUProcessor();
_processor = _config->getProcessor(transform);

if(invert == OCIO_INVERT_EXACT)
{
_cpu_processor = _processor->getOptimizedCPUProcessor(OCIO::OPTIMIZATION_LOSSLESS);
_gpu_processor = _processor->getOptimizedGPUProcessor(OCIO::OPTIMIZATION_LOSSLESS);
}
else
{
_cpu_processor = _processor->getDefaultCPUProcessor();
_gpu_processor = _processor->getDefaultGPUProcessor();
}

_action = OCIO_ACTION_CONVERT;

UpdateOCIOGLState();
}


void OpenColorIO_AE_Context::setupDisplay(const char *input, const char *display, const char *view)
void OpenColorIO_AE_Context::setupDisplay(const char *input, const char *display, const char *view, OCIO_Invert invert)
{
_views.clear();

Expand All @@ -620,17 +616,27 @@ void OpenColorIO_AE_Context::setupDisplay(const char *input, const char *display
transform->setSrc(input);
transform->setDisplay(display);
transform->setView(view);

transform->setDirection(invert == OCIO_INVERT_OFF ? OCIO::TRANSFORM_DIR_FORWARD : OCIO::TRANSFORM_DIR_INVERSE);

_input = input;
_display = display;
_view = view;
_invert = invert;


_processor = _config->getProcessor(transform);

_cpu_processor = _processor->getDefaultCPUProcessor();
_gpu_processor = _processor->getDefaultGPUProcessor();

if(invert == OCIO_INVERT_EXACT)
{
_cpu_processor = _processor->getOptimizedCPUProcessor(OCIO::OPTIMIZATION_LOSSLESS);
_gpu_processor = _processor->getOptimizedGPUProcessor(OCIO::OPTIMIZATION_LOSSLESS);
}
else
{
_cpu_processor = _processor->getDefaultCPUProcessor();
_gpu_processor = _processor->getDefaultGPUProcessor();
}

_action = OCIO_ACTION_DISPLAY;

UpdateOCIOGLState();
Expand All @@ -652,6 +658,7 @@ void OpenColorIO_AE_Context::setupLUT(OCIO_Invert invert, OCIO_Interp interpolat
transform->setInterpolation(static_cast<OCIO::Interpolation>(interpolation));
transform->setDirection(invert > OCIO_INVERT_OFF ? OCIO::TRANSFORM_DIR_INVERSE : OCIO::TRANSFORM_DIR_FORWARD);


_processor = _config->getProcessor(transform);

if(invert == OCIO_INVERT_EXACT)
Expand All @@ -676,22 +683,22 @@ void OpenColorIO_AE_Context::setupLUT(OCIO_Invert invert, OCIO_Interp interpolat

bool OpenColorIO_AE_Context::ExportLUT(const std::string &path, const std::string &display_icc_path)
{
std::string the_extension = path.substr( path.find_last_of('.') + 1 );
const std::string the_extension = path.substr( path.find_last_of('.') + 1 );

try{

if(the_extension == "icc")
{
int cubesize = 32;
int whitepointtemp = 6505;
std::string copyright = "";
const int cubesize = 32;
const int whitepointtemp = 6505;
const std::string copyright = "";

// create a description tag from the filename
size_t filename_start = path.find_last_of(delimiter) + 1;
size_t filename_end = path.find_last_of('.') - 1;
const size_t filename_start = path.find_last_of(delimiter) + 1;
const size_t filename_end = path.find_last_of('.') - 1;

std::string description = path.substr(path.find_last_of(delimiter) + 1,
1 + filename_end - filename_start);
const std::string description = path.substr(path.find_last_of(delimiter) + 1,
1 + filename_end - filename_start);

SaveICCProfileToFile(path, _cpu_processor, cubesize, whitepointtemp,
display_icc_path, description, copyright, false);
Expand All @@ -700,18 +707,22 @@ bool OpenColorIO_AE_Context::ExportLUT(const std::string &path, const std::strin
{
// this code lovingly pulled from ociobakelut

// need an extension->format map (yes, just did this one call up)
std::map<std::string, std::string> extensions;
std::string format;

for(int i=0; i < OCIO::Baker::getNumFormats(); ++i)
{
const char *extension = OCIO::Baker::getFormatExtensionByIndex(i);
const char *format = OCIO::Baker::getFormatNameByIndex(i);
const char *formatName = OCIO::Baker::getFormatNameByIndex(i);

extensions[ extension ] = format;
if(the_extension == extension)
{
format = formatName;
break;
}
}

std::string format = extensions[ the_extension ];
if(format.empty())
return false;


OCIO::BakerRcPtr baker = OCIO::Baker::Create();
Expand All @@ -721,8 +732,8 @@ bool OpenColorIO_AE_Context::ExportLUT(const std::string &path, const std::strin
if(_action == OCIO_ACTION_CONVERT)
{
baker->setConfig(_config);
baker->setInputSpace(_input.c_str());
baker->setTargetSpace(_output.c_str());
baker->setInputSpace(_invert ? _output.c_str() : _input.c_str());
baker->setTargetSpace(_invert ? _input.c_str() : _output.c_str());

std::ofstream f(path.c_str());
baker->bake(f);
Expand All @@ -732,20 +743,21 @@ bool OpenColorIO_AE_Context::ExportLUT(const std::string &path, const std::strin
OCIO::ConfigRcPtr editableConfig = _config->createEditableCopy();

OCIO::ColorSpaceRcPtr inputColorSpace = OCIO::ColorSpace::Create();
std::string inputspace = "RawInput";
const std::string inputspace = "RawInput";
inputColorSpace->setName(inputspace.c_str());
editableConfig->addColorSpace(inputColorSpace);


OCIO::ColorSpaceRcPtr outputColorSpace = OCIO::ColorSpace::Create();
std::string outputspace = "ProcessedOutput";
const std::string outputspace = "ProcessedOutput";
outputColorSpace->setName(outputspace.c_str());

OCIO::DisplayViewTransformRcPtr transform = OCIO::DisplayViewTransform::Create();

transform->setSrc(_input.c_str());
transform->setDisplay(_display.c_str());
transform->setView(_view.c_str());
transform->setDirection(_invert ? OCIO::TRANSFORM_DIR_INVERSE : OCIO::TRANSFORM_DIR_FORWARD);

outputColorSpace->setTransform(transform, OCIO::COLORSPACE_DIR_FROM_REFERENCE);

Expand All @@ -764,13 +776,13 @@ bool OpenColorIO_AE_Context::ExportLUT(const std::string &path, const std::strin
OCIO::ConfigRcPtr editableConfig = OCIO::Config::Create();

OCIO::ColorSpaceRcPtr inputColorSpace = OCIO::ColorSpace::Create();
std::string inputspace = "RawInput";
const std::string inputspace = "RawInput";
inputColorSpace->setName(inputspace.c_str());
editableConfig->addColorSpace(inputColorSpace);


OCIO::ColorSpaceRcPtr outputColorSpace = OCIO::ColorSpace::Create();
std::string outputspace = "ProcessedOutput";
const std::string outputspace = "ProcessedOutput";
outputColorSpace->setName(outputspace.c_str());

OCIO::FileTransformRcPtr transform = OCIO::FileTransform::Create();
Expand Down
9 changes: 4 additions & 5 deletions vendor/aftereffects/OpenColorIO_AE_Context.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class OpenColorIO_AE_Context

bool Verify(const ArbitraryData *arb_data, const std::string &dir);

void setupConvert(const char *input, const char *output);
void setupDisplay(const char *input, const char *display, const char *view);
void setupConvert(const char *input, const char *output, OCIO_Invert invert);
void setupDisplay(const char *input, const char *display, const char *view, OCIO_Invert invert);
void setupLUT(OCIO_Invert invert, OCIO_Interp interpolation);

typedef std::vector<std::string> SpaceVec;
Expand All @@ -68,7 +68,7 @@ class OpenColorIO_AE_Context
const std::string & getOutput() const { return _output; }
const std::string & getDisplay() const { return _display; }
const std::string & getView() const { return _view; }
const SpaceVec & getInputs(bool fullPath=false) const { return fullPath ? _inputsFullPath : _inputs; }
const SpaceVec & getColorSpaces() const { return _colorSpaces; }
const SpaceVec & getDisplays() const { return _displays; }
const SpaceVec & getViews() const { return _views; }

Expand Down Expand Up @@ -96,8 +96,7 @@ class OpenColorIO_AE_Context
std::string _output;
std::string _display;
std::string _view;
SpaceVec _inputs;
SpaceVec _inputsFullPath;
SpaceVec _colorSpaces;
SpaceVec _displays;
SpaceVec _views;

Expand Down
2 changes: 1 addition & 1 deletion vendor/aftereffects/OpenColorIO_AE_PiPL.r
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ resource 'PiPL' (16000) {
50365504
},
AE_Effect_Global_OutFlags_2 {
142644232
411079688
},
/* [11] */
AE_Effect_Match_Name {
Expand Down
Loading