MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / cloneExpressions

Method cloneExpressions

Engine/Knob.cpp:4054–4088  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4052} // KnobHelper::refreshListenersAfterValueChange
4053
4054void
4055KnobHelper::cloneExpressions(KnobI* other,
4056 int dimension,
4057 int otherDimension)
4058{
4059 assert( (int)_imp->expressions.size() == getDimension() );
4060 assert( (dimension == otherDimension) || (dimension != -1) );
4061 try {
4062 if (dimension == -1) {
4063 int dims = std::min( getDimension(), other->getDimension() );
4064 for (int i = 0; i < dims; ++i) {
4065 std::string expr = other->getExpression(i);
4066 bool hasRet = other->isExpressionUsingRetVariable(i);
4067 if ( !expr.empty() ) {
4068 setExpression(i, expr, hasRet, false);
4069 cloneExpressionsResults(other, i, i);
4070 }
4071 }
4072 } else {
4073 if (otherDimension == -1) {
4074 otherDimension = dimension;
4075 }
4076 assert( dimension >= 0 && dimension < getDimension() &&
4077 otherDimension >= 0 && otherDimension < other->getDimension() );
4078 std::string expr = other->getExpression(otherDimension);
4079 bool hasRet = other->isExpressionUsingRetVariable(otherDimension);
4080 if ( !expr.empty() ) {
4081 setExpression(dimension, expr, hasRet, false);
4082 cloneExpressionsResults(other, dimension, otherDimension);
4083 }
4084 }
4085 } catch (...) {
4086 ///ignore errors
4087 }
4088}
4089
4090bool
4091KnobHelper::cloneExpressionsAndCheckIfChanged(KnobI* other,

Callers

nothing calls this directly

Calls 6

getDimensionFunction · 0.85
emptyMethod · 0.80
sizeMethod · 0.45
getDimensionMethod · 0.45
getExpressionMethod · 0.45

Tested by

no test coverage detected