arranged items so they are inputs of folder rather than outputs
This commit is contained in:
@@ -180,9 +180,25 @@ void NodeParamSetStandardValueCommand::undo()
|
||||
ref_.input().node()->SetSplitStandardValueOnTrack(ref_, old_value_);
|
||||
}
|
||||
|
||||
Project *NodeParamArrayInsertCommand::GetRelevantProject() const
|
||||
NodeParamArrayAppendCommand::NodeParamArrayAppendCommand(Node *node, const QString &input) :
|
||||
node_(node),
|
||||
input_(input)
|
||||
{
|
||||
return input_.node()->project();
|
||||
}
|
||||
|
||||
Project *NodeParamArrayAppendCommand::GetRelevantProject() const
|
||||
{
|
||||
return node_->project();
|
||||
}
|
||||
|
||||
void NodeParamArrayAppendCommand::redo()
|
||||
{
|
||||
node_->InputArrayAppend(input_, false);
|
||||
}
|
||||
|
||||
void NodeParamArrayAppendCommand::undo()
|
||||
{
|
||||
node_->InputArrayRemoveLast(input_, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -139,30 +139,21 @@ private:
|
||||
|
||||
};
|
||||
|
||||
class NodeParamArrayInsertCommand : public UndoCommand
|
||||
class NodeParamArrayAppendCommand : public UndoCommand
|
||||
{
|
||||
public:
|
||||
NodeParamArrayInsertCommand(const NodeInput& input, int index) :
|
||||
input_(input),
|
||||
index_(index)
|
||||
{
|
||||
}
|
||||
NodeParamArrayAppendCommand(Node* node, const QString& input);
|
||||
|
||||
virtual Project* GetRelevantProject() const override;
|
||||
|
||||
virtual void redo() override
|
||||
{
|
||||
input_.node()->InputArrayInsert(input_.input(), index_);
|
||||
}
|
||||
virtual void redo() override;
|
||||
|
||||
virtual void undo() override
|
||||
{
|
||||
input_.node()->InputArrayRemove(input_.input(), index_);
|
||||
}
|
||||
virtual void undo() override;
|
||||
|
||||
private:
|
||||
NodeInput input_;
|
||||
int index_;
|
||||
Node* node_;
|
||||
|
||||
QString input_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ void ProjectExplorer::set_view_type(ProjectToolbar::ViewType type)
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectExplorer::Edit(Item *item)
|
||||
void ProjectExplorer::Edit(Node *item)
|
||||
{
|
||||
CurrentView()->edit(sort_model_.mapFromSource(model_.CreateIndexFromItem(item)));
|
||||
}
|
||||
@@ -199,7 +199,7 @@ void ProjectExplorer::ItemDoubleClickedSlot(const QModelIndex &index)
|
||||
rename_timer_.stop();
|
||||
|
||||
// Retrieve source item from index
|
||||
Item* i = static_cast<Item*>(sort_model_.mapToSource(index).internalPointer());
|
||||
Node* i = static_cast<Node*>(sort_model_.mapToSource(index).internalPointer());
|
||||
|
||||
// If the item is a folder, browse to it
|
||||
if (dynamic_cast<Folder*>(i) && (view_type() == ProjectToolbar::ListView || view_type() == ProjectToolbar::IconView)) {
|
||||
@@ -264,7 +264,7 @@ void ProjectExplorer::ShowContextMenu()
|
||||
|
||||
// Actions to add when only one item is selected
|
||||
if (context_menu_items_.size() == 1) {
|
||||
Item* context_menu_item = context_menu_items_.first();
|
||||
Node* context_menu_item = context_menu_items_.first();
|
||||
|
||||
if (dynamic_cast<Folder*>(context_menu_item)) {
|
||||
|
||||
@@ -298,7 +298,7 @@ void ProjectExplorer::ShowContextMenu()
|
||||
bool all_items_have_video_streams = true;
|
||||
bool all_items_are_footage_or_sequence = true;
|
||||
|
||||
foreach (Item* i, context_menu_items_) {
|
||||
foreach (Node* i, context_menu_items_) {
|
||||
Footage* footage_cast_test = dynamic_cast<Footage*>(i);
|
||||
Sequence* sequence_cast_test = dynamic_cast<Sequence*>(i);
|
||||
|
||||
@@ -349,7 +349,7 @@ void ProjectExplorer::ShowContextMenu()
|
||||
|
||||
void ProjectExplorer::ShowItemPropertiesDialog()
|
||||
{
|
||||
Item* sel = context_menu_items_.first();
|
||||
Node* sel = context_menu_items_.first();
|
||||
|
||||
// FIXME: Support for multiple items
|
||||
if (dynamic_cast<Footage*>(sel)) {
|
||||
@@ -408,7 +408,7 @@ void ProjectExplorer::ContextMenuStartProxy(QAction *a)
|
||||
Sequence* sequence = Node::ValueToPtr<Sequence>(a->data());
|
||||
|
||||
// To get here, the `context_menu_items_` must be all kFootage
|
||||
foreach (Item* i, context_menu_items_) {
|
||||
foreach (Node* i, context_menu_items_) {
|
||||
Footage* f = static_cast<Footage*>(i);
|
||||
|
||||
QVector<VideoParams> enabled_streams = f->GetEnabledVideoStreams();
|
||||
@@ -444,18 +444,18 @@ void ProjectExplorer::set_root(Folder *item)
|
||||
tree_view_->setRootIndex(index);
|
||||
}
|
||||
|
||||
QVector<Item *> ProjectExplorer::SelectedItems() const
|
||||
QVector<Node *> ProjectExplorer::SelectedItems() const
|
||||
{
|
||||
// Determine which view is active and get its selected indexes
|
||||
QModelIndexList index_list = CurrentView()->selectionModel()->selectedRows();
|
||||
|
||||
// Convert indexes to item objects
|
||||
QVector<Item*> selected_items;
|
||||
QVector<Node*> selected_items;
|
||||
|
||||
for (int i=0;i<index_list.size();i++) {
|
||||
QModelIndex index = sort_model_.mapToSource(index_list.at(i));
|
||||
|
||||
Item* item = static_cast<Item*>(index.internalPointer());
|
||||
Node* item = static_cast<Node*>(index.internalPointer());
|
||||
|
||||
selected_items.append(item);
|
||||
}
|
||||
@@ -472,7 +472,7 @@ Folder *ProjectExplorer::GetSelectedFolder() const
|
||||
Folder* folder = nullptr;
|
||||
|
||||
// Get the selected items from the panel
|
||||
QVector<Item*> selected_items = SelectedItems();
|
||||
QVector<Node*> selected_items = SelectedItems();
|
||||
|
||||
// Heuristic for finding the selected folder:
|
||||
//
|
||||
@@ -482,11 +482,11 @@ Folder *ProjectExplorer::GetSelectedFolder() const
|
||||
// - If more than one folder is found, we play it safe and import into the root folder
|
||||
|
||||
for (int i=0;i<selected_items.size();i++) {
|
||||
Item* sel_item = selected_items.at(i);
|
||||
Node* sel_item = selected_items.at(i);
|
||||
|
||||
// If this item is not a folder, presumably it's parent is
|
||||
if (!dynamic_cast<Folder*>(sel_item)) {
|
||||
sel_item = sel_item->item_parent();
|
||||
sel_item = sel_item->folder();
|
||||
}
|
||||
|
||||
if (folder == nullptr) {
|
||||
@@ -525,7 +525,7 @@ void ProjectExplorer::DeselectAll()
|
||||
|
||||
void ProjectExplorer::DeleteSelected()
|
||||
{
|
||||
QVector<Item*> selected = SelectedItems();
|
||||
QVector<Node*> selected = SelectedItems();
|
||||
|
||||
if (selected.isEmpty()) {
|
||||
return;
|
||||
@@ -535,7 +535,7 @@ void ProjectExplorer::DeleteSelected()
|
||||
|
||||
bool dont_confirm_footage_in_use = false;
|
||||
|
||||
foreach (Item* item, selected) {
|
||||
foreach (Node* item, selected) {
|
||||
// Verify whether this item is in use anywhere
|
||||
Footage* footage_cast_test = dynamic_cast<Footage*>(item);
|
||||
Sequence* sequence_cast_test = dynamic_cast<Sequence*>(item);
|
||||
|
||||
@@ -59,7 +59,7 @@ public:
|
||||
|
||||
void set_root(Folder *item);
|
||||
|
||||
QVector<Item *> SelectedItems() const;
|
||||
QVector<Node *> SelectedItems() const;
|
||||
|
||||
/**
|
||||
* @brief Use a heuristic to determine which (if any) folder is selected
|
||||
@@ -89,7 +89,7 @@ public:
|
||||
public slots:
|
||||
void set_view_type(ProjectToolbar::ViewType type);
|
||||
|
||||
void Edit(Item* item);
|
||||
void Edit(Node* item);
|
||||
|
||||
signals:
|
||||
/**
|
||||
@@ -99,7 +99,7 @@ signals:
|
||||
*
|
||||
* The Item that was double clicked, or nullptr if empty area was double clicked
|
||||
*/
|
||||
void DoubleClickedItem(Item* item);
|
||||
void DoubleClickedItem(Node* item);
|
||||
|
||||
private:
|
||||
/**
|
||||
@@ -153,7 +153,7 @@ private:
|
||||
|
||||
QTimer rename_timer_;
|
||||
|
||||
QVector<Item*> context_menu_items_;
|
||||
QVector<Node*> context_menu_items_;
|
||||
|
||||
private slots:
|
||||
void ItemClickedSlot(const QModelIndex& index);
|
||||
|
||||
@@ -92,7 +92,7 @@ void ImportTool::DragEnter(TimelineViewMouseEvent *event)
|
||||
stream >> enabled_streams >> item_ptr;
|
||||
|
||||
// Get Item object
|
||||
Item* item = reinterpret_cast<Item*>(item_ptr);
|
||||
Node* item = reinterpret_cast<Node*>(item_ptr);
|
||||
|
||||
// Check if Item is Footage
|
||||
if (dynamic_cast<Footage*>(item)) {
|
||||
@@ -390,7 +390,7 @@ void ImportTool::DropGhosts(bool insert)
|
||||
dst_graph = Core::instance()->GetActiveProject();
|
||||
|
||||
command->add_child(new NodeAddCommand(dst_graph, new_sequence));
|
||||
command->add_child(new NodeEdgeAddCommand(Core::instance()->GetSelectedFolderInActiveProject(), NodeInput(new_sequence, Item::kParentInput)));
|
||||
command->add_child(new FolderAddChild(Core::instance()->GetSelectedFolderInActiveProject(), new_sequence));
|
||||
new_sequence->add_default_nodes(command);
|
||||
|
||||
FootageToGhosts(0, dragged_footage_, new_sequence->video_params().time_base(), 0);
|
||||
|
||||
Reference in New Issue
Block a user