timeline: various work to improve timeline behavior, particularly when dealing with transitions
This commit is contained in:
@@ -256,6 +256,39 @@ NodeValueTable TransitionBlock::Value(NodeValueDatabase &value) const
|
||||
return table;
|
||||
}
|
||||
|
||||
TransitionBlock *GetBlockTransitionInternal(Block *block, Timeline::MovementMode mode)
|
||||
{
|
||||
// See if this block outputs to a transition
|
||||
foreach (NodeEdgePtr edge, block->output()->edges()) {
|
||||
Node* connected_node = edge->input()->parentNode();
|
||||
|
||||
if (connected_node->IsBlock()) {
|
||||
Block* connected_block = static_cast<Block*>(connected_node);
|
||||
|
||||
if (connected_block->type() == Block::kTransition) {
|
||||
TransitionBlock* connected_transition = static_cast<TransitionBlock*>(connected_block);
|
||||
|
||||
if ((mode == Timeline::kTrimIn && edge->input() == connected_transition->in_block_input())
|
||||
|| (mode == Timeline::kTrimOut && edge->input() == connected_transition->out_block_input())) {
|
||||
return connected_transition;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
TransitionBlock *TransitionBlock::GetBlockInTransition(Block *block)
|
||||
{
|
||||
return GetBlockTransitionInternal(block, Timeline::kTrimIn);
|
||||
}
|
||||
|
||||
TransitionBlock *TransitionBlock::GetBlockOutTransition(Block *block)
|
||||
{
|
||||
return GetBlockTransitionInternal(block, Timeline::kTrimOut);
|
||||
}
|
||||
|
||||
void TransitionBlock::ShaderJobEvent(NodeValueDatabase &value, ShaderJob &job) const
|
||||
{
|
||||
Q_UNUSED(value)
|
||||
|
||||
@@ -51,6 +51,10 @@ public:
|
||||
|
||||
virtual NodeValueTable Value(NodeValueDatabase &value) const override;
|
||||
|
||||
static TransitionBlock* GetBlockInTransition(Block* block);
|
||||
|
||||
static TransitionBlock* GetBlockOutTransition(Block* block);
|
||||
|
||||
protected:
|
||||
virtual void ShaderJobEvent(NodeValueDatabase &value, ShaderJob& job) const;
|
||||
|
||||
|
||||
+5
-2
@@ -556,7 +556,7 @@ bool Node::OutputsTo(const QString &id, bool recursively) const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Node::OutputsTo(NodeInput *input, bool recursively) const
|
||||
bool Node::OutputsTo(NodeInput *input, bool recursively, bool include_arrays) const
|
||||
{
|
||||
QList<NodeOutput*> outputs = GetOutputs();
|
||||
|
||||
@@ -566,7 +566,10 @@ bool Node::OutputsTo(NodeInput *input, bool recursively) const
|
||||
|
||||
if (connected == input) {
|
||||
return true;
|
||||
} else if (recursively && connected->parentNode()->OutputsTo(input, recursively)) {
|
||||
} else if (include_arrays && input->IsArray()
|
||||
&& static_cast<NodeInputArray*>(input)->sub_params().contains(connected)) {
|
||||
return true;
|
||||
} else if (recursively && connected->parentNode()->OutputsTo(input, recursively, include_arrays)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -224,7 +224,7 @@ public:
|
||||
/**
|
||||
* @brief Same as OutputsTo(Node*), but for a specific node input rather than just a node.
|
||||
*/
|
||||
bool OutputsTo(NodeInput* input, bool recursively) const;
|
||||
bool OutputsTo(NodeInput* input, bool recursively, bool include_arrays) const;
|
||||
|
||||
/**
|
||||
* @brief Returns whether this node ever receives an input from a particular node instance
|
||||
|
||||
Reference in New Issue
Block a user