From f6b3d51389cd114cd81d6908c8d5ac9732e75c0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Devernay?= Date: Thu, 27 Oct 2016 15:13:06 +0200 Subject: [PATCH 1/3] DockablePanel: check more often for an existing gui --- Gui/DockablePanel.cpp | 114 ++++++++++++++++++++++++++++-------------- 1 file changed, 77 insertions(+), 37 deletions(-) diff --git a/Gui/DockablePanel.cpp b/Gui/DockablePanel.cpp index 513a0b93a5..39045ed551 100644 --- a/Gui/DockablePanel.cpp +++ b/Gui/DockablePanel.cpp @@ -418,8 +418,9 @@ DockablePanel::DockablePanel(Gui* gui, DockablePanel::~DockablePanel() { - if ( getGui() ) { - getGui()->removeVisibleDockablePanel(this); + Gui* gui = getGui(); + if (gui) { + gui->removeVisibleDockablePanel(this); } } @@ -534,13 +535,15 @@ DockablePanel::onKnobsRecreated() // Refresh the curve editor with potential new animated knobs if (isNodePanel) { - NodeGuiPtr node = isNodePanel->getNode(); - - getGui()->getCurveEditor()->removeNode( node.get() ); - getGui()->getCurveEditor()->addNode(node); + Gui* gui = getGui(); + if (gui) { + NodeGuiPtr node = isNodePanel->getNode(); + gui->getCurveEditor()->removeNode( node.get() ); + gui->getCurveEditor()->addNode(node); - getGui()->removeNodeGuiFromDopeSheetEditor(node); - getGui()->addNodeGuiToDopeSheetEditor(node); + gui->removeNodeGuiFromDopeSheetEditor(node); + gui->addNodeGuiToDopeSheetEditor(node); + } } } @@ -966,13 +969,21 @@ DockablePanel::setClosedInternal(bool c) NodeSettingsPanel* nodePanel = dynamic_cast(this); if (nodePanel) { - nodePanel->getNode()->getNode()->getEffectInstance()->refreshAfterTimeChange( false, getGui()->getApp()->getTimeLine()->currentFrame() ); - - NodeGuiPtr nodeGui = nodePanel->getNode(); NodePtr internalNode = nodeGui->getNode(); - boost::shared_ptr panel = getMultiInstancePanel(); + Gui* gui = getGui(); + if (internalNode && gui) { + GuiAppInstPtr app = gui->getApp(); + if (app) { + boost::shared_ptr timeline = app->getTimeLine(); + if (timeline) { + internalNode->getEffectInstance()->refreshAfterTimeChange( false, timeline->currentFrame() ); + } + } + } + + boost::shared_ptr panel = getMultiInstancePanel(); if (!c) { gui->addNodeGuiToCurveEditor(nodeGui); @@ -1050,9 +1061,12 @@ DockablePanel::closePanel() hasFocus->clearFocus(); } - const std::list& viewers = getGui()->getViewersList(); - for (std::list::const_iterator it = viewers.begin(); it != viewers.end(); ++it) { - (*it)->getViewer()->redraw(); + Gui* gui = getGui(); + if (gui) { + const std::list& viewers = gui->getViewersList(); + for (std::list::const_iterator it = viewers.begin(); it != viewers.end(); ++it) { + (*it)->getViewer()->redraw(); + } } } @@ -1076,7 +1090,10 @@ DockablePanel::minimizeOrMaximize(bool toggled) for (U32 i = 0; i < _panels.size(); ++i) { _imp->_container->addWidget(_panels[i]); } - getGui()->buildTabFocusOrderPropertiesBin(); + Gui* gui = getGui(); + if (gui) { + gui->buildTabFocusOrderPropertiesBin(); + } update(); } @@ -1116,7 +1133,10 @@ DockablePanel::floatPanel() _imp->_floatingWidget->deleteLater(); _imp->_floatingWidget = 0; } - getGui()->buildTabFocusOrderPropertiesBin(); + Gui* gui = getGui(); + if (gui) { + gui->buildTabFocusOrderPropertiesBin(); + } return _imp->_floatingWidget; } @@ -1257,11 +1277,15 @@ DockablePanel::onOverlayColorDialogColorChanged(const QColor& color) _imp->_hasOverlayColor = true; } - NodesList overlayNodes; - getGui()->getNodesEntitledForOverlays(overlayNodes); - NodesList::iterator found = std::find(overlayNodes.begin(), overlayNodes.end(), node); - if ( found != overlayNodes.end() ) { - getGui()->getApp()->redrawAllViewers(); + Gui* gui = getGui(); + if (gui) { + NodesList overlayNodes; + + gui->getNodesEntitledForOverlays(overlayNodes); + NodesList::iterator found = std::find(overlayNodes.begin(), overlayNodes.end(), node); + if ( found != overlayNodes.end() ) { + gui->getApp()->redrawAllViewers(); + } } } } @@ -1330,11 +1354,15 @@ DockablePanel::onOverlayButtonClicked() _imp->_overlayButton->setIcon( QIcon(pixOverlay) ); } } - NodesList overlayNodes; - getGui()->getNodesEntitledForOverlays(overlayNodes); - NodesList::iterator found = std::find(overlayNodes.begin(), overlayNodes.end(), node); - if ( found != overlayNodes.end() ) { - getGui()->getApp()->redrawAllViewers(); + Gui* gui = getGui(); + if (gui) { + NodesList overlayNodes; + + gui->getNodesEntitledForOverlays(overlayNodes); + NodesList::iterator found = std::find(overlayNodes.begin(), overlayNodes.end(), node); + if ( found != overlayNodes.end() ) { + gui->getApp()->redrawAllViewers(); + } } } @@ -1380,11 +1408,15 @@ DockablePanel::resetHostOverlayColor() appPTR->getIcon(NATRON_PIXMAP_OVERLAY, NATRON_MEDIUM_BUTTON_ICON_SIZE, &pixOverlay); _imp->_overlayButton->setIcon( QIcon(pixOverlay) ); - NodesList overlayNodes; - getGui()->getNodesEntitledForOverlays(overlayNodes); - NodesList::iterator found = std::find(overlayNodes.begin(), overlayNodes.end(), node); - if ( found != overlayNodes.end() ) { - getGui()->getApp()->redrawAllViewers(); + Gui* gui = getGui(); + if (gui) { + NodesList overlayNodes; + + gui->getNodesEntitledForOverlays(overlayNodes); + NodesList::iterator found = std::find(overlayNodes.begin(), overlayNodes.end(), node); + if ( found != overlayNodes.end() ) { + gui->getApp()->redrawAllViewers(); + } } } @@ -1480,7 +1512,11 @@ DockablePanel::onManageUserParametersActionTriggered() void DockablePanel::setKeyOnAllParameters() { - double time = getGui()->getApp()->getTimeLine()->currentFrame(); + Gui* gui = getGui(); + if (!gui) { + return; + } + double time = gui->getApp()->getTimeLine()->currentFrame(); AddKeysCommand::KeysToAddList keys; const KnobsGuiMapping& knobsMap = getKnobsMapping(); @@ -1488,7 +1524,7 @@ DockablePanel::setKeyOnAllParameters() KnobPtr knob = it->first.lock(); if ( knob->isAnimationEnabled() ) { for (int i = 0; i < knob->getDimension(); ++i) { - std::list > curves = getGui()->getCurveEditor()->findCurve(it->second, i); + std::list > curves = gui->getCurveEditor()->findCurve(it->second, i); for (std::list >::iterator it2 = curves.begin(); it2 != curves.end(); ++it2) { AddKeysCommand::KeyToAdd k; KeyFrame kf; @@ -1525,12 +1561,16 @@ DockablePanel::setKeyOnAllParameters() } } } - pushUndoCommand( new AddKeysCommand(getGui()->getCurveEditor()->getCurveWidget(), keys) ); + pushUndoCommand( new AddKeysCommand(gui->getCurveEditor()->getCurveWidget(), keys) ); } void DockablePanel::removeAnimationOnAllParameters() { + Gui* gui = getGui(); + if (!gui) { + return; + } std::map< boost::shared_ptr, std::vector > keysToRemove; const KnobsGuiMapping& knobsMap = getKnobsMapping(); @@ -1538,7 +1578,7 @@ DockablePanel::removeAnimationOnAllParameters() KnobPtr knob = it->first.lock(); if ( knob->isAnimationEnabled() ) { for (int i = 0; i < knob->getDimension(); ++i) { - std::list > curves = getGui()->getCurveEditor()->findCurve(it->second, i); + std::list > curves = gui->getCurveEditor()->findCurve(it->second, i); for (std::list >::iterator it2 = curves.begin(); it2 != curves.end(); ++it2) { KeyFrameSet keys = (*it2)->getInternalCurve()->getKeyFrames_mt_safe(); @@ -1551,7 +1591,7 @@ DockablePanel::removeAnimationOnAllParameters() } } } - pushUndoCommand( new RemoveKeysCommand(getGui()->getCurveEditor()->getCurveWidget(), keysToRemove) ); + pushUndoCommand( new RemoveKeysCommand(gui->getCurveEditor()->getCurveWidget(), keysToRemove) ); } void From 9f708bc829849630df133e316c7d90ed1ecd2346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Devernay?= Date: Thu, 27 Oct 2016 15:32:44 +0200 Subject: [PATCH 2/3] GuiPrivate: be safe --- Gui/GuiPrivate.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Gui/GuiPrivate.cpp b/Gui/GuiPrivate.cpp index 5ce4126b54..e47cc80928 100644 --- a/Gui/GuiPrivate.cpp +++ b/Gui/GuiPrivate.cpp @@ -295,6 +295,12 @@ GuiPrivate::notifyGuiClosing() const NodesGuiList allNodes = _nodeGraphArea->getAllActiveNodes(); + { + // we do not need this list anymore, avoid using it + QMutexLocker k(&this->openedPanelsMutex); + this->openedPanels.clear(); + } + for (NodesGuiList::const_iterator it = allNodes.begin(); it != allNodes.end(); ++it) { DockablePanel* panel = (*it)->getSettingPanel(); if (panel) { From 90bd399c4ab2c5242a604b6a9616b793791d9ba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Devernay?= Date: Thu, 27 Oct 2016 15:40:32 +0200 Subject: [PATCH 3/3] INSTALL_OSX: cleanup --- INSTALL_OSX.md | 60 +++++++++++++++++++++++++------------------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/INSTALL_OSX.md b/INSTALL_OSX.md index 8db2d88178..ff44e1f835 100644 --- a/INSTALL_OSX.md +++ b/INSTALL_OSX.md @@ -7,17 +7,17 @@ OS X 10.6 (a.k.a. Snow Leopard) and newer are supported when building with MacPo ## Checkout sources - git clone https://github.com/MrKepzie/Natron.git - cd Natron + git clone https://github.com/MrKepzie/Natron.git + cd Natron If you want to compile the bleeding edge version, use the master branch: - git checkout master - + git checkout master + Update the submodules: - git submodule update -i --recursive + git submodule update -i --recursive ## Install libraries @@ -31,8 +31,8 @@ Homebrew is easier to set up than MacPorts, but cannot build universal binaries. You need an up to date MacPorts version. Just download it and install it from , and execute the following commands in a terminal: - sudo port selfupdate - sudo port upgrade outdated + sudo port selfupdate + sudo port upgrade outdated Then, you should add the "ports" provided by Natron. Edit as root the file `/opt/local/etc/macports/sources.conf` (as in `sudo nano /opt/local/etc/macports/sources.conf`) and add the following line at the beginning, with the path to the Natron sources (yes, there are three slashes after `file:`): @@ -52,9 +52,9 @@ If compiling on Mac OS X 10.6 with Xcode 4, you should also revert to the defaul And finally install the required packages: - sudo port install qt4-mac boost cairo expat - sudo port install py27-pyside py27-sphinx - sudo ln -s python2.7-config /opt/local/bin/python2-config + sudo port install qt4-mac boost cairo expat gsed + sudo port install py27-pyside py27-sphinx + sudo ln -s python2.7-config /opt/local/bin/python2-config Create the file /opt/local/lib/pkgconfig/glu.pc containing GLU configuration, for example using the following comands: @@ -107,7 +107,7 @@ Install libraries: brew tap homebrew/python brew tap homebrew/science - brew install expat cairo + brew install expat cairo gnu-sed brew install --build-from-source qt --with-mysql Qt will not build on macOS Sierra, and the last command fails, but a sierra-compatible brew is available (to be used only in Sierra, since this builds Qt from sources and takes a while) @@ -132,7 +132,7 @@ The last command above will take a while, since it builds from sources, and shou also set the correct value for the pkg-config path (you can also put this in your .bash_profile): - + export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig:/usr/local/opt/cairo/lib/pkgconfig ### Installing a patched Qt to avoid stack overflows @@ -221,17 +221,17 @@ EOF You can generate a makefile by opening a Terminal, setting the current directory to the toplevel source directory, and typing - qmake -r + qmake -r then type - make - + make + This will create all binaries in all the subprojects folders. If you want to build in DEBUG mode change the qmake call to this line: - qmake -r CONFIG+=debug + qmake -r CONFIG+=debug * You can also enable logging by adding CONFIG+=log @@ -247,12 +247,12 @@ tracker and in CImg-based plugins. First, install clang 3.8. On OS X 10.6 Snow Leopard 10.6: - sudo port install ld64-136 +llvm38 clang-3.8` + sudo port install ld64-136 +llvm38 clang-3.8` On OS X 10.7 or later: - sudo port install ld64-latest +llvm38 clang-3.8` - + sudo port install ld64-latest +llvm38 clang-3.8` + Then configure using the following qmake command (replace `macx-clang`with `macx-clang-libc++` on OS X 10.9 and later): /opt/local/libexec/qt4/bin/qmake -spec unsupported/macx-clang QMAKE_CXX=clang++-mp-3.8 QMAKE_CXX=clang++-mp-3.8 QMAKE_CC=clang-mp-3.8 QMAKE_OBJECTIVE_CXX=clang++-mp-3.8 QMAKE_OBJECTIVE_CC=clang-mp-3.8 QMAKE_LD=clang++-mp-3.8 -r CONFIG+=openmp @@ -260,21 +260,21 @@ Then configure using the following qmake command (replace `macx-clang`with `macx To build the plugins, use the following command-line (on OS X 10.9 and later, remove `-stdlib=libstdc++`): - make CXX=clang++-mp-3.8 CXXFLAGS_ADD="-fopenmp" LDFLAGS_ADD="-fopenmp" + make CXX=clang++-mp-3.8 CXXFLAGS_ADD="-fopenmp" LDFLAGS_ADD="-fopenmp" Or, if you have MangledOSMesa32 installed in `OSMESA_PATH` and LLVM installed in `LLVM_PATH` (MangledOSMesa32 and LLVM build script is available from [https://github.com/devernay/osmesa-install](github:devernay/osmesa-install) : - OSMESA_PATH=/opt/osmesa - LLVM_PATH=/opt/llvm - make CXX=clang++-mp-3.8 CXXFLAGS_ADD="-fopenmp" LDFLAGS_ADD="-fopenmp" CXXFLAGS_MESA="-DHAVE_OSMESA" LDFLAGS_MESA="-L${OSMESA_PATH}/lib -lMangledOSMesa32 `${LLVM_PATH}/bin/llvm-config --ldflags --libs engine mcjit mcdisassembler | tr '\n' ' '`" OSMESA_PATH="${OSMESA_PATH}" + OSMESA_PATH=/opt/osmesa + LLVM_PATH=/opt/llvm + make CXX=clang++-mp-3.8 CXXFLAGS_ADD="-fopenmp" LDFLAGS_ADD="-fopenmp" CXXFLAGS_MESA="-DHAVE_OSMESA" LDFLAGS_MESA="-L${OSMESA_PATH}/lib -lMangledOSMesa32 `${LLVM_PATH}/bin/llvm-config --ldflags --libs engine mcjit mcdisassembler | tr '\n' ' '`" OSMESA_PATH="${OSMESA_PATH}" ## Build on Xcode -Follow the instruction of build but +Follow the instruction of build but add -spec macx-xcode to the qmake call command: - qmake -r -spec macx-xcode - + qmake -r -spec macx-xcode + Then open the already provided Project-xcode.xcodeproj and compile the target "all" ### Compiling plugins with Xcode @@ -318,7 +318,7 @@ On MacPorts, this would look like: ## Testing - (cd Tests && qmake -r CONFIG+=debug CONFIG+=coverage && make -j4 && ./Tests) + (cd Tests && qmake -r CONFIG+=debug CONFIG+=coverage && make -j4 && ./Tests) ## Generating Python bindings @@ -349,7 +349,7 @@ tools/utils/runPostShiboken.sh **Note** Shiboken has a few glitches which needs fixing with some sed commands, run tools/utils/runPostShiboken.sh once shiboken is called - + ## OpenFX plugins Instructions to build the [openfx-io](https://github.com/MrKepzie/openfx-io) and [openfx-misc](https://github.com/devernay/openfx-misc) sets of plugins can also be found in the [tools/packageOSX.sh](https://github.com/MrKepzie/Natron/blob/master/tools/packageOSX.sh) script if you are using MacPorts, or in the .travis.yml file in their respective github repositories if you are using homebrew ([openfx-misc/.travis.yml](https://github.com/devernay/openfx-misc/blob/master/.travis.yml), [openfx-io/.travis.yml](https://github.com/MrKepzie/openfx-io/blob/master/.travis.yml). @@ -357,8 +357,8 @@ Instructions to build the [openfx-io](https://github.com/MrKepzie/openfx-io) and You can install [TuttleOFX](http://www.tuttleofx.org/) using homebrew: - brew tap homebrew/science homebrew/x11 homebrew/python cbenhagen/video - brew install tuttleofx + brew tap homebrew/science homebrew/x11 homebrew/python cbenhagen/video + brew install tuttleofx Or have a look at the [instructions for building on MacPorts as well as precompiled universal binaries](http://devernay.free.fr/hacks/openfx/#OSXTuttleOFX).