timeline import interaction progress
This commit is contained in:
@@ -59,10 +59,10 @@ QString TimelineOutput::Description()
|
||||
void TimelineOutput::AttachTimeline(TimelinePanel *timeline)
|
||||
{
|
||||
if (attached_timeline_ != nullptr) {
|
||||
//TimelineView* view = attached_timeline_->view();
|
||||
TimelineView* view = attached_timeline_->view();
|
||||
|
||||
//disconnect(view, SIGNAL(RequestInsertBlockAtIndex(Block*, int)), this, SLOT(InsertBlockAtIndex(Block*, int)));
|
||||
//disconnect(view, SIGNAL(RequestPlaceBlock(Block*, rational)), this, SLOT(PlaceBlock(Block*, rational)));
|
||||
disconnect(view, SIGNAL(RequestPlaceBlock(Block*, rational, int)), this, SLOT(PlaceBlock(Block*, rational, int)));
|
||||
|
||||
// Remove existing UI objects from TimelinePanel
|
||||
attached_timeline_->Clear();
|
||||
@@ -80,10 +80,10 @@ void TimelineOutput::AttachTimeline(TimelinePanel *timeline)
|
||||
track->GenerateBlockWidgets();
|
||||
}
|
||||
|
||||
//TimelineView* view = attached_timeline_->view();
|
||||
TimelineView* view = attached_timeline_->view();
|
||||
|
||||
//connect(view, SIGNAL(RequestInsertBlockAtIndex(Block*, int)), this, SLOT(InsertBlockAtIndex(Block*, int)));
|
||||
//connect(view, SIGNAL(RequestPlaceBlock(Block*, rational)), this, SLOT(PlaceBlock(Block*, rational)));
|
||||
connect(view, SIGNAL(RequestPlaceBlock(Block*, rational, int)), this, SLOT(PlaceBlock(Block*, rational, int)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -158,6 +158,18 @@ void TimelineOutput::DetachTrack(TrackOutput *track)
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineOutput::AddTrack()
|
||||
{
|
||||
TrackOutput* track = new TrackOutput();
|
||||
static_cast<NodeGraph*>(parent())->AddNode(track);
|
||||
|
||||
if (track_cache_.isEmpty()) {
|
||||
NodeParam::ConnectEdge(track->track_output(), track_input());
|
||||
} else {
|
||||
NodeParam::ConnectEdge(track->track_output(), track_cache_.last()->track_input());
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineOutput::TrackConnectionAdded(NodeEdgePtr edge)
|
||||
{
|
||||
if (edge->input() != track_input()) {
|
||||
@@ -189,9 +201,7 @@ void TimelineOutput::TrackConnectionRemoved(NodeEdgePtr edge)
|
||||
void TimelineOutput::TrackAddedBlock(Block *block)
|
||||
{
|
||||
if (attached_timeline_ != nullptr) {
|
||||
qDebug() << "track index lmao:" << GetTrackIndex(static_cast<TrackOutput*>(sender()));
|
||||
|
||||
attached_timeline_->view()->AddBlock(block);
|
||||
attached_timeline_->view()->AddBlock(block, GetTrackIndex(static_cast<TrackOutput*>(sender())));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -227,3 +237,12 @@ void TimelineOutput::TrackEdgeRemoved(NodeEdgePtr edge)
|
||||
DetachTrack(added_track);
|
||||
}
|
||||
}
|
||||
|
||||
void TimelineOutput::PlaceBlock(Block *block, rational start, int track)
|
||||
{
|
||||
while (track >= track_cache_.size()) {
|
||||
AddTrack();
|
||||
}
|
||||
|
||||
track_cache_.at(track)->PlaceBlock(block, start);
|
||||
}
|
||||
|
||||
@@ -57,6 +57,8 @@ private:
|
||||
|
||||
void DetachTrack(TrackOutput* track);
|
||||
|
||||
void AddTrack();
|
||||
|
||||
TimelinePanel* attached_timeline_;
|
||||
|
||||
NodeInput* track_input_;
|
||||
@@ -97,6 +99,11 @@ private slots:
|
||||
*/
|
||||
void TrackEdgeRemoved(NodeEdgePtr edge);
|
||||
|
||||
/**
|
||||
* @brief Forwards a PlaceBlock signal to the requested track
|
||||
*/
|
||||
void PlaceBlock(Block* block, rational start, int track);
|
||||
|
||||
};
|
||||
|
||||
#endif // TIMELINEOUTPUT_H
|
||||
|
||||
@@ -56,49 +56,6 @@ public:
|
||||
|
||||
NodeOutput* track_output();
|
||||
|
||||
signals:
|
||||
/**
|
||||
* @brief Signal emitted when a Block is added to this Track
|
||||
*/
|
||||
void BlockAdded(Block* block);
|
||||
|
||||
/**
|
||||
* @brief Signal emitted when a Block is removed from this Track
|
||||
*/
|
||||
void BlockRemoved(Block* block);
|
||||
|
||||
public slots:
|
||||
virtual void Process(const rational &time) override;
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Sets this Block as the only block in the Timeline (creating essentially a one clip sequence)
|
||||
*/
|
||||
void ConnectBlockInternal(Block* block);
|
||||
|
||||
/**
|
||||
* @brief Disconnects t
|
||||
*/
|
||||
void RemoveBlockInternal();
|
||||
|
||||
/**
|
||||
* @brief Adds a Block to the parent graph so it can be connected to other Nodes
|
||||
*
|
||||
* Also runs through Node's dependencies (the Nodes whose outputs are connected to this Node's inputs)
|
||||
*/
|
||||
void AddBlockToGraph(Block* block);
|
||||
|
||||
Block* attached_block();
|
||||
|
||||
QVector<Block*> block_cache_;
|
||||
|
||||
Block* current_block_;
|
||||
|
||||
NodeInput* track_input_;
|
||||
|
||||
NodeOutput* track_output_;
|
||||
|
||||
private slots:
|
||||
/**
|
||||
* @brief Adds Block `block` at the very beginning of the Sequence before all other clips
|
||||
*/
|
||||
@@ -160,6 +117,51 @@ private slots:
|
||||
* length
|
||||
*/
|
||||
void SpliceBlock(Block* inner, Block* outer, rational inner_in);
|
||||
|
||||
signals:
|
||||
/**
|
||||
* @brief Signal emitted when a Block is added to this Track
|
||||
*/
|
||||
void BlockAdded(Block* block);
|
||||
|
||||
/**
|
||||
* @brief Signal emitted when a Block is removed from this Track
|
||||
*/
|
||||
void BlockRemoved(Block* block);
|
||||
|
||||
public slots:
|
||||
virtual void Process(const rational &time) override;
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief Sets this Block as the only block in the Timeline (creating essentially a one clip sequence)
|
||||
*/
|
||||
void ConnectBlockInternal(Block* block);
|
||||
|
||||
/**
|
||||
* @brief Disconnects t
|
||||
*/
|
||||
void RemoveBlockInternal();
|
||||
|
||||
/**
|
||||
* @brief Adds a Block to the parent graph so it can be connected to other Nodes
|
||||
*
|
||||
* Also runs through Node's dependencies (the Nodes whose outputs are connected to this Node's inputs)
|
||||
*/
|
||||
void AddBlockToGraph(Block* block);
|
||||
|
||||
Block* attached_block();
|
||||
|
||||
QVector<Block*> block_cache_;
|
||||
|
||||
Block* current_block_;
|
||||
|
||||
NodeInput* track_input_;
|
||||
|
||||
NodeOutput* track_output_;
|
||||
|
||||
private slots:
|
||||
|
||||
};
|
||||
|
||||
#endif // TRACKOUTPUT_H
|
||||
|
||||
Reference in New Issue
Block a user