ui for output rows on nodes
This commit is contained in:
@@ -128,6 +128,10 @@ Effect::Effect(Clip* c, const EffectMeta *em) :
|
||||
expanded_(true),
|
||||
texture_ctx(nullptr)
|
||||
{
|
||||
if (em != nullptr) {
|
||||
// set up UI from effect metadata
|
||||
name = em->name;
|
||||
}
|
||||
}
|
||||
|
||||
Effect::~Effect() {
|
||||
|
||||
+24
-5
@@ -37,13 +37,18 @@
|
||||
#include "ui/keyframenavigator.h"
|
||||
#include "ui/clickablelabel.h"
|
||||
|
||||
EffectRow::EffectRow(Effect *parent, const QString &id, const QString &name, bool savable, bool keyframable) :
|
||||
EffectRow::EffectRow(Effect *parent,
|
||||
const QString &id,
|
||||
const QString &name,
|
||||
bool savable,
|
||||
bool keyframable) :
|
||||
QObject(parent),
|
||||
id_(id),
|
||||
name_(name),
|
||||
keyframable_(keyframable),
|
||||
keyframing_(false),
|
||||
savable_(savable)
|
||||
savable_(savable),
|
||||
output_type_(olive::nodes::kInvalid)
|
||||
{
|
||||
Q_ASSERT(parent != nullptr);
|
||||
|
||||
@@ -62,7 +67,9 @@ void EffectRow::AddField(EffectField *field)
|
||||
|
||||
void EffectRow::AddNodeInput(olive::nodes::DataType type)
|
||||
{
|
||||
accepted_datatypes_.append(type);
|
||||
Q_ASSERT(output_type_ == olive::nodes::kInvalid);
|
||||
|
||||
accepted_inputs_.append(type);
|
||||
}
|
||||
|
||||
bool EffectRow::IsKeyframing() {
|
||||
@@ -107,9 +114,21 @@ void EffectRow::SetEnabled(bool enabled)
|
||||
}
|
||||
}
|
||||
|
||||
bool EffectRow::CanConnectNodes()
|
||||
void EffectRow::SetOutputDataType(olive::nodes::DataType type)
|
||||
{
|
||||
return !accepted_datatypes_.isEmpty();
|
||||
Q_ASSERT(accepted_inputs_.isEmpty());
|
||||
|
||||
output_type_ = type;
|
||||
}
|
||||
|
||||
bool EffectRow::IsNodeInput()
|
||||
{
|
||||
return !accepted_inputs_.isEmpty();
|
||||
}
|
||||
|
||||
bool EffectRow::IsNodeOutput()
|
||||
{
|
||||
return output_type_ != olive::nodes::kInvalid;
|
||||
}
|
||||
|
||||
void EffectRow::SetKeyframingEnabled(bool enabled) {
|
||||
|
||||
+40
-6
@@ -51,6 +51,7 @@ class ClickableLabel;
|
||||
class EffectRow : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief EffectRow Constructor
|
||||
*
|
||||
@@ -82,7 +83,11 @@ public:
|
||||
* Whether keyframing can be enabled on this row or not. This is true by default. Some values you may want to prevent
|
||||
* the user from keyframing (e.g. the filename of a VST plugin), which can be done by setting this to false.
|
||||
*/
|
||||
EffectRow(Effect* parent, const QString& id, const QString& name, bool savable = true, bool keyframable = true);
|
||||
EffectRow(Effect* parent,
|
||||
const QString& id,
|
||||
const QString& name,
|
||||
bool savable = true,
|
||||
bool keyframable = true);
|
||||
|
||||
/**
|
||||
* @brief Retrieve the EffectField at this index. Must be less than FieldCount().
|
||||
@@ -212,15 +217,33 @@ public:
|
||||
void SetEnabled(bool enabled);
|
||||
|
||||
/**
|
||||
* @brief Check if nodes can be connected to this input.
|
||||
* @brief Check if nodes can be connected to this as an input.
|
||||
*
|
||||
* Connecting is enabled by adding an accepted node input using AddNodeInput().
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* TRUE if nodes can be connected.
|
||||
* TRUE if nodes can be connected as an input.
|
||||
*/
|
||||
bool CanConnectNodes();
|
||||
bool IsNodeInput();
|
||||
|
||||
/**
|
||||
* @brief Check if nodes can be connected to this as an output
|
||||
*
|
||||
* Connecting is enabled by setting an output data type in SetOutputDataType().
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* TRUE if nodes can be connected as an output
|
||||
*/
|
||||
bool IsNodeOutput();
|
||||
|
||||
/**
|
||||
* @brief Set output data type
|
||||
*
|
||||
* Set the type of data this row outputs to type
|
||||
*/
|
||||
void SetOutputDataType(olive::nodes::DataType type);
|
||||
|
||||
protected:
|
||||
/**
|
||||
@@ -365,9 +388,20 @@ private:
|
||||
QVector<EffectField*> fields_;
|
||||
|
||||
/**
|
||||
* @brief Internal array of accepted node data types
|
||||
* @brief Internal array of accepted node data types.
|
||||
*
|
||||
* Is mutally-exclusive with accepted_outputs_, i.e. you cannot have values added to this and also a value set in
|
||||
* accepted_outputs_.
|
||||
*/
|
||||
QVector<olive::nodes::DataType> accepted_datatypes_;
|
||||
QVector<olive::nodes::DataType> accepted_inputs_;
|
||||
|
||||
/**
|
||||
* @brief Internal value for what kind of data this row outputs
|
||||
*
|
||||
* Is mutally-exclusive with accepted_inputs_, i.e. you cannot have values added to it and also a value set in
|
||||
* this.
|
||||
*/
|
||||
olive::nodes::DataType output_type_;
|
||||
};
|
||||
|
||||
#endif // EFFECTROW_H
|
||||
|
||||
@@ -67,6 +67,10 @@ TransformEffect::TransformEffect(Clip* c, const EffectMeta* em) : Effect(c, em)
|
||||
opacity->SetMaximum(100);
|
||||
opacity->SetDefault(100);
|
||||
|
||||
// TEMP - Create matrix output
|
||||
EffectRow* matrix_output = new EffectRow(this, "matrix", "Matrix", false, false);
|
||||
matrix_output->SetOutputDataType(olive::nodes::kMatrix);
|
||||
|
||||
// set up gizmos
|
||||
top_left_gizmo = add_gizmo(GIZMO_TYPE_DOT);
|
||||
top_left_gizmo->set_cursor(Qt::SizeFDiagCursor);
|
||||
|
||||
Reference in New Issue
Block a user