V8 related cleanup

This commit is contained in:
ksuprynowicz 2023-05-16 00:00:32 +02:00
parent fe9babf02d
commit 8de1331fa5
5 changed files with 9 additions and 28 deletions

View file

@ -25,33 +25,17 @@
#include "scripting/ControllerScriptingInterface.h"
static const float SEARCH_SPHERE_SIZE = 0.0132f;
/*static const QVariantMap SEARCH_SPHERE = {{"x", SEARCH_SPHERE_SIZE},
{"y", SEARCH_SPHERE_SIZE},
{"z", SEARCH_SPHERE_SIZE}};*/
static const glm::vec3 SEARCH_SPHERE(SEARCH_SPHERE_SIZE, SEARCH_SPHERE_SIZE, SEARCH_SPHERE_SIZE);
static const int DEFAULT_SEARCH_SPHERE_DISTANCE = 1000; // how far from camera to search intersection?
/*static const QVariantMap COLORS_GRAB_SEARCHING_HALF_SQUEEZE = {{"red", 10},
{"green", 10},
{"blue", 255}};
static const QVariantMap COLORS_GRAB_SEARCHING_FULL_SQUEEZE = {{"red", 250},
{"green", 10},
{"blue", 10}};
static const QVariantMap COLORS_GRAB_DISTANCE_HOLD = {{"red", 238},
{"green", 75},
{"blue", 214}};*/
static const glm::u8vec3 COLORS_GRAB_SEARCHING_HALF_SQUEEZE(10, 10, 255);
static const glm::u8vec3 COLORS_GRAB_SEARCHING_FULL_SQUEEZE(250, 10, 10);
static const glm::u8vec3 COLORS_GRAB_DISTANCE_HOLD(238, 75, 215);
void LoginStateManager::tearDown() {
auto pointers = DependencyManager::get<PointerManager>().data();
if (pointers) {

View file

@ -309,7 +309,7 @@ public slots:
* });
*/
QUuid getOverlayAtPoint(const glm::vec2& point);
/*@jsdoc
* Finds the closest 3D overlay (or local entity) intersected by a {@link PickRay}.
* @function Overlays.findRayIntersection

View file

@ -338,20 +338,12 @@ namespace scriptable {
return engine->newQObject(object, ScriptEngine::QtOwnership, ScriptEngine::AutoCreateDynamicProperties);
},
[](const ScriptValue& value, QVariant &dest) -> bool {
//Q_ASSERT(p != NULL);
//QPointer<T>& out = *(reinterpret_cast<QPointer<T>* >(p));
auto obj = value.toQObject();
#ifdef SCRIPTABLE_MESH_DEBUG
qCInfo(graphics_scripting) << "qpointer_qobject_cast" << obj << value.toString();
#endif
if (auto tmp = qobject_cast<T*>(obj)) {
//out = QPointer<T>(tmp);
#if defined(Q_OS_WIN) || defined(Q_OS_MAC)
dest.setValue(QPointer<T>(tmp));
#else
//V8TODO: works on Linux but not Windows?
dest.template setValue(QPointer<T>(tmp));
#endif
return true;
}
#if 0
@ -363,7 +355,6 @@ namespace scriptable {
return true;
}
#endif
//out = nullptr;
return false;
}
);

View file

@ -78,6 +78,12 @@ ScriptValue menuItemPropertiesToScriptValue(ScriptEngine* engine, const MenuItem
* @property {string} [grouping] - The name of grouping to add this menu item to.
*/
bool menuItemPropertiesFromScriptValue(const ScriptValue& object, MenuItemProperties& properties) {
if (!object.hasProperty("menuName")) {
return false;
}
if (!object.hasProperty("menuItemName")) {
return false;
}
properties.menuName = object.property("menuName").toVariant().toString();
properties.menuItemName = object.property("menuItemName").toVariant().toString();
properties.isCheckable = object.property("isCheckable").toVariant().toBool();

View file

@ -104,10 +104,10 @@ bool blockingInvokeMethod(
}
// Inspecting of the qt event queue
// requres access to private Qt datastructures
// requires access to private Qt datastructures
// Querying the event queue should be done with
// care as it could lock the threadData->postEventList.mutex
// The code uses a tryLock to avoid the possability of a
// The code uses a tryLock to avoid the possibility of a
// deadlock during a call to this code, although that is unlikely
//
#ifdef DEBUG_EVENT_QUEUE