minor improvements

This commit is contained in:
itsmattkc
2019-09-17 21:25:00 +10:00
parent 1207e180ec
commit 16a4897236
3 changed files with 56 additions and 7 deletions
-7
View File
@@ -310,13 +310,6 @@ void Core::CreateNewSequence()
// Connect timeline end point to renderer
NodeParam::ConnectEdge(tb->length_output(), rp->length_input());
// FIXME: Test code
AlphaOverBlend* blend = new AlphaOverBlend();
new_sequence->AddNode(blend);
OpacityNode* opac = new OpacityNode();
new_sequence->AddNode(opac);
// End test code
vo->AttachViewer(olive::panel_focus_manager->MostRecentlyFocused<ViewerPanel>());
tb->AttachTimeline(olive::panel_focus_manager->MostRecentlyFocused<TimelinePanel>());
olive::panel_focus_manager->MostRecentlyFocused<NodePanel>()->SetGraph(new_sequence.get());
+34
View File
@@ -327,6 +327,26 @@ bool Node::OutputsTo(Node *n)
return false;
}
bool Node::HasInputs()
{
return HasParamOfType(NodeParam::kInput, false);
}
bool Node::HasOutputs()
{
return HasParamOfType(NodeParam::kOutput, false);
}
bool Node::HasConnectedInputs()
{
return HasParamOfType(NodeParam::kInput, true);
}
bool Node::HasConnectedOutputs()
{
return HasParamOfType(NodeParam::kOutput, true);
}
void Node::Hash(QCryptographicHash *hash, NodeOutput* from, const rational &time)
{
// Add this Node's ID
@@ -373,6 +393,20 @@ bool Node::HasParamWithID(const QString &id)
return false;
}
bool Node::HasParamOfType(NodeParam::Type type, bool must_be_connected)
{
QList<NodeParam*> params = parameters();
foreach (NodeParam* p, params) {
if (p->type() == type
&& (p->IsConnected() || !must_be_connected)) {
return true;
}
}
return false;
}
void Node::InputChanged(rational start, rational end)
{
InvalidateCache(start, end, static_cast<NodeInput*>(sender()));
+22
View File
@@ -153,6 +153,26 @@ public:
*/
bool OutputsTo(Node* n);
/**
* @brief Return whether this Node has input parameters
*/
bool HasInputs();
/**
* @brief Return whether this Node has output parameters
*/
bool HasOutputs();
/**
* @brief Return whether this Node has input parameters and at least one of them is connected
*/
bool HasConnectedInputs();
/**
* @brief Return whether this Node has output parameters and at least one of them is connected
*/
bool HasConnectedOutputs();
/**
* @brief Add's unique information about this Node at the given time to a QCryptographicHash
*/
@@ -270,6 +290,8 @@ private:
*/
bool HasParamWithID(const QString& id);
bool HasParamOfType(NodeParam::Type type, bool must_be_connected);
/**
* @brief The last timecode Process() was called with
*/