DD::Image::LookupCurves Class Reference

Public Member Functions

 LookupCurves (const CurveDescription *t)
 
unsigned size () const
 
const char * curveName (unsigned index) const
 
double getValue (unsigned index, double x) const
 
void getOuterKeys (unsigned index, SKey &leftKey, SKey &rightKey) const
 
bool hasExpression (unsigned index) const
 
bool isIdentity (unsigned index) const
 
bool isConstant (unsigned index) const
 
double getDerivative (unsigned index, double x) const
 
double getNthDerivative (int n, unsigned index, double x) const
 
double getInverse (unsigned index, double y) const
 
double getInverseGeneral (unsigned index, double y) const
 
double getIntegral (unsigned index, double x1, double x2) const
 
void append (Hash &) const
 
KnobgetKnob () const
 

Friends

class ::LookupCurvesKnob
 

Detailed Description

Provides user-editable lookup curves to a plugin.

Your plugin must include an instance of this object, and must also call LookupCurves_knob() in the knobs() method. The user will then get a mini curve editor in the control panel where they can edit the lookup curves.

This fairly opaque object replaces the array of "Animation" objects that were in the previous Nuke api. This was done to allow more freedom to reimplement the animation editor, and to allow lookup curves that can vary over time.

Although many plugins call evaluate() directly in their engine() method, it is recommended that for maximum speed you should build your own indexed table during _validate() by calling evaluate() at that time to fill it in. For absolute maximum speed, use the append() method to check if the lookup curves have changed since you last filled in your table. A plugin will always have a better idea about the domain, accuracy, and interpolation it needs, so Nuke does not bother even trying to provide an indexed table.

Constructor & Destructor Documentation

LookupCurves::LookupCurves ( const CurveDescription t)

Constructor. T should point to an array of CurveDescriptions; these should be terminated by a sentinel CurveDescriptor with a NULL name pointer.

References DD::Image::CurveDescription::name.

Member Function Documentation

unsigned LookupCurves::size ( ) const

Return how many curves the user can edit. This is defined by the table passed to the constructor. All functions that take an index number can only be called with a number less than this value.

const char * DD::Image::LookupCurves::curveName ( unsigned  index) const
inline

Return the name of the indexed curve, from the table passed to the constructor.

double DD::Image::LookupCurves::getValue ( unsigned  index,
double  x 
) const
inline

Return the value of lookup curve index at the location x.

void DD::Image::LookupCurves::getOuterKeys ( unsigned  index,
SKey &  leftKey,
SKey &  rightKey 
) const
inline

fn const void LookupCurves::getOuterKeys(unsigned index, SKey& leftKey, SKey& rightKey) const Return the first and last keys for the curve

bool DD::Image::LookupCurves::hasExpression ( unsigned  index) const
inline

Does the curve have an expression? (expressions may not be safely evaluated on worker threads)

bool DD::Image::LookupCurves::isIdentity ( unsigned  index) const
inline

Return true if the curve is the identity: evaluate(index,x)==x for all x.

bool DD::Image::LookupCurves::isConstant ( unsigned  index) const
inline

Return true if the curve is constant: evaluate(index,x)==evaluate(index,0) for all x.

double DD::Image::LookupCurves::getDerivative ( unsigned  index,
double  x 
) const
inline

Return the first derivative of the curve at x.

double DD::Image::LookupCurves::getNthDerivative ( int  n,
unsigned  index,
double  x 
) const
inline

Return the n'th derivative of the curve at x. If n is zero this acts like evaluate()

double DD::Image::LookupCurves::getInverse ( unsigned  index,
double  y 
) const
inline

Return x such that evaluate(index,x)==y. This is fairly slow! This is designed to invert color lookup tables. It only works if the derivative is zero or positive everywhere. If the Newton's approximation fails it will do a binary search but it then assumes the answer is between 0 and 1.

double DD::Image::LookupCurves::getInverseGeneral ( unsigned  index,
double  y 
) const
inline

Return x such that evaluate(index,x)==y. This is fairly slow! It is well defined for monotonically increasing/decreasing curves, where the inverse lies within the Root node's frame range.

double DD::Image::LookupCurves::getIntegral ( unsigned  index,
double  x1,
double  x2 
) const
inline

Integrate the curve between x1 and x2.

void LookupCurves::append ( Hash hash) const

Modify the hash to reflect the values of all the lookup curves. This can be used to determine if you need to refill the tables.

References DD::Image::Knob::append().



©2021 The Foundry Visionmongers, Ltd. All Rights Reserved.
www.thefoundry.co.uk