From 4c71a33b7b4a6604eb411cc95867dc643cc265e6 Mon Sep 17 00:00:00 2001 From: itsmattkc <34096995+itsmattkc@users.noreply.github.com> Date: Sun, 17 Jul 2022 14:48:00 -0700 Subject: [PATCH] node: implement array start offset --- app/node/generator/text/textv3.cpp | 1 + app/widget/nodeparamview/nodeparamviewitem.cpp | 2 +- app/widget/nodeview/nodeviewitem.cpp | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/node/generator/text/textv3.cpp b/app/node/generator/text/textv3.cpp index ce70704ab..baadfb101 100644 --- a/app/node/generator/text/textv3.cpp +++ b/app/node/generator/text/textv3.cpp @@ -56,6 +56,7 @@ TextGeneratorV3::TextGeneratorV3() : AddInput(kUseArgsInput, NodeValue::kBoolean, true, InputFlags(kInputFlagHidden | kInputFlagStatic)); AddInput(kArgsInput, NodeValue::kText, InputFlags(kInputFlagArray)); + SetInputProperty(kArgsInput, QStringLiteral("arraystart"), 1); text_gizmo_ = new TextGizmo(this); text_gizmo_->SetInput(NodeInput(this, kTextInput)); diff --git a/app/widget/nodeparamview/nodeparamviewitem.cpp b/app/widget/nodeparamview/nodeparamviewitem.cpp index 603072e1a..7b0e82fd3 100644 --- a/app/widget/nodeparamview/nodeparamviewitem.cpp +++ b/app/widget/nodeparamview/nodeparamviewitem.cpp @@ -304,7 +304,7 @@ void NodeParamViewItemBody::Retranslate() if (ic.IsArray() && ic.element() >= 0) { // Make the label the array index - i.value().main_label->setText(tr("%1:").arg(ic.element())); + i.value().main_label->setText(tr("%1:").arg(ic.element() + ic.GetProperty(QStringLiteral("arraystart")).toInt())); } else { // Set to the input's name i.value().main_label->setText(tr("%1:").arg(ic.name())); diff --git a/app/widget/nodeview/nodeviewitem.cpp b/app/widget/nodeview/nodeviewitem.cpp index 9a04ee961..3879df6bd 100644 --- a/app/widget/nodeview/nodeviewitem.cpp +++ b/app/widget/nodeview/nodeviewitem.cpp @@ -373,7 +373,7 @@ void NodeViewItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *opti if (element_ == -1) { node_name = node_->GetInputName(input_); } else { - node_name = QString::number(element_); + node_name = QString::number(element_ + node_->GetInputProperty(input_, QStringLiteral("arraystart")).toInt()); } }