From add6df05fd7b478e6f7ea4f0784de0a9b7cad59c Mon Sep 17 00:00:00 2001 From: Emma Broman Date: Mon, 7 Aug 2023 10:08:21 +0200 Subject: [PATCH] Replace some more `getPropertyValue` function calls (deprecated) --- data/assets/util/webgui.asset | 10 +++++----- scripts/core_scripts.lua | 28 ++++++++++++++-------------- src/interaction/touchbar.mm | 4 ++-- src/rendering/renderengine.cpp | 6 +++--- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/data/assets/util/webgui.asset b/data/assets/util/webgui.asset index 2892f6e71c..aa59aa8000 100644 --- a/data/assets/util/webgui.asset +++ b/data/assets/util/webgui.asset @@ -27,10 +27,10 @@ asset.onInitialize(function() -- and remove automatic restart on each property change, -- since frequent restarting seems to be unstable on mac. - local enabled = openspace.getPropertyValue("Modules.WebGui.ServerProcessEnabled") + local enabled = openspace.propertyValue("Modules.WebGui.ServerProcessEnabled") openspace.setPropertyValueSingle("Modules.WebGui.ServerProcessEnabled", false) - local directories = openspace.getPropertyValue("Modules.WebGui.Directories") + local directories = openspace.propertyValue("Modules.WebGui.Directories") directories[#directories + 1] = "frontend" directories[#directories + 1] = frontend .. "frontend" @@ -40,7 +40,7 @@ asset.onInitialize(function() -- The GUI contains date and simulation increment, -- so let's remove these from the dashboard. - if openspace.getPropertyValue("Modules.CefWebGui.Visible") then + if openspace.propertyValue("Modules.CefWebGui.Visible") then if openspace.hasProperty("Dashboard.Date.Enabled") then openspace.setPropertyValueSingle("Dashboard.Date.Enabled", false) end @@ -52,7 +52,7 @@ end) asset.onDeinitialize(function() -- Remove the frontend endpoint - local directories = openspace.getPropertyValue("Modules.WebGui.Directories") + local directories = openspace.propertyValue("Modules.WebGui.Directories") local newDirectories = {} -- @TODO(maci, 2019-08-23) see message below @@ -73,7 +73,7 @@ asset.onDeinitialize(function() end) function setCefRoute(route) - local port = openspace.getPropertyValue("Modules.WebGui.Port") + local port = openspace.propertyValue("Modules.WebGui.Port") -- As a developer, you can manually serve the webgui from port 4690 -- with the command `npm start` in the web gui repository if guiCustomization.webguiDevelopmentMode then diff --git a/scripts/core_scripts.lua b/scripts/core_scripts.lua index 8a0c434a99..602b50e5a5 100644 --- a/scripts/core_scripts.lua +++ b/scripts/core_scripts.lua @@ -146,7 +146,7 @@ openspace.rebindKey = function(oldKey, newKey) end openspace.appendToListProperty = function(propertyIdentifier, newItem) - local list = openspace.getPropertyValue(propertyIdentifier) + local list = openspace.propertyValue(propertyIdentifier) if type(list) ~= 'table' then openspace.printError( "Error when calling script 'openspace.appendToListProperty': " .. @@ -159,7 +159,7 @@ openspace.appendToListProperty = function(propertyIdentifier, newItem) end openspace.addToPropertyValue = function(propertyIdentifier, valueToAdd) - local value = openspace.getPropertyValue(propertyIdentifier) + local value = openspace.propertyValue(propertyIdentifier) if type(value) == 'string' then value = value .. valueToAdd; else @@ -169,7 +169,7 @@ openspace.addToPropertyValue = function(propertyIdentifier, valueToAdd) end openspace.invertBooleanProperty = function(propertyIdentifier) - local value = openspace.getPropertyValue(propertyIdentifier) + local value = openspace.propertyValue(propertyIdentifier) if type(value) ~= 'boolean' then openspace.printError( "Error when calling script 'openspace.invertBooleanProperty': " .. @@ -183,7 +183,7 @@ end openspace.fadeIn = function(identifier, fadeTime, endScript) -- Set default values for optional arguments endScript = endScript or "" - fadeTime = fadeTime or openspace.getPropertyValue("OpenSpaceEngine.FadeDuration") + fadeTime = fadeTime or openspace.propertyValue("OpenSpaceEngine.FadeDuration") local enabledProperty = identifier .. ".Enabled" local fadeProperty = identifier .. ".Fade" @@ -197,7 +197,7 @@ openspace.fadeIn = function(identifier, fadeTime, endScript) if hasTag ~= nil or hasWild ~= nil then -- Regex, several nodes - local enabledPropertyList = openspace.getProperty(enabledProperty) + local enabledPropertyList = openspace.property(enabledProperty) if next(enabledPropertyList) == nil then -- List is empty, no matches found openspace.printError( @@ -207,7 +207,7 @@ openspace.fadeIn = function(identifier, fadeTime, endScript) return end - local fadePropertyList = openspace.getProperty(fadeProperty) + local fadePropertyList = openspace.property(fadeProperty) if next(fadePropertyList) == nil then -- List is empty, no matches found openspace.printError( @@ -234,7 +234,7 @@ openspace.fadeIn = function(identifier, fadeTime, endScript) ) return else - isEnabled = openspace.getPropertyValue(enabledProperty) + isEnabled = openspace.propertyValue(enabledProperty) end end @@ -250,7 +250,7 @@ end openspace.fadeOut = function(identifier, fadeTime, endScript) -- Set default values for optional arguments endScript = endScript or "" - fadeTime = fadeTime or openspace.getPropertyValue("OpenSpaceEngine.FadeDuration") + fadeTime = fadeTime or openspace.propertyValue("OpenSpaceEngine.FadeDuration") local enabledProperty = identifier .. ".Enabled" local fadeProperty = identifier .. ".Fade" @@ -264,7 +264,7 @@ openspace.fadeOut = function(identifier, fadeTime, endScript) if hasTag ~= nil or hasWild ~= nil then -- Regex, several nodes - local enabledPropertyList = openspace.getProperty(enabledProperty) + local enabledPropertyList = openspace.property(enabledProperty) if next(enabledPropertyList) == nil then -- List is empty, no matches found openspace.printError( @@ -274,7 +274,7 @@ openspace.fadeOut = function(identifier, fadeTime, endScript) return end - local fadePropertyList = openspace.getProperty(fadeProperty) + local fadePropertyList = openspace.property(fadeProperty) if next(fadePropertyList) == nil then -- List is empty, no matches found openspace.printError( @@ -301,7 +301,7 @@ openspace.fadeOut = function(identifier, fadeTime, endScript) ) return else - isEnabled = openspace.getPropertyValue(enabledProperty) + isEnabled = openspace.propertyValue(enabledProperty) end end @@ -319,10 +319,10 @@ end openspace.toggleFade = function(renderable, fadeTime, endScript) if (fadeTime == nil) then - fadeTime = openspace.getPropertyValue("OpenSpaceEngine.FadeDuration") + fadeTime = openspace.propertyValue("OpenSpaceEngine.FadeDuration") end - local enabled = openspace.getPropertyValue(renderable .. ".Enabled") - local fadeState = openspace.getPropertyValue(renderable .. ".Fade") + local enabled = openspace.propertyValue(renderable .. ".Enabled") + local fadeState = openspace.propertyValue(renderable .. ".Fade") if (enabled) then if (fadeState < 0.5) then openspace.fadeIn(renderable, fadeTime-(fadeTime*fadeState), endScript) diff --git a/src/interaction/touchbar.mm b/src/interaction/touchbar.mm index 3e67369240..6f8bbbf1c4 100644 --- a/src/interaction/touchbar.mm +++ b/src/interaction/touchbar.mm @@ -206,7 +206,7 @@ NSArray* focusIdentifiers; (void)sender; global::scriptEngine->queueScript( - "local isEnabled = openspace.getPropertyValue('Dashboard.IsEnabled');\ + "local isEnabled = openspace.propertyValue('Dashboard.IsEnabled');\ openspace.setPropertyValueSingle('Dashboard.IsEnabled', not isEnabled);\ openspace.setPropertyValueSingle('RenderEngine.ShowLog', not isEnabled);\ openspace.setPropertyValueSingle('RenderEngine.ShowVersion', not isEnabled);\ @@ -219,7 +219,7 @@ NSArray* focusIdentifiers; // Remove unused variable warning (void)sender; global::scriptEngine->queueScript( - "local isEnabled = openspace.getPropertyValue('Modules.CefWebGui.Visible');\ + "local isEnabled = openspace.propertyValue('Modules.CefWebGui.Visible');\ openspace.setPropertyValueSingle('Modules.CefWebGui.Visible', not isEnabled);", scripting::ScriptEngine::RemoteScripting::No ); diff --git a/src/rendering/renderengine.cpp b/src/rendering/renderengine.cpp index 1c486dac18..f73dbcc2f6 100644 --- a/src/rendering/renderengine.cpp +++ b/src/rendering/renderengine.cpp @@ -772,7 +772,7 @@ bool RenderEngine::mouseActivationCallback(const glm::dvec2& mousePosition) cons if (intersects(mousePosition, _cameraButtonLocations.rotation)) { constexpr const char ToggleRotationFrictionScript[] = R"( local f = 'NavigationHandler.OrbitalNavigator.Friction.RotationalFriction'; - openspace.setPropertyValueSingle(f, not openspace.getPropertyValue(f));)"; + openspace.setPropertyValueSingle(f, not openspace.propertyValue(f));)"; global::scriptEngine->queueScript( ToggleRotationFrictionScript, @@ -784,7 +784,7 @@ bool RenderEngine::mouseActivationCallback(const glm::dvec2& mousePosition) cons if (intersects(mousePosition, _cameraButtonLocations.zoom)) { constexpr const char ToggleZoomFrictionScript[] = R"( local f = 'NavigationHandler.OrbitalNavigator.Friction.ZoomFriction'; - openspace.setPropertyValueSingle(f, not openspace.getPropertyValue(f));)"; + openspace.setPropertyValueSingle(f, not openspace.propertyValue(f));)"; global::scriptEngine->queueScript( ToggleZoomFrictionScript, @@ -796,7 +796,7 @@ bool RenderEngine::mouseActivationCallback(const glm::dvec2& mousePosition) cons if (intersects(mousePosition, _cameraButtonLocations.roll)) { constexpr const char ToggleRollFrictionScript[] = R"( local f = 'NavigationHandler.OrbitalNavigator.Friction.RollFriction'; - openspace.setPropertyValueSingle(f, not openspace.getPropertyValue(f));)"; + openspace.setPropertyValueSingle(f, not openspace.propertyValue(f));)"; global::scriptEngine->queueScript( ToggleRollFrictionScript,