History

working on renderstates

SamGondelman committed 9 years ago

Commit 3c719b21 parent 3a35cd16 files · +97 −17Browse files

Showing the changes to interface/src/raypick/LaserPointerScriptingInterface.cpp (1 of 6 files). Show all

Unified · Split

interface/src/raypick/LaserPointerScriptingInterface.cpp+41−3
@@ -15,6 +15,8 @@ · 14 unmodified lines
1515 #include "RegisteredMetaTypes.h"
1616 #include "GLMHelpers.h"
1717
18+#include "Application.h"
19+
1820 LaserPointerScriptingInterface* LaserPointerScriptingInterface::getInstance() {
1921 static LaserPointerScriptingInterface instance;
2022 return &instance;
@@ -52,10 +54,46 @@ uint32_t LaserPointerScriptingInterface::createLaserPointer(const QVariant& prop · 31 unmodified lines
5254 enabled = propertyMap["enabled"].toBool();
5355 }
5456
55− // TODO:
56− // handle render state properties
57+ QHash<QString, RenderState> renderStates;
58+ if (propertyMap["renderStates"].isValid()) {
59+ QList<QVariant> renderStateVariants = propertyMap["renderStates"].toList();
60+ for (QVariant& renderStateVariant : renderStateVariants) {
61+ if (renderStateVariant.isValid()) {
62+ QVariantMap renderStateMap = renderStateVariant.toMap();
63+ if (renderStateMap["name"].isValid()) {
64+ QString name = renderStateMap["name"].toString();
65+
66+ QUuid startID;
67+ if (renderStateMap["start"].isValid()) {
68+ QVariantMap startMap = renderStateMap["start"].toMap();
69+ if (startMap["type"].isValid()) {
70+ startID = qApp->getOverlays().addOverlay(startMap["type"].toString(), startMap);
71+ }
72+ }
73+
74+ QUuid pathID;
75+ if (renderStateMap["path"].isValid()) {
76+ QVariantMap pathMap = renderStateMap["path"].toMap();
77+ if (pathMap["type"].isValid()) {
78+ pathID = qApp->getOverlays().addOverlay(pathMap["type"].toString(), pathMap);
79+ }
80+ }
81+
82+ QUuid endID;
83+ if (renderStateMap["end"].isValid()) {
84+ QVariantMap endMap = renderStateMap["end"].toMap();
85+ if (endMap["type"].isValid()) {
86+ endID = qApp->getOverlays().addOverlay(endMap["type"].toString(), endMap);
87+ }
88+ }
89+
90+ renderStates[name] = RenderState(startID, pathID, endID);
91+ }
92+ }
93+ }
94+ }
5795
58− return LaserPointerManager::getInstance().createLaserPointer(jointName, posOffset, dirOffset, filter, maxDistance, enabled);
96+ return LaserPointerManager::getInstance().createLaserPointer(jointName, posOffset, dirOffset, filter, maxDistance, renderStates, enabled);
5997 } else {
6098 return 0;
6199 }