nodeparamview: speed up node adding
This commit is contained in:
@@ -76,7 +76,7 @@ NodeParamView::NodeParamView(bool create_keyframe_view, QWidget *parent) :
|
|||||||
// Create contexts for three different types
|
// Create contexts for three different types
|
||||||
context_items_.resize(Track::kCount + 1);
|
context_items_.resize(Track::kCount + 1);
|
||||||
for (int i=0; i<context_items_.size(); i++) {
|
for (int i=0; i<context_items_.size(); i++) {
|
||||||
NodeParamViewContext *c = new NodeParamViewContext;
|
NodeParamViewContext *c = new NodeParamViewContext(param_widget_area_);
|
||||||
c->setVisible(false);
|
c->setVisible(false);
|
||||||
connect(c, &NodeParamViewContext::AboutToDeleteItem, this, &NodeParamView::ItemAboutToBeRemoved, Qt::DirectConnection);
|
connect(c, &NodeParamViewContext::AboutToDeleteItem, this, &NodeParamView::ItemAboutToBeRemoved, Qt::DirectConnection);
|
||||||
|
|
||||||
@@ -245,8 +245,6 @@ void NodeParamView::DeselectNodes(const QVector<Node *> &nodes)
|
|||||||
|
|
||||||
void NodeParamView::UpdateContexts()
|
void NodeParamView::UpdateContexts()
|
||||||
{
|
{
|
||||||
//TIME_THIS_FUNCTION;
|
|
||||||
|
|
||||||
bool changes_made = false;
|
bool changes_made = false;
|
||||||
|
|
||||||
foreach (Node *ctx, current_contexts_) {
|
foreach (Node *ctx, current_contexts_) {
|
||||||
@@ -735,7 +733,7 @@ void NodeParamView::AddNode(Node *n, Node *ctx, NodeParamViewContext *context)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeParamViewItem* item = new NodeParamViewItem(n, IsGroupMode() ? kCheckBoxesOnNonConnected : kNoCheckBoxes, context);
|
NodeParamViewItem* item = new NodeParamViewItem(n, IsGroupMode() ? kCheckBoxesOnNonConnected : kNoCheckBoxes, context->GetDockArea());
|
||||||
|
|
||||||
connect(item, &NodeParamViewItem::RequestSetTime, this, &NodeParamView::SetTimeAndSignal);
|
connect(item, &NodeParamViewItem::RequestSetTime, this, &NodeParamView::SetTimeAndSignal);
|
||||||
connect(item, &NodeParamViewItem::RequestSelectNode, this, &NodeParamView::SelectNodeFromConnectedLink);
|
connect(item, &NodeParamViewItem::RequestSelectNode, this, &NodeParamView::SelectNodeFromConnectedLink);
|
||||||
|
|||||||
@@ -50,13 +50,13 @@ NodeParamViewConnectedLabel::NodeParamViewConnectedLabel(const NodeInput &input,
|
|||||||
label_layout->setMargin(0);
|
label_layout->setMargin(0);
|
||||||
layout->addLayout(label_layout);
|
layout->addLayout(label_layout);
|
||||||
|
|
||||||
CollapseButton *collapse_btn = new CollapseButton();
|
CollapseButton *collapse_btn = new CollapseButton(this);
|
||||||
collapse_btn->setChecked(false);
|
collapse_btn->setChecked(false);
|
||||||
label_layout->addWidget(collapse_btn);
|
label_layout->addWidget(collapse_btn);
|
||||||
|
|
||||||
label_layout->addWidget(new QLabel(tr("Connected to")));
|
label_layout->addWidget(new QLabel(tr("Connected to"), this));
|
||||||
|
|
||||||
connected_to_lbl_ = new ClickableLabel();
|
connected_to_lbl_ = new ClickableLabel(this);
|
||||||
connected_to_lbl_->setCursor(Qt::PointingHandCursor);
|
connected_to_lbl_->setCursor(Qt::PointingHandCursor);
|
||||||
connected_to_lbl_->setContextMenuPolicy(Qt::CustomContextMenu);
|
connected_to_lbl_->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
connect(connected_to_lbl_, &ClickableLabel::MouseClicked, this, &NodeParamViewConnectedLabel::ConnectionClicked);
|
connect(connected_to_lbl_, &ClickableLabel::MouseClicked, this, &NodeParamViewConnectedLabel::ConnectionClicked);
|
||||||
@@ -80,18 +80,23 @@ NodeParamViewConnectedLabel::NodeParamViewConnectedLabel(const NodeInput &input,
|
|||||||
connect(input_.node(), &Node::InputConnected, this, &NodeParamViewConnectedLabel::InputConnected);
|
connect(input_.node(), &Node::InputConnected, this, &NodeParamViewConnectedLabel::InputConnected);
|
||||||
connect(input_.node(), &Node::InputDisconnected, this, &NodeParamViewConnectedLabel::InputDisconnected);
|
connect(input_.node(), &Node::InputDisconnected, this, &NodeParamViewConnectedLabel::InputDisconnected);
|
||||||
|
|
||||||
// Set up table area
|
// Creating the tree is expensive, hold off until the user specifically requests it
|
||||||
value_tree_ = new NodeValueTree();
|
value_tree_ = nullptr;
|
||||||
value_tree_->setVisible(false);
|
|
||||||
layout->addWidget(value_tree_);
|
|
||||||
connect(collapse_btn, &CollapseButton::toggled, this, &NodeParamViewConnectedLabel::SetValueTreeVisible);
|
connect(collapse_btn, &CollapseButton::toggled, this, &NodeParamViewConnectedLabel::SetValueTreeVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NodeParamViewConnectedLabel::CreateTree()
|
||||||
|
{
|
||||||
|
// Set up table area
|
||||||
|
value_tree_ = new NodeValueTree(this);
|
||||||
|
layout()->addWidget(value_tree_);
|
||||||
|
}
|
||||||
|
|
||||||
void NodeParamViewConnectedLabel::SetTime(const rational &time)
|
void NodeParamViewConnectedLabel::SetTime(const rational &time)
|
||||||
{
|
{
|
||||||
time_ = time;
|
time_ = time;
|
||||||
|
|
||||||
if (value_tree_->isVisible()) {
|
if (value_tree_ && value_tree_->isVisible()) {
|
||||||
UpdateValueTree();
|
UpdateValueTree();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -154,14 +159,22 @@ void NodeParamViewConnectedLabel::UpdateLabel()
|
|||||||
|
|
||||||
void NodeParamViewConnectedLabel::UpdateValueTree()
|
void NodeParamViewConnectedLabel::UpdateValueTree()
|
||||||
{
|
{
|
||||||
value_tree_->SetNode(input_, time_);
|
if (value_tree_) {
|
||||||
|
value_tree_->SetNode(input_, time_);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeParamViewConnectedLabel::SetValueTreeVisible(bool e)
|
void NodeParamViewConnectedLabel::SetValueTreeVisible(bool e)
|
||||||
{
|
{
|
||||||
value_tree_->setVisible(e);
|
if (value_tree_) {
|
||||||
|
value_tree_->setVisible(e);
|
||||||
|
}
|
||||||
|
|
||||||
if (e) {
|
if (e) {
|
||||||
|
if (!value_tree_) {
|
||||||
|
CreateTree();
|
||||||
|
}
|
||||||
|
|
||||||
UpdateValueTree();
|
UpdateValueTree();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ private:
|
|||||||
|
|
||||||
void UpdateValueTree();
|
void UpdateValueTree();
|
||||||
|
|
||||||
|
void CreateTree();
|
||||||
|
|
||||||
ClickableLabel* connected_to_lbl_;
|
ClickableLabel* connected_to_lbl_;
|
||||||
|
|
||||||
NodeInput input_;
|
NodeInput input_;
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ void NodeParamViewItem::RecreateBody()
|
|||||||
body_->deleteLater();
|
body_->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
body_ = new NodeParamViewItemBody(node_, create_checkboxes_);
|
body_ = new NodeParamViewItemBody(node_, create_checkboxes_, this);
|
||||||
connect(body_, &NodeParamViewItemBody::RequestSelectNode, this, &NodeParamViewItem::RequestSelectNode);
|
connect(body_, &NodeParamViewItemBody::RequestSelectNode, this, &NodeParamViewItem::RequestSelectNode);
|
||||||
connect(body_, &NodeParamViewItemBody::RequestSetTime, this, &NodeParamViewItem::RequestSetTime);
|
connect(body_, &NodeParamViewItemBody::RequestSetTime, this, &NodeParamViewItem::RequestSetTime);
|
||||||
connect(body_, &NodeParamViewItemBody::ArrayExpandedChanged, this, &NodeParamViewItem::ArrayExpandedChanged);
|
connect(body_, &NodeParamViewItemBody::ArrayExpandedChanged, this, &NodeParamViewItem::ArrayExpandedChanged);
|
||||||
@@ -148,7 +148,7 @@ NodeParamViewItemBody::NodeParamViewItemBody(Node* node, NodeParamViewCheckBoxBe
|
|||||||
|
|
||||||
if (n->InputIsArray(input)) {
|
if (n->InputIsArray(input)) {
|
||||||
// Insert here
|
// Insert here
|
||||||
QWidget* array_widget = new QWidget();
|
QWidget* array_widget = new QWidget(this);
|
||||||
|
|
||||||
QGridLayout* array_layout = new QGridLayout(array_widget);
|
QGridLayout* array_layout = new QGridLayout(array_widget);
|
||||||
array_layout->setContentsMargins(QtUtils::QFontMetricsWidth(fontMetrics(), QStringLiteral(" ")), 0, 0, 0);
|
array_layout->setContentsMargins(QtUtils::QFontMetricsWidth(fontMetrics(), QStringLiteral(" ")), 0, 0, 0);
|
||||||
@@ -160,7 +160,7 @@ NodeParamViewItemBody::NodeParamViewItemBody(Node* node, NodeParamViewCheckBoxBe
|
|||||||
int arr_sz = 0;
|
int arr_sz = 0;
|
||||||
|
|
||||||
// Add one last add button for appending to the array
|
// Add one last add button for appending to the array
|
||||||
NodeParamViewArrayButton* append_btn = new NodeParamViewArrayButton(NodeParamViewArrayButton::kAdd);
|
NodeParamViewArrayButton* append_btn = new NodeParamViewArrayButton(NodeParamViewArrayButton::kAdd, this);
|
||||||
connect(append_btn, &NodeParamViewArrayButton::clicked, this, &NodeParamViewItemBody::ArrayAppendClicked);
|
connect(append_btn, &NodeParamViewArrayButton::clicked, this, &NodeParamViewItemBody::ArrayAppendClicked);
|
||||||
array_layout->addWidget(append_btn, arr_sz, kArrayInsertColumn);
|
array_layout->addWidget(append_btn, arr_sz, kArrayInsertColumn);
|
||||||
|
|
||||||
@@ -186,7 +186,7 @@ void NodeParamViewItemBody::CreateWidgets(QGridLayout* layout, Node *node, const
|
|||||||
|
|
||||||
// Create optional checkbox if requested
|
// Create optional checkbox if requested
|
||||||
if (create_checkboxes_) {
|
if (create_checkboxes_) {
|
||||||
ui_objects.optional_checkbox = new QCheckBox();
|
ui_objects.optional_checkbox = new QCheckBox(this);
|
||||||
connect(ui_objects.optional_checkbox, &QCheckBox::clicked, this, &NodeParamViewItemBody::OptionalCheckBoxClicked);
|
connect(ui_objects.optional_checkbox, &QCheckBox::clicked, this, &NodeParamViewItemBody::OptionalCheckBoxClicked);
|
||||||
layout->addWidget(ui_objects.optional_checkbox, row, kOptionalCheckBox);
|
layout->addWidget(ui_objects.optional_checkbox, row, kOptionalCheckBox);
|
||||||
|
|
||||||
@@ -196,7 +196,7 @@ void NodeParamViewItemBody::CreateWidgets(QGridLayout* layout, Node *node, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add descriptor label
|
// Add descriptor label
|
||||||
ui_objects.main_label = new QLabel();
|
ui_objects.main_label = new QLabel(this);
|
||||||
|
|
||||||
// Create input label
|
// Create input label
|
||||||
layout->addWidget(ui_objects.main_label, row, kLabelColumn);
|
layout->addWidget(ui_objects.main_label, row, kLabelColumn);
|
||||||
@@ -205,7 +205,7 @@ void NodeParamViewItemBody::CreateWidgets(QGridLayout* layout, Node *node, const
|
|||||||
if (element == -1) {
|
if (element == -1) {
|
||||||
|
|
||||||
// Create a collapse toggle for expanding/collapsing the array
|
// Create a collapse toggle for expanding/collapsing the array
|
||||||
CollapseButton* array_collapse_btn = new CollapseButton();
|
CollapseButton* array_collapse_btn = new CollapseButton(this);
|
||||||
|
|
||||||
// Default to collapsed
|
// Default to collapsed
|
||||||
array_collapse_btn->setChecked(false);
|
array_collapse_btn->setChecked(false);
|
||||||
@@ -220,8 +220,8 @@ void NodeParamViewItemBody::CreateWidgets(QGridLayout* layout, Node *node, const
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
NodeParamViewArrayButton* insert_element_btn = new NodeParamViewArrayButton(NodeParamViewArrayButton::kAdd);
|
NodeParamViewArrayButton* insert_element_btn = new NodeParamViewArrayButton(NodeParamViewArrayButton::kAdd, this);
|
||||||
NodeParamViewArrayButton* remove_element_btn = new NodeParamViewArrayButton(NodeParamViewArrayButton::kRemove);
|
NodeParamViewArrayButton* remove_element_btn = new NodeParamViewArrayButton(NodeParamViewArrayButton::kRemove, this);
|
||||||
|
|
||||||
layout->addWidget(insert_element_btn, row, kArrayInsertColumn);
|
layout->addWidget(insert_element_btn, row, kArrayInsertColumn);
|
||||||
layout->addWidget(remove_element_btn, row, kArrayRemoveColumn);
|
layout->addWidget(remove_element_btn, row, kArrayRemoveColumn);
|
||||||
@@ -249,14 +249,14 @@ void NodeParamViewItemBody::CreateWidgets(QGridLayout* layout, Node *node, const
|
|||||||
|
|
||||||
if (node->IsInputConnectable(input)) {
|
if (node->IsInputConnectable(input)) {
|
||||||
// Create clickable label used when an input is connected
|
// Create clickable label used when an input is connected
|
||||||
ui_objects.connected_label = new NodeParamViewConnectedLabel(resolved);
|
ui_objects.connected_label = new NodeParamViewConnectedLabel(resolved, this);
|
||||||
connect(ui_objects.connected_label, &NodeParamViewConnectedLabel::RequestSelectNode, this, &NodeParamViewItemBody::RequestSelectNode);
|
connect(ui_objects.connected_label, &NodeParamViewConnectedLabel::RequestSelectNode, this, &NodeParamViewItemBody::RequestSelectNode);
|
||||||
layout->addWidget(ui_objects.connected_label, row, kWidgetStartColumn, 1, kKeyControlColumn - kWidgetStartColumn);
|
layout->addWidget(ui_objects.connected_label, row, kWidgetStartColumn, 1, kKeyControlColumn - kWidgetStartColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add keyframe control to this layout if parameter is keyframable
|
// Add keyframe control to this layout if parameter is keyframable
|
||||||
if (node->IsInputKeyframable(input)) {
|
if (node->IsInputKeyframable(input)) {
|
||||||
ui_objects.key_control = new NodeParamViewKeyframeControl();
|
ui_objects.key_control = new NodeParamViewKeyframeControl(this);
|
||||||
ui_objects.key_control->SetInput(resolved);
|
ui_objects.key_control->SetInput(resolved);
|
||||||
layout->addWidget(ui_objects.key_control, row, kKeyControlColumn);
|
layout->addWidget(ui_objects.key_control, row, kKeyControlColumn);
|
||||||
connect(ui_objects.key_control, &NodeParamViewKeyframeControl::RequestSetTime, this, &NodeParamViewItemBody::RequestSetTime);
|
connect(ui_objects.key_control, &NodeParamViewKeyframeControl::RequestSetTime, this, &NodeParamViewItemBody::RequestSetTime);
|
||||||
|
|||||||
@@ -33,31 +33,31 @@ NodeParamViewItemTitleBar::NodeParamViewItemTitleBar(QWidget *parent) :
|
|||||||
{
|
{
|
||||||
QHBoxLayout* layout = new QHBoxLayout(this);
|
QHBoxLayout* layout = new QHBoxLayout(this);
|
||||||
|
|
||||||
collapse_btn_ = new CollapseButton();
|
collapse_btn_ = new CollapseButton(this);
|
||||||
connect(collapse_btn_, &QPushButton::clicked, this, &NodeParamViewItemTitleBar::ExpandedStateChanged);
|
connect(collapse_btn_, &QPushButton::clicked, this, &NodeParamViewItemTitleBar::ExpandedStateChanged);
|
||||||
layout->addWidget(collapse_btn_);
|
layout->addWidget(collapse_btn_);
|
||||||
|
|
||||||
lbl_ = new QLabel();
|
lbl_ = new QLabel(this);
|
||||||
layout->addWidget(lbl_);
|
layout->addWidget(lbl_);
|
||||||
|
|
||||||
// Place next buttons on the far side
|
// Place next buttons on the far side
|
||||||
layout->addStretch();
|
layout->addStretch();
|
||||||
|
|
||||||
add_fx_btn_ = new QPushButton();
|
add_fx_btn_ = new QPushButton(this);
|
||||||
add_fx_btn_->setIcon(icon::AddEffect);
|
add_fx_btn_->setIcon(icon::AddEffect);
|
||||||
add_fx_btn_->setFixedSize(add_fx_btn_->sizeHint().height(), add_fx_btn_->sizeHint().height());
|
add_fx_btn_->setFixedSize(add_fx_btn_->sizeHint().height(), add_fx_btn_->sizeHint().height());
|
||||||
add_fx_btn_->setVisible(false);
|
add_fx_btn_->setVisible(false);
|
||||||
layout->addWidget(add_fx_btn_);
|
layout->addWidget(add_fx_btn_);
|
||||||
connect(add_fx_btn_, &QPushButton::clicked, this, &NodeParamViewItemTitleBar::AddEffectButtonClicked);
|
connect(add_fx_btn_, &QPushButton::clicked, this, &NodeParamViewItemTitleBar::AddEffectButtonClicked);
|
||||||
|
|
||||||
pin_btn_ = new QPushButton(QStringLiteral("P"));
|
pin_btn_ = new QPushButton(QStringLiteral("P"), this);
|
||||||
pin_btn_->setCheckable(true);
|
pin_btn_->setCheckable(true);
|
||||||
pin_btn_->setFixedSize(pin_btn_->sizeHint().height(), pin_btn_->sizeHint().height());
|
pin_btn_->setFixedSize(pin_btn_->sizeHint().height(), pin_btn_->sizeHint().height());
|
||||||
pin_btn_->setVisible(false);
|
pin_btn_->setVisible(false);
|
||||||
layout->addWidget(pin_btn_);
|
layout->addWidget(pin_btn_);
|
||||||
connect(pin_btn_, &QPushButton::clicked, this, &NodeParamViewItemTitleBar::PinToggled);
|
connect(pin_btn_, &QPushButton::clicked, this, &NodeParamViewItemTitleBar::PinToggled);
|
||||||
|
|
||||||
enabled_checkbox_ = new QCheckBox();
|
enabled_checkbox_ = new QCheckBox(this);
|
||||||
enabled_checkbox_->setVisible(false);
|
enabled_checkbox_->setVisible(false);
|
||||||
layout->addWidget(enabled_checkbox_);
|
layout->addWidget(enabled_checkbox_);
|
||||||
connect(enabled_checkbox_, &QCheckBox::clicked, this, &NodeParamViewItemTitleBar::EnabledCheckBoxClicked);
|
connect(enabled_checkbox_, &QCheckBox::clicked, this, &NodeParamViewItemTitleBar::EnabledCheckBoxClicked);
|
||||||
|
|||||||
@@ -33,7 +33,11 @@ class NodeParamViewKeyframeControl : public QWidget, public TimeTargetObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
NodeParamViewKeyframeControl(bool right_align = true, QWidget* parent = nullptr);
|
NodeParamViewKeyframeControl(bool right_align, QWidget* parent = nullptr);
|
||||||
|
NodeParamViewKeyframeControl(QWidget* parent = nullptr) :
|
||||||
|
NodeParamViewKeyframeControl(true, parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
const NodeInput& GetConnectedInput() const
|
const NodeInput& GetConnectedInput() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -71,9 +71,11 @@ int GetSliderCount(NodeValue::Type type)
|
|||||||
|
|
||||||
void NodeParamViewWidgetBridge::CreateWidgets()
|
void NodeParamViewWidgetBridge::CreateWidgets()
|
||||||
{
|
{
|
||||||
|
QWidget *parent = dynamic_cast<QWidget*>(this->parent());
|
||||||
|
|
||||||
if (GetInnerInput().IsArray() && GetInnerInput().element() == -1) {
|
if (GetInnerInput().IsArray() && GetInnerInput().element() == -1) {
|
||||||
|
|
||||||
NodeParamViewArrayWidget* w = new NodeParamViewArrayWidget(GetInnerInput().node(), GetInnerInput().input());
|
NodeParamViewArrayWidget* w = new NodeParamViewArrayWidget(GetInnerInput().node(), GetInnerInput().input(), parent);
|
||||||
connect(w, &NodeParamViewArrayWidget::DoubleClicked, this, &NodeParamViewWidgetBridge::ArrayWidgetDoubleClicked);
|
connect(w, &NodeParamViewArrayWidget::DoubleClicked, this, &NodeParamViewWidgetBridge::ArrayWidgetDoubleClicked);
|
||||||
widgets_.append(w);
|
widgets_.append(w);
|
||||||
|
|
||||||
@@ -94,12 +96,12 @@ void NodeParamViewWidgetBridge::CreateWidgets()
|
|||||||
break;
|
break;
|
||||||
case NodeValue::kInt:
|
case NodeValue::kInt:
|
||||||
{
|
{
|
||||||
CreateSliders<IntegerSlider>(1);
|
CreateSliders<IntegerSlider>(1, parent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NodeValue::kRational:
|
case NodeValue::kRational:
|
||||||
{
|
{
|
||||||
CreateSliders<RationalSlider>(1);
|
CreateSliders<RationalSlider>(1, parent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NodeValue::kFloat:
|
case NodeValue::kFloat:
|
||||||
@@ -107,12 +109,12 @@ void NodeParamViewWidgetBridge::CreateWidgets()
|
|||||||
case NodeValue::kVec3:
|
case NodeValue::kVec3:
|
||||||
case NodeValue::kVec4:
|
case NodeValue::kVec4:
|
||||||
{
|
{
|
||||||
CreateSliders<FloatSlider>(GetSliderCount(t));
|
CreateSliders<FloatSlider>(GetSliderCount(t), parent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NodeValue::kCombo:
|
case NodeValue::kCombo:
|
||||||
{
|
{
|
||||||
QComboBox* combobox = new QComboBox();
|
QComboBox* combobox = new QComboBox(parent);
|
||||||
|
|
||||||
QStringList items = GetInnerInput().GetComboBoxStrings();
|
QStringList items = GetInnerInput().GetComboBoxStrings();
|
||||||
foreach (const QString& s, items) {
|
foreach (const QString& s, items) {
|
||||||
@@ -125,21 +127,21 @@ void NodeParamViewWidgetBridge::CreateWidgets()
|
|||||||
}
|
}
|
||||||
case NodeValue::kFile:
|
case NodeValue::kFile:
|
||||||
{
|
{
|
||||||
FileField* file_field = new FileField();
|
FileField* file_field = new FileField(parent);
|
||||||
widgets_.append(file_field);
|
widgets_.append(file_field);
|
||||||
connect(file_field, &FileField::FilenameChanged, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
connect(file_field, &FileField::FilenameChanged, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NodeValue::kColor:
|
case NodeValue::kColor:
|
||||||
{
|
{
|
||||||
ColorButton* color_button = new ColorButton(GetInnerInput().node()->project()->color_manager());
|
ColorButton* color_button = new ColorButton(GetInnerInput().node()->project()->color_manager(), parent);
|
||||||
widgets_.append(color_button);
|
widgets_.append(color_button);
|
||||||
connect(color_button, &ColorButton::ColorChanged, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
connect(color_button, &ColorButton::ColorChanged, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NodeValue::kText:
|
case NodeValue::kText:
|
||||||
{
|
{
|
||||||
NodeParamViewTextEdit* line_edit = new NodeParamViewTextEdit();
|
NodeParamViewTextEdit* line_edit = new NodeParamViewTextEdit(parent);
|
||||||
widgets_.append(line_edit);
|
widgets_.append(line_edit);
|
||||||
connect(line_edit, &NodeParamViewTextEdit::textEdited, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
connect(line_edit, &NodeParamViewTextEdit::textEdited, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
||||||
connect(line_edit, &NodeParamViewTextEdit::RequestEditInViewer, this, &NodeParamViewWidgetBridge::RequestEditTextInViewer);
|
connect(line_edit, &NodeParamViewTextEdit::RequestEditInViewer, this, &NodeParamViewWidgetBridge::RequestEditTextInViewer);
|
||||||
@@ -147,21 +149,21 @@ void NodeParamViewWidgetBridge::CreateWidgets()
|
|||||||
}
|
}
|
||||||
case NodeValue::kBoolean:
|
case NodeValue::kBoolean:
|
||||||
{
|
{
|
||||||
QCheckBox* check_box = new QCheckBox();
|
QCheckBox* check_box = new QCheckBox(parent);
|
||||||
widgets_.append(check_box);
|
widgets_.append(check_box);
|
||||||
connect(check_box, &QCheckBox::clicked, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
connect(check_box, &QCheckBox::clicked, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NodeValue::kFont:
|
case NodeValue::kFont:
|
||||||
{
|
{
|
||||||
QFontComboBox* font_combobox = new QFontComboBox();
|
QFontComboBox* font_combobox = new QFontComboBox(parent);
|
||||||
widgets_.append(font_combobox);
|
widgets_.append(font_combobox);
|
||||||
connect(font_combobox, &QFontComboBox::currentFontChanged, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
connect(font_combobox, &QFontComboBox::currentFontChanged, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NodeValue::kBezier:
|
case NodeValue::kBezier:
|
||||||
{
|
{
|
||||||
BezierWidget *bezier = new BezierWidget();
|
BezierWidget *bezier = new BezierWidget(parent);
|
||||||
widgets_.append(bezier);
|
widgets_.append(bezier);
|
||||||
|
|
||||||
connect(bezier->x_slider(), &FloatSlider::ValueChanged, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
connect(bezier->x_slider(), &FloatSlider::ValueChanged, this, &NodeParamViewWidgetBridge::WidgetCallback);
|
||||||
@@ -384,10 +386,10 @@ void NodeParamViewWidgetBridge::WidgetCallback()
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void NodeParamViewWidgetBridge::CreateSliders(int count)
|
void NodeParamViewWidgetBridge::CreateSliders(int count, QWidget *parent)
|
||||||
{
|
{
|
||||||
for (int i=0;i<count;i++) {
|
for (int i=0;i<count;i++) {
|
||||||
T* fs = new T();
|
T* fs = new T(parent);
|
||||||
fs->SliderBase::SetDefaultValue(GetInnerInput().GetSplitDefaultValueForTrack(i));
|
fs->SliderBase::SetDefaultValue(GetInnerInput().GetSplitDefaultValueForTrack(i));
|
||||||
fs->SetLadderElementCount(2);
|
fs->SetLadderElementCount(2);
|
||||||
|
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ private:
|
|||||||
void SetProperty(const QString &key, const QVariant &value);
|
void SetProperty(const QString &key, const QVariant &value);
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
void CreateSliders(int count);
|
void CreateSliders(int count, QWidget *parent);
|
||||||
|
|
||||||
void UpdateWidgetValues();
|
void UpdateWidgetValues();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user