Skip to content

Commit

Permalink
Merge branch 'workshop' into RB-2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
MrKepzie committed Nov 6, 2015
2 parents f24c566 + 12a1a29 commit 2b7e714
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 78 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ addons:
# ubuntu-toolchain-r/test contains recent versions of gcc
- ppa:ubuntu-toolchain-r/test
# get a recent ffmpeg (>=2.5) for precise from ppa:archivematica/externals(2.5.1) or ppa:pavlyshko/precise(2.6.1)
- ppa:pavlyshko/precise
- ppa:archivematica/externals
packages:
- gcc-4.9
- g++-4.9
Expand Down
13 changes: 10 additions & 3 deletions Engine/AppInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -890,21 +890,28 @@ AppInstance::createNodeInternal(const QString & pluginID,
if (addToProject) {
//Add the node to the project before loading it so it is present when the python script that registers a variable of the name
//of the node works
group->addNode(node);
assert(group);
if (group) {
group->addNode(node);
}
}
assert(node);
try {
node->load(multiInstanceParentName, serialization,dontLoadName, userEdited, addToProject, fixedName,paramValues);
} catch (const std::exception & e) {
group->removeNode(node);
if (group) {
group->removeNode(node);
}
std::string title("Error while creating node");
std::string message = title + " " + foundPluginID + ": " + e.what();
qDebug() << message.c_str();
errorDialog(title, message, false);

return boost::shared_ptr<Natron::Node>();
} catch (...) {
group->removeNode(node);
if (group) {
group->removeNode(node);
}
std::string title("Error while creating node");
std::string message = title + " " + foundPluginID;
qDebug() << message.c_str();
Expand Down
5 changes: 3 additions & 2 deletions Engine/OfxParamInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1664,7 +1664,6 @@ OfxDouble2DInstance::OfxDouble2DInstance(OfxEffectInstance* node,
// Only create native overlays if there is no interact or kOfxParamPropUseHostOverlayHandle is set
// see https://github.com/MrKepzie/Natron/issues/932
// only create automatic overlay for kOfxParamDoubleTypeXYAbsolute and kOfxParamDoubleTypeNormalisedXYAbsolute
#pragma message WARN("TODO: check that kOfxParamDoubleTypeNormalisedXYAbsolute overlays are OK")
if ((!_node->effectInstance()->getOverlayInteractMainEntry() &&
(getDoubleType() == kOfxParamDoubleTypeXYAbsolute ||
getDoubleType() == kOfxParamDoubleTypeNormalisedXYAbsolute)) ||
Expand All @@ -1681,7 +1680,9 @@ OfxDouble2DInstance::OfxDouble2DInstance(OfxEffectInstance* node,
dblKnob->setValueIsNormalized(0, KnobDouble::eValueIsNormalizedX);
dblKnob->setValueIsNormalized(1, KnobDouble::eValueIsNormalizedY);
}
dblKnob->setDefaultValuesAreNormalized(coordSystem == kOfxParamCoordinatesNormalised);
dblKnob->setDefaultValuesAreNormalized(coordSystem == kOfxParamCoordinatesNormalised ||
doubleType == kOfxParamDoubleTypeNormalisedXY ||
doubleType == kOfxParamDoubleTypeNormalisedXYAbsolute);
for (int i = 0; i < dims; ++i) {
dblKnob->setDefaultValue(def[i], i);
}
Expand Down
6 changes: 2 additions & 4 deletions Engine/RotoDrawableItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ RotoDrawableItem::rotoKnobChanged(const boost::shared_ptr<KnobI>& knob, Natron::
type = eRotoStrokeTypeSolid;
}

if (reason == Natron::eValueChangedReasonSlaveRefresh) {
if (reason == Natron::eValueChangedReasonSlaveRefresh && knob != _imp->center && knob != _imp->cloneCenter) {
getContext()->s_breakMultiStroke();
}

Expand Down Expand Up @@ -853,9 +853,7 @@ RotoDrawableItem::refreshNodesConnections()
}
} //if (_imp->effectNode && type != eRotoStrokeTypeEraser)

if (connectionChanged) {
getContext()->resetTransformsCenter(type == eRotoStrokeTypeClone || type == eRotoStrokeTypeReveal, true);
}

}

void
Expand Down
45 changes: 2 additions & 43 deletions Engine/RotoStrokeItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,10 +285,6 @@ RotoStrokeItem::isEmpty() const
void
RotoStrokeItem::setStrokeFinished()
{
double time = getContext()->getTimelineCurrentTime();
bool autoKeying = getContext()->isAutoKeyingEnabled();
Point center;
bool centerSet = false;
{
QMutexLocker k(&itemMutex);
_imp->finished = true;
Expand All @@ -300,47 +296,10 @@ RotoStrokeItem::setStrokeFinished()
}
}
_imp->strokeDotPatterns.clear();

///Compute the value of the center knob
center.x = center.y = 0;

int nbPoints = 0;
for (std::list<RotoStrokeItemPrivate::StrokeCurves>::const_iterator it = _imp->strokes.begin();
it!=_imp->strokes.end(); ++it) {
KeyFrameSet xCurve = it->xCurve->getKeyFrames_mt_safe();
KeyFrameSet yCurve = it->yCurve->getKeyFrames_mt_safe();
assert(xCurve.size() == yCurve.size());

KeyFrameSet::iterator xIt = xCurve.begin();
KeyFrameSet::iterator yIt = yCurve.begin();
for (; xIt != xCurve.end(); ++xIt, ++yIt) {
center.x += xIt->getValue();
center.y += yIt->getValue();
}
nbPoints += xCurve.size();
}

centerSet = nbPoints > 0;
if (centerSet) {
center.x /= (double)nbPoints;
center.y /= (double)nbPoints;
}
}
if (centerSet) {


boost::shared_ptr<KnobDouble> centerKnob = getCenterKnob();
if (autoKeying) {
centerKnob->setValueAtTime(time, center.x, 0);
centerKnob->setValueAtTime(time, center.y, 1);
setKeyframeOnAllTransformParameters(time);
} else {
centerKnob->setValue(center.x, 0);
centerKnob->setValue(center.y, 1);
}

}

getContext()->resetTransformCenter();

boost::shared_ptr<Node> effectNode = getEffectNode();
boost::shared_ptr<Node> mergeNode = getMergeNode();
boost::shared_ptr<Node> timeOffsetNode = getTimeOffsetNode();
Expand Down
22 changes: 0 additions & 22 deletions Gui/KnobGuiDouble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ KnobGuiDouble::valueAccordingToType(bool normalize,
}

KnobDouble::ValueIsNormalizedEnum state = _knob.lock()->getValueIsNormalized(dimension);
#if 1
#pragma message WARN("Alex please check that the following is right")
boost::shared_ptr<KnobDouble> knob = _knob.lock();
SequenceTime time = knob->getHolder()->getApp()->getTimeLine()->currentFrame();
if (state != KnobDouble::eValueIsNormalizedNone) {
Expand All @@ -120,26 +118,6 @@ KnobGuiDouble::valueAccordingToType(bool normalize,
knob->denormalize(dimension, time, value);
}
}
#else
// this code is duplicated from KnobDouble::normalize and KnobDouble::denormalize
if (state == KnobDouble::eValueIsNormalizedX) {
Format f;
getKnob()->getHolder()->getApp()->getProject()->getProjectDefaultFormat(&f);
if (normalize) {
*value /= f.width();
} else {
*value *= f.width();
}
} else if (state == KnobDouble::eValueIsNormalizedY) {
Format f;
getKnob()->getHolder()->getApp()->getProject()->getProjectDefaultFormat(&f);
if (normalize) {
*value /= f.height();
} else {
*value *= f.height();
}
}
#endif
}

