Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add color editor(srgb) #1425

Merged
merged 16 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ui/zenoedit/dialog/zeditparamlayoutdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ static CONTROL_ITEM_INFO controlList[] = {
{"Integer Vector 2", CONTROL_VEC2_INT, "vec2i", ":/icons/parameter_control_integerVector2.svg"},
{"Color", CONTROL_COLOR, "color", ":/icons/parameter_control_color.svg"},
{"Pure Color", CONTROL_PURE_COLOR, "color", ":/icons/parameter_control_color.svg"},
{"Color Vec3f", CONTROL_COLOR_VEC3F, "color", ":/icons/parameter_control_color.svg"},
{"Curve", CONTROL_CURVE, "curve", ":/icons/parameter_control_curve.svg"},
{"SpinBox", CONTROL_HSPINBOX, "int", ":/icons/parameter_control_spinbox.svg"},
{"DoubleSpinBox", CONTROL_HDOUBLESPINBOX, "float", ":/icons/parameter_control_spinbox.svg"},
Expand Down
1 change: 1 addition & 0 deletions ui/zenoedit/nodesys/zenonode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -921,6 +921,7 @@ ZGraphicsLayout* ZenoNode::addParam(const QModelIndex& viewparamIdx, ZenoSubGrap
case CONTROL_WRITEPATH:
case CONTROL_MULTILINE_STRING:
case CONTROL_PURE_COLOR:
case CONTROL_COLOR_VEC3F:
case CONTROL_CURVE:
case CONTROL_HSLIDER:
case CONTROL_HSPINBOX:
Expand Down
12 changes: 11 additions & 1 deletion ui/zenoedit/panel/zenoproppanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,18 @@ void ZenoPropPanel::onViewParamDataChanged(const QModelIndex& topLeft, const QMo
}
else if (QPushButton *pBtn = qobject_cast<QPushButton *>(ctrl.pControl))
{
if (value.canConvert<QColor>())
// purecolor
if (value.canConvert<QColor>()) {
pBtn->setStyleSheet(QString("background-color:%1; border:0;").arg(value.value<QColor>().name()));
}
// colorvec3f
else if (value.canConvert<UI_VECTYPE>()) {
UI_VECTYPE vec = value.value<UI_VECTYPE>();
if (vec.size() == 3) {
auto color = QColor::fromRgbF(vec[0], vec[1], vec[2]);
pBtn->setStyleSheet(QString("background-color:%1; border:0;").arg(color.name()));
}
}
}
//...
}
Expand Down
19 changes: 14 additions & 5 deletions ui/zenoedit/res/stylesheet/qwidget.qss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ QDialog
background: rgb(45,50,57);
}

QDialog QPushButton
QDialog .QPushButton
{
background: #596270;
color:#C3D2DF;
Expand All @@ -17,19 +17,19 @@ QDialog QPushButton
font-weight: 600;
}

QDialog QPushButton:hover
QDialog .QPushButton:hover
{
background: #6A93BC;
color:#CFDBE5;
}

QDialog QPushButton:default
QDialog .QPushButton:default
{
background: #4578AC;
color:#C3D2DF;
}

QDialog QPushButton:disabled
QDialog .QPushButton:disabled
{
background: #8A919A;
color:#9BAAB4;
Expand Down Expand Up @@ -68,6 +68,11 @@ QDialog QLineEdit:disabled {
color: #8f9ba8;
}

QDialog QGroupBox {
font-size: 8pt;
font-weight: 500;
color: #A3B1C0;
}

QDialog QCheckBox{
font-size: 9pt;
Expand Down Expand Up @@ -98,6 +103,10 @@ QDialog QSpinBox::down-button
border: none;
}

QDialog QSpinBox:disabled {
background-color: #2F2F2F;
}

QDialog QTableWidget
{
background-color: #191D21;
Expand Down Expand Up @@ -208,4 +217,4 @@ QWidget[cssClass = "welcomepage_link"]
border-radius: 8px;
border:1px solid #24282E;
padding-left: 20px;
}
}
35 changes: 34 additions & 1 deletion ui/zenoedit/res/stylesheet/spinbox.qss
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ QSpinBox[cssClass = "control"]::up-button:hover
{
image: url(:/icons/rightArrow-on.svg);
}

