Showing the changes to interface/src/raypick/PointerScriptingInterface.cpp (1 of 31 files). Show all
Unified · Split
| @@ -9,10 +9,10 @@ · 8 unmodified lines | |||
| 9 | #include "PointerScriptingInterface.h" | 9 | #include "PointerScriptingInterface.h" |
| 10 | 10 | ||
| 11 | #include <QtCore/QVariant> | 11 | #include <QtCore/QVariant> |
| 12 | |||
| 13 | #include <GLMHelpers.h> | 12 | #include <GLMHelpers.h> |
| 14 | 13 | ||
| 15 | #include "Application.h" | 14 | #include "Application.h" |
| 15 | #include "LaserPointer.h" | ||
| 16 | 16 | ||
| 17 | void PointerScriptingInterface::setIgnoreItems(const QUuid& uid, const QScriptValue& ignoreItems) const { | 17 | void PointerScriptingInterface::setIgnoreItems(const QUuid& uid, const QScriptValue& ignoreItems) const { |
| 18 | DependencyManager::get<PointerManager>()->setIgnoreItems(uid, qVectorQUuidFromScriptValue(ignoreItems)); | 18 | DependencyManager::get<PointerManager>()->setIgnoreItems(uid, qVectorQUuidFromScriptValue(ignoreItems)); |
| @@ -48,6 +48,11 @@ QUuid PointerScriptingInterface::createLaserPointer(const QVariant& properties) · 29 unmodified lines | |||
| 48 | lockEnd = propertyMap["lockEnd"].toBool(); | 48 | lockEnd = propertyMap["lockEnd"].toBool(); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | bool distanceScaleEnd = false; | ||
| 52 | if (propertyMap["distanceScaleEnd"].isValid()) { | ||
| 53 | distanceScaleEnd = propertyMap["distanceScaleEnd"].toBool(); | ||
| 54 | } | ||
| 55 | |||
| 51 | bool enabled = false; | 56 | bool enabled = false; |
| 52 | if (propertyMap["enabled"].isValid()) { | 57 | if (propertyMap["enabled"].isValid()) { |
| 53 | enabled = propertyMap["enabled"].toBool(); | 58 | enabled = propertyMap["enabled"].toBool(); |
| @@ -61,7 +66,7 @@ QUuid PointerScriptingInterface::createLaserPointer(const QVariant& properties) · 7 unmodified lines | |||
| 61 | QVariantMap renderStateMap = renderStateVariant.toMap(); | 66 | QVariantMap renderStateMap = renderStateVariant.toMap(); |
| 62 | if (renderStateMap["name"].isValid()) { | 67 | if (renderStateMap["name"].isValid()) { |
| 63 | std::string name = renderStateMap["name"].toString().toStdString(); | 68 | std::string name = renderStateMap["name"].toString().toStdString(); |
| 64 | renderStates[name] = buildRenderState(renderStateMap); | 69 | renderStates[name] = LaserPointer::buildRenderState(renderStateMap); |
| 65 | } | 70 | } |
| 66 | } | 71 | } |
| 67 | } | 72 | } |
| @@ -76,13 +81,13 @@ QUuid PointerScriptingInterface::createLaserPointer(const QVariant& properties) · 8 unmodified lines | |||
| 76 | if (renderStateMap["name"].isValid() && renderStateMap["distance"].isValid()) { | 81 | if (renderStateMap["name"].isValid() && renderStateMap["distance"].isValid()) { |
| 77 | std::string name = renderStateMap["name"].toString().toStdString(); | 82 | std::string name = renderStateMap["name"].toString().toStdString(); |
| 78 | float distance = renderStateMap["distance"].toFloat(); | 83 | float distance = renderStateMap["distance"].toFloat(); |
| 79 | defaultRenderStates[name] = std::pair<float, RenderState>(distance, buildRenderState(renderStateMap)); | 84 | defaultRenderStates[name] = std::pair<float, RenderState>(distance, LaserPointer::buildRenderState(renderStateMap)); |
| 80 | } | 85 | } |
| 81 | } | 86 | } |
| 82 | } | 87 | } |
| 83 | } | 88 | } |
| 84 | 89 | ||
| 85 | return DependencyManager::get<PointerManager>()->addPointer(std::make_shared<LaserPointer>(properties, renderStates, defaultRenderStates, faceAvatar, centerEndY, lockEnd, enabled)); | 90 | return DependencyManager::get<PointerManager>()->addPointer(std::make_shared<LaserPointer>(properties, renderStates, defaultRenderStates, faceAvatar, centerEndY, lockEnd, distanceScaleEnd, enabled)); |
| 86 | } | 91 | } |
| 87 | 92 | ||
| 88 | void PointerScriptingInterface::editRenderState(const QUuid& uid, const QString& renderState, const QVariant& properties) const { | 93 | void PointerScriptingInterface::editRenderState(const QUuid& uid, const QString& renderState, const QVariant& properties) const { |
| @@ -104,36 +109,4 @@ void PointerScriptingInterface::editRenderState(const QUuid& uid, const QString& · 15 unmodified lines | |||
| 104 | } | 109 | } |
| 105 | 110 | ||
| 106 | DependencyManager::get<PointerManager>()->editRenderState(uid, renderState.toStdString(), startProps, pathProps, endProps); | 111 | DependencyManager::get<PointerManager>()->editRenderState(uid, renderState.toStdString(), startProps, pathProps, endProps); |
| 107 | } | ||
| 108 | |||
| 109 | RenderState PointerScriptingInterface::buildRenderState(const QVariantMap& propMap) { | ||
| 110 | QUuid startID; | ||
| 111 | if (propMap["start"].isValid()) { | ||
| 112 | QVariantMap startMap = propMap["start"].toMap(); | ||
| 113 | if (startMap["type"].isValid()) { | ||
| 114 | startMap.remove("visible"); | ||
| 115 | startID = qApp->getOverlays().addOverlay(startMap["type"].toString(), startMap); | ||
| 116 | } | ||
| 117 | } | ||
| 118 | |||
| 119 | QUuid pathID; | ||
| 120 | if (propMap["path"].isValid()) { | ||
| 121 | QVariantMap pathMap = propMap["path"].toMap(); | ||
| 122 | // right now paths must be line3ds | ||
| 123 | if (pathMap["type"].isValid() && pathMap["type"].toString() == "line3d") { | ||
| 124 | pathMap.remove("visible"); | ||
| 125 | pathID = qApp->getOverlays().addOverlay(pathMap["type"].toString(), pathMap); | ||
| 126 | } | ||
| 127 | } | ||
| 128 | |||
| 129 | QUuid endID; | ||
| 130 | if (propMap["end"].isValid()) { | ||
| 131 | QVariantMap endMap = propMap["end"].toMap(); | ||
| 132 | if (endMap["type"].isValid()) { | ||
| 133 | endMap.remove("visible"); | ||
| 134 | endID = qApp->getOverlays().addOverlay(endMap["type"].toString(), endMap); | ||
| 135 | } | ||
| 136 | } | ||
| 137 | |||
| 138 | return RenderState(startID, pathID, endID); | ||
| 139 | } | 112 | } |