History

wiggly lasers

HifiExperiments committed 2 years ago

Commit 30646471 parent bc45c1715 files · +205 −144Browse files

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

Unified · Split

interface/src/raypick/PointerScriptingInterface.cpp+39−46
@@ -25,7 +25,6 @@ · 24 unmodified lines
25#include <ScriptManager.h>25#include <ScriptManager.h>
26 26
27STATIC_SCRIPT_TYPES_INITIALIZER((+[](ScriptManager* manager){27STATIC_SCRIPT_TYPES_INITIALIZER((+[](ScriptManager* manager){
28 qDebug() << "STATIC_SCRIPT_TYPES_INITIALIZER PointerScriptingInterface";
29 auto scriptEngine = manager->engine().get();28 auto scriptEngine = manager->engine().get();
30 scriptRegisterMetaType<RayPointerProperties, rayPointerPropertiesToScriptValue, rayPointerPropertiesFromScriptValue>(scriptEngine);29 scriptRegisterMetaType<RayPointerProperties, rayPointerPropertiesToScriptValue, rayPointerPropertiesFromScriptValue>(scriptEngine);
31 scriptRegisterMetaType<StylusPointerProperties, stylusPointerPropertiesToScriptValue, stylusPointerPropertiesFromScriptValue>(scriptEngine);30 scriptRegisterMetaType<StylusPointerProperties, stylusPointerPropertiesToScriptValue, stylusPointerPropertiesFromScriptValue>(scriptEngine);
@@ -92,7 +91,6 @@ unsigned int PointerScriptingInterface::createParabolaPointer(ParabolaPointerPro · 60 unmodified lines
92 return createPointerInternal(PickQuery::PickType::Parabola, properties);91 return createPointerInternal(PickQuery::PickType::Parabola, properties);
93}92}
94 93
95
96bool PointerScriptingInterface::isPointerEnabled(unsigned int uid) const {94bool PointerScriptingInterface::isPointerEnabled(unsigned int uid) const {
97 return DependencyManager::get<PointerManager>()->isPointerEnabled(uid);95 return DependencyManager::get<PointerManager>()->isPointerEnabled(uid);
98}96}
@@ -178,45 +176,45 @@ std::shared_ptr<Pointer> PointerScriptingInterface::buildStylus(const PointerPro · 79 unmodified lines
178 * Properties that define the visual appearance of a ray pointer when the pointer is intersecting something.176 * Properties that define the visual appearance of a ray pointer when the pointer is intersecting something.
179 * @typedef {object} Pointers.RayPointerRenderState177 * @typedef {object} Pointers.RayPointerRenderState
180 * @property {string} name - When creating using {@link Pointers.createPointer}, the name of the render state.178 * @property {string} name - When creating using {@link Pointers.createPointer}, the name of the render state.
181 * @property {Overlays.OverlayProperties|Uuid} [start]179 * @property {Entities.EntityProperties|Uuid} [start]
182 * <p>When creating or editing using {@link Pointers.createPointer} or {@link Pointers.editRenderState}, the properties of 180 * <p>When creating or editing using {@link Pointers.createPointer} or {@link Pointers.editRenderState}, the properties of
183 * an overlay to render at the start of the ray pointer. The <code>type</code> property must be specified.</p>181 * an entity to render at the start of the ray pointer. The <code>type</code> property must be specified.</p>
184 * <p>When getting using {@link Pointers.getPointerProperties}, the ID of the overlay rendered at the start of the ray;182 * <p>When getting using {@link Pointers.getPointerProperties}, the ID of the entity rendered at the start of the ray;
185 * <code>null</code> if there is no overlay.183 * <code>null</code> if there is no entity.
186 *184 *
187 * @property {Overlays.OverlayProperties|Uuid} [path]185 * @property {Entities.EntityProperties|Uuid} [path]
188 * <p>When creating or editing using {@link Pointers.createPointer} or {@link Pointers.editRenderState}, the properties of186 * <p>When creating or editing using {@link Pointers.createPointer} or {@link Pointers.editRenderState}, the properties of
189 * the overlay rendered for the path of the ray pointer. The <code>type</code> property must be specified and be 187 * the entity rendered for the path of the ray pointer. The <code>type</code> property must be specified and be
190 * <code>"line3d"</code>.</p>188 * <code>"PolyLine"</code>.</p> Specify <code>linePoints</code> to control how many segments make up the path.
191 * <p>When getting using {@link Pointers.getPointerProperties}, the ID of the overlay rendered for the path of the ray;189 * <p>When getting using {@link Pointers.getPointerProperties}, the ID of the entity rendered for the path of the ray;
192 * <code>null</code> if there is no overlay.190 * <code>null</code> if there is no entity.
193 *191 *
194 * @property {Overlays.OverlayProperties|Uuid} [end]192 * @property {Entities.EntityProperties|Uuid} [end]
195 * <p>When creating or editing using {@link Pointers.createPointer} or {@link Pointers.editRenderState}, the properties of193 * <p>When creating or editing using {@link Pointers.createPointer} or {@link Pointers.editRenderState}, the properties of
196 * an overlay to render at the end of the ray pointer. The <code>type</code> property must be specified.</p>194 * an entity to render at the end of the ray pointer. The <code>type</code> property must be specified.</p>
197 * <p>When getting using {@link Pointers.getPointerProperties}, the ID of the overlay rendered at the end of the ray; 195 * <p>When getting using {@link Pointers.getPointerProperties}, the ID of the entity rendered at the end of the ray;
198 * <code>null</code> if there is no overlay.196 * <code>null</code> if there is no entity.
199 */197 */
200/*@jsdoc198/*@jsdoc
201 * The properties of a ray pointer. These include the properties from the underlying ray pick that the pointer uses.199 * The properties of a ray pointer. These include the properties from the underlying ray pick that the pointer uses.
202 * @typedef {object} Pointers.RayPointerProperties200 * @typedef {object} Pointers.RayPointerProperties
203 * @property {boolean} [faceAvatar=false] - <code>true</code> if the overlay rendered at the end of the ray rotates about the 201 * @property {boolean} [faceAvatar=false] - <code>true</code> if the entity rendered at the end of the ray rotates about the
204 * world y-axis to always face the avatar; <code>false</code> if it maintains its world orientation.202 * world y-axis to always face the avatar; <code>false</code> if it maintains its world orientation.
205 * @property {boolean} [centerEndY=true] - <code>true</code> if the overlay rendered at the end of the ray is centered on 203 * @property {boolean} [centerEndY=true] - <code>true</code> if the entity rendered at the end of the ray is centered on
206 * the ray end; <code>false</code> if the overlay is positioned against the surface if <code>followNormal</code> is 204 * the ray end; <code>false</code> if the entity is positioned against the surface if <code>followNormal</code> is
207 * <code>true</code>, or above the ray end if <code>followNormal</code> is <code>false</code>.205 * <code>true</code>, or above the ray end if <code>followNormal</code> is <code>false</code>.
208* @property {boolean} [lockEnd=false] - <code>true</code> if the end of the ray is locked to the center of the object at 206* @property {boolean} [lockEnd=false] - <code>true</code> if the end of the ray is locked to the center of the object at
209 * which the ray is pointing; <code>false</code> if the end of the ray is at the intersected surface.207 * which the ray is pointing; <code>false</code> if the end of the ray is at the intersected surface.
210 * @property {boolean} [distanceScaleEnd=false] - <code>true</code> if the dimensions of the overlay at the end of the ray 208 * @property {boolean} [distanceScaleEnd=false] - <code>true</code> if the dimensions of the entity at the end of the ray
211 * scale linearly with distance; <code>false</code> if they aren't. 209 * scale linearly with distance; <code>false</code> if they aren't.
212 * @property {boolean} [scaleWithParent=false] - <code>true</code> if the width of the ray's path and the size of the 210 * @property {boolean} [scaleWithParent=false] - <code>true</code> if the width of the ray's path and the size of the
213 * start and end overlays scale linearly with the pointer parent's scale; <code>false</code> if they don't scale.211 * start and end entities scale linearly with the pointer parent's scale; <code>false</code> if they don't scale.
214 * @property {boolean} [scaleWithAvatar=false] - A synonym for <code>scalewithParent</code>.212 * @property {boolean} [scaleWithAvatar=false] - A synonym for <code>scalewithParent</code>.
215 * <p class="important">Deprecated: This property is deprecated and will be removed.</p>213 * <p class="important">Deprecated: This property is deprecated and will be removed.</p>
216 * @property {boolean} [followNormal=false] - <code>true</code> if the overlay rendered at the end of the ray rotates to 214 * @property {boolean} [followNormal=false] - <code>true</code> if the entity rendered at the end of the ray rotates to
217 * follow the normal of the surface if one is intersected; <code>false</code> if it doesn't.215 * follow the normal of the surface if one is intersected; <code>false</code> if it doesn't.
218 * @property {number} [followNormalStrength=0.0] - How quickly the overlay rendered at the end of the ray rotates to follow 216 * @property {number} [followNormalStrength=0.0] - How quickly the entity rendered at the end of the ray rotates to follow
219 * the normal of an intersected surface. If <code>0</code> or <code>1</code>, the overlay rotation follows instantaneously; 217 * the normal of an intersected surface. If <code>0</code> or <code>1</code>, the entity rotation follows instantaneously;
220 * for other values, the larger the value the more quickly the rotation follows.218 * for other values, the larger the value the more quickly the rotation follows.
221 * @property {Pointers.RayPointerRenderState[]|Object.<string, Pointers.RayPointerRenderState>} [renderStates]219 * @property {Pointers.RayPointerRenderState[]|Object.<string, Pointers.RayPointerRenderState>} [renderStates]
222 * <p>A set of visual states that can be switched among using {@link Pointers.setRenderState}. These define the visual 220 * <p>A set of visual states that can be switched among using {@link Pointers.setRenderState}. These define the visual
@@ -236,7 +234,7 @@ std::shared_ptr<Pointer> PointerScriptingInterface::buildStylus(const PointerPro · 13 unmodified lines
236 * @property {boolean} [hover=false] - <code>true</code> if the pointer generates {@link Entities} hover events, 234 * @property {boolean} [hover=false] - <code>true</code> if the pointer generates {@link Entities} hover events,
237 * <code>false</code> if it doesn't.235 * <code>false</code> if it doesn't.
238 * @property {Pointers.Trigger[]} [triggers=[]] - A list of ways that a {@link Controller} action or function should trigger 236 * @property {Pointers.Trigger[]} [triggers=[]] - A list of ways that a {@link Controller} action or function should trigger
239 * events on the entity or overlay currently intersected.237 * events on the object currently intersected.
240 * @property {PickType} pointerType - The type of pointer returned from {@link Pointers.getPointerProperties} or 238 * @property {PickType} pointerType - The type of pointer returned from {@link Pointers.getPointerProperties} or
241 * {@link Pointers.getPointerScriptParameters}. A laser pointer's type is {@link PickType(0)|PickType.Ray}.239 * {@link Pointers.getPointerScriptParameters}. A laser pointer's type is {@link PickType(0)|PickType.Ray}.
242 * @property {number} [pickID] - The ID of the pick created alongside this pointer, returned from 240 * @property {number} [pickID] - The ID of the pick created alongside this pointer, returned from
@@ -378,41 +376,41 @@ std::shared_ptr<Pointer> PointerScriptingInterface::buildLaserPointer(const Poin · 135 unmodified lines
378 * Properties that define the visual appearance of a parabola pointer when the pointer is intersecting something.376 * Properties that define the visual appearance of a parabola pointer when the pointer is intersecting something.
379 * @typedef {object} Pointers.ParabolaPointerRenderState377 * @typedef {object} Pointers.ParabolaPointerRenderState
380 * @property {string} name - When creating using {@link Pointers.createPointer}, the name of the render state.378 * @property {string} name - When creating using {@link Pointers.createPointer}, the name of the render state.
381 * @property {Overlays.OverlayProperties|Uuid} [start]379 * @property {Entities.EntityProperties|Uuid} [start]
382 * <p>When creating or editing using {@link Pointers.createPointer} or {@link Pointers.editRenderState}, the properties of380 * <p>When creating or editing using {@link Pointers.createPointer} or {@link Pointers.editRenderState}, the properties of
383 * an overlay to render at the start of the parabola pointer. The <code>type</code> property must be specified.</p>381 * an entity to render at the start of the parabola pointer. The <code>type</code> property must be specified.</p>
384 * <p>When getting using {@link Pointers.getPointerProperties}, the ID of the overlay rendered at the start of the 382 * <p>When getting using {@link Pointers.getPointerProperties}, the ID of the entity rendered at the start of the
385 * parabola; <code>null</code> if there is no overlay.383 * parabola; <code>null</code> if there is no entity.
386 * @property {Pointers.ParabolaPointerPath|Uuid} [path]384 * @property {Pointers.ParabolaPointerPath|Uuid} [path]
387 * <p>When creating or editing using {@link Pointers.createPointer} or {@link Pointers.editRenderState}, the properties of385 * <p>When creating or editing using {@link Pointers.createPointer} or {@link Pointers.editRenderState}, the properties of
388 * the rendered path of the parabola pointer.</p>386 * the rendered path of the parabola pointer.</p>
389 * <p>This property is not provided when getting using {@link Pointers.getPointerProperties}.387 * <p>This property is not provided when getting using {@link Pointers.getPointerProperties}.
390 * @property {Overlays.OverlayProperties|Uuid} [end]388 * @property {Entities.EntityProperties|Uuid} [end]
391 * <p>When creating or editing using {@link Pointers.createPointer} or {@link Pointers.editRenderState}, the properties of389 * <p>When creating or editing using {@link Pointers.createPointer} or {@link Pointers.editRenderState}, the properties of
392 * an overlay to render at the end of the ray pointer. The <code>type</code> property must be specified.</p>390 * an entity to render at the end of the ray pointer. The <code>type</code> property must be specified.</p>
393 * <p>When getting using {@link Pointers.getPointerProperties}, the ID of the overlay rendered at the end of the parabola;391 * <p>When getting using {@link Pointers.getPointerProperties}, the ID of the entity rendered at the end of the parabola;
394 * <code>null</code> if there is no overlay.392 * <code>null</code> if there is no entity.
395 */393 */
396/*@jsdoc394/*@jsdoc
397 * The properties of a parabola pointer. These include the properties from the underlying parabola pick that the pointer uses.395 * The properties of a parabola pointer. These include the properties from the underlying parabola pick that the pointer uses.
398 * @typedef {object} Pointers.ParabolaPointerProperties396 * @typedef {object} Pointers.ParabolaPointerProperties
399 * @property {boolean} [faceAvatar=false] - <code>true</code> if the overlay rendered at the end of the ray rotates about the397 * @property {boolean} [faceAvatar=false] - <code>true</code> if the entity rendered at the end of the ray rotates about the
400 * world y-axis to always face the avatar; <code>false</code> if it maintains its world orientation.398 * world y-axis to always face the avatar; <code>false</code> if it maintains its world orientation.
401 * @property {boolean} [centerEndY=true] - <code>true</code> if the overlay rendered at the end of the ray is centered on399 * @property {boolean} [centerEndY=true] - <code>true</code> if the entity rendered at the end of the ray is centered on
402 * the ray end; <code>false</code> if the overlay is positioned against the surface if <code>followNormal</code> is400 * the ray end; <code>false</code> if the entity is positioned against the surface if <code>followNormal</code> is
403 * <code>true</code>, or above the ray end if <code>followNormal</code> is <code>false</code>.401 * <code>true</code>, or above the ray end if <code>followNormal</code> is <code>false</code>.
404* @property {boolean} [lockEnd=false] - <code>true</code> if the end of the ray is locked to the center of the object at402* @property {boolean} [lockEnd=false] - <code>true</code> if the end of the ray is locked to the center of the object at
405 * which the ray is pointing; <code>false</code> if the end of the ray is at the intersected surface.403 * which the ray is pointing; <code>false</code> if the end of the ray is at the intersected surface.
406 * @property {boolean} [distanceScaleEnd=false] - <code>true</code> if the dimensions of the overlay at the end of the ray404 * @property {boolean} [distanceScaleEnd=false] - <code>true</code> if the dimensions of the entity at the end of the ray
407 * scale linearly with distance; <code>false</code> if they aren't.405 * scale linearly with distance; <code>false</code> if they aren't.
408 * @property {boolean} [scaleWithParent=false] - <code>true</code> if the width of the ray's path and the size of the406 * @property {boolean} [scaleWithParent=false] - <code>true</code> if the width of the ray's path and the size of the
409 * start and end overlays scale linearly with the pointer parent's scale; <code>false</code> if they don't scale.407 * start and end entities scale linearly with the pointer parent's scale; <code>false</code> if they don't scale.
410 * @property {boolean} [scaleWithAvatar=false] - A synonym for <code>scalewithParent</code>.408 * @property {boolean} [scaleWithAvatar=false] - A synonym for <code>scalewithParent</code>.
411 * <p class="important">Deprecated: This property is deprecated and will be removed.</p>409 * <p class="important">Deprecated: This property is deprecated and will be removed.</p>
412 * @property {boolean} [followNormal=false] - <code>true</code> if the overlay rendered at the end of the ray rotates to410 * @property {boolean} [followNormal=false] - <code>true</code> if the entity rendered at the end of the ray rotates to
413 * follow the normal of the surface if one is intersected; <code>false</code> if it doesn't.411 * follow the normal of the surface if one is intersected; <code>false</code> if it doesn't.
414 * @property {number} [followNormalStrength=0.0] - How quickly the overlay rendered at the end of the ray rotates to follow412 * @property {number} [followNormalStrength=0.0] - How quickly the entity rendered at the end of the ray rotates to follow
415 * the normal of an intersected surface. If <code>0</code> or <code>1</code>, the overlay rotation follows instantaneously;413 * the normal of an intersected surface. If <code>0</code> or <code>1</code>, the entity rotation follows instantaneously;
416 * for other values, the larger the value the more quickly the rotation follows.414 * for other values, the larger the value the more quickly the rotation follows.
417 * @property {Pointers.ParabolaPointerRenderState[]|Object.<string, Pointers.ParabolaPointerRenderState>} [renderStates] 415 * @property {Pointers.ParabolaPointerRenderState[]|Object.<string, Pointers.ParabolaPointerRenderState>} [renderStates]
418 * <p>A set of visual states that can be switched among using {@link Pointers.setRenderState}. These define the visual416 * <p>A set of visual states that can be switched among using {@link Pointers.setRenderState}. These define the visual
@@ -432,7 +430,7 @@ std::shared_ptr<Pointer> PointerScriptingInterface::buildLaserPointer(const Poin · 13 unmodified lines
432 * @property {boolean} [hover=false] - <code>true</code> if the pointer generates {@link Entities} hover events,430 * @property {boolean} [hover=false] - <code>true</code> if the pointer generates {@link Entities} hover events,
433 * <code>false</code> if it doesn't.431 * <code>false</code> if it doesn't.
434 * @property {Pointers.Trigger[]} [triggers=[]] - A list of ways that a {@link Controller} action or function should trigger432 * @property {Pointers.Trigger[]} [triggers=[]] - A list of ways that a {@link Controller} action or function should trigger
435 * events on the entity or overlay currently intersected.433 * events on the object currently intersected.
436 * @property {PickType} pointerType - The type of pointer returned from {@link Pointers.getPointerProperties} or 434 * @property {PickType} pointerType - The type of pointer returned from {@link Pointers.getPointerProperties} or
437 * {@link Pointers.getPointerScriptParameters}. A parabola pointer's type is {@link PickType(0)|PickType.Parabola}.435 * {@link Pointers.getPointerScriptParameters}. A parabola pointer's type is {@link PickType(0)|PickType.Parabola}.
438 * @property {number} [pickID] - The ID of the pick created alongside this pointer, returned from 436 * @property {number} [pickID] - The ID of the pick created alongside this pointer, returned from
@@ -622,7 +620,6 @@ bool rayPointerPropertiesFromScriptValue(const ScriptValue& value, RayPointerPro · 183 unmodified lines
622 out.properties[*renderStatesName].setValue(renderStates);620 out.properties[*renderStatesName].setValue(renderStates);
623 }621 }
624 }622 }
625 qDebug() << "rayPointerPropertiesFromScriptValue" << out.properties;
626 return true;623 return true;
627}624}
628 625
@@ -675,7 +672,6 @@ bool stylusPointerPropertiesFromScriptValue(const ScriptValue& value, StylusPoin · 46 unmodified lines
675 out.properties[*renderStatesName].setValue(renderStates);672 out.properties[*renderStatesName].setValue(renderStates);
676 }673 }
677 }674 }
678 qDebug() << "stylusPointerPropertiesFromScriptValue" << out.properties;
679 return true;675 return true;
680}676}
681 677
@@ -714,7 +710,6 @@ bool parabolaPointerPropertiesFromScriptValue(const ScriptValue& value, Parabola · 32 unmodified lines
714 pathProperties.copyFromScriptValue(path, false);710 pathProperties.copyFromScriptValue(path, false);
715 stateMap.insert("pathPropertyIndex", QVariant(out.entityProperties.length()));711 stateMap.insert("pathPropertyIndex", QVariant(out.entityProperties.length()));
716 out.entityProperties.append(pathProperties);712 out.entityProperties.append(pathProperties);
717 qDebug() << "parabolaPointerPropertiesFromScriptValue : added path entity";
718 }713 }
719 714
720 if (stateMap["end"].isValid()) {715 if (stateMap["end"].isValid()) {
@@ -723,7 +718,6 @@ bool parabolaPointerPropertiesFromScriptValue(const ScriptValue& value, Parabola · 2 unmodified lines
723 endProperties.copyFromScriptValue(end, false);718 endProperties.copyFromScriptValue(end, false);
724 stateMap.insert("endPropertyIndex", QVariant(out.entityProperties.length()));719 stateMap.insert("endPropertyIndex", QVariant(out.entityProperties.length()));
725 out.entityProperties.append(endProperties);720 out.entityProperties.append(endProperties);
726 qDebug() << "parabolaPointerPropertiesFromScriptValue : added end entity";
727 }721 }
728 renderStates[i].setValue(stateMap);722 renderStates[i].setValue(stateMap);
729 }723 }
@@ -731,6 +725,5 @@ bool parabolaPointerPropertiesFromScriptValue(const ScriptValue& value, Parabola · 1 unmodified line
731 out.properties[*renderStatesName].setValue(renderStates);725 out.properties[*renderStatesName].setValue(renderStates);
732 }726 }
733 }727 }
734 qDebug() << "parabolaPointerPropertiesFromScriptValue" << out.properties;
735 return true;728 return true;
736}729}