style: unify identifier naming per updated conventions
Automated with clang-tidy readability-identifier-naming (config added to .clang-tidy) plus scripted passes, per the updated rules now documented in CONTRIBUTING.md: - types (class/struct/enum/alias/template params): PascalCase - functions, variables, members: snake_case (incl. rational -> Rational) - private/protected members: trailing underscore; static member variables likewise (instance_, available_themes_) - constants and enum values: snake_case (kLinear -> k_linear, F32P -> f32p); ALL_CAPS reserved for macros - macros: OAK_ prefix (OLIVE_ADD_TEST/OLIVE_ASSERT/OLIVE_CONFIG -> OAK_ADD_TEST/OAK_ASSERT/OAK_CONFIG, GL_PREAMBLE -> OAK_GL_PREAMBLE, include guards -> OAK_*) - file names: all lowercase (Current/Plugin/OliveHost/OliveClip/ OlivePluginInstance -> current/plugin/olivehost/oliveclip/ oliveplugininstance) - getters share the member name sans underscore, setters set_foo() - Qt and third-party (OpenFX) virtual overrides and framework callbacks keep their original names (exempt in .clang-tidy) Manual follow-ups required where automation could not reach: - string-based QMetaObject/SIGNAL/SLOT references updated to renamed methods (AddTask, CreatedFile, DeleteSpecificFile, moveSelectionUp, ...) - macro bodies referencing renamed methods (OLIVE_CONFIG, NODE_DEFAULT_DESTRUCTOR, MANAGEDDISPLAYWIDGET_*) - self-shadowing locals renamed where signals/methods became same-named (size_changed, worker_count, selected_items, import param, filters) - third_party OFX member/namespace usages restored (OFX::Host::*, _created, _clipPrefsDirty, createInstance, clearPersistentMessage) - STL protocol aliases restored (const_iterator) with .clang-tidy ignore rules; qHash overloads restored Full build and test suite pass: ctest 4/4, ~1960 gtest cases green.
This commit is contained in:
@@ -17,9 +17,9 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef NODEPARAMBUTTON_H
|
||||
#define NODEPARAMBUTTON_H
|
||||
#include "node/plugins/Plugin.h"
|
||||
#ifndef OAK_NODEPARAMBUTTON_H
|
||||
#define OAK_NODEPARAMBUTTON_H
|
||||
#include "node/plugins/plugin.h"
|
||||
|
||||
#include <QPushButton>
|
||||
|
||||
@@ -33,15 +33,15 @@ public:
|
||||
connect(this, &QPushButton::clicked, this, &NodeParamButton::pressed);
|
||||
}
|
||||
signals:
|
||||
void onPressed(QString name);
|
||||
void on_pressed(QString name);
|
||||
private slots:
|
||||
void pressed()
|
||||
{
|
||||
emit onPressed(name_);
|
||||
emit on_pressed(name_);
|
||||
}
|
||||
|
||||
private:
|
||||
QString name_;
|
||||
};
|
||||
|
||||
#endif //NODEPARAMBUTTON_H
|
||||
#endif //OAK_NODEPARAMBUTTON_H
|
||||
|
||||
@@ -75,28 +75,28 @@ NodeParamView::NodeParamView(bool create_keyframe_view, QWidget *parent)
|
||||
param_widget_container_layout->addStretch(INT_MAX);
|
||||
|
||||
// Create contexts for three different types
|
||||
context_items_.resize(Track::kCount + 1);
|
||||
context_items_.resize(Track::k_count + 1);
|
||||
for (int i = 0; i < context_items_.size(); i++) {
|
||||
NodeParamViewContext *c = new NodeParamViewContext(param_widget_area_);
|
||||
c->setVisible(false);
|
||||
connect(c, &NodeParamViewContext::AboutToDeleteItem, this,
|
||||
&NodeParamView::ItemAboutToBeRemoved, Qt::DirectConnection);
|
||||
connect(c, &NodeParamViewContext::about_to_delete_item, this,
|
||||
&NodeParamView::item_about_to_be_removed, Qt::DirectConnection);
|
||||
|
||||
NodeParamViewItemTitleBar *title_bar =
|
||||
static_cast<NodeParamViewItemTitleBar *>(c->titleBarWidget());
|
||||
|
||||
if (i == Track::kVideo || i == Track::kAudio) {
|
||||
c->SetEffectType(static_cast<Track::Type>(i));
|
||||
title_bar->SetAddEffectButtonVisible(true);
|
||||
title_bar->SetText(tr("%1 Nodes")
|
||||
.arg(Footage::GetStreamTypeName(
|
||||
if (i == Track::k_video || i == Track::k_audio) {
|
||||
c->set_effect_type(static_cast<Track::Type>(i));
|
||||
title_bar->set_add_effect_button_visible(true);
|
||||
title_bar->set_text(tr("%1 Nodes")
|
||||
.arg(Footage::get_stream_type_name(
|
||||
static_cast<Track::Type>(i))));
|
||||
} else {
|
||||
title_bar->SetText(tr("Other"));
|
||||
title_bar->set_text(tr("Other"));
|
||||
}
|
||||
|
||||
context_items_[i] = c;
|
||||
param_widget_area_->AddItem(c);
|
||||
param_widget_area_->add_item(c);
|
||||
}
|
||||
|
||||
// Disable collapsing param view (but collapsing keyframe view is permitted)
|
||||
@@ -113,7 +113,7 @@ NodeParamView::NodeParamView(bool create_keyframe_view, QWidget *parent)
|
||||
connect(param_scroll_area_->verticalScrollBar(), &QScrollBar::rangeChanged,
|
||||
vertical_scrollbar_, &QScrollBar::setRange);
|
||||
connect(param_scroll_area_->verticalScrollBar(), &QScrollBar::rangeChanged,
|
||||
this, &NodeParamView::UpdateGlobalScrollBar);
|
||||
this, &NodeParamView::update_global_scroll_bar);
|
||||
connect(vertical_scrollbar_, &QScrollBar::valueChanged,
|
||||
param_scroll_area_->verticalScrollBar(), &QScrollBar::setValue);
|
||||
|
||||
@@ -130,17 +130,17 @@ NodeParamView::NodeParamView(bool create_keyframe_view, QWidget *parent)
|
||||
// Create keyframe view
|
||||
keyframe_view_ = new KeyframeView();
|
||||
keyframe_view_->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
keyframe_view_->SetSnapService(this);
|
||||
ConnectTimelineView(keyframe_view_);
|
||||
keyframe_view_->set_snap_service(this);
|
||||
connect_timeline_view(keyframe_view_);
|
||||
keyframe_area_layout->addWidget(keyframe_view_);
|
||||
|
||||
// Connect ruler and keyframe view together
|
||||
connect(keyframe_view_, &KeyframeView::Dragged, this,
|
||||
connect(keyframe_view_, &KeyframeView::dragged, this,
|
||||
static_cast<void (NodeParamView::*)(int)>(
|
||||
&NodeParamView::SetCatchUpScrollValue));
|
||||
connect(keyframe_view_, &KeyframeView::Released, this,
|
||||
&NodeParamView::set_catch_up_scroll_value));
|
||||
connect(keyframe_view_, &KeyframeView::released, this,
|
||||
static_cast<void (NodeParamView::*)()>(
|
||||
&NodeParamView::StopCatchUpScrollTimer));
|
||||
&NodeParamView::stop_catch_up_scroll_timer));
|
||||
|
||||
splitter->addWidget(keyframe_area);
|
||||
|
||||
@@ -180,7 +180,7 @@ NodeParamView::~NodeParamView()
|
||||
qDeleteAll(context_items_);
|
||||
}
|
||||
|
||||
void NodeParamView::CloseContextsBelongingToProject(Project *p)
|
||||
void NodeParamView::close_contexts_belonging_to_project(Project *p)
|
||||
{
|
||||
QVector<Node *> new_contexts = contexts_;
|
||||
|
||||
@@ -191,7 +191,7 @@ void NodeParamView::CloseContextsBelongingToProject(Project *p)
|
||||
}
|
||||
}
|
||||
|
||||
SetContexts(new_contexts);
|
||||
set_contexts(new_contexts);
|
||||
}
|
||||
|
||||
/*void NodeParamView::SelectNodes(const QVector<Node *> &nodes)
|
||||
@@ -253,14 +253,14 @@ void NodeParamView::DeselectNodes(const QVector<Node *> &nodes)
|
||||
}
|
||||
}*/
|
||||
|
||||
void NodeParamView::UpdateContexts()
|
||||
void NodeParamView::update_contexts()
|
||||
{
|
||||
bool changes_made = false;
|
||||
|
||||
foreach (Node *ctx, current_contexts_) {
|
||||
if (!contexts_.contains(ctx)) {
|
||||
// Context is being removed
|
||||
RemoveContext(ctx);
|
||||
remove_context(ctx);
|
||||
changes_made = true;
|
||||
}
|
||||
}
|
||||
@@ -268,7 +268,7 @@ void NodeParamView::UpdateContexts()
|
||||
foreach (Node *ctx, contexts_) {
|
||||
if (!current_contexts_.contains(ctx)) {
|
||||
// Context is being added
|
||||
AddContext(ctx);
|
||||
add_context(ctx);
|
||||
changes_made = true;
|
||||
}
|
||||
}
|
||||
@@ -276,38 +276,38 @@ void NodeParamView::UpdateContexts()
|
||||
if (changes_made) {
|
||||
current_contexts_ = contexts_;
|
||||
|
||||
if (IsGroupMode()) {
|
||||
if (is_group_mode()) {
|
||||
// Check inputs that have been passed through
|
||||
NodeGroup *group = static_cast<NodeGroup *>(contexts_.first());
|
||||
for (auto it = group->GetInputPassthroughs().cbegin();
|
||||
it != group->GetInputPassthroughs().cend(); it++) {
|
||||
GroupInputPassthroughAdded(group, it->second);
|
||||
for (auto it = group->get_input_passthroughs().cbegin();
|
||||
it != group->get_input_passthroughs().cend(); it++) {
|
||||
group_input_passthrough_added(group, it->second);
|
||||
}
|
||||
|
||||
connect(group, &NodeGroup::InputPassthroughAdded, this,
|
||||
&NodeParamView::GroupInputPassthroughAdded);
|
||||
connect(group, &NodeGroup::InputPassthroughRemoved, this,
|
||||
&NodeParamView::GroupInputPassthroughRemoved);
|
||||
connect(group, &NodeGroup::input_passthrough_added, this,
|
||||
&NodeParamView::group_input_passthrough_added);
|
||||
connect(group, &NodeGroup::input_passthrough_removed, this,
|
||||
&NodeParamView::group_input_passthrough_removed);
|
||||
}
|
||||
|
||||
foreach (NodeParamViewContext *ctx, context_items_) {
|
||||
SortItemsInContext(ctx);
|
||||
sort_items_in_context(ctx);
|
||||
}
|
||||
|
||||
if (keyframe_view_) {
|
||||
QueueKeyframePositionUpdate();
|
||||
queue_keyframe_position_update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamView::ItemAboutToBeRemoved(NodeParamViewItem *item)
|
||||
void NodeParamView::item_about_to_be_removed(NodeParamViewItem *item)
|
||||
{
|
||||
if (keyframe_view_) {
|
||||
for (auto it = item->GetKeyframeConnections().begin();
|
||||
it != item->GetKeyframeConnections().end(); it++) {
|
||||
for (auto it = item->get_keyframe_connections().begin();
|
||||
it != item->get_keyframe_connections().end(); it++) {
|
||||
for (auto jt = it->begin(); jt != it->end(); jt++) {
|
||||
for (auto kt = jt->begin(); kt != jt->end(); kt++) {
|
||||
keyframe_view_->RemoveKeyframesOfTrack(*kt);
|
||||
keyframe_view_->remove_keyframes_of_track(*kt);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -315,36 +315,36 @@ void NodeParamView::ItemAboutToBeRemoved(NodeParamViewItem *item)
|
||||
|
||||
QVector<NodeParamViewItem *> copy = selected_nodes_;
|
||||
if (copy.removeOne(item)) {
|
||||
SetSelectedNodes(copy);
|
||||
set_selected_nodes(copy);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamView::ItemClicked()
|
||||
void NodeParamView::item_clicked()
|
||||
{
|
||||
ToggleSelect(static_cast<NodeParamViewItem *>(sender()));
|
||||
toggle_select(static_cast<NodeParamViewItem *>(sender()));
|
||||
}
|
||||
|
||||
void NodeParamView::SelectNodeFromConnectedLink(Node *node)
|
||||
void NodeParamView::select_node_from_connected_link(Node *node)
|
||||
{
|
||||
NodeParamViewItem *item = static_cast<NodeParamViewItem *>(sender());
|
||||
|
||||
Node::ContextPair p = { node, item->GetContext() };
|
||||
SetSelectedNodes({ p });
|
||||
Node::ContextPair p = { node, item->get_context() };
|
||||
set_selected_nodes({ p });
|
||||
}
|
||||
|
||||
void NodeParamView::RequestEditTextInViewer()
|
||||
void NodeParamView::request_edit_text_in_viewer()
|
||||
{
|
||||
NodeParamViewItem *item = static_cast<NodeParamViewItem *>(sender());
|
||||
|
||||
SetSelectedNodes({ item });
|
||||
emit RequestViewerToStartEditingText();
|
||||
set_selected_nodes({ item });
|
||||
emit request_viewer_to_start_editing_text();
|
||||
}
|
||||
|
||||
void NodeParamView::SetContexts(const QVector<Node *> &contexts)
|
||||
void NodeParamView::set_contexts(const QVector<Node *> &contexts)
|
||||
{
|
||||
// Setting contexts is expensive, so we queue it here to prevent multiple calls in a short timespan
|
||||
contexts_ = contexts;
|
||||
UpdateContexts();
|
||||
update_contexts();
|
||||
}
|
||||
|
||||
void NodeParamView::resizeEvent(QResizeEvent *event)
|
||||
@@ -359,20 +359,20 @@ void NodeParamView::ScaleChangedEvent(const double &scale)
|
||||
super::ScaleChangedEvent(scale);
|
||||
|
||||
if (keyframe_view_) {
|
||||
keyframe_view_->SetScale(scale);
|
||||
keyframe_view_->set_scale(scale);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamView::TimebaseChangedEvent(const rational &timebase)
|
||||
void NodeParamView::TimebaseChangedEvent(const Rational &timebase)
|
||||
{
|
||||
super::TimebaseChangedEvent(timebase);
|
||||
|
||||
if (keyframe_view_) {
|
||||
keyframe_view_->SetTimebase(timebase);
|
||||
keyframe_view_->set_timebase(timebase);
|
||||
}
|
||||
|
||||
foreach (NodeParamViewContext *ctx, context_items_) {
|
||||
ctx->SetTimebase(timebase);
|
||||
ctx->set_timebase(timebase);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -380,15 +380,15 @@ void NodeParamView::ConnectedNodeChangeEvent(ViewerOutput *n)
|
||||
{
|
||||
if (keyframe_view_) {
|
||||
// Set viewer as a time target
|
||||
keyframe_view_->SetTimeTarget(n);
|
||||
keyframe_view_->set_time_target(n);
|
||||
}
|
||||
|
||||
foreach (NodeParamViewContext *item, context_items_) {
|
||||
item->SetTimeTarget(n);
|
||||
item->set_time_target(n);
|
||||
}
|
||||
}
|
||||
|
||||
void ReconnectOutputsIfNotDeletingNode(MultiUndoCommand *c,
|
||||
void reconnect_outputs_if_not_deleting_node(MultiUndoCommand *c,
|
||||
NodeViewDeleteCommand *dc, Node *output,
|
||||
Node *deleting, Node *context)
|
||||
{
|
||||
@@ -396,9 +396,9 @@ void ReconnectOutputsIfNotDeletingNode(MultiUndoCommand *c,
|
||||
it != deleting->output_connections().cend(); it++) {
|
||||
const NodeInput &proposed_reconnect = it->second;
|
||||
|
||||
if (dc->ContainsNode(proposed_reconnect.node(), context)) {
|
||||
if (dc->contains_node(proposed_reconnect.node(), context)) {
|
||||
// Uh-oh we're deleting this node too, instead connect to its outputs
|
||||
ReconnectOutputsIfNotDeletingNode(
|
||||
reconnect_outputs_if_not_deleting_node(
|
||||
c, dc, output, proposed_reconnect.node(), context);
|
||||
} else {
|
||||
c->add_child(new NodeEdgeAddCommand(output, it->second));
|
||||
@@ -409,7 +409,7 @@ void ReconnectOutputsIfNotDeletingNode(MultiUndoCommand *c,
|
||||
void NodeParamView::DeleteSelected()
|
||||
{
|
||||
if (keyframe_view_ && keyframe_view_->hasFocus()) {
|
||||
keyframe_view_->DeleteSelected();
|
||||
keyframe_view_->delete_selected();
|
||||
} else if (!selected_nodes_.isEmpty()) {
|
||||
MultiUndoCommand *c = new MultiUndoCommand();
|
||||
|
||||
@@ -419,24 +419,24 @@ void NodeParamView::DeleteSelected()
|
||||
|
||||
// Add all nodes
|
||||
foreach (NodeParamViewItem *item, selected_nodes_) {
|
||||
Node *n = item->GetNode();
|
||||
dc->AddNode(n, item->GetContext());
|
||||
Node *n = item->get_node();
|
||||
dc->add_node(n, item->get_context());
|
||||
}
|
||||
|
||||
// Make reconnections where possible
|
||||
foreach (NodeParamViewItem *item, selected_nodes_) {
|
||||
Node *n = item->GetNode();
|
||||
Node *n = item->get_node();
|
||||
|
||||
Node *node_being_deleted = n;
|
||||
Node *connected_to_effect_input = nullptr;
|
||||
|
||||
while (true) {
|
||||
if (node_being_deleted->GetEffectInput().IsValid()) {
|
||||
if (node_being_deleted->get_effect_input().is_valid()) {
|
||||
if ((connected_to_effect_input =
|
||||
node_being_deleted->GetEffectInput()
|
||||
.GetConnectedOutput())) {
|
||||
if (dc->ContainsNode(connected_to_effect_input,
|
||||
item->GetContext())) {
|
||||
node_being_deleted->get_effect_input()
|
||||
.get_connected_output())) {
|
||||
if (dc->contains_node(connected_to_effect_input,
|
||||
item->get_context())) {
|
||||
// Node's getting deleted, recurse
|
||||
node_being_deleted = connected_to_effect_input;
|
||||
continue;
|
||||
@@ -448,8 +448,8 @@ void NodeParamView::DeleteSelected()
|
||||
}
|
||||
|
||||
if (connected_to_effect_input) {
|
||||
ReconnectOutputsIfNotDeletingNode(
|
||||
c, dc, connected_to_effect_input, n, item->GetContext());
|
||||
reconnect_outputs_if_not_deleting_node(
|
||||
c, dc, connected_to_effect_input, n, item->get_context());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -458,7 +458,7 @@ void NodeParamView::DeleteSelected()
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamView::SetSelectedNodes(const QVector<NodeParamViewItem *> &nodes,
|
||||
void NodeParamView::set_selected_nodes(const QVector<NodeParamViewItem *> &nodes,
|
||||
bool handle_focused_node, bool emit_signal)
|
||||
{
|
||||
if (handle_focused_node) {
|
||||
@@ -467,7 +467,7 @@ void NodeParamView::SetSelectedNodes(const QVector<NodeParamViewItem *> &nodes,
|
||||
}
|
||||
|
||||
foreach (NodeParamViewItem *n, selected_nodes_) {
|
||||
n->SetHighlighted(false);
|
||||
n->set_highlighted(false);
|
||||
}
|
||||
|
||||
selected_nodes_ = nodes;
|
||||
@@ -479,10 +479,10 @@ void NodeParamView::SetSelectedNodes(const QVector<NodeParamViewItem *> &nodes,
|
||||
|
||||
for (int i = 0; i < selected_nodes_.size(); i++) {
|
||||
NodeParamViewItem *n = selected_nodes_.at(i);
|
||||
n->SetHighlighted(true);
|
||||
n->set_highlighted(true);
|
||||
|
||||
if (emit_signal) {
|
||||
p[i] = { n->GetNode(), n->GetContext() };
|
||||
p[i] = { n->get_node(), n->get_context() };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -490,22 +490,22 @@ void NodeParamView::SetSelectedNodes(const QVector<NodeParamViewItem *> &nodes,
|
||||
focused_node_ = nullptr;
|
||||
|
||||
foreach (NodeParamViewItem *n, selected_nodes_) {
|
||||
if (n->GetNode()->HasGizmos()) {
|
||||
if (n->get_node()->has_gizmos()) {
|
||||
focused_node_ = n;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Node *n = focused_node_ ? focused_node_->GetNode() : nullptr;
|
||||
emit FocusedNodeChanged(n);
|
||||
Node *n = focused_node_ ? focused_node_->get_node() : nullptr;
|
||||
emit focused_node_changed(n);
|
||||
}
|
||||
|
||||
if (emit_signal) {
|
||||
emit SelectedNodesChanged(p);
|
||||
emit selected_nodes_changed(p);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamView::SetSelectedNodes(const QVector<Node::ContextPair> &nodes,
|
||||
void NodeParamView::set_selected_nodes(const QVector<Node::ContextPair> &nodes,
|
||||
bool emit_signal)
|
||||
{
|
||||
QVector<NodeParamViewItem *> items;
|
||||
@@ -516,7 +516,7 @@ void NodeParamView::SetSelectedNodes(const QVector<Node::ContextPair> &nodes,
|
||||
it++) {
|
||||
NodeParamViewContext *ctx = *it;
|
||||
|
||||
NodeParamViewItem *item = ctx->GetItem(n.node, n.context);
|
||||
NodeParamViewItem *item = ctx->get_item(n.node, n.context);
|
||||
|
||||
if (item) {
|
||||
items.append(item);
|
||||
@@ -527,7 +527,7 @@ void NodeParamView::SetSelectedNodes(const QVector<Node::ContextPair> &nodes,
|
||||
}
|
||||
}
|
||||
|
||||
SetSelectedNodes(items, true, emit_signal);
|
||||
set_selected_nodes(items, true, emit_signal);
|
||||
|
||||
if (!selected_nodes_.empty()) {
|
||||
NodeParamViewItem *scrolled_to = selected_nodes_.front();
|
||||
@@ -540,31 +540,31 @@ void NodeParamView::SetSelectedNodes(const QVector<Node::ContextPair> &nodes,
|
||||
|
||||
// Make sure the dock/tab containing this node is visible
|
||||
if (scrolled_ctx) {
|
||||
scrolled_ctx->SetExpanded(true);
|
||||
scrolled_ctx->set_expanded(true);
|
||||
scrolled_ctx->raise();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Node *NodeParamView::GetNodeWithID(const QString &id)
|
||||
Node *NodeParamView::get_node_with_id(const QString &id)
|
||||
{
|
||||
return GetNodeWithIDAndIgnoreList(id, QVector<Node *>());
|
||||
return get_node_with_id_and_ignore_list(id, QVector<Node *>());
|
||||
}
|
||||
|
||||
Node *NodeParamView::GetNodeWithIDAndIgnoreList(const QString &id,
|
||||
Node *NodeParamView::get_node_with_id_and_ignore_list(const QString &id,
|
||||
const QVector<Node *> &ignore)
|
||||
{
|
||||
for (NodeParamViewItem *item : selected_nodes_) {
|
||||
if (item->GetNode()->id() == id && !ignore.contains(item->GetNode())) {
|
||||
return item->GetNode();
|
||||
if (item->get_node()->id() == id && !ignore.contains(item->get_node())) {
|
||||
return item->get_node();
|
||||
}
|
||||
}
|
||||
|
||||
for (NodeParamViewContext *ctx : context_items_) {
|
||||
for (NodeParamViewItem *item : ctx->GetItems()) {
|
||||
if (item->GetNode()->id() == id &&
|
||||
!ignore.contains(item->GetNode())) {
|
||||
return item->GetNode();
|
||||
for (NodeParamViewItem *item : ctx->get_items()) {
|
||||
if (item->get_node()->id() == id &&
|
||||
!ignore.contains(item->get_node())) {
|
||||
return item->get_node();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -572,14 +572,14 @@ Node *NodeParamView::GetNodeWithIDAndIgnoreList(const QString &id,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool NodeParamView::CopySelected(bool cut)
|
||||
bool NodeParamView::copy_selected(bool cut)
|
||||
{
|
||||
if (super::CopySelected(cut)) {
|
||||
if (super::copy_selected(cut)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (keyframe_view_ && keyframe_view_->hasFocus()) {
|
||||
if (keyframe_view_->CopySelected(cut)) {
|
||||
if (keyframe_view_->copy_selected(cut)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -588,18 +588,18 @@ bool NodeParamView::CopySelected(bool cut)
|
||||
return false;
|
||||
}
|
||||
|
||||
ProjectSerializer::SaveData sdata(ProjectSerializer::kOnlyNodes);
|
||||
ProjectSerializer::SaveData sdata(ProjectSerializer::k_only_nodes);
|
||||
ProjectSerializer::SerializedProperties properties;
|
||||
QVector<Node *> nodes;
|
||||
|
||||
for (NodeParamViewItem *item : selected_nodes_) {
|
||||
Node *n = item->GetNode();
|
||||
Node *n = item->get_node();
|
||||
|
||||
if (!nodes.contains(n)) {
|
||||
nodes.append(n);
|
||||
|
||||
Node::Position pos =
|
||||
item->GetContext()->GetNodePositionDataInContext(n);
|
||||
item->get_context()->get_node_position_data_in_context(n);
|
||||
|
||||
properties[n][QStringLiteral("x")] =
|
||||
QString::number(pos.position.x());
|
||||
@@ -610,10 +610,10 @@ bool NodeParamView::CopySelected(bool cut)
|
||||
}
|
||||
}
|
||||
|
||||
sdata.SetOnlySerializeNodesAndResolveGroups(nodes);
|
||||
sdata.SetProperties(properties);
|
||||
sdata.set_only_serialize_nodes_and_resolve_groups(nodes);
|
||||
sdata.set_properties(properties);
|
||||
|
||||
ProjectSerializer::Copy(sdata);
|
||||
ProjectSerializer::copy(sdata);
|
||||
|
||||
if (cut) {
|
||||
DeleteSelected();
|
||||
@@ -622,34 +622,34 @@ bool NodeParamView::CopySelected(bool cut)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool NodeParamView::Paste()
|
||||
bool NodeParamView::paste()
|
||||
{
|
||||
if (keyframe_view_) {
|
||||
if (keyframe_view_->Paste(std::bind(&NodeParamView::GetNodeWithID, this,
|
||||
if (keyframe_view_->paste(std::bind(&NodeParamView::get_node_with_id, this,
|
||||
std::placeholders::_1))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return Paste(this, std::bind(&NodeParamView::GenerateExistingPasteMap, this,
|
||||
return paste(this, std::bind(&NodeParamView::generate_existing_paste_map, this,
|
||||
std::placeholders::_1));
|
||||
}
|
||||
|
||||
bool NodeParamView::Paste(
|
||||
bool NodeParamView::paste(
|
||||
QWidget *parent,
|
||||
std::function<QHash<Node *, Node *>(const ProjectSerializer::Result &)>
|
||||
get_existing_map_function)
|
||||
{
|
||||
ProjectSerializer::Result res =
|
||||
ProjectSerializer::Paste(ProjectSerializer::kOnlyNodes);
|
||||
if (res.GetLoadData().nodes.isEmpty()) {
|
||||
ProjectSerializer::paste(ProjectSerializer::k_only_nodes);
|
||||
if (res.get_load_data().nodes.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Determine if any nodes of this type are already in the editor
|
||||
QHash<Node *, Node *> existing_nodes = get_existing_map_function(res);
|
||||
|
||||
QVector<Node *> nodes_to_paste_as_new = res.GetLoadData().nodes;
|
||||
QVector<Node *> nodes_to_paste_as_new = res.get_load_data().nodes;
|
||||
MultiUndoCommand *command = new MultiUndoCommand();
|
||||
|
||||
if (!existing_nodes.empty()) {
|
||||
@@ -659,7 +659,7 @@ bool NodeParamView::Paste(
|
||||
QStringList node_names;
|
||||
for (auto it = existing_nodes.cbegin(); it != existing_nodes.cend();
|
||||
it++) {
|
||||
node_names.append(it.key()->GetLabelAndName());
|
||||
node_names.append(it.key()->get_label_and_name());
|
||||
}
|
||||
|
||||
b.setText(
|
||||
@@ -685,7 +685,7 @@ bool NodeParamView::Paste(
|
||||
// Filter out existing nodes
|
||||
for (auto it = existing_nodes.cbegin(); it != existing_nodes.cend();
|
||||
it++) {
|
||||
Node::CopyInputs(it.value(), it.key(), false, command);
|
||||
Node::copy_inputs(it.value(), it.key(), false, command);
|
||||
nodes_to_paste_as_new.removeOne(it.value());
|
||||
}
|
||||
}
|
||||
@@ -694,8 +694,8 @@ bool NodeParamView::Paste(
|
||||
if (!nodes_to_paste_as_new.isEmpty()) {
|
||||
Node::PositionMap map;
|
||||
|
||||
for (auto it = res.GetLoadData().properties.cbegin();
|
||||
it != res.GetLoadData().properties.cend(); it++) {
|
||||
for (auto it = res.get_load_data().properties.cbegin();
|
||||
it != res.get_load_data().properties.cend(); it++) {
|
||||
if (nodes_to_paste_as_new.contains(it.key())) {
|
||||
Node::Position pos;
|
||||
|
||||
@@ -718,106 +718,106 @@ bool NodeParamView::Paste(
|
||||
return true;
|
||||
}
|
||||
|
||||
void NodeParamView::QueueKeyframePositionUpdate()
|
||||
void NodeParamView::queue_keyframe_position_update()
|
||||
{
|
||||
QMetaObject::invokeMethod(this, &NodeParamView::UpdateElementY,
|
||||
QMetaObject::invokeMethod(this, &NodeParamView::update_element_y,
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
|
||||
void NodeParamView::AddContext(Node *ctx)
|
||||
void NodeParamView::add_context(Node *ctx)
|
||||
{
|
||||
NodeParamViewContext *item = GetContextItemFromContext(ctx);
|
||||
NodeParamViewContext *item = get_context_item_from_context(ctx);
|
||||
|
||||
// TEMP: Creating many NPV items is EXTREMELY slow so limit to one item per context for now.
|
||||
// I have a better solution in the works to use one UI for several nodes, but I haven't
|
||||
// done it yet, and this can severely affect productivity.
|
||||
if (item->GetContexts().size() == 1) {
|
||||
if (item->get_contexts().size() == 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Queued so that if any further work is done in connecting this node to the context, it'll be
|
||||
// done before our sorting function is called
|
||||
connect(ctx, &Node::NodeAddedToContext, this,
|
||||
&NodeParamView::NodeAddedToContext, Qt::QueuedConnection);
|
||||
connect(ctx, &Node::NodeRemovedFromContext, this,
|
||||
&NodeParamView::NodeRemovedFromContext, Qt::QueuedConnection);
|
||||
connect(ctx, &Node::node_added_to_context, this,
|
||||
&NodeParamView::node_added_to_context, Qt::QueuedConnection);
|
||||
connect(ctx, &Node::node_removed_from_context, this,
|
||||
&NodeParamView::node_removed_from_context, Qt::QueuedConnection);
|
||||
|
||||
item->AddContext(ctx);
|
||||
item->add_context(ctx);
|
||||
item->setVisible(true);
|
||||
|
||||
for (auto it = ctx->GetContextPositions().cbegin();
|
||||
it != ctx->GetContextPositions().cend(); it++) {
|
||||
AddNode(it.key(), ctx, item);
|
||||
for (auto it = ctx->get_context_positions().cbegin();
|
||||
it != ctx->get_context_positions().cend(); it++) {
|
||||
add_node(it.key(), ctx, item);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamView::RemoveContext(Node *ctx)
|
||||
void NodeParamView::remove_context(Node *ctx)
|
||||
{
|
||||
disconnect(ctx, &Node::NodeAddedToContext, this,
|
||||
&NodeParamView::NodeAddedToContext);
|
||||
disconnect(ctx, &Node::NodeRemovedFromContext, this,
|
||||
&NodeParamView::NodeRemovedFromContext);
|
||||
disconnect(ctx, &Node::node_added_to_context, this,
|
||||
&NodeParamView::node_added_to_context);
|
||||
disconnect(ctx, &Node::node_removed_from_context, this,
|
||||
&NodeParamView::node_removed_from_context);
|
||||
|
||||
foreach (NodeParamViewContext *item, context_items_) {
|
||||
item->RemoveContext(ctx);
|
||||
item->RemoveNodesWithContext(ctx);
|
||||
item->remove_context(ctx);
|
||||
item->remove_nodes_with_context(ctx);
|
||||
|
||||
if (item->GetContexts().isEmpty()) {
|
||||
if (item->get_contexts().isEmpty()) {
|
||||
item->setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamView::AddNode(Node *n, Node *ctx, NodeParamViewContext *context)
|
||||
void NodeParamView::add_node(Node *n, Node *ctx, NodeParamViewContext *context)
|
||||
{
|
||||
if ((n->GetFlags() & Node::kDontShowInParamView) && !IsGroupMode() &&
|
||||
if ((n->get_flags() & Node::k_dont_show_in_param_view) && !is_group_mode() &&
|
||||
!show_all_nodes_) {
|
||||
return;
|
||||
}
|
||||
|
||||
NodeParamViewItem *item = new NodeParamViewItem(
|
||||
n, IsGroupMode() ? kCheckBoxesOnNonConnected : kNoCheckBoxes,
|
||||
context->GetDockArea());
|
||||
n, is_group_mode() ? k_check_boxes_on_non_connected : k_no_check_boxes,
|
||||
context->get_dock_area());
|
||||
|
||||
connect(item, &NodeParamViewItem::RequestSelectNode, this,
|
||||
&NodeParamView::SelectNodeFromConnectedLink);
|
||||
connect(item, &NodeParamViewItem::PinToggled, this,
|
||||
&NodeParamView::PinNode);
|
||||
connect(item, &NodeParamViewItem::InputCheckedChanged, this,
|
||||
&NodeParamView::InputCheckBoxChanged);
|
||||
connect(item, &NodeParamViewItem::Clicked, this,
|
||||
&NodeParamView::ItemClicked);
|
||||
connect(item, &NodeParamViewItem::RequestEditTextInViewer, this,
|
||||
&NodeParamView::RequestEditTextInViewer);
|
||||
connect(item, &NodeParamViewItem::request_select_node, this,
|
||||
&NodeParamView::select_node_from_connected_link);
|
||||
connect(item, &NodeParamViewItem::pin_toggled, this,
|
||||
&NodeParamView::pin_node);
|
||||
connect(item, &NodeParamViewItem::input_checked_changed, this,
|
||||
&NodeParamView::input_check_box_changed);
|
||||
connect(item, &NodeParamViewItem::clicked, this,
|
||||
&NodeParamView::item_clicked);
|
||||
connect(item, &NodeParamViewItem::request_edit_text_in_viewer, this,
|
||||
&NodeParamView::request_edit_text_in_viewer);
|
||||
|
||||
item->SetContext(ctx);
|
||||
item->SetTimeTarget(GetConnectedNode());
|
||||
item->SetTimebase(timebase());
|
||||
item->set_context(ctx);
|
||||
item->set_time_target(get_connected_node());
|
||||
item->set_timebase(timebase());
|
||||
|
||||
context->AddNode(item);
|
||||
context->add_node(item);
|
||||
|
||||
if (!focused_node_ && n->HasGizmos()) {
|
||||
if (!focused_node_ && n->has_gizmos()) {
|
||||
// We'll focus this node now
|
||||
SetSelectedNodes({ item });
|
||||
set_selected_nodes({ item });
|
||||
}
|
||||
|
||||
if (keyframe_view_) {
|
||||
connect(item, &NodeParamViewItem::dockLocationChanged, this,
|
||||
&NodeParamView::QueueKeyframePositionUpdate);
|
||||
connect(item, &NodeParamViewItem::ArrayExpandedChanged, this,
|
||||
&NodeParamView::QueueKeyframePositionUpdate);
|
||||
connect(item, &NodeParamViewItem::ExpandedChanged, this,
|
||||
&NodeParamView::QueueKeyframePositionUpdate);
|
||||
connect(item, &NodeParamViewItem::Moved, this,
|
||||
&NodeParamView::QueueKeyframePositionUpdate);
|
||||
connect(item, &NodeParamViewItem::InputArraySizeChanged, this,
|
||||
&NodeParamView::InputArraySizeChanged);
|
||||
&NodeParamView::queue_keyframe_position_update);
|
||||
connect(item, &NodeParamViewItem::array_expanded_changed, this,
|
||||
&NodeParamView::queue_keyframe_position_update);
|
||||
connect(item, &NodeParamViewItem::expanded_changed, this,
|
||||
&NodeParamView::queue_keyframe_position_update);
|
||||
connect(item, &NodeParamViewItem::moved, this,
|
||||
&NodeParamView::queue_keyframe_position_update);
|
||||
connect(item, &NodeParamViewItem::input_array_size_changed, this,
|
||||
&NodeParamView::input_array_size_changed);
|
||||
|
||||
item->SetKeyframeConnections(keyframe_view_->AddKeyframesOfNode(n));
|
||||
item->set_keyframe_connections(keyframe_view_->add_keyframes_of_node(n));
|
||||
}
|
||||
}
|
||||
|
||||
int GetDistanceBetweenNodes(Node *start, Node *end)
|
||||
int get_distance_between_nodes(Node *start, Node *end)
|
||||
{
|
||||
if (start == end) {
|
||||
return 0;
|
||||
@@ -825,7 +825,7 @@ int GetDistanceBetweenNodes(Node *start, Node *end)
|
||||
|
||||
for (auto it = start->input_connections().cbegin();
|
||||
it != start->input_connections().cend(); it++) {
|
||||
int this_node_dist = GetDistanceBetweenNodes(it->second, end);
|
||||
int this_node_dist = get_distance_between_nodes(it->second, end);
|
||||
if (this_node_dist != -1) {
|
||||
return 1 + this_node_dist;
|
||||
}
|
||||
@@ -834,18 +834,18 @@ int GetDistanceBetweenNodes(Node *start, Node *end)
|
||||
return -1;
|
||||
}
|
||||
|
||||
void NodeParamView::SortItemsInContext(NodeParamViewContext *context_item)
|
||||
void NodeParamView::sort_items_in_context(NodeParamViewContext *context_item)
|
||||
{
|
||||
QVector<QPair<NodeParamViewItem *, int>> distances;
|
||||
|
||||
for (auto it = context_item->GetItems().cbegin();
|
||||
it != context_item->GetItems().cend(); it++) {
|
||||
for (auto it = context_item->get_items().cbegin();
|
||||
it != context_item->get_items().cend(); it++) {
|
||||
NodeParamViewItem *item = *it;
|
||||
|
||||
int distance = -1;
|
||||
foreach (Node *ctx, context_item->GetContexts()) {
|
||||
foreach (Node *ctx, context_item->get_contexts()) {
|
||||
distance =
|
||||
qMax(distance, GetDistanceBetweenNodes(ctx, item->GetNode()));
|
||||
qMax(distance, get_distance_between_nodes(ctx, item->get_node()));
|
||||
}
|
||||
|
||||
if (distance == -1) {
|
||||
@@ -869,22 +869,22 @@ void NodeParamView::SortItemsInContext(NodeParamViewContext *context_item)
|
||||
}
|
||||
|
||||
foreach (auto info, distances) {
|
||||
context_item->GetDockArea()->AddItem(info.first);
|
||||
context_item->get_dock_area()->add_item(info.first);
|
||||
}
|
||||
}
|
||||
|
||||
NodeParamViewContext *NodeParamView::GetContextItemFromContext(Node *ctx)
|
||||
NodeParamViewContext *NodeParamView::get_context_item_from_context(Node *ctx)
|
||||
{
|
||||
Track::Type ctx_type = Track::kCount;
|
||||
Track::Type ctx_type = Track::k_count;
|
||||
|
||||
if (ClipBlock *clip = dynamic_cast<ClipBlock *>(ctx)) {
|
||||
if (clip->track()) {
|
||||
if (clip->track()->type() != Track::kNone) {
|
||||
if (clip->track()->type() != Track::k_none) {
|
||||
ctx_type = clip->track()->type();
|
||||
}
|
||||
}
|
||||
} else if (Track *track = dynamic_cast<Track *>(ctx)) {
|
||||
if (track->type() != Track::kNone) {
|
||||
if (track->type() != Track::k_none) {
|
||||
ctx_type = track->type();
|
||||
}
|
||||
}
|
||||
@@ -892,7 +892,7 @@ NodeParamViewContext *NodeParamView::GetContextItemFromContext(Node *ctx)
|
||||
return context_items_.at(ctx_type);
|
||||
}
|
||||
|
||||
void NodeParamView::ToggleSelect(NodeParamViewItem *item)
|
||||
void NodeParamView::toggle_select(NodeParamViewItem *item)
|
||||
{
|
||||
QVector<NodeParamViewItem *> new_sel;
|
||||
|
||||
@@ -904,31 +904,31 @@ void NodeParamView::ToggleSelect(NodeParamViewItem *item)
|
||||
// De-select this node
|
||||
if (qApp->keyboardModifiers() & Qt::ShiftModifier) {
|
||||
new_sel.removeOne(item);
|
||||
SetSelectedNodes(new_sel, true);
|
||||
set_selected_nodes(new_sel, true);
|
||||
}
|
||||
} else {
|
||||
new_sel.append(item);
|
||||
SetSelectedNodes(new_sel, false);
|
||||
set_selected_nodes(new_sel, false);
|
||||
|
||||
if (!new_sel.contains(focused_node_)) {
|
||||
// This node gets sent to both the curve editor and viewer, so we focus it even if it has
|
||||
// no gizmos
|
||||
focused_node_ = item;
|
||||
|
||||
emit FocusedNodeChanged(focused_node_ ? focused_node_->GetNode() :
|
||||
emit focused_node_changed(focused_node_ ? focused_node_->get_node() :
|
||||
nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QHash<Node *, Node *>
|
||||
NodeParamView::GenerateExistingPasteMap(const ProjectSerializer::Result &r)
|
||||
NodeParamView::generate_existing_paste_map(const ProjectSerializer::Result &r)
|
||||
{
|
||||
QVector<Node *> ignore_nodes;
|
||||
QHash<Node *, Node *> existing_nodes;
|
||||
for (Node *n : r.GetLoadData().nodes) {
|
||||
for (Node *n : r.get_load_data().nodes) {
|
||||
if (Node *existing =
|
||||
GetNodeWithIDAndIgnoreList(n->id(), ignore_nodes)) {
|
||||
get_node_with_id_and_ignore_list(n->id(), ignore_nodes)) {
|
||||
existing_nodes.insert(existing, n);
|
||||
ignore_nodes.append(existing);
|
||||
}
|
||||
@@ -936,18 +936,18 @@ NodeParamView::GenerateExistingPasteMap(const ProjectSerializer::Result &r)
|
||||
return existing_nodes;
|
||||
}
|
||||
|
||||
void NodeParamView::UpdateGlobalScrollBar()
|
||||
void NodeParamView::update_global_scroll_bar()
|
||||
{
|
||||
if (keyframe_view_) {
|
||||
keyframe_view_->SetMaxScroll(param_widget_container_->height() -
|
||||
keyframe_view_->set_max_scroll(param_widget_container_->height() -
|
||||
ruler()->height());
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamView::PinNode(bool pin)
|
||||
void NodeParamView::pin_node(bool pin)
|
||||
{
|
||||
NodeParamViewItem *item = static_cast<NodeParamViewItem *>(sender());
|
||||
Node *node = item->GetNode();
|
||||
Node *node = item->get_node();
|
||||
|
||||
if (pin) {
|
||||
pinned_nodes_.append(node);
|
||||
@@ -991,27 +991,27 @@ void NodeParamView::PinNode(bool pin)
|
||||
}
|
||||
}*/
|
||||
|
||||
void NodeParamView::UpdateElementY()
|
||||
void NodeParamView::update_element_y()
|
||||
{
|
||||
for (NodeParamViewContext *ctx : context_items_) {
|
||||
for (auto it = ctx->GetItems().cbegin(); it != ctx->GetItems().cend();
|
||||
for (auto it = ctx->get_items().cbegin(); it != ctx->get_items().cend();
|
||||
it++) {
|
||||
NodeParamViewItem *item = *it;
|
||||
Node *node = item->GetNode();
|
||||
Node *node = item->get_node();
|
||||
const KeyframeView::NodeConnections &connections =
|
||||
item->GetKeyframeConnections();
|
||||
item->get_keyframe_connections();
|
||||
|
||||
if (!connections.isEmpty()) {
|
||||
for (const QString &input : node->inputs()) {
|
||||
if (!(node->GetInputFlags(input) & kInputFlagHidden)) {
|
||||
if (!(node->get_input_flags(input) & k_input_flag_hidden)) {
|
||||
int arr_sz =
|
||||
NodeGroup::ResolveInput(NodeInput(node, input))
|
||||
.GetArraySize();
|
||||
NodeGroup::resolve_input(NodeInput(node, input))
|
||||
.get_array_size();
|
||||
|
||||
for (int i = -1; i < arr_sz; i++) {
|
||||
NodeInput ic = { node, input, i };
|
||||
|
||||
int y = item->GetElementY(ic);
|
||||
int y = item->get_element_y(ic);
|
||||
|
||||
// For some reason Qt's mapToGlobal doesn't seem to handle this, so we offset here
|
||||
y += vertical_scrollbar_->value();
|
||||
@@ -1024,7 +1024,7 @@ void NodeParamView::UpdateElementY()
|
||||
input_con.at(ic.element() + 1);
|
||||
for (KeyframeViewInputConnection *track :
|
||||
ele_con) {
|
||||
track->SetKeyframeY(y);
|
||||
track->set_keyframe_y(y);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1035,68 +1035,68 @@ void NodeParamView::UpdateElementY()
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamView::NodeAddedToContext(Node *n)
|
||||
void NodeParamView::node_added_to_context(Node *n)
|
||||
{
|
||||
Node *ctx = static_cast<Node *>(sender());
|
||||
NodeParamViewContext *item = GetContextItemFromContext(ctx);
|
||||
NodeParamViewContext *item = get_context_item_from_context(ctx);
|
||||
|
||||
AddNode(n, ctx, item);
|
||||
add_node(n, ctx, item);
|
||||
|
||||
SortItemsInContext(item);
|
||||
sort_items_in_context(item);
|
||||
|
||||
if (keyframe_view_) {
|
||||
QueueKeyframePositionUpdate();
|
||||
queue_keyframe_position_update();
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamView::NodeRemovedFromContext(Node *n)
|
||||
void NodeParamView::node_removed_from_context(Node *n)
|
||||
{
|
||||
Node *ctx = static_cast<Node *>(sender());
|
||||
|
||||
foreach (NodeParamViewContext *ctx_item, context_items_) {
|
||||
ctx_item->RemoveNode(n, ctx);
|
||||
ctx_item->remove_node(n, ctx);
|
||||
}
|
||||
|
||||
if (keyframe_view_) {
|
||||
QueueKeyframePositionUpdate();
|
||||
queue_keyframe_position_update();
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamView::InputCheckBoxChanged(const NodeInput &input, bool e)
|
||||
void NodeParamView::input_check_box_changed(const NodeInput &input, bool e)
|
||||
{
|
||||
NodeGroup *group = static_cast<NodeGroup *>(contexts_.first());
|
||||
|
||||
if (e) {
|
||||
group->AddInputPassthrough(input);
|
||||
group->add_input_passthrough(input);
|
||||
} else {
|
||||
group->RemoveInputPassthrough(input);
|
||||
group->remove_input_passthrough(input);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamView::GroupInputPassthroughAdded(NodeGroup *group,
|
||||
void NodeParamView::group_input_passthrough_added(NodeGroup *group,
|
||||
const NodeInput &input)
|
||||
{
|
||||
foreach (NodeParamViewContext *pvctx, context_items_) {
|
||||
pvctx->SetInputChecked(input, true);
|
||||
pvctx->set_input_checked(input, true);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamView::GroupInputPassthroughRemoved(NodeGroup *group,
|
||||
void NodeParamView::group_input_passthrough_removed(NodeGroup *group,
|
||||
const NodeInput &input)
|
||||
{
|
||||
foreach (NodeParamViewContext *pvctx, context_items_) {
|
||||
pvctx->SetInputChecked(input, false);
|
||||
pvctx->set_input_checked(input, false);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamView::InputArraySizeChanged(const QString &input, int,
|
||||
void NodeParamView::input_array_size_changed(const QString &input, int,
|
||||
int new_size)
|
||||
{
|
||||
NodeParamViewItem *sender =
|
||||
static_cast<NodeParamViewItem *>(this->sender());
|
||||
|
||||
KeyframeView::NodeConnections &connections =
|
||||
sender->GetKeyframeConnections();
|
||||
sender->get_keyframe_connections();
|
||||
KeyframeView::InputConnections &inputs = connections[input];
|
||||
|
||||
int adj_new_size = new_size + 1;
|
||||
@@ -1107,7 +1107,7 @@ void NodeParamView::InputArraySizeChanged(const QString &input, int,
|
||||
for (int i = adj_new_size; i < inputs.size(); i++) {
|
||||
const KeyframeView::ElementConnections &ec = inputs.at(i);
|
||||
for (auto kc : ec) {
|
||||
keyframe_view_->RemoveKeyframesOfTrack(kc);
|
||||
keyframe_view_->remove_keyframes_of_track(kc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1122,13 +1122,13 @@ void NodeParamView::InputArraySizeChanged(const QString &input, int,
|
||||
|
||||
// Fill in extra elements
|
||||
for (int i = old_size; i < inputs.size(); i++) {
|
||||
inputs[i] = keyframe_view_->AddKeyframesOfElement(
|
||||
NodeInput(sender->GetNode(), input, i - 1));
|
||||
inputs[i] = keyframe_view_->add_keyframes_of_element(
|
||||
NodeInput(sender->get_node(), input, i - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QueueKeyframePositionUpdate();
|
||||
queue_keyframe_position_update();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef NODEPARAMVIEW_H
|
||||
#define NODEPARAMVIEW_H
|
||||
#ifndef OAK_NODEPARAMVIEW_H
|
||||
#define OAK_NODEPARAMVIEW_H
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QWidget>
|
||||
@@ -48,104 +48,104 @@ public:
|
||||
|
||||
virtual ~NodeParamView() override;
|
||||
|
||||
void CloseContextsBelongingToProject(Project *p);
|
||||
void close_contexts_belonging_to_project(Project *p);
|
||||
|
||||
void DeleteSelected();
|
||||
|
||||
void SelectAll()
|
||||
void select_all()
|
||||
{
|
||||
keyframe_view_->SelectAll();
|
||||
keyframe_view_->select_all();
|
||||
}
|
||||
|
||||
void DeselectAll()
|
||||
void deselect_all()
|
||||
{
|
||||
keyframe_view_->DeselectAll();
|
||||
keyframe_view_->deselect_all();
|
||||
}
|
||||
|
||||
void SetSelectedNodes(const QVector<NodeParamViewItem *> &nodes,
|
||||
void set_selected_nodes(const QVector<NodeParamViewItem *> &nodes,
|
||||
bool handle_focused_node = true,
|
||||
bool emit_signal = true);
|
||||
void SetSelectedNodes(const QVector<Node::ContextPair> &nodes,
|
||||
void set_selected_nodes(const QVector<Node::ContextPair> &nodes,
|
||||
bool emit_signal = true);
|
||||
|
||||
Node *GetNodeWithID(const QString &id);
|
||||
Node *GetNodeWithIDAndIgnoreList(const QString &id,
|
||||
Node *get_node_with_id(const QString &id);
|
||||
Node *get_node_with_id_and_ignore_list(const QString &id,
|
||||
const QVector<Node *> &ignore);
|
||||
|
||||
const QVector<Node *> &GetContexts() const
|
||||
const QVector<Node *> &get_contexts() const
|
||||
{
|
||||
return contexts_;
|
||||
}
|
||||
|
||||
virtual bool CopySelected(bool cut) override;
|
||||
virtual bool copy_selected(bool cut) override;
|
||||
|
||||
virtual bool Paste() override;
|
||||
static bool Paste(
|
||||
virtual bool paste() override;
|
||||
static bool paste(
|
||||
QWidget *parent,
|
||||
std::function<QHash<Node *, Node *>(const ProjectSerializer::Result &)>
|
||||
get_existing_map_function);
|
||||
|
||||
public slots:
|
||||
void SetContexts(const QVector<Node *> &contexts);
|
||||
void set_contexts(const QVector<Node *> &contexts);
|
||||
|
||||
void UpdateElementY();
|
||||
void update_element_y();
|
||||
|
||||
signals:
|
||||
void FocusedNodeChanged(Node *n);
|
||||
void focused_node_changed(Node *n);
|
||||
|
||||
void SelectedNodesChanged(const QVector<Node::ContextPair> &nodes);
|
||||
void selected_nodes_changed(const QVector<Node::ContextPair> &nodes);
|
||||
|
||||
void RequestViewerToStartEditingText();
|
||||
void request_viewer_to_start_editing_text();
|
||||
|
||||
protected:
|
||||
virtual void resizeEvent(QResizeEvent *event) override;
|
||||
|
||||
virtual void ScaleChangedEvent(const double &) override;
|
||||
virtual void TimebaseChangedEvent(const rational &) override;
|
||||
virtual void TimebaseChangedEvent(const Rational &) override;
|
||||
|
||||
virtual void ConnectedNodeChangeEvent(ViewerOutput *n) override;
|
||||
|
||||
virtual const QVector<KeyframeViewInputConnection *> *
|
||||
GetSnapKeyframes() const override
|
||||
get_snap_keyframes() const override
|
||||
{
|
||||
return keyframe_view_ ? &keyframe_view_->GetKeyframeTracks() : nullptr;
|
||||
return keyframe_view_ ? &keyframe_view_->get_keyframe_tracks() : nullptr;
|
||||
}
|
||||
|
||||
virtual const std::vector<NodeKeyframe *> *
|
||||
GetSnapIgnoreKeyframes() const override
|
||||
get_snap_ignore_keyframes() const override
|
||||
{
|
||||
return keyframe_view_ ? &keyframe_view_->GetSelectedKeyframes() :
|
||||
return keyframe_view_ ? &keyframe_view_->get_selected_keyframes() :
|
||||
nullptr;
|
||||
}
|
||||
|
||||
virtual const TimeTargetObject *GetKeyframeTimeTarget() const override
|
||||
virtual const TimeTargetObject *get_keyframe_time_target() const override
|
||||
{
|
||||
return keyframe_view_;
|
||||
}
|
||||
|
||||
private:
|
||||
void QueueKeyframePositionUpdate();
|
||||
void queue_keyframe_position_update();
|
||||
|
||||
void AddContext(Node *context);
|
||||
void add_context(Node *context);
|
||||
|
||||
void RemoveContext(Node *context);
|
||||
void remove_context(Node *context);
|
||||
|
||||
void AddNode(Node *n, Node *ctx, NodeParamViewContext *context);
|
||||
void add_node(Node *n, Node *ctx, NodeParamViewContext *context);
|
||||
|
||||
void SortItemsInContext(NodeParamViewContext *context);
|
||||
void sort_items_in_context(NodeParamViewContext *context);
|
||||
|
||||
NodeParamViewContext *GetContextItemFromContext(Node *context);
|
||||
NodeParamViewContext *get_context_item_from_context(Node *context);
|
||||
|
||||
bool IsGroupMode() const
|
||||
bool is_group_mode() const
|
||||
{
|
||||
return contexts_.size() == 1 &&
|
||||
dynamic_cast<NodeGroup *>(contexts_.first());
|
||||
}
|
||||
|
||||
void ToggleSelect(NodeParamViewItem *item);
|
||||
void toggle_select(NodeParamViewItem *item);
|
||||
|
||||
QHash<Node *, Node *>
|
||||
GenerateExistingPasteMap(const ProjectSerializer::Result &r);
|
||||
generate_existing_paste_map(const ProjectSerializer::Result &r);
|
||||
|
||||
KeyframeView *keyframe_view_;
|
||||
|
||||
@@ -174,38 +174,38 @@ private:
|
||||
bool show_all_nodes_;
|
||||
|
||||
private slots:
|
||||
void UpdateGlobalScrollBar();
|
||||
void update_global_scroll_bar();
|
||||
|
||||
void PinNode(bool pin);
|
||||
void pin_node(bool pin);
|
||||
|
||||
//void FocusChanged(QWidget *old, QWidget *now);
|
||||
|
||||
void NodeAddedToContext(Node *n);
|
||||
void node_added_to_context(Node *n);
|
||||
|
||||
void NodeRemovedFromContext(Node *n);
|
||||
void node_removed_from_context(Node *n);
|
||||
|
||||
void InputCheckBoxChanged(const NodeInput &input, bool e);
|
||||
void input_check_box_changed(const NodeInput &input, bool e);
|
||||
|
||||
void GroupInputPassthroughAdded(olive::NodeGroup *group,
|
||||
void group_input_passthrough_added(olive::NodeGroup *group,
|
||||
const olive::NodeInput &input);
|
||||
|
||||
void GroupInputPassthroughRemoved(olive::NodeGroup *group,
|
||||
void group_input_passthrough_removed(olive::NodeGroup *group,
|
||||
const olive::NodeInput &input);
|
||||
|
||||
void UpdateContexts();
|
||||
void update_contexts();
|
||||
|
||||
void ItemAboutToBeRemoved(NodeParamViewItem *item);
|
||||
void item_about_to_be_removed(NodeParamViewItem *item);
|
||||
|
||||
void ItemClicked();
|
||||
void item_clicked();
|
||||
|
||||
void SelectNodeFromConnectedLink(Node *node);
|
||||
void select_node_from_connected_link(Node *node);
|
||||
|
||||
void RequestEditTextInViewer();
|
||||
void request_edit_text_in_viewer();
|
||||
|
||||
void InputArraySizeChanged(const QString &input, int old_size,
|
||||
void input_array_size_changed(const QString &input, int old_size,
|
||||
int new_size);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // NODEPARAMVIEW_H
|
||||
#endif // OAK_NODEPARAMVIEW_H
|
||||
|
||||
@@ -41,20 +41,20 @@ NodeParamViewArrayWidget::NodeParamViewArrayWidget(Node *node,
|
||||
count_lbl_ = new QLabel();
|
||||
layout->addWidget(count_lbl_);
|
||||
|
||||
connect(node_, &Node::InputArraySizeChanged, this,
|
||||
&NodeParamViewArrayWidget::UpdateCounter);
|
||||
connect(node_, &Node::input_array_size_changed, this,
|
||||
&NodeParamViewArrayWidget::update_counter);
|
||||
|
||||
UpdateCounter(input_, 0, node_->InputArraySize(input_));
|
||||
update_counter(input_, 0, node_->input_array_size(input_));
|
||||
}
|
||||
|
||||
void NodeParamViewArrayWidget::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
{
|
||||
QWidget::mouseDoubleClickEvent(event);
|
||||
|
||||
emit DoubleClicked();
|
||||
emit double_clicked();
|
||||
}
|
||||
|
||||
void NodeParamViewArrayWidget::UpdateCounter(const QString &input, int old_size,
|
||||
void NodeParamViewArrayWidget::update_counter(const QString &input, int old_size,
|
||||
int new_size)
|
||||
{
|
||||
Q_UNUSED(old_size)
|
||||
@@ -68,7 +68,7 @@ NodeParamViewArrayButton::NodeParamViewArrayButton(
|
||||
: QPushButton(parent)
|
||||
, type_(type)
|
||||
{
|
||||
Retranslate();
|
||||
retranslate();
|
||||
|
||||
int sz = sizeHint().height() / 3 * 2;
|
||||
setFixedSize(sz, sz);
|
||||
@@ -77,15 +77,15 @@ NodeParamViewArrayButton::NodeParamViewArrayButton(
|
||||
void NodeParamViewArrayButton::changeEvent(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::LanguageChange) {
|
||||
Retranslate();
|
||||
retranslate();
|
||||
}
|
||||
|
||||
QPushButton::changeEvent(event);
|
||||
}
|
||||
|
||||
void NodeParamViewArrayButton::Retranslate()
|
||||
void NodeParamViewArrayButton::retranslate()
|
||||
{
|
||||
if (type_ == kAdd) {
|
||||
if (type_ == k_add) {
|
||||
setText(tr("+"));
|
||||
} else {
|
||||
setText(tr("-"));
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef NODEPARAMVIEWARRAYWIDGET_H
|
||||
#define NODEPARAMVIEWARRAYWIDGET_H
|
||||
#ifndef OAK_NODEPARAMVIEWARRAYWIDGET_H
|
||||
#define OAK_NODEPARAMVIEWARRAYWIDGET_H
|
||||
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
@@ -34,7 +34,7 @@ namespace olive
|
||||
class NodeParamViewArrayButton : public QPushButton {
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Type { kAdd, kRemove };
|
||||
enum Type { k_add, k_remove };
|
||||
|
||||
NodeParamViewArrayButton(Type type, QWidget *parent = nullptr);
|
||||
|
||||
@@ -42,7 +42,7 @@ protected:
|
||||
virtual void changeEvent(QEvent *event) override;
|
||||
|
||||
private:
|
||||
void Retranslate();
|
||||
void retranslate();
|
||||
|
||||
Type type_;
|
||||
};
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
void DoubleClicked();
|
||||
void double_clicked();
|
||||
|
||||
protected:
|
||||
virtual void mouseDoubleClickEvent(QMouseEvent *event) override;
|
||||
@@ -67,9 +67,9 @@ private:
|
||||
QLabel *count_lbl_;
|
||||
|
||||
private slots:
|
||||
void UpdateCounter(const QString &input, int old_size, int new_size);
|
||||
void update_counter(const QString &input, int old_size, int new_size);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // NODEPARAMVIEWARRAYWIDGET_H
|
||||
#endif // OAK_NODEPARAMVIEWARRAYWIDGET_H
|
||||
|
||||
@@ -51,7 +51,7 @@ NodeParamViewConnectedLabel::NodeParamViewConnectedLabel(const NodeInput &input,
|
||||
// Set up label area
|
||||
QHBoxLayout *label_layout = new QHBoxLayout();
|
||||
label_layout->setSpacing(
|
||||
QtUtils::QFontMetricsWidth(fontMetrics(), QStringLiteral(" ")));
|
||||
QtUtils::q_font_metrics_width(fontMetrics(), QStringLiteral(" ")));
|
||||
label_layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->addLayout(label_layout);
|
||||
|
||||
@@ -64,10 +64,10 @@ NodeParamViewConnectedLabel::NodeParamViewConnectedLabel(const NodeInput &input,
|
||||
connected_to_lbl_ = new ClickableLabel(this);
|
||||
connected_to_lbl_->setCursor(Qt::PointingHandCursor);
|
||||
connected_to_lbl_->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(connected_to_lbl_, &ClickableLabel::MouseClicked, this,
|
||||
&NodeParamViewConnectedLabel::ConnectionClicked);
|
||||
connect(connected_to_lbl_, &ClickableLabel::mouse_clicked, this,
|
||||
&NodeParamViewConnectedLabel::connection_clicked);
|
||||
connect(connected_to_lbl_, &ClickableLabel::customContextMenuRequested,
|
||||
this, &NodeParamViewConnectedLabel::ShowLabelContextMenu);
|
||||
this, &NodeParamViewConnectedLabel::show_label_context_menu);
|
||||
label_layout->addWidget(connected_to_lbl_);
|
||||
|
||||
label_layout->addStretch();
|
||||
@@ -78,47 +78,47 @@ NodeParamViewConnectedLabel::NodeParamViewConnectedLabel(const NodeInput &input,
|
||||
connected_to_lbl_->setForegroundRole(QPalette::Link);
|
||||
connected_to_lbl_->setFont(link_font);
|
||||
|
||||
if (input_.IsConnected()) {
|
||||
InputConnected(input_.GetConnectedOutput(), input_);
|
||||
if (input_.is_connected()) {
|
||||
input_connected(input_.get_connected_output(), input_);
|
||||
} else {
|
||||
InputDisconnected(nullptr, input_);
|
||||
input_disconnected(nullptr, input_);
|
||||
}
|
||||
|
||||
connect(input_.node(), &Node::InputConnected, this,
|
||||
&NodeParamViewConnectedLabel::InputConnected);
|
||||
connect(input_.node(), &Node::InputDisconnected, this,
|
||||
&NodeParamViewConnectedLabel::InputDisconnected);
|
||||
connect(input_.node(), &Node::input_connected, this,
|
||||
&NodeParamViewConnectedLabel::input_connected);
|
||||
connect(input_.node(), &Node::input_disconnected, this,
|
||||
&NodeParamViewConnectedLabel::input_disconnected);
|
||||
|
||||
// Creating the tree is expensive, hold off until the user specifically requests it
|
||||
value_tree_ = nullptr;
|
||||
connect(collapse_btn, &CollapseButton::toggled, this,
|
||||
&NodeParamViewConnectedLabel::SetValueTreeVisible);
|
||||
&NodeParamViewConnectedLabel::set_value_tree_visible);
|
||||
}
|
||||
|
||||
void NodeParamViewConnectedLabel::SetViewerNode(ViewerOutput *viewer)
|
||||
void NodeParamViewConnectedLabel::set_viewer_node(ViewerOutput *viewer)
|
||||
{
|
||||
if (viewer_) {
|
||||
disconnect(viewer_, &ViewerOutput::PlayheadChanged, this,
|
||||
&NodeParamViewConnectedLabel::UpdateValueTree);
|
||||
disconnect(viewer_, &ViewerOutput::playhead_changed, this,
|
||||
&NodeParamViewConnectedLabel::update_value_tree);
|
||||
}
|
||||
|
||||
viewer_ = viewer;
|
||||
|
||||
if (viewer_) {
|
||||
connect(viewer_, &ViewerOutput::PlayheadChanged, this,
|
||||
&NodeParamViewConnectedLabel::UpdateValueTree);
|
||||
UpdateValueTree();
|
||||
connect(viewer_, &ViewerOutput::playhead_changed, this,
|
||||
&NodeParamViewConnectedLabel::update_value_tree);
|
||||
update_value_tree();
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewConnectedLabel::CreateTree()
|
||||
void NodeParamViewConnectedLabel::create_tree()
|
||||
{
|
||||
// Set up table area
|
||||
value_tree_ = new NodeValueTree(this);
|
||||
layout()->addWidget(value_tree_);
|
||||
}
|
||||
|
||||
void NodeParamViewConnectedLabel::InputConnected(Node *output,
|
||||
void NodeParamViewConnectedLabel::input_connected(Node *output,
|
||||
const NodeInput &input)
|
||||
{
|
||||
if (input_ != input) {
|
||||
@@ -127,10 +127,10 @@ void NodeParamViewConnectedLabel::InputConnected(Node *output,
|
||||
|
||||
connected_node_ = output;
|
||||
|
||||
UpdateLabel();
|
||||
update_label();
|
||||
}
|
||||
|
||||
void NodeParamViewConnectedLabel::InputDisconnected(Node *output,
|
||||
void NodeParamViewConnectedLabel::input_disconnected(Node *output,
|
||||
const NodeInput &input)
|
||||
{
|
||||
if (input_ != input) {
|
||||
@@ -141,10 +141,10 @@ void NodeParamViewConnectedLabel::InputDisconnected(Node *output,
|
||||
|
||||
connected_node_ = nullptr;
|
||||
|
||||
UpdateLabel();
|
||||
update_label();
|
||||
}
|
||||
|
||||
void NodeParamViewConnectedLabel::ShowLabelContextMenu()
|
||||
void NodeParamViewConnectedLabel::show_label_context_menu()
|
||||
{
|
||||
Menu m(this);
|
||||
|
||||
@@ -152,25 +152,25 @@ void NodeParamViewConnectedLabel::ShowLabelContextMenu()
|
||||
connect(disconnect_action, &QAction::triggered, this, [this]() {
|
||||
Core::instance()->undo_stack()->push(
|
||||
new NodeEdgeRemoveCommand(connected_node_, input_),
|
||||
Node::GetDisconnectCommandString(connected_node_, input_));
|
||||
Node::get_disconnect_command_string(connected_node_, input_));
|
||||
});
|
||||
|
||||
m.exec(QCursor::pos());
|
||||
}
|
||||
|
||||
void NodeParamViewConnectedLabel::ConnectionClicked()
|
||||
void NodeParamViewConnectedLabel::connection_clicked()
|
||||
{
|
||||
if (connected_node_) {
|
||||
emit RequestSelectNode(connected_node_);
|
||||
emit request_select_node(connected_node_);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewConnectedLabel::UpdateLabel()
|
||||
void NodeParamViewConnectedLabel::update_label()
|
||||
{
|
||||
QString s;
|
||||
|
||||
if (connected_node_) {
|
||||
s = connected_node_->Name();
|
||||
s = connected_node_->name();
|
||||
} else {
|
||||
s = tr("Nothing");
|
||||
}
|
||||
@@ -178,14 +178,14 @@ void NodeParamViewConnectedLabel::UpdateLabel()
|
||||
connected_to_lbl_->setText(s);
|
||||
}
|
||||
|
||||
void NodeParamViewConnectedLabel::UpdateValueTree()
|
||||
void NodeParamViewConnectedLabel::update_value_tree()
|
||||
{
|
||||
if (value_tree_ && viewer_ && value_tree_->isVisible()) {
|
||||
value_tree_->SetNode(input_, viewer_->GetPlayhead());
|
||||
value_tree_->set_node(input_, viewer_->get_playhead());
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewConnectedLabel::SetValueTreeVisible(bool e)
|
||||
void NodeParamViewConnectedLabel::set_value_tree_visible(bool e)
|
||||
{
|
||||
if (value_tree_) {
|
||||
value_tree_->setVisible(e);
|
||||
@@ -193,11 +193,11 @@ void NodeParamViewConnectedLabel::SetValueTreeVisible(bool e)
|
||||
|
||||
if (e) {
|
||||
if (!value_tree_) {
|
||||
CreateTree();
|
||||
create_tree();
|
||||
value_tree_->setVisible(true);
|
||||
}
|
||||
|
||||
UpdateValueTree();
|
||||
update_value_tree();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef NODEPARAMVIEWCONNECTEDLABEL_H
|
||||
#define NODEPARAMVIEWCONNECTEDLABEL_H
|
||||
#ifndef OAK_NODEPARAMVIEWCONNECTEDLABEL_H
|
||||
#define OAK_NODEPARAMVIEWCONNECTEDLABEL_H
|
||||
|
||||
#include "node/param.h"
|
||||
#include "widget/clickablelabel/clickablelabel.h"
|
||||
@@ -35,26 +35,26 @@ public:
|
||||
NodeParamViewConnectedLabel(const NodeInput &input,
|
||||
QWidget *parent = nullptr);
|
||||
|
||||
void SetViewerNode(ViewerOutput *viewer);
|
||||
void set_viewer_node(ViewerOutput *viewer);
|
||||
|
||||
signals:
|
||||
void RequestSelectNode(Node *n);
|
||||
void request_select_node(Node *n);
|
||||
|
||||
private slots:
|
||||
void InputConnected(Node *output, const NodeInput &input);
|
||||
void input_connected(Node *output, const NodeInput &input);
|
||||
|
||||
void InputDisconnected(Node *output, const NodeInput &input);
|
||||
void input_disconnected(Node *output, const NodeInput &input);
|
||||
|
||||
void ShowLabelContextMenu();
|
||||
void show_label_context_menu();
|
||||
|
||||
void ConnectionClicked();
|
||||
void connection_clicked();
|
||||
|
||||
private:
|
||||
void UpdateLabel();
|
||||
void update_label();
|
||||
|
||||
void UpdateValueTree();
|
||||
void update_value_tree();
|
||||
|
||||
void CreateTree();
|
||||
void create_tree();
|
||||
|
||||
ClickableLabel *connected_to_lbl_;
|
||||
|
||||
@@ -67,9 +67,9 @@ private:
|
||||
ViewerOutput *viewer_;
|
||||
|
||||
private slots:
|
||||
void SetValueTreeVisible(bool e);
|
||||
void set_value_tree_visible(bool e);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // NODEPARAMVIEWCONNECTEDLABEL_H
|
||||
#endif // OAK_NODEPARAMVIEWCONNECTEDLABEL_H
|
||||
|
||||
@@ -34,29 +34,29 @@ namespace olive
|
||||
|
||||
NodeParamViewContext::NodeParamViewContext(QWidget *parent)
|
||||
: super(parent)
|
||||
, type_(Track::kNone)
|
||||
, type_(Track::k_none)
|
||||
{
|
||||
QWidget *body = new QWidget();
|
||||
QHBoxLayout *body_layout = new QHBoxLayout(body);
|
||||
SetBody(body);
|
||||
set_body(body);
|
||||
|
||||
dock_area_ = new NodeParamViewDockArea();
|
||||
body_layout->addWidget(dock_area_);
|
||||
|
||||
setBackgroundRole(QPalette::Base);
|
||||
|
||||
Retranslate();
|
||||
retranslate();
|
||||
|
||||
connect(title_bar(), &NodeParamViewItemTitleBar::AddEffectButtonClicked,
|
||||
this, &NodeParamViewContext::AddEffectButtonClicked);
|
||||
connect(title_bar(), &NodeParamViewItemTitleBar::add_effect_button_clicked,
|
||||
this, &NodeParamViewContext::add_effect_button_clicked);
|
||||
}
|
||||
|
||||
NodeParamViewItem *NodeParamViewContext::GetItem(Node *node, Node *ctx)
|
||||
NodeParamViewItem *NodeParamViewContext::get_item(Node *node, Node *ctx)
|
||||
{
|
||||
for (auto it = items_.begin(); it != items_.end(); it++) {
|
||||
NodeParamViewItem *item = *it;
|
||||
|
||||
if (item->GetNode() == node && item->GetContext() == ctx) {
|
||||
if (item->get_node() == node && item->get_context() == ctx) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
@@ -64,20 +64,20 @@ NodeParamViewItem *NodeParamViewContext::GetItem(Node *node, Node *ctx)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void NodeParamViewContext::AddNode(NodeParamViewItem *item)
|
||||
void NodeParamViewContext::add_node(NodeParamViewItem *item)
|
||||
{
|
||||
items_.append(item);
|
||||
dock_area_->AddItem(item);
|
||||
dock_area_->add_item(item);
|
||||
}
|
||||
|
||||
void NodeParamViewContext::RemoveNode(Node *node, Node *ctx)
|
||||
void NodeParamViewContext::remove_node(Node *node, Node *ctx)
|
||||
{
|
||||
for (auto it = items_.begin(); it != items_.end();) {
|
||||
NodeParamViewItem *item = *it;
|
||||
|
||||
if (item->GetNode() == node && item->GetContext() == ctx) {
|
||||
emit AboutToDeleteItem(item);
|
||||
dock_area_->RemoveItem(item);
|
||||
if (item->get_node() == node && item->get_context() == ctx) {
|
||||
emit about_to_delete_item(item);
|
||||
dock_area_->remove_item(item);
|
||||
it = items_.erase(it);
|
||||
} else {
|
||||
it++;
|
||||
@@ -85,14 +85,14 @@ void NodeParamViewContext::RemoveNode(Node *node, Node *ctx)
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewContext::RemoveNodesWithContext(Node *ctx)
|
||||
void NodeParamViewContext::remove_nodes_with_context(Node *ctx)
|
||||
{
|
||||
for (auto it = items_.begin(); it != items_.end();) {
|
||||
NodeParamViewItem *item = *it;
|
||||
|
||||
if (item->GetContext() == ctx) {
|
||||
emit AboutToDeleteItem(item);
|
||||
dock_area_->RemoveItem(item);
|
||||
if (item->get_context() == ctx) {
|
||||
emit about_to_delete_item(item);
|
||||
dock_area_->remove_item(item);
|
||||
it = items_.erase(it);
|
||||
} else {
|
||||
it++;
|
||||
@@ -100,72 +100,72 @@ void NodeParamViewContext::RemoveNodesWithContext(Node *ctx)
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewContext::SetInputChecked(const NodeInput &input, bool e)
|
||||
void NodeParamViewContext::set_input_checked(const NodeInput &input, bool e)
|
||||
{
|
||||
foreach (NodeParamViewItem *item, items_) {
|
||||
if (item->GetNode() == input.node()) {
|
||||
item->SetInputChecked(input, e);
|
||||
if (item->get_node() == input.node()) {
|
||||
item->set_input_checked(input, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewContext::SetTimebase(const rational &timebase)
|
||||
void NodeParamViewContext::set_timebase(const Rational &timebase)
|
||||
{
|
||||
foreach (NodeParamViewItem *item, items_) {
|
||||
item->SetTimebase(timebase);
|
||||
item->set_timebase(timebase);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewContext::SetTimeTarget(ViewerOutput *n)
|
||||
void NodeParamViewContext::set_time_target(ViewerOutput *n)
|
||||
{
|
||||
foreach (NodeParamViewItem *item, items_) {
|
||||
item->SetTimeTarget(n);
|
||||
item->set_time_target(n);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewContext::SetEffectType(Track::Type type)
|
||||
void NodeParamViewContext::set_effect_type(Track::Type type)
|
||||
{
|
||||
type_ = type;
|
||||
}
|
||||
|
||||
void NodeParamViewContext::Retranslate()
|
||||
void NodeParamViewContext::retranslate()
|
||||
{
|
||||
}
|
||||
|
||||
void NodeParamViewContext::AddEffectButtonClicked()
|
||||
void NodeParamViewContext::add_effect_button_clicked()
|
||||
{
|
||||
Node::Flag flag = Node::kNone;
|
||||
Node::Flag flag = Node::k_none;
|
||||
|
||||
if (type_ == Track::kVideo) {
|
||||
flag = Node::kVideoEffect;
|
||||
if (type_ == Track::k_video) {
|
||||
flag = Node::k_video_effect;
|
||||
} else {
|
||||
flag = Node::kAudioEffect;
|
||||
flag = Node::k_audio_effect;
|
||||
}
|
||||
|
||||
if (flag == Node::kNone) {
|
||||
if (flag == Node::k_none) {
|
||||
return;
|
||||
}
|
||||
|
||||
Menu *m =
|
||||
NodeFactory::CreateMenu(this, false, Node::kCategoryUnknown, flag);
|
||||
NodeFactory::create_menu(this, false, Node::k_category_unknown, flag);
|
||||
connect(m, &Menu::triggered, this,
|
||||
&NodeParamViewContext::AddEffectMenuItemTriggered);
|
||||
&NodeParamViewContext::add_effect_menu_item_triggered);
|
||||
m->exec(QCursor::pos());
|
||||
delete m;
|
||||
}
|
||||
|
||||
void NodeParamViewContext::AddEffectMenuItemTriggered(QAction *a)
|
||||
void NodeParamViewContext::add_effect_menu_item_triggered(QAction *a)
|
||||
{
|
||||
Node *n = NodeFactory::CreateFromMenuAction(a);
|
||||
|
||||
if (n) {
|
||||
NodeInput new_node_input = n->GetEffectInput();
|
||||
NodeInput new_node_input = n->get_effect_input();
|
||||
MultiUndoCommand *command = new MultiUndoCommand();
|
||||
|
||||
QVector<Project *> graphs_added_to;
|
||||
|
||||
foreach (Node *ctx, contexts_) {
|
||||
NodeInput ctx_input = ctx->GetEffectInput();
|
||||
NodeInput ctx_input = ctx->get_effect_input();
|
||||
|
||||
if (!graphs_added_to.contains(ctx->parent())) {
|
||||
command->add_child(new NodeAddCommand(ctx->parent(), n));
|
||||
@@ -173,12 +173,12 @@ void NodeParamViewContext::AddEffectMenuItemTriggered(QAction *a)
|
||||
}
|
||||
|
||||
command->add_child(new NodeSetPositionCommand(
|
||||
n, ctx, ctx->GetNodePositionInContext(ctx)));
|
||||
n, ctx, ctx->get_node_position_in_context(ctx)));
|
||||
command->add_child(new NodeSetPositionCommand(
|
||||
ctx, ctx, ctx->GetNodePositionInContext(ctx) + QPointF(1, 0)));
|
||||
ctx, ctx, ctx->get_node_position_in_context(ctx) + QPointF(1, 0)));
|
||||
|
||||
if (ctx_input.IsConnected()) {
|
||||
Node *prev_output = ctx_input.GetConnectedOutput();
|
||||
if (ctx_input.is_connected()) {
|
||||
Node *prev_output = ctx_input.get_connected_output();
|
||||
|
||||
command->add_child(
|
||||
new NodeEdgeRemoveCommand(prev_output, ctx_input));
|
||||
@@ -190,7 +190,7 @@ void NodeParamViewContext::AddEffectMenuItemTriggered(QAction *a)
|
||||
}
|
||||
|
||||
Core::instance()->undo_stack()->push(
|
||||
command, tr("Added %1 to Node Chain").arg(n->Name()));
|
||||
command, tr("Added %1 to Node Chain").arg(n->name()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef NODEPARAMVIEWCONTEXT_H
|
||||
#define NODEPARAMVIEWCONTEXT_H
|
||||
#ifndef OAK_NODEPARAMVIEWCONTEXT_H
|
||||
#define OAK_NODEPARAMVIEWCONTEXT_H
|
||||
|
||||
#include "nodeparamviewdockarea.h"
|
||||
#include "nodeparamviewitembase.h"
|
||||
@@ -34,53 +34,53 @@ class NodeParamViewContext : public NodeParamViewItemBase {
|
||||
public:
|
||||
NodeParamViewContext(QWidget *parent = nullptr);
|
||||
|
||||
NodeParamViewDockArea *GetDockArea() const
|
||||
NodeParamViewDockArea *get_dock_area() const
|
||||
{
|
||||
return dock_area_;
|
||||
}
|
||||
|
||||
const QVector<Node *> &GetContexts() const
|
||||
const QVector<Node *> &get_contexts() const
|
||||
{
|
||||
return contexts_;
|
||||
}
|
||||
|
||||
const QVector<NodeParamViewItem *> &GetItems() const
|
||||
const QVector<NodeParamViewItem *> &get_items() const
|
||||
{
|
||||
return items_;
|
||||
}
|
||||
|
||||
NodeParamViewItem *GetItem(Node *node, Node *ctx);
|
||||
NodeParamViewItem *get_item(Node *node, Node *ctx);
|
||||
|
||||
void AddNode(NodeParamViewItem *item);
|
||||
void add_node(NodeParamViewItem *item);
|
||||
|
||||
void RemoveNode(Node *node, Node *ctx);
|
||||
void remove_node(Node *node, Node *ctx);
|
||||
|
||||
void RemoveNodesWithContext(Node *ctx);
|
||||
void remove_nodes_with_context(Node *ctx);
|
||||
|
||||
void SetInputChecked(const NodeInput &input, bool e);
|
||||
void set_input_checked(const NodeInput &input, bool e);
|
||||
|
||||
void SetTimebase(const rational &timebase);
|
||||
void set_timebase(const Rational &timebase);
|
||||
|
||||
void SetTimeTarget(ViewerOutput *n);
|
||||
void set_time_target(ViewerOutput *n);
|
||||
|
||||
void SetEffectType(Track::Type type);
|
||||
void set_effect_type(Track::Type type);
|
||||
|
||||
signals:
|
||||
void AboutToDeleteItem(NodeParamViewItem *item);
|
||||
void about_to_delete_item(NodeParamViewItem *item);
|
||||
|
||||
public slots:
|
||||
void AddContext(Node *node)
|
||||
void add_context(Node *node)
|
||||
{
|
||||
contexts_.append(node);
|
||||
}
|
||||
|
||||
void RemoveContext(Node *node)
|
||||
void remove_context(Node *node)
|
||||
{
|
||||
contexts_.removeOne(node);
|
||||
}
|
||||
|
||||
protected slots:
|
||||
virtual void Retranslate() override;
|
||||
virtual void retranslate() override;
|
||||
|
||||
private:
|
||||
NodeParamViewDockArea *dock_area_;
|
||||
@@ -92,11 +92,11 @@ private:
|
||||
Track::Type type_;
|
||||
|
||||
private slots:
|
||||
void AddEffectButtonClicked();
|
||||
void add_effect_button_clicked();
|
||||
|
||||
void AddEffectMenuItemTriggered(QAction *a);
|
||||
void add_effect_menu_item_triggered(QAction *a);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // NODEPARAMVIEWCONTEXT_H
|
||||
#endif // OAK_NODEPARAMVIEWCONTEXT_H
|
||||
|
||||
@@ -42,7 +42,7 @@ QMenu *NodeParamViewDockArea::createPopupMenu()
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void NodeParamViewDockArea::AddItem(QDockWidget *item)
|
||||
void NodeParamViewDockArea::add_item(QDockWidget *item)
|
||||
{
|
||||
item->setAllowedAreas(Qt::LeftDockWidgetArea);
|
||||
item->setFeatures(QDockWidget::DockWidgetClosable |
|
||||
@@ -50,7 +50,7 @@ void NodeParamViewDockArea::AddItem(QDockWidget *item)
|
||||
addDockWidget(Qt::LeftDockWidgetArea, item);
|
||||
}
|
||||
|
||||
void NodeParamViewDockArea::RemoveItem(QDockWidget *item)
|
||||
void NodeParamViewDockArea::remove_item(QDockWidget *item)
|
||||
{
|
||||
if (!item) {
|
||||
return;
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef NODEPARAMVIEWDOCKAREA_H
|
||||
#define NODEPARAMVIEWDOCKAREA_H
|
||||
#ifndef OAK_NODEPARAMVIEWDOCKAREA_H
|
||||
#define OAK_NODEPARAMVIEWDOCKAREA_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
@@ -36,10 +36,10 @@ public:
|
||||
|
||||
virtual QMenu *createPopupMenu() override;
|
||||
|
||||
void AddItem(QDockWidget *item);
|
||||
void RemoveItem(QDockWidget *item);
|
||||
void add_item(QDockWidget *item);
|
||||
void remove_item(QDockWidget *item);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // NODEPARAMVIEWDOCKAREA_H
|
||||
#endif // OAK_NODEPARAMVIEWDOCKAREA_H
|
||||
|
||||
@@ -30,21 +30,21 @@
|
||||
#include "node/group/group.h"
|
||||
#include "node/nodeundo.h"
|
||||
#include "node/project/sequence/sequence.h"
|
||||
#include "pluginSupport/OlivePluginInstance.h"
|
||||
#include "pluginSupport/oliveplugininstance.h"
|
||||
|
||||
namespace olive
|
||||
{
|
||||
|
||||
const int NodeParamViewItemBody::kKeyControlColumn = 10;
|
||||
const int NodeParamViewItemBody::kArrayInsertColumn = kKeyControlColumn - 1;
|
||||
const int NodeParamViewItemBody::kArrayRemoveColumn = kArrayInsertColumn - 1;
|
||||
const int NodeParamViewItemBody::kExtraButtonColumn = kKeyControlColumn - 1;
|
||||
const int NodeParamViewItemBody::k_key_control_column = 10;
|
||||
const int NodeParamViewItemBody::k_array_insert_column = k_key_control_column - 1;
|
||||
const int NodeParamViewItemBody::k_array_remove_column = k_array_insert_column - 1;
|
||||
const int NodeParamViewItemBody::k_extra_button_column = k_key_control_column - 1;
|
||||
|
||||
const int NodeParamViewItemBody::kOptionalCheckBox = 0;
|
||||
const int NodeParamViewItemBody::kArrayCollapseBtnColumn = 1;
|
||||
const int NodeParamViewItemBody::kLabelColumn = 2;
|
||||
const int NodeParamViewItemBody::kWidgetStartColumn = 3;
|
||||
const int NodeParamViewItemBody::kMaxWidgetColumn = kArrayRemoveColumn;
|
||||
const int NodeParamViewItemBody::k_optional_check_box = 0;
|
||||
const int NodeParamViewItemBody::k_array_collapse_btn_column = 1;
|
||||
const int NodeParamViewItemBody::k_label_column = 2;
|
||||
const int NodeParamViewItemBody::k_widget_start_column = 3;
|
||||
const int NodeParamViewItemBody::k_max_widget_column = k_array_remove_column;
|
||||
|
||||
#define super NodeParamViewItemBase
|
||||
|
||||
@@ -61,21 +61,21 @@ NodeParamViewItem::NodeParamViewItem(
|
||||
, ctx_(nullptr)
|
||||
, time_target_(nullptr)
|
||||
{
|
||||
node_->Retranslate();
|
||||
node_->retranslate();
|
||||
|
||||
// Create and add contents widget
|
||||
RecreateBody();
|
||||
recreate_body();
|
||||
|
||||
connect(node_, &Node::LabelChanged, this, &NodeParamViewItem::Retranslate);
|
||||
connect(node_, &Node::InputArraySizeChanged, this,
|
||||
&NodeParamViewItem::InputArraySizeChanged);
|
||||
connect(node_, &Node::MessageCountChanged, this,
|
||||
&NodeParamViewItem::UpdateMessagePanel);
|
||||
connect(node_, &Node::label_changed, this, &NodeParamViewItem::retranslate);
|
||||
connect(node_, &Node::input_array_size_changed, this,
|
||||
&NodeParamViewItem::input_array_size_changed);
|
||||
connect(node_, &Node::message_count_changed, this,
|
||||
&NodeParamViewItem::update_message_panel);
|
||||
|
||||
// FIXME: Implemented to pick up when an input is set to hidden or not - DEFINITELY not a fast
|
||||
// way of doing this, but "fine" for now.
|
||||
connect(node_, &Node::InputFlagsChanged, this,
|
||||
&NodeParamViewItem::RecreateBody);
|
||||
connect(node_, &Node::input_flags_changed, this,
|
||||
&NodeParamViewItem::recreate_body);
|
||||
|
||||
setBackgroundRole(QPalette::Window);
|
||||
|
||||
@@ -84,19 +84,19 @@ NodeParamViewItem::NodeParamViewItem(
|
||||
//title_bar()->SetEnabledCheckBoxChecked(node_->IsEnabled());
|
||||
//connect(title_bar(), &NodeParamViewItemTitleBar::EnabledCheckBoxClicked, node_, &Node::SetEnabled);
|
||||
|
||||
Retranslate();
|
||||
retranslate();
|
||||
}
|
||||
|
||||
void NodeParamViewItem::Retranslate()
|
||||
void NodeParamViewItem::retranslate()
|
||||
{
|
||||
node_->Retranslate();
|
||||
node_->retranslate();
|
||||
|
||||
title_bar()->SetText(GetTitleBarTextFromNode(node_));
|
||||
title_bar()->set_text(get_title_bar_text_from_node(node_));
|
||||
|
||||
body_->Retranslate();
|
||||
body_->retranslate();
|
||||
}
|
||||
|
||||
void NodeParamViewItem::RecreateBody()
|
||||
void NodeParamViewItem::recreate_body()
|
||||
{
|
||||
if (body_) {
|
||||
body_->setParent(nullptr);
|
||||
@@ -111,17 +111,17 @@ void NodeParamViewItem::RecreateBody()
|
||||
}
|
||||
|
||||
body_ = new NodeParamViewItemBody(node_, create_checkboxes_, this);
|
||||
connect(body_, &NodeParamViewItemBody::RequestSelectNode, this,
|
||||
&NodeParamViewItem::RequestSelectNode);
|
||||
connect(body_, &NodeParamViewItemBody::ArrayExpandedChanged, this,
|
||||
&NodeParamViewItem::ArrayExpandedChanged);
|
||||
connect(body_, &NodeParamViewItemBody::InputCheckedChanged, this,
|
||||
&NodeParamViewItem::InputCheckedChanged);
|
||||
connect(body_, &NodeParamViewItemBody::RequestEditTextInViewer, this,
|
||||
&NodeParamViewItem::RequestEditTextInViewer);
|
||||
body_->Retranslate();
|
||||
body_->SetTimebase(timebase_);
|
||||
body_->SetTimeTarget(time_target_);
|
||||
connect(body_, &NodeParamViewItemBody::request_select_node, this,
|
||||
&NodeParamViewItem::request_select_node);
|
||||
connect(body_, &NodeParamViewItemBody::array_expanded_changed, this,
|
||||
&NodeParamViewItem::array_expanded_changed);
|
||||
connect(body_, &NodeParamViewItemBody::input_checked_changed, this,
|
||||
&NodeParamViewItem::input_checked_changed);
|
||||
connect(body_, &NodeParamViewItemBody::request_edit_text_in_viewer, this,
|
||||
&NodeParamViewItem::request_edit_text_in_viewer);
|
||||
body_->retranslate();
|
||||
body_->set_timebase(timebase_);
|
||||
body_->set_time_target(time_target_);
|
||||
|
||||
message_container_ = new QWidget(this);
|
||||
QVBoxLayout *message_layout = new QVBoxLayout(message_container_);
|
||||
@@ -134,7 +134,7 @@ void NodeParamViewItem::RecreateBody()
|
||||
message_clear_button_ = new QPushButton(tr("Clear"), message_container_);
|
||||
message_clear_button_->setVisible(false);
|
||||
connect(message_clear_button_, &QPushButton::clicked, this,
|
||||
&NodeParamViewItem::ClearMessages);
|
||||
&NodeParamViewItem::clear_messages);
|
||||
message_header->addWidget(message_clear_button_);
|
||||
message_layout->addLayout(message_header);
|
||||
|
||||
@@ -146,11 +146,11 @@ void NodeParamViewItem::RecreateBody()
|
||||
message_layout->addWidget(message_label_);
|
||||
message_layout->addWidget(body_);
|
||||
|
||||
SetBody(message_container_);
|
||||
UpdateMessagePanel();
|
||||
set_body(message_container_);
|
||||
update_message_panel();
|
||||
}
|
||||
|
||||
void NodeParamViewItem::UpdateMessagePanel()
|
||||
void NodeParamViewItem::update_message_panel()
|
||||
{
|
||||
if (!message_label_) {
|
||||
return;
|
||||
@@ -159,7 +159,7 @@ void NodeParamViewItem::UpdateMessagePanel()
|
||||
auto *instance = node_->getPluginInstance();
|
||||
auto *olive_instance =
|
||||
dynamic_cast<plugin::OlivePluginInstance *>(instance);
|
||||
if (!olive_instance || olive_instance->persistentMessageCount() == 0) {
|
||||
if (!olive_instance || olive_instance->persistent_message_count() == 0) {
|
||||
message_label_->setVisible(false);
|
||||
if (message_clear_button_) {
|
||||
message_clear_button_->setVisible(false);
|
||||
@@ -168,16 +168,16 @@ void NodeParamViewItem::UpdateMessagePanel()
|
||||
}
|
||||
|
||||
QStringList lines;
|
||||
for (const auto &msg : olive_instance->persistentMessages()) {
|
||||
for (const auto &msg : olive_instance->persistent_messages()) {
|
||||
QString prefix;
|
||||
switch (msg.type) {
|
||||
case plugin::ErrorType::Error:
|
||||
case plugin::ErrorType::error:
|
||||
prefix = QStringLiteral("Error");
|
||||
break;
|
||||
case plugin::ErrorType::Warning:
|
||||
case plugin::ErrorType::warning:
|
||||
prefix = QStringLiteral("Warning");
|
||||
break;
|
||||
case plugin::ErrorType::Message:
|
||||
case plugin::ErrorType::message:
|
||||
prefix = QStringLiteral("Message");
|
||||
break;
|
||||
}
|
||||
@@ -191,22 +191,22 @@ void NodeParamViewItem::UpdateMessagePanel()
|
||||
}
|
||||
}
|
||||
|
||||
int NodeParamViewItem::GetElementY(const NodeInput &c) const
|
||||
int NodeParamViewItem::get_element_y(const NodeInput &c) const
|
||||
{
|
||||
if (IsExpanded()) {
|
||||
return body_->GetElementY(c);
|
||||
if (is_expanded()) {
|
||||
return body_->get_element_y(c);
|
||||
} else {
|
||||
// Not expanded, put keyframes at the titlebar Y
|
||||
return mapToGlobal(title_bar()->rect().center()).y();
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewItem::SetInputChecked(const NodeInput &input, bool e)
|
||||
void NodeParamViewItem::set_input_checked(const NodeInput &input, bool e)
|
||||
{
|
||||
body_->SetInputChecked(input, e);
|
||||
body_->set_input_checked(input, e);
|
||||
}
|
||||
|
||||
void NodeParamViewItem::ClearMessages()
|
||||
void NodeParamViewItem::clear_messages()
|
||||
{
|
||||
auto *instance = node_->getPluginInstance();
|
||||
auto *olive_instance =
|
||||
@@ -238,14 +238,14 @@ NodeParamViewItemBody::NodeParamViewItemBody(
|
||||
foreach (QString input, node->inputs()) {
|
||||
Node *n = node;
|
||||
|
||||
NodeInput resolved = NodeGroup::ResolveInput(NodeInput(n, input));
|
||||
NodeInput resolved = NodeGroup::resolve_input(NodeInput(n, input));
|
||||
if (!connected_signals.contains(resolved.node())) {
|
||||
connect(resolved.node(), &Node::InputArraySizeChanged, this,
|
||||
&NodeParamViewItemBody::InputArraySizeChanged);
|
||||
connect(resolved.node(), &Node::InputConnected, this,
|
||||
&NodeParamViewItemBody::EdgeChanged);
|
||||
connect(resolved.node(), &Node::InputDisconnected, this,
|
||||
&NodeParamViewItemBody::EdgeChanged);
|
||||
connect(resolved.node(), &Node::input_array_size_changed, this,
|
||||
&NodeParamViewItemBody::input_array_size_changed);
|
||||
connect(resolved.node(), &Node::input_connected, this,
|
||||
&NodeParamViewItemBody::edge_changed);
|
||||
connect(resolved.node(), &Node::input_disconnected, this,
|
||||
&NodeParamViewItemBody::edge_changed);
|
||||
|
||||
connected_signals.append(resolved.node());
|
||||
}
|
||||
@@ -253,11 +253,11 @@ NodeParamViewItemBody::NodeParamViewItemBody(
|
||||
input_group_lookup_.insert({ resolved.node(), resolved.input() },
|
||||
{ n, input });
|
||||
|
||||
if (!(n->GetInputFlags(input) & kInputFlagHidden)) {
|
||||
if (!(n->get_input_flags(input) & k_input_flag_hidden)) {
|
||||
QString page_label =
|
||||
n->GetInputProperty(input, QStringLiteral("ui_page")).toString();
|
||||
n->get_input_property(input, QStringLiteral("ui_page")).toString();
|
||||
QString group_label =
|
||||
n->GetInputProperty(input, QStringLiteral("ui_group"))
|
||||
n->get_input_property(input, QStringLiteral("ui_group"))
|
||||
.toString();
|
||||
if (!page_label.isEmpty() && page_label != current_page) {
|
||||
QLabel *page_title = new QLabel(page_label, this);
|
||||
@@ -278,17 +278,17 @@ NodeParamViewItemBody::NodeParamViewItemBody(
|
||||
insert_row++;
|
||||
current_group = group_label;
|
||||
}
|
||||
CreateWidgets(root_layout, n, input, -1, insert_row);
|
||||
create_widgets(root_layout, n, input, -1, insert_row);
|
||||
|
||||
insert_row++;
|
||||
|
||||
if (n->InputIsArray(input)) {
|
||||
if (n->input_is_array(input)) {
|
||||
// Insert here
|
||||
QWidget *array_widget = new QWidget(this);
|
||||
|
||||
QGridLayout *array_layout = new QGridLayout(array_widget);
|
||||
array_layout->setContentsMargins(
|
||||
QtUtils::QFontMetricsWidth(fontMetrics(),
|
||||
QtUtils::q_font_metrics_width(fontMetrics(),
|
||||
QStringLiteral(" ")),
|
||||
0, 0, 0);
|
||||
|
||||
@@ -300,11 +300,11 @@ NodeParamViewItemBody::NodeParamViewItemBody(
|
||||
|
||||
// Add one last add button for appending to the array
|
||||
NodeParamViewArrayButton *append_btn =
|
||||
new NodeParamViewArrayButton(NodeParamViewArrayButton::kAdd,
|
||||
new NodeParamViewArrayButton(NodeParamViewArrayButton::k_add,
|
||||
this);
|
||||
connect(append_btn, &NodeParamViewArrayButton::clicked, this,
|
||||
&NodeParamViewItemBody::ArrayAppendClicked);
|
||||
array_layout->addWidget(append_btn, arr_sz, kArrayInsertColumn);
|
||||
&NodeParamViewItemBody::array_append_clicked);
|
||||
array_layout->addWidget(append_btn, arr_sz, k_array_insert_column);
|
||||
|
||||
array_widget->setVisible(false);
|
||||
|
||||
@@ -317,7 +317,7 @@ NodeParamViewItemBody::NodeParamViewItemBody(
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewItemBody::CreateWidgets(QGridLayout *layout, Node *node,
|
||||
void NodeParamViewItemBody::create_widgets(QGridLayout *layout, Node *node,
|
||||
const QString &input, int element,
|
||||
int row)
|
||||
{
|
||||
@@ -333,11 +333,11 @@ void NodeParamViewItemBody::CreateWidgets(QGridLayout *layout, Node *node,
|
||||
if (create_checkboxes_) {
|
||||
ui_objects.optional_checkbox = new QCheckBox(this);
|
||||
connect(ui_objects.optional_checkbox, &QCheckBox::clicked, this,
|
||||
&NodeParamViewItemBody::OptionalCheckBoxClicked);
|
||||
layout->addWidget(ui_objects.optional_checkbox, row, kOptionalCheckBox);
|
||||
&NodeParamViewItemBody::optional_check_box_clicked);
|
||||
layout->addWidget(ui_objects.optional_checkbox, row, k_optional_check_box);
|
||||
|
||||
if (create_checkboxes_ == kCheckBoxesOnNonConnected &&
|
||||
input_ref.IsConnected()) {
|
||||
if (create_checkboxes_ == k_check_boxes_on_non_connected &&
|
||||
input_ref.is_connected()) {
|
||||
ui_objects.optional_checkbox->setVisible(false);
|
||||
}
|
||||
}
|
||||
@@ -346,9 +346,9 @@ void NodeParamViewItemBody::CreateWidgets(QGridLayout *layout, Node *node,
|
||||
ui_objects.main_label = new QLabel(this);
|
||||
|
||||
// Create input label
|
||||
layout->addWidget(ui_objects.main_label, row, kLabelColumn);
|
||||
layout->addWidget(ui_objects.main_label, row, k_label_column);
|
||||
|
||||
if (node->InputIsArray(input)) {
|
||||
if (node->input_is_array(input)) {
|
||||
if (element == -1) {
|
||||
// Create a collapse toggle for expanding/collapsing the array
|
||||
CollapseButton *array_collapse_btn = new CollapseButton(this);
|
||||
@@ -357,32 +357,32 @@ void NodeParamViewItemBody::CreateWidgets(QGridLayout *layout, Node *node,
|
||||
array_collapse_btn->setChecked(false);
|
||||
|
||||
// Add collapse button to layout
|
||||
layout->addWidget(array_collapse_btn, row, kArrayCollapseBtnColumn);
|
||||
layout->addWidget(array_collapse_btn, row, k_array_collapse_btn_column);
|
||||
|
||||
// Connect signal to show/hide array params when toggled
|
||||
connect(array_collapse_btn, &CollapseButton::toggled, this,
|
||||
&NodeParamViewItemBody::ArrayCollapseBtnPressed);
|
||||
&NodeParamViewItemBody::array_collapse_btn_pressed);
|
||||
|
||||
array_collapse_buttons_.insert({ node, input }, array_collapse_btn);
|
||||
|
||||
} else {
|
||||
NodeParamViewArrayButton *insert_element_btn =
|
||||
new NodeParamViewArrayButton(NodeParamViewArrayButton::kAdd,
|
||||
new NodeParamViewArrayButton(NodeParamViewArrayButton::k_add,
|
||||
this);
|
||||
NodeParamViewArrayButton *remove_element_btn =
|
||||
new NodeParamViewArrayButton(NodeParamViewArrayButton::kRemove,
|
||||
new NodeParamViewArrayButton(NodeParamViewArrayButton::k_remove,
|
||||
this);
|
||||
|
||||
layout->addWidget(insert_element_btn, row, kArrayInsertColumn);
|
||||
layout->addWidget(remove_element_btn, row, kArrayRemoveColumn);
|
||||
layout->addWidget(insert_element_btn, row, k_array_insert_column);
|
||||
layout->addWidget(remove_element_btn, row, k_array_remove_column);
|
||||
|
||||
ui_objects.array_insert_btn = insert_element_btn;
|
||||
ui_objects.array_remove_btn = remove_element_btn;
|
||||
|
||||
connect(insert_element_btn, &NodeParamViewArrayButton::clicked,
|
||||
this, &NodeParamViewItemBody::ArrayInsertClicked);
|
||||
this, &NodeParamViewItemBody::array_insert_clicked);
|
||||
connect(remove_element_btn, &NodeParamViewArrayButton::clicked,
|
||||
this, &NodeParamViewItemBody::ArrayRemoveClicked);
|
||||
this, &NodeParamViewItemBody::array_remove_clicked);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,80 +390,80 @@ void NodeParamViewItemBody::CreateWidgets(QGridLayout *layout, Node *node,
|
||||
ui_objects.widget_bridge =
|
||||
new NodeParamViewWidgetBridge(NodeInput(node, input, element), this);
|
||||
connect(ui_objects.widget_bridge,
|
||||
&NodeParamViewWidgetBridge::WidgetsRecreated, this,
|
||||
&NodeParamViewItemBody::ReplaceWidgets);
|
||||
&NodeParamViewWidgetBridge::widgets_recreated, this,
|
||||
&NodeParamViewItemBody::replace_widgets);
|
||||
connect(ui_objects.widget_bridge,
|
||||
&NodeParamViewWidgetBridge::ArrayWidgetDoubleClicked, this,
|
||||
&NodeParamViewItemBody::ToggleArrayExpanded);
|
||||
&NodeParamViewWidgetBridge::array_widget_double_clicked, this,
|
||||
&NodeParamViewItemBody::toggle_array_expanded);
|
||||
connect(ui_objects.widget_bridge,
|
||||
&NodeParamViewWidgetBridge::RequestEditTextInViewer, this,
|
||||
&NodeParamViewItemBody::RequestEditTextInViewer);
|
||||
&NodeParamViewWidgetBridge::request_edit_text_in_viewer, this,
|
||||
&NodeParamViewItemBody::request_edit_text_in_viewer);
|
||||
|
||||
// Place widgets into layout
|
||||
PlaceWidgetsFromBridge(layout, ui_objects.widget_bridge, row);
|
||||
place_widgets_from_bridge(layout, ui_objects.widget_bridge, row);
|
||||
|
||||
// In case this input is a group, resolve that actual input to use for connected labels
|
||||
NodeInput resolved = NodeGroup::ResolveInput(input_ref);
|
||||
NodeInput resolved = NodeGroup::resolve_input(input_ref);
|
||||
|
||||
if (node->IsInputConnectable(input)) {
|
||||
if (node->is_input_connectable(input)) {
|
||||
// Create clickable label used when an input is connected
|
||||
ui_objects.connected_label =
|
||||
new NodeParamViewConnectedLabel(resolved, this);
|
||||
connect(ui_objects.connected_label,
|
||||
&NodeParamViewConnectedLabel::RequestSelectNode, this,
|
||||
&NodeParamViewItemBody::RequestSelectNode);
|
||||
layout->addWidget(ui_objects.connected_label, row, kWidgetStartColumn,
|
||||
1, kKeyControlColumn - kWidgetStartColumn);
|
||||
&NodeParamViewConnectedLabel::request_select_node, this,
|
||||
&NodeParamViewItemBody::request_select_node);
|
||||
layout->addWidget(ui_objects.connected_label, row, k_widget_start_column,
|
||||
1, k_key_control_column - k_widget_start_column);
|
||||
}
|
||||
|
||||
// Add keyframe control to this layout if parameter is keyframable
|
||||
if (node->IsInputKeyframable(input)) {
|
||||
if (node->is_input_keyframable(input)) {
|
||||
ui_objects.key_control = new NodeParamViewKeyframeControl(this);
|
||||
ui_objects.key_control->SetInput(resolved);
|
||||
layout->addWidget(ui_objects.key_control, row, kKeyControlColumn);
|
||||
ui_objects.key_control->set_input(resolved);
|
||||
layout->addWidget(ui_objects.key_control, row, k_key_control_column);
|
||||
}
|
||||
|
||||
input_ui_map_.insert(input_ref, ui_objects);
|
||||
|
||||
if (node->IsInputConnectable(input)) {
|
||||
UpdateUIForEdgeConnection(input_ref);
|
||||
if (node->is_input_connectable(input)) {
|
||||
update_ui_for_edge_connection(input_ref);
|
||||
}
|
||||
|
||||
SetTimeTargetOnInputUI(ui_objects);
|
||||
SetTimebaseOnInputUI(ui_objects);
|
||||
set_time_target_on_input_ui(ui_objects);
|
||||
set_timebase_on_input_ui(ui_objects);
|
||||
}
|
||||
|
||||
void NodeParamViewItemBody::SetTimeTarget(ViewerOutput *target)
|
||||
void NodeParamViewItemBody::set_time_target(ViewerOutput *target)
|
||||
{
|
||||
time_target_ = target;
|
||||
|
||||
foreach (const InputUI &ui_obj, input_ui_map_) {
|
||||
SetTimeTargetOnInputUI(ui_obj);
|
||||
set_time_target_on_input_ui(ui_obj);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewItemBody::SetTimeTargetOnInputUI(const InputUI &ui_obj)
|
||||
void NodeParamViewItemBody::set_time_target_on_input_ui(const InputUI &ui_obj)
|
||||
{
|
||||
// Only keyframable inputs have a key control widget
|
||||
if (ui_obj.key_control) {
|
||||
ui_obj.key_control->SetTimeTarget(time_target_);
|
||||
ui_obj.key_control->set_time_target(time_target_);
|
||||
}
|
||||
if (ui_obj.connected_label) {
|
||||
ui_obj.connected_label->SetViewerNode(time_target_);
|
||||
ui_obj.connected_label->set_viewer_node(time_target_);
|
||||
}
|
||||
ui_obj.widget_bridge->SetTimeTarget(time_target_);
|
||||
ui_obj.widget_bridge->set_time_target(time_target_);
|
||||
}
|
||||
|
||||
void NodeParamViewItemBody::Retranslate()
|
||||
void NodeParamViewItemBody::retranslate()
|
||||
{
|
||||
for (auto i = input_ui_map_.begin(); i != input_ui_map_.end(); i++) {
|
||||
const NodeInput &ic = i.key();
|
||||
|
||||
if (ic.IsArray() && ic.element() >= 0) {
|
||||
if (ic.is_array() && ic.element() >= 0) {
|
||||
// Make the label the array index
|
||||
i.value().main_label->setText(tr("%1:").arg(
|
||||
ic.element() +
|
||||
ic.GetProperty(QStringLiteral("arraystart")).toInt()));
|
||||
ic.get_property(QStringLiteral("arraystart")).toInt()));
|
||||
} else {
|
||||
// Set to the input's name
|
||||
i.value().main_label->setText(tr("%1:").arg(ic.name()));
|
||||
@@ -471,9 +471,9 @@ void NodeParamViewItemBody::Retranslate()
|
||||
}
|
||||
}
|
||||
|
||||
int NodeParamViewItemBody::GetElementY(NodeInput c) const
|
||||
int NodeParamViewItemBody::get_element_y(NodeInput c) const
|
||||
{
|
||||
if (c.IsArray() && !array_ui_.value(c.input_pair()).widget->isVisible()) {
|
||||
if (c.is_array() && !array_ui_.value(c.input_pair()).widget->isVisible()) {
|
||||
// Array is collapsed, so we'll return the Y of its root
|
||||
c.set_element(-1);
|
||||
}
|
||||
@@ -493,7 +493,7 @@ int NodeParamViewItemBody::GetElementY(NodeInput c) const
|
||||
return lbl_center.y();
|
||||
}
|
||||
|
||||
void NodeParamViewItemBody::EdgeChanged(Node *output, const NodeInput &input)
|
||||
void NodeParamViewItemBody::edge_changed(Node *output, const NodeInput &input)
|
||||
{
|
||||
Q_UNUSED(output)
|
||||
|
||||
@@ -501,16 +501,16 @@ void NodeParamViewItemBody::EdgeChanged(Node *output, const NodeInput &input)
|
||||
input_group_lookup_.value({ input.node(), input.input() });
|
||||
NodeInput resolved(pair.node, pair.input, input.element());
|
||||
|
||||
UpdateUIForEdgeConnection(resolved);
|
||||
update_ui_for_edge_connection(resolved);
|
||||
}
|
||||
|
||||
void NodeParamViewItemBody::UpdateUIForEdgeConnection(const NodeInput &input)
|
||||
void NodeParamViewItemBody::update_ui_for_edge_connection(const NodeInput &input)
|
||||
{
|
||||
// Show/hide bridge widgets
|
||||
if (input_ui_map_.contains(input)) {
|
||||
const InputUI &ui_objects = input_ui_map_[input];
|
||||
|
||||
bool is_connected = NodeGroup::ResolveInput(input).IsConnected();
|
||||
bool is_connected = NodeGroup::resolve_input(input).is_connected();
|
||||
|
||||
foreach (QWidget *w, ui_objects.widget_bridge->widgets()) {
|
||||
w->setVisible(!is_connected);
|
||||
@@ -524,25 +524,25 @@ void NodeParamViewItemBody::UpdateUIForEdgeConnection(const NodeInput &input)
|
||||
}
|
||||
|
||||
// Show/hide optional checkbox if requested
|
||||
if (create_checkboxes_ == kCheckBoxesOnNonConnected) {
|
||||
if (create_checkboxes_ == k_check_boxes_on_non_connected) {
|
||||
ui_objects.optional_checkbox->setVisible(!is_connected);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewItemBody::PlaceWidgetsFromBridge(
|
||||
void NodeParamViewItemBody::place_widgets_from_bridge(
|
||||
QGridLayout *layout, NodeParamViewWidgetBridge *bridge, int row)
|
||||
{
|
||||
// Add widgets for this parameter to the layout
|
||||
for (int i = 0; i < bridge->widgets().size(); i++) {
|
||||
QWidget *w = bridge->widgets().at(i);
|
||||
|
||||
int col = i + kWidgetStartColumn;
|
||||
int col = i + k_widget_start_column;
|
||||
|
||||
int colspan;
|
||||
if (i == bridge->widgets().size() - 1) {
|
||||
// Span this widget among remaining columns
|
||||
colspan = kMaxWidgetColumn - col;
|
||||
colspan = k_max_widget_column - col;
|
||||
} else {
|
||||
colspan = 1;
|
||||
}
|
||||
@@ -551,7 +551,7 @@ void NodeParamViewItemBody::PlaceWidgetsFromBridge(
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewItemBody::InputArraySizeChangedInternal(Node *node,
|
||||
void NodeParamViewItemBody::input_array_size_changed_internal(Node *node,
|
||||
const QString &input,
|
||||
int size)
|
||||
{
|
||||
@@ -569,10 +569,10 @@ void NodeParamViewItemBody::InputArraySizeChangedInternal(Node *node,
|
||||
|
||||
if (array_ui.count < size) {
|
||||
// Our UI count is smaller than the size, create more
|
||||
grid->addWidget(array_ui.append_btn, size, kArrayInsertColumn);
|
||||
grid->addWidget(array_ui.append_btn, size, k_array_insert_column);
|
||||
|
||||
for (int i = array_ui.count; i < size; i++) {
|
||||
CreateWidgets(grid, node, input, i, i);
|
||||
create_widgets(grid, node, input, i, i);
|
||||
}
|
||||
} else {
|
||||
for (int i = array_ui.count - 1; i >= size; i--) {
|
||||
@@ -587,16 +587,16 @@ void NodeParamViewItemBody::InputArraySizeChangedInternal(Node *node,
|
||||
delete input_ui.array_remove_btn;
|
||||
}
|
||||
|
||||
grid->addWidget(array_ui.append_btn, size, kArrayInsertColumn);
|
||||
grid->addWidget(array_ui.append_btn, size, k_array_insert_column);
|
||||
}
|
||||
|
||||
array_ui.count = size;
|
||||
|
||||
Retranslate();
|
||||
retranslate();
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewItemBody::ArrayCollapseBtnPressed(bool checked)
|
||||
void NodeParamViewItemBody::array_collapse_btn_pressed(bool checked)
|
||||
{
|
||||
const NodeInputPair &input =
|
||||
array_collapse_buttons_.key(static_cast<CollapseButton *>(sender()));
|
||||
@@ -605,15 +605,15 @@ void NodeParamViewItemBody::ArrayCollapseBtnPressed(bool checked)
|
||||
if (checked) {
|
||||
// Ensure widgets are created (the signal will be ignored if they are)
|
||||
NodeInput resolved =
|
||||
NodeGroup::ResolveInput(NodeInput(input.node, input.input));
|
||||
InputArraySizeChangedInternal(input.node, input.input,
|
||||
resolved.GetArraySize());
|
||||
NodeGroup::resolve_input(NodeInput(input.node, input.input));
|
||||
input_array_size_changed_internal(input.node, input.input,
|
||||
resolved.get_array_size());
|
||||
}
|
||||
|
||||
emit ArrayExpandedChanged(checked);
|
||||
emit array_expanded_changed(checked);
|
||||
}
|
||||
|
||||
void NodeParamViewItemBody::InputArraySizeChanged(const QString &input,
|
||||
void NodeParamViewItemBody::input_array_size_changed(const QString &input,
|
||||
int old_sz, int size)
|
||||
{
|
||||
Q_UNUSED(old_sz)
|
||||
@@ -621,58 +621,58 @@ void NodeParamViewItemBody::InputArraySizeChanged(const QString &input,
|
||||
NodeInputPair nip =
|
||||
input_group_lookup_.value({ static_cast<Node *>(sender()), input });
|
||||
|
||||
InputArraySizeChangedInternal(nip.node, nip.input, size);
|
||||
input_array_size_changed_internal(nip.node, nip.input, size);
|
||||
}
|
||||
|
||||
void NodeParamViewItemBody::ArrayAppendClicked()
|
||||
void NodeParamViewItemBody::array_append_clicked()
|
||||
{
|
||||
for (auto it = array_ui_.cbegin(); it != array_ui_.cend(); it++) {
|
||||
if (it.value().append_btn == sender()) {
|
||||
NodeInput real_input = NodeGroup::ResolveInput(
|
||||
NodeInput real_input = NodeGroup::resolve_input(
|
||||
NodeInput(it.key().node, it.key().input));
|
||||
Core::instance()->undo_stack()->push(
|
||||
new NodeArrayInsertCommand(real_input.node(),
|
||||
real_input.input(),
|
||||
real_input.GetArraySize()),
|
||||
real_input.get_array_size()),
|
||||
tr("Appended Array Element In %1 - %2")
|
||||
.arg(real_input.node()->GetLabelAndName(),
|
||||
real_input.GetInputName()));
|
||||
.arg(real_input.node()->get_label_and_name(),
|
||||
real_input.get_input_name()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewItemBody::ArrayInsertClicked()
|
||||
void NodeParamViewItemBody::array_insert_clicked()
|
||||
{
|
||||
for (auto it = input_ui_map_.cbegin(); it != input_ui_map_.cend(); it++) {
|
||||
if (it.value().array_insert_btn == sender()) {
|
||||
// Found our input and element
|
||||
NodeInput ic = NodeGroup::ResolveInput(it.key());
|
||||
NodeInput ic = NodeGroup::resolve_input(it.key());
|
||||
Core::instance()->undo_stack()->push(
|
||||
new NodeArrayInsertCommand(ic.node(), ic.input(), ic.element()),
|
||||
tr("Inserted Array Element In %1 - %2")
|
||||
.arg(ic.node()->GetLabelAndName(), ic.GetInputName()));
|
||||
.arg(ic.node()->get_label_and_name(), ic.get_input_name()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewItemBody::ArrayRemoveClicked()
|
||||
void NodeParamViewItemBody::array_remove_clicked()
|
||||
{
|
||||
for (auto it = input_ui_map_.cbegin(); it != input_ui_map_.cend(); it++) {
|
||||
if (it.value().array_remove_btn == sender()) {
|
||||
// Found our input and element
|
||||
NodeInput ic = NodeGroup::ResolveInput(it.key());
|
||||
NodeInput ic = NodeGroup::resolve_input(it.key());
|
||||
Core::instance()->undo_stack()->push(
|
||||
new NodeArrayRemoveCommand(ic.node(), ic.input(), ic.element()),
|
||||
tr("Removed Array Element In %1 - %2")
|
||||
.arg(ic.node()->GetLabelAndName(), ic.GetInputName()));
|
||||
.arg(ic.node()->get_label_and_name(), ic.get_input_name()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewItemBody::ToggleArrayExpanded()
|
||||
void NodeParamViewItemBody::toggle_array_expanded()
|
||||
{
|
||||
NodeParamViewWidgetBridge *bridge =
|
||||
static_cast<NodeParamViewWidgetBridge *>(sender());
|
||||
@@ -687,21 +687,21 @@ void NodeParamViewItemBody::ToggleArrayExpanded()
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewItemBody::SetTimebase(const rational &timebase)
|
||||
void NodeParamViewItemBody::set_timebase(const Rational &timebase)
|
||||
{
|
||||
timebase_ = timebase;
|
||||
|
||||
foreach (const InputUI &ui_obj, input_ui_map_) {
|
||||
SetTimebaseOnInputUI(ui_obj);
|
||||
set_timebase_on_input_ui(ui_obj);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewItemBody::SetTimebaseOnInputUI(const InputUI &ui_obj)
|
||||
void NodeParamViewItemBody::set_timebase_on_input_ui(const InputUI &ui_obj)
|
||||
{
|
||||
ui_obj.widget_bridge->SetTimebase(timebase_);
|
||||
ui_obj.widget_bridge->set_timebase(timebase_);
|
||||
}
|
||||
|
||||
void NodeParamViewItemBody::SetInputChecked(const NodeInput &input, bool e)
|
||||
void NodeParamViewItemBody::set_input_checked(const NodeInput &input, bool e)
|
||||
{
|
||||
if (input_ui_map_.contains(input)) {
|
||||
QCheckBox *cb = input_ui_map_.value(input).optional_checkbox;
|
||||
@@ -711,13 +711,13 @@ void NodeParamViewItemBody::SetInputChecked(const NodeInput &input, bool e)
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewItemBody::ReplaceWidgets(const NodeInput &input)
|
||||
void NodeParamViewItemBody::replace_widgets(const NodeInput &input)
|
||||
{
|
||||
InputUI ui = input_ui_map_.value(input);
|
||||
PlaceWidgetsFromBridge(ui.layout, ui.widget_bridge, ui.row);
|
||||
place_widgets_from_bridge(ui.layout, ui.widget_bridge, ui.row);
|
||||
}
|
||||
|
||||
void NodeParamViewItemBody::ShowSpeedDurationDialogForNode()
|
||||
void NodeParamViewItemBody::show_speed_duration_dialog_for_node()
|
||||
{
|
||||
// We should only get there if the node is a clip, determined by the dynamic_cast in CreateWidgets
|
||||
SpeedDurationDialog sdd({ static_cast<ClipBlock *>(node_) }, timebase_,
|
||||
@@ -725,13 +725,13 @@ void NodeParamViewItemBody::ShowSpeedDurationDialogForNode()
|
||||
sdd.exec();
|
||||
}
|
||||
|
||||
void NodeParamViewItemBody::OptionalCheckBoxClicked(bool e)
|
||||
void NodeParamViewItemBody::optional_check_box_clicked(bool e)
|
||||
{
|
||||
QCheckBox *cb = static_cast<QCheckBox *>(sender());
|
||||
|
||||
for (auto it = input_ui_map_.cbegin(); it != input_ui_map_.cend(); it++) {
|
||||
if (it.value().optional_checkbox == cb) {
|
||||
emit InputCheckedChanged(it.key(), e);
|
||||
emit input_checked_changed(it.key(), e);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef NODEPARAMVIEWITEM_H
|
||||
#define NODEPARAMVIEWITEM_H
|
||||
#ifndef OAK_NODEPARAMVIEWITEM_H
|
||||
#define OAK_NODEPARAMVIEWITEM_H
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QGridLayout>
|
||||
@@ -43,9 +43,9 @@ namespace olive
|
||||
{
|
||||
|
||||
enum NodeParamViewCheckBoxBehavior {
|
||||
kNoCheckBoxes,
|
||||
kCheckBoxesOn,
|
||||
kCheckBoxesOnNonConnected
|
||||
k_no_check_boxes,
|
||||
k_check_boxes_on,
|
||||
k_check_boxes_on_non_connected
|
||||
};
|
||||
|
||||
class NodeParamViewItemBody : public QWidget {
|
||||
@@ -55,36 +55,36 @@ public:
|
||||
NodeParamViewCheckBoxBehavior create_checkboxes,
|
||||
QWidget *parent = nullptr);
|
||||
|
||||
void SetTimeTarget(ViewerOutput *target);
|
||||
void set_time_target(ViewerOutput *target);
|
||||
|
||||
void Retranslate();
|
||||
void retranslate();
|
||||
|
||||
int GetElementY(NodeInput c) const;
|
||||
int get_element_y(NodeInput c) const;
|
||||
|
||||
// Set the timebase of any timebased widgets contained here
|
||||
void SetTimebase(const rational &timebase);
|
||||
void set_timebase(const Rational &timebase);
|
||||
|
||||
void SetInputChecked(const NodeInput &input, bool e);
|
||||
void set_input_checked(const NodeInput &input, bool e);
|
||||
|
||||
signals:
|
||||
void RequestSelectNode(Node *node);
|
||||
void request_select_node(Node *node);
|
||||
|
||||
void ArrayExpandedChanged(bool e);
|
||||
void array_expanded_changed(bool e);
|
||||
|
||||
void InputCheckedChanged(const NodeInput &input, bool e);
|
||||
void input_checked_changed(const NodeInput &input, bool e);
|
||||
|
||||
void RequestEditTextInViewer();
|
||||
void request_edit_text_in_viewer();
|
||||
|
||||
private:
|
||||
void CreateWidgets(QGridLayout *layout, Node *node, const QString &input,
|
||||
void create_widgets(QGridLayout *layout, Node *node, const QString &input,
|
||||
int element, int row_index);
|
||||
|
||||
void UpdateUIForEdgeConnection(const NodeInput &input);
|
||||
void update_ui_for_edge_connection(const NodeInput &input);
|
||||
|
||||
void PlaceWidgetsFromBridge(QGridLayout *layout,
|
||||
void place_widgets_from_bridge(QGridLayout *layout,
|
||||
NodeParamViewWidgetBridge *bridge, int row);
|
||||
|
||||
void InputArraySizeChangedInternal(Node *node, const QString &input,
|
||||
void input_array_size_changed_internal(Node *node, const QString &input,
|
||||
int size);
|
||||
|
||||
struct InputUI {
|
||||
@@ -111,8 +111,8 @@ private:
|
||||
NodeParamViewArrayButton *append_btn;
|
||||
};
|
||||
|
||||
void SetTimeTargetOnInputUI(const InputUI &ui);
|
||||
void SetTimebaseOnInputUI(const InputUI &ui);
|
||||
void set_time_target_on_input_ui(const InputUI &ui);
|
||||
void set_timebase_on_input_ui(const InputUI &ui);
|
||||
|
||||
Node *node_;
|
||||
|
||||
@@ -120,7 +120,7 @@ private:
|
||||
|
||||
QHash<NodeInputPair, CollapseButton *> array_collapse_buttons_;
|
||||
|
||||
rational timebase_;
|
||||
Rational timebase_;
|
||||
|
||||
ViewerOutput *time_target_;
|
||||
|
||||
@@ -134,38 +134,38 @@ private:
|
||||
* Serves as an effective "maximum column" index because the keyframe button is always aligned
|
||||
* to the right edge.
|
||||
*/
|
||||
static const int kKeyControlColumn;
|
||||
static const int k_key_control_column;
|
||||
|
||||
static const int kArrayInsertColumn;
|
||||
static const int kArrayRemoveColumn;
|
||||
static const int kExtraButtonColumn;
|
||||
static const int k_array_insert_column;
|
||||
static const int k_array_remove_column;
|
||||
static const int k_extra_button_column;
|
||||
|
||||
static const int kOptionalCheckBox;
|
||||
static const int kArrayCollapseBtnColumn;
|
||||
static const int kLabelColumn;
|
||||
static const int kWidgetStartColumn;
|
||||
static const int kMaxWidgetColumn;
|
||||
static const int k_optional_check_box;
|
||||
static const int k_array_collapse_btn_column;
|
||||
static const int k_label_column;
|
||||
static const int k_widget_start_column;
|
||||
static const int k_max_widget_column;
|
||||
|
||||
private slots:
|
||||
void EdgeChanged(Node *output, const NodeInput &input);
|
||||
void edge_changed(Node *output, const NodeInput &input);
|
||||
|
||||
void ArrayCollapseBtnPressed(bool checked);
|
||||
void array_collapse_btn_pressed(bool checked);
|
||||
|
||||
void InputArraySizeChanged(const QString &input, int old_sz, int size);
|
||||
void input_array_size_changed(const QString &input, int old_sz, int size);
|
||||
|
||||
void ArrayAppendClicked();
|
||||
void array_append_clicked();
|
||||
|
||||
void ArrayInsertClicked();
|
||||
void array_insert_clicked();
|
||||
|
||||
void ArrayRemoveClicked();
|
||||
void array_remove_clicked();
|
||||
|
||||
void ToggleArrayExpanded();
|
||||
void toggle_array_expanded();
|
||||
|
||||
void ReplaceWidgets(const NodeInput &input);
|
||||
void replace_widgets(const NodeInput &input);
|
||||
|
||||
void ShowSpeedDurationDialogForNode();
|
||||
void show_speed_duration_dialog_for_node();
|
||||
|
||||
void OptionalCheckBoxClicked(bool e);
|
||||
void optional_check_box_clicked(bool e);
|
||||
};
|
||||
|
||||
class NodeParamViewItem : public NodeParamViewItemBase {
|
||||
@@ -175,63 +175,63 @@ public:
|
||||
NodeParamViewCheckBoxBehavior create_checkboxes,
|
||||
QWidget *parent = nullptr);
|
||||
|
||||
void SetTimeTarget(ViewerOutput *target)
|
||||
void set_time_target(ViewerOutput *target)
|
||||
{
|
||||
time_target_ = target;
|
||||
|
||||
body_->SetTimeTarget(target);
|
||||
body_->set_time_target(target);
|
||||
}
|
||||
|
||||
void SetTimebase(const rational &timebase)
|
||||
void set_timebase(const Rational &timebase)
|
||||
{
|
||||
timebase_ = timebase;
|
||||
|
||||
body_->SetTimebase(timebase);
|
||||
body_->set_timebase(timebase);
|
||||
}
|
||||
|
||||
Node *GetContext() const
|
||||
Node *get_context() const
|
||||
{
|
||||
return ctx_;
|
||||
}
|
||||
|
||||
void SetContext(Node *ctx)
|
||||
void set_context(Node *ctx)
|
||||
{
|
||||
ctx_ = ctx;
|
||||
}
|
||||
|
||||
Node *GetNode() const
|
||||
Node *get_node() const
|
||||
{
|
||||
return node_;
|
||||
}
|
||||
|
||||
int GetElementY(const NodeInput &c) const;
|
||||
int get_element_y(const NodeInput &c) const;
|
||||
|
||||
void SetInputChecked(const NodeInput &input, bool e);
|
||||
void set_input_checked(const NodeInput &input, bool e);
|
||||
|
||||
KeyframeView::NodeConnections &GetKeyframeConnections()
|
||||
KeyframeView::NodeConnections &get_keyframe_connections()
|
||||
{
|
||||
return keyframe_connections_;
|
||||
}
|
||||
|
||||
void SetKeyframeConnections(const KeyframeView::NodeConnections &c)
|
||||
void set_keyframe_connections(const KeyframeView::NodeConnections &c)
|
||||
{
|
||||
keyframe_connections_ = c;
|
||||
}
|
||||
|
||||
signals:
|
||||
void RequestSelectNode(Node *node);
|
||||
void request_select_node(Node *node);
|
||||
|
||||
void ArrayExpandedChanged(bool e);
|
||||
void array_expanded_changed(bool e);
|
||||
|
||||
void InputCheckedChanged(const NodeInput &input, bool e);
|
||||
void input_checked_changed(const NodeInput &input, bool e);
|
||||
|
||||
void RequestEditTextInViewer();
|
||||
void request_edit_text_in_viewer();
|
||||
|
||||
void InputArraySizeChanged(const QString &input, int old_size,
|
||||
void input_array_size_changed(const QString &input, int old_size,
|
||||
int new_size);
|
||||
|
||||
protected slots:
|
||||
virtual void Retranslate() override;
|
||||
virtual void retranslate() override;
|
||||
|
||||
private:
|
||||
NodeParamViewItemBody *body_;
|
||||
@@ -247,16 +247,16 @@ private:
|
||||
|
||||
ViewerOutput *time_target_;
|
||||
|
||||
rational timebase_;
|
||||
Rational timebase_;
|
||||
|
||||
KeyframeView::NodeConnections keyframe_connections_;
|
||||
|
||||
private slots:
|
||||
void RecreateBody();
|
||||
void UpdateMessagePanel();
|
||||
void ClearMessages();
|
||||
void recreate_body();
|
||||
void update_message_panel();
|
||||
void clear_messages();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // NODEPARAMVIEWITEM_H
|
||||
#endif // OAK_NODEPARAMVIEWITEM_H
|
||||
|
||||
@@ -40,12 +40,12 @@ NodeParamViewItemBase::NodeParamViewItemBase(QWidget *parent)
|
||||
this->setTitleBarWidget(title_bar_);
|
||||
|
||||
// Connect title bar to this
|
||||
connect(title_bar_, &NodeParamViewItemTitleBar::ExpandedStateChanged, this,
|
||||
&NodeParamViewItemBase::SetExpanded);
|
||||
connect(title_bar_, &NodeParamViewItemTitleBar::PinToggled, this,
|
||||
&NodeParamViewItemBase::PinToggled);
|
||||
connect(title_bar_, &NodeParamViewItemTitleBar::Clicked, this,
|
||||
&NodeParamViewItemBase::Clicked);
|
||||
connect(title_bar_, &NodeParamViewItemTitleBar::expanded_state_changed, this,
|
||||
&NodeParamViewItemBase::set_expanded);
|
||||
connect(title_bar_, &NodeParamViewItemTitleBar::pin_toggled, this,
|
||||
&NodeParamViewItemBase::pin_toggled);
|
||||
connect(title_bar_, &NodeParamViewItemTitleBar::clicked, this,
|
||||
&NodeParamViewItemBase::clicked);
|
||||
|
||||
// Use dummy QWidget to retain width when not expanded (QDockWidget seems to ignore the titlebar
|
||||
// size hints and will shrink as small as possible if the body is hidden)
|
||||
@@ -60,26 +60,26 @@ NodeParamViewItemBase::NodeParamViewItemBase(QWidget *parent)
|
||||
setFocusPolicy(Qt::ClickFocus);
|
||||
}
|
||||
|
||||
bool NodeParamViewItemBase::IsExpanded() const
|
||||
bool NodeParamViewItemBase::is_expanded() const
|
||||
{
|
||||
return title_bar_->IsExpanded();
|
||||
return title_bar_->is_expanded();
|
||||
}
|
||||
|
||||
QString NodeParamViewItemBase::GetTitleBarTextFromNode(Node *n)
|
||||
QString NodeParamViewItemBase::get_title_bar_text_from_node(Node *n)
|
||||
{
|
||||
if (n->GetLabel().isEmpty()) {
|
||||
return n->Name();
|
||||
if (n->get_label().isEmpty()) {
|
||||
return n->name();
|
||||
} else {
|
||||
return tr("%1 (%2)").arg(n->GetLabel(), n->Name());
|
||||
return tr("%1 (%2)").arg(n->get_label(), n->name());
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewItemBase::SetBody(QWidget *body)
|
||||
void NodeParamViewItemBase::set_body(QWidget *body)
|
||||
{
|
||||
body_ = body;
|
||||
body_->setParent(this);
|
||||
|
||||
if (title_bar_->IsExpanded()) {
|
||||
if (title_bar_->is_expanded()) {
|
||||
setWidget(body_);
|
||||
}
|
||||
}
|
||||
@@ -97,18 +97,18 @@ void NodeParamViewItemBase::paintEvent(QPaintEvent *event)
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewItemBase::SetExpanded(bool e)
|
||||
void NodeParamViewItemBase::set_expanded(bool e)
|
||||
{
|
||||
setWidget(e ? body_ : hidden_body_);
|
||||
title_bar_->SetExpanded(e);
|
||||
title_bar_->set_expanded(e);
|
||||
|
||||
emit ExpandedChanged(e);
|
||||
emit expanded_changed(e);
|
||||
}
|
||||
|
||||
void NodeParamViewItemBase::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::LanguageChange) {
|
||||
Retranslate();
|
||||
retranslate();
|
||||
}
|
||||
|
||||
super::changeEvent(e);
|
||||
@@ -118,14 +118,14 @@ void NodeParamViewItemBase::moveEvent(QMoveEvent *event)
|
||||
{
|
||||
super::moveEvent(event);
|
||||
|
||||
emit Moved();
|
||||
emit moved();
|
||||
}
|
||||
|
||||
void NodeParamViewItemBase::mousePressEvent(QMouseEvent *e)
|
||||
{
|
||||
super::mousePressEvent(e);
|
||||
|
||||
emit Clicked();
|
||||
emit clicked();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef NODEPARAMVIEWITEMBASE_H
|
||||
#define NODEPARAMVIEWITEMBASE_H
|
||||
#ifndef OAK_NODEPARAMVIEWITEMBASE_H
|
||||
#define OAK_NODEPARAMVIEWITEMBASE_H
|
||||
|
||||
#include <QDockWidget>
|
||||
|
||||
@@ -35,41 +35,41 @@ class NodeParamViewItemBase : public QDockWidget {
|
||||
public:
|
||||
NodeParamViewItemBase(QWidget *parent = nullptr);
|
||||
|
||||
void SetHighlighted(bool e)
|
||||
void set_highlighted(bool e)
|
||||
{
|
||||
highlighted_ = e;
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
bool IsHighlighted() const
|
||||
bool is_highlighted() const
|
||||
{
|
||||
return highlighted_;
|
||||
}
|
||||
|
||||
bool IsExpanded() const;
|
||||
bool is_expanded() const;
|
||||
|
||||
static QString GetTitleBarTextFromNode(Node *n);
|
||||
static QString get_title_bar_text_from_node(Node *n);
|
||||
|
||||
public slots:
|
||||
void SetExpanded(bool e);
|
||||
void set_expanded(bool e);
|
||||
|
||||
void ToggleExpanded()
|
||||
void toggle_expanded()
|
||||
{
|
||||
SetExpanded(!IsExpanded());
|
||||
set_expanded(!is_expanded());
|
||||
}
|
||||
|
||||
signals:
|
||||
void PinToggled(bool e);
|
||||
void pin_toggled(bool e);
|
||||
|
||||
void ExpandedChanged(bool e);
|
||||
void expanded_changed(bool e);
|
||||
|
||||
void Moved();
|
||||
void moved();
|
||||
|
||||
void Clicked();
|
||||
void clicked();
|
||||
|
||||
protected:
|
||||
void SetBody(QWidget *body);
|
||||
void set_body(QWidget *body);
|
||||
|
||||
virtual void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
@@ -85,7 +85,7 @@ protected:
|
||||
virtual void mousePressEvent(QMouseEvent *e) override;
|
||||
|
||||
protected slots:
|
||||
virtual void Retranslate()
|
||||
virtual void retranslate()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -101,4 +101,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif // NODEPARAMVIEWITEMBASE_H
|
||||
#endif // OAK_NODEPARAMVIEWITEMBASE_H
|
||||
|
||||
@@ -37,7 +37,7 @@ NodeParamViewItemTitleBar::NodeParamViewItemTitleBar(QWidget *parent)
|
||||
|
||||
collapse_btn_ = new CollapseButton(this);
|
||||
connect(collapse_btn_, &QPushButton::clicked, this,
|
||||
&NodeParamViewItemTitleBar::ExpandedStateChanged);
|
||||
&NodeParamViewItemTitleBar::expanded_state_changed);
|
||||
layout->addWidget(collapse_btn_);
|
||||
|
||||
lbl_ = new QLabel(this);
|
||||
@@ -47,13 +47,13 @@ NodeParamViewItemTitleBar::NodeParamViewItemTitleBar(QWidget *parent)
|
||||
layout->addStretch();
|
||||
|
||||
add_fx_btn_ = new QPushButton(this);
|
||||
add_fx_btn_->setIcon(icon::AddEffect);
|
||||
add_fx_btn_->setIcon(icon::add_effect);
|
||||
add_fx_btn_->setFixedSize(add_fx_btn_->sizeHint().height(),
|
||||
add_fx_btn_->sizeHint().height());
|
||||
add_fx_btn_->setVisible(false);
|
||||
layout->addWidget(add_fx_btn_);
|
||||
connect(add_fx_btn_, &QPushButton::clicked, this,
|
||||
&NodeParamViewItemTitleBar::AddEffectButtonClicked);
|
||||
&NodeParamViewItemTitleBar::add_effect_button_clicked);
|
||||
|
||||
pin_btn_ = new QPushButton(QStringLiteral("P"), this);
|
||||
pin_btn_->setCheckable(true);
|
||||
@@ -62,16 +62,16 @@ NodeParamViewItemTitleBar::NodeParamViewItemTitleBar(QWidget *parent)
|
||||
pin_btn_->setVisible(false);
|
||||
layout->addWidget(pin_btn_);
|
||||
connect(pin_btn_, &QPushButton::clicked, this,
|
||||
&NodeParamViewItemTitleBar::PinToggled);
|
||||
&NodeParamViewItemTitleBar::pin_toggled);
|
||||
|
||||
enabled_checkbox_ = new QCheckBox(this);
|
||||
enabled_checkbox_->setVisible(false);
|
||||
layout->addWidget(enabled_checkbox_);
|
||||
connect(enabled_checkbox_, &QCheckBox::clicked, this,
|
||||
&NodeParamViewItemTitleBar::EnabledCheckBoxClicked);
|
||||
&NodeParamViewItemTitleBar::enabled_check_box_clicked);
|
||||
}
|
||||
|
||||
void NodeParamViewItemTitleBar::SetExpanded(bool e)
|
||||
void NodeParamViewItemTitleBar::set_expanded(bool e)
|
||||
{
|
||||
draw_border_ = e;
|
||||
collapse_btn_->setChecked(e);
|
||||
@@ -97,7 +97,7 @@ void NodeParamViewItemTitleBar::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
QWidget::mousePressEvent(event);
|
||||
|
||||
emit Clicked();
|
||||
emit clicked();
|
||||
}
|
||||
|
||||
void NodeParamViewItemTitleBar::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef NODEPARAMVIEWITEMTITLEBAR_H
|
||||
#define NODEPARAMVIEWITEMTITLEBAR_H
|
||||
#ifndef OAK_NODEPARAMVIEWITEMTITLEBAR_H
|
||||
#define OAK_NODEPARAMVIEWITEMTITLEBAR_H
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QLabel>
|
||||
@@ -36,51 +36,51 @@ class NodeParamViewItemTitleBar : public QWidget {
|
||||
public:
|
||||
NodeParamViewItemTitleBar(QWidget *parent = nullptr);
|
||||
|
||||
bool IsExpanded() const
|
||||
bool is_expanded() const
|
||||
{
|
||||
return collapse_btn_->isChecked();
|
||||
}
|
||||
|
||||
public slots:
|
||||
void SetExpanded(bool e);
|
||||
void set_expanded(bool e);
|
||||
|
||||
void SetText(const QString &s)
|
||||
void set_text(const QString &s)
|
||||
{
|
||||
lbl_->setText(s);
|
||||
lbl_->setToolTip(s);
|
||||
lbl_->setMinimumWidth(1);
|
||||
}
|
||||
|
||||
void SetPinButtonVisible(bool e)
|
||||
void set_pin_button_visible(bool e)
|
||||
{
|
||||
pin_btn_->setVisible(e);
|
||||
}
|
||||
|
||||
void SetAddEffectButtonVisible(bool e)
|
||||
void set_add_effect_button_visible(bool e)
|
||||
{
|
||||
add_fx_btn_->setVisible(e);
|
||||
}
|
||||
|
||||
void SetEnabledCheckBoxVisible(bool e)
|
||||
void set_enabled_check_box_visible(bool e)
|
||||
{
|
||||
enabled_checkbox_->setVisible(e);
|
||||
}
|
||||
|
||||
void SetEnabledCheckBoxChecked(bool e)
|
||||
void set_enabled_check_box_checked(bool e)
|
||||
{
|
||||
enabled_checkbox_->setChecked(e);
|
||||
}
|
||||
|
||||
signals:
|
||||
void ExpandedStateChanged(bool e);
|
||||
void expanded_state_changed(bool e);
|
||||
|
||||
void PinToggled(bool e);
|
||||
void pin_toggled(bool e);
|
||||
|
||||
void AddEffectButtonClicked();
|
||||
void add_effect_button_clicked();
|
||||
|
||||
void EnabledCheckBoxClicked(bool e);
|
||||
void enabled_check_box_clicked(bool e);
|
||||
|
||||
void Clicked();
|
||||
void clicked();
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent *event) override;
|
||||
@@ -104,4 +104,4 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif // NODEPARAMVIEWITEMTITLEBAR_H
|
||||
#endif // OAK_NODEPARAMVIEWITEMTITLEBAR_H
|
||||
|
||||
@@ -44,89 +44,89 @@ NodeParamViewKeyframeControl::NodeParamViewKeyframeControl(bool right_align,
|
||||
layout->addStretch();
|
||||
}
|
||||
|
||||
prev_key_btn_ = CreateNewToolButton(icon::TriLeft);
|
||||
prev_key_btn_ = create_new_tool_button(icon::tri_left);
|
||||
prev_key_btn_->setIconSize(prev_key_btn_->iconSize() / 2);
|
||||
layout->addWidget(prev_key_btn_);
|
||||
|
||||
toggle_key_btn_ = CreateNewToolButton(icon::Diamond);
|
||||
toggle_key_btn_ = create_new_tool_button(icon::diamond);
|
||||
toggle_key_btn_->setCheckable(true);
|
||||
toggle_key_btn_->setIconSize(toggle_key_btn_->iconSize() / 2);
|
||||
layout->addWidget(toggle_key_btn_);
|
||||
|
||||
next_key_btn_ = CreateNewToolButton(icon::TriRight);
|
||||
next_key_btn_ = create_new_tool_button(icon::tri_right);
|
||||
next_key_btn_->setIconSize(next_key_btn_->iconSize() / 2);
|
||||
layout->addWidget(next_key_btn_);
|
||||
|
||||
enable_key_btn_ = CreateNewToolButton(icon::Clock);
|
||||
enable_key_btn_ = create_new_tool_button(icon::clock);
|
||||
enable_key_btn_->setCheckable(true);
|
||||
enable_key_btn_->setIconSize(enable_key_btn_->iconSize() / 4 * 3);
|
||||
layout->addWidget(enable_key_btn_);
|
||||
|
||||
connect(prev_key_btn_, &QPushButton::clicked, this,
|
||||
&NodeParamViewKeyframeControl::GoToPreviousKey);
|
||||
&NodeParamViewKeyframeControl::go_to_previous_key);
|
||||
connect(next_key_btn_, &QPushButton::clicked, this,
|
||||
&NodeParamViewKeyframeControl::GoToNextKey);
|
||||
&NodeParamViewKeyframeControl::go_to_next_key);
|
||||
connect(toggle_key_btn_, &QPushButton::clicked, this,
|
||||
&NodeParamViewKeyframeControl::ToggleKeyframe);
|
||||
&NodeParamViewKeyframeControl::toggle_keyframe);
|
||||
connect(enable_key_btn_, &QPushButton::toggled, this,
|
||||
&NodeParamViewKeyframeControl::ShowButtonsFromKeyframeEnable);
|
||||
&NodeParamViewKeyframeControl::show_buttons_from_keyframe_enable);
|
||||
connect(enable_key_btn_, &QPushButton::clicked, this,
|
||||
&NodeParamViewKeyframeControl::KeyframeEnableBtnClicked);
|
||||
&NodeParamViewKeyframeControl::keyframe_enable_btn_clicked);
|
||||
|
||||
// Set defaults
|
||||
SetInput(NodeInput());
|
||||
ShowButtonsFromKeyframeEnable(false);
|
||||
set_input(NodeInput());
|
||||
show_buttons_from_keyframe_enable(false);
|
||||
}
|
||||
|
||||
void NodeParamViewKeyframeControl::SetInput(const NodeInput &input)
|
||||
void NodeParamViewKeyframeControl::set_input(const NodeInput &input)
|
||||
{
|
||||
if (input_.IsValid()) {
|
||||
disconnect(input_.node(), &Node::KeyframeEnableChanged, this,
|
||||
&NodeParamViewKeyframeControl::KeyframeEnableChanged);
|
||||
disconnect(input_.node(), &Node::KeyframeAdded, this,
|
||||
&NodeParamViewKeyframeControl::UpdateState);
|
||||
disconnect(input_.node(), &Node::KeyframeRemoved, this,
|
||||
&NodeParamViewKeyframeControl::UpdateState);
|
||||
disconnect(input_.node(), &Node::KeyframeTimeChanged, this,
|
||||
&NodeParamViewKeyframeControl::UpdateState);
|
||||
if (input_.is_valid()) {
|
||||
disconnect(input_.node(), &Node::keyframe_enable_changed, this,
|
||||
&NodeParamViewKeyframeControl::keyframe_enable_changed);
|
||||
disconnect(input_.node(), &Node::keyframe_added, this,
|
||||
&NodeParamViewKeyframeControl::update_state);
|
||||
disconnect(input_.node(), &Node::keyframe_removed, this,
|
||||
&NodeParamViewKeyframeControl::update_state);
|
||||
disconnect(input_.node(), &Node::keyframe_time_changed, this,
|
||||
&NodeParamViewKeyframeControl::update_state);
|
||||
}
|
||||
|
||||
input_ = input;
|
||||
SetButtonsEnabled(input_.IsValid());
|
||||
set_buttons_enabled(input_.is_valid());
|
||||
|
||||
// Pick up keyframing value
|
||||
enable_key_btn_->setChecked(input_.IsValid() && input_.IsKeyframing());
|
||||
enable_key_btn_->setChecked(input_.is_valid() && input_.is_keyframing());
|
||||
|
||||
// Update buttons
|
||||
UpdateState();
|
||||
update_state();
|
||||
|
||||
if (input_.IsValid()) {
|
||||
connect(input_.node(), &Node::KeyframeEnableChanged, this,
|
||||
&NodeParamViewKeyframeControl::KeyframeEnableChanged);
|
||||
connect(input_.node(), &Node::KeyframeAdded, this,
|
||||
&NodeParamViewKeyframeControl::UpdateState);
|
||||
connect(input_.node(), &Node::KeyframeRemoved, this,
|
||||
&NodeParamViewKeyframeControl::UpdateState);
|
||||
connect(input_.node(), &Node::KeyframeTimeChanged, this,
|
||||
&NodeParamViewKeyframeControl::UpdateState);
|
||||
if (input_.is_valid()) {
|
||||
connect(input_.node(), &Node::keyframe_enable_changed, this,
|
||||
&NodeParamViewKeyframeControl::keyframe_enable_changed);
|
||||
connect(input_.node(), &Node::keyframe_added, this,
|
||||
&NodeParamViewKeyframeControl::update_state);
|
||||
connect(input_.node(), &Node::keyframe_removed, this,
|
||||
&NodeParamViewKeyframeControl::update_state);
|
||||
connect(input_.node(), &Node::keyframe_time_changed, this,
|
||||
&NodeParamViewKeyframeControl::update_state);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewKeyframeControl::TimeTargetDisconnectEvent(ViewerOutput *v)
|
||||
{
|
||||
disconnect(v, &ViewerOutput::PlayheadChanged, this,
|
||||
&NodeParamViewKeyframeControl::UpdateState);
|
||||
disconnect(v, &ViewerOutput::playhead_changed, this,
|
||||
&NodeParamViewKeyframeControl::update_state);
|
||||
}
|
||||
|
||||
void NodeParamViewKeyframeControl::TimeTargetConnectEvent(ViewerOutput *v)
|
||||
{
|
||||
connect(v, &ViewerOutput::PlayheadChanged, this,
|
||||
&NodeParamViewKeyframeControl::UpdateState);
|
||||
UpdateState();
|
||||
connect(v, &ViewerOutput::playhead_changed, this,
|
||||
&NodeParamViewKeyframeControl::update_state);
|
||||
update_state();
|
||||
}
|
||||
|
||||
QPushButton *
|
||||
NodeParamViewKeyframeControl::CreateNewToolButton(const QIcon &icon) const
|
||||
NodeParamViewKeyframeControl::create_new_tool_button(const QIcon &icon) const
|
||||
{
|
||||
QPushButton *btn = new QPushButton();
|
||||
btn->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum);
|
||||
@@ -135,7 +135,7 @@ NodeParamViewKeyframeControl::CreateNewToolButton(const QIcon &icon) const
|
||||
return btn;
|
||||
}
|
||||
|
||||
void NodeParamViewKeyframeControl::SetButtonsEnabled(bool e)
|
||||
void NodeParamViewKeyframeControl::set_buttons_enabled(bool e)
|
||||
{
|
||||
prev_key_btn_->setEnabled(e);
|
||||
toggle_key_btn_->setEnabled(e);
|
||||
@@ -143,45 +143,45 @@ void NodeParamViewKeyframeControl::SetButtonsEnabled(bool e)
|
||||
enable_key_btn_->setEnabled(e);
|
||||
}
|
||||
|
||||
rational NodeParamViewKeyframeControl::GetCurrentTimeAsNodeTime() const
|
||||
Rational NodeParamViewKeyframeControl::get_current_time_as_node_time() const
|
||||
{
|
||||
return GetAdjustedTime(GetTimeTarget(), input_.node(),
|
||||
GetTimeTarget()->GetPlayhead(),
|
||||
Node::kTransformTowardsInput);
|
||||
return get_adjusted_time(get_time_target(), input_.node(),
|
||||
get_time_target()->get_playhead(),
|
||||
Node::k_transform_towards_input);
|
||||
}
|
||||
|
||||
rational
|
||||
NodeParamViewKeyframeControl::ConvertToViewerTime(const rational &r) const
|
||||
Rational
|
||||
NodeParamViewKeyframeControl::convert_to_viewer_time(const Rational &r) const
|
||||
{
|
||||
return GetAdjustedTime(input_.node(), GetTimeTarget(), r,
|
||||
Node::kTransformTowardsOutput);
|
||||
return get_adjusted_time(input_.node(), get_time_target(), r,
|
||||
Node::k_transform_towards_output);
|
||||
}
|
||||
|
||||
void NodeParamViewKeyframeControl::ShowButtonsFromKeyframeEnable(bool e)
|
||||
void NodeParamViewKeyframeControl::show_buttons_from_keyframe_enable(bool e)
|
||||
{
|
||||
prev_key_btn_->setVisible(e);
|
||||
toggle_key_btn_->setVisible(e);
|
||||
next_key_btn_->setVisible(e);
|
||||
}
|
||||
|
||||
void NodeParamViewKeyframeControl::ToggleKeyframe(bool e)
|
||||
void NodeParamViewKeyframeControl::toggle_keyframe(bool e)
|
||||
{
|
||||
rational node_time = GetCurrentTimeAsNodeTime();
|
||||
Rational node_time = get_current_time_as_node_time();
|
||||
|
||||
QVector<NodeKeyframe *> keys =
|
||||
input_.node()->GetKeyframesAtTime(input_, node_time);
|
||||
input_.node()->get_keyframes_at_time(input_, node_time);
|
||||
|
||||
MultiUndoCommand *command = new MultiUndoCommand();
|
||||
|
||||
int nb_tracks = input_.node()->GetNumberOfKeyframeTracks(input_);
|
||||
int nb_tracks = input_.node()->get_number_of_keyframe_tracks(input_);
|
||||
|
||||
if (e && keys.isEmpty()) {
|
||||
// Add a keyframe here (one for each track)
|
||||
for (int i = 0; i < nb_tracks; i++) {
|
||||
NodeKeyframe *key = new NodeKeyframe(
|
||||
node_time,
|
||||
input_.node()->GetSplitValueAtTimeOnTrack(input_, node_time, i),
|
||||
input_.node()->GetBestKeyframeTypeForTimeOnTrack(input_,
|
||||
input_.node()->get_split_value_at_time_on_track(input_, node_time, i),
|
||||
input_.node()->get_best_keyframe_type_for_time_on_track(input_,
|
||||
node_time, i),
|
||||
i, input_.element(), input_.input());
|
||||
|
||||
@@ -193,11 +193,11 @@ void NodeParamViewKeyframeControl::ToggleKeyframe(bool e)
|
||||
foreach (NodeKeyframe *key, keys) {
|
||||
command->add_child(new NodeParamRemoveKeyframeCommand(key));
|
||||
|
||||
if (input_.node()->GetKeyframeTracks(input_).size() == 1) {
|
||||
if (input_.node()->get_keyframe_tracks(input_).size() == 1) {
|
||||
// If this was the last keyframe on this track, set the standard value to the value at this time too
|
||||
command->add_child(new NodeParamSetStandardValueCommand(
|
||||
NodeKeyframeTrackReference(input_, key->track()),
|
||||
input_.node()->GetSplitValueAtTimeOnTrack(input_, node_time,
|
||||
input_.node()->get_split_value_at_time_on_track(input_, node_time,
|
||||
key->track())));
|
||||
}
|
||||
}
|
||||
@@ -206,52 +206,52 @@ void NodeParamViewKeyframeControl::ToggleKeyframe(bool e)
|
||||
Core::instance()->undo_stack()->push(command, tr("Toggled Keyframe"));
|
||||
}
|
||||
|
||||
void NodeParamViewKeyframeControl::UpdateState()
|
||||
void NodeParamViewKeyframeControl::update_state()
|
||||
{
|
||||
if (!input_.IsValid() || !input_.IsKeyframing() || !GetTimeTarget()) {
|
||||
if (!input_.is_valid() || !input_.is_keyframing() || !get_time_target()) {
|
||||
return;
|
||||
}
|
||||
|
||||
NodeKeyframe *earliest_key = input_.node()->GetEarliestKeyframe(input_);
|
||||
NodeKeyframe *latest_key = input_.node()->GetLatestKeyframe(input_);
|
||||
NodeKeyframe *earliest_key = input_.node()->get_earliest_keyframe(input_);
|
||||
NodeKeyframe *latest_key = input_.node()->get_latest_keyframe(input_);
|
||||
|
||||
rational node_time = GetCurrentTimeAsNodeTime();
|
||||
Rational node_time = get_current_time_as_node_time();
|
||||
|
||||
prev_key_btn_->setEnabled(earliest_key && node_time > earliest_key->time());
|
||||
next_key_btn_->setEnabled(latest_key && node_time < latest_key->time());
|
||||
toggle_key_btn_->setChecked(
|
||||
input_.node()->HasKeyframeAtTime(input_, node_time));
|
||||
input_.node()->has_keyframe_at_time(input_, node_time));
|
||||
}
|
||||
|
||||
void NodeParamViewKeyframeControl::GoToPreviousKey()
|
||||
void NodeParamViewKeyframeControl::go_to_previous_key()
|
||||
{
|
||||
rational node_time = GetCurrentTimeAsNodeTime();
|
||||
Rational node_time = get_current_time_as_node_time();
|
||||
|
||||
NodeKeyframe *previous_key =
|
||||
input_.node()->GetClosestKeyframeBeforeTime(input_, node_time);
|
||||
input_.node()->get_closest_keyframe_before_time(input_, node_time);
|
||||
|
||||
if (previous_key && GetTimeTarget()) {
|
||||
rational key_time = ConvertToViewerTime(previous_key->time());
|
||||
GetTimeTarget()->SetPlayhead(key_time);
|
||||
if (previous_key && get_time_target()) {
|
||||
Rational key_time = convert_to_viewer_time(previous_key->time());
|
||||
get_time_target()->set_playhead(key_time);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewKeyframeControl::GoToNextKey()
|
||||
void NodeParamViewKeyframeControl::go_to_next_key()
|
||||
{
|
||||
rational node_time = GetCurrentTimeAsNodeTime();
|
||||
Rational node_time = get_current_time_as_node_time();
|
||||
|
||||
NodeKeyframe *next_key =
|
||||
input_.node()->GetClosestKeyframeAfterTime(input_, node_time);
|
||||
input_.node()->get_closest_keyframe_after_time(input_, node_time);
|
||||
|
||||
if (next_key && GetTimeTarget()) {
|
||||
rational key_time = ConvertToViewerTime(next_key->time());
|
||||
GetTimeTarget()->SetPlayhead(key_time);
|
||||
if (next_key && get_time_target()) {
|
||||
Rational key_time = convert_to_viewer_time(next_key->time());
|
||||
get_time_target()->set_playhead(key_time);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewKeyframeControl::KeyframeEnableBtnClicked(bool e)
|
||||
void NodeParamViewKeyframeControl::keyframe_enable_btn_clicked(bool e)
|
||||
{
|
||||
if (e == input_.IsKeyframing()) {
|
||||
if (e == input_.is_keyframing()) {
|
||||
// No-op
|
||||
return;
|
||||
}
|
||||
@@ -266,12 +266,12 @@ void NodeParamViewKeyframeControl::KeyframeEnableBtnClicked(bool e)
|
||||
|
||||
// Create one keyframe across all tracks here
|
||||
const QVector<QVariant> &key_vals =
|
||||
input_.node()->GetSplitStandardValue(input_);
|
||||
input_.node()->get_split_standard_value(input_);
|
||||
|
||||
for (int i = 0; i < key_vals.size(); i++) {
|
||||
NodeKeyframe *key =
|
||||
new NodeKeyframe(GetCurrentTimeAsNodeTime(), key_vals.at(i),
|
||||
NodeKeyframe::kDefaultType, i,
|
||||
new NodeKeyframe(get_current_time_as_node_time(), key_vals.at(i),
|
||||
NodeKeyframe::k_default_type, i,
|
||||
input_.element(), input_.input());
|
||||
|
||||
command->add_child(
|
||||
@@ -280,7 +280,7 @@ void NodeParamViewKeyframeControl::KeyframeEnableBtnClicked(bool e)
|
||||
|
||||
command_name =
|
||||
tr("Enabled Keyframing On %1 - %2")
|
||||
.arg(input_.node()->GetLabelAndName(), input_.GetInputName());
|
||||
.arg(input_.node()->get_label_and_name(), input_.get_input_name());
|
||||
} else {
|
||||
// Confirm the user wants to clear all keyframes
|
||||
if (QMessageBox::warning(
|
||||
@@ -289,12 +289,12 @@ void NodeParamViewKeyframeControl::KeyframeEnableBtnClicked(bool e)
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
||||
// Store value at this time, we'll set this as the persistent value later
|
||||
const QVector<QVariant> &stored_vals =
|
||||
input_.node()->GetSplitValueAtTime(input_,
|
||||
GetCurrentTimeAsNodeTime());
|
||||
input_.node()->get_split_value_at_time(input_,
|
||||
get_current_time_as_node_time());
|
||||
|
||||
// Delete all keyframes
|
||||
foreach (const NodeKeyframeTrack &track,
|
||||
input_.node()->GetKeyframeTracks(input_)) {
|
||||
input_.node()->get_keyframe_tracks(input_)) {
|
||||
for (int i = track.size() - 1; i >= 0; i--) {
|
||||
command->add_child(
|
||||
new NodeParamRemoveKeyframeCommand(track.at(i)));
|
||||
@@ -312,8 +312,8 @@ void NodeParamViewKeyframeControl::KeyframeEnableBtnClicked(bool e)
|
||||
new NodeParamSetKeyframingCommand(input_, false));
|
||||
|
||||
command_name = tr("Disabled Keyframing On %1 - %2")
|
||||
.arg(input_.node()->GetLabelAndName(),
|
||||
input_.GetInputName());
|
||||
.arg(input_.node()->get_label_and_name(),
|
||||
input_.get_input_name());
|
||||
} else {
|
||||
// Disable action has effectively been ignored
|
||||
enable_key_btn_->setChecked(true);
|
||||
@@ -323,7 +323,7 @@ void NodeParamViewKeyframeControl::KeyframeEnableBtnClicked(bool e)
|
||||
Core::instance()->undo_stack()->push(command, command_name);
|
||||
}
|
||||
|
||||
void NodeParamViewKeyframeControl::KeyframeEnableChanged(const NodeInput &input,
|
||||
void NodeParamViewKeyframeControl::keyframe_enable_changed(const NodeInput &input,
|
||||
bool e)
|
||||
{
|
||||
if (input_ == input) {
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef NODEPARAMVIEWKEYFRAMECONTROL_H
|
||||
#define NODEPARAMVIEWKEYFRAMECONTROL_H
|
||||
#ifndef OAK_NODEPARAMVIEWKEYFRAMECONTROL_H
|
||||
#define OAK_NODEPARAMVIEWKEYFRAMECONTROL_H
|
||||
|
||||
#include <QPushButton>
|
||||
#include <QWidget>
|
||||
@@ -40,25 +40,25 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
const NodeInput &GetConnectedInput() const
|
||||
const NodeInput &get_connected_input() const
|
||||
{
|
||||
return input_;
|
||||
}
|
||||
|
||||
void SetInput(const NodeInput &input);
|
||||
void set_input(const NodeInput &input);
|
||||
|
||||
protected:
|
||||
virtual void TimeTargetDisconnectEvent(ViewerOutput *v) override;
|
||||
virtual void TimeTargetConnectEvent(ViewerOutput *v) override;
|
||||
|
||||
private:
|
||||
QPushButton *CreateNewToolButton(const QIcon &icon) const;
|
||||
QPushButton *create_new_tool_button(const QIcon &icon) const;
|
||||
|
||||
void SetButtonsEnabled(bool e);
|
||||
void set_buttons_enabled(bool e);
|
||||
|
||||
rational GetCurrentTimeAsNodeTime() const;
|
||||
Rational get_current_time_as_node_time() const;
|
||||
|
||||
rational ConvertToViewerTime(const rational &r) const;
|
||||
Rational convert_to_viewer_time(const Rational &r) const;
|
||||
|
||||
QPushButton *prev_key_btn_;
|
||||
QPushButton *toggle_key_btn_;
|
||||
@@ -68,21 +68,21 @@ private:
|
||||
NodeInput input_;
|
||||
|
||||
private slots:
|
||||
void ShowButtonsFromKeyframeEnable(bool e);
|
||||
void show_buttons_from_keyframe_enable(bool e);
|
||||
|
||||
void ToggleKeyframe(bool e);
|
||||
void toggle_keyframe(bool e);
|
||||
|
||||
void UpdateState();
|
||||
void update_state();
|
||||
|
||||
void GoToPreviousKey();
|
||||
void go_to_previous_key();
|
||||
|
||||
void GoToNextKey();
|
||||
void go_to_next_key();
|
||||
|
||||
void KeyframeEnableBtnClicked(bool e);
|
||||
void keyframe_enable_btn_clicked(bool e);
|
||||
|
||||
void KeyframeEnableChanged(const NodeInput &input, bool e);
|
||||
void keyframe_enable_changed(const NodeInput &input, bool e);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // NODEPARAMVIEWKEYFRAMECONTROL_H
|
||||
#endif // OAK_NODEPARAMVIEWKEYFRAMECONTROL_H
|
||||
|
||||
@@ -38,46 +38,46 @@ NodeParamViewTextEdit::NodeParamViewTextEdit(QWidget *parent)
|
||||
line_edit_ = new QPlainTextEdit();
|
||||
line_edit_->setUndoRedoEnabled(true);
|
||||
connect(line_edit_, &QPlainTextEdit::textChanged, this,
|
||||
&NodeParamViewTextEdit::InnerWidgetTextChanged);
|
||||
&NodeParamViewTextEdit::inner_widget_text_changed);
|
||||
layout->addWidget(line_edit_);
|
||||
|
||||
edit_btn_ = new QPushButton();
|
||||
edit_btn_->setIcon(icon::ToolEdit);
|
||||
edit_btn_->setIcon(icon::tool_edit);
|
||||
edit_btn_->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Expanding);
|
||||
layout->addWidget(edit_btn_);
|
||||
connect(edit_btn_, &QPushButton::clicked, this,
|
||||
&NodeParamViewTextEdit::ShowTextDialog);
|
||||
&NodeParamViewTextEdit::show_text_dialog);
|
||||
|
||||
edit_in_viewer_btn_ = new QPushButton(tr("Edit In Viewer"));
|
||||
edit_in_viewer_btn_->setIcon(icon::Pencil);
|
||||
edit_in_viewer_btn_->setIcon(icon::pencil);
|
||||
layout->addWidget(edit_in_viewer_btn_);
|
||||
connect(edit_in_viewer_btn_, &QPushButton::clicked, this,
|
||||
&NodeParamViewTextEdit::RequestEditInViewer);
|
||||
&NodeParamViewTextEdit::request_edit_in_viewer);
|
||||
|
||||
SetEditInViewerOnlyMode(false);
|
||||
set_edit_in_viewer_only_mode(false);
|
||||
}
|
||||
|
||||
void NodeParamViewTextEdit::SetEditInViewerOnlyMode(bool on)
|
||||
void NodeParamViewTextEdit::set_edit_in_viewer_only_mode(bool on)
|
||||
{
|
||||
line_edit_->setVisible(!on);
|
||||
edit_btn_->setVisible(!on);
|
||||
edit_in_viewer_btn_->setVisible(on);
|
||||
}
|
||||
|
||||
void NodeParamViewTextEdit::ShowTextDialog()
|
||||
void NodeParamViewTextEdit::show_text_dialog()
|
||||
{
|
||||
TextDialog d(this->text(), this);
|
||||
if (d.exec() == QDialog::Accepted) {
|
||||
QString s = d.text();
|
||||
|
||||
line_edit_->setPlainText(s);
|
||||
emit textEdited(s);
|
||||
emit text_edited(s);
|
||||
}
|
||||
}
|
||||
|
||||
void NodeParamViewTextEdit::InnerWidgetTextChanged()
|
||||
void NodeParamViewTextEdit::inner_widget_text_changed()
|
||||
{
|
||||
emit textEdited(this->text());
|
||||
emit text_edited(this->text());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef NODEPARAMVIEWTEXTEDIT_H
|
||||
#define NODEPARAMVIEWTEXTEDIT_H
|
||||
#ifndef OAK_NODEPARAMVIEWTEXTEDIT_H
|
||||
#define OAK_NODEPARAMVIEWTEXTEDIT_H
|
||||
|
||||
#include <QPlainTextEdit>
|
||||
#include <QPushButton>
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
return line_edit_->toPlainText();
|
||||
}
|
||||
|
||||
void SetEditInViewerOnlyMode(bool on);
|
||||
void set_edit_in_viewer_only_mode(bool on);
|
||||
|
||||
public slots:
|
||||
void setText(const QString &s)
|
||||
@@ -66,9 +66,9 @@ public slots:
|
||||
}
|
||||
|
||||
signals:
|
||||
void textEdited(const QString &);
|
||||
void text_edited(const QString &);
|
||||
|
||||
void RequestEditInViewer();
|
||||
void request_edit_in_viewer();
|
||||
|
||||
private:
|
||||
QPlainTextEdit *line_edit_;
|
||||
@@ -78,11 +78,11 @@ private:
|
||||
QPushButton *edit_in_viewer_btn_;
|
||||
|
||||
private slots:
|
||||
void ShowTextDialog();
|
||||
void show_text_dialog();
|
||||
|
||||
void InnerWidgetTextChanged();
|
||||
void inner_widget_text_changed();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // NODEPARAMVIEWTEXTEDIT_H
|
||||
#endif // OAK_NODEPARAMVIEWTEXTEDIT_H
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -19,8 +19,8 @@
|
||||
|
||||
***/
|
||||
|
||||
#ifndef NODEPARAMVIEWWIDGETBRIDGE_H
|
||||
#define NODEPARAMVIEWWIDGETBRIDGE_H
|
||||
#ifndef OAK_NODEPARAMVIEWWIDGETBRIDGE_H
|
||||
#define OAK_NODEPARAMVIEWWIDGETBRIDGE_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
@@ -48,61 +48,61 @@ public:
|
||||
}
|
||||
|
||||
// Set the timebase of certain Timebased widgets
|
||||
void SetTimebase(const rational &timebase);
|
||||
void set_timebase(const Rational &timebase);
|
||||
|
||||
signals:
|
||||
void ArrayWidgetDoubleClicked();
|
||||
void array_widget_double_clicked();
|
||||
|
||||
void WidgetsRecreated(const NodeInput &input);
|
||||
void widgets_recreated(const NodeInput &input);
|
||||
|
||||
void RequestEditTextInViewer();
|
||||
void request_edit_text_in_viewer();
|
||||
|
||||
protected:
|
||||
virtual void TimeTargetDisconnectEvent(ViewerOutput *v) override;
|
||||
virtual void TimeTargetConnectEvent(ViewerOutput *v) override;
|
||||
|
||||
private:
|
||||
void CreateWidgets();
|
||||
void create_widgets();
|
||||
|
||||
void SetInputValue(const QVariant &value, int track);
|
||||
void set_input_value(const QVariant &value, int track);
|
||||
|
||||
void SetInputValueInternal(const QVariant &value, int track,
|
||||
void set_input_value_internal(const QVariant &value, int track,
|
||||
MultiUndoCommand *command,
|
||||
bool insert_on_all_tracks_if_no_key);
|
||||
|
||||
void ProcessSlider(NumericSliderBase *slider, int slider_track,
|
||||
void process_slider(NumericSliderBase *slider, int slider_track,
|
||||
const QVariant &value);
|
||||
void ProcessSlider(NumericSliderBase *slider, const QVariant &value)
|
||||
void process_slider(NumericSliderBase *slider, const QVariant &value)
|
||||
{
|
||||
ProcessSlider(slider, widgets_.indexOf(slider), value);
|
||||
process_slider(slider, widgets_.indexOf(slider), value);
|
||||
}
|
||||
|
||||
void SetProperty(const QString &key, const QVariant &value);
|
||||
void set_property(const QString &key, const QVariant &value);
|
||||
|
||||
template <typename T> void CreateSliders(int count, QWidget *parent);
|
||||
template <typename T> void create_sliders(int count, QWidget *parent);
|
||||
|
||||
void UpdateWidgetValues();
|
||||
void update_widget_values();
|
||||
|
||||
rational GetCurrentTimeAsNodeTime() const;
|
||||
Rational get_current_time_as_node_time() const;
|
||||
|
||||
const NodeInput &GetOuterInput() const
|
||||
const NodeInput &get_outer_input() const
|
||||
{
|
||||
return input_hierarchy_.first();
|
||||
}
|
||||
|
||||
const NodeInput &GetInnerInput() const
|
||||
const NodeInput &get_inner_input() const
|
||||
{
|
||||
return input_hierarchy_.last();
|
||||
}
|
||||
|
||||
QString GetCommandName() const;
|
||||
QString get_command_name() const;
|
||||
|
||||
NodeValue::Type GetDataType() const
|
||||
NodeValue::Type get_data_type() const
|
||||
{
|
||||
return GetOuterInput().GetDataType();
|
||||
return get_outer_input().get_data_type();
|
||||
}
|
||||
|
||||
void UpdateProperties();
|
||||
void update_properties();
|
||||
|
||||
QVector<NodeInput> input_hierarchy_;
|
||||
|
||||
@@ -113,16 +113,16 @@ private:
|
||||
NodeParamViewScrollBlocker scroll_filter_;
|
||||
|
||||
private slots:
|
||||
void WidgetCallback();
|
||||
void widget_callback();
|
||||
|
||||
void InputValueChanged(const NodeInput &input, const TimeRange &range);
|
||||
void input_value_changed(const NodeInput &input, const TimeRange &range);
|
||||
|
||||
void InputDataTypeChanged(const QString &input, NodeValue::Type type);
|
||||
void input_data_type_changed(const QString &input, NodeValue::Type type);
|
||||
|
||||
void PropertyChanged(const QString &input, const QString &key,
|
||||
void property_changed(const QString &input, const QString &key,
|
||||
const QVariant &value);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // NODEPARAMVIEWWIDGETBRIDGE_H
|
||||
#endif // OAK_NODEPARAMVIEWWIDGETBRIDGE_H
|
||||
|
||||
Reference in New Issue
Block a user