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 25, 2015
2 parents 8612609 + bc2de0a commit add008b
Show file tree
Hide file tree
Showing 84 changed files with 5,465 additions and 112 deletions.
2 changes: 1 addition & 1 deletion Engine/AppInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ AppInstance::createNodeInternal(const QString & pluginID,
Natron::removeFileExtension(moduleName);
setGroupLabelIDAndVersion(node, modulePath, moduleName);
}
} else if (!requestedByLoad && !_imp->_creatingGroup) {
} else if (!requestedByLoad && !_imp->_creatingGroup && userEdited) {
//if the node is a group and we're not loading the project, create one input and one output
NodePtr input,output;

Expand Down
1 change: 1 addition & 0 deletions Engine/Cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "Global/MemoryInfo.h"
GCC_DIAG_OFF(deprecated)
#include <QtCore/QMutex>
#include <QtCore/QThread>
#include <QtCore/QWaitCondition>
#include <QtCore/QMutexLocker>
#include <QtCore/QObject>
Expand Down
13 changes: 13 additions & 0 deletions Engine/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,12 @@ Settings::initializeKnobsNodeGraph()
_usePluginIconsInNodeGraph->setAnimationEnabled(false);
_nodegraphTab->addKnob(_usePluginIconsInNodeGraph);

_useAntiAliasing = Natron::createKnob<KnobBool>(this, "Anti-Aliasing");
_useAntiAliasing->setHintToolTip("When checked, the node graph will be painted using anti-aliasing. Unchecking it may increase performances."
" Changing this requires a restart of Natron");
_useAntiAliasing->setAnimationEnabled(false);
_nodegraphTab->addKnob(_useAntiAliasing);


_defaultNodeColor = Natron::createKnob<KnobColor>(this, "Default node color",3);
_defaultNodeColor->setName("defaultNodeColor");
Expand Down Expand Up @@ -1370,6 +1376,7 @@ Settings::setDefaultValues()
setCachingLabels();
_autoTurbo->setDefaultValue(false);
_usePluginIconsInNodeGraph->setDefaultValue(true);
_useAntiAliasing->setDefaultValue(false);
_defaultNodeColor->setDefaultValue(0.7,0);
_defaultNodeColor->setDefaultValue(0.7,1);
_defaultNodeColor->setDefaultValue(0.7,2);
Expand Down Expand Up @@ -3076,6 +3083,12 @@ Settings::isPluginIconActivatedOnNodeGraph() const

}

bool
Settings::isNodeGraphAntiAliasingEnabled() const
{
return _useAntiAliasing->getValue();
}

