mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-04 17:10:47 +00:00
Add Texture Viewer custom shaders directory setting
This commit is contained in:
@@ -302,6 +302,8 @@ DECLARE_REFLECTION_STRUCT(BugReport);
|
||||
\
|
||||
CONFIG_SETTING_VAL(public, bool, bool, TextureViewer_PerTexYFlip, false) \
|
||||
\
|
||||
CONFIG_SETTING_VAL(public, QString, rdcstr, TextureViewer_CustomShadersDirectory, "") \
|
||||
\
|
||||
CONFIG_SETTING_VAL(public, bool, bool, AlwaysReplayLocally, false) \
|
||||
\
|
||||
CONFIG_SETTING_VAL(public, int, int, LocalProxyAPI, -1) \
|
||||
@@ -523,6 +525,13 @@ For more information about some of these settings that are user-facing see
|
||||
|
||||
Defaults to ``False``.
|
||||
|
||||
.. data:: TextureViewer_CustomShadersDirectory
|
||||
|
||||
Path to the directory containing custom shader files for Texture Viewer. If left empty, config
|
||||
directory is used.
|
||||
|
||||
Defaults to ``""``
|
||||
|
||||
.. data:: AlwaysReplayLocally
|
||||
|
||||
``True`` if when loading a capture that was originally captured on a remote device but uses an
|
||||
|
||||
@@ -127,6 +127,7 @@ SettingsDialog::SettingsDialog(ICaptureContext &ctx, QWidget *parent)
|
||||
ui->TextureViewer_ResetRange->setChecked(m_Ctx.Config().TextureViewer_ResetRange);
|
||||
ui->TextureViewer_PerTexSettings->setChecked(m_Ctx.Config().TextureViewer_PerTexSettings);
|
||||
ui->TextureViewer_PerTexYFlip->setChecked(m_Ctx.Config().TextureViewer_PerTexYFlip);
|
||||
ui->TextureViewer_CustomShadersPath->setText(m_Ctx.Config().TextureViewer_CustomShadersDirectory);
|
||||
ui->CheckUpdate_AllowChecks->setChecked(m_Ctx.Config().CheckUpdate_AllowChecks);
|
||||
ui->Font_PreferMonospaced->setChecked(m_Ctx.Config().Font_PreferMonospaced);
|
||||
|
||||
@@ -564,6 +565,28 @@ void SettingsDialog::on_TextureViewer_PerTexYFlip_toggled(bool checked)
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
void SettingsDialog::on_browseCustomShadersPath_clicked()
|
||||
{
|
||||
QString dir = RDDialog::getExistingDirectory(this, tr("Choose directory for custom shaders"),
|
||||
m_Ctx.Config().TextureViewer_CustomShadersDirectory);
|
||||
|
||||
if(!dir.isEmpty())
|
||||
{
|
||||
m_Ctx.Config().TextureViewer_CustomShadersDirectory = dir;
|
||||
ui->TextureViewer_CustomShadersPath->setText(dir);
|
||||
}
|
||||
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
void SettingsDialog::on_resetCustomShadersPath_clicked()
|
||||
{
|
||||
m_Ctx.Config().TextureViewer_CustomShadersDirectory = "";
|
||||
ui->TextureViewer_CustomShadersPath->setText(QString());
|
||||
|
||||
m_Ctx.Config().Save();
|
||||
}
|
||||
|
||||
void SettingsDialog::on_TextureViewer_ResetRange_toggled(bool checked)
|
||||
{
|
||||
m_Ctx.Config().TextureViewer_ResetRange = ui->TextureViewer_ResetRange->isChecked();
|
||||
|
||||
@@ -81,6 +81,8 @@ private slots:
|
||||
void on_TextureViewer_PerTexSettings_toggled(bool checked);
|
||||
void on_TextureViewer_ResetRange_toggled(bool checked);
|
||||
void on_TextureViewer_PerTexYFlip_toggled(bool checked);
|
||||
void on_browseCustomShadersPath_clicked();
|
||||
void on_resetCustomShadersPath_clicked();
|
||||
|
||||
// shader viewer
|
||||
void on_ShaderViewer_FriendlyNaming_toggled(bool checked);
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>561</width>
|
||||
<height>519</height>
|
||||
<width>564</width>
|
||||
<height>530</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -410,7 +410,7 @@ e.g. 1000 * 10 = 1e4</string>
|
||||
<string>A global scale for all fonts in the program. This will only scale text, icons and other UI elements will be scaled according to DPI settings as normal.</string>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -649,6 +649,16 @@ After interop is enabled you will need to reload any capture.</string>
|
||||
<string>Texture Viewer</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_3">
|
||||
<item row="4" column="1">
|
||||
<widget class="QPushButton" name="browseCustomShadersPath">
|
||||
<property name="toolTip">
|
||||
<string>Browse for the directory with custom shaders for Texture Viewer</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="sizePolicy">
|
||||
@@ -665,22 +675,6 @@ After interop is enabled you will need to reload any capture.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="TextureViewer_ResetRange">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Reset visible range when changing event or texture</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_13">
|
||||
<property name="sizePolicy">
|
||||
@@ -697,6 +691,29 @@ After interop is enabled you will need to reload any capture.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_29">
|
||||
<property name="toolTip">
|
||||
<string>Path to the directory with custom shaders for Texture Viewer</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Custom shaders directory</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>378</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="TextureViewer_PerTexSettings">
|
||||
<property name="minimumSize">
|
||||
@@ -713,6 +730,22 @@ After interop is enabled you will need to reload any capture.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QCheckBox" name="TextureViewer_ResetRange">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Reset visible range when changing event or texture</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_26">
|
||||
<property name="sizePolicy">
|
||||
@@ -745,18 +778,22 @@ After interop is enabled you will need to reload any capture.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLineEdit" name="TextureViewer_CustomShadersPath">
|
||||
<property name="toolTip">
|
||||
<string>Path to the directory with custom shaders for Texture Viewer</string>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>378</height>
|
||||
</size>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2">
|
||||
<widget class="QPushButton" name="resetCustomShadersPath">
|
||||
<property name="toolTip">
|
||||
<string>Reset custom shaders directory to default config path</string>
|
||||
</property>
|
||||
</spacer>
|
||||
<property name="text">
|
||||
<string>Reset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
||||
@@ -4020,8 +4020,7 @@ void TextureViewer::reloadCustomShaders(const QString &filter)
|
||||
filters.push_back(lit("*.") + it.key());
|
||||
}
|
||||
|
||||
QStringList files =
|
||||
QDir(configFilePath(QString()))
|
||||
QStringList files = getCustomShadersDir()
|
||||
.entryList(filters, QDir::Files | QDir::NoDotAndDotDot, QDir::Name | QDir::IgnoreCase);
|
||||
|
||||
QStringList watchedFiles = m_Watcher->files();
|
||||
@@ -4038,11 +4037,12 @@ void TextureViewer::reloadCustomShaders(const QString &filter)
|
||||
if(!filter.isEmpty() && filter.toUpper() != key)
|
||||
continue;
|
||||
|
||||
m_Watcher->addPath(configFilePath(f));
|
||||
QString filePath = QDir::cleanPath(getCustomShadersDir().absoluteFilePath(f));
|
||||
m_Watcher->addPath(filePath);
|
||||
|
||||
if(!m_CustomShaders.contains(key) && !m_CustomShadersBusy.contains(key))
|
||||
{
|
||||
QFile fileHandle(configFilePath(f));
|
||||
QFile fileHandle(filePath);
|
||||
if(fileHandle.open(QFile::ReadOnly | QFile::Text))
|
||||
{
|
||||
QTextStream stream(&fileHandle);
|
||||
@@ -4134,6 +4134,13 @@ void TextureViewer::reloadCustomShaders(const QString &filter)
|
||||
}
|
||||
}
|
||||
|
||||
QDir TextureViewer::getCustomShadersDir() const
|
||||
{
|
||||
return m_Ctx.Config().TextureViewer_CustomShadersDirectory.empty()
|
||||
? QDir(configFilePath(QString()))
|
||||
: QDir(m_Ctx.Config().TextureViewer_CustomShadersDirectory);
|
||||
}
|
||||
|
||||
void TextureViewer::on_customCreate_clicked()
|
||||
{
|
||||
QString filename = ui->customShader->currentText();
|
||||
@@ -4177,7 +4184,7 @@ void TextureViewer::on_customCreate_clicked()
|
||||
return;
|
||||
}
|
||||
|
||||
QString path = configFilePath(filename);
|
||||
QString path = QDir::cleanPath(getCustomShadersDir().absoluteFilePath(filename));
|
||||
|
||||
QString src;
|
||||
|
||||
@@ -4240,7 +4247,7 @@ void TextureViewer::on_customEdit_clicked()
|
||||
return;
|
||||
}
|
||||
|
||||
QString path = configFilePath(filename);
|
||||
QString path = QDir::cleanPath(getCustomShadersDir().absoluteFilePath(filename));
|
||||
|
||||
QString src;
|
||||
|
||||
@@ -4332,7 +4339,7 @@ void TextureViewer::on_customDelete_clicked()
|
||||
|
||||
if(res == QMessageBox::Yes)
|
||||
{
|
||||
QString path = configFilePath(shaderName);
|
||||
QString path = QDir::cleanPath(getCustomShadersDir().absoluteFilePath(shaderName));
|
||||
if(!QFileInfo::exists(path))
|
||||
{
|
||||
RDDialog::critical(
|
||||
|
||||
@@ -350,6 +350,7 @@ private:
|
||||
|
||||
bool canCompileCustomShader(ShaderEncoding encoding);
|
||||
void reloadCustomShaders(const QString &filter);
|
||||
QDir getCustomShadersDir() const;
|
||||
|
||||
TextureDisplay m_TexDisplay;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user