some timeline work
This commit is contained in:
@@ -53,6 +53,11 @@ public:
|
||||
*/
|
||||
void AddNodeWithDependencies(Node* node);
|
||||
|
||||
/**
|
||||
* @brief Removes a Node from the graph and destroys it
|
||||
*/
|
||||
void RemoveNode(Node* node);
|
||||
|
||||
/**
|
||||
* @brief Retrieve a complete list of the nodes belonging to this graph
|
||||
*/
|
||||
|
||||
@@ -55,6 +55,11 @@ private:
|
||||
*/
|
||||
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
|
||||
*
|
||||
@@ -107,6 +112,26 @@ private slots:
|
||||
* the Sequence, a GapBlock is inserted to compensate.
|
||||
*/
|
||||
void PlaceBlock(Block* block, rational start);
|
||||
|
||||
/**
|
||||
* @brief Removes a Block and places a Gap in its place
|
||||
*/
|
||||
void RemoveBlock(Block* block);
|
||||
|
||||
/**
|
||||
* @brief Removes a Block pushing all subsequent Blocks earlier to take up the space
|
||||
*/
|
||||
void RippleRemoveBlock(Block* block);
|
||||
|
||||
/**
|
||||
* @brief Removes the Block at the given index pushing all subsequent Blocks earlier to take up the space
|
||||
*/
|
||||
void RippleRemoveBlockAtIndex(int index);
|
||||
|
||||
/**
|
||||
* @brief Removes the last Block of the Sequence at the given index
|
||||
*/
|
||||
void RippleRemoveLast();
|
||||
};
|
||||
|
||||
#endif // TIMELINEOUTPUT_H
|
||||
|
||||
@@ -75,6 +75,11 @@ void TimelinePanel::SetTimebase(const rational &timebase)
|
||||
view_->SetTimebase(timebase);
|
||||
}
|
||||
|
||||
TimelineView *TimelinePanel::view()
|
||||
{
|
||||
return view_;
|
||||
}
|
||||
|
||||
void TimelinePanel::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
|
||||
@@ -39,13 +39,12 @@ public:
|
||||
|
||||
void SetTimebase(const rational& timebase);
|
||||
|
||||
TimelineView* view();
|
||||
|
||||
protected:
|
||||
virtual void changeEvent(QEvent* e) override;
|
||||
|
||||
signals:
|
||||
void RequestInsertBlockAtIndex(Block*, int);
|
||||
|
||||
void RequestPlaceBlock(Block* block, rational start);
|
||||
|
||||
private:
|
||||
void Retranslate();
|
||||
|
||||
@@ -61,6 +61,8 @@ signals:
|
||||
|
||||
void RequestPlaceBlock(Block* block, rational start);
|
||||
|
||||
void RequestInsertBlockAtTime(Block* block, rational time);
|
||||
|
||||
protected:
|
||||
virtual void mousePressEvent(QMouseEvent *event) override;
|
||||
virtual void mouseMoveEvent(QMouseEvent *event) override;
|
||||
|
||||
@@ -111,18 +111,30 @@ void TimelineView::ImportTool::DragLeave(QDragLeaveEvent *event)
|
||||
void TimelineView::ImportTool::DragDrop(QDropEvent *event)
|
||||
{
|
||||
if (parent()->HasGhosts()) {
|
||||
// We use QObject as the parent for the nodes we create. If there is no TimelineOutput node, this object going out
|
||||
// of scope will delete the nodes. If there is, they'll become parents of the NodeGraph instead
|
||||
QObject node_memory_manager;
|
||||
|
||||
foreach (TimelineViewGhostItem* ghost, parent()->ghost_items_) {
|
||||
ClipBlock* clip = new ClipBlock();
|
||||
MediaInput* media = new MediaInput();
|
||||
|
||||
// Set parents to node_memory_manager in case no TimelineOutput receives this signal
|
||||
// FIXME: Moving nodes to shared_ptrs might be a better idea, except they all use the QObject system for hierarchy
|
||||
// already...
|
||||
clip->setParent(&node_memory_manager);
|
||||
media->setParent(&node_memory_manager);
|
||||
|
||||
clip->set_length(ghost->Out() - ghost->In());
|
||||
media->SetFootage(ghost->stream()->footage());
|
||||
|
||||
NodeParam::ConnectEdge(media->texture_output(), clip->texture_input());
|
||||
|
||||
// FIXME: If this doesn't have a TimelineOutput node attached, this is a memory leak. Maybe switching nodes to
|
||||
// shared ptrs would be a better idea.
|
||||
emit parent()->RequestPlaceBlock(clip, ghost->In());
|
||||
if (event->keyboardModifiers() & Qt::ControlModifier) {
|
||||
emit parent()->RequestPlaceBlock(clip, ghost->In());
|
||||
} else {
|
||||
emit parent()->RequestInsertBlockAtTime(clip, ghost->In());
|
||||
}
|
||||
}
|
||||
|
||||
parent()->ClearGhosts();
|
||||
|
||||
Reference in New Issue
Block a user