void
Settings::getSunkenColor(double* r,double* g,double* b) const
{
Expand Down
3 changes: 3 additions & 0 deletions Engine/Settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,8 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON

bool isPluginIconActivatedOnNodeGraph() const;

bool isNodeGraphAntiAliasingEnabled() const;

void getSunkenColor(double* r,double* g,double* b) const;
void getBaseColor(double* r,double* g,double* b) const;
void getRaisedColor(double* r,double* g,double* b) const;
Expand Down Expand Up @@ -456,6 +458,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON
boost::shared_ptr<KnobBool> _hideOptionalInputsAutomatically;
boost::shared_ptr<KnobBool> _useInputAForMergeAutoConnect;
boost::shared_ptr<KnobBool> _usePluginIconsInNodeGraph;
boost::shared_ptr<KnobBool> _useAntiAliasing;
boost::shared_ptr<KnobColor> _defaultNodeColor;
boost::shared_ptr<KnobColor> _defaultBackdropColor;
boost::shared_ptr<KnobColor> _defaultGeneratorColor;
Expand Down
2 changes: 1 addition & 1 deletion Global/GitVersion.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef NATRON_GITVERSION_H_
#define NATRON_GITVERSION_H_
#define GIT_BRANCH "workshop"
#define GIT_COMMIT "1f3d6cc37991806edea42c1050af52bb8ee4203f"
#define GIT_COMMIT "73b487d9735c583a5312c8f9dd087d1ffedc3f26"
#endif
43 changes: 24 additions & 19 deletions Gui/AddKnobDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1428,10 +1428,12 @@ AddKnobDialog::onOkClicked()
///If the knob was in a group, we need to place it at the same index
int oldIndexInGroup = -1;

std::string oldKnobScriptName;
std::vector<std::pair<std::string,bool> > expressions;
std::map<boost::shared_ptr<KnobI>,std::vector<std::pair<std::string,bool> > > listenersExpressions;

if (_imp->knob) {
oldKnobScriptName = _imp->knob->getName();

oldParentPage = _imp->knob->getTopLevelPage();
index = getChoiceIndexFromKnobType(_imp->knob.get());
Expand Down Expand Up @@ -1525,33 +1527,36 @@ AddKnobDialog::onOkClicked()
_imp->knob->clone(_imp->originalKnobSerialization->getKnob().get());
}
//Recover expressions
if (!expressions.empty()) {
try {
for (std::size_t i = 0 ; i < expressions.size(); ++i) {
if (!expressions[i].first.empty()) {
_imp->knob->setExpression(i, expressions[i].first, expressions[i].second);
}
try {
for (std::size_t i = 0 ; i < expressions.size(); ++i) {
if (!expressions[i].first.empty()) {
_imp->knob->setExpression(i, expressions[i].first, expressions[i].second);
}
} catch (...) {

}
} catch (...) {

}


//Recover listeners expressions
if (!listenersExpressions.empty()) {

for (std::map<boost::shared_ptr<KnobI>,std::vector<std::pair<std::string,bool> > >::iterator it = listenersExpressions.begin();
it != listenersExpressions.end(); ++it) {
assert(it->first->getDimension() == (int)it->second.size());
for (int i = 0; i < it->first->getDimension(); ++i) {
try {
it->first->setExpression(i, it->second[i].first, it->second[i].second);
} catch (...) {

for (std::map<boost::shared_ptr<KnobI>,std::vector<std::pair<std::string,bool> > >::iterator it = listenersExpressions.begin();it != listenersExpressions.end(); ++it) {
assert(it->first->getDimension() == (int)it->second.size());
for (int i = 0; i < it->first->getDimension(); ++i) {
try {
std::string expr;
if (oldKnobScriptName != _imp->knob->getName()) {
//Change in expressions the script-name
QString estr(it->second[i].first.c_str());
estr.replace(oldKnobScriptName.c_str(), _imp->knob->getName().c_str());
expr = estr.toStdString();
} else {
expr = it->second[i].first;
}
it->first->setExpression(i, expr, it->second[i].second);
} catch (...) {

}
}

}
}

Expand Down
8 changes: 7 additions & 1 deletion Gui/BackDropGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ CLANG_DIAG_ON(uninitialized)
#include "Engine/KnobTypes.h"
#include "Engine/Node.h"
#include "Engine/BackDrop.h"
#include "Engine/Settings.h"

#include "Gui/GuiApplicationManager.h"
#include "Gui/KnobGuiString.h"
#include "Gui/NodeGraphTextItem.h"

Expand Down Expand Up @@ -166,7 +168,11 @@ BackDropGuiPrivate::refreshLabelText(int nameHeight,const QString &text)
QColor color;
if (!text.isEmpty()) {
KnobGuiString::parseFont(textLabel, &f, &color);
f.setStyleStrategy(QFont::NoAntialias);

bool antialias = appPTR->getCurrentSettings()->isNodeGraphAntiAliasingEnabled();
if (!antialias) {
f.setStyleStrategy(QFont::NoAntialias);
}
label->setFont(f);
}

Expand Down
14 changes: 13 additions & 1 deletion Gui/Edge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,10 @@ EdgePrivate::initLabel()
txt.setRgbF(Natron::clamp(r,0.,1.),Natron::clamp(g,0.,1.), Natron::clamp(b,0.,1.));
label->setBrush(txt);
QFont f = qApp->font();
f.setStyleStrategy(QFont::NoAntialias);
bool antialias = appPTR->getCurrentSettings()->isNodeGraphAntiAliasingEnabled();
if (!antialias) {
f.setStyleStrategy(QFont::NoAntialias);
}
label->setFont(f);
//_imp->label->setDefaultTextColor( QColor(200,200,200) );
}
Expand Down Expand Up @@ -702,6 +705,11 @@ Edge::paint(QPainter *painter,
const QStyleOptionGraphicsItem * /*options*/,
QWidget * /*parent*/)
{
bool antialias = appPTR->getCurrentSettings()->isNodeGraphAntiAliasingEnabled();
if (!antialias) {
painter->setRenderHint(QPainter::Antialiasing, false);
}

QPen myPen = pen();

boost::shared_ptr<NodeGui> dst = _imp->dest.lock();
Expand Down Expand Up @@ -875,6 +883,10 @@ LinkArrow::paint(QPainter *painter,
const QStyleOptionGraphicsItem* /*options*/,
QWidget* /*parent*/)
{
bool antialias = appPTR->getCurrentSettings()->isNodeGraphAntiAliasingEnabled();
if (!antialias) {
painter->setRenderHint(QPainter::Antialiasing, false);
}
QPen myPen = pen();

myPen.setColor(_renderColor);
Expand Down
7 changes: 1 addition & 6 deletions Gui/Gui.h
Original file line number Diff line number Diff line change
Expand Up @@ -606,9 +606,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON

void setLastKeyPressVisitedClickFocus(bool visited);

#ifdef __NATRON_WIN32__
void setApplicationConsoleActionVisible(bool visible);
#endif

Q_SIGNALS:

Expand Down Expand Up @@ -737,12 +735,9 @@ public Q_SLOTS:
void onRenderProgressDialogFinished();

void onFocusChanged(QWidget* old, QWidget*);

#ifdef __NATRON_WIN32__

void onShowApplicationConsoleActionTriggered();

#endif


private:

Expand Down
15 changes: 11 additions & 4 deletions Gui/Gui10.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,26 +360,33 @@ Gui::updateLastPluginDirectory(const QString & str)
_imp->_lastPluginDir = str;
}

#ifdef __NATRON_WIN32__

void
Gui::onShowApplicationConsoleActionTriggered()
{

setApplicationConsoleActionVisible(!_imp->applicationConsoleVisible);
}

void
Gui::setApplicationConsoleActionVisible(bool visible)
{
#ifdef __NATRON_WIN32__
if (visible == _imp->applicationConsoleVisible) {
return;
}
_imp->applicationConsoleVisible = visible;
HWND hWnd = GetConsoleWindow();
if (hWnd) {
ShowWindow(hWnd, _imp->applicationConsoleVisible ? SW_SHOW : SW_HIDE );
if (_imp->applicationConsoleVisible) {
ShowWindow(hWnd, SW_HIDE);
} else {
ShowWindow(hWnd, SW_SHOWNORMAL);
}

}

}
#else
Q_UNUSED(visible)
#endif
}

2 changes: 0 additions & 2 deletions Gui/GuiPrivate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,7 @@ GuiPrivate::GuiPrivate(GuiAppInstance* app,
, currentPanelFocusEventRecursion(0)
, keyPressEventHasVisitedFocusWidget(false)
, wasLaskUserSeekDuringPlayback(false)
#ifdef __NATRON_WIN32__
, applicationConsoleVisible(true)
#endif
{
}

Expand Down
2 changes: 0 additions & 2 deletions Gui/GuiPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,7 @@ struct GuiPrivate

bool wasLaskUserSeekDuringPlayback;

#ifdef __NATRON_WIN32__
bool applicationConsoleVisible;
#endif

GuiPrivate(GuiAppInstance* app,
Gui* gui);
Expand Down
9 changes: 5 additions & 4 deletions Gui/KnobGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,7 @@ KnobGui::createAnimationMenu(QMenu* menu,int dimension)
} // if (isAppKnob)
} // createAnimationMenu

void
boost::shared_ptr<KnobI>
KnobGui::createDuplicateOnNode(Natron::EffectInstance* effect,bool linkExpression)
{
///find-out to which node that master knob belongs to
Expand All @@ -624,7 +624,7 @@ KnobGui::createDuplicateOnNode(Natron::EffectInstance* effect,bool linkExpressio
"Continue anyway ?").toStdString(),false,
Natron::StandardButtons(Natron::eStandardButtonOk | Natron::eStandardButtonCancel));
if (rep != Natron::eStandardButtonYes) {
return;
return boost::shared_ptr<KnobI>();
}
}
}
Expand All @@ -633,7 +633,7 @@ KnobGui::createDuplicateOnNode(Natron::EffectInstance* effect,bool linkExpressio
EffectInstance* isEffect = dynamic_cast<EffectInstance*>(holder);
assert(isEffect);
if (!isEffect) {
return;
return boost::shared_ptr<KnobI>();
}

KnobBool* isBool = dynamic_cast<KnobBool*>(knob.get());
Expand Down Expand Up @@ -739,7 +739,7 @@ KnobGui::createDuplicateOnNode(Natron::EffectInstance* effect,bool linkExpressio
output = newKnob;
}
if (!output) {
return;
return boost::shared_ptr<KnobI>();
}

output->cloneDefaultValues(knob.get());
Expand Down Expand Up @@ -784,4 +784,5 @@ KnobGui::createDuplicateOnNode(Natron::EffectInstance* effect,bool linkExpressio
}
effect->refreshKnobs();
holder->getApp()->triggerAutoSave();
return output;
}
2 changes: 1 addition & 1 deletion Gui/KnobGui.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ GCC_DIAG_SUGGEST_OVERRIDE_ON
**/
bool isSecretRecursive() const;

void createDuplicateOnNode(Natron::EffectInstance* effect,bool linkExpression);
boost::shared_ptr<KnobI> createDuplicateOnNode(Natron::EffectInstance* effect,bool linkExpression);


static bool shouldSliderBeVisible(int sliderMin, int sliderMax)
Expand Down
6 changes: 1 addition & 5 deletions Gui/LineEdit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,7 @@ void
LineEdit::keyPressEvent(QKeyEvent* e)
{
QLineEdit::keyPressEvent(e);
if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) {
///Return and enter emit editingFinished() in parent implementation but do not accept the shortcut either
e->accept();
return;
} else if (e->matches(QKeySequence::Paste)) {
if (e->matches(QKeySequence::Paste)) {
Q_EMIT textPasted();
}
}
Loading

0 comments on commit add008b

Please sign in to comment.