Skip to content

Commit

Permalink
Release version 1.3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
gortnarj committed Mar 26, 2018
2 parents b9f170d + 1ff4f86 commit e085d42
Show file tree
Hide file tree
Showing 25 changed files with 3,282 additions and 2,944 deletions.
2 changes: 1 addition & 1 deletion README.md
@@ -1,4 +1,4 @@
# VMT Editor ![version](https://img.shields.io/badge/version-1.3.9-blue.svg)
# VMT Editor ![version](https://img.shields.io/badge/version-1.3.10-blue.svg)

[Official website](https://gira-x.github.io/VMT-Editor/)

Expand Down
6 changes: 4 additions & 2 deletions VMT_Editor.pro
Expand Up @@ -79,7 +79,8 @@ SOURCES += \
src/vmttextedit.cpp \
src/texturedragdroplineedit.cpp \
src/texturepreviewdialog.cpp \
src/user-interface/layerblend.cpp
src/user-interface/layerblend.cpp \
src/user-interface/emissive-blend.cpp

HEADERS += \
src/mainwindow.h \
Expand Down Expand Up @@ -129,7 +130,8 @@ HEADERS += \
src/vmttextedit.h \
src/texturedragdroplineedit.h \
src/texturepreviewdialog.h \
src/user-interface/layerblend.h
src/user-interface/layerblend.h \
src/user-interface/emissive-blend.h

FORMS += \
ui/mainwindow.ui \
Expand Down
10 changes: 5 additions & 5 deletions app.rc
Expand Up @@ -5,18 +5,18 @@ IDI_ICON3 ICON DISCARDABLE "vtffile.ico"
#include <windows.h>

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,3,9
PRODUCTVERSION 1,3,9
FILEVERSION 1,3,10
PRODUCTVERSION 1,3,10
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "FileDescription", "VMT Editor"
VALUE "FileVersion", "1.3.9"
VALUE "ProductVersion", "1.3.9"
VALUE "FileVersion", "1.3.10"
VALUE "ProductVersion", "1.3.10"
VALUE "ProductName", "VMT Editor"
VALUE "LegalCopyright", "Copyright � 2016-2017"
VALUE "LegalCopyright", "Copyright � 2016-2018"
END
END

Expand Down
Binary file modified images/qss/down_arrow_disabled.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/qss/up_arrow_disabled.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/reconvert_dialog.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion misc/version.txt
@@ -1 +1 @@
1.3.9
1.3.10
1 change: 1 addition & 0 deletions resources.qrc
Expand Up @@ -95,6 +95,7 @@
<file alias="clear">images/clear.png</file>
<file alias="layerblend">images/layerblend.png</file>
<file alias="reconvert_half">images/reconvert_half.png</file>
<file alias="reconvert_dialog">images/reconvert_dialog.png</file>
</qresource>
<qresource prefix="/files">
<file alias="subGroups">misc/completions.txt</file>
Expand Down
373 changes: 279 additions & 94 deletions src/mainwindow.cpp

Large diffs are not rendered by default.

20 changes: 15 additions & 5 deletions src/mainwindow.h
Expand Up @@ -12,6 +12,8 @@
#include <QLineEdit>
#include <QVBoxLayout>
#include <QDesktopServices>
#include <QProcess>


#ifdef Q_OS_WIN
# include <QWinJumpList>
Expand Down Expand Up @@ -74,7 +76,8 @@ class MainWindow : public QMainWindow
UnlitTwoTexture,
NormalBlend,
TreeSway,
LayerBlend
LayerBlend,
EmissiveBlend
};

MainWindow( QString fileToOpen = "", QWidget* parent = NULL );
Expand Down Expand Up @@ -258,9 +261,9 @@ class MainWindow : public QMainWindow

//----------------------------------------------------------------------------------------//

void changeColor( QPlainTextEdit* colorField );
void changeColor( QToolButton* colorField );

void changeColor( QPlainTextEdit* colorField, TintSlider* slider );
void changeColor( QToolButton *colorField, TintSlider* slider );

bool previewTexture( const int type, const QString& texture );

Expand Down Expand Up @@ -405,6 +408,8 @@ public slots:

void paste();

void createReconvertAction(QLineEdit* lineEdit, QString fileName);

private slots:

void previewTexture();
Expand All @@ -415,6 +420,8 @@ private slots:

void displayOptionsDialog();

void displayConversionDialogTexture(QString file);

void displayConversionDialog();

void displayBatchDialog();
Expand All @@ -433,6 +440,8 @@ private slots:

void addCSGOParameter(QString value, VmtFile& vmt, QString string, QDoubleSpinBox* doubleSpinBox);

