setValue
Definition
-- @/lua/ge/extensions/core/settings/settings.lua:307
local function setValue(key, value, ignoreCache)
if settingInProgress[key] then
--log("W", "", "This call to setValue() settings is being ignored, because it is flagged as a recursive call via 'M.settingInProgress["..dumps(key).."]'. This should not happen, please review callstack below:")
--print(debug.tracesimple())
return
end
settingInProgress[key] = true
-- log('I','settings','setValue called key = '..tostring(key)..' value = '..tostring(value))
-- apply to memory right now
local stateDirty = false
if ignoreCache or values[key] == nil or (tostring(value) ~= tostring(values[key])) then
stateDirty = true
values[key] = value
if options[key] and type(options[key].set) == 'function' then
options[key].set(value)
end
end
settingInProgress[key] = false
-- delay writing to disk
if stateDirty and not M.loadingSettingsInProgress then
M.requestSave()
end
return stateDirty
end
Callers
@/lua/ge/main.lua
if tableFindKey(cmdArgs, '-disableDynamicCollision') then
settings.setValue('disableDynamicCollision', true)
end
@/ui/lib/int/beamng.controls.js
scope.$evalAsync(() => {
setValue(event)
})
@/lua/ge/extensions/util/screenshotCreator.lua
if isInShowroom() then
settings.setValue('GraphicDynReflectionEnabled', value)
end
@/lua/ge/extensions/util/resaveMaterials.lua
local function onExtensionLoaded()
settings.setValue("IngameConsoleLogBlacklist", "DA")
settings.setValue("WinConsoleLogBlacklist", "DA")
settings.setValue("IngameConsoleLogBlacklist", "DA")
settings.setValue("WinConsoleLogBlacklist", "DA")
extensions.core_jobsystem.create(work, 1) -- yield every second, good for background tasks
@/inspector/Views/ConsolePrompt.js
{
this._codeMirror.setValue(text || "");
this._codeMirror.clearHistory();
if (!keepCurrentText) {
this._codeMirror.setValue("");
this._codeMirror.clearHistory();
this._codeMirror.setValue(historyEntry.text || "");
@/lua/ge/extensions/render/openxr.lua
local function saveSettings()
settings.setValue("openXRuiEnabled" , M.openXRuiEnabled[0])
settings.setValue("openXRuiMode" , M.openXRuiMode[0])
settings.setValue("openXRuiEnabled" , M.openXRuiEnabled[0])
settings.setValue("openXRuiMode" , M.openXRuiMode[0])
settings.setValue("openXRwindowViewMode", M.openXRwindowViewMode[0])
settings.setValue("openXRuiMode" , M.openXRuiMode[0])
settings.setValue("openXRwindowViewMode", M.openXRwindowViewMode[0])
settings.setValue("openXRdebugEnabled" , M.openXRdebugEnabled[0])
settings.setValue("openXRwindowViewMode", M.openXRwindowViewMode[0])
settings.setValue("openXRdebugEnabled" , M.openXRdebugEnabled[0])
settings.setValue("openXRquadCompositionEnabled" , M.openXRquadCompositionEnabled[0])
settings.setValue("openXRdebugEnabled" , M.openXRdebugEnabled[0])
settings.setValue("openXRquadCompositionEnabled" , M.openXRquadCompositionEnabled[0])
end
@/lua/ge/extensions/core/versionUpdate.lua
--newInstall = nil; lastVersion = "0.1.2.3.fake" -- fake major update
--settings.setValue('disableModsAfterUpdate',nil)-- use together with above line, to simulate a clean major update
--newInstall = nil; lastVersion = beamng_version -- fake no update
log("D", "", string.format("Saving lastVersion to disk: %s", dumps(beamng_version)))
settings.setValue('lastVersion', beamng_version)
end
@/inspector/External/CodeMirror/codemirror.js
// have to be initialized before the editor can start at all.
option("value", "", function (cm, val) { return cm.setValue(val); }, true)
option("mode", null, function (cm, val) {
@/inspector/Views/AuditTestCaseContentView.js
});
codeMirror.setValue(domNode);
@/ui/modules/scenariocontrol/scenariocontrol.js
vm.applySettings = function (key) {
bngApi.engineLua(`settings.setValue("${key}", "${vm.userSettings.values[key]}")`)
}
@/lua/ge/extensions/core/online.lua
enabled = false
settings.setValue('telemetry', 'disable')
end
table.insert(hidden_ids, uid)
settings.setValue("OnlineHiddenMessageIDs", table.concat(hidden_ids, ','))
settings.requestSave()
@/inspector/Views/InlineSwatch.js
let codeMirror = this._valueEditor.codeMirror;
codeMirror.setValue(value);
@/lua/ge/extensions/core/settings/rally.lua
for k,v in pairs(levelData) do
settings.setValue(k, v)
end
@/lua/ge/extensions/util/compileMeshes.lua
local function onExtensionLoaded()
--settings.setValue("IngameConsoleLogBlacklist", "DA")
--settings.setValue("WinConsoleLogBlacklist", "DA")
--settings.setValue("IngameConsoleLogBlacklist", "DA")
--settings.setValue("WinConsoleLogBlacklist", "DA")
extensions.core_jobsystem.create(work, 1) -- yield every second, good for background tasks
@/lua/ge/extensions/core/camera.lua
updateOptionsUI(vdata)
settings.setValue('cameraConfig', jsonEncode({ version=currentVersion, data=configuration }))
end
local function resetConfiguration()
settings.setValue('cameraConfig', "")
for vid, vdata in pairs(getVehicleData()) do
@/lua/ge/extensions/core/settings/graphic.lua
end
settings.setValue('GraphicAntialiasType', value)
end,
end
settings.setValue('GraphicAntialias', value)
end,
set = function ( value )
settings.setValue("PostFXBloomGeneralEnabled", value)
local postFX = scenetree.findObject("PostEffectBloomObject")
set = function ( value )
settings.setValue("PostFXMotionBlurEnabled", value)
local fx = scenetree.findObject("PostFxMotionBlur")
set = function ( value )
settings.setValue("PostFXMotionBlurStrength", value)
if scenetree.PostFxMotionBlur then
set = function ( value )
settings.setValue("PostFXMotionBlurPlayerVehicle", value)
BeamNGVehicle.motionBlurPlayerVehiclesEnabled = value
end
settings.setValue('PostFXSSAOGeneralQuality', value)
end,
set = function( value )
settings.setValue("SkipGenerateLicencePlate",value)
end
for k, v in pairs(data) do
settings.setValue(k, v)
end
@/lua/ge/extensions/flowgraph/nodes/gameplay/multiseat.lua
self.previous = settings.getValue('multiseat', false)
settings.setValue('multiseat', true)
end
if self.activated then
settings.setValue('multiseat', self.previous)
self.activated = false
@/inspector/Views/SourceCodeTextEditor.js
this._showPopover(content);
codeMirror.setValue(formattedText || data.description);
this._popover.update();
@/inspector/Views/TextEditor.js
if (this._codeMirror.getValue() !== newString)
this._codeMirror.setValue(newString);
else {
this._formatterSourceMap = WI.FormatterSourceMap.fromSourceMapData(sourceMapData);
this._codeMirror.setValue(formattedText);
this._updateAfterFormatting(true, beforePrettyPrintState);
@/lua/ge/extensions/core/settings/settings.lua
if value then
isChanged = M.setValue(qualityKey, value, ignoreCache) or isChanged
end
local s = newState[k]
isChanged = M.setValue(k, s, ignoreCache) or isChanged
end
if settingInProgress[key] then
--log("W", "", "This call to setValue() settings is being ignored, because it is flagged as a recursive call via 'M.settingInProgress["..dumps(key).."]'. This should not happen, please review callstack below:")
--print(debug.tracesimple())
if M.impl.defaultValues[key] ~= nil then
setValue(key, M.impl.defaultValues[key])
end
@/lua/ge/extensions/editor/gen/world.lua
if settings.getValue('GraphicAntialias') == 4 and settings.getValue('GraphicAntialiasType') == "fxaa" then
settings.setValue('GraphicAntialias', 0)
-- activateAAAfter = true
@/lua/ge/extensions/ui/gridSelectorUtils/displayDataModule.lua
if optionKey then
settings.setValue(optionKey, value)
end
@/ui/ui-vue/src/tests/components/base/bngSlider.spec.js
await input.setValue(30)
await input.setValue(1)
@/lua/ge/extensions/tech/techCore.lua
local function setup()
settings.setValue('uiUnits', 'metric')
settings.setValue('uiUnitLength', 'metric')
settings.setValue('uiUnits', 'metric')
settings.setValue('uiUnitLength', 'metric')
settings.setValue('uiUnitTemperature', 'c')
settings.setValue('uiUnitLength', 'metric')
settings.setValue('uiUnitTemperature', 'c')
settings.setValue('uiUnitWeight', 'kg')
settings.setValue('uiUnitTemperature', 'c')
settings.setValue('uiUnitWeight', 'kg')
settings.setValue('uiUnitTorque', 'metric')
settings.setValue('uiUnitWeight', 'kg')
settings.setValue('uiUnitTorque', 'metric')
settings.setValue('uiUnitConsumptionRate', 'metric')
settings.setValue('uiUnitTorque', 'metric')
settings.setValue('uiUnitConsumptionRate', 'metric')
settings.setValue('uiUnitEnergy', 'metric')
settings.setValue('uiUnitConsumptionRate', 'metric')
settings.setValue('uiUnitEnergy', 'metric')
settings.setValue('uiUnitDate', 'iso')
settings.setValue('uiUnitEnergy', 'metric')
settings.setValue('uiUnitDate', 'iso')
settings.setValue('uiUnitPower', 'hp')
settings.setValue('uiUnitDate', 'iso')
settings.setValue('uiUnitPower', 'hp')
settings.setValue('uiUnitVolume', 'l')
settings.setValue('uiUnitPower', 'hp')
settings.setValue('uiUnitVolume', 'l')
settings.setValue('uiUnitPressure', 'bar')
settings.setValue('uiUnitVolume', 'l')
settings.setValue('uiUnitPressure', 'bar')
M.handleFPSLimit = function(request)
settings.setValue('fpsLimit', request['fps'])
settings.setValue('fpsLimitEnabled', true)
settings.setValue('fpsLimit', request['fps'])
settings.setValue('fpsLimitEnabled', true)
settings.setValue('fpsLimitBackgroundEnabled', false)
settings.setValue('fpsLimitEnabled', true)
settings.setValue('fpsLimitBackgroundEnabled', false)
request:sendACK('SetFPSLimit')
M.handleRemoveFPSLimit = function(request)
settings.setValue('fpsLimitEnabled', false)
request:sendACK('RemovedFPSLimit')
local value = request['value']
settings.setValue(key, value, true)
request:sendACK('SettingsChanged')
@/lua/ge/extensions/core/hardwareinfo.lua
local function acknowledgeWarning(warning)
settings.setValue('PerformanceWarnings.' .. warning, true)
requestInfo()
@/ui/ui-vue/src/tests/components/base/bngInput.spec.js
await input.setValue(inputValue)
await input.trigger('focusout')
@/lua/ge/extensions/core/modmanager.lua
result = true
settings.setValue('disableModsAfterUpdate', result) -- only disable mods if some were installed in the first place
end
local function enableModsAfterUpdate()
settings.setValue('disableModsAfterUpdate', false)
onUiReady()
@/lua/ge/extensions/ui/bindingsLegend.lua
resetFade()
settings.setValue("bindingsLegendShowApp", not settings.getValue("bindingsLegendShowApp", true))
sendDataToUI()
@/lua/ge/extensions/core/cameraModes/driver.lua
self.saveTimeout = nil -- disable any ongoing auto-save
settings.setValue('cameraDriverVehicleConfigs', "{}")
end
vehConfigs[vehicleName] = vehConfig
settings.setValue('cameraDriverVehicleConfigs', jsonEncode(vehConfigs))
settings.setValue('cameraDriverFov', data.res.fov)
settings.setValue('cameraDriverVehicleConfigs', jsonEncode(vehConfigs))
settings.setValue('cameraDriverFov', data.res.fov)
self.saveTimeout = nil
@/lua/ge/extensions/render/renderViews.lua
if activateAAAfter then
settings.setValue('GraphicAntialias', 4)
activateAAAfter = nil
if settings.getValue('GraphicAntialias') == 4 and settings.getValue('GraphicAntialiasType') == "fxaa" then
settings.setValue('GraphicAntialias', 0)
activateAAAfter = true
@/inspector/External/three.js/three.js
program.getUniforms().setValue( gl, 'morphTargetInfluences', morphInfluences );
*
* .setValue( gl, value, [renderer] )
*
*
* .setValue( gl, name, value )
*
var u = seq[ i ];
u.setValue( gl, value[ u.id ] );
if ( u !== undefined ) u.setValue( gl, value, this.renderer );
if ( v !== undefined ) this.setValue( gl, name, v );
// note: always updating when .needsUpdate is undefined
u.setValue( gl, v.value, renderer );
p_uniforms.setValue( _gl, 'projectionMatrix', camera.projectionMatrix );
p_uniforms.setValue( _gl, 'logDepthBufFC',
2.0 / ( Math.log( camera.far + 1.0 ) / Math.LN2 ) );
uCamPos.setValue( _gl,
_vector3.setFromMatrixPosition( camera.matrixWorld ) );
p_uniforms.setValue( _gl, 'viewMatrix', camera.matrixWorldInverse );
p_uniforms.setValue( _gl, 'boneTexture', skeleton.boneTexture );
p_uniforms.setValue( _gl, 'boneTextureSize', skeleton.boneTextureSize );
p_uniforms.setValue( _gl, 'boneTexture', skeleton.boneTexture );
p_uniforms.setValue( _gl, 'boneTextureSize', skeleton.boneTextureSize );
p_uniforms.setValue( _gl, 'toneMappingExposure', _this.toneMappingExposure );
p_uniforms.setValue( _gl, 'toneMappingWhitePoint', _this.toneMappingWhitePoint );
p_uniforms.setValue( _gl, 'toneMappingExposure', _this.toneMappingExposure );
p_uniforms.setValue( _gl, 'toneMappingWhitePoint', _this.toneMappingWhitePoint );
p_uniforms.setValue( _gl, 'modelViewMatrix', object.modelViewMatrix );
p_uniforms.setValue( _gl, 'normalMatrix', object.normalMatrix );
p_uniforms.setValue( _gl, 'modelViewMatrix', object.modelViewMatrix );
p_uniforms.setValue( _gl, 'normalMatrix', object.normalMatrix );
p_uniforms.setValue( _gl, 'modelMatrix', object.matrixWorld );
p_uniforms.setValue( _gl, 'normalMatrix', object.normalMatrix );
p_uniforms.setValue( _gl, 'modelMatrix', object.matrixWorld );
binding.setValue( buffer, offset );
break;
var originalValueOffset = this.valueSize * 3;
this.binding.setValue( this.buffer, originalValueOffset );
bindings[ i ].setValue( array, offset );
this.bind();
this.setValue( sourceArray, offset );
@/lua/ge/extensions/core/input/bindings.lua
if oldMajor == 0 and oldMinor < 37 then
settings.setValue('showedInputLayoutPopupV37', false)
end
@/lua/ge/extensions/util/groundModelDebug.lua
local function setValue(name, gm, type, val)
gm.data[type] = val
if im.SliderInt("collisiontype", v.cdata.collisiontype, 0, 30) then
setValue(k, v, 'collisiontype', v.cdata.collisiontype[0])
end
if im.SliderFloat("defaultDepth", v.cdata.defaultDepth, 0.0, 5) then
setValue(k, v, 'defaultDepth', v.cdata.defaultDepth[0])
end
if im.SliderFloat("dragAnisotropy", v.cdata.dragAnisotropy, 0, 1, "%.2f") then
setValue(k, v, 'dragAnisotropy', v.cdata.dragAnisotropy[0])
end
if im.SliderFloat("flowBehaviorIndex", v.cdata.flowBehaviorIndex, 0, 5.0, "%.2f") then
setValue(k, v, 'flowBehaviorIndex', v.cdata.flowBehaviorIndex[0])
end
if im.SliderFloat("flowConsistencyIndex", v.cdata.flowConsistencyIndex, 0, 15000, "%.0f") then
setValue(k, v, 'flowConsistencyIndex', v.cdata.flowConsistencyIndex[0])
end
if im.SliderFloat("fluidDensity", v.cdata.fluidDensity, 0, 50000, "%.0f") then
setValue(k, v, 'fluidDensity', v.cdata.fluidDensity[0])
end
if im.SliderFloat("hydrodynamicFriction", v.cdata.hydrodynamicFriction, 0, 0.01, "%.4f") then
setValue(k, v, 'hydrodynamicFriction', v.cdata.hydrodynamicFriction[0])
end
-- if im.InputText("name", v.cdata.name) then
-- setValue(k, v, 'name', v.cdata.name[0])
-- end
if im.SliderFloat("roughnessCoefficient", v.cdata.roughnessCoefficient, 0, 1, "%.2f") then
setValue(k, v, 'roughnessCoefficient', v.cdata.roughnessCoefficient[0])
end
if im.SliderFloat("shearStrength", v.cdata.shearStrength, 0, 25000, "%.0f") then
setValue(k, v, 'shearStrength', v.cdata.shearStrength[0])
end
if im.Checkbox("skidMarks", v.cdata.skidMarks) then
setValue(k, v, 'skidMarks', v.cdata.skidMarks[0])
end
if im.SliderFloat("slidingFrictionCoefficient", v.cdata.slidingFrictionCoefficient, 0.1, 1.5, "%.2f") then
setValue(k, v, 'slidingFrictionCoefficient', v.cdata.slidingFrictionCoefficient[0])
end
if im.SliderFloat("staticFrictionCoefficient", v.cdata.staticFrictionCoefficient, 0.1, 2.0, "%.2f") then
setValue(k, v, 'staticFrictionCoefficient', v.cdata.staticFrictionCoefficient[0])
end
if im.SliderFloat("strength", v.cdata.strength, 0, 2, "%.2f") then
setValue(k, v, 'strength', v.cdata.strength[0])
end
if im.SliderFloat("stribeckVelocity", v.cdata.stribeckVelocity, 0, 7.5, "%.2f") then
setValue(k, v, 'stribeckVelocity', v.cdata.stribeckVelocity[0])
end
@/lua/ge/extensions/editor/api/core.lua
elseif type.type == varTypes.Setting then
settings.setValue(type.name, on)
end
@/lua/ge/extensions/scenario/scenarios.lua
local isMultiseat = scenario.playersCountRange.min > 1
settings.setValue('multiseat', isMultiseat)
local isMultiseat = scenario.playersCountRange.min > 1
settings.setValue('multiseat', isMultiseat)
@/lua/ge/extensions/gameplay/crashTest/scenarioManager.lua
else
settings.setValue('enableCrashCam', true)
extensions.load('freeroam_crashCamMode')
end
settings.setValue('enableCrashCam', oldCrashCamSettingValue)
end
@/lua/ge/extensions/gameplay/rally.lua
local newVal = clamp(current + tick, 1, 10)
settings.setValue('rallyCodriverTiming', newVal)
local msg = translateLanguage('ui.rally.codriverTiming', 'Codriver timing', true)
@/lua/ge/extensions/career/career.lua
debugSettings[mod.debugName] = not active
settings.setValue('careerDebugSettings', debugSettings)
end