Replace some more getPropertyValue function calls (deprecated)

This commit is contained in:
Emma Broman
2023-08-07 10:08:21 +02:00
parent 15dbe32341
commit add6df05fd
4 changed files with 24 additions and 24 deletions
+5 -5
View File
@@ -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
+14 -14
View File
@@ -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)
+2 -2
View File
@@ -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
);
+3 -3
View File
@@ -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,