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 Dec 7, 2015
2 parents 30e4996 + 3a590eb commit 94e99c7
Show file tree
Hide file tree
Showing 303 changed files with 5,739 additions and 4,518 deletions.
33 changes: 22 additions & 11 deletions .travis-coverity-scan-build.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
#!/bin/sh
# Modified coverity scan build script
# Original script available at https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh
# Additions (see corresponding sections below):
# - Verify Coverity Scan run condition
# - Verify Coverity Scan script test mode
# - set TOOL_BASE to a writable directory with more than 1Gb free space

set -e

# Environment check
echo -e "\033[33;1mNote: PROJECT_NAME and COVERITY_SCAN_TOKEN are available on Project Settings page on scan.coverity.com\033[0m"
echo -e "\033[33;1mNote: COVERITY_SCAN_PROJECT_NAME and COVERITY_SCAN_TOKEN are available on Project Settings page on scan.coverity.com\033[0m"
[ -z "$COVERITY_SCAN_PROJECT_NAME" ] && echo "ERROR: COVERITY_SCAN_PROJECT_NAME must be set" && exit 1
#[ -z "$COVERITY_SCAN_NOTIFICATION_EMAIL" ] && echo "ERROR: COVERITY_SCAN_NOTIFICATION_EMAIL must be set" && exit 1
[ -z "$COVERITY_SCAN_NOTIFICATION_EMAIL" ] && echo "ERROR: COVERITY_SCAN_NOTIFICATION_EMAIL must be set" && exit 1
[ -z "$COVERITY_SCAN_BRANCH_PATTERN" ] && echo "ERROR: COVERITY_SCAN_BRANCH_PATTERN must be set" && exit 1
[ -z "$COVERITY_SCAN_BUILD_COMMAND" ] && echo "ERROR: COVERITY_SCAN_BUILD_COMMAND must be set" && exit 1
[ -z "$COVERITY_SCAN_TOKEN" ] && echo "ERROR: COVERITY_SCAN_TOKEN must be set" && exit 1

PLATFORM=`uname`
TOOL_ARCHIVE=/tmp/cov-analysis-${PLATFORM}.tgz
TOOL_URL=https://scan.coverity.com/download/${PLATFORM}
TOOL_BASE=/tmp/coverity-scan-analysis
UPLOAD_URL="http://scan5.coverity.com/cgi-bin/travis_upload.py"
#TOOL_BASE=/tmp/coverity-scan-analysis
TOOL_BASE=/home/travis/coverity-scan-analysis
UPLOAD_URL="https://scan.coverity.com/builds"
SCAN_URL="https://scan.coverity.com"

# Verify Coverity Scan run condition
Expand Down Expand Up @@ -54,7 +61,7 @@ else
else
WHEN=`echo $AUTH_RES | ruby -e "require 'rubygems'; require 'json'; puts JSON[STDIN.read]['next_upload_permitted_at']"`
echo -e "\033[33;1mCoverity Scan analysis NOT authorized until $WHEN.\033[0m"
exit 1
exit 0
fi
fi

Expand Down Expand Up @@ -83,13 +90,13 @@ COV_BUILD_OPTIONS=""
RESULTS_DIR="cov-int"
eval "${COVERITY_SCAN_BUILD_COMMAND_PREPEND}"
COVERITY_UNSUPPORTED=1 cov-build --dir $RESULTS_DIR $COV_BUILD_OPTIONS $COVERITY_SCAN_BUILD_COMMAND
cov-import-scm --dir $RESULTS_DIR --scm git --log $RESULTS_DIR/scm_log.txt 2>&1

# Upload results
echo -e "\033[33;1mTarring Coverity Scan Analysis results...\033[0m"
RESULTS_ARCHIVE=analysis-results.tgz
tar czf $RESULTS_ARCHIVE $RESULTS_DIR
SHA=`git rev-parse --short HEAD`
#VERSION_SHA=$(cat VERSION)#$SHA

# Verify Coverity Scan script test mode
if [ "$coverity_scan_script_test_mode" = true ]; then
Expand All @@ -98,14 +105,18 @@ if [ "$coverity_scan_script_test_mode" = true ]; then
fi

echo -e "\033[33;1mUploading Coverity Scan Analysis results...\033[0m"
curl \
--progress-bar \
response=$(curl \
--silent --write-out "\n%{http_code}\n" \
--form project=$COVERITY_SCAN_PROJECT_NAME \
--form token=$COVERITY_SCAN_TOKEN \
--form email=$COVERITY_SCAN_NOTIFICATION_EMAIL \
--form file=@$RESULTS_ARCHIVE \
--form version=$SHA \
--form description="Travis CI build" \
$UPLOAD_URL

# --form description="$VERSION_SHA" \
$UPLOAD_URL)
status_code=$(echo "$response" | sed -n '$p')
if [ "$status_code" != "201" ]; then
TEXT=$(echo "$response" | sed '$d')
echo -e "\033[33;1mCoverity Scan upload failed: $TEXT.\033[0m"
exit 1
fi
5 changes: 2 additions & 3 deletions BreakpadClient/BreakpadClient.pro
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ unix {
}