bool
Expand Down
1 change: 1 addition & 0 deletions Gui/RotoGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3263,6 +3263,7 @@ RotoGui::penUp(double /*time*/,
if (_imp->state == eEventStateBuildingStroke) {
assert(_imp->rotoData->strokeBeingPaint);
_imp->context->getNode()->getApp()->setUserIsPainting(boost::shared_ptr<Node>());
assert(_imp->rotoData->strokeBeingPaint->getParentLayer());
_imp->rotoData->strokeBeingPaint->setStrokeFinished();
if (!_imp->multiStrokeEnabled->isChecked()) {
pushUndoCommand(new AddStrokeUndoCommand(this,_imp->rotoData->strokeBeingPaint));
Expand Down
6 changes: 3 additions & 3 deletions tools/travis/install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then
if [ "$CC" = "$TEST_CC" ]; then sudo add-apt-repository -y ppa:kubuntu-ppa/backports; fi
# we also need a recent ffmpeg for the newest version of the plugin
#if [ "$CC" = "$TEST_CC" ]; then sudo add-apt-repository -y ppa:jon-severinsson/ffmpeg; fi #not available
#if [ "$CC" = "$TEST_CC" ]; then sudo add-apt-repository -y ppa:archivematica/externals; fi #2.5.1
if [ "$CC" = "$TEST_CC" ]; then sudo add-apt-repository -y ppa:pavlyshko/precise; fi #2.6.1
if [ "$CC" = "$TEST_CC" ]; then sudo add-apt-repository -y ppa:archivematica/externals; fi #2.5.1
#if [ "$CC" = "$TEST_CC" ]; then sudo add-apt-repository -y ppa:pavlyshko/precise; fi #2.6.1
sudo apt-get update
sudo apt-get update -qq

Expand All @@ -75,7 +75,7 @@ if [[ ${TRAVIS_OS_NAME} == "linux" ]]; then

# OpenFX
if [ "$CC" = "$TEST_CC" ]; then make -C libs/OpenFX/Examples; fi
if [ "$CC" = "$TEST_CC" ]; then make -C libs/OpenFX/Support/Plugins1; fi
if [ "$CC" = "$TEST_CC" ]; then make -C libs/OpenFX/Support/Plugins; fi
if [ "$CC" = "$TEST_CC" ]; then make -C libs/OpenFX/Support/PropTester; fi
if [ "$CC" = "$TEST_CC" ]; then rm -rf Tests/Plugins; mkdir -p Tests/Plugins/Examples Tests/Plugins/Support Tests/Plugins/IO; fi
if [ "$CC" = "$TEST_CC" ]; then mv libs/OpenFX/Examples/*/*-64-debug/*.ofx.bundle Tests/Plugins/Examples; fi
Expand Down

0 comments on commit 2b7e714

Please sign in to comment.