QDoubleSpinBox
{
background: #191D21;
Expand Down Expand Up @@ -117,4 +117,37 @@ QDoubleSpinBox::up-button
QDoubleSpinBox::up-button:hover
{
image: url(:/icons/rightArrow-on.svg);
}

/* ^^^ the upper style is too large... */
QDoubleSpinBox#MixedSpinBox
{
height: 20px;
font-size: 9pt;
font-weight: 400;
border: 0;
color: #FFFFFF;
background-color: #191D21;
}

QDoubleSpinBox#MixedSpinBox:focus
{
border: 2px solid #4B9EF4;
}

QDoubleSpinBox#MixedSpinBox:disabled
{
background-color: #2F2F2F;
}

QDoubleSpinBox#MixedSpinBox::up-button
{
height: 0px;
width: 0px;
}

QDoubleSpinBox#MixedSpinBox::down-button
{
height: 0px;
width: 0px;
}
1 change: 1 addition & 0 deletions ui/zenomodel/include/modeldata.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ enum PARAM_CONTROL {
CONTROL_MULTILINE_STRING,
CONTROL_COLOR,
CONTROL_PURE_COLOR,
CONTROL_COLOR_VEC3F,
CONTROL_CURVE,
CONTROL_HSLIDER,
CONTROL_HSPINBOX,
Expand Down
5 changes: 5 additions & 0 deletions ui/zenomodel/src/jsonhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ namespace JsonHelper
int dim = -1;
bool bFloat = false;
UiHelper::parseVecType(type, dim, bFloat);
// ^^^ use regexp, but not include colorvec3f
// vvv so specify here
if (type == "colorvec3f") {
bFloat = true;
}

for (int i = 0; i < vec.size(); i++) {
if (!bFloat)
Expand Down
17 changes: 15 additions & 2 deletions ui/zenomodel/src/uihelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ bool UiHelper::validateVariant(const QVariant& var, const QString& type)
{
return (varType == QMetaType::User);
}
case CONTROL_COLOR_VEC3F:
case CONTROL_VEC2_FLOAT:
case CONTROL_VEC2_INT:
case CONTROL_VEC3_FLOAT:
Expand Down Expand Up @@ -252,6 +253,7 @@ QVariant UiHelper::parseStringByType(const QString &defaultValue, const QString
case CONTROL_COLOR:
case CONTROL_ENUM:
return defaultValue;
case CONTROL_COLOR_VEC3F:
case CONTROL_VEC2_FLOAT:
case CONTROL_VEC2_INT:
case CONTROL_VEC3_FLOAT:
Expand Down Expand Up @@ -387,7 +389,8 @@ QString UiHelper::getControlDesc(PARAM_CONTROL ctrl)
case CONTROL_VEC3_INT: return "Integer Vector 3";
case CONTROL_VEC2_INT: return "Integer Vector 2";
case CONTROL_COLOR: return "Color";
case CONTROL_PURE_COLOR: return "Pure Color";
case CONTROL_PURE_COLOR: return "Pure Color";
case CONTROL_COLOR_VEC3F: return "Color Vec3f";
case CONTROL_CURVE: return "Curve";
case CONTROL_HSPINBOX: return "SpinBox";
case CONTROL_HDOUBLESPINBOX: return "DoubleSpinBox";
Expand Down Expand Up @@ -466,6 +469,10 @@ PARAM_CONTROL UiHelper::getControlByDesc(const QString& descName)
{
return CONTROL_PURE_COLOR;
}
else if (descName == "Color Vec3f")
{
return CONTROL_COLOR_VEC3F;
}
else if (descName == "Curve")
{
return CONTROL_CURVE;
Expand Down Expand Up @@ -554,7 +561,7 @@ QStringList UiHelper::getControlLists(const QString& type, bool isNodeUI)
else if (type == "readpath") { ctrls = { CONTROL_READPATH }; }
else if (type == "multiline_string") { ctrls = { CONTROL_STRING, CONTROL_MULTILINE_STRING }; }
else if (type == "color") { //color is more general than heatmap.
ctrls = {CONTROL_COLOR, CONTROL_PURE_COLOR};
ctrls = {CONTROL_COLOR, CONTROL_PURE_COLOR, CONTROL_COLOR_VEC3F};
}
else if (type == "curve") { ctrls = { CONTROL_CURVE }; }
else if (type.startsWith("enum ")) {
Expand Down Expand Up @@ -609,6 +616,10 @@ PARAM_CONTROL UiHelper::getControlByType(const QString &type)
return CONTROL_MULTILINE_STRING;
} else if (type == "color") { //color is more general than heatmap.
return CONTROL_COLOR;
} else if (type == "purecolor") {
return CONTROL_PURE_COLOR;
} else if (type == "colorvec3f") { //colorvec3f is for coloreditor, color is heatmap? ^^^^
return CONTROL_COLOR_VEC3F;
} else if (type == "curve") {
return CONTROL_CURVE;
} else if (type.startsWith("enum ")) {
Expand Down Expand Up @@ -655,6 +666,8 @@ QString UiHelper::getTypeByControl(PARAM_CONTROL ctrl)
case CONTROL_WRITEPATH: return "string";
case CONTROL_READPATH: return "string";
case CONTROL_COLOR: return "color"; //todo: is vec3?
case CONTROL_PURE_COLOR: return "purecolor";
case CONTROL_COLOR_VEC3F: return "colorvec3f"; // ^^^ color vec is here
case CONTROL_CURVE: return "curve";
case CONTROL_ENUM: return "string";
case CONTROL_HSLIDER:
Expand Down
Loading
Loading