void openReconvertDialogAction();

void reconvertTexture();

void reconvertTextureHalf();
Expand All @@ -453,14 +462,14 @@ private slots:

void vmtPreviewChanged();

void createReconvertAction(QLineEdit* lineEdit, QString fileName);

void reconvertAll();

void createBlendToolTexture();

bool combineMaps(QLineEdit *lineEditBase, QLineEdit *lineEditAlpha);

void refreshInGame();

//----------------------------------------------------------------------------------------//

void action_New();
Expand Down Expand Up @@ -514,6 +523,7 @@ private slots:
void on_action_treeSway_triggered(bool checked);
void on_action_decal_triggered(bool checked);
void on_action_layerBlend_triggered(bool checked);
void on_action_emissiveBlend_triggered(bool checked);
};

//----------------------------------------------------------------------------//
Expand Down
2 changes: 1 addition & 1 deletion src/tintslider.cpp
Expand Up @@ -27,7 +27,7 @@ void TintSlider::valueChangedSlot(int value) {
.arg( hsl.blue() ));
}

void TintSlider::initialize(QPlainTextEdit* colorWidget, const QColor& color) {
void TintSlider::initialize(QToolButton *colorWidget, const QColor& color) {

this->colorWidget = colorWidget;
this->color = color;
Expand Down
5 changes: 3 additions & 2 deletions src/tintslider.h
Expand Up @@ -3,6 +3,7 @@

#include <QSlider>
#include <QPlainTextEdit>
#include <QToolButton>


class TintSlider : public QSlider {
Expand All @@ -15,11 +16,11 @@ class TintSlider : public QSlider {

void wheelEvent(QWheelEvent* event);

void initialize( QPlainTextEdit* colorWidget, const QColor& color = QColor(255, 255, 255) );
void initialize(QToolButton *colorWidget, const QColor& color = QColor(255, 255, 255) );

private:

QPlainTextEdit* colorWidget;
QToolButton* colorWidget;

QColor color;

Expand Down
148 changes: 148 additions & 0 deletions src/user-interface/emissive-blend.cpp
@@ -0,0 +1,148 @@
#include "emissive-blend.h"

#include "user-interface/constants.h"
#include "errors.h"
#include "logging/logging.h"
#include "utilities/strings.h"

bool emissiveblend::hasChanged(Ui::MainWindow *ui)
{
// simplifying default checks
#define START return (
#define VAL(w, s) stripZeroes(w->cleanText()) != s ||
#define CHE(w) w->isChecked() ||
#define COL(w) utils::getBG(w) != white ||
#define TEX(w) w->text() != "" ||
#define END false);

START
TEX(ui->lineEdit_emissiveBlendTexture)
TEX(ui->lineEdit_emissiveBlendBaseTexture)
TEX(ui->lineEdit_emissiveBlendFlowTexture)
VAL(ui->doubleSpinBox_emissiveBlendScrollX, "0.0")
VAL(ui->doubleSpinBox_emissiveBlendScrollY, "0.0")
VAL(ui->doubleSpinBox_emissiveBlendStrength, "1.0")
COL(ui->toolButton_emissiveBlendTint)
END
}

void emissiveblend::resetAction(Ui::MainWindow *ui)
{
ui->groupBox_emissiveBlend->setVisible(false);
ui->action_emissiveBlend->setChecked(false);
}

void emissiveblend::resetWidgets(Ui::MainWindow *ui)
{
ui->lineEdit_emissiveBlendTexture->clear();
ui->lineEdit_emissiveBlendBaseTexture->clear();
ui->lineEdit_emissiveBlendFlowTexture->clear();
ui->toolButton_emissiveBlendTint->setStyleSheet(whiteBG);
ui->doubleSpinBox_emissiveBlendTint->setValue(1.0);
ui->doubleSpinBox_emissiveBlendScrollX->setValue(0.0);
ui->doubleSpinBox_emissiveBlendScrollY->setValue(0.0);
}

void initializeEmissiveBlend(Ui::MainWindow *ui, VmtFile *vmt)
{
utils::BooleanResult raw = utils::takeBoolean("$emissiveblendenabled", vmt, ui);
if (!raw.present)
return;

vmt->state.showEmissiveBlend = true;

switch (vmt->shader)
{
case Shader::S_VertexLitGeneric:
ui->groupBox_emissiveBlend->setEnabled(true);
ui->groupBox_emissiveBlend->setChecked(true);
vmt->state.emissiveBlendEnabled = true;
break;
default:
ERROR("Emissive blend only works with the VertexLitGeneric shader");
}
}

void processScrollVector(const QString &parameter, const QString &value,
Ui::MainWindow *ui)
{
const utils::DoubleTuple tuple = utils::toDoubleTuple(value, 2);

if (tuple.valid) {
double xd = tuple.values.at(0);
double yd = tuple.values.at(1);
ui->doubleSpinBox_emissiveBlendScrollX->setValue(xd);
ui->doubleSpinBox_emissiveBlendScrollY->setValue(yd);
} else {
logging::error(parameter + " has invalid value: " + value,
ui);
}
}

void emissiveblend::parseParameters(Ui::MainWindow *ui, VmtFile *vmt, MainWindow *mainwindow)
{
// golfing away the checks to quickly parse parameters
// note that the DO... macros all require an additional end bracket as
// PREP opens an if
#define PREP(p) \
if (vmt->parameters.contains(p)) { \
if (!vmt->state.emissiveBlendEnabled) \
ERROR(p " only works with $emissiveblendenabled 1") \
vmt->state.showEmissiveBlend = true;
#define DO(p, m) { \
PREP(p) \
m(p, vmt->parameters.take(p), ui); \
} \
}
#define DO_CHOICE(p, m, b) { \
PREP(p) \
m(p, vmt->parameters.take(p), ui, b); \
} \
}
#define DO_WITH_VMT(p, m) { \
PREP(p) \
m(p, vmt->parameters.take(p), ui, *vmt); \
} \
}
#define DOUBLE(p, def, widget) { \
PREP(p) \
const QString &v = vmt->parameters.take(p); \
utils::DoubleResult r = \
utils::parseDouble(p, v, def, ui); \
if (r.notDefault) widget->setValue(r.value); \
} \
}
#define BOOL(p, widget) { \
PREP(p) \
const QString &v = vmt->parameters.take(p); \
utils::BooleanResult r = \
utils::parseBoolean(p, v, ui); \
if (r.value) widget->setChecked(true); \
} \
}
#define COLOR(p, color, slider) { \
PREP(p) \
const QString &v = vmt->parameters.take(p); \
utils::applyColor(p, v, color, slider, ui); \
} \
}
#define TEXTURE(p, widget) { \
PREP(p) \
const QString &v = vmt->parameters.take(p); \
utils::parseTexture(p, v, ui, widget, *vmt); \
mainwindow->createReconvertAction(widget, v); \
} \
}

initializeEmissiveBlend(ui, vmt);

DO("$emissiveblendscrollvector", processScrollVector)
TEXTURE("$emissiveblendtexture", ui->lineEdit_emissiveBlendTexture)
TEXTURE("$emissiveblendbasetexture", ui->lineEdit_emissiveBlendBaseTexture)
TEXTURE("$emissiveblendflowtexture", ui->lineEdit_emissiveBlendFlowTexture)
COLOR("$emissiveblendtint", ui->toolButton_emissiveBlendTint, ui->doubleSpinBox_emissiveBlendTint)
DOUBLE("$emissiveblendstrength", "1", ui->doubleSpinBox_emissiveBlendStrength)
DOUBLE("$bumpdetailscale2", "1", ui->doubleSpinBox_bumpdetailscale2)


}
52 changes: 52 additions & 0 deletions src/user-interface/emissive-blend.h
@@ -0,0 +1,52 @@
#ifndef EMISSIVEBLEND_H
#define EMISSIVEBLEND_H

#include "ui_mainwindow.h"

#include "view-helper.h"
#include "vmt/vmt-helper.h"

/*!
* Functions for interacting with the Normal blend named groupbox.
*/
namespace emissiveblend {

/*!
* Detects if the views are not in their default state and returns true if
* any field differs from the default.
*
* Call from MainWindow::isGroupChanged().
*/
bool hasChanged(Ui::MainWindow *ui);

/*!
* Hides the groupbox and unchecks the action.
*
* Call from MainWindow::shaderChanged() for hiding group boxes whose
* content did not change after a shader change.
*/
void resetAction(Ui::MainWindow *ui);

/*!
* Resets the widgets to their default state.
*
* Call from MainWindow::resetWidgets().
*/
void resetWidgets(Ui::MainWindow *ui);

/*!
* Processes the passed parameter from the VmtFile and initializes the
* user interface with it.
*
* Checks vmt->state.normalBlendEnabled.
*
* The user interface is set up and errors are returned should any
* parameters have an invalid format.
*
* We only process the parameter if it exists.
*/
void parseParameters(Ui::MainWindow *ui, VmtFile *vmt, MainWindow *mainwindow);

} // namespace normalblend

#endif

0 comments on commit e085d42

Please sign in to comment.