Skip to content

Commit

Permalink
Merge branch 'NatronGitHub:RB-2.6' into patch-2
Browse files Browse the repository at this point in the history
  • Loading branch information
TodicaIonut authored Dec 11, 2024
2 parents 8c0db59 + 8326245 commit 1c574d9
Show file tree
Hide file tree
Showing 36 changed files with 139 additions and 148 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ set(QTWIDGETS_INCLUDE_DIRS ${Qt5Widgets_INCLUDE_DIRS})
#for QString(const char*) assumes ASCII strings, we may run into troubles
add_compile_definitions(QT_NO_CAST_FROM_ASCII)

if (NOT MSVC)
if (MSVC)
# Allow __cplusplus to properly reflect the c++ standard version.
add_compile_options(/Zc:__cplusplus)
add_compile_definitions(__STDC_LIMIT_MACROS WIN32_LEAN_AND_MEAN _USE_MATH_DEFINES)
else()
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wmissing-prototypes" )
add_compile_options(-Wall -Wextra -Wmissing-declarations -Wno-multichar -Winit-self -Wno-long-long
-Wvla -Wdate-time -Wshift-overflow=2
Expand Down
12 changes: 9 additions & 3 deletions Engine/AppManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,9 +457,15 @@ AppManager::~AppManager()
QThreadPool::globalInstance()->waitForDone();

///Kill caches now because decreaseNCacheFilesOpened can be called
_imp->_nodeCache->waitForDeleterThread();
_imp->_diskCache->waitForDeleterThread();
_imp->_viewerCache->waitForDeleterThread();
if (_imp->_nodeCache) {
_imp->_nodeCache->waitForDeleterThread();
}
if (_imp->_diskCache) {
_imp->_diskCache->waitForDeleterThread();
}
if (_imp->_viewerCache) {
_imp->_viewerCache->waitForDeleterThread();
}
_imp->_nodeCache.reset();
_imp->_viewerCache.reset();
_imp->_diskCache.reset();
Expand Down
4 changes: 4 additions & 0 deletions Engine/AppManagerPrivate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,10 @@ template <typename T>
void
saveCache(Cache<T>* cache)
{
if (!cache) {
return;
}

std::string cacheRestoreFilePath = cache->getRestoreFilePath();
FStreamsSupport::ofstream ofile;
FStreamsSupport::open(&ofile, cacheRestoreFilePath);
Expand Down
4 changes: 4 additions & 0 deletions Engine/CLArgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
#include <cassert>
#include <stdexcept>

#ifdef __NATRON_WIN32__
#include <shellapi.h> // CommandLineToArgvW
#endif

#include <QtCore/QCoreApplication>
#include <QtCore/QDebug>
#include <QtCore/QFile>
Expand Down
2 changes: 1 addition & 1 deletion Engine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ target_include_directories(NatronEngine
)
target_compile_definitions(NatronEngine
PRIVATE
NATRON_CUSTOM_BUILD_USER_TOKEN=${BUILD_USER_NAME}
NATRON_CUSTOM_BUILD_USER_TOKEN="${BUILD_USER_NAME}"
NATRON_BUILD_NUMBER=0
${XDG_DEFS}
)
2 changes: 2 additions & 0 deletions Engine/HostOverlaySupport.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
#include <Python.h>
// ***** END PYTHON BLOCK *****

#include <string>

#include "Global/Macros.h"

#include "Engine/EngineFwd.h"
Expand Down
8 changes: 0 additions & 8 deletions Engine/Knob.h
Original file line number Diff line number Diff line change
Expand Up @@ -1938,12 +1938,6 @@ class Knob
ViewSpec view,
int dimension);

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

/**
* @brief Calls setValueAtTime with a reason of eValueChangedReasonNatronInternalEdited.
Expand Down Expand Up @@ -2147,8 +2141,6 @@ class Knob

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

void queueSetValue(const T& v, ViewSpec view, int dimension);

virtual void clearExpressionsResults(int dimension) OVERRIDE FINAL
{
QMutexLocker k(&_valueMutex);
Expand Down
7 changes: 4 additions & 3 deletions Engine/KnobImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -2588,9 +2588,10 @@ Knob<T>::copyValueForTypeAndCheckIfChanged(Knob<OTHERTYPE>* other,
int dimMin = std::min( getDimension(), other->getDimension() );
std::vector<OTHERTYPE> v = other->getValueForEachDimension_mt_safe_vector();
for (int i = 0; i < dimMin; ++i) {
if (_values[i] != v[i]) {
_values[i] = v[i];
_guiValues[i] = v[i];
const T convertedV = static_cast<T>(v[i]);
if (_values[i] != convertedV) {
_values[i] = convertedV;
_guiValues[i] = convertedV;
ret = true;
}
}
Expand Down
4 changes: 2 additions & 2 deletions Engine/NodeGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2836,12 +2836,12 @@ NodeCollection::exportGroupToPython(const QString& pluginID,
WRITE_STATIC_LINE(NATRON_PYPLUG_MAGIC);
QString descline = QString( QString::fromUtf8(NATRON_PYPLUG_GENERATED "%1 PyPlug exporter version %2.") ).arg( QString::fromUtf8(NATRON_APPLICATION_NAME) ).arg(NATRON_PYPLUG_EXPORTER_VERSION);
WRITE_STRING(descline);
WRITE_STATIC_LINE();
WRITE_STATIC_LINE("");
QString handWrittenStr = QString::fromUtf8("# Hand-written code should be added in a separate file named %1.py").arg(extModule);
WRITE_STRING(handWrittenStr);
WRITE_STATIC_LINE("# See http://natron.readthedocs.org/en/master/devel/groups.html#adding-hand-written-code-callbacks-etc");
WRITE_STATIC_LINE("# Note that Viewers are never exported");
WRITE_STATIC_LINE();
WRITE_STATIC_LINE("");
WRITE_STATIC_LINE("import " NATRON_ENGINE_PYTHON_MODULE_NAME);
WRITE_STATIC_LINE("import sys");
WRITE_STATIC_LINE("");
Expand Down
1 change: 1 addition & 0 deletions Engine/NodePrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "Global/Macros.h"

#include "Node.h"
#include "Timer.h" // gettimeofday()

#include <QtCore/QWaitCondition>
#include <QtCore/QReadWriteLock>
Expand Down
2 changes: 1 addition & 1 deletion Engine/StandardPaths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

#include <QtCore/QtGlobal> // for Q_OS_*
#if defined(Q_OS_WIN)
#include <windows.h>
#include <combaseapi.h>
#include <IntShCut.h>
#include <ShlObj.h>
#ifndef CSIDL_MYMUSIC
Expand Down
2 changes: 1 addition & 1 deletion Engine/Timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
//----------------------------------------------------------------------------

#if defined(__NATRON_WIN32__) && !defined(__NATRON_MINGW__)
#include <windows.h>
#include <winsock2.h>
#else
#include <sys/time.h>
#endif
Expand Down
1 change: 1 addition & 0 deletions Engine/TrackerContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ CLANG_DIAG_ON(uninitialized)
#include "Engine/KnobTypes.h"
#include "Engine/Project.h"
#include "Engine/Curve.h"
#include "Engine/Timer.h" // gettimeofday()
#include "Engine/TLSHolder.h"
#include "Engine/Transform.h"
#include "Engine/TrackMarker.h"
Expand Down
3 changes: 3 additions & 0 deletions Global/Macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,9 @@ GCC_ONLY_DIAG_OFF(pragmas) // warning: unknown option after '#pragma GCC diagno
/////////////////////////////////////////////////////////////////////////////////////////////

/* COMPILER() - the compiler being used to build the project */
#ifdef COMPILER
#undef COMPILER
#endif
#define COMPILER(NATRON_FEATURE) (NATRON_COMPILER_ ## NATRON_FEATURE)

/* COMPILER_SUPPORTS() - whether the compiler being used to build the project supports the given feature. */
Expand Down
6 changes: 5 additions & 1 deletion Global/ProcInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
#include <string.h> // strdup
#endif

#ifdef __NATRON_WIN32__
#include <shellapi.h> // CommandLineToArgvW
#endif

#include "StrUtils.h"

NATRON_NAMESPACE_ENTER
Expand Down Expand Up @@ -499,7 +503,7 @@ ProcInfo::getenv_wrapper(const char *varName)
std::vector<char> buffer;
getenv_s(&requiredSize, 0, 0, varName);
if (requiredSize == 0)
return buffer;
return std::string();
buffer.resize(requiredSize);
getenv_s(&requiredSize, &buffer[0], requiredSize, varName);
// requiredSize includes the terminating null, which we don't want.
Expand Down
2 changes: 1 addition & 1 deletion Gui/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ target_include_directories(NatronGui
)
target_compile_definitions(NatronGui
PRIVATE
NATRON_CUSTOM_BUILD_USER_TOKEN=${BUILD_USER_NAME}
NATRON_CUSTOM_BUILD_USER_TOKEN="${BUILD_USER_NAME}"
NATRON_BUILD_NUMBER=0
QT_NO_KEYWORDS
)
3 changes: 2 additions & 1 deletion Gui/FileTypeMainWindow_win.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@
#include <stdexcept>

// —— general includes —————————————————————————
#include <windows.h>
#include <Dde.h>

#include <QMessageBox>
#include <QApplication>
#include <QtCore/QDir>
Expand Down
83 changes: 24 additions & 59 deletions Gui/HostOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ NATRON_NAMESPACE_ENTER
//
// TODO: This is a bug, there is no reason to not use setValues().
// OpenFX plugins are not affected, because instanceChanged does not pass the dimension information.
namespace {

void nonBlockingSetValues(Natron::KnobDoublePtr& knob, const double x, const double y, const ValueChangedReasonEnum reason) {
knob->setValue(x, ViewSpec::all(), 0, reason, nullptr);
knob->setValue(y, ViewSpec::all(), 1, reason, nullptr);
}

inline void nonBlockingSetValues(Natron::KnobDoublePtr& knob, const OfxPointD& point, const ValueChangedReasonEnum reason) {
nonBlockingSetValues(knob, point.x, point.y, reason);
}

} // namespace


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

#warning TODO
#if 0
int numKeys = knob->get;

if (numKeys > 0) {
const double darken = 0.5;
glColor3f(pR * l * darken, pG * l * darken, pB * l * darken);

glPointSize(pointSize() * screenPixelRatio);
glBegin(GL_POINTS);
for (int i=0; i < numKeys; ++i) {
double time = p->getKeyTime(i);
OfxPointD pt;
p->getValueAtTime(time, pt.x, pt.y);
glVertex2d(pt.x, pt.y);

}
glEnd();
glLineWidth(1.5 * screenPixelRatio);
glBegin(GL_LINE_STRIP);
double time = p->getKeyTime(0);
for (int i = 1; i < numKeys; ++i) {
double timeNext = p->getKeyTime(i);
for (int j = (i == 1 ? 0 : 1); j <= steps; ++j) {
double timeStep = time + j * (timeNext - time) / steps;
OfxPointD pt;
p->getValueAtTime(timeStep, pt.x, pt.y);
glVertex2d(pt.x, pt.y);
}
time = timeNext;
}
glEnd();
}
#endif

glColor3f(pR * l, pG * l, pB * l);
glPointSize(pointSize() * screenPixelRatio);
glBegin(GL_POINTS);
Expand Down Expand Up @@ -1750,8 +1727,7 @@ PositionInteract::penMotion(double time,
EffectInstancePtr holder = _overlay->getNode()->getNode()->getEffectInstance();
holder->setMultipleParamsEditLevel(KnobHolder::eMultipleParamsEditOnCreateNewCommand);
// Do not use setValues(x,y) (see note at the top of this file).
knob->setValue(p[0], ViewSpec::all(), 0, eValueChangedReasonNatronGuiEdited);
knob->setValue(p[1], ViewSpec::all(), 1, eValueChangedReasonNatronGuiEdited);
nonBlockingSetValues(knob, p[0], p[1], eValueChangedReasonNatronGuiEdited);
holder->setMultipleParamsEditLevel(KnobHolder::eMultipleParamsEditOff);
}

Expand Down Expand Up @@ -2196,20 +2172,17 @@ TransformInteract::penMotion(double time,
if (centerChanged) {
KnobDoublePtr knob = _center.lock();
// Do not use setValues(x,y) (see note at the top of this file).
knob->setValue(center.x, ViewSpec::all(), 0, eValueChangedReasonNatronGuiEdited);
knob->setValue(center.y, ViewSpec::all(), 1, eValueChangedReasonNatronGuiEdited);
nonBlockingSetValues(knob, center, eValueChangedReasonNatronGuiEdited);
}
if (translateChanged) {
KnobDoublePtr knob = _translate.lock();
// Do not use setValues(x,y) (see note at the top of this file).
knob->setValue(translate.x, ViewSpec::all(), 0, eValueChangedReasonNatronGuiEdited);
knob->setValue(translate.y, ViewSpec::all(), 1, eValueChangedReasonNatronGuiEdited);
nonBlockingSetValues(knob, translate, eValueChangedReasonNatronGuiEdited);
}
if (scaleChanged) {
KnobDoublePtr knob = _scale.lock();
// Do not use setValues(x,y) (see note at the top of this file).
knob->setValue(scale.x, ViewSpec::all(), 0, eValueChangedReasonNatronGuiEdited);
knob->setValue(scale.y, ViewSpec::all(), 1, eValueChangedReasonNatronGuiEdited);
nonBlockingSetValues(knob, scale, eValueChangedReasonNatronGuiEdited);
}
if (rotateChanged) {
KnobDoublePtr knob = _rotate.lock();
Expand Down Expand Up @@ -2330,14 +2303,12 @@ CornerPinInteract::penMotion(double time,
KnobDoublePtr knob = _from[_dragging].lock();
assert(knob);
// Do not use setValues(x,y) (see note at the top of this file).
knob->setValue(from[_dragging].x, ViewSpec::all(), 0, eValueChangedReasonPluginEdited);
knob->setValue(from[_dragging].y, ViewSpec::all(), 1, eValueChangedReasonPluginEdited);
nonBlockingSetValues(knob, from[_dragging], eValueChangedReasonPluginEdited);
} else {
KnobDoublePtr knob = _to[_dragging].lock();
assert(knob);
// Do not use setValues(x,y) (see note at the top of this file).
knob->setValue(to[_dragging].x, ViewSpec::all(), 0, eValueChangedReasonPluginEdited);
knob->setValue(to[_dragging].y, ViewSpec::all(), 1, eValueChangedReasonPluginEdited);
nonBlockingSetValues(knob, to[_dragging], eValueChangedReasonPluginEdited);
}
holder->setMultipleParamsEditLevel(KnobHolder::eMultipleParamsEditOff);
}
Expand Down Expand Up @@ -2403,8 +2374,7 @@ PositionInteract::penUp(double time,
EffectInstancePtr holder = _overlay->getNode()->getNode()->getEffectInstance();
holder->setMultipleParamsEditLevel(KnobHolder::eMultipleParamsEditOnCreateNewCommand);
// Do not use setValues(x,y) (see note at the top of this file).
knob->setValue(p[0], ViewSpec::all(), 0, eValueChangedReasonNatronGuiEdited);
knob->setValue(p[1], ViewSpec::all(), 1, eValueChangedReasonNatronGuiEdited);
nonBlockingSetValues(knob, p[0], p[1], eValueChangedReasonNatronGuiEdited);
holder->setMultipleParamsEditLevel(KnobHolder::eMultipleParamsEditOff);
}

Expand Down Expand Up @@ -2441,20 +2411,17 @@ TransformInteract::penUp(double /*time*/,
{
KnobDoublePtr knob = _center.lock();
// Do not use setValues(x,y) (see note at the top of this file).
knob->setValue(_centerDrag.x, ViewSpec::all(), 0, eValueChangedReasonPluginEdited);
knob->setValue(_centerDrag.y, ViewSpec::all(), 1, eValueChangedReasonPluginEdited);
nonBlockingSetValues(knob, _centerDrag, eValueChangedReasonPluginEdited);
}
{
KnobDoublePtr knob = _translate.lock();
// Do not use setValues(x,y) (see note at the top of this file).
knob->setValue(_translateDrag.x, ViewSpec::all(), 0, eValueChangedReasonPluginEdited);
knob->setValue(_translateDrag.y, ViewSpec::all(), 1, eValueChangedReasonPluginEdited);
nonBlockingSetValues(knob, _translateDrag, eValueChangedReasonPluginEdited);
}
{
KnobDoublePtr knob = _scale.lock();
// Do not use setValues(x,y) (see note at the top of this file).
knob->setValue(_scaleParamDrag.x, ViewSpec::all(), 0, eValueChangedReasonPluginEdited);
knob->setValue(_scaleParamDrag.y, ViewSpec::all(), 1, eValueChangedReasonPluginEdited);
nonBlockingSetValues(knob, _scaleParamDrag, eValueChangedReasonPluginEdited);
}
{
KnobDoublePtr knob = _rotate.lock();
Expand Down Expand Up @@ -2509,14 +2476,12 @@ CornerPinInteract::penUp(double /*time*/,
KnobDoublePtr knob = _from[_dragging].lock();
assert(knob);
// Do not use setValues(x,y) (see note at the top of this file).
knob->setValue(_fromDrag[_dragging].x, ViewSpec::all(), 0, eValueChangedReasonPluginEdited);
knob->setValue(_fromDrag[_dragging].y, ViewSpec::all(), 1, eValueChangedReasonPluginEdited);
nonBlockingSetValues(knob, _fromDrag[_dragging], eValueChangedReasonPluginEdited);
} else {
KnobDoublePtr knob = _to[_dragging].lock();
assert(knob);
// Do not use setValues(x,y) (see note at the top of this file).
knob->setValue(_toDrag[_dragging].x, ViewSpec::all(), 0, eValueChangedReasonPluginEdited);
knob->setValue(_toDrag[_dragging].y, ViewSpec::all(), 1, eValueChangedReasonPluginEdited);
nonBlockingSetValues(knob, _toDrag[_dragging], eValueChangedReasonPluginEdited);
}
holder->setMultipleParamsEditLevel(KnobHolder::eMultipleParamsEditOff);
}
Expand Down
11 changes: 11 additions & 0 deletions Tests/OSGLContext_Test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@

NATRON_NAMESPACE_USING

#if defined(__NATRON_WIN32__) && !defined(__NATRON_MINGW__)
namespace {

// Define nullptr_t operator since MSVC dosn't appear to have one by default.
std::ostream& operator<<(std::ostream& os, const std::nullptr_t p) {
return os << "<nullptr>";
}

} // namespace
#endif

TEST(OSGLContext, Basic)
{
if (!appPTR->isOpenGLLoaded()) {
Expand Down
1 change: 0 additions & 1 deletion tools/MINGW-packages/mingw-w64-libraw-gpl2/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ prepare() {
patch -Np1 -i "${srcdir}/LibRaw_wsock32.patch"
patch -Np1 -i "${srcdir}/LibRaw_obsolete-macros.patch"

export ACLOCAL_PATH="/msys64/usr/share/aclocal/"
autoreconf -ifv
}

Expand Down
Loading

0 comments on commit 1c574d9

Please sign in to comment.