mirror of
https://github.com/overte-org/overte.git
synced 2025-07-26 03:15:12 +02:00
Fixed default render states for laser pointers
This commit is contained in:
parent
4062d80445
commit
b0e030ada2
1 changed files with 36 additions and 31 deletions
|
@ -569,42 +569,47 @@ bool rayPointerPropertiesFromScriptValue(const ScriptValue& value, RayPointerPro
|
||||||
// This copies properties from script value, but also converts entity properties of entities used in render states
|
// This copies properties from script value, but also converts entity properties of entities used in render states
|
||||||
// from JS objects into EntityItemProperties
|
// from JS objects into EntityItemProperties
|
||||||
out.properties = value.engine()->fromScriptValue<QVariantMap>(value);
|
out.properties = value.engine()->fromScriptValue<QVariantMap>(value);
|
||||||
if (out.properties["renderStates"].canConvert<QVariantList>()) {
|
QList<QString> renderStatesNames;
|
||||||
QVariantList renderStates = out.properties["renderStates"].value<QVariantList>();
|
renderStatesNames.append("renderStates");
|
||||||
for( int i = 0; i < renderStates.length(); i++) {
|
renderStatesNames.append("defaultRenderStates");
|
||||||
if (renderStates[i].canConvert<QVariantMap>()) {
|
for (auto renderStatesName = renderStatesNames.cbegin(); renderStatesName!=renderStatesNames.cend(); renderStatesName++) {
|
||||||
QVariantMap stateMap = renderStates[i].value<QVariantMap>();
|
if (out.properties[*renderStatesName].canConvert<QVariantList>()) {
|
||||||
if (stateMap["name"].canConvert<QString>()) {
|
QVariantList renderStates = out.properties[*renderStatesName].value<QVariantList>();
|
||||||
stateMap["name"].value<QString>();
|
for (int i = 0; i < renderStates.length(); i++) {
|
||||||
}
|
if (renderStates[i].canConvert<QVariantMap>()) {
|
||||||
if (stateMap["start"].isValid()) {
|
QVariantMap stateMap = renderStates[i].value<QVariantMap>();
|
||||||
ScriptValue start = value.property("renderStates").property(i).property("start");
|
if (stateMap["name"].canConvert<QString>()) {
|
||||||
EntityItemProperties startProperties;
|
stateMap["name"].value<QString>();
|
||||||
startProperties.copyFromScriptValue(start, false);
|
}
|
||||||
stateMap.insert("startPropertyIndex", QVariant(out.entityProperties.length()));
|
if (stateMap["start"].isValid()) {
|
||||||
out.entityProperties.append(startProperties);
|
ScriptValue start = value.property(*renderStatesName).property(i).property("start");
|
||||||
}
|
EntityItemProperties startProperties;
|
||||||
|
startProperties.copyFromScriptValue(start, false);
|
||||||
|
stateMap.insert("startPropertyIndex", QVariant(out.entityProperties.length()));
|
||||||
|
out.entityProperties.append(startProperties);
|
||||||
|
}
|
||||||
|
|
||||||
if (stateMap["path"].isValid()) {
|
if (stateMap["path"].isValid()) {
|
||||||
ScriptValue path = value.property("renderStates").property(i).property("path");
|
ScriptValue path = value.property(*renderStatesName).property(i).property("path");
|
||||||
EntityItemProperties pathProperties;
|
EntityItemProperties pathProperties;
|
||||||
pathProperties.copyFromScriptValue(path, false);
|
pathProperties.copyFromScriptValue(path, false);
|
||||||
stateMap.insert("pathPropertyIndex", QVariant(out.entityProperties.length()));
|
stateMap.insert("pathPropertyIndex", QVariant(out.entityProperties.length()));
|
||||||
out.entityProperties.append(pathProperties);
|
out.entityProperties.append(pathProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stateMap["end"].isValid()) {
|
if (stateMap["end"].isValid()) {
|
||||||
ScriptValue end = value.property("renderStates").property(i).property("end");
|
ScriptValue end = value.property(*renderStatesName).property(i).property("end");
|
||||||
EntityItemProperties endProperties;
|
EntityItemProperties endProperties;
|
||||||
endProperties.copyFromScriptValue(end, false);
|
endProperties.copyFromScriptValue(end, false);
|
||||||
stateMap.insert("endPropertyIndex", QVariant(out.entityProperties.length()));
|
stateMap.insert("endPropertyIndex", QVariant(out.entityProperties.length()));
|
||||||
out.entityProperties.append(endProperties);
|
out.entityProperties.append(endProperties);
|
||||||
|
}
|
||||||
|
// V8TODO: Check if path is a polyline and if values are valid
|
||||||
|
renderStates[i].setValue(stateMap);
|
||||||
}
|
}
|
||||||
// V8TODO: Check if path is a polyline and if values are valid
|
|
||||||
renderStates[i].setValue(stateMap);
|
|
||||||
}
|
}
|
||||||
|
out.properties[*renderStatesName].setValue(renderStates);
|
||||||
}
|
}
|
||||||
out.properties["renderStates"].setValue(renderStates);
|
|
||||||
}
|
}
|
||||||
qDebug() << "rayPointerPropertiesFromScriptValue" << out.properties;
|
qDebug() << "rayPointerPropertiesFromScriptValue" << out.properties;
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue