nodeparam: implemented parameters that allow arbitrary properties to be set

for UI representations

Allows properties to be set without adding explicit extra members to NodeInputs.
Crucially this means parameters like slider value representations (percent,
decibel, etc.) can be set from NodeInputs now.
This commit is contained in:
itsmattkc
2020-03-07 01:21:36 +11:00
parent d12a0dca23
commit c168bf1a80
8 changed files with 118 additions and 133 deletions
+4 -2
View File
@@ -31,7 +31,9 @@ TransformDistort::TransformDistort()
rotation_input_ = new NodeInput("rot_in", NodeParam::kFloat);
AddInput(rotation_input_);
scale_input_ = new NodeInput("scale_in", NodeParam::kVec2, QVector2D(100.0f, 100.0f));
scale_input_ = new NodeInput("scale_in", NodeParam::kVec2, QVector2D(1.0f, 1.0f));
scale_input_->set_property("min", QVector2D(0, 0));
scale_input_->set_property("view", "percent");
AddInput(scale_input_);
uniform_scale_input_ = new NodeInput("uniform_scale_in", NodeParam::kBoolean, true);
@@ -89,7 +91,7 @@ NodeValueTable TransformDistort::Value(const NodeValueDatabase &value) const
mat.rotate(value[rotation_input_].Get(NodeParam::kFloat).toFloat(), 0, 0, 1);
// Scale and Uniform Scale
QVector2D scale = value[scale_input_].Get(NodeParam::kVec2).value<QVector2D>()*0.01f;
QVector2D scale = value[scale_input_].Get(NodeParam::kVec2).value<QVector2D>();
if (value[uniform_scale_input_].Get(NodeParam::kBoolean).toBool()) {
scale.setY(scale.x());
}