Skip to content

Commit

Permalink
CHANGES:...
Browse files Browse the repository at this point in the history
- Curve: re-work the way strings animation was handled within the engine. Rather than have a separate StringAnimationmanager that would take care of handling string animation, the Curve class can handle everything on its own. Each KeyFrame now has optional properties (by default it has none) which are not interpolated. For string parameters, each keyframe has a string property.

- Add a new Knob type: KnobKeyFrameMarkers which enables to create keyframes without a data type: useful to create specific timeline markers. This is used for example by the Roto node to track user keyframes on the shapes, or by the Tracker to handle manual keyframes on a track.

-An effect may now have multiple KnobItemsTable of different types. E.g: an effect could have a table with e.g: "Actors" and another table with e.g: "Rushes".
  • Loading branch information
MrKepzie committed Jul 31, 2017
1 parent 9c6efa3 commit d0a4ddf
Show file tree
Hide file tree
Showing 118 changed files with 3,509 additions and 4,517 deletions.
17 changes: 12 additions & 5 deletions Documentation/source/devel/PythonReference/NatronEngine/Effect.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ Functions
* def :meth:`getPremult<NatronEngine.Effect.getPremult>` ()
* def :meth:`getPixelAspectRatio<NatronEngine.Effect.getPixelAspectRatio>` ()
* def :meth:`getRegionOfDefinition<NatronEngine.Effect.getRegionOfDefinition>` (time,view)
* def :meth:`getItemsTable<NatronEngine.Effect.getItemsTable>` ()
* def :meth:`getItemsTable<NatronEngine.Effect.getItemsTable>` (tableName)
* def :meth:`getAllItemsTable<NatronEngine.Effect.getAllItemsTable>` ()
* def :meth:`getScriptName<NatronEngine.Effect.getScriptName>` ()
* def :meth:`getSize<NatronEngine.Effect.getSize>` ()
* def :meth:`getUserPageParam<NatronEngine.Effect.getUserPageParam>` ()
Expand Down Expand Up @@ -412,15 +413,21 @@ for the "Output".
This can be useful for example to set the position of a point parameter to the center
of the region of definition.

.. method:: NatronEngine.Effect.getItemsTable()

.. method:: NatronEngine.Effect.getItemsTable(tableName)

:param tableName: :class:`str<PySide.QtCore.QString>`
:rtype: :class:`ItemsTable<NatronEngine.ItemsTable>`

Returns the items table if this node has any. An :ref:`ItemsTable<ItemsTable>` is used
for example in the Tracker node to display the tracks or in the RotoPaint node to display
Returns the items table matching the given *tableName*.
An :ref:`ItemsTable<ItemsTable>` is used for example in the Tracker node to display the tracks or in the RotoPaint node to display
the shapes and strokes in the properties panel.

.. method:: NatronEngine.Effect.getItemsTable()

:rtype: :class:`PyList`

Returns a list of all :ref:`ItemsTable<ItemsTable>`held by the node.


.. method:: NatronEngine.Effect.getScriptName()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Functions
* def :meth:`insertItem<NatronEngine.ItemsTable.insertItem>`(index,item,parent)
* def :meth:`removeItem<NatronEngine.ItemsTable.removeItem>`(item)
* def :meth:`getAttributeName<NatronEngine.ItemsTable.getAttributeName>`()
* def :meth:`getTableName<NatronEngine.ItemsTable.getTableName>`()
* def :meth:`isModelParentingEnabled<NatronEngine.ItemsTable.isModelParentingEnabled>`()
.. _itemsTable.details:
Expand Down Expand Up @@ -130,6 +131,15 @@ Member functions description
Returns the name of the Python attribute :ref:`automatically declared<autoVar>` by Natron
under which table items are automatically defined. For example, for the RotoPaint node,
items are declared under the **roto** attribute.

.. method:: NatronEngine.ItemsTable.getTableName ()

:rtype: :class:`str<PySide.QtCore.QString>`

Returns the name of the table: this is used to identify uniquely the kind of objects
a table may handle. Since a node may have multiple tables, each table must have a different
name.


.. method:: NatronEngine.ItemsTable.isModelParentingEnabled()

