mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-08 14:42:09 +02:00
fix AnyEndpoint support from JS
This commit is contained in:
parent
7e3192d0f6
commit
d5a90e273e
1 changed files with 17 additions and 2 deletions
|
@ -217,10 +217,10 @@ public:
|
|||
}
|
||||
|
||||
virtual float value() override {
|
||||
float result = 0;
|
||||
float result = 0.0f;
|
||||
for (auto& child : _children) {
|
||||
float childResult = child->value();
|
||||
if (childResult != 0.0f) {
|
||||
if (childResult != 0.0f && result == 0.0f) {
|
||||
result = childResult;
|
||||
}
|
||||
}
|
||||
|
@ -856,6 +856,21 @@ Endpoint::Pointer UserInputMapper::endpointFor(const QScriptValue& endpoint) {
|
|||
return result;
|
||||
}
|
||||
|
||||
if (endpoint.isArray()) {
|
||||
int length = endpoint.property("length").toInteger();
|
||||
Endpoint::List children;
|
||||
for (int i = 0; i < length; i++) {
|
||||
QScriptValue arrayItem = endpoint.property(i);
|
||||
Endpoint::Pointer destination = endpointFor(arrayItem);
|
||||
if (!destination) {
|
||||
return Endpoint::Pointer();
|
||||
}
|
||||
children.push_back(destination);
|
||||
}
|
||||
return std::make_shared<AnyEndpoint>(children);
|
||||
}
|
||||
|
||||
|
||||
qWarning() << "Unsupported input type " << endpoint.toString();
|
||||
return Endpoint::Pointer();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue