Showing the changes to interface/src/raypick/LaserPointerScriptingInterface.cpp (1 of 7 files). Show all
Unified · Split
| @@ -40,6 +40,11 @@ uint32_t LaserPointerScriptingInterface::createLaserPointer(const QVariant& prop · 39 unmodified lines | |||
| 40 | centerEndY = propertyMap["centerEndY"].toBool(); | 40 | centerEndY = propertyMap["centerEndY"].toBool(); |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | bool lockEnd = false; | ||
| 44 | if (propertyMap["lockEnd"].isValid()) { | ||
| 45 | lockEnd = propertyMap["lockEnd"].toBool(); | ||
| 46 | } | ||
| 47 | |||
| 43 | bool enabled = false; | 48 | bool enabled = false; |
| 44 | if (propertyMap["enabled"].isValid()) { | 49 | if (propertyMap["enabled"].isValid()) { |
| 45 | enabled = propertyMap["enabled"].toBool(); | 50 | enabled = propertyMap["enabled"].toBool(); |
| @@ -53,33 +58,7 @@ uint32_t LaserPointerScriptingInterface::createLaserPointer(const QVariant& prop · 7 unmodified lines | |||
| 53 | QVariantMap renderStateMap = renderStateVariant.toMap(); | 58 | QVariantMap renderStateMap = renderStateVariant.toMap(); |
| 54 | if (renderStateMap["name"].isValid()) { | 59 | if (renderStateMap["name"].isValid()) { |
| 55 | QString name = renderStateMap["name"].toString(); | 60 | QString name = renderStateMap["name"].toString(); |
| 56 | 61 | renderStates[name] = buildRenderState(renderStateMap); | |
| 57 | QUuid startID; | ||
| 58 | if (renderStateMap["start"].isValid()) { | ||
| 59 | QVariantMap startMap = renderStateMap["start"].toMap(); | ||
| 60 | if (startMap["type"].isValid()) { | ||
| 61 | startID = qApp->getOverlays().addOverlay(startMap["type"].toString(), startMap); | ||
| 62 | } | ||
| 63 | } | ||
| 64 | |||
| 65 | QUuid pathID; | ||
| 66 | if (renderStateMap["path"].isValid()) { | ||
| 67 | QVariantMap pathMap = renderStateMap["path"].toMap(); | ||
| 68 | // right now paths must be line3ds | ||
| 69 | if (pathMap["type"].isValid() && pathMap["type"].toString() == "line3d") { | ||
| 70 | pathID = qApp->getOverlays().addOverlay(pathMap["type"].toString(), pathMap); | ||
| 71 | } | ||
| 72 | } | ||
| 73 | |||
| 74 | QUuid endID; | ||
| 75 | if (renderStateMap["end"].isValid()) { | ||
| 76 | QVariantMap endMap = renderStateMap["end"].toMap(); | ||
| 77 | if (endMap["type"].isValid()) { | ||
| 78 | endID = qApp->getOverlays().addOverlay(endMap["type"].toString(), endMap); | ||
| 79 | } | ||
| 80 | } | ||
| 81 | |||
| 82 | renderStates[name] = RenderState(startID, pathID, endID); | ||
| 83 | } | 62 | } |
| 84 | } | 63 | } |
| 85 | } | 64 | } |
| @@ -100,9 +79,9 @@ uint32_t LaserPointerScriptingInterface::createLaserPointer(const QVariant& prop · 14 unmodified lines | |||
| 100 | dirOffset = vec3FromVariant(propertyMap["dirOffset"]); | 79 | dirOffset = vec3FromVariant(propertyMap["dirOffset"]); |
| 101 | } | 80 | } |
| 102 | 81 | ||
| 103 | return DependencyManager::get<LaserPointerManager>()->createLaserPointer(jointName, posOffset, dirOffset, filter, maxDistance, renderStates, faceAvatar, centerEndY, enabled); | 82 | return DependencyManager::get<LaserPointerManager>()->createLaserPointer(jointName, posOffset, dirOffset, filter, maxDistance, renderStates, faceAvatar, centerEndY, lockEnd, enabled); |
| 104 | } else { | 83 | } else { |
| 105 | return DependencyManager::get<LaserPointerManager>()->createLaserPointer(filter, maxDistance, renderStates, faceAvatar, centerEndY, enabled); | 84 | return DependencyManager::get<LaserPointerManager>()->createLaserPointer(filter, maxDistance, renderStates, faceAvatar, centerEndY, lockEnd, enabled); |
| 106 | } | 85 | } |
| 107 | } else if (propertyMap["position"].isValid()) { | 86 | } else if (propertyMap["position"].isValid()) { |
| 108 | glm::vec3 position = vec3FromVariant(propertyMap["position"]); | 87 | glm::vec3 position = vec3FromVariant(propertyMap["position"]); |
| @@ -112,8 +91,58 @@ uint32_t LaserPointerScriptingInterface::createLaserPointer(const QVariant& prop · 3 unmodified lines | |||
| 112 | direction = vec3FromVariant(propertyMap["direction"]); | 91 | direction = vec3FromVariant(propertyMap["direction"]); |
| 113 | } | 92 | } |
| 114 | 93 | ||
| 115 | return DependencyManager::get<LaserPointerManager>()->createLaserPointer(position, direction, filter, maxDistance, renderStates, faceAvatar, centerEndY, enabled); | 94 | return DependencyManager::get<LaserPointerManager>()->createLaserPointer(position, direction, filter, maxDistance, renderStates, faceAvatar, centerEndY, lockEnd, enabled); |
| 116 | } | 95 | } |
| 117 | 96 | ||
| 118 | return 0; | 97 | return 0; |
| 98 | } | ||
| 99 | |||
| 100 | void LaserPointerScriptingInterface::editRenderState(unsigned int uid, const QString& renderState, const QVariant& properties) { | ||
| 101 | QVariantMap propMap = properties.toMap(); | ||
| 102 | |||
| 103 | QVariant startProps; | ||
| 104 | if (propMap["start"].isValid()) { | ||
| 105 | startProps = propMap["start"]; | ||
| 106 | } | ||
| 107 | |||
| 108 | QVariant pathProps; | ||
| 109 | if (propMap["path"].isValid()) { | ||
| 110 | pathProps = propMap["path"]; | ||
| 111 | } | ||
| 112 | |||
| 113 | QVariant endProps; | ||
| 114 | if (propMap["end"].isValid()) { | ||
| 115 | endProps = propMap["end"]; | ||
| 116 | } | ||
| 117 | |||
| 118 | DependencyManager::get<LaserPointerManager>()->editRenderState(uid, renderState, startProps, pathProps, endProps); | ||
| 119 | } | ||
| 120 | |||
| 121 | const RenderState LaserPointerScriptingInterface::buildRenderState(const QVariantMap& propMap) { | ||
| 122 | QUuid startID; | ||
| 123 | if (propMap["start"].isValid()) { | ||
| 124 | QVariantMap startMap = propMap["start"].toMap(); | ||
| 125 | if (startMap["type"].isValid()) { | ||
| 126 | startID = qApp->getOverlays().addOverlay(startMap["type"].toString(), startMap); | ||
| 127 | } | ||
| 128 | } | ||
| 129 | |||
| 130 | QUuid pathID; | ||
| 131 | if (propMap["path"].isValid()) { | ||
| 132 | QVariantMap pathMap = propMap["path"].toMap(); | ||
| 133 | // right now paths must be line3ds | ||
| 134 | if (pathMap["type"].isValid() && pathMap["type"].toString() == "line3d") { | ||
| 135 | pathID = qApp->getOverlays().addOverlay(pathMap["type"].toString(), pathMap); | ||
| 136 | } | ||
| 137 | } | ||
| 138 | |||
| 139 | QUuid endID; | ||
| 140 | if (propMap["end"].isValid()) { | ||
| 141 | QVariantMap endMap = propMap["end"].toMap(); | ||
| 142 | if (endMap["type"].isValid()) { | ||
| 143 | endID = qApp->getOverlays().addOverlay(endMap["type"].toString(), endMap); | ||
| 144 | } | ||
| 145 | } | ||
| 146 | |||
| 147 | return RenderState(startID, pathID, endID); | ||
| 119 | } | 148 | } |