GE Lua Documentation

Press F to search!

GetKeyIndex

Definition


-- @/=[C]:-1
function GetKeyIndex(...)

Callers

@/lua/ge/extensions/editor/rallyEditor/drivelineTab.lua

  local isShiftDown = im.IsKeyDown(im.GetKeyIndex(im.Key_ModShift))
  local isDelDown = im.IsKeyDown(im.GetKeyIndex(im.Key_Delete))
  local isShiftDown = im.IsKeyDown(im.GetKeyIndex(im.Key_ModShift))
  local isDelDown = im.IsKeyDown(im.GetKeyIndex(im.Key_Delete))
  local isMouseDown = im.IsMouseDown(0)
@/lua/ge/extensions/editor/sceneTree.lua
  if hasDragDropPayload then
    if imgui.IsKeyDown(imgui.GetKeyIndex(imgui.Key_Escape)) then
      hasDragDropPayload = false
@/lua/ge/extensions/editor/gen/ui.lua
					row[#row + 1] = {'Z', '...'}
					if im.IsKeyDown(im.GetKeyIndex(im.Key_Z)) then
						row = HTree[4]
@/lua/common/extensions/ui/imguiUtils.lua
      imgui.EndTooltip()
      if imgui.IsKeyPressed(imgui.GetKeyIndex(imgui.Key_PageUp)) then
        self.sampleTime = self.sampleTime + 0.05
        self.sampleTime = self.sampleTime + 0.05
      elseif imgui.IsKeyPressed(imgui.GetKeyIndex(imgui.Key_PageDown)) then
        self.sampleTime = math.max(0, self.sampleTime - 0.05)
@/lua/ge/extensions/editor/api/gui.lua
      end
      v[v_index] = v[v_index] - (imgui.IsKeyDown(imgui.GetKeyIndex(imgui.Key_ReservedForModCtrl)) and step_fast or step)
    end
      end
      v[v_index] = v[v_index] + (imgui.IsKeyDown(imgui.GetKeyIndex(imgui.Key_ReservedForModCtrl)) and step_fast or step)
    end
@/lua/common/extensions/ui/imgui_gen_luaintf.lua
--===
function M.GetKeyIndex(ImGuiKey_key) return imgui.GetKeyIndex(ImGuiKey_key) end
--===
function M.GetKeyIndex(ImGuiKey_key) return imgui.GetKeyIndex(ImGuiKey_key) end
@/lua/ge/extensions/editor/gen/exp_frame.lua
--------------------
    if im.IsKeyPressed(im.GetKeyIndex(im.Key_DownArrow)) then
--        lo('?? AD:')
    end
    if im.IsKeyPressed(im.GetKeyIndex(im.Key_Space)) then
        if cmove then
    end
    if im.IsKeyPressed(im.GetKeyIndex(im.Key_Escape)) then
--    if im.IsKeyPressed(im.GetKeyIndex(im.Key_Space)) then
    if im.IsKeyPressed(im.GetKeyIndex(im.Key_Escape)) then
--    if im.IsKeyPressed(im.GetKeyIndex(im.Key_Space)) then
        U.dump(dw, '>>>> DW:'..nmove..' L:'..L)
@/lua/ge/extensions/editor/biomeTool.lua
    end
    if imgui.IsKeyDown(imgui.GetKeyIndex(imgui.Key_Escape)) then
      imgui.CloseCurrentPopup()

    if imgui.IsKeyDown(imgui.GetKeyIndex(imgui.Key_Enter)) then
      syncSelectedBrushListFunc(enum_forestBrushItemZone.central)
    end
    if imgui.IsKeyDown(imgui.GetKeyIndex(imgui.Key_Escape)) then
      imgui.CloseCurrentPopup()
    end
    if imgui.IsKeyDown(imgui.GetKeyIndex(imgui.Key_Enter)) then
      syncSelectedBrushListFunc(enum_forestBrushItemZone.falloff)
      end
      if imgui.IsKeyDown(imgui.GetKeyIndex(imgui.Key_Escape)) then
        imgui.CloseCurrentPopup()

      if imgui.IsKeyDown(imgui.GetKeyIndex(imgui.Key_Enter)) then
        syncSelectedBrushListFunc(enum_forestBrushItemZone.edge)

  if imgui.IsKeyDown(imgui.GetKeyIndex(imgui.Key_Escape)) then
    isDrawingLassoArea = false
@/lua/ge/extensions/editor/toolUtilities/splineInput.lua
local joinDistSq = joinDist * joinDist
local altKeyIdx, ctrlKeyIdx, shiftKeyIdx = im.GetKeyIndex(im.Key_ModAlt), im.GetKeyIndex(im.Key_ModCtrl), im.GetKeyIndex(im.Key_ModShift)
local delKeyIdx, cKeyIdx, vKeyIdx = im.GetKeyIndex(im.Key_Delete), im.GetKeyIndex(im.Key_C), im.GetKeyIndex(im.Key_V)
local joinDistSq = joinDist * joinDist
local altKeyIdx, ctrlKeyIdx, shiftKeyIdx = im.GetKeyIndex(im.Key_ModAlt), im.GetKeyIndex(im.Key_ModCtrl), im.GetKeyIndex(im.Key_ModShift)
local delKeyIdx, cKeyIdx, vKeyIdx = im.GetKeyIndex(im.Key_Delete), im.GetKeyIndex(im.Key_C), im.GetKeyIndex(im.Key_V)
local joinDistSq = joinDist * joinDist
local altKeyIdx, ctrlKeyIdx, shiftKeyIdx = im.GetKeyIndex(im.Key_ModAlt), im.GetKeyIndex(im.Key_ModCtrl), im.GetKeyIndex(im.Key_ModShift)
local delKeyIdx, cKeyIdx, vKeyIdx = im.GetKeyIndex(im.Key_Delete), im.GetKeyIndex(im.Key_C), im.GetKeyIndex(im.Key_V)
local altKeyIdx, ctrlKeyIdx, shiftKeyIdx = im.GetKeyIndex(im.Key_ModAlt), im.GetKeyIndex(im.Key_ModCtrl), im.GetKeyIndex(im.Key_ModShift)
local delKeyIdx, cKeyIdx, vKeyIdx = im.GetKeyIndex(im.Key_Delete), im.GetKeyIndex(im.Key_C), im.GetKeyIndex(im.Key_V)
local typeScales = { -- The scale factors for the different hit types.
local altKeyIdx, ctrlKeyIdx, shiftKeyIdx = im.GetKeyIndex(im.Key_ModAlt), im.GetKeyIndex(im.Key_ModCtrl), im.GetKeyIndex(im.Key_ModShift)
local delKeyIdx, cKeyIdx, vKeyIdx = im.GetKeyIndex(im.Key_Delete), im.GetKeyIndex(im.Key_C), im.GetKeyIndex(im.Key_V)
local typeScales = { -- The scale factors for the different hit types.
local altKeyIdx, ctrlKeyIdx, shiftKeyIdx = im.GetKeyIndex(im.Key_ModAlt), im.GetKeyIndex(im.Key_ModCtrl), im.GetKeyIndex(im.Key_ModShift)
local delKeyIdx, cKeyIdx, vKeyIdx = im.GetKeyIndex(im.Key_Delete), im.GetKeyIndex(im.Key_C), im.GetKeyIndex(im.Key_V)
local typeScales = { -- The scale factors for the different hit types.
@/lua/ge/extensions/editor/gen/region.lua
	end
	if im.IsKeyPressed(im.GetKeyIndex(im.Key_Enter)) and out.inpave then
--        lo('??+++++++++++++++++++++++++++++++++++++++++++++++ region_to_GEN:'..#abase..':'..tostring(out.inpave))
@/lua/ge/extensions/editor/roadArchitect.lua
local keyIdx = {                                                                                    -- Relevant cached key indices.
  ctrl = im.GetKeyIndex(im.Key_ModCtrl),
  shift = im.GetKeyIndex(im.Key_ModShift),
  ctrl = im.GetKeyIndex(im.Key_ModCtrl),
  shift = im.GetKeyIndex(im.Key_ModShift),
  del = im.GetKeyIndex(im.Key_Delete),
  shift = im.GetKeyIndex(im.Key_ModShift),
  del = im.GetKeyIndex(im.Key_Delete),
  alt = im.GetKeyIndex(im.Key_ModAlt),
  del = im.GetKeyIndex(im.Key_Delete),
  alt = im.GetKeyIndex(im.Key_ModAlt),
  a = im.GetKeyIndex(im.Key_A),
  alt = im.GetKeyIndex(im.Key_ModAlt),
  a = im.GetKeyIndex(im.Key_A),
  c = im.GetKeyIndex(im.Key_C),
  a = im.GetKeyIndex(im.Key_A),
  c = im.GetKeyIndex(im.Key_C),
  v = im.GetKeyIndex(im.Key_V) }
  c = im.GetKeyIndex(im.Key_C),
  v = im.GetKeyIndex(im.Key_V) }
@/lua/ge/extensions/editor/dynamicDecals/layerStack.lua

  -- TODO: Use input action instead of im.IsKeyDown(im.GetKeyIndex(im.Key_ReservedForModCtrl)) as 'Ctrl' modifier
  if selectionData and selectionData[layer.uid] then
    if editor.uiIconImageButton(editor.icons.near_me, im.ImVec2(tool.getIconSize(), tool.getIconSize()), editor.color.beamng.Value, nil, nil, string.format("select##%s_%s", guiId, layer.uid)) then
      selection.deselectLayer(im.IsKeyDown(im.GetKeyIndex(im.Key_ReservedForModCtrl)) and layer.uid or nil)
    end
    if editor.uiIconImageButton(editor.icons.near_me, im.ImVec2(tool.getIconSize(), tool.getIconSize()), nil, nil, nil, string.format("select##%s_%s", guiId, layer.uid)) then
      selection.selectLayer(layer.uid, im.IsKeyDown(im.GetKeyIndex(im.Key_ReservedForModCtrl)))
    end
@/lua/ge/extensions/editor/util/transformUtil.lua
    onUpdate = function()
      if im.IsKeyDown(im.GetKeyIndex(im.Key_Escape)) then
        editor.selectEditMode(editor.editModes.objectSelect)
@/lua/ge/extensions/editor/forestEditor.lua
    end
    if im.IsKeyReleased(im.GetKeyIndex(im.Key_Escape)) == true then
      var.editingObject = nil
        end
        if im.IsKeyReleased(im.GetKeyIndex(im.Key_Escape)) then
          var.lassoPLNodes = {}
@/lua/ge/extensions/editor/vehicleDetailViewer.lua
    local wheel = im.GetIO().MouseWheel
    local isShiftHeld = im.IsKeyDown(im.GetKeyIndex(im.Key_ModShift))
    local isCtrlHeld = im.IsKeyDown(im.GetKeyIndex(im.Key_ModCtrl))
    local isShiftHeld = im.IsKeyDown(im.GetKeyIndex(im.Key_ModShift))
    local isCtrlHeld = im.IsKeyDown(im.GetKeyIndex(im.Key_ModCtrl))
@/lua/common/extensions/ui/imgui_custom_luaintf.lua

  -- GetKeyIndex() is a no-op since 1.87
  function M.GetKeyIndex(index)
  -- GetKeyIndex() is a no-op since 1.87
  function M.GetKeyIndex(index)
    return index
@/lua/ge/extensions/editor/resourceChecker.lua
                if im.IsItemHovered() and im.IsMouseClicked(0) then
                  if not im.IsKeyDown(im.GetKeyIndex(im.Key_ModShift)) then
                    isDoubleClicked = {}
                      if im.IsItemHovered() and im.IsMouseClicked(0) then
                        if not im.IsKeyDown(im.GetKeyIndex(im.Key_ModShift)) then
                          isDoubleClicked = {}
                            if im.IsItemHovered() and im.IsMouseClicked(0) then
                              if not im.IsKeyDown(im.GetKeyIndex(im.Key_ModShift)) then
                                isDoubleClicked = {}
      if im.IsItemHovered() and im.IsMouseClicked(0) then
        if not im.IsKeyDown(im.GetKeyIndex(im.Key_ModShift)) then
          isDoubleClicked = {}
@/lua/ge/extensions/editor/api/valueInspector.lua
      if io.KeyCtrl then
        if imgui.IsKeyPressed(imgui.GetKeyIndex(imgui.Key_C)) then
          setClipboard(jsonEncode({copiedValue = fieldValue, copiedFieldType = fieldType}))
        end
        if imgui.IsKeyPressed(imgui.GetKeyIndex(imgui.Key_V)) then
          local tbl = jsonDecodeSilent(getClipboard(), "ValueInspectorCopyPasteMenu")
@/lua/ge/extensions/editor/materialEditor.lua
              end
            elseif im.IsKeyReleased(im.GetKeyIndex(im.Key_Escape)) then
              -- Cancel mapTo picking.
@/lua/ge/extensions/editor/buildingEditor.lua
	--- KEYS
	if im.IsKeyPressed(im.GetKeyIndex(im.Key_X)) and editor.keyModifiers.ctrl then
		reload()

	if im.IsKeyPressed(im.GetKeyIndex(im.Key_Enter)) then
		W.onKey(im.Key_Enter)
	end
	if im.IsKeyPressed(im.GetKeyIndex(im.Key_Backspace)) then
		W.onKey(im.Key_Backspace)
	end
	if im.IsKeyPressed(im.GetKeyIndex(im.Key_Space)) then
		W.onKey(im.Key_Space)
	end
	if im.IsKeyPressed(im.GetKeyIndex(im.Key_Escape)) then
		W.onKey(im.Key_Escape)
	inpoint = false
	if im.IsKeyReleased(im.GetKeyIndex(im.Key_ModAlt)) == true then
--        lo('?? ALT_OFF:')
	end
	if im.IsKeyReleased(im.GetKeyIndex(im.Mod_Shift)) == true then
		W.keyShift(false)
		end
		if im.IsKeyPressed(im.GetKeyIndex(im.Key_X)) then
				lo('?? bE_RELOAD:')

	if im.IsKeyPressed(im.GetKeyIndex(im.Key_UpArrow)) then
		W.keyUD(1)
	end
	if im.IsKeyPressed(im.GetKeyIndex(im.Key_DownArrow)) then
		W.keyUD(-1)

	if im.IsKeyPressed(im.GetKeyIndex(im.Key_RightArrow)) then
		W.keyRL(1)
	end
	if im.IsKeyPressed(im.GetKeyIndex(im.Key_LeftArrow)) then
		W.keyRL(-1)
local function onEditorGui()
	if im.IsKeyPressed(im.GetKeyIndex(im.Key_X)) and editor.keyModifiers.ctrl then
--		print('?? to_RELOAD:')
@/lua/ge/extensions/editor/gen/exp_meshexplorer.lua
------------------------------
--	if U._PRD == 0 and im.IsKeyPressed(im.GetKeyIndex(im.Key_X)) and editor.keyModifiers.ctrl then
--		W.up(2,'X-Ray'..' (WIP)')
@/lua/ge/extensions/editor/gen/decal.lua
    if editor.keyModifiers.ctrl then
        if im.IsKeyPressed(im.GetKeyIndex(im.Key_Z)) then
--            lo('?? CTRL_Z:')
    end
    if im.IsKeyReleased(im.GetKeyIndex(im.Key_ModAlt)) then
        if U._MODE ~= 'conf' then out.aplot = nil end
    --- KEYBOARD
	if im.IsKeyPressed(im.GetKeyIndex(im.Key_RightArrow)) then
		incommand = {'right'}
	end
	if im.IsKeyPressed(im.GetKeyIndex(im.Key_LeftArrow)) then
        incommand = {'left'}
	end
	if im.IsKeyPressed(im.GetKeyIndex(im.Key_UpArrow)) then
		keyUD(1)
	end
	if im.IsKeyPressed(im.GetKeyIndex(im.Key_DownArrow)) then
		keyUD(-1)
	end
    if im.IsKeyPressed(im.GetKeyIndex(im.Key_Delete)) then
        if cjunc then
    end
    if im.IsKeyPressed(im.GetKeyIndex(im.Key_Enter)) then
        rdlist = editor.getAllRoads()
    if cpick and U._PRD == 0 and U._MODE ~= 'conf' then
        if im.IsKeyPressed(im.GetKeyIndex(im.Key_UpArrow)) then
            if tableSize(anodesel) == 1 and anodesel[1] then
            end
        elseif im.IsKeyPressed(im.GetKeyIndex(im.Key_DownArrow)) then
            local anode = editor.getNodes(croad)
            end
        elseif im.IsKeyPressed(im.GetKeyIndex(im.Key_RightArrow)) then
            -- mantle width up
            ter2road()
        elseif im.IsKeyPressed(im.GetKeyIndex(im.Key_LeftArrow)) then
            -- mantle width down
@/lua/ge/extensions/editor/dynamicDecals/textures.lua
local function handleTextureImageTileClicked(filePath, texturesFiles)
  if im.IsKeyDown(im.GetKeyIndex(im.Key_ReservedForModShift)) then
    local sel = editor.selection["dynamicDecalTexture"]
  end
  selectTextureFile({filePath}, im.IsKeyDown(im.GetKeyIndex(im.Key_ReservedForModCtrl)))
end
@/lua/ge/extensions/editor/gen/world.lua

	if U._PRD == 0 and im.IsKeyDown(im.GetKeyIndex(im.Key_Z)) then
			lo('?? wallSplit_HOR:')
--[[
		elseif editor.keyModifiers.ctrl and not im.IsKeyDown(im.GetKeyIndex(im.Key_Z)) then
		   lo('?? to_create:')
-- TOP SPLIT
					lo('?? for_top:'..tostring(im.IsKeyDown(im.GetKeyIndex(im.Key_Z))))
--                lo('?? rc:'..id..':'..tostring(rayCast.object)) --..rayCast.object.name)
				if cedit.cval['AltZ'] ~= nil then
--                if im.IsKeyDown(im.GetKeyIndex(im.Key_Z)) then
					intopchange = true
			end
		elseif not im.IsKeyDown(im.GetKeyIndex(im.Key_Z)) then
--                lo('?? corner_DRAG:'..tostring(editor.keyModifiers.ctrl), true)
	-- Z ------------
	elseif im.IsKeyDown(im.GetKeyIndex(im.Key_Z)) then
		if scope == 'building' then
		if editor.keyModifiers.shift then
	--    if im.IsKeyDown(im.GetKeyIndex(im.Key_Z)) then -- or im.IsKeyDown(im.GetKeyIndex(im.Key_X)) then
			indrag = true
		if editor.keyModifiers.shift then
	--    if im.IsKeyDown(im.GetKeyIndex(im.Key_Z)) then -- or im.IsKeyDown(im.GetKeyIndex(im.Key_X)) then
			indrag = true
--[[
		elseif not editor.keyModifiers.ctrl and not im.IsKeyDown(im.GetKeyIndex(im.Key_Z)) and cmesh ~= nil then
			if true then return end

	if nm == 'theTerrain' and not indrag and editor.keyModifiers.ctrl and not im.IsKeyDown(im.GetKeyIndex(im.Key_Z)) then
		lo('?? to_create:')
			cmouse = ray.pos + d*ray.dir
			if im.IsKeyDown(im.GetKeyIndex(im.Key_Z)) then
--            if editor.keyModifiers.ctrl then
				forBuilding(desc, function(w, ij)
					local dir = im.IsKeyDown(im.GetKeyIndex(im.Key_Z)) and w.v or w.u
					dir = dir:normalized()
					local line = line2rect(t, base2world(desc, ij), w.u, w.v,
						im.IsKeyDown(im.GetKeyIndex(im.Key_Z)) and 1 or 2)
					if line then
--[[
				if im.IsKeyDown(im.GetKeyIndex(im.Key_Z)) then
					if ({wall=1})[scope] then
--            lo('?? weelresz:'..tostring(cedit.cval['AltZ'][3]))
--        if im.IsKeyDown(im.GetKeyIndex(im.Key_Z)) then
			--            if editor.keyModifiers.shift then
		elseif scope == 'top' then
			if im.IsKeyPressed(im.GetKeyIndex(im.Key_Z)) then
--            if editor.keyModifiers.shift then
--    if tostring(key) == '525' then
	if key == im.GetKeyIndex(im.Key_Escape) then
		if cmesh ~= nil then
		end
	elseif key == im.GetKeyIndex(im.Key_Space) then
--    if key == im.Key_Space then
		M.save(amesh, 'save_'..id)
	elseif key == im.GetKeyIndex(im.Key_Backspace) and cmesh ~= nil then
			lo('?? onBack:'..#dmesh[cmesh].sel)
		end
	elseif key == im.GetKeyIndex(im.Key_Enter) then
		lo('??+++++++++++++++++++++++ for_ENT:')
--------------------
	if editor.keyModifiers.ctrl and im.IsKeyDown(im.GetKeyIndex(im.Key_Z)) then
--            lo('?? to_restoere:'..#asave..':'..tostring(cedit.mesh)..':'..tostring(inrollback))
	end
	if im.IsKeyReleased(im.GetKeyIndex(im.Key_Z)) then
--        lo('?? Z_up:')
	end
	if im.IsKeyReleased(im.GetKeyIndex(im.Key_ModCtrl)) then
--            lo('??^^^^^^^^^^^^^^ rb_BACK:',true)
	end
	if im.IsKeyPressed(im.GetKeyIndex(im.Key_Enter)) then
			lo('?? to_SAVE:')
	end
	if im.IsKeyPressed(im.GetKeyIndex(im.Key_Delete)) then
		if out.inhole then
	--------------------
	if im.IsKeyPressed(im.GetKeyIndex(im.Key_Backspace)) then
--        if csave > #asave then return end
	if editor.keyModifiers.ctrl then
--            lo('?? for_CTRL:'..tostring(im.IsKeyDown(im.GetKeyIndex(im.Key_J))))
		local desc = adesc[cedit.mesh]

		if im.IsKeyPressed(im.GetKeyIndex(im.Key_C)) then
-- TO COPY BUFFER
				U.dump(incopy[cedit.mesh], '?? copied:')
--        elseif im.IsKeyPressed(im.GetKeyIndex(im.Key_V)) then
		elseif im.IsKeyPressed(im.GetKeyIndex(im.Key_V)) then
--        elseif im.IsKeyPressed(im.GetKeyIndex(im.Key_V)) then
		elseif im.IsKeyPressed(im.GetKeyIndex(im.Key_V)) then
-- PASTE
		local dir
		if im.IsKeyDown(im.GetKeyIndex(im.Key_RightArrow)) then
			dir = 1
		end
		if im.IsKeyDown(im.GetKeyIndex(im.Key_LeftArrow)) then
			dir = -1
@/lua/ge/extensions/editor/toolUtilities/ribbonInput.lua
local zExtra = 0.05
local altKeyIdx = im.GetKeyIndex(im.Key_ModAlt)
local delKeyIdx = im.GetKeyIndex(im.Key_Delete)
local altKeyIdx = im.GetKeyIndex(im.Key_ModAlt)
local delKeyIdx = im.GetKeyIndex(im.Key_Delete)
@/lua/ge/extensions/editor/flowgraph/nodelibrary.lua
  -- Navigate the list with the keyboard
  --[[if im.IsKeyPressed(im.GetKeyIndex(im.Key_Enter)) then self.createNodeButtonListIndex = self.selectedButtonListIndex end
  if self.selectedButtonListIndex then
  if self.selectedButtonListIndex then
    if im.IsKeyPressed(im.GetKeyIndex(im.Key_UpArrow)) then
      self.selectedButtonListIndex = math.max(self.selectedButtonListIndex - 1, 1)
    end
    if im.IsKeyPressed(im.GetKeyIndex(im.Key_DownArrow)) then
      self.selectedButtonListIndex = math.min(self.selectedButtonListIndex + 1, self.numberOfButtons)
@/lua/ge/extensions/editor/toolUtilities/polygon.lua
local min, max = math.min, math.max
local delKeyIdx, altKeyIdx = im.GetKeyIndex(im.Key_Delete), im.GetKeyIndex(im.Key_ModAlt)
local lineSegGranInv = 1.0 / lineSegGran
local min, max = math.min, math.max
local delKeyIdx, altKeyIdx = im.GetKeyIndex(im.Key_Delete), im.GetKeyIndex(im.Key_ModAlt)
local lineSegGranInv = 1.0 / lineSegGran