Expand Down
162 changes: 34 additions & 128 deletions Engine/AnimatingObjectI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,20 @@

NATRON_NAMESPACE_ENTER

struct AnimatingObjectIPrivate
struct SplittableViewsI::Implementation
{
mutable QMutex viewsMutex;
std::list<ViewIdx> views;

AnimatingObjectIPrivate()

Implementation()
: viewsMutex()
, views()
{
views.push_back(ViewIdx(0));
}

AnimatingObjectIPrivate(const AnimatingObjectIPrivate& other)
Implementation(const Implementation& other)
: viewsMutex()
, views()
{
Expand All @@ -65,32 +66,35 @@ struct AnimatingObjectIPrivate
}
};

AnimatingObjectI::AnimatingObjectI()
: _imp(new AnimatingObjectIPrivate())
SplittableViewsI::SplittableViewsI()
: _imp(new Implementation)
{

}

AnimatingObjectI::AnimatingObjectI(const boost::shared_ptr<AnimatingObjectI>& other, const FrameViewRenderKey& /*key*/)
: _imp(new AnimatingObjectIPrivate(*other->_imp))

SplittableViewsI::SplittableViewsI(const boost::shared_ptr<SplittableViewsI>& other, const FrameViewRenderKey& /*key*/)
: _imp(new Implementation(*other->_imp))
{

}

AnimatingObjectI::~AnimatingObjectI()


SplittableViewsI::~SplittableViewsI()
{

}

std::list<ViewIdx>
AnimatingObjectI::getViewsList() const
SplittableViewsI::getViewsList() const
{
QMutexLocker k(&_imp->viewsMutex);
return _imp->views;
}

ViewIdx
AnimatingObjectI::checkIfViewExistsOrFallbackMainView(ViewIdx view) const
SplittableViewsI::checkIfViewExistsOrFallbackMainView(ViewIdx view) const
{

// Find the view. If it is not in the split views, fallback on the main view.
Expand All @@ -100,7 +104,7 @@ AnimatingObjectI::checkIfViewExistsOrFallbackMainView(ViewIdx view) const
} // checkIfViewExistsOrFallbackMainView