# mac os x
mac {
macx {
# hack to make minidump_generator.cc compile as it uses
# esp instead of __esp
# DEFINES += __DARWIN_UNIX03=0 -- looks like we do not need it anymore
Expand All @@ -91,7 +91,7 @@ mac {
}

# linux
linux {
unix:!macx {
SOURCES += \
$$BREAKPAD_PATH/client/linux/crash_generation/crash_generation_client.cc \
$$BREAKPAD_PATH/client/linux/crash_generation/crash_generation_server.cc \
Expand All @@ -105,7 +105,6 @@ linux {
$$BREAKPAD_PATH/client/linux/minidump_writer/linux_dumper.cc \
$$BREAKPAD_PATH/client/linux/minidump_writer/linux_ptrace_dumper.cc \
$$BREAKPAD_PATH/client/linux/minidump_writer/minidump_writer.cc \
$$BREAKPAD_PATH/client/linux/sender/google_crash_report_sender.cc \
$$BREAKPAD_PATH/common/linux/crc32.cc \
$$BREAKPAD_PATH/common/linux/dump_symbols.cc \
$$BREAKPAD_PATH/common/linux/elf_core_dump.cc \
Expand Down
9 changes: 9 additions & 0 deletions Documentation/source/PythonReference/NatronEngine/Effect.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Functions
* def :meth:`setScriptName<NatronEngine.Effect.setScriptName>` (scriptName)
* def :meth:`setSize<NatronEngine.Effect.setSize>` (w, h)
* def :meth:`setSubGraphEditable<NatronEngine.Effect.setSubGraphEditable>` (editable)
* def :meth:`setPagesOrder<NatronEngine.Effect.setPagesOrder>` (pages)

.. _details:

Expand Down Expand Up @@ -489,3 +490,11 @@ The user will still be able to see the internal node graph but will not be able
unlock it.


.. method:: NatronEngine.Effect.setPagesOrder(pages)

:param pages: :class:`sequence`

Given the string list *pages* try to find the corresponding pages by their-script name
and order them in the given order.


31 changes: 31 additions & 0 deletions Documentation/source/PythonReference/NatronEngine/Param.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,14 @@ Functions
* def :meth:`setAddNewLine<NatronEngine.Param.setAddNewLine>` (a)
* def :meth:`setAnimationEnabled<NatronEngine.Param.setAnimationEnabled>` (e)
* def :meth:`setEnabled<NatronEngine.Param.setEnabled>` (enabled[, dimension=0])
* def :meth:`setEnabledByDefault<NatronEngine.Param.setEnabledByDefault>` (enabled)
* def :meth:`setEvaluateOnChange<NatronEngine.Param.setEvaluateOnChange>` (eval)
* def :meth:`setHelp<NatronEngine.Param.setHelp>` (help)
* def :meth:`setPersistant<NatronEngine.Param.setPersistant>` (persistant)
* def :meth:`setVisible<NatronEngine.Param.setVisible>` (visible)
* def :meth:`setVisibleByDefault<NatronEngine.Param.setVisibleByDefault>` (visible)
* def :meth:`setAsAlias<NatronEngine.StringParamBase.setAsAlias>` (otherParam)


.. _details:

Expand Down Expand Up @@ -447,7 +451,14 @@ When disabled, the parameter will be displayed in black and the user will not be
to edit it.
See :func:`getIsEnabled(dimension)<NatronEngine.Param.getIsEnabled>`

.. method:: NatronEngine.Param.setEnabledByDefault(enabled)


:param enabled: :class:`bool<PySide.QtCore.bool>`

Set whether the parameter should be enabled or not by default.
When disabled, the parameter will be displayed in black and the user will not be able
to edit it.


.. method:: NatronEngine.Param.setEvaluateOnChange(eval)
Expand Down Expand Up @@ -490,7 +501,27 @@ See :func:`getIsPersistant<NatronEngine.Param.getIsPersistant>`
Set whether this parameter should be visible or not to the user.
See :func:`getIsVisible()<NatronEngine.Param.getIsVisible>`

.. method:: NatronEngine.Param.setVisibleByDefault(visible)


:param visible: :class:`bool<PySide.QtCore.bool>`

Set whether this parameter should be visible or not to the user in its default state.


.. method:: NatronEngine.StringParamBase.setAsAlias(otherParam)

:param otherParam: :class:`Param<NatronEngine.Param>`
:rtype: :class:`bool<PySide.QtCore.bool>`


Set this parameter as an alias of *otherParam*.
They need to be both of the same *type* and of the same *dimension*.
This parameter will control *otherParam* entirely and in case of a choice param, its
drop-down menu will be updated whenever the *otherParam* menu is updated.

This is used generally to make user parameters on groups with the "Pick" option of the
"Manage User Parameters" dialog.



19 changes: 14 additions & 5 deletions Engine/AppInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <stdexcept>

#include <QtCore/QDir>
#include <QtCore/QTextStream>
#include <QtConcurrentMap> // QtCore on Qt4, QtConcurrent on Qt5
#include <QtCore/QUrl>
#include <QtCore/QFileInfo>
Expand Down Expand Up @@ -685,8 +686,12 @@ AppInstance::createNodeFromPythonModule(Natron::Plugin* plugin,
group);
containerNode = createNode(groupArgs);
std::string containerName;
group->initNodeName(plugin->getLabelWithoutSuffix().toStdString(),&containerName);
containerNode->setScriptName(containerName);
try {
group->initNodeName(plugin->getLabelWithoutSuffix().toStdString(),&containerName);
containerNode->setScriptName(containerName);
} catch (...) {

}


} else {
Expand Down Expand Up @@ -1013,7 +1018,11 @@ AppInstance::createNodeInternal(const QString & pluginID,
CreateNodeArgs::DefaultValuesList(),
isGrp);
output = createNode(args);
output->setScriptName("Output");
try {
output->setScriptName("Output");
} catch (...) {

}
assert(output);
}
{
Expand Down Expand Up @@ -1510,9 +1519,9 @@ AppInstance::save(const std::string& filename)
{
boost::shared_ptr<Natron::Project> project= getProject();
if (project->hasProjectBeenSavedByUser()) {
QString projectName = project->getProjectName();
QString projectFilename = project->getProjectFilename();
QString projectPath = project->getProjectPath();
return project->saveProject(projectPath, projectName, 0);
return project->saveProject(projectPath, projectFilename, 0);
} else {
return saveAs(filename);
}
Expand Down
29 changes: 24 additions & 5 deletions Engine/AppInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@
#include <QStringList>

#include "Global/GlobalDefines.h"
#include "Engine/RectD.h"
#include "Engine/EngineFwd.h"

class QFileInfo;
class QMutex;

struct AppInstancePrivate;

struct CreateNodeArgs
Expand Down Expand Up @@ -377,8 +375,13 @@ class AppInstance

virtual bool isDraftRenderEnabled() const { return false; }

virtual void setUserIsPainting(const boost::shared_ptr<Natron::Node>& /*rotopaintNode*/) {}
virtual boost::shared_ptr<Natron::Node> getIsUserPainting() const { return boost::shared_ptr<Natron::Node>(); }
virtual void setUserIsPainting(const boost::shared_ptr<Natron::Node>& /*rotopaintNode*/,
const boost::shared_ptr<RotoStrokeItem>& /*stroke*/,
bool /*isPainting*/) {}

virtual void getActiveRotoDrawingStroke(boost::shared_ptr<Natron::Node>* /*node*/,
boost::shared_ptr<RotoStrokeItem>* /*stroke*/,
bool* /*isPainting*/) const { }

virtual bool isRenderStatsActionChecked() const { return false; }

Expand All @@ -398,6 +401,22 @@ class AppInstance

virtual void* getOfxHostOSHandle() const { return NULL; }

virtual void updateLastPaintStrokeData(int /*newAge*/,
const std::list<std::pair<Natron::Point,double> >& /*points*/,
const RectD& /*lastPointsBbox*/,
int /*strokeIndex*/) {}

virtual void getLastPaintStrokePoints(std::list<std::list<std::pair<Natron::Point,double> > >* /*strokes*/, int* /*strokeIndex*/) const {}

virtual int getStrokeLastIndex() const { return -1; }

virtual void getRenderStrokeData(RectD* /*lastStrokeMovementBbox*/, std::list<std::pair<Natron::Point,double> >* /*lastStrokeMovementPoints*/,
double */*distNextIn*/, boost::shared_ptr<Natron::Image>* /*strokeImage*/) const {}

virtual void updateStrokeImage(const boost::shared_ptr<Natron::Image>& /*image*/, double /*distNextOut*/, bool /*setDistNextOut*/) {}

virtual RectD getLastPaintStrokeBbox() const { return RectD(); }

public Q_SLOTS:

void quit();
Expand Down
63 changes: 57 additions & 6 deletions Engine/AppManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
#include <QtCore/QCoreApplication>
#include <QtCore/QSettings>
#include <QtCore/QThreadPool>
#include <QtCore/QTextStream>
#include <QtNetwork/QAbstractSocket>
#include <QtNetwork/QLocalServer>
#include <QtNetwork/QLocalSocket>
Expand Down Expand Up @@ -75,6 +76,7 @@
#include "Engine/Project.h"
#include "Engine/RotoPaint.h"
#include "Engine/RotoSmear.h"
#include "Engine/StandardPaths.h"
#include "Engine/ViewerInstance.h" // RenderStatsMap


Expand Down Expand Up @@ -2616,7 +2618,7 @@ AppManager::isProjectAlreadyOpened(const std::string& projectFilePath) const
boost::shared_ptr<Natron::Project> proj = it->second.app->getProject();
if (proj) {
QString path = proj->getProjectPath();
QString name = proj->getProjectName();
QString name = proj->getProjectFilename();
std::string existingProject = path.toStdString() + name.toStdString();
if (existingProject == projectFilePath) {
return it->first;
Expand All @@ -2643,17 +2645,29 @@ AppManager::onCrashReporterOutputWritten()
//At this point, the CrashReporter just notified us it is ready, so we can create our exception handler safely
//because we know the pipe is opened on the other side.

QString dumpPath = Natron::StandardPaths::writableLocation(Natron::StandardPaths::eStandardLocationTemp);

#if defined(Q_OS_MAC)
_imp->breakpadHandler.reset(new google_breakpad::ExceptionHandler( std::string(), 0, 0/*dmpcb*/, 0, true,
_imp->breakpadHandler.reset(new google_breakpad::ExceptionHandler( dumpPath.toStdString(),
0,
0/*dmpcb*/,
0,
true,
_imp->crashReporterBreakpadPipe.toStdString().c_str()));
#elif defined(Q_OS_LINUX)
_imp->breakpadHandler.reset(new google_breakpad::ExceptionHandler( google_breakpad::MinidumpDescriptor(std::string()), 0, 0/*dmpCb*/,
0, true, handle));
_imp->breakpadHandler.reset(new google_breakpad::ExceptionHandler( google_breakpad::MinidumpDescriptor(dumpPath.toStdString()),
0,
0/*dmpCb*/,
0,
true,
_imp->crashReporterBreakpadPipe.handle()));
#elif defined(Q_OS_WIN32)
_imp->breakpadHandler.reset(new google_breakpad::ExceptionHandler( std::wstring(), 0, 0/*dmpcb*/,
_imp->breakpadHandler.reset(new google_breakpad::ExceptionHandler( dumpPath.toStdWString(),
0,
0/*dmpcb*/,
google_breakpad::ExceptionHandler::HANDLER_ALL,
MiniDumpNormal,
filename.toStdWString(),
_imp->crashReporterBreakpadPipe.toStdWString().c_str(),
0));
#endif

Expand Down Expand Up @@ -3000,6 +3014,7 @@ bool interpretPythonScript(const std::string& script,std::string* error,std::str
}

if (error && !error->empty()) {
*error = "While executing script:\n" + script + "Python error:\n" + *error;
return false;
}
return true;
Expand Down Expand Up @@ -3307,4 +3322,40 @@ void getFunctionArguments(const std::string& pyFunc,std::string* error,std::vect
}
}

/**
* @brief Given a fullyQualifiedName, e.g: app1.Group1.Blur1
* this function returns the PyObject attribute of Blur1 if it is defined, or Group1 otherwise
* If app1 or Group1 does not exist at this point, this is a failure.
**/
PyObject*
getAttrRecursive(const std::string& fullyQualifiedName,PyObject* parentObj,bool* isDefined)
{
std::size_t foundDot = fullyQualifiedName.find(".");
std::string attrName = foundDot == std::string::npos ? fullyQualifiedName : fullyQualifiedName.substr(0, foundDot);
PyObject* obj = 0;
if (PyObject_HasAttrString(parentObj, attrName.c_str())) {
obj = PyObject_GetAttrString(parentObj, attrName.c_str());
}

///We either found the parent object or we are on the last object in which case we return the parent
if (!obj) {
//assert(fullyQualifiedName.find(".") == std::string::npos);
*isDefined = false;
return parentObj;
} else {
std::string recurseName;
if (foundDot != std::string::npos) {
recurseName = fullyQualifiedName;
recurseName.erase(0, foundDot + 1);
}
if (!recurseName.empty()) {
return getAttrRecursive(recurseName, obj, isDefined);
} else {
*isDefined = true;
return obj;
}
}

}

} //Namespace Natron
Loading

0 comments on commit 94e99c7

Please sign in to comment.