nodetable: show values in separate columns

Works for vector coordinates (e.g. XY, XYZ, etc.) as well as displays
checkboxes for RGB/A. Still non-functional.
This commit is contained in:
itsmattkc
2020-06-18 15:07:47 +10:00
parent 897b9ca3dd
commit a717742cbc
+32 -26
View File
@@ -20,6 +20,7 @@
#include "nodetableview.h" #include "nodetableview.h"
#include <QCheckBox>
#include <QHeaderView> #include <QHeaderView>
#include "node/param.h" #include "node/param.h"
@@ -31,7 +32,12 @@ NodeTableView::NodeTableView(QWidget* parent) :
QTreeWidget(parent) QTreeWidget(parent)
{ {
setColumnCount(3); setColumnCount(3);
setHeaderLabels({tr("Type"), tr("Value"), tr("Source")}); setHeaderLabels({tr("Type"),
tr("Source"),
tr("R/X"),
tr("G/Y"),
tr("B/Z"),
tr("A/W")});
} }
void NodeTableView::SetNode(Node *n, const rational &time) void NodeTableView::SetNode(Node *n, const rational &time)
@@ -60,41 +66,41 @@ void NodeTableView::SetNode(Node *n, const rational &time)
for (int j=table.Count()-1; j>=0; j--) { for (int j=table.Count()-1; j>=0; j--) {
const NodeValue& value = table.at(j); const NodeValue& value = table.at(j);
QString value_str = NodeInput::ValueToString(value.type(), value.data()); // Create item
QTreeWidgetItem* sub_item = new QTreeWidgetItem();
top_item->addChild(sub_item);
// Set data type name
sub_item->setText(0, NodeParam::GetPrettyDataTypeName(value.type()));
// Determine source
QString source_name; QString source_name;
if (value.source()) { if (value.source()) {
source_name = value.source()->Name(); source_name = value.source()->Name();
} else { } else {
source_name = tr("(unknown)"); source_name = tr("(unknown)");
} }
sub_item->setText(1, source_name);
QTreeWidgetItem* sub_item = new QTreeWidgetItem(); switch (value.type()) {
sub_item->setText(0, NodeParam::GetPrettyDataTypeName(value.type())); case NodeParam::kTexture:
sub_item->setText(1, value_str); {
sub_item->setText(2, source_name); // NodeTableTraverser puts video params in here
top_item->addChild(sub_item); VideoParams p = value.data().value<VideoParams>();
int channel_count = PixelFormat::ChannelCount(p.format());
// Special cases for (int k=0;k<channel_count;k++) {
if (value.type() == NodeParam::kTexture) { this->setItemWidget(sub_item, 2 + k, new QCheckBox());
// NodeTableTraverser converts footage to VideoParams
QTreeWidgetItem* red_channel = new QTreeWidgetItem();
red_channel->setText(0, tr("Red"));
sub_item->addChild(red_channel);
QTreeWidgetItem* green_channel = new QTreeWidgetItem();
green_channel->setText(0, tr("Green"));
sub_item->addChild(green_channel);
QTreeWidgetItem* blue_channel = new QTreeWidgetItem();
blue_channel->setText(0, tr("Blue"));
sub_item->addChild(blue_channel);
if (PixelFormat::FormatHasAlphaChannel(value.data().value<VideoParams>().format())) {
QTreeWidgetItem* alpha_channel = new QTreeWidgetItem();
alpha_channel->setText(0, tr("Alpha"));
sub_item->addChild(alpha_channel);
} }
break;
}
default:
{
QVector<QVariant> split_values = input->split_normal_value_into_track_values(value.data());
for (int k=0;k<split_values.size();k++) {
sub_item->setText(2 + k, NodeInput::ValueToString(value.type(), split_values.at(k)));
}
}
} }
} }
} }