Add byte range offset/length controls to raw buffer viewer. Refs #224

This commit is contained in:
baldurk
2017-05-10 17:20:37 +01:00
parent c3e521f254
commit 6941444796
3 changed files with 94 additions and 14 deletions
+44
View File
@@ -1007,6 +1007,13 @@ void BufferViewer::SetupMeshView()
{
setWindowTitle(tr("Mesh Output"));
// hide buttons we don't want in the toolbar
ui->byteRangeLine->setVisible(false);
ui->byteRangeStartLabel->setVisible(false);
ui->byteRangeStart->setVisible(false);
ui->byteRangeLengthLabel->setVisible(false);
ui->byteRangeLength->setVisible(false);
ui->formatSpecifier->setVisible(false);
ui->cameraControlsGroup->setVisible(false);
@@ -2317,7 +2324,10 @@ void BufferViewer::ViewBuffer(uint64_t byteOffset, uint64_t byteSize, ResourceId
BufferDescription *buf = m_Ctx.GetBuffer(id);
if(buf)
{
setWindowTitle(ToQStr(buf->name) + lit(" - Contents"));
m_ObjectByteSize = buf->length;
}
processFormat(format);
}
@@ -2334,7 +2344,10 @@ void BufferViewer::ViewTexture(uint32_t arrayIdx, uint32_t mip, ResourceId id, c
TextureDescription *tex = m_Ctx.GetTexture(id);
if(tex)
{
setWindowTitle(ToQStr(tex->name) + lit(" - Contents"));
m_ObjectByteSize = tex->byteSize;
}
processFormat(format);
}
@@ -2650,13 +2663,44 @@ void BufferViewer::processFormat(const QString &format)
ClearModels();
m_Format = format;
m_ModelVSIn->columns = FormatElement::ParseFormatString(format, 0, true, errors);
uint32_t stride = 0;
for(const FormatElement &el : m_ModelVSIn->columns)
stride += el.byteSize();
stride = qMax(1U, stride);
ui->byteRangeStart->setSingleStep((int)stride);
ui->byteRangeLength->setSingleStep((int)stride);
ui->byteRangeStart->setMaximum((int)m_ObjectByteSize);
ui->byteRangeLength->setMaximum((int)m_ObjectByteSize);
ui->byteRangeStart->setValue((int)m_ByteOffset);
ui->byteRangeLength->setValue((int)m_ByteSize);
ui->formatSpecifier->setErrors(errors);
OnEventChanged(m_Ctx.CurEvent());
}
void BufferViewer::on_byteRangeStart_valueChanged(int value)
{
m_ByteOffset = value;
processFormat(m_Format);
}
void BufferViewer::on_byteRangeLength_valueChanged(int value)
{
m_ByteSize = value;
processFormat(m_Format);
}
void BufferViewer::exportData(const BufferExport &params)
{
if(!m_Ctx.LogLoaded())
+7 -3
View File
@@ -95,8 +95,10 @@ private slots:
void on_drawRange_currentIndexChanged(int index);
void on_controlType_currentIndexChanged(int index);
void on_camSpeed_valueChanged(double value);
void on_instance_valueChanged(int arg1);
void on_rowOffset_valueChanged(int arg1);
void on_instance_valueChanged(int value);
void on_rowOffset_valueChanged(int value);
void on_byteRangeStart_valueChanged(int value);
void on_byteRangeLength_valueChanged(int value);
// manual slots
void render_mouseMove(QMouseEvent *e);
@@ -174,9 +176,11 @@ private:
// data from raw buffer view
bool m_IsBuffer = true;
QString m_Format;
uint32_t m_TexArrayIdx = 0;
uint32_t m_TexMip = 0;
uint64_t m_ByteOffset = 0;
uint64_t m_ObjectByteSize = UINT64_MAX;
uint64_t m_ByteSize = UINT64_MAX;
ResourceId m_BufferID;
@@ -240,4 +244,4 @@ private:
void SyncViews(RDTableView *primary, bool selection, bool scroll);
void UpdateHighlightVerts();
void ScrollToRow(BufferItemModel *model, int row);
};
};
+43 -11
View File
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>761</width>
<width>788</width>
<height>537</height>
</rect>
</property>
@@ -577,9 +577,9 @@
<widget class="QFrame" name="meshToolbar">
<property name="geometry">
<rect>
<x>50</x>
<x>0</x>
<y>10</y>
<width>435</width>
<width>767</width>
<height>28</height>
</rect>
</property>
@@ -702,9 +702,6 @@
</item>
<item>
<widget class="QSpinBox" name="rowOffset">
<property name="prefix">
<string/>
</property>
<property name="maximum">
<number>1000000</number>
</property>
@@ -724,6 +721,41 @@
</property>
</widget>
</item>
<item>
<widget class="Line" name="byteRangeLine">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="byteRangeStartLabel">
<property name="text">
<string>Byte Range Start</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="byteRangeStart">
<property name="maximum">
<number>999123456</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="byteRangeLengthLabel">
<property name="text">
<string>Length</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="byteRangeLength">
<property name="maximum">
<number>999123456</number>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
@@ -782,6 +814,11 @@
</widget>
</widget>
<customwidgets>
<customwidget>
<class>ToolWindowManager</class>
<extends>QWidget</extends>
<header>3rdparty/toolwindowmanager/ToolWindowManager.h</header>
</customwidget>
<customwidget>
<class>CustomPaintWidget</class>
<extends>QWidget</extends>
@@ -792,11 +829,6 @@
<extends>QTableView</extends>
<header>Widgets/Extended/RDTableView.h</header>
</customwidget>
<customwidget>
<class>ToolWindowManager</class>
<extends>QWidget</extends>
<header>3rdparty/toolwindowmanager/ToolWindowManager.h</header>
</customwidget>
<customwidget>
<class>BufferFormatSpecifier</class>
<extends>QWidget</extends>