Skip to content

Commit 1c574d9

Browse files
authored
Merge branch 'NatronGitHub:RB-2.6' into patch-2
2 parents 8c0db59 + 8326245 commit 1c574d9

36 files changed

+139
-148
lines changed

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,11 @@ set(QTWIDGETS_INCLUDE_DIRS ${Qt5Widgets_INCLUDE_DIRS})
8383
#for QString(const char*) assumes ASCII strings, we may run into troubles
8484
add_compile_definitions(QT_NO_CAST_FROM_ASCII)
8585

86-
if (NOT MSVC)
86+
if (MSVC)
87+
# Allow __cplusplus to properly reflect the c++ standard version.
88+
add_compile_options(/Zc:__cplusplus)
89+
add_compile_definitions(__STDC_LIMIT_MACROS WIN32_LEAN_AND_MEAN _USE_MATH_DEFINES)
90+
else()
8791
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-prototypes" )
8892
add_compile_options(-Wall -Wextra -Wmissing-declarations -Wno-multichar -Winit-self -Wno-long-long
8993
-Wvla -Wdate-time -Wshift-overflow=2

Engine/AppManager.cpp

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,9 +457,15 @@ AppManager::~AppManager()
457457
QThreadPool::globalInstance()->waitForDone();
458458

459459
///Kill caches now because decreaseNCacheFilesOpened can be called
460-
_imp->_nodeCache->waitForDeleterThread();
461-
_imp->_diskCache->waitForDeleterThread();
462-
_imp->_viewerCache->waitForDeleterThread();
460+
if (_imp->_nodeCache) {
461+
_imp->_nodeCache->waitForDeleterThread();
462+
}
463+
if (_imp->_diskCache) {
464+
_imp->_diskCache->waitForDeleterThread();
465+
}
466+
if (_imp->_viewerCache) {
467+
_imp->_viewerCache->waitForDeleterThread();
468+
}
463469
_imp->_nodeCache.reset();
464470
_imp->_viewerCache.reset();
465471
_imp->_diskCache.reset();

Engine/AppManagerPrivate.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,6 +448,10 @@ template <typename T>
448448
void
449449
saveCache(Cache<T>* cache)
450450
{
451+
if (!cache) {
452+
return;
453+
}
454+
451455
std::string cacheRestoreFilePath = cache->getRestoreFilePath();
452456
FStreamsSupport::ofstream ofile;
453457
FStreamsSupport::open(&ofile, cacheRestoreFilePath);

Engine/CLArgs.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
#include <cassert>
3232
#include <stdexcept>
3333

34+
#ifdef __NATRON_WIN32__
35+
#include <shellapi.h> // CommandLineToArgvW
36+
#endif
37+
3438
#include <QtCore/QCoreApplication>
3539
#include <QtCore/QDebug>
3640
#include <QtCore/QFile>

Engine/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ target_include_directories(NatronEngine
110110
)
111111
target_compile_definitions(NatronEngine
112112
PRIVATE
113-
NATRON_CUSTOM_BUILD_USER_TOKEN=${BUILD_USER_NAME}
113+
NATRON_CUSTOM_BUILD_USER_TOKEN="${BUILD_USER_NAME}"
114114
NATRON_BUILD_NUMBER=0
115115
${XDG_DEFS}
116116
)

Engine/HostOverlaySupport.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
#include <Python.h>
2727
// ***** END PYTHON BLOCK *****
2828

29+
#include <string>
30+
2931
#include "Global/Macros.h"
3032

3133
#include "Engine/EngineFwd.h"

Engine/Knob.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1938,12 +1938,6 @@ class Knob
19381938
ViewSpec view,
19391939
int dimension);
19401940

1941-
/**
1942-
* @brief This is called by the plugin when a set value call would happen during an interact action.
1943-
**/
1944-
void requestSetValueOnUndoStack(const T & value,
1945-
ViewSpec view,
1946-
int dimension);
19471941

19481942
/**
19491943
* @brief Calls setValueAtTime with a reason of eValueChangedReasonNatronInternalEdited.
@@ -2147,8 +2141,6 @@ class Knob
21472141

21482142
void makeKeyFrame(Curve* curve, double time, ViewSpec view, const T& v, KeyFrame* key);
21492143

2150-
void queueSetValue(const T& v, ViewSpec view, int dimension);
2151-
21522144
virtual void clearExpressionsResults(int dimension) OVERRIDE FINAL
21532145
{
21542146
QMutexLocker k(&_valueMutex);

Engine/KnobImpl.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2588,9 +2588,10 @@ Knob<T>::copyValueForTypeAndCheckIfChanged(Knob<OTHERTYPE>* other,
25882588
int dimMin = std::min( getDimension(), other->getDimension() );
25892589
std::vector<OTHERTYPE> v = other->getValueForEachDimension_mt_safe_vector();
25902590
for (int i = 0; i < dimMin; ++i) {
2591-
if (_values[i] != v[i]) {
2592-
_values[i] = v[i];
2593-
_guiValues[i] = v[i];
2591+
const T convertedV = static_cast<T>(v[i]);
2592+
if (_values[i] != convertedV) {
2593+
_values[i] = convertedV;
2594+
_guiValues[i] = convertedV;
25942595
ret = true;
25952596
}
25962597
}

Engine/NodeGroup.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2836,12 +2836,12 @@ NodeCollection::exportGroupToPython(const QString& pluginID,
28362836
WRITE_STATIC_LINE(NATRON_PYPLUG_MAGIC);
28372837
QString descline = QString( QString::fromUtf8(NATRON_PYPLUG_GENERATED "%1 PyPlug exporter version %2.") ).arg( QString::fromUtf8(NATRON_APPLICATION_NAME) ).arg(NATRON_PYPLUG_EXPORTER_VERSION);
28382838
WRITE_STRING(descline);
2839-
WRITE_STATIC_LINE();
2839+
WRITE_STATIC_LINE("");
28402840
QString handWrittenStr = QString::fromUtf8("# Hand-written code should be added in a separate file named %1.py").arg(extModule);
28412841
WRITE_STRING(handWrittenStr);
28422842
WRITE_STATIC_LINE("# See http://natron.readthedocs.org/en/master/devel/groups.html#adding-hand-written-code-callbacks-etc");
28432843
WRITE_STATIC_LINE("# Note that Viewers are never exported");
2844-
WRITE_STATIC_LINE();
2844+
WRITE_STATIC_LINE("");
28452845
WRITE_STATIC_LINE("import " NATRON_ENGINE_PYTHON_MODULE_NAME);
28462846
WRITE_STATIC_LINE("import sys");
28472847
WRITE_STATIC_LINE("");

Engine/NodePrivate.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "Global/Macros.h"
3030

3131
#include "Node.h"
32+
#include "Timer.h" // gettimeofday()
3233

3334
#include <QtCore/QWaitCondition>
3435
#include <QtCore/QReadWriteLock>

Engine/StandardPaths.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737

3838
#include <QtCore/QtGlobal> // for Q_OS_*
3939
#if defined(Q_OS_WIN)
40-
#include <windows.h>
40+
#include <combaseapi.h>
4141
#include <IntShCut.h>
4242
#include <ShlObj.h>
4343
#ifndef CSIDL_MYMUSIC

Engine/Timer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
//----------------------------------------------------------------------------
3636

3737
#if defined(__NATRON_WIN32__) && !defined(__NATRON_MINGW__)
38-
#include <windows.h>
38+
#include <winsock2.h>
3939
#else
4040
#include <sys/time.h>
4141
#endif

Engine/TrackerContext.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ CLANG_DIAG_ON(uninitialized)
4646
#include "Engine/KnobTypes.h"
4747
#include "Engine/Project.h"
4848
#include "Engine/Curve.h"
49+
#include "Engine/Timer.h" // gettimeofday()
4950
#include "Engine/TLSHolder.h"
5051
#include "Engine/Transform.h"
5152
#include "Engine/TrackMarker.h"

Global/Macros.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,9 @@ GCC_ONLY_DIAG_OFF(pragmas) // warning: unknown option after '#pragma GCC diagno
455455
/////////////////////////////////////////////////////////////////////////////////////////////
456456

457457
/* COMPILER() - the compiler being used to build the project */
458+
#ifdef COMPILER
459+
#undef COMPILER
460+
#endif
458461
#define COMPILER(NATRON_FEATURE) (NATRON_COMPILER_ ## NATRON_FEATURE)
459462

460463
/* COMPILER_SUPPORTS() - whether the compiler being used to build the project supports the given feature. */

Global/ProcInfo.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@
3838
#include <string.h> // strdup
3939
#endif
4040

41+
#ifdef __NATRON_WIN32__
42+
#include <shellapi.h> // CommandLineToArgvW
43+
#endif
44+
4145
#include "StrUtils.h"
4246

4347
NATRON_NAMESPACE_ENTER
@@ -499,7 +503,7 @@ ProcInfo::getenv_wrapper(const char *varName)
499503
std::vector<char> buffer;
500504
getenv_s(&requiredSize, 0, 0, varName);
501505
if (requiredSize == 0)
502-
return buffer;
506+
return std::string();
503507
buffer.resize(requiredSize);
504508
getenv_s(&requiredSize, &buffer[0], requiredSize, varName);
505509
// requiredSize includes the terminating null, which we don't want.

Gui/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ target_include_directories(NatronGui
9090
)
9191
target_compile_definitions(NatronGui
9292
PRIVATE
93-
NATRON_CUSTOM_BUILD_USER_TOKEN=${BUILD_USER_NAME}
93+
NATRON_CUSTOM_BUILD_USER_TOKEN="${BUILD_USER_NAME}"
9494
NATRON_BUILD_NUMBER=0
9595
QT_NO_KEYWORDS
9696
)

Gui/FileTypeMainWindow_win.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
#include <stdexcept>
4646

4747
// —— general includes —————————————————————————
48-
#include <windows.h>
48+
#include <Dde.h>
49+
4950
#include <QMessageBox>
5051
#include <QApplication>
5152
#include <QtCore/QDir>

Gui/HostOverlay.cpp

Lines changed: 24 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,18 @@ NATRON_NAMESPACE_ENTER
7777
//
7878
// TODO: This is a bug, there is no reason to not use setValues().
7979
// OpenFX plugins are not affected, because instanceChanged does not pass the dimension information.
80+
namespace {
81+
82+
void nonBlockingSetValues(Natron::KnobDoublePtr& knob, const double x, const double y, const ValueChangedReasonEnum reason) {
83+
knob->setValue(x, ViewSpec::all(), 0, reason, nullptr);
84+
knob->setValue(y, ViewSpec::all(), 1, reason, nullptr);
85+
}
86+
87+
inline void nonBlockingSetValues(Natron::KnobDoublePtr& knob, const OfxPointD& point, const ValueChangedReasonEnum reason) {
88+
nonBlockingSetValues(knob, point.x, point.y, reason);
89+
}
90+
91+
} // namespace
8092

8193

8294
DefaultInteractI::DefaultInteractI(HostOverlay* overlay)
@@ -994,41 +1006,6 @@ PositionInteract::draw(double time,
9941006
glTranslated(direction * shadow.x, -direction * shadow.y, 0);
9951007
glMatrixMode(GL_MODELVIEW); // Modelview should be used on Nuke
9961008

997-
#warning TODO
998-
#if 0
999-
int numKeys = knob->get;
1000-
1001-
if (numKeys > 0) {
1002-
const double darken = 0.5;
1003-
glColor3f(pR * l * darken, pG * l * darken, pB * l * darken);
1004-
1005-
glPointSize(pointSize() * screenPixelRatio);
1006-
glBegin(GL_POINTS);
1007-
for (int i=0; i < numKeys; ++i) {
1008-
double time = p->getKeyTime(i);
1009-
OfxPointD pt;
1010-
p->getValueAtTime(time, pt.x, pt.y);
1011-
glVertex2d(pt.x, pt.y);
1012-
1013-
}
1014-
glEnd();
1015-
glLineWidth(1.5 * screenPixelRatio);
1016-
glBegin(GL_LINE_STRIP);
1017-
double time = p->getKeyTime(0);
1018-
for (int i = 1; i < numKeys; ++i) {
1019-
double timeNext = p->getKeyTime(i);
1020-
for (int j = (i == 1 ? 0 : 1); j <= steps; ++j) {
1021-
double timeStep = time + j * (timeNext - time) / steps;
1022-
OfxPointD pt;
1023-
p->getValueAtTime(timeStep, pt.x, pt.y);
1024-
glVertex2d(pt.x, pt.y);
1025-
}
1026-
time = timeNext;
1027-
}
1028-
glEnd();
1029-
}
1030-
#endif
1031-
10321009
glColor3f(pR * l, pG * l, pB * l);
10331010
glPointSize(pointSize() * screenPixelRatio);
10341011
glBegin(GL_POINTS);
@@ -1750,8 +1727,7 @@ PositionInteract::penMotion(double time,
17501727
EffectInstancePtr holder = _overlay->getNode()->getNode()->getEffectInstance();
17511728
holder->setMultipleParamsEditLevel(KnobHolder::eMultipleParamsEditOnCreateNewCommand);
17521729
// Do not use setValues(x,y) (see note at the top of this file).
1753-
knob->setValue(p[0], ViewSpec::all(), 0, eValueChangedReasonNatronGuiEdited);
1754-
knob->setValue(p[1], ViewSpec::all(), 1, eValueChangedReasonNatronGuiEdited);
1730+
nonBlockingSetValues(knob, p[0], p[1], eValueChangedReasonNatronGuiEdited);
17551731
holder->setMultipleParamsEditLevel(KnobHolder::eMultipleParamsEditOff);
17561732
}
17571733

@@ -2196,20 +2172,17 @@ TransformInteract::penMotion(double time,
21962172
if (centerChanged) {
21972173
KnobDoublePtr knob = _center.lock();
21982174
// Do not use setValues(x,y) (see note at the top of this file).
2199-
knob->setValue(center.x, ViewSpec::all(), 0, eValueChangedReasonNatronGuiEdited);
2200-
knob->setValue(center.y, ViewSpec::all(), 1, eValueChangedReasonNatronGuiEdited);
2175+
nonBlockingSetValues(knob, center, eValueChangedReasonNatronGuiEdited);
22012176
}
22022177
if (translateChanged) {
22032178
KnobDoublePtr knob = _translate.lock();
22042179
// Do not use setValues(x,y) (see note at the top of this file).
2205-
knob->setValue(translate.x, ViewSpec::all(), 0, eValueChangedReasonNatronGuiEdited);
2206-
knob->setValue(translate.y, ViewSpec::all(), 1, eValueChangedReasonNatronGuiEdited);
2180+
nonBlockingSetValues(knob, translate, eValueChangedReasonNatronGuiEdited);
22072181
}
22082182
if (scaleChanged) {
22092183
KnobDoublePtr knob = _scale.lock();
22102184
// Do not use setValues(x,y) (see note at the top of this file).
2211-
knob->setValue(scale.x, ViewSpec::all(), 0, eValueChangedReasonNatronGuiEdited);
2212-
knob->setValue(scale.y, ViewSpec::all(), 1, eValueChangedReasonNatronGuiEdited);
2185+
nonBlockingSetValues(knob, scale, eValueChangedReasonNatronGuiEdited);
22132186
}
22142187
if (rotateChanged) {
22152188
KnobDoublePtr knob = _rotate.lock();
@@ -2330,14 +2303,12 @@ CornerPinInteract::penMotion(double time,
23302303
KnobDoublePtr knob = _from[_dragging].lock();
23312304
assert(knob);
23322305
// Do not use setValues(x,y) (see note at the top of this file).
2333-
knob->setValue(from[_dragging].x, ViewSpec::all(), 0, eValueChangedReasonPluginEdited);
2334-
knob->setValue(from[_dragging].y, ViewSpec::all(), 1, eValueChangedReasonPluginEdited);
2306+
nonBlockingSetValues(knob, from[_dragging], eValueChangedReasonPluginEdited);
23352307
} else {
23362308
KnobDoublePtr knob = _to[_dragging].lock();
23372309
assert(knob);
23382310
// Do not use setValues(x,y) (see note at the top of this file).
2339-
knob->setValue(to[_dragging].x, ViewSpec::all(), 0, eValueChangedReasonPluginEdited);
2340-
knob->setValue(to[_dragging].y, ViewSpec::all(), 1, eValueChangedReasonPluginEdited);
2311+
nonBlockingSetValues(knob, to[_dragging], eValueChangedReasonPluginEdited);
23412312
}
23422313
holder->setMultipleParamsEditLevel(KnobHolder::eMultipleParamsEditOff);
23432314
}
@@ -2403,8 +2374,7 @@ PositionInteract::penUp(double time,
24032374
EffectInstancePtr holder = _overlay->getNode()->getNode()->getEffectInstance();
24042375
holder->setMultipleParamsEditLevel(KnobHolder::eMultipleParamsEditOnCreateNewCommand);
24052376
// Do not use setValues(x,y) (see note at the top of this file).
2406-
knob->setValue(p[0], ViewSpec::all(), 0, eValueChangedReasonNatronGuiEdited);
2407-
knob->setValue(p[1], ViewSpec::all(), 1, eValueChangedReasonNatronGuiEdited);
2377+
nonBlockingSetValues(knob, p[0], p[1], eValueChangedReasonNatronGuiEdited);
24082378
holder->setMultipleParamsEditLevel(KnobHolder::eMultipleParamsEditOff);
24092379
}
24102380

@@ -2441,20 +2411,17 @@ TransformInteract::penUp(double /*time*/,
24412411
{
24422412
KnobDoublePtr knob = _center.lock();
24432413
// Do not use setValues(x,y) (see note at the top of this file).
2444-
knob->setValue(_centerDrag.x, ViewSpec::all(), 0, eValueChangedReasonPluginEdited);
2445-
knob->setValue(_centerDrag.y, ViewSpec::all(), 1, eValueChangedReasonPluginEdited);
2414+
nonBlockingSetValues(knob, _centerDrag, eValueChangedReasonPluginEdited);
24462415
}
24472416
{
24482417
KnobDoublePtr knob = _translate.lock();
24492418
// Do not use setValues(x,y) (see note at the top of this file).
2450-
knob->setValue(_translateDrag.x, ViewSpec::all(), 0, eValueChangedReasonPluginEdited);
2451-
knob->setValue(_translateDrag.y, ViewSpec::all(), 1, eValueChangedReasonPluginEdited);
2419+
nonBlockingSetValues(knob, _translateDrag, eValueChangedReasonPluginEdited);
24522420
}
24532421
{
24542422
KnobDoublePtr knob = _scale.lock();
24552423
// Do not use setValues(x,y) (see note at the top of this file).
2456-
knob->setValue(_scaleParamDrag.x, ViewSpec::all(), 0, eValueChangedReasonPluginEdited);
2457-
knob->setValue(_scaleParamDrag.y, ViewSpec::all(), 1, eValueChangedReasonPluginEdited);
2424+
nonBlockingSetValues(knob, _scaleParamDrag, eValueChangedReasonPluginEdited);
24582425
}
24592426
{
24602427
KnobDoublePtr knob = _rotate.lock();
@@ -2509,14 +2476,12 @@ CornerPinInteract::penUp(double /*time*/,
25092476
KnobDoublePtr knob = _from[_dragging].lock();
25102477
assert(knob);
25112478
// Do not use setValues(x,y) (see note at the top of this file).
2512-
knob->setValue(_fromDrag[_dragging].x, ViewSpec::all(), 0, eValueChangedReasonPluginEdited);
2513-
knob->setValue(_fromDrag[_dragging].y, ViewSpec::all(), 1, eValueChangedReasonPluginEdited);
2479+
nonBlockingSetValues(knob, _fromDrag[_dragging], eValueChangedReasonPluginEdited);
25142480
} else {
25152481
KnobDoublePtr knob = _to[_dragging].lock();
25162482
assert(knob);
25172483
// Do not use setValues(x,y) (see note at the top of this file).
2518-
knob->setValue(_toDrag[_dragging].x, ViewSpec::all(), 0, eValueChangedReasonPluginEdited);
2519-
knob->setValue(_toDrag[_dragging].y, ViewSpec::all(), 1, eValueChangedReasonPluginEdited);
2484+
nonBlockingSetValues(knob, _toDrag[_dragging], eValueChangedReasonPluginEdited);
25202485
}
25212486
holder->setMultipleParamsEditLevel(KnobHolder::eMultipleParamsEditOff);
25222487
}

Tests/OSGLContext_Test.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,17 @@
3333

3434
NATRON_NAMESPACE_USING
3535

36+
#if defined(__NATRON_WIN32__) && !defined(__NATRON_MINGW__)
37+
namespace {
38+
39+
// Define nullptr_t operator since MSVC dosn't appear to have one by default.
40+
std::ostream& operator<<(std::ostream& os, const std::nullptr_t p) {
41+
return os << "<nullptr>";
42+
}
43+
44+
} // namespace
45+
#endif
46+
3647
TEST(OSGLContext, Basic)
3748
{
3849
if (!appPTR->isOpenGLLoaded()) {

tools/MINGW-packages/mingw-w64-libraw-gpl2/PKGBUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ prepare() {
3939
patch -Np1 -i "${srcdir}/LibRaw_wsock32.patch"
4040
patch -Np1 -i "${srcdir}/LibRaw_obsolete-macros.patch"
4141

42-
export ACLOCAL_PATH="/msys64/usr/share/aclocal/"
4342
autoreconf -ifv
4443
}
4544

0 commit comments

Comments
 (0)