preliminary support for multiple timeline sections
This commit is contained in:
@@ -107,9 +107,7 @@ void NodeParamViewItem::SetupUI()
|
||||
|
||||
int row_count = 0;
|
||||
|
||||
for (int i=0;i<first_node->ParameterCount();i++) {
|
||||
NodeParam* param = first_node->ParamAt(i);
|
||||
|
||||
foreach (NodeParam* param, first_node->parameters()) {
|
||||
// This widget only needs to show input parameters
|
||||
if (param->type() == NodeParam::kInput) {
|
||||
|
||||
@@ -141,9 +139,7 @@ void NodeParamViewItem::AddAdditionalNode(Node *n)
|
||||
{
|
||||
int bridge_count = 0;
|
||||
|
||||
for (int i=0;i<n->ParameterCount();i++) {
|
||||
NodeParam* param = n->ParamAt(i);
|
||||
|
||||
foreach (NodeParam* param, n->parameters()) {
|
||||
if (param->type() == NodeParam::kInput) {
|
||||
bridges_.at(bridge_count)->AddInput(static_cast<NodeInput*>(param));
|
||||
|
||||
@@ -162,9 +158,7 @@ void NodeParamViewItem::Retranslate()
|
||||
|
||||
int row_count = 0;
|
||||
|
||||
for (int i=0;i<first_node->ParameterCount();i++) {
|
||||
NodeParam* param = first_node->ParamAt(i);
|
||||
|
||||
foreach (NodeParam* param, first_node->parameters()) {
|
||||
// This widget only needs to show input parameters
|
||||
if (param->type() == NodeParam::kInput) {
|
||||
param_lbls_.at(row_count)->setText(tr("%1:").arg(param->name()));
|
||||
|
||||
@@ -127,9 +127,7 @@ void NodeView::AddNode(Node* node)
|
||||
scene_.addItem(item);
|
||||
|
||||
// Add a NodeViewEdge for each connection
|
||||
QList<NodeParam*> node_params = node->parameters();
|
||||
|
||||
foreach (NodeParam* param, node_params) {
|
||||
foreach (NodeParam* param, node->parameters()) {
|
||||
|
||||
// We only bother working with outputs since eventually this will cover all inputs too
|
||||
// (covering both would lead to duplicates since every edge connects to one input and one output)
|
||||
|
||||
@@ -105,7 +105,7 @@ void NodeViewItem::SetExpanded(bool e)
|
||||
|
||||
// If a node is connected, use its parameter count to set the height
|
||||
if (node_ != nullptr) {
|
||||
full_size_rect.adjust(0, 0, 0, node_text_padding_*2 + font_metrics.height() * node_->ParameterCount());
|
||||
full_size_rect.adjust(0, 0, 0, node_text_padding_*2 + font_metrics.height() * node_->parameters().size());
|
||||
}
|
||||
|
||||
// Store content_rect (the rect without the titlebar)
|
||||
@@ -127,7 +127,7 @@ QRectF NodeViewItem::GetParameterConnectorRect(int index)
|
||||
return QRectF();
|
||||
}
|
||||
|
||||
NodeParam* param = node_->ParamAt(index);
|
||||
NodeParam* param = node_->parameters().at(index);
|
||||
|
||||
QRectF connector_rect(rect().x(),
|
||||
content_rect_.y() + node_text_padding_ + font_metrics.height() / 2 - node_connector_size_ / 2,
|
||||
@@ -151,7 +151,7 @@ QPointF NodeViewItem::GetParameterTextPoint(int index)
|
||||
return QPointF();
|
||||
}
|
||||
|
||||
NodeParam* param = node_->ParamAt(index);
|
||||
NodeParam* param = node_->parameters().at(index);
|
||||
|
||||
if (param->type() == NodeParam::kOutput) {
|
||||
return content_rect_.topRight() + QPointF(-(node_connector_size_ + node_text_padding_),
|
||||
@@ -193,9 +193,8 @@ void NodeViewItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti
|
||||
// Store the text points which will steadily increase sa we loop
|
||||
|
||||
// Loop through all the parameters
|
||||
QList<NodeParam*> node_params = node_->parameters();
|
||||
for (int i=0;i<node_params.size();i++) {
|
||||
NodeParam* param = node_params.at(i);
|
||||
for (int i=0;i<node_->parameters().size();i++) {
|
||||
NodeParam* param = node_->parameters().at(i);
|
||||
|
||||
// Draw connector square
|
||||
painter->fillRect(GetParameterConnectorRect(i), connector_brush);
|
||||
@@ -274,11 +273,11 @@ void NodeViewItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
// See if the mouse click was on a parameter connector
|
||||
if (IsExpanded() // This is only possible if the node is expanded
|
||||
&& node_ != nullptr) { // We can only loop through a node's parameters if a valid node is attached
|
||||
for (int i=0;i<node_->ParameterCount();i++) {
|
||||
for (int i=0;i<node_->parameters().size();i++) {
|
||||
|
||||
if (GetParameterConnectorRect(i).contains(event->pos())) { // See if the cursor is in the rect
|
||||
|
||||
NodeParam* param = node_->ParamAt(i);
|
||||
NodeParam* param = node_->parameters().at(i);
|
||||
|
||||
// Create draggable object
|
||||
dragging_edge_ = new NodeViewEdge();
|
||||
@@ -369,7 +368,7 @@ void NodeViewItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
}
|
||||
|
||||
// See if the mouse is currently inside a connector rect
|
||||
for (int i=0;i<drop_item->node()->ParameterCount();i++) {
|
||||
for (int i=0;i<drop_item->node()->parameters().size();i++) {
|
||||
|
||||
// Make a larger "hitbox" rect to make it easier to drag into
|
||||
QRectF param_hitbox = drop_item->GetParameterConnectorRect(i).adjusted(-node_connector_size_,
|
||||
@@ -378,7 +377,7 @@ void NodeViewItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
|
||||
node_connector_size_);
|
||||
|
||||
// Get the parameter we're dragging into
|
||||
NodeParam* comp_param = drop_item->node()->ParamAt(i);
|
||||
NodeParam* comp_param = drop_item->node()->parameters().at(i);
|
||||
|
||||
if (param_hitbox.contains(drop_item->mapFromScene(event->scenePos())) // See if we're dragging inside the hitbox
|
||||
&& NodeParam::AreDataTypesCompatible(drag_src_param_, comp_param)) { // Make sure the types are compatible
|
||||
|
||||
@@ -163,7 +163,7 @@ void TimelineView::Clear()
|
||||
block_items_.clear();
|
||||
}
|
||||
|
||||
void TimelineView::ConnectTimelineNode(TimelineOutput *node)
|
||||
void TimelineView::ConnectTimelineNode(TrackList *node)
|
||||
{
|
||||
if (timeline_node_ != nullptr) {
|
||||
disconnect(timeline_node_, SIGNAL(TimebaseChanged(const rational&)), this, SIGNAL(TimebaseChanged(const rational&)));
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
|
||||
void SetScale(const double& scale);
|
||||
|
||||
void ConnectTimelineNode(TimelineOutput* node);
|
||||
void ConnectTimelineNode(TrackList* node);
|
||||
|
||||
void DisconnectTimelineNode();
|
||||
|
||||
@@ -338,7 +338,7 @@ private:
|
||||
HandTool hand_tool_;
|
||||
ZoomTool zoom_tool_;
|
||||
|
||||
TimelineOutput* timeline_node_;
|
||||
TrackList* timeline_node_;
|
||||
|
||||
void AddGhost(TimelineViewGhostItem* ghost);
|
||||
|
||||
|
||||
@@ -285,7 +285,7 @@ void TrackRippleRemoveAreaCommand::undo()
|
||||
track_->InvalidateCache(in_, out_);
|
||||
}
|
||||
|
||||
TrackPlaceBlockCommand::TrackPlaceBlockCommand(TimelineOutput* timeline, int track, Block *block, rational in, QUndoCommand *parent) :
|
||||
TrackPlaceBlockCommand::TrackPlaceBlockCommand(TrackList *timeline, int track, Block *block, rational in, QUndoCommand *parent) :
|
||||
TrackRippleRemoveAreaCommand(nullptr, in, 0, parent), // Out gets set correctly in redo()
|
||||
timeline_(timeline),
|
||||
track_index_(track),
|
||||
|
||||
@@ -159,13 +159,13 @@ protected:
|
||||
*/
|
||||
class TrackPlaceBlockCommand : public TrackRippleRemoveAreaCommand {
|
||||
public:
|
||||
TrackPlaceBlockCommand(TimelineOutput *timeline, int track, Block* block, rational in, QUndoCommand* parent = nullptr);
|
||||
TrackPlaceBlockCommand(TrackList *timeline, int track, Block* block, rational in, QUndoCommand* parent = nullptr);
|
||||
|
||||
virtual void redo() override;
|
||||
virtual void undo() override;
|
||||
|
||||
private:
|
||||
TimelineOutput* timeline_;
|
||||
TrackList* timeline_;
|
||||
int track_index_;
|
||||
bool append_;
|
||||
GapBlock* gap_;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
# Olive - Non-Linear Video Editor
|
||||
# Copyright (C) 2019 Olive Team
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
set(OLIVE_SOURCES
|
||||
${OLIVE_SOURCES}
|
||||
widget/timelinewidget/timelinewidget.h
|
||||
widget/timelinewidget/timelinewidget.cpp
|
||||
PARENT_SCOPE
|
||||
)
|
||||
@@ -107,8 +107,12 @@ void TimelineWidget::ConnectTimelineNode(TimelineOutput *node)
|
||||
{
|
||||
timeline_node_ = node;
|
||||
|
||||
int track_type = 0;
|
||||
|
||||
foreach (TimelineView* view, views_) {
|
||||
view->ConnectTimelineNode(node);
|
||||
view->ConnectTimelineNode(node->track_list(static_cast<TimelineOutput::TrackType>(track_type)));
|
||||
|
||||
track_type++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,11 +149,6 @@ void TimelineWidget::DeselectAll()
|
||||
}
|
||||
}
|
||||
|
||||
TimelineView *TimelineWidget::GetView(const TimelineWidget::ViewType &view_type)
|
||||
{
|
||||
return views_.at(view_type);
|
||||
}
|
||||
|
||||
void TimelineWidget::RippleToIn()
|
||||
{
|
||||
RippleEditTo(olive::timeline::kTrimIn, false);
|
||||
|
||||
@@ -56,13 +56,6 @@ signals:
|
||||
void TimeChanged(const int64_t& time);
|
||||
|
||||
private:
|
||||
enum ViewType {
|
||||
kVideo,
|
||||
kAudio
|
||||
};
|
||||
|
||||
TimelineView* GetView(const ViewType& view_type);
|
||||
|
||||
void RippleEditTo(olive::timeline::MovementMode mode, bool insert_gaps);
|
||||
|
||||
void SetTimeAndSignal(const int64_t& t);
|
||||
|
||||
Reference in New Issue
Block a user