forked from qt-creator/qt-creator
QmlDesigner: Fix important issues to Effect Maker
A first shot of fixes Change-Id: I7c175edb601fc5880805cd6496e7c8c8a10df33d Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -28,7 +28,7 @@ Item {
|
|||||||
valueLoader.source = "ValueBool.qml"
|
valueLoader.source = "ValueBool.qml"
|
||||||
else if (uniformType === "color")
|
else if (uniformType === "color")
|
||||||
valueLoader.source = "ValueColor.qml"
|
valueLoader.source = "ValueColor.qml"
|
||||||
else if (uniformType === "image")
|
else if (uniformType === "sampler2D")
|
||||||
valueLoader.source = "ValueImage.qml"
|
valueLoader.source = "ValueImage.qml"
|
||||||
else if (uniformType === "define")
|
else if (uniformType === "define")
|
||||||
valueLoader.source = "ValueDefine.qml"
|
valueLoader.source = "ValueDefine.qml"
|
||||||
|
|||||||
@@ -774,7 +774,7 @@ void EffectMakerModel::updateCustomUniforms()
|
|||||||
for (Uniform *uniform : uniforms) {
|
for (Uniform *uniform : uniforms) {
|
||||||
// TODO: Check if uniform is already added.
|
// TODO: Check if uniform is already added.
|
||||||
const bool isDefine = uniform->type() == Uniform::Type::Define;
|
const bool isDefine = uniform->type() == Uniform::Type::Define;
|
||||||
QString type = Uniform::typeToProperty(uniform->type());
|
QString propertyType = Uniform::typeToProperty(uniform->type());
|
||||||
QString value = valueAsString(*uniform);
|
QString value = valueAsString(*uniform);
|
||||||
QString bindedValue = valueAsBinding(*uniform);
|
QString bindedValue = valueAsBinding(*uniform);
|
||||||
// When user has set custom uniform value, use it as-is
|
// When user has set custom uniform value, use it as-is
|
||||||
@@ -799,7 +799,7 @@ void EffectMakerModel::updateCustomUniforms()
|
|||||||
QString boundValueString = bindedValue.isEmpty() ? QString() : QString(": %1").arg(bindedValue);
|
QString boundValueString = bindedValue.isEmpty() ? QString() : QString(": %1").arg(bindedValue);
|
||||||
// Custom values are not readonly, others inside the effect can be
|
// Custom values are not readonly, others inside the effect can be
|
||||||
QString readOnly = uniform->useCustomValue() ? QString() : QStringLiteral("readonly ");
|
QString readOnly = uniform->useCustomValue() ? QString() : QStringLiteral("readonly ");
|
||||||
previewEffectPropertiesString += " " + readOnly + "property " + type + " "
|
previewEffectPropertiesString += " " + readOnly + "property " + propertyType + " "
|
||||||
+ propertyName + boundValueString + '\n';
|
+ propertyName + boundValueString + '\n';
|
||||||
// Define type properties are not added into exports
|
// Define type properties are not added into exports
|
||||||
if (!isDefine) {
|
if (!isDefine) {
|
||||||
@@ -811,11 +811,11 @@ void EffectMakerModel::updateCustomUniforms()
|
|||||||
exportedEffectPropertiesString += QStringLiteral(" // ") + line + '\n';
|
exportedEffectPropertiesString += QStringLiteral(" // ") + line + '\n';
|
||||||
}
|
}
|
||||||
exportedEffectPropertiesString += QStringLiteral(" ") + readOnly
|
exportedEffectPropertiesString += QStringLiteral(" ") + readOnly
|
||||||
+ "property " + type + " " + propertyName
|
+ "property " + propertyType + " " + propertyName
|
||||||
+ boundValueString + '\n';
|
+ boundValueString + '\n';
|
||||||
} else {
|
} else {
|
||||||
// Custom values are not added into root
|
// Custom values are not added into root
|
||||||
exportedRootPropertiesString += " property " + type + " " + propertyName
|
exportedRootPropertiesString += " property " + propertyType + " " + propertyName
|
||||||
+ valueString + '\n';
|
+ valueString + '\n';
|
||||||
exportedEffectPropertiesString += QStringLiteral(" ")
|
exportedEffectPropertiesString += QStringLiteral(" ")
|
||||||
+ readOnly + "property alias " + propertyName
|
+ readOnly + "property alias " + propertyName
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright (C) 2023 The Qt Company Ltd.
|
// Copyright (C) 2023 The Qt Company Ltd.
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
#include "uniform.h"
|
#include "uniform.h"
|
||||||
@@ -270,8 +270,10 @@ QString Uniform::stringFromType(Uniform::Type type)
|
|||||||
return "vec2";
|
return "vec2";
|
||||||
else if (type == Type::Vec3)
|
else if (type == Type::Vec3)
|
||||||
return "vec3";
|
return "vec3";
|
||||||
else if (type == Type::Vec4 || type == Type::Color)
|
else if (type == Type::Vec4)
|
||||||
return "vec4";
|
return "vec4";
|
||||||
|
else if (type == Type::Color)
|
||||||
|
return "color";
|
||||||
else if (type == Type::Sampler)
|
else if (type == Type::Sampler)
|
||||||
return "sampler2D";
|
return "sampler2D";
|
||||||
else if (type == Type::Define)
|
else if (type == Type::Define)
|
||||||
|
|||||||
Reference in New Issue
Block a user