From 8de1331fa54bbbdcd0cd4adabd3f148b93d46e52 Mon Sep 17 00:00:00 2001 From: ksuprynowicz Date: Tue, 16 May 2023 00:00:32 +0200 Subject: [PATCH] V8 related cleanup --- interface/src/LoginStateManager.cpp | 16 ---------------- interface/src/ui/overlays/Overlays.h | 2 +- .../GraphicsScriptingInterface.cpp | 9 --------- .../script-engine/src/MenuItemProperties.cpp | 6 ++++++ libraries/shared/src/shared/QtHelpers.cpp | 4 ++-- 5 files changed, 9 insertions(+), 28 deletions(-) diff --git a/interface/src/LoginStateManager.cpp b/interface/src/LoginStateManager.cpp index 4207549d98..f11f636f03 100644 --- a/interface/src/LoginStateManager.cpp +++ b/interface/src/LoginStateManager.cpp @@ -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().data(); if (pointers) { diff --git a/interface/src/ui/overlays/Overlays.h b/interface/src/ui/overlays/Overlays.h index 5f3d631a36..b3d9992bd0 100644 --- a/interface/src/ui/overlays/Overlays.h +++ b/interface/src/ui/overlays/Overlays.h @@ -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 diff --git a/libraries/graphics-scripting/src/graphics-scripting/GraphicsScriptingInterface.cpp b/libraries/graphics-scripting/src/graphics-scripting/GraphicsScriptingInterface.cpp index 823d61cb84..0dd5b95532 100644 --- a/libraries/graphics-scripting/src/graphics-scripting/GraphicsScriptingInterface.cpp +++ b/libraries/graphics-scripting/src/graphics-scripting/GraphicsScriptingInterface.cpp @@ -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& out = *(reinterpret_cast* >(p)); auto obj = value.toQObject(); #ifdef SCRIPTABLE_MESH_DEBUG qCInfo(graphics_scripting) << "qpointer_qobject_cast" << obj << value.toString(); #endif if (auto tmp = qobject_cast(obj)) { - //out = QPointer(tmp); -#if defined(Q_OS_WIN) || defined(Q_OS_MAC) dest.setValue(QPointer(tmp)); -#else - //V8TODO: works on Linux but not Windows? - dest.template setValue(QPointer(tmp)); -#endif return true; } #if 0 @@ -363,7 +355,6 @@ namespace scriptable { return true; } #endif - //out = nullptr; return false; } ); diff --git a/libraries/script-engine/src/MenuItemProperties.cpp b/libraries/script-engine/src/MenuItemProperties.cpp index d720696b2f..442c540dd4 100644 --- a/libraries/script-engine/src/MenuItemProperties.cpp +++ b/libraries/script-engine/src/MenuItemProperties.cpp @@ -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(); diff --git a/libraries/shared/src/shared/QtHelpers.cpp b/libraries/shared/src/shared/QtHelpers.cpp index 6dfcb07093..ed618ae8a1 100644 --- a/libraries/shared/src/shared/QtHelpers.cpp +++ b/libraries/shared/src/shared/QtHelpers.cpp @@ -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