Skip to content

Commit

Permalink
Merge branch 'workshop' of https://github.com/MrKepzie/Natron into wo…
Browse files Browse the repository at this point in the history
…rkshop
  • Loading branch information
MrKepzie committed Oct 8, 2015
2 parents 91754b6 + cb246ff commit 8f2c327
Show file tree
Hide file tree
Showing 15 changed files with 373 additions and 145 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- Nodes group to have cleaner graphs with hidden sub-nodegraphs
- PyPlug: You can export a group as a Python plug-in and it be re-used in any other project as a single node as you would use any other plug-in
- SeExpr integration within a node: http://www.disneyanimation.com/technology/seexpr.html
- New SeNoise and SeGrain nodes based on SeExpr
- RotoPaint node with Wacom tablets support
- DopeSheet editor: This is where you can control easily keyframes and clips in time for motion graphics purposes
- Render statistics: Available in the Render menu, use this to debug complex compositions
Expand Down
2 changes: 1 addition & 1 deletion Engine/DiskCacheNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ DiskCacheNode::addSupportedBitDepth(std::list<Natron::ImageBitDepthEnum>* depths
}

bool
DiskCacheNode::shouldCacheOutput(bool /*isFrameVaryingOrAnimated*/) const
DiskCacheNode::shouldCacheOutput(bool /*isFrameVaryingOrAnimated*/,double /*time*/, int /*view*/) const
{
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion Engine/DiskCacheNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class DiskCacheNode : public Natron::OutputEffectInstance

virtual Natron::StatusEnum render(const RenderActionArgs& args) OVERRIDE WARN_UNUSED_RETURN;

virtual bool shouldCacheOutput(bool isFrameVaryingOrAnimated) const OVERRIDE FINAL WARN_UNUSED_RETURN;
virtual bool shouldCacheOutput(bool isFrameVaryingOrAnimated, double time, int view) const OVERRIDE FINAL WARN_UNUSED_RETURN;

boost::scoped_ptr<DiskCacheNodePrivate> _imp;
};
Expand Down
18 changes: 14 additions & 4 deletions Engine/EffectInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,11 +369,11 @@ EffectInstance::aborted() const
} // EffectInstance::aborted

bool
EffectInstance::shouldCacheOutput(bool isFrameVaryingOrAnimated) const
EffectInstance::shouldCacheOutput(bool isFrameVaryingOrAnimated,double time, int view) const
{
boost::shared_ptr<Node> n = _node.lock();

return n->shouldCacheOutput(isFrameVaryingOrAnimated);
return n->shouldCacheOutput(isFrameVaryingOrAnimated, time ,view);
}

