began new infrastructure

Yep, this is another one of my "famous" sweeping rewrites. Expect things to break.

Goals for this are:
- Greatly simplify node connections (particularly with arrays) so the code requires less maintenance/is more stable
- Redesign node structure to address issues where UI would stall for lengthy periods of time
- Less reliance on shared ptrs/greater reliance on QObject system for inheritance/memory management
- General code cleanup and improvements
This commit is contained in:
itsmattkc
2021-01-05 11:20:38 +11:00
parent 19eabf2830
commit 181235f6ce
152 changed files with 3932 additions and 8166 deletions
+8 -14
View File
@@ -28,11 +28,10 @@ namespace olive {
MediaInput::MediaInput() :
connected_footage_(nullptr)
{
footage_input_ = new NodeInput("footage_in", NodeInput::kFootage);
footage_input_->set_connectable(false);
footage_input_->set_is_keyframable(false);
footage_input_ = new NodeInput(this, QStringLiteral("footage_in"), NodeValue::kFootage);
footage_input_->SetConnectable(false);
footage_input_->SetKeyframable(false);
connect(footage_input_, &NodeInput::ValueChanged, this, &MediaInput::FootageChanged);
AddInput(footage_input_);
}
QVector<Node::CategoryID> MediaInput::Category() const
@@ -42,17 +41,12 @@ QVector<Node::CategoryID> MediaInput::Category() const
Stream *MediaInput::stream() const
{
return Node::ValueToPtr<Stream>(footage_input_->get_standard_value());
return Node::ValueToPtr<Stream>(footage_input_->GetStandardValue());
}
void MediaInput::SetStream(Stream* s)
{
footage_input_->set_standard_value(Node::PtrToValue(s));
}
bool MediaInput::IsMedia() const
{
return true;
footage_input_->SetStandardValue(Node::PtrToValue(s));
}
void MediaInput::Retranslate()
@@ -68,7 +62,7 @@ NodeValueTable MediaInput::Value(NodeValueDatabase &value) const
rational media_duration = Timecode::timestamp_to_time(connected_footage_->duration(),
connected_footage_->timebase());
table.Push(NodeInput::kRational, QVariant::fromValue(media_duration), this, "length");
table.Push(NodeValue::kRational, QVariant::fromValue(media_duration), this, false, QStringLiteral("length"));
}
return table;
@@ -76,7 +70,7 @@ NodeValueTable MediaInput::Value(NodeValueDatabase &value) const
void MediaInput::FootageChanged()
{
Stream* new_footage = footage_input_->get_standard_value().value<Stream*>();
Stream* new_footage = footage_input_->GetStandardValue().value<Stream*>();
if (new_footage == connected_footage_) {
return;
@@ -95,7 +89,7 @@ void MediaInput::FootageChanged()
void MediaInput::FootageParametersChanged()
{
InvalidateCache(TimeRange(0, RATIONAL_MAX), footage_input_, footage_input_);
InvalidateCache(TimeRange(0, RATIONAL_MAX), InputConnection(footage_input_));
}
}
-2
View File
@@ -61,8 +61,6 @@ public:
Stream* stream() const;
void SetStream(Stream *s);
virtual bool IsMedia() const override;
virtual void Retranslate() override;
virtual NodeValueTable Value(NodeValueDatabase& value) const override;
+4 -3
View File
@@ -55,9 +55,10 @@ NodeValueTable TimeInput::Value(NodeValueDatabase &value) const
{
NodeValueTable table = value.Merge();
table.Push(NodeParam::kFloat,
value[QStringLiteral("global")].Get(NodeParam::kFloat, QStringLiteral("time_in")),
table.Push(NodeValue::kFloat,
value[QStringLiteral("global")].Get(NodeValue::kFloat, QStringLiteral("time_in")),
this,
false,
QStringLiteral("time"));
return table;
@@ -68,7 +69,7 @@ void TimeInput::Hash(QCryptographicHash &hash, const rational &time) const
Node::Hash(hash, time);
// Make sure time is hashed
hash.addData(NodeParam::ValueToBytes(NodeParam::kRational, QVariant::fromValue(time)));
hash.addData(NodeValue::ValueToBytes(NodeValue::kRational, QVariant::fromValue(time)));
}
}