bool
AnimatingObjectI::splitView(ViewIdx view)
SplittableViewsI::splitView(ViewIdx view)
{
if (!canSplitViews()) {
return false;
Expand All @@ -118,7 +122,7 @@ AnimatingObjectI::splitView(ViewIdx view)
}

bool
AnimatingObjectI::unSplitView(ViewIdx view)
SplittableViewsI::unSplitView(ViewIdx view)
{
// Cannot split the main view
if (view == 0) {
Expand All @@ -144,7 +148,7 @@ AnimatingObjectI::unSplitView(ViewIdx view)
}

void
AnimatingObjectI::unSplitAllViews()
SplittableViewsI::unSplitAllViews()
{
std::list<ViewIdx> views = getViewsList();
for (std::list<ViewIdx>::iterator it = views.begin(); it != views.end(); ++it) {
Expand All @@ -155,141 +159,43 @@ AnimatingObjectI::unSplitAllViews()
}
}

AnimatingObjectI::~AnimatingObjectI() {}

ValueChangedReturnCodeEnum
AnimatingObjectI::setIntValueAtTime(TimeValue /*time*/, int /*value*/, ViewSetSpec /*view*/, DimSpec /*dimension*/, ValueChangedReasonEnum /*reason*/, KeyFrame* /*newKey*/)
AnimatingObjectI::SetKeyFrameArgs::SetKeyFrameArgs()
: view(ViewSetSpec::all())
, dimension(0)
, flags(eSetKeyFrameFlagSetValue | eSetKeyFrameFlagMergeProperties)
, reason(eValueChangedReasonUserEdited)
, callKnobChangedHandlerEvenIfNothingChanged(false)
{
if (getKeyFrameDataType() != eCurveTypeInt) {
throw std::invalid_argument("Invalid call to setIntValueAtTime on an object that does not support integer");
}
return eValueChangedReturnCodeNothingChanged;
}

ValueChangedReturnCodeEnum
AnimatingObjectI::setDoubleValueAtTime(TimeValue /*time*/, double /*value*/, ViewSetSpec /*view*/, DimSpec /*dimension*/, ValueChangedReasonEnum /*reason*/, KeyFrame* /*newKey*/)
{
if (getKeyFrameDataType() != eCurveTypeDouble) {
throw std::invalid_argument("Invalid call to setDoubleValueAtTime on an object that does not support double");
}
return eValueChangedReturnCodeNothingChanged;
}

ValueChangedReturnCodeEnum
AnimatingObjectI::setBoolValueAtTime(TimeValue /*time*/, bool /*value*/, ViewSetSpec /*view*/, DimSpec /*dimension*/, ValueChangedReasonEnum /*reason*/, KeyFrame* /*newKey*/)
void
AnimatingObjectI::SetKeyFrameArgs::operator=(const SetKeyFrameArgs &o)
{
if (getKeyFrameDataType() != eCurveTypeBool) {
throw std::invalid_argument("Invalid call to setBoolValueAtTime on an object that does not support bool");
}
return eValueChangedReturnCodeNothingChanged;
view = o.view;
dimension = o.dimension;
flags = o.flags;
reason = o.reason;
callKnobChangedHandlerEvenIfNothingChanged = o.callKnobChangedHandlerEvenIfNothingChanged;
}

ValueChangedReturnCodeEnum
AnimatingObjectI::setStringValueAtTime(TimeValue /*time*/, const std::string& /*value*/, ViewSetSpec /*view*/, DimSpec /*dimension*/, ValueChangedReasonEnum /*reason*/, KeyFrame* /*newKey*/)
AnimatingObjectI::setKeyFrame(const SetKeyFrameArgs& /*args*/, const KeyFrame& /*value*/)
{
if (getKeyFrameDataType() != eCurveTypeString) {
throw std::invalid_argument("Invalid call to setStringValueAtTime on an object that does not support string");
}
return eValueChangedReturnCodeNothingChanged;
}

void
AnimatingObjectI::setMultipleIntValueAtTime(const std::list<IntTimeValuePair>& /*keys*/, ViewSetSpec /*view*/, DimSpec /*dimension*/, ValueChangedReasonEnum /*reason*/, std::vector<KeyFrame>* /*newKey*/)
{
if (getKeyFrameDataType() != eCurveTypeInt) {
throw std::invalid_argument("Invalid call to setMultipleIntValueAtTime on an object that does not support integer");
}
}

void
AnimatingObjectI::setMultipleDoubleValueAtTime(const std::list<DoubleTimeValuePair>& /*keys*/, ViewSetSpec /*view*/, DimSpec /*dimension*/, ValueChangedReasonEnum /*reason*/, std::vector<KeyFrame>* /*newKey*/)
{
if (getKeyFrameDataType() != eCurveTypeDouble) {
throw std::invalid_argument("Invalid call to setMultipleDoubleValueAtTime on an object that does not support double");
}
}


void
AnimatingObjectI::setMultipleBoolValueAtTime(const std::list<BoolTimeValuePair>& /*keys*/, ViewSetSpec /*view*/, DimSpec /*dimension*/, ValueChangedReasonEnum /*reason*/, std::vector<KeyFrame>* /*newKey*/)
{
if (getKeyFrameDataType() != eCurveTypeBool) {
throw std::invalid_argument("Invalid call to setMultipleBoolValueAtTime on an object that does not support boolean");
}
}

void
AnimatingObjectI::setMultipleStringValueAtTime(const std::list<StringTimeValuePair>& /*keys*/, ViewSetSpec /*view*/, DimSpec /*dimension*/, ValueChangedReasonEnum /*reason*/, std::vector<KeyFrame>* /*newKey*/)
{
if (getKeyFrameDataType() != eCurveTypeString) {
throw std::invalid_argument("Invalid call to setMultipleStringValueAtTime on an object that does not support string");
}
}

void
AnimatingObjectI::setIntValueAtTimeAcrossDimensions(TimeValue /*time*/, const std::vector<int>& /*values*/, DimIdx /*dimensionStartIndex*/, ViewSetSpec /*view*/, ValueChangedReasonEnum /*reason*/, std::vector<ValueChangedReturnCodeEnum>* /*retCodes*/)
{
if (getKeyFrameDataType() != eCurveTypeInt) {
throw std::invalid_argument("Invalid call to setIntValueAtTimeAcrossDimensions on an object that does not support integer");
}
}

void
AnimatingObjectI::setDoubleValueAtTimeAcrossDimensions(TimeValue /*time*/, const std::vector<double>& /*values*/, DimIdx /*dimensionStartIndex*/, ViewSetSpec /*view*/, ValueChangedReasonEnum /*reason*/, std::vector<ValueChangedReturnCodeEnum>* /*retCodes*/)
{
if (getKeyFrameDataType() != eCurveTypeDouble) {
throw std::invalid_argument("Invalid call to setDoubleValueAtTimeAcrossDimensions on an object that does not support double");
}

}

void
AnimatingObjectI::setBoolValueAtTimeAcrossDimensions(TimeValue /*time*/, const std::vector<bool>& /*values*/, DimIdx /*dimensionStartIndex*/, ViewSetSpec /*view*/, ValueChangedReasonEnum /*reason*/, std::vector<ValueChangedReturnCodeEnum>* /*retCodes*/)
{
if (getKeyFrameDataType() != eCurveTypeBool) {
throw std::invalid_argument("Invalid call to setBoolValueAtTimeAcrossDimensions on an object that does not support boolean");
}
}

void
AnimatingObjectI::setStringValueAtTimeAcrossDimensions(TimeValue /*time*/, const std::vector<std::string>& /*values*/, DimIdx /*dimensionStartIndex*/, ViewSetSpec /*view*/, ValueChangedReasonEnum /*reason*/, std::vector<ValueChangedReturnCodeEnum>* /*retCodes*/)
{
if (getKeyFrameDataType() != eCurveTypeString) {
throw std::invalid_argument("Invalid call to setStringValueAtTimeAcrossDimensions on an object that does not support string");
}
}

void
AnimatingObjectI::setMultipleIntValueAtTimeAcrossDimensions(const PerCurveIntValuesList& /*keysPerDimension*/, ValueChangedReasonEnum /*reason*/)
{
if (getKeyFrameDataType() != eCurveTypeInt) {
throw std::invalid_argument("Invalid call to setMultipleIntValueAtTimeAcrossDimensions on an object that does not support integer");
}
}

void
AnimatingObjectI::setMultipleDoubleValueAtTimeAcrossDimensions(const PerCurveDoubleValuesList& /*keysPerDimension*/, ValueChangedReasonEnum /*reason*/)
AnimatingObjectI::setMultipleKeyFrames(const SetKeyFrameArgs& /*args*/, const std::list<KeyFrame>& /*keys*/)
{
if (getKeyFrameDataType() != eCurveTypeDouble) {
throw std::invalid_argument("Invalid call to setMultipleDoubleValueAtTimeAcrossDimensions on an object that does not support double");
}
}


void
AnimatingObjectI::setMultipleBoolValueAtTimeAcrossDimensions(const PerCurveBoolValuesList& /*keysPerDimension*/, ValueChangedReasonEnum /*reason*/)
AnimatingObjectI::setKeyFramesAcrossDimensions(const SetKeyFrameArgs& /*args*/,const std::vector<KeyFrame>& /*values*/, DimIdx /*dimensionStartIndex*/,std::vector<ValueChangedReturnCodeEnum>* /*retCodes*/)
{
if (getKeyFrameDataType() != eCurveTypeBool) {
throw std::invalid_argument("Invalid call to setMultipleBoolValueAtTimeAcrossDimensions on an object that does not support boolean");
}
}


void
AnimatingObjectI::setMultipleStringValueAtTimeAcrossDimensions(const PerCurveStringValuesList& /*keysPerDimension*/, ValueChangedReasonEnum /*reason*/)
{
if (getKeyFrameDataType() != eCurveTypeString) {
throw std::invalid_argument("Invalid call to setMultipleStringValueAtTimeAcrossDimensions on an object that does not support string");
}
}


Expand Down
Loading

0 comments on commit d0a4ddf

Please sign in to comment.