U64
Expand Down Expand Up @@ -880,7 +880,7 @@ EffectInstance::getImage(int inputNb,
getPreferredDepthAndComponents(inputNb, &prefComps, &prefDepth);
assert(!prefComps.empty());

inputImg = convertPlanesFormatsIfNeeded(getApp(), inputImg, pixelRoI, prefComps.front(), prefDepth, getNode()->usesAlpha0ToConvertFromRGBToRGBA(), outputPremult);
inputImg = convertPlanesFormatsIfNeeded(getApp(), inputImg, pixelRoI, prefComps.front(), prefDepth, getNode()->usesAlpha0ToConvertFromRGBToRGBA(), outputPremult, channelForMask);

if (inputImagesThreadLocal.empty()) {
///If the effect is analysis (e.g: Tracker) there's no input images in the tread local storage, hence add it
Expand Down Expand Up @@ -4209,7 +4209,17 @@ EffectInstance::abortAnyEvaluation()
assert(node);
node->incrementKnobsAge();
std::list<Natron::OutputEffectInstance*> outputNodes;
node->hasOutputNodesConnected(&outputNodes);

NodeGroup* isGroup = dynamic_cast<NodeGroup*>(this);
if (isGroup) {
std::list<Node*> inputOutputs;
isGroup->getInputsOutputs(&inputOutputs);
for (std::list<Node*>::iterator it = inputOutputs.begin(); it!=inputOutputs.end();++it) {
(*it)->hasOutputNodesConnected(&outputNodes);
}
} else {
node->hasOutputNodesConnected(&outputNodes);
}
for (std::list<Natron::OutputEffectInstance*>::const_iterator it = outputNodes.begin(); it != outputNodes.end(); ++it) {
ViewerInstance* isViewer = dynamic_cast<ViewerInstance*>(*it);
if (isViewer) {
Expand Down
5 changes: 3 additions & 2 deletions Engine/EffectInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,7 @@ class EffectInstance
const bool dontUpscale,
RectI* roiPixel) WARN_UNUSED_RETURN;
virtual void aboutToRestoreDefaultValues() OVERRIDE FINAL;
virtual bool shouldCacheOutput(bool isFrameVaryingOrAnimated) const;
virtual bool shouldCacheOutput(bool isFrameVaryingOrAnimated, double time, int view) const;

/**
* @brief Can be derived to get the region that the plugin is capable of filling.
Expand Down Expand Up @@ -1684,7 +1684,8 @@ class EffectInstance
const ImageComponents& targetComponents,
ImageBitDepthEnum targetDepth,
bool useAlpha0ForRGBToRGBAConversion,
ImagePremultiplicationEnum outputPremult);
ImagePremultiplicationEnum outputPremult,
int channelForAlpha);


/**
Expand Down
13 changes: 7 additions & 6 deletions Engine/EffectInstanceRenderRoI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,8 @@ EffectInstance::convertPlanesFormatsIfNeeded(const AppInstance* app,
const ImageComponents& targetComponents,
ImageBitDepthEnum targetDepth,
bool useAlpha0ForRGBToRGBAConversion,
ImagePremultiplicationEnum outputPremult)
ImagePremultiplicationEnum outputPremult,
int channelForAlpha)
{
bool imageConversionNeeded = targetComponents.getNumComponents() != inputImage->getComponents().getNumComponents() || targetDepth != inputImage->getBitDepth();
if (!imageConversionNeeded) {
Expand All @@ -216,12 +217,12 @@ EffectInstance::convertPlanesFormatsIfNeeded(const AppInstance* app,
inputImage->convertToFormatAlpha0( clippedRoi,
app->getDefaultColorSpaceForBitDepth(inputImage->getBitDepth()),
app->getDefaultColorSpaceForBitDepth(targetDepth),
-1, false, unPremultIfNeeded, tmp.get() );
channelForAlpha, false, unPremultIfNeeded, tmp.get() );
} else {
inputImage->convertToFormat( clippedRoi,
app->getDefaultColorSpaceForBitDepth(inputImage->getBitDepth()),
app->getDefaultColorSpaceForBitDepth(targetDepth),
-1, false, unPremultIfNeeded, tmp.get() );
channelForAlpha, false, unPremultIfNeeded, tmp.get() );
}

return tmp;
Expand Down Expand Up @@ -576,7 +577,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args,
premult = eImagePremultiplicationOpaque;
}

ImagePtr tmp = convertPlanesFormatsIfNeeded(app, *it, args.roi, *compIt, inputArgs.bitdepth, useAlpha0ForRGBToRGBAConversion, premult);
ImagePtr tmp = convertPlanesFormatsIfNeeded(app, *it, args.roi, *compIt, inputArgs.bitdepth, useAlpha0ForRGBToRGBAConversion, premult, -1);
assert(tmp);
convertedPlanes.push_back(tmp);
}
Expand Down Expand Up @@ -678,7 +679,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args,
bool draftModeSupported = getNode()->isDraftModeUsed();

bool isFrameVaryingOrAnimated = isFrameVaryingOrAnimated_Recursive();
bool createInCache = shouldCacheOutput(isFrameVaryingOrAnimated);
bool createInCache = shouldCacheOutput(isFrameVaryingOrAnimated, args.time, args.view);
Natron::ImageKey key(getNode().get(),
nodeHash,
isFrameVaryingOrAnimated,
Expand Down Expand Up @@ -1536,7 +1537,7 @@ EffectInstance::renderRoI(const RenderRoIArgs & args,
}

///The image might need to be converted to fit the original requested format
it->second.downscaleImage = convertPlanesFormatsIfNeeded(getApp(), it->second.downscaleImage, roi, it->first, args.bitdepth, useAlpha0ForRGBToRGBAConversion, planesToRender.outputPremult);
it->second.downscaleImage = convertPlanesFormatsIfNeeded(getApp(), it->second.downscaleImage, roi, it->first, args.bitdepth, useAlpha0ForRGBToRGBAConversion, planesToRender.outputPremult, -1);

assert(it->second.downscaleImage->getComponents() == it->first && it->second.downscaleImage->getBitDepth() == args.bitdepth);
outputPlanes->push_back(it->second.downscaleImage);
Expand Down
7 changes: 7 additions & 0 deletions Engine/Knob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3692,6 +3692,13 @@ KnobHolder::onDoEndChangesOnMainThreadTriggered()
endChanges();
}

ChangesList
KnobHolder::getKnobChanges() const
{
QMutexLocker l(&_imp->evaluationBlockedMutex);
return _imp->knobChanged;
}

void
KnobHolder::endChanges(bool discardEverything)
{
Expand Down
2 changes: 2 additions & 0 deletions Engine/Knob.h
Original file line number Diff line number Diff line change
Expand Up @@ -2074,6 +2074,8 @@ class KnobHolder : public QObject
**/
void beginChanges();
void endChanges(bool discardEverything = false);

ChangesList getKnobChanges() const;

/**
* @brief The virtual portion of notifyProjectBeginValuesChanged(). This is called by the project
Expand Down
Loading

0 comments on commit 8f2c327

Please sign in to comment.