@luminocity/lemonate-engine 26.3.2 → 26.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lemonate.es.js +10 -10
- package/dist/lemonate.js +10 -10
- package/dist/lemonate.min.js +2 -2
- package/dist/lemonate.umd.js +10 -10
- package/dist/player.zip +0 -0
- package/package.json +1 -1
package/dist/lemonate.es.js
CHANGED
|
@@ -41290,7 +41290,7 @@ class Item extends EventEmitter {
|
|
|
41290
41290
|
}
|
|
41291
41291
|
}
|
|
41292
41292
|
|
|
41293
|
-
var engine$1 = "26.3.
|
|
41293
|
+
var engine$1 = "26.3.4";
|
|
41294
41294
|
var bullet = "3.26";
|
|
41295
41295
|
var lua = "5.4.3";
|
|
41296
41296
|
var packageVersionInfo = {
|
|
@@ -120207,7 +120207,7 @@ class SgVehicle extends SgItem {
|
|
|
120207
120207
|
if (super.updateEvent(field, value, type, oldValue))
|
|
120208
120208
|
return true;
|
|
120209
120209
|
switch (field) {
|
|
120210
|
-
case "
|
|
120210
|
+
case "ChassisNode": {
|
|
120211
120211
|
this.vehicleData.chassis = value;
|
|
120212
120212
|
break;
|
|
120213
120213
|
}
|
|
@@ -130920,7 +130920,7 @@ var lua_api_datetime = "\nlocal Class = require('engine/class')\n\n---@class Dat
|
|
|
130920
130920
|
|
|
130921
130921
|
var lua_api_events = "\nlocal _internal = require('engine/_internal');\nlocal msgpack = require('engine/msgpack');\nlocal handle = require('engine/handle');\nlocal unpack = msgpack.unpack\n\n--- @module events\nlocal events = {}\nlocal listeners = {}\nlocal listenerIndex = 1\n\n---Start listening to events of a certain type. This method will take an event type and a function to call if the\n---event is triggered.\n---@param eventtype string Type of the event. See possible types of events below\n---@param func function function to call\nfunction events.on(eventtype, func)\n if type(func) == 'function' then\n local id = listenerIndex\n local listener = { id=id, func=func, eventtype=eventtype, once=false }\n listeners[id] = listener\n listenerIndex = listenerIndex + 1\n _internal.sendMessage('events.on', { eventtype=eventtype, id=id })\n else\n error(\"func parameter needs to be a function\")\n end\nend\n\n---Listen to the next event of a certain type. After the event is triggered once, the event listener will automatically\n---deactivate again. This method will take an event type and a function to call if the event is triggered.\n---@param eventtype string Type of the event. See possible types of events below\n---@param func function function to call\nfunction events.once(eventtype, func)\n if type(func) == 'function' then\n local id = listenerIndex\n local listener = { id=id, func=func, eventtype=eventtype, once=true }\n listeners[id] = listener\n listenerIndex = listenerIndex + 1\n _internal.sendMessage('events.once', { eventtype=eventtype, id=id })\n else\n error(\"func parameter needs to be a function\")\n end\nend\n\n---Stop listening to events of a certain type. Clears all events of the given type for this script entity.\n---@param eventtype string Type of the event\nfunction events.off(eventtype)\n local keys_to_remove = {}\n for id, listener in pairs(listeners) do\n if listener.eventtype == eventtype then\n table.insert(keys_to_remove, id)\n end\n end\n\n for _, id in ipairs(keys_to_remove) do\n listeners[id] = nil\n end\n\n _internal.sendMessage('events.off', { eventtype=eventtype })\nend\n\nfunction events.emitExternal(eventtype, value)\n _internal.sendMessage('events.emitExternal', { eventtype=eventtype, value=value })\nend\n\nfunction events._translate(e)\n e = unpack(e)\n\n --- Translate handles to an actual object\n if type(e.event.handle) == 'table' then\n local object = handle.createObject(e.event.handle)\n if object == nil then\n error(\"events._translate(): Cannot translate handle to object, because it is invalid!\")\n end\n e.event.object = object\n e.event.handle = nil\n end\n\n return e;\nend\n\nfunction events._processIncoming(e)\n\n --- Translate handles to an actual object\n if type(e.event.handle) == 'table' then\n local object = handle.createObject(e.event.handle)\n if object == nil then\n error(\"events._processIncoming(): Cannot translate handle to object, because it is invalid!\")\n end\n e.event.object = handle.createObject(e.event.handle)\n e.event.handle = nil\n end\n\n local listener = listeners[e.listenerId]\n if listener then\n listener.func(e.event)\n end\nend\n\nreturn events\n";
|
|
130922
130922
|
|
|
130923
|
-
var lua_api_handle = "\nlocal handle = {}\n\
|
|
130923
|
+
var lua_api_handle = "\nlocal handle = {}\n\n--local objectCache = {}\n\nfunction handle.createObject(h)\n if h == nil then\n return nil\n end\n if h and h._isHandle then\n --if objectCache[h.id] then\n -- return objectCache[h.id]\n --end\n local path = 'engine/' .. h.basetype .. 's/' .. h.type\n local Type = require(path)\n if not Type then\n print(\"handle.createObject(): Type not found!\", path)\n return nil\n end\n if type(Type.new) == 'function' then\n local obj = Type.new(h.id, h.nodeId)\n --objectCache[h.id] = obj\n return obj\n else\n print(\"handle.createObject(): Type found but fromHandle function is missing!\", path)\n printDump(Type)\n return nil\n end\n else\n print(debug.traceback())\n print(\"handle.createObject(): Not a valid handle!\", h)\n return nil\n end\nend\n\nfunction handle.invalidate(id)\n --if id and objectCache[id] then\n -- objectCache[id] = nil\n --end\nend\n\nreturn handle\n";
|
|
130924
130924
|
|
|
130925
130925
|
var lua_api_imgui = "\nlocal _internal = require('engine/_internal');\n\n--- @module ImGui\nlocal ImGui = {}\n\n--- Enumeration of the available backend flags.\n--- @enum BackendFlags\n--- @field None number No flag set.\n--- @field HasGamepad number Backend platform supports gamepad and currently has one connected.\n--- @field HasMouseCursors number Backend platform supports honoring GetMouseCursor() value to change the OS cursor shape.\n--- @field HasSetMousePos number Backend platform supports io.WantSetMousePos requests to reposition the OS mouse position (only used if ImGuiConfigFlags_NavEnableSetMousePos is set).\n--- @field RendererHasVtxOffset number Backend renderer supports ImDrawCmd::VtxOffset. This enables output of large meshes (64K+ vertices) while still using 16-bit indices.\nImGui.BackendFlags = {\n None = 0,\n HasGamepad = 1 << 0,\n HasMouseCursors = 1 << 1,\n HasSetMousePos = 1 << 2,\n RendererHasVtxOffset = 1 << 3\n}\n\n--- Enumeration of the available configuration flags.\n--- @enum ConfigFlags\n--- @field None number No flag set.\n--- @field NavEnableKeyboard number Enable keyboard controls.\n--- @field NavEnableGamepad number Enable gamepad controls.\n--- @field NavEnableSetMousePos number Enable mouse repositioning requests with io.WantSetMousePos.\n--- @field NavNoCaptureKeyboard number Disable keyboard capture by ImGui.\n--- @field NoMouse number Disable mouse controls.\n--- @field NoMouseCursorChange number Disable mouse cursor change requests.\n--- @field IsSRGB number Enable sRGB gamma correction.\n--- @field IsTouchScreen number Enable touch screen controls.\nImGui.ConfigFlags = {\n None = 0,\n NavEnableKeyboard = 1 << 0,\n NavEnableGamepad = 1 << 1,\n NavEnableSetMousePos = 1 << 2,\n NavNoCaptureKeyboard = 1 << 3,\n NoMouse = 1 << 4,\n NoMouseCursorChange = 1 << 5,\n IsSRGB = 1 << 20,\n IsTouchScreen = 1 << 21\n}\n\n--- Sets the global window padding for all windows.\n--- @param x number Padding for the x-axis.\n--- @param y number Padding for the y-axis.\nfunction ImGui.setGlobalWindowPadding(x, y)\n _internal.sendMessage('imgui.setGlobalWindowPadding', { x=x, y=y })\nend\n\n--- Sets the global window rounding for all windows.\n--- @param r number Rounding value.\nfunction ImGui.setGlobalWindowRounding(r)\n _internal.sendMessage('imgui.setGlobalWindowRounding', { r=r })\nend\n\n--- Sets the global frame padding for all windows.\n--- @param x float Padding for the x-axis.\n--- @param y float Padding for the y-axis.\nfunction ImGui.setGlobalFramePadding(x, y)\n _internal.sendMessage('imgui.setGlobalFramePadding', { x=x, y=y })\nend\n\n--- Sets the global frame rounding for all windows.\n--- @param r number Rounding value.\nfunction ImGui.setGlobalFrameRounding(r)\n _internal.sendMessage('imgui.setGlobalFrameRounding', { r=r })\nend\n\n--- Sets the global item spacing for all windows.\n--- @param x number Spacing for the x-axis.\n--- @param y number Spacing for the y-axis.\nfunction ImGui.setGlobalItemSpacing(x, y)\n _internal.sendMessage('imgui.setGlobalItemSpacing', { x=x, y=y })\nend\n\n--- Sets the global item inner spacing for all windows.\n--- @param x number Inner spacing for the x-axis.\n--- @param y number Inner spacing for the y-axis.\nfunction ImGui.setGlobalItemInnerSpacing(x, y)\n _internal.sendMessage('imgui.setGlobalItemInnerSpacing', { x=x, y=y })\nend\n\n--- Sets the global indent spacing for all windows.\n--- @param value number Indent spacing value.\nfunction ImGui.setGlobalIndentSpacing(value)\n _internal.sendMessage('imgui.setGlobalIndentSpacing', { value=value })\nend\n\n--- Sets the global scrollbar size for all windows.\n--- @param value number Scrollbar size value.\nfunction ImGui.setGlobalScrollbarSize(value)\n _internal.sendMessage('imgui.setGlobalScrollbarSize', { value=value })\nend\n\n--- Sets the global scrollbar rounding for all windows.\n--- @param value number The value of the scrollbar rounding.\nfunction ImGui.setGlobalScrollbarRounding(value)\n _internal.sendMessage('imgui.setGlobalScrollbarRounding', { value=value })\nend\n\n--- Sets the global minimum width/height of a grab box for slider/scrollbar for all windows.\n--- @param value number The value of the minimum grab.\nfunction ImGui.setGlobalGrabMinSize(value)\n _internal.sendMessage('imgui.setGlobalGrabMinSize', { value=value })\nend\n\n--- Sets the global radius of grabs corners rounding for all windows. Set to 0.0 to have rectangular slider grabs.\n--- @param value number The value of grabs corners rounding.\nfunction ImGui.setGlobalGrabRounding(value)\n _internal.sendMessage('imgui.setGlobalGrabRounding', { value=value })\nend\n\n--- Enumeration of the available window flags.\n--- @enum WindowFlags\n--- @field None number No flag set.\n--- @field NoTitleBar number Window doesn't have a title bar.\n--- @field NoResize number Window can't be resized.\n--- @field NoMove number Window can't be moved.\n--- @field NoScrollbar number Window has no scrollbar.\n--- @field NoScrollWithMouse number Window scrollbar doesn't respond to mouse scrolling.\n--- @field NoCollapse number Window can't be collapsed.\n--- @field AlwaysAutoResize number Window should resize to its content every frame.\n--- @field ShowBorders number Window has borders.\n--- @field NoSavedSettings number Never save settings (inodependent of ImGuiConfigFlags_NoSaveSettings).\n--- @field NoMouseInputs number Window will not receive mouse inputs.\n--- @field MenuBar number Window has a menu-bar.\n--- @field HorizontalScrollbar number Window has a horizontal scrollbar.\n--- @field NoFocusOnAppearing number Window doesn't take focus when first appearing.\n--- @field NoBringToFrontOnFocus number Window doesn't bring to front when taking focus.\n--- @field AlwaysVerticalScrollbar number Window has a vertical scrollbar.\n--- @field AlwaysHorizontalScrollbar number Window has a horizontal scrollbar.\n--- @field AlwaysUseWindowPadding number Ensure child windows without border uses style.WindowPadding (ignored by default for non-bordered child windows, because more convenient).\n--- @field NoNavInputs number No gamepad/keyboard navigation within the window.\n--- @field NoNavFocus number No focusing toward this window with gamepad/keyboard navigation (e.g. skipped by CTRL+TAB).\n--- @field UnsavedDocument number Display a dot next to the title. When used in a tab/docking context, tab is selected when clicking the X + closure is not assumed (will wait for user to stop submitting the tab). Otherwise closure is assumed when pressing the X, so if you keep submitting the tab may reappear at end of tab bar.\n--- @field NoNav number No gamepad/keyboard navigation within the window and no focusing toward this window with gamepad/keyboard navigation.\n--- @field NoDecoration number Disable title-bar, resizing borders, and scrollbar.\n--- @field NoInputs number Window is completely sealed and won't receive inputs.\nImGui.WindowFlags = {\n None = 0,\n NoTitleBar = 1 << 0,\n NoResize = 1 << 1,\n NoMove = 1 << 2,\n NoScrollbar = 1 << 3,\n NoScrollWithMouse = 1 << 4,\n NoCollapse = 1 << 5,\n AlwaysAutoResize = 1 << 6,\n ShowBorders = 1 << 7,\n NoSavedSettings = 1 << 8,\n NoMouseInputs = 1 << 9,\n MenuBar = 1 << 10,\n HorizontalScrollbar = 1 << 11,\n NoFocusOnAppearing = 1 << 12,\n NoBringToFrontOnFocus = 1 << 13,\n AlwaysVerticalScrollbar = 1 << 14,\n AlwaysHorizontalScrollbar = 1 << 15,\n AlwaysUseWindowPadding = 1 << 16,\n NoNavInputs = 1 << 18,\n NoNavFocus = 1 << 19,\n UnsavedDocument = 1 << 20,\n NoNav = 1 << 18 | 1 << 19,\n NoDecoration = 1 << 0 | 1 << 1 | 1 << 3 | 1 << 5,\n NoInputs = 1 << 9 | 1 << 18 | 1 << 19\n}\n\n--- Begins a new dialog.\n--- @param text string The title of the dialog.\n--- @param x number The x coordinate of the dialog (optional).\n--- @param y number The y coordinate of the dialog (optional).\n--- @param flags WindowFlags Configuration flags.\nfunction ImGui.beginDialog(text, x, y, flags)\n return _internal.sendMessage('imgui.beginDialog', { text=text, x=x, y=y, flags=flags })\nend\n\n--- Ends the current dialog.\n--- @function\nfunction ImGui.endDialog()\n _internal.sendMessage('imgui.endDialog')\nend\n\n--- Begins the main menu bar. See `Menubar example`_.\n--- @return boolean Return true if the main menu bar is open, otherwise false.\nfunction ImGui.beginMainMenuBar()\n return _internal.sendMessage('imgui.beginMainMenuBar')\nend\n\n--- Ends the current main menu bar.\n--- @function\nfunction ImGui.endMainMenuBar()\n _internal.sendMessage('imgui.endMainMenuBar')\nend\n\n--- Begins a new menu-bar inside current window.\n--- To be displayed correctly, the dialog parent needs to have\n--- the ImGui.WindowFlags.MenuBar flag enabled. See `Menubar example`_.\n--- @return boolean Return true if the menu bar is open, otherwise false.\nfunction ImGui.beginMenuBar()\n return _internal.sendMessage('imgui.beginMenuBar')\nend\n\n--- Ends the current menu bar.\n--- @function\nfunction ImGui.endMenuBar()\n _internal.sendMessage('imgui.endMenuBar')\nend\n\n--- Begins a new menu.\n--- @param label string the label of the menu. See `Menubar example`_.\n--- @return boolean Return true if the menu is open, otherwise false.\nfunction ImGui.beginMenu(label)\n return _internal.sendMessage('imgui.beginMenu', { label=label})\nend\n\n--- Ends the current menu.\n--- @function\nfunction ImGui.endMenu()\n _internal.sendMessage('imgui.endMenu')\nend\n\n--- Creates a new menu item.\n--- @param mainLabel string The main label of the menu item.\n--- @param secondaryLabel string The secondary label of the menu item.\n--- @return boolean Return true if the menu item is pressed, otherwise false.\nfunction ImGui.menuItem(mainLabel, secondaryLabel)\n return _internal.sendMessage('imgui.menuItem', { mainLabel=mainLabel, secondaryLabel=secondaryLabel })\nend\n\n--- Begins a child window. See `Group Child example`_ for a full example\n--- @param label string the label of the child window.\nfunction ImGui.beginChild(label)\n _internal.sendMessage('imgui.beginChild', { label=label})\nend\n\n--- Ends the current child window.\n--- @function\nfunction ImGui.endChild()\n _internal.sendMessage('imgui.endChild')\nend\n\n--- Begins a new group of items. See `Group Child example`_ for a full example\n--- @function\nfunction ImGui.beginGroup()\n _internal.sendMessage('imgui.beginGroup')\nend\n\n--- Ends the current group of items.\n--- @function\nfunction ImGui.endGroup()\n _internal.sendMessage('imgui.endGroup')\nend\n\n--- Begins a new table. See `Table example`_ for a full example.\n--- @param mode string The mode of the table.\n--- @param number number The number of the table.\n--- @return boolean Return true if the table is open, otherwise false.\nfunction ImGui.beginTable(mode, number)\n return _internal.sendMessage('imgui.beginTable', { mode=mode, number=number })\nend\n\n--- Ends the current table.\n--- @function\nfunction ImGui.endTable()\n _internal.sendMessage('imgui.endTable')\nend\n\n--- Appends into into the next row of the table.\n--- @function\nfunction ImGui.tableNextRow()\n _internal.sendMessage('imgui.tableNextRow')\nend\n\n--- Appends into into the next column of the table.\n--- @function\nfunction ImGui.tableNextColumn()\n _internal.sendMessage('imgui.tableNextColumn')\nend\n\n--- Moves to the next row in the table.\n--- @function\nfunction ImGui.tableNextRow()\n _internal.sendMessage('imgui.tableNextRow')\nend\n\n--- Moves to the next column in the table.\n--- @function\nfunction ImGui.moveToNextColumn()\n _internal.sendMessage('imgui.moveToNextColumn')\nend\n\n--- Sets a cell in the table.\n--- @param label string The label of the cell.\nfunction ImGui.tableSetCell(label)\n _internal.sendMessage('imgui.tableSetCell', { label=label })\nend\n\n--- Creates the specified number of columns in the current window.\n--- @param numberCols number The number of columns.\nfunction ImGui.createColumns(numberCols)\n _internal.sendMessage('imgui.createColumns', { numberCols=numberCols })\nend\n\n--- Enumeration of available tab bar flags.\n--- @enum TabBarFlags\n--- @field None number No flags.\n--- @field Reorderable number Allow manually dragging tabs to re-order them + New tabs are appended at the end of list.\n--- @field AutoSelectNewTabs number Automatically select new tabs when they appear.\n--- @field TabListPopupButton number Disable buttons to open the tab list popup.\n--- @field NoCloseWithMiddleMouseButton number Disable behavior of closing tabs (that are submitted with p_open != NULL) with middle mouse button.\n--- @field NoTabListScrollingButtons number Disable scrolling buttons (apply when fitting policy is ImGuiTabBarFlags_FittingPolicyScroll).\n--- @field NoTooltip number Disable tooltips when hovering a tab.\n--- @field FittingPolicyResizeDown number Resize tabs when they don't fit.\n--- @field FittingPolicyScroll number Add scroll buttons when tabs don't fit.\n--- @field FittingPolicyMask number Fitting policy mask (defaults to ImGuiTabBarFlags_FittingPolicyResizeDown | ImGuiTabBarFlags_FittingPolicyScroll).\n--- @field FittingPolicyDefault number Fitting policy when there are no tabs.\nImGui.TabBarFlags = {\n None = 0,\n Reorderable = 1,\n AutoSelectNewTabs = 2,\n TabListPopupButton = 4,\n NoCloseWithMiddleMouseButton = 8,\n NoTabListScrollingButtons = 16,\n NoTooltip = 32,\n FittingPolicyResizeDown = 64,\n FittingPolicyScroll = 128,\n FittingPolicyMask = 64 + 128,\n FittingPolicyDefault = 64\n}\n\n--- Begins a new tab bar. See `Tabbar example`_ for a full example.\n--- @param label string The label of the tab bar.\n--- @param flags TabBarFlags Configuration flags.\n--- @return boolean Return true if the tab bar is open, otherwise false.\nfunction ImGui.beginTabBar(label, flags)\n return _internal.sendMessage('imgui.beginTabBar', { label=label, flags=flags })\nend\n\n--- Ends the current tab bar.\n--- @function\nfunction ImGui.endTabBar()\n _internal.sendMessage('imgui.endTabBar')\nend\n\n--- Begins a new tab item.\n--- @param label string The label of the tab item.\n--- @param flags TabBarFlags Configuration flags.\n--- @return boolean Return true if the tab item is open, otherwise false.\nfunction ImGui.beginTabItem(label, flags)\n return _internal.sendMessage('imgui.beginTabItem', { label=label, flags=flags })\nend\n\n--- Ends the current tab item.\n--- @function\nfunction ImGui.endTabItem()\n _internal.sendMessage('imgui.endTabItem')\nend\n\n--- Begins a new tooltip.\n--- @function\nfunction ImGui.beginTooltip()\n _internal.sendMessage('imgui.beginTooltip')\nend\n\n--- Ends the current tab item.\n--- @function\nfunction ImGui.endTooltip()\n _internal.sendMessage('imgui.endTooltip')\nend\n\n--- Enumeration of available popup flags.\n--- @enum PopupFlags\n--- @field None number No flag set.\n--- @field MouseButtonLeft number Open on Left Mouse release.\n--- @field MouseButtonRight number Open on Right Mouse release.\n--- @field MouseButtonMiddle number Open on Middle Mouse release.\n--- @field MouseButtonMask number Bit mask for buttons.\n--- @field MouseButtonDefault number Open on MouseButtonRight Mouse release (default).\n--- @field NoOpenOverExistingPopup number Don't open if there's already a popup at the same level of the popup stack.\n--- @field NoOpenOverItems number Don't return true when hovering items, only when hovering empty space.\n--- @field AnyPopupId number Ignore the ImGuiID parameter and test for any popup.\n--- @field AnyPopupLevel number Search/test at any level of the popup stack.\nImGui.PopupFlags = {\n None = 0,\n MouseButtonLeft = 0, -- Open on Left Mouse release\n MouseButtonRight = 1, -- Open on Right Mouse release\n MouseButtonMiddle = 2, -- Open on Middle Mouse release\n MouseButtonMask = 31,\n MouseButtonDefault = 1,\n NoOpenOverExistingPopup = 1 << 5, -- Don't open if there's already a popup at the same level of the popup stack\n NoOpenOverItems = 1 << 6, -- Don't return true when hovering items, only when hovering empty space\n AnyPopupId = 1 << 7, -- Ignore the ImGuiID parameter and test for any popup\n AnyPopupLevel = 1 << 8, -- Search/test at any level of the popup stack\n}\n\n--- Begins a new popup window. See `Popup example`_ for a full example.\n--- @param label string The label of the pop up item.\n--- @param flags PopupFlags Configuration flags.\n--- @return boolean Return true if the popup is open, otherwise false.\nfunction ImGui.beginPopup(label, flags)\n return _internal.sendMessage('imgui.beginPopup', { label=label, flags=flags })\nend\n\n--- Ends the current popup window.\n--- @function\nfunction ImGui.endPopup()\n _internal.sendMessage('imgui.endPopup')\nend\n\n--- Opens a popup window identified by the label.\n--- @function\nfunction ImGui.openPopup(label)\n _internal.sendMessage('imgui.openPopup', { label=label })\nend\n\n--- Closes the current popup window.\n--- @function\nfunction ImGui.closeCurrentPopup()\n _internal.sendMessage('imgui.closeCurrentPopup')\nend\n\n--- Begins a new modal popup window.\n--- @param label string The label of the pop up modal item.\n--- @param flags PopupFlags Configuration flags.\n--- @return boolean Return true if the popup is open, otherwise false.\nfunction ImGui.beginPopupModal(label, flags)\n return _internal.sendMessage('imgui.beginPopupModal', { label=label, flags=flags })\nend\n\n--- Displays text to the current window.\n--- @param text string The text to be displayed.\nfunction ImGui.text(text)\n _internal.sendMessage('imgui.text', { text=text })\nend\n\n--- Displays text to the current window with a given color.\n--- @param text string the text to be displayed.\n--- @param color WidgetColor An instance of WidgetColor.\nfunction ImGui.textColored(text, color)\n _internal.sendMessage('imgui.textColored', { text=text, colorId=color.idx })\nend\n\n--- Displays wrapped text to the current window\n--- @param text string The text to be displayed.\nfunction ImGui.textWrapped(text)\n _internal.sendMessage('imgui.textWrapped', { text=text })\nend\n\n--- Enumeration for input text flags.\n--- @enum InputTextFlags\n--- @field None number No flags.\n--- @field CharsDecimal number Allow decimals and operators (0123456789.+-/).\n--- @field CharsHexadecimal number Allow decimals, operators ad letters (0123456789ABCDEFabcdef).\n--- @field CharsUppercase number Turn lowercase letters into uppercase.\n--- @field CharsNoBlank number Filter out spaces, tabs.\n--- @field AutoSelectAll number Select entire text when first taking mouse focus.\n--- @field EnterReturnsTrue number Return 'true' when Enter is pressed (as opposed to every time the value was modified).\n--- @field CallbackCompletion number Callback on pressing TAB (for completion handling).\n--- @field CallbackHistory number Callback on pressing Up/Down arrows (for history handling).\n--- @field CallbackAlways number Callback on each iteration. User code may query cursor position, modify text buffer.\n--- @field CallbackCharFilter number Callback on character inputs to replace or discard them. Modify 'EventChar' to replace or discard, or return 1 in callback to discard.\n--- @field AllowTabInput number Pressing TAB input a '\\t' character into the text field.\n--- @field CtrlEnterForNewLine number In multi-line mode, unfocus with Enter, add new line with Ctrl+Enter (default is opposite unfocus with Ctrl+Enter, add line with Enter).\n--- @field NoHorizontalScroll number Disable following the cursor horizontally.\n--- @field AlwaysOverwrite number Overwrite mode.\n--- @field ReadOnly number Read-only mode.\n--- @field Password number Password mode, display all characters as ''.\n--- @field NoUndoRedo number Disable undo/redo. Note that input text owns the text data while active, if you want to provide your own undo/redo stack you need e.g. to call ClearActiveID().\n--- @field CharsScientific number Allow scientific notation input (0123456789.+-\\*/eE).\n--- @field CallbackResize number Callback on buffer capacity changes request (beyond 'buf_size' parameter value), allowing the string to grow.\n--- @field CallbackEdit number Callback on any edit.\n--- @field EscapeClearsAll number Clears the input when Escape key is pressed.\nImGui.InputTextFlags = {\n None = 0,\n CharsDecimal = 1 << 0,\n CharsHexadecimal = 1 << 1,\n CharsUppercase = 1 << 2,\n CharsNoBlank = 1 << 3,\n AutoSelectAll = 1 << 4,\n EnterReturnsTrue = 1 << 5,\n CallbackCompletion = 1 << 6,\n CallbackHistory = 1 << 7,\n CallbackAlways = 1 << 8,\n CallbackCharFilter = 1 << 9,\n AllowTabInput = 1 << 10,\n CtrlEnterForNewLine = 1 << 11,\n NoHorizontalScroll = 1 << 12,\n AlwaysOverwrite = 1 << 13,\n ReadOnly = 1 << 14,\n Password = 1 << 15,\n NoUndoRedo = 1 << 16,\n CharsScientific = 1 << 17,\n CallbackResize = 1 << 18,\n CallbackEdit = 1 << 19,\n EscapeClearsAll = 1 << 20\n}\n\n--- Creates a text input widget.\n--- @param label string the label to add to the input widget.\n--- @param widgetString WidgetString An intance of WidgetString to interact with the inputText widget.\n--- @param flags InputTextFlags The flags to be used for the input label (optional).\n--- @usage\n--- local gui = require 'engine/imgui'\n--- widgetString = gui.WidgetString:new(32, \"\")\n--- gui.inputText(\"your name\", widgetString)\nfunction ImGui.inputText(label, widgetString, flags)\n _internal.sendMessage('imgui.inputText', { label=label, bufferId=widgetString.idx, flags=flags })\nend\n\n--- Creates a number input widget.\n--- @param label string the label to add to the input widget.\n--- @param widgetNumber WidgetNumber An intance of WidgetString to interact with the inputNumber widget.\n--- @param flags InputTextFlags The flags to be used for the input label (optional). They are the same for InputText.\n--- @usage\n--- local gui = require 'engine/imgui'\n--- widgetNumber = gui.WidgetNumber:new(42)\n--- gui.inputNumber(\"Answer to The Ultimate Question of Life\", widgetNumber)\nfunction ImGui.inputNumber(label, widgetNumber, flags)\n _internal.sendMessage('imgui.inputNumber', { label=label, bufferId=widgetNumber.idx, flags=flags })\nend\n\n--- Creates a bullet point with accompanying text.\n--- @param text string The text to display next to the bullet point.\nfunction ImGui.bulletText(text)\n _internal.sendMessage('imgui.bulletText', { text=text})\nend\n\n--- Increases the horizontal indent of the subsequent widgets by a certain amount.\nfunction ImGui.indent()\n _internal.sendMessage('imgui.indent')\nend\n\n--- Decreases the horizontal indent of the subsequent widgets by a certain amount.\nfunction ImGui.unindent()\n _internal.sendMessage('imgui.unindent')\nend\n\n--- @class WidgetString\n--- A class to internally store strings to be used in the Lumino Lua environment.\nlocal WidgetString = {\n _isWidgetString = true,\n _type = \"WidgetString\"\n}\n\n--- Creates a new WidgetString object with the given length and initial value.\n--- @param length number The length (in bytes) of the buffer where the string is stored.\n--- @param initialValue string The initial value of the string.\nfunction WidgetString:new(length, initialValue)\n local idx = _internal.sendMessage('imgui.createStringBuffer', { length = length, initialValue = initialValue })\n local obj = { idx = idx, length = length }\n self.__index = self\n Class.__setmetatable(obj, self)\n return obj\nend\n\n--- Retrieves the value stored inside an instance of WidgetString.\n--- @return string The string stored inside the instance of WidgetString.\nfunction WidgetString:getValue()\n __assertTrace(self._isWidgetString, \"self is not a WidgetString\")\n return _internal.sendMessage('imgui.getStringBufferValue', { bufferId = self.idx })\nend\n\n--- Sets a new internal value to an instance of WidgetString.\n--- @param value string The value to set the widget string to.\nfunction WidgetString:setValue(value)\n __assertTrace(self._isWidgetString, \"self is not a WidgetString\")\n return _internal.sendMessage('imgui.setStringBuffer', { value = value, bufferId = self.idx })\nend\n\n--- Concatenation operator for WidgetString. It also accepts primitive strings.\n--- @param other WidgetString|string The other WidgetString or string to concatenate with.\n--- @return string The concatenated string.\nfunction WidgetString.__concat(self, other)\n if type(self) == \"string\" then\n return self .. other:getValue()\n elseif type(other) == \"string\" then\n return self:getValue() .. other\n elseif getmetatable(self) == WidgetString and getmetatable(other) == WidgetString then\n return self:getValue() .. other:getValue()\n else\n error(\"One argument must be a WidgetString instance. The second argument must be a WidgetString instance or a string\")\n end\nend\n\n--- Equality operator for WidgetString.\n--- @param other WidgetString|string The other WidgetString or string to compare with.\n--- @return boolean True if the values are equal.\nfunction WidgetString.__eq(self, other)\n if type(other) == \"string\" then\n return self:getValue() == other\n elseif getmetatable(other) == WidgetString then\n return self:getValue() == other:getValue()\n else\n return false\n end\nend\n\n--- Hook that runs before an object is deleted by the garbage collector.\n--- It calls a function to delete the WidgetString object in JS\n--- @private\nfunction WidgetString:__gc()\n _internal.sendMessage('imgui.freeStringBuffer', { bufferId = self.idx })\nend\n\n--- Returns the string representation of the WidgetString.\n--- @return string The string value.\nfunction WidgetString:__tostring()\n return self:getValue()\nend\n\n-- Add the WidgetString class to the ImGui namespace\nImGui.WidgetString = WidgetString\n\n--- @class WidgetNumber\n--- A class to internally store numbers to be used in the Lumino Lua environment.\nlocal WidgetNumber = {\n _isWidgetNumber = true,\n _type = \"WidgetNumber\"\n}\n\n--- Creates a new WidgetNumber object with the given initial value\n--- @param initialValue number The initial value stored internally.\nfunction WidgetNumber:new(initialValue)\n -- Store the WidgetNumber object in a field of the class instance metatable\n local idx = _internal.sendMessage('imgui.createWidgetNumber', { initialValue = initialValue })\n local obj = { idx = idx}\n self.__index = self\n Class.__setmetatable(obj, self)\n -- Return the instance\n return obj\nend\n\n--- Retrieves the value stored inside an instance of WidgetNumber.\n--- @return number The value interally stored inside the widget number.\nfunction WidgetNumber:getValue()\n __assertTrace(self._isWidgetNumber, \"self is not a WidgetNumber\")\n return _internal.sendMessage('imgui.getWidgetNumber', { numberId = self.idx })\nend\n\n--- Sets a new internal value to an instance of WidgetNumber.\n--- @param value number The value to set the widget number to.\nfunction WidgetNumber:setValue(value)\n __assertTrace(self._isWidgetNumber, \"self is not a WidgetNumber\")\n return _internal.sendMessage('imgui.setWidgetNumber', { value = value, numberId = self.idx })\nend\n\n--- Sum operator for widgetNumber. It also accepts primitive number.\n--- @param other WidgetNumber The other WidgetNumber (or number) to add to.\n--- @return number The sum of the two values.\nfunction WidgetNumber.__add(self, other)\n if type(self) == \"number\" then\n return self + other:getValue()\n elseif type(other) == \"number\" then\n return self:getValue() + other\n elseif getmetatable(self) == WidgetNumber and getmetatable(other) == WidgetNumber then\n return self:getValue() + other:getValue()\n else\n error(\"One argument must be a WidgetNumber instance. \\\n The second argument must be a WidgetNumber instance or a number\")\n end\nend\n\n--- Multiplication operator for widgetNumber. It also accepts primitive number.\n--- @param other WidgetNumber The other `WidgetNumber` instance to multiply to.\n--- @return number the product of the two values.\nfunction WidgetNumber.__mul(self, other)\n assert(self._isWidgetNumber, \"self is not a WidgetNumber\")\n if type(other) == \"number\" then\n return self:getValue() * other\n elseif type(self) == \"number\" then\n return self * other:getValue()\n elseif getmetatable(other) == WidgetNumber and getmetatable(self) == WidgetNumber then\n return self:getValue() * other:getValue()\n else\n error(\"One argument must be a WidgetNumber instance. \\\n The second argument must be a WidgetNumber instance or a number\")\n end\nend\n\n--- Hook that runs before an object is deleted by the garbage collector.\n--- It calls a function to delete the WidgetNumber object in JS\n--- @private\nfunction WidgetNumber:__gc()\n _internal.sendMessage('imgui.freeWidgetNumber', { numberId = self.idx })\nend\n-- Add the WidgetNumber class to the Nk.Canvas namespace\nImGui.WidgetNumber = WidgetNumber\n\n--- @class WidgetVector3\n--- A class to internally store a 3D vector to be used in the Lumino Lua environment.\nlocal WidgetVector3 = {\n _isWidgetVector3 = true,\n _type = \"WidgetVector3\"\n}\n\n--- Creates a new WidgetVector3 object with the given initial values for x, y, z.\n--- @param x number The initial x component value.\n--- @param y number The initial y component value.\n--- @param z number The initial z component value.\n--- @return WidgetVector3 A new WidgetVector3 instance.\nfunction WidgetVector3:new(x, y, z)\n -- Store the WidgetVector3 object in a field of the class instance metatable\n local idx = _internal.sendMessage('imgui.createWidgetVector3', { x = x, y = y, z = z })\n local obj = { idx = idx, x = x, y = y, z = z }\n self.__index = self\n Class.__setmetatable(obj, self)\n -- Return the instance\n return obj\nend\n\n--- Retrieves the vector components stored inside an instance of WidgetVector3.\n--- @return number x The X component\n--- @return number y The Y component\n--- @return number z The Z component\nfunction WidgetVector3:getValue()\n assert(self._isWidgetVector3, \"self is not a WidgetVector3\")\n local values = _internal.sendMessage('imgui.getWidgetVector3', { vectorId = self.idx })\n self.x = values.x\n self.y = values.y\n self.z = values.z\n return self.x, self.y, self.z\nend\n\n--- Sets new internal values for the x, y, z components of an instance of WidgetVector3.\n--- @param x number The x component to set.\n--- @param y number The y component to set.\n--- @param z number The z component to set.\nfunction WidgetVector3:setValue(x, y, z)\n assert(self._isWidgetVector3, \"self is not a WidgetVector3\")\n self.x, self.y, self.z = x, y, z\n _internal.sendMessage('imgui.setWidgetVector3', { x = x, y = y, z = z, vectorId = self.idx })\nend\n\n--- Addition operator for WidgetVector3. It also accepts primitive number.\n--- @param other WidgetVector3 The other WidgetVector3 (or number) to add to.\n--- @return WidgetVector3 The sum of the two vectors.\nfunction WidgetVector3.__add(self, other)\n assert(self._isWidgetVector3, \"self is not a WidgetVector3\")\n if type(other) == \"number\" then\n return WidgetVector3:new(self.x + other, self.y + other, self.z + other)\n elseif getmetatable(other) == WidgetVector3 then\n return WidgetVector3:new(self.x + other.x, self.y + other.y, self.z + other.z)\n else\n error(\"One argument must be a WidgetVector3 instance. The other must be a WidgetVector3 instance or a number\")\n end\nend\n\n--- Subtraction operator for WidgetVector3. It also accepts primitive number.\n--- @param other WidgetVector3 The other WidgetVector3 (or number) to subtract from.\n--- @return WidgetVector3 The difference between the two vectors.\nfunction WidgetVector3.__sub(self, other)\n assert(self._isWidgetVector3, \"self is not a WidgetVector3\")\n if type(other) == \"number\" then\n return WidgetVector3:new(self.x - other, self.y - other, self.z - other)\n elseif getmetatable(other) == WidgetVector3 then\n return WidgetVector3:new(self.x - other.x, self.y - other.y, self.z - other.z)\n else\n error(\"One argument must be a WidgetVector3 instance. The other must be a WidgetVector3 instance or a number\")\n end\nend\n\n--- Hook that runs before an object is deleted by the garbage collector.\n--- It calls a function to delete the WidgetVector3 object in JS.\n--- @private\nfunction WidgetVector3:__gc()\n _internal.sendMessage('imgui.freeWidgetVector3', { vectorId = self.idx })\nend\n\n-- Add the WidgetVector3 class to the ImGui namespace\nImGui.WidgetVector3 = WidgetVector3\n\n--- Creates a new progress bar.\n--- @param status number Progress status (0.0f to 1.0f) to represent in the progress bar.\nfunction ImGui.progressBar(status)\n _internal.sendMessage('imgui.progressBar', { status=status })\nend\n\n--- Enumeration for slider flags\n--- @enum SliderFlags\n--- @field None number No flag set.\n--- @field AlwaysClamp number Clamp value to min/max bounds when input manually with CTRL+Click. By default CTRL+Click allows going out of bounds.\n--- @field Logarithmic number Make the widget logarithmic (linear otherwise). Consider using ImGuiSliderFlags_NoRoundToFormat with this if using a format-string with small amount of digits.\n--- @field NoRoundToFormat number Disable rounding underlying value to match precision of the display format string (e.g. %.3f values are rounded to those 3 digits).\n--- @field NoInput number Disable CTRL+Click or Enter key allowing to input text directly into the widget.\nImGui.SliderFlags = {\n None = 0,\n AlwaysClamp = 1 << 4,\n Logarithmic = 1 << 5,\n NoRoundToFormat = 1 << 6,\n NoInput = 1 << 7\n}\n\n--- Creates a new float slider.\n--- @param label string the label to add to the slider.\n--- @param number WidgetNumber The widgetNumber to use as storage.\n--- @param minValue number the minimum value for the slider.\n--- @param maxValue number the maximum value for the slider.\n--- @param format string format of the string in the slider. The default if omitted is \"%f\".\n--- @param flags SliderFlags The flags to be used for the slider (optional).\nfunction ImGui.sliderFloat(label, number, minValue, maxValue, format, flags)\n assert(number._isWidgetNumber, \"number is not a WidgetNumber\")\n _internal.sendMessage('imgui.sliderFloat', { label=label, numberId=number.idx, minValue=minValue, maxValue=maxValue, format=format, flags=flags })\nend\n\n--- Creates a new integer slider.\n--- @param label string The label to add to the slider.\n--- @param number WidgetNumber The widgetNumber to use as storage.\n--- @param minValue number The minimum value for the slider.\n--- @param maxValue number The maximum value for the slider.\n--- @param format string The format of the string in the slider. The default if omitted is \"%d\".\n--- @param flags SliderFlags The flags to be used for the slider (optional).\nfunction ImGui.sliderInt(label, number, minValue, maxValue, format, flags)\n assert(number._isWidgetNumber, \"number is not a WidgetNumber\")\n _internal.sendMessage('imgui.sliderInt', { label=label, numberId=number.idx, minValue=minValue, maxValue=maxValue, format=format, flags=flags })\nend\n\n--- Creates a set of three sliders for manipulating a vector3 object.\n--- @param label string The label to display next to the sliders.\n--- @param widgetVector3 WidgetVector3 The vector3 widget object.\n--- @param minValue number The minimum value for the slider.\n--- @param maxValue number The maximum value for the slider.\n--- @param format string The format of the string in the slider. The default if omitted is \"%f\".\n--- @param flags SliderFlags The flags to be used for the slider (optional).\nfunction ImGui.sliderVector3(label, vector, minValue, maxValue, format, flags)\n assert(vector._isWidgetVector3, \"vector is not a WidgetVector3\")\n _internal.sendMessage('imgui.sliderVector3', { label=label, vectorId=vector.idx, minValue=minValue, maxValue=maxValue, format=format, flags=flags })\nend\n\n--- Creates a new button.\n--- @param text string The text to be displayed on the button.\n--- @param width number The width of the button (optional).\n--- @param height number The height of the button (optional).\n--- @return boolean Returns true if the button was clicked, otherwise false.\nfunction ImGui.button(text, width, height)\n return _internal.sendMessage('imgui.button', { text=text, width=width, height=height })\nend\n\n--- Logs button events in the ImGui interface.\n--- @function\nfunction ImGui.logButtons()\n _internal.sendMessage('imgui.logButtons')\nend\n\n--- Logs the current ImGui interface to the clipboard. Useful for debugging.\n--- @function\nfunction ImGui.logToClipboard()\n _internal.sendMessage('imgui.logToClipboard')\nend\n\n--- Stops logging events in the ImGui interface.\n--- @function\nfunction ImGui.logFinish()\n _internal.sendMessage('imgui.logFinish')\nend\n\n--- Logs a text in the ImGui interface.\n--- @param text string the text to log\nfunction ImGui.logText(text)\n _internal.sendMessage('imgui.logText', { text=text})\nend\n\n--- Adds an horizontal separator between items.\n--- @function\nfunction ImGui.separator()\n _internal.sendMessage('imgui.separator')\nend\n\n--- Adds horizontal spacing between items.\n--- @function\nfunction ImGui.spacing()\n _internal.sendMessage('imgui.spacing')\nend\n\n--- The next item will be created on the same line.\n--- @param spacing number The spacing between items in pixels. If not given, the default spacing is used.\n--- @param offset number The X position where the next item should start in window coordiantes. If not given, the item is placed right after the previous one.\nfunction ImGui.sameLine(spacing, offset)\n _internal.sendMessage('imgui.sameLine', { offset=offset, spacing=spacing})\nend\n\n--- Enum for selectable flags\n--- @enum SelectableFlags\n--- @field None number No flag set.\n--- @field DontClosePopups number Clicking this doesn't close parent popup window.\n--- @field SpanAllColumns number Selectable frame can span all columns (text will still fit in current column).\n--- @field AllowDoubleClick number Generate press events on double clicks too.\n--- @field Disabled number Cannot be selected, display grayed out text.\n--- @field AllowItemOverlap number (WIP) Hit testing to allow subsequent widgets to overlap this one.\nImGui.SelectableFlags = {\n None = 0,\n DontClosePopups = 1 << 0,\n SpanAllColumns = 1 << 1,\n AllowDoubleClick = 1 << 2,\n Disabled = 1 << 3,\n AllowItemOverlap = 1 << 4\n}\n\n--- Creates a selectable item.\n--- @param text string Text in the selectable item.\n--- @param flags SelectableFlags Configuration flags.\nfunction ImGui.selectable(text, flags)\n _internal.sendMessage('imgui.selectable', { text=text, flags=flags })\nend\n\n--- Creates a new checkbox.\n--- @param label string The label of the checkbox.\n--- @param number WidgetNumber The widgetNumber to use as storage.\nfunction ImGui.checkbox(label, number)\n assert(number._isWidgetNumber, \"number is not a WidgetNumber\")\n _internal.sendMessage('imgui.checkbox', { label=label, numberId=number.idx })\nend\n\n--- Creates a new checkbox to enable/disable flags.\n--- @param label string The label of the checkbox.\n--- @param flags ConfigFlags Configuration flags.\nfunction ImGui.checkboxFlags(label, flags)\n _internal.sendMessage('imgui.checkboxFlags', { label=label, flags=flags })\nend\n\n--- Creates a combo box with a list of items to choose from.\n--- @param label string The label of the combo box.\n--- @param number WidgetNumber The widgetNumber to use as storage. Note that arrays in ImGUI\n--- are indexed from 0 and arrays in Lua are indexed from 1. You will need to offset the arrays.\n--- @param items array An array of strings to use as options.\nfunction ImGui.combo(label, number, items)\n -- TODO\n -- Lua starts counting arrays from 1. The number is offset by this value\n -- but it doesn't look like there's any way to directly correct it without\n -- touching imgui source code...we could do some \"hack\" like hardcoding\n -- an empty element into the array\n -- table.insert(items, 1, \"\")\n -- number.idx + 1\n _internal.sendMessage('imgui.combo', { label=label, numberId=number.idx, items=items })\nend\n\n--- Creates a collapsing header with a given label.\n--- @param label string The label of the header.\n--- @return boolean Return true if the header is open, false if it is closed.\nfunction ImGui.collapsingHeader(label)\n return _internal.sendMessage('imgui.collapsingHeader', { label=label })\nend\n\n--- Creates a tree node.\n--- @param label string The label of the tree node.\n--- @return boolean A boolean indicating whether the tree node is open.\n--- @usage\n--- local gui = require 'engine/imgui'\n--- local TreeBehaviour = Class.new(Behaviour)\n--- \n--- function TreeBehaviour:rendergui()\n--- gui.beginDialog(\"Tree Example\")\n--- \n--- if gui.treeNode(\"Click to expand\") then\n--- if gui.isItemToggledOpen() then\n--- gui.text(\"Just opened!\")\n--- end\n--- gui.text(\"Some content...\")\n--- gui.treePop()\n--- end\n--- \n--- gui.endDialog()\n--- end\n--- return TreeBehaviour\nfunction ImGui.treeNode(label)\n return _internal.sendMessage('imgui.treeNode', { label=label })\nend\n\n--- Ends the current tree node.\n--- Called after `treeNode()`, it ends a tree node and automatically\n--- pops it from the ImGui tree structure.\n--- @function\n--- @see treeNode()\nfunction ImGui.treePop()\n _internal.sendMessage('imgui.treePop')\nend\n\n--- Add a tree node to the GUI with the given label.\n--- @param label string The label to display on the tree node.\nfunction ImGui.treePush(label)\n _internal.sendMessage('imgui.treePush', { label=label })\nend\n\n--- @class WidgetColor\n--- A class to internally link numbers to be used in the Dear ImGui api from the Lumino codebase to Lua environment.\nlocal WidgetColor = {}\n\n--- Creates a new WidgetColor object with the given RGBA values. The RGBA values range from 0 to 1.\n--- @param r number The red color component channel.\n--- @param g number The green color component channel.\n--- @param b number The blue color component channel.\n--- @param a number The alpha color component channel.\n--- @return WidgetColor A new WidgetColor instance.\nfunction WidgetColor:new(r, g, b, a)\n -- Store the WidgetColor object in a field of the class instance metatable\n local idx = _internal.sendMessage('imgui.createWidgetColor', { r=r, g=g, b=b, a=a })\n local obj = { idx = idx,\n r = r,\n g = g,\n b = b,\n a = a}\n self.__index = self\n Class.__setmetatable(obj, self)\n -- Return the instance\n return obj\nend\n\n--- Retrieves the RGBA components stored inside an instance of WidgetColor. The RGBA values range from 0 to 1.\n--- @return number r Red component\n--- @return number g Green component\n--- @return number b Blue component\n--- @return number a Alpha component\nfunction WidgetColor:getValue()\n local values = _internal.sendMessage('imgui.getWidgetColor', { colorId = self.idx })\n self.r = values.r\n self.g = values.g\n self.b = values.b\n self.a = values.a\n return self.r, self.g, self.b, self.a\nend\n\n--- Sets new internal values for the r, g, b, a components of an instance of WidgetColor. The RGBA values range from 0 to 1.\n--- @param r number The r component to set.\n--- @param g number The g component to set.\n--- @param b number The b component to set.\n--- @param a number The a component to set.\nfunction WidgetColor:setValue(r, g, b, a)\n self.r, self.g, self.b, self.a = r, g, b, a\n _internal.sendMessage('imgui.setWidgetColor', { r = r, g = g, b = b, a = a, colorId = self.idx })\nend\n\n--- Hook that runs before an object is deleted by the garbage collector.\n--- It calls a function to delete the WidgetColor object in JS\n--- @private\nfunction WidgetColor:__gc()\n _internal.sendMessage('imgui.freeWidgetColor', { colorId = self.idx })\nend\n-- Add the WidgetColor class to the Nk.Canvas namespace\nImGui.WidgetColor = WidgetColor\n\n--- Enumeration of flags for the color editing widgets.\n--- @enum ColorEditFlags\n--- @field None number No flag set.\n--- @field NoAlpha number ColorEdit, ColorPicker, ColorButton: ignore Alpha component (will only read 3 components from the input pointer).\n--- @field NoPicker number ColorEdit: disable picker when clicking on color square.\n--- @field NoOptions number ColorEdit: disable toggling options menu when right-clicking on inputs/small preview.\n--- @field NoSmallPreview number ColorEdit, ColorPicker: disable color square preview next to the inputs. (e.g. to show only the inputs)\n--- @field NoInputs number ColorEdit, ColorPicker: disable inputs sliders/text widgets (e.g. to show only the small preview color square).\n--- @field NoTooltip number ColorEdit, ColorPicker, ColorButton: disable tooltip when hovering the preview.\n--- @field NoLabel number ColorEdit, ColorPicker: disable display of inline text label (the label is still forwarded to the tooltip and picker).\n--- @field NoSidePreview number ColorPicker: disable bigger color preview on right side of the picker, use small color square preview instead.\n--- @field NoDragDrop number ColorEdit: disable drag and drop target. ColorButton: disable drag and drop source.\n--- @field NoBorder number ColorButton: disable border (which is enforced by default)\n--- @field AlphaBar number ColorEdit, ColorPicker: show vertical alpha bar/gradient in picker.\n--- @field AlphaPreview number ColorEdit, ColorPicker, ColorButton: display preview as a transparent color over a checkerboard, instead of opaque.\n--- @field AlphaPreviewHalf number ColorEdit, ColorPicker, ColorButton: display half opaque / half checkerboard, instead of opaque.\n--- @field HDR number ColorEdit: Currently only disable 0.0f..1.0f limits in RGBA edition (note: you probably want to use ImGuiColorEditFlags_Float flag as well).\n--- @field DisplayRGB number ColorEdit: override display type among RGB.\n--- @field DisplayHSV number ColorEdit: override display type among HSV.\n--- @field DisplayHex number ColorEdit: override display type among Hex.\n--- @field Uint8 number Display values formatted as 0..255.\n--- @field Float number Display values formatted as 0.0f..1.0f floats instead of 0..255 integers. No round-trip of value via integers.\n--- @field PickerHueBar number Display a bar for Hue and rectangle for Sat/Value.\n--- @field PickerHueWheel number Display a wheel for Hue and triangle for Sat/Value.\n--- @field InputRGB number Input and output data in RGB format.\n--- @field InputHSV number Input and output data in HSV format.\nImGui.ColorEditFlags = {\n None = 0,\n NoAlpha = 1 << 1,\n NoPicker = 1 << 2,\n NoOptions = 1 << 3,\n NoSmallPreview = 1 << 4,\n NoInputs = 1 << 5,\n NoTooltip = 1 << 6,\n NoLabel = 1 << 7,\n NoSidePreview = 1 << 8,\n NoDragDrop = 1 << 9,\n NoBorder = 1 << 10,\n AlphaBar = 1 << 16,\n AlphaPreview = 1 << 17,\n AlphaPreviewHalf = 1 << 18,\n HDR = 1 << 19,\n DisplayRGB = 1 << 20,\n DisplayHSV = 1 << 21,\n DisplayHex = 1 << 22,\n Uint8 = 1 << 23,\n Float = 1 << 24,\n PickerHueBar = 1 << 25,\n PickerHueWheel = 1 << 26,\n InputRGB = 1 << 27,\n InputHSV = 1 << 28\n}\n\n--- Creates a color picker.\n--- @param label string The label of the color picker.\n--- @param color WidgetColor An instance of WidgetColor.\n--- @param flag ColorEditFlags User given flags to change the behaviour the behaviour of the widget.\n--- @usage\n--- local gui = Nk.ImGui\n--- gui.beginDialog(\"Color picker\")\n--- gui.colorPicker(\"Pick a color\", color1)\n--- gui.spacing()\n--- gui.colorEdit(\"Edit a color\", color2)\n--- gui.endDialog()\nfunction ImGui.colorPicker(label, color, flags)\n _internal.sendMessage('imgui.colorPicker', { label=label, colorId=color.idx, flags=flags })\nend\n\n--- Creates a color edit. Similar to ColorPicker\n--- @param label string The label of the color picker.\n--- @param color WidgetColor An instance of WidgetColor.\n--- @param flag ColorEditFlags User given flags to change the behaviour of the widget.\nfunction ImGui.colorEdit(label, color, flags)\n _internal.sendMessage('imgui.colorEdit', { label=label, colorId=color.idx, flags=flags })\nend\n\n--- Sets the position of the next window.\n--- @param x number The x-coordinate of the window position.\n--- @param y number The y-coordinate of the window position.\nfunction ImGui.setNextWindowPos(x, y)\n _internal.sendMessage('imgui.setNextWindowPos', { x=x, y=y })\nend\n\n--- Sets the size of the next window.\n--- @param x number Width of the window.\n--- @param y number Height of the window.\nfunction ImGui.setNextWindowSize(x, y)\n _internal.sendMessage('imgui.setNextWindowSize', { x=x, y=y })\nend\n\n--- Sets the content size of the ColorEditFlagsnext window.\n--- @param x number Width of the window content\n--- @param y number Height of the window content\nfunction ImGui.setNextWindowContentSize(x, y)\n _internal.sendMessage('imgui.setNextWindowContentSize', { x=x, y=y })\nend\n\n--- Sets the size constraints of the next window.\n--- @param x number Minimum width of the window.\n--- @param y number Minimum height of the window.\nfunction ImGui.setNextWindowSizeConstraints(minX, minY, maxX, maxY)\n _internal.sendMessage('imgui.setNextWindowSizeConstraints', { minX=minX, minY=minY, maxX=maxX, maxY=maxY })\nend\n\n--- Sets the collapsed state of the next window.\n--- @param collapsed boolean Whether the window should be collapsed or not.\nfunction ImGui.setNextWindowCollapsed(collapsed)\n _internal.sendMessage('imgui.setNextWindowCollapsed', { collapsed=collapsed })\nend\n\n--- Sets the focus state of the next window.\n--- @param focused boolean Whether the window should be focused or not.\nfunction ImGui.setNextWindowFocus()\n _internal.sendMessage('imgui.setNextWindowFocus')\nend\n\n--- Sets the background alpha value of the next window.\n--- @param alpha number The alpha value of the background, between 0 and 1.\nfunction ImGui.setNextWindowBgAlpha(alpha)\n _internal.sendMessage('imgui.setNextWindowBgAlpha', { alpha=alpha })\nend\n\n--- Determines if the current item is hovered by the mouse cursor. For an example, see `Item State Example`_.\n--- @return boolean True if the current item is being hovered by the mouse cursor, false otherwise.\nfunction ImGui.isItemHovered()\n return _internal.sendMessage('imgui.isItemHovered')\nend\n\n--- Determines if the current item has been clicked. For an example, see `Item State Example`_.\n--- @return boolean True if the current item has been clicked, false otherwise.\nfunction ImGui.isItemClicked()\n return _internal.sendMessage('imgui.isItemClicked')\nend\n\n--- Determines if the current item is open. For an example, see `Item State Example`_.\n--- @return boolean True if the current item is toggled open, false otherwise.\nfunction ImGui.isItemToggledOpen()\n return _internal.sendMessage('imgui.isItemToggledOpen')\nend\n\n--- Enumeration for mouse button events.\n--- @enum MouseButton\n--- @field Left number Index for the left mouse button.\n--- @field Right number Index for the right mouse button.\n--- @field Middle number Index for the middle mouse button.\n--- @field COUNT number The number of mouse buttons.\nImGui.MouseButton = {\n Left = 0,\n Right = 1,\n Middle = 2,\n COUNT = 5\n}\n\n--- Enumeration of mouse cursor types for use with SetMouseCursor().\n--- @enum MouseCursor\n--- @field None number No cursor.\n--- @field Arrow number Arrow cursor.\n--- @field TextInput number Text input I-beam cursor.\n--- @field ResizeAll number (Unused by Dear ImGui functions).\n--- @field ResizeNS number Vertical resize cursor.\n--- @field ResizeEW number Horizontal resize cursor.\n--- @field ResizeNESW number Cursor for resizing bottom-left corner of window.\n--- @field ResizeNWSE number Cursor for resizing bottom-right corner of window.\n--- @field Hand number Sets mouse cursor to hand.\n--- @field NotAllowed number Cursor for disallowed interaction (usually a crossed circle).\n--- @field COUNT number Number of cursor types.\nImGui.MouseCursor = {\n None = -1,\n Arrow = 0,\n TextInput = 1,\n ResizeAll = 2,\n ResizeNS = 3,\n ResizeEW = 4,\n ResizeNESW = 5,\n ResizeNWSE = 6,\n Hand = 7,\n NotAllowed = 8,\n COUNT = 9\n}\n\n--- Returns true if the mouse was clicked on the given event.\n--- @param event MouseButton The event for which to check for a mouse click.\nfunction ImGui.isMouseClicked(event)\n return _internal.sendMessage('imgui.isMouseClicked', { event=event })\nend\n\n--- Sets the mouse cursor to the given cursor type.\n--- @param cursor MouseCursor The cursor type to set.\nfunction ImGui.setMouseCursor(cursor)\n _internal.sendMessage('imgui.setMouseCursor', { cursor=cursor })\nend\n\n--- Hook that runs before an object is deleted by the garbage collector.\n--- Cleanup resources and shut down the user interface\n--- @private\nfunction ImGui:__gc()\n _internal.sendMessage('imgui.shutdown')\nend\n\nreturn ImGui\n";
|
|
130926
130926
|
|
|
@@ -130988,13 +130988,13 @@ var lua_api_renderer = "\nlocal _internal = require('engine/_internal');\nlocal
|
|
|
130988
130988
|
|
|
130989
130989
|
var lua_api_sceneentry = "\nlocal Class = require('engine/class')\nlocal _internal = require('engine/_internal');\n\n--- @class SceneEntry\nlocal SceneEntry = Class.new()\n\nSceneEntry._id = nil\n\n--- Hook for the Class type when a new object is created\n---@private\nfunction SceneEntry:__new(id)\n self._id = id\nend\n\n--- Load the scene\nfunction SceneEntry:load()\n self:setLoaded(true)\nend\n\n--- Unload the scene\nfunction SceneEntry:unload()\n self:setLoaded(false)\nend\n\n--- Activate the scene, meaning it will be rendered\nfunction SceneEntry:activate()\n self:setActivated(true)\nend\n\n--- Deactivate the scene, meaning it will not be rendered anymore\nfunction SceneEntry:deactivate()\n self:setActivated(false)\nend\n\n--- Set the activation state of the scene. An active scene will be rendered, an inactive one won't\n---@param value boolean true or false\nfunction SceneEntry:setActivated(value)\n _internal.sendMessage('sceneentry.setActivated', { id = self._id, value = value })\nend\n\n--- Set the loading state of the scene. An unloaded scene will not be rendered and freed from memory\n---@param value boolean true or false\nfunction SceneEntry:setLoaded(value)\n _internal.sendMessage('sceneentry.setLoaded', { id = self._id, value = value })\nend\n\n--- Returns the activation state of the scene\n---@return boolean Activation state\nfunction SceneEntry:isActive()\n return _internal.sendMessage('sceneentry.isActive', { id = self._id })\nend\n\n--- Returns the loading state of the scene\n---@return boolean Loading state\nfunction SceneEntry:isLoaded()\n return _internal.sendMessage('sceneentry.isLoaded', { id = self._id })\nend\n\nreturn SceneEntry\n";
|
|
130990
130990
|
|
|
130991
|
-
var lua_api_sceneobject = "\nlocal _internal = require('engine/_internal');\nlocal Object = require 'engine/object'\nlocal handle = require 'engine/handle'\nlocal Transform = require 'engine/math/transform'\nlocal Vector3 = require 'engine/math/vector3'\nlocal Tools = require 'engine/tools'\nlocal Promise = require 'engine/promise'\n\n------------------------------------------------------------------\n-- SceneObject class\n------------------------------------------------------------------\n\n--- @class SceneObject\nlocal SceneObject = Class.new(Object)\nSceneObject._isSceneObject = true\nSceneObject._type = \"SceneObject\"\n\n--- Enumeration of the available types to use with SceneObject.create()\n--- @enum Type\nSceneObject.Type = {\n Audio = \"SgAudio\",\n AudioListener = \"AudioListener\",\n Billboard = \"SgBillboard\",\n Box = \"SgBox\",\n Camera = \"SgCamera\",\n CircleShadow = \"SgCircleShadow\",\n Cone = \"SgCone\",\n Cylinder = \"SgCylinder\",\n GaussianSplats = \"SgGaussianSplats\",\n Group = \"SgGroup\",\n Lightsource = \"SgLightsource\",\n Mesh = \"SgMesh\",\n Particles = \"SgParticles\",\n Plane = \"SgPlane\",\n Points = \"SgPoints\",\n PositionalAudio = \"SgPositionalAudio\",\n Prefab = \"SgPrefab\",\n Ring = \"SgRing\",\n Scene = \"Scene\",\n Sky = \"SgSky\",\n Sphere = \"SgSphere\",\n Text = \"SgText\",\n Torus = \"SgTorus\",\n Vehicle = \"SgVehicle\"\n}\n\n---@private\nfunction SceneObject:__new(handle, nodeId)\n Object.__new(self, handle)\n self._type = \"SceneObject\"\n self._isSceneObject = true\n self._nodeId = nodeId\nend\n\nfunction capitalizeFirstLetter(str)\n local firstChar = str:sub(1, 1)\n if firstChar:lower() == firstChar then\n firstChar = firstChar:upper()\n return firstChar .. str:sub(2)\n end\n return str\nend\n\n---@private\nfunction SceneObject:__customIndex(key)\n -- any private properties of scene objects start with an underscore. if so, just use rawget, otherwise\n -- get the value of the field from the engine and return it\n local value = rawget(self, key)\n if value or type(key) ~= 'string' or string.sub(key, 1, 1) == '_' then\n return value\n else\n return self:get(key)\n end\nend\n\n---@private\nfunction SceneObject:__customNewIndex(key, value)\n -- any private properties of scene objects start with an underscore. if so, just use rawset, otherwise\n -- write the value to the field in the engine\n if type(key) ~= 'string' or string.sub(key, 1, 1) == '_' then\n rawset(self, key, value)\n else\n self:set(key, value)\n end\nend\n\n--- Finds all objects with the given name.\n---\n--- The search can be restricted to a specific hierarchy by passing a `root` node.\n--- If no `root` is provided, the search covers the entire scene.\n---\n--- This function supports both static and instance usage:\n---\n--- **Static call**\n--- SceneObject.findAllByName(name root?)\n--- - Searches the entire scene unless a `root` node is provided.\n---\n--- **Instance call**\n--- obj:findAllByName(name, root?)\n--- - Uses `obj` as the root of the search unless an explicit `root`\n--- argument is passed.\n--- - Ideal when searching only within a specific hierarchy.\n---\n--- @param name string Name of the objects in the scenegraph.\n--- @param root (optional) SceneObject The root node to restrict the search to.\n--- @return table A table containing all found objects, or an empty table if none are found.\n--- @usage\n--- -- Global search\n--- local objects = SceneObject.findAllByName(\"Enemy\")\n--- for _, obj in ipairs(objects) do\n--- print(\"Found object with type:\", obj:getType())\n--- end\n---\n--- -- Scoped search under a specific parent node\n--- local level = SceneObject.findByName(\"Level1\")\n--- local objects = SceneObject.findAllByName(\"Enemy\", level)\n--- for _, obj in ipairs(objects) do\n--- print(\"Found object under parent with type:\", obj:getType())\n--- end\n---\n--- -- Instance call: search within a specific object's hierarchy\n--- local level = SceneObject.findByName(\"Level1\")\n--- local enemies = level:findAllByName(\"Enemy\")\n--- for _, obj in ipairs(enemies) do\n--- print(\"Found enemy under level:\", obj:getName())\n--- end\nfunction SceneObject.findAllByName(self, name, root)\n -- Detect if called as instance method\n if type(self) == \"table\" and self._isSceneObject then\n -- Instance call: default root to self if not provided (and self is not the class)\n if root == nil and self ~= SceneObject then\n root = self\n end\n else\n -- Static call: shift parameters\n name, root = self, name\n end\n \n __assertTrace(name, \"name is empty\")\n \n local objects = _internal.sendMessage('sceneobject.findAllByName', { \n name = name, \n root = root and root._handle or nil \n })\n \n for key, value in pairs(objects) do\n objects[key] = handle.createObject(value)\n end\n \n return objects\nend\n\n--- Finds the first occurrence of an object with the given name.\n---\n--- The search can be restricted to a specific hierarchy by passing a `root` node.\n--- If no `root` is provided, the search covers the entire scene.\n---\n--- This function supports both static and instance usage:\n---\n--- **Static call**\n--- SceneObject.findByName(name root)\n--- - Searches the entire scene unless a `root` node is provided.\n---\n--- **Instance call**\n--- obj:findByName(name root)\n--- - Uses `obj` as the root of the search unless an explicit `root`\n--- argument is passed.\n--- - Ideal when searching only within a specific hierarchy.\n---\n--- @param name string Name of the object in the scenegraph.\n--- @param root (optional) SceneObject The root node to restrict the search to.\n--- @return Object|nil The first object found with the given name, or `nil` if not found.\n--- @usage\n--- -- Global search\n--- local obj = SceneObject.findByName(\"Player\")\n--- if obj then\n--- print(\"Found object:\", obj:getName())\n--- end\n---\n--- -- Scoped search under a specific parent node\n--- local obj = SceneObject.findByName(\"Player\", parentNode)\n--- if obj then\n--- print(\"Found object under parent:\", obj:getName())\n--- end\n---\n--- -- Instance call: search within a specific object's hierarchy\n--- local player = SceneObject.findByName(\"Player\")\n--- local weapon = player:findByName(\"Weapon\")\n--- if weapon then\n--- print(\"Found weapon under player:\", weapon:getName())\n--- end\nfunction SceneObject.findByName(self, name, root)\n -- Detect if called as instance method\n if type(self) == \"table\" and self._isSceneObject then\n -- Instance call: default root to self if not provided\n if root == nil and self ~= SceneObject then\n root = self\n end\n else\n -- Static call: shift parameters\n name, root = self, name\n end\n \n __assertTrace(name, \"name is empty\")\n \n return handle.createObject(_internal.sendMessage('sceneobject.findByName', { \n name = name, \n root = root and root._handle or nil \n }))\nend\n\n---Find an object by its unique ID and return it.\n---\n--- @param id string The unique ID of the object.\n--- @return Object The found object or nil if not found.\n--- @usage\n--- local obj = SceneObject.findById(\"2135a78324fe\")\n--- if obj then\n--- print(\"Found object: \", obj:getName())\n--- end\nfunction SceneObject.findById(self, id)\n if type(self) == 'string' then\n id = self\n end\n if not id then\n return nil\n end\n return handle.createObject(_internal.sendMessage('sceneobject.findById', { id=id }))\nend\n\n--- Finds all objects that have the specified tag.\n---\n--- The search can be limited to a specific hierarchy by passing a `root` node.\n--- If no `root` is provided, the search scans the entire scene.\n---\n--- This function supports both static and instance usage:\n---\n--- **Static call**\n--- SceneObject.findByTag(tag, root)\n--- - Searches the entire scene unless a `root` node is provided.\n---\n--- **Instance call**\n--- obj:findByTag(tag, root)\n--- - Uses `obj` as the root of the search unless an explicit `root`\n--- argument is passed.\n--- - Ideal when searching only within a specific hierarchy.\n---\n--- @param tag string The tag to look for.\n--- @param root (optional) SceneObject The root node to restrict the search to.\n--- @return table A table of objects that have the given tag. May be empty if no matches are found.\n--- @usage\n--- -- Global search\n--- local enemies = SceneObject.findByTag(\"Enemy\")\n--- for _, enemy in ipairs(enemies) do\n--- print(\"Found enemy:\", enemy:getName())\n--- end\n---\n--- -- Scoped search under a specific parent node\n--- local tagged = SceneObject.findByTag(\"Interactable\", parentNode)\n--- for _, obj in ipairs(tagged) do\n--- print(\"Found interactable under parent:\", obj:getName())\n--- end\n---\n--- -- Instance call: search within a specific object's hierarchy\n--- local level = SceneObject.findByName(\"Level1\")\n--- local enemies = level:findByTag(\"Enemy\")\n--- for _, enemy in ipairs(enemies) do\n--- print(\"Found enemy under level:\", enemy:getName())\n--- end\nfunction SceneObject.findByTag(self, tag, root)\n -- Detect if called as instance method\n if type(self) == \"table\" and self._isSceneObject then\n -- Instance call: default root to self if not provided (and self is not the class)\n if root == nil and self ~= SceneObject then\n root = self\n end\n else\n -- Static call: shift parameters\n tag, root = self, tag\n end\n \n __assertTrace(tag, \"tag is empty\")\n \n local objects = _internal.sendMessage('sceneobject.findByTag', { \n tag = tag, \n root = root and root._handle or nil \n })\n \n for key, value in pairs(objects) do\n objects[key] = handle.createObject(value)\n end\n \n return objects\nend\n\n---Create a new object in the scenegraph. This is a generic function, for specialized versions, see the respective Sg<name> classes like SgBox.\n--- @param objectType string Type of object.\n--- @param options table The options to use. For information about the possible options, see the specialized functions below.\n--- @param parent Object the parent object to add the new one to or nil to put it at root level\n--- @return Promise a promise resolving to a SceneObject\n--- @usage\n--- local promise = SceneObject.create(SceneObject.Type.Sphere, { radius = 1 }, nil)\n--- promise:next(function(obj)\n--- obj:setActive(true)\n--- end)\nfunction SceneObject.create(self, objectType, options, parent)\n if (type(self) == \"string\") then\n objectType, options, parent = self, objectType, options\n end\n\n __assertTrace(type(objectType) == 'string', 'objectType must be a string')\n __assertTrace(parent == nil or (type(parent) == 'table' and parent._isSceneObject), 'parent must be a SceneObject')\n\n local p = _internal.sendMessage('sceneobject.create', {\n type = objectType,\n options = options,\n parent = parent and parent._handle or nil\n })\n return Promise:new(p)\nend\n\n--- Get the ID of the scene object.\n--- @return string The unique ID of the object.\n--- @usage\n--- local obj = SceneObject.findByName(\"Cube\")\n--- print(\"Object ID:\", obj:getId())\nfunction SceneObject:getId()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return self._nodeId\nend\n\n--- Get the name of the scene object.\n--- @return string The user-defined name of the object.\n--- @usage\n--- local obj = SceneObject.findByName(\"Cube\")\n--- print(\"Object name:\", obj:getName())\nfunction SceneObject:getName()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return _internal.sendMessage('sceneobject.getName', { obj=self._handle })\nend\n\n--- Return the display name of the scene object.\n--- In case the object has no user-given name, a name will be generated\n--- in the format \"type <id>\"\n--- @return string Displayname\n--- @usage\n--- local obj = SceneObject.findByName(\"Enemy\")\n--- print(\"Display name:\", obj:getDisplayName())\nfunction SceneObject:getDisplayName()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return _internal.sendMessage('sceneobject.getDisplayName', { obj=self._handle })\nend\n\n--- Return the type of the object\n--- @return string Type\n--- @usage\n--- local obj = SceneObject.findByName(\"Wall\")\n--- print(\"Object type:\", obj:getType())\nfunction SceneObject:getType()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return _internal.sendMessage('sceneobject.getType', { obj=self._handle })\nend\n\n--- Set a field of the scene object to a new value.\n---\n--- @param name string The name of the field.\n--- @param value any The new value to set.\n--- @usage\n--- local obj = SceneObject.findByName(\"Light\")\n--- obj:set(\"Brightness\", \"High\")\nfunction SceneObject:set(name, value)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n name = capitalizeFirstLetter(name)\n _internal.sendMessage('sceneobject.set', { obj=self._handle, name=name, value=value })\nend\n\n--- Get a field value from the scene object.\n---\n--- @param name string The name of the field.\n--- @return string The value of the field.\n--- @usage\n--- local obj = SceneObject.findByName(\"Lamp\")\n--- local intensity = obj:get(\"Intensity\")\n--- print(\"Intensity: \" .. intensity)\nfunction SceneObject:get(name)\n\n -- This is a replacement for the old get() function without parameters that would just return a node reference\n -- It needs to stay in place as long as there are still scripts that depend on it.\n if name == nil then\n return self\n end\n\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n name = capitalizeFirstLetter(name)\n local field = _internal.sendMessage('sceneobject.get', { obj=self._handle, name=name })\n if field == nil then\n return nil\n end\n return toType(field.value, field.type)\nend\n\n--- Set a field of the scene object to a new value.\n---@deprecated 25.11 Use ``set`` which is the new shorter version\n--- @param name string The name of the field.\n--- @param value any The new value to set.\n--- @usage\n--- local obj = SceneObject.findByName(\"Light\")\n--- obj:setFieldValue(\"Brightness\", \"High\")\nfunction SceneObject:setFieldValue(name, value)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n name = capitalizeFirstLetter(name)\n _internal.sendMessage('sceneobject.set', { obj=self._handle, name=name, value=value })\nend\n\n--- Get a field value from the scene object.\n---@deprecated 25.11 Use ``get`` which is the new shorter version\n--- @param name string The name of the field.\n--- @return string The value of the field.\n--- @usage\n--- local obj = SceneObject.findByName(\"Lamp\")\n--- local intensity = obj:getFieldValue(\"Intensity\")\n--- print(\"Intensity: \" .. intensity)\nfunction SceneObject:getFieldValue(name)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n name = capitalizeFirstLetter(name)\n local field = _internal.sendMessage('sceneobject.get', { obj=self._handle, name=name })\n if field == nil then\n return nil\n end\n return toType(field.value, field.type)\nend\n\n--- Animate a field from its current value to a new value.\n---\n--- @param name string The name of the field\n--- @param value any The new value to animate to.\n--- @param duration number The duration in milliseconds for the animation to take\n--- @param ease string The type of easing to use. Possible values: 'linear', 'easeInOutQuad'\n--- @return number animation id. Can be used to cancel animation using cancelAnimation(id)\nfunction SceneObject:animateFieldValue(name, value, duration, ease)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(not (type(value) == 'table'), \"Cannot animate objects!\");\n name = capitalizeFirstLetter(name)\n return _internal.sendMessage('sceneobject.animateFieldValue', { obj=self._handle, name=name, value=value, duration=duration, ease=ease })\nend\n\n--- Cancel a running animation\n---\n--- @param name string The name of the field\nfunction SceneObject:cancelAnimation(id)\n _internal.sendMessage('sceneobject.cancelAnimation', { obj=self._handle, id=id })\nend\n\n--- Set a field of the scene object to a new color value.\n---@deprecated 25.09 Use ``set`` which handle the correct type automatically.\n--- @param name string The name of the field.\n--- @param value Color The new color value.\n--- @usage\n--- local obj = SceneObject.findByName(\"Cube\")\n--- obj:setFieldColorValue(\"Color\", Color.new(1, 0, 0, 1)) -- Sets the object to red.\nfunction SceneObject:setFieldColorValue(name, value)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(value._isColor, \"value is not a Color\")\n name = capitalizeFirstLetter(name)\n _internal.sendMessage('sceneobject.set', { obj=self._handle, name=name, value=value:toData() })\nend\n\n--- Set a field of the scene object to a new number value.\n---@deprecated 25.09 Use ``set`` which handle the correct type automatically.\n--- @param name string The name of the field.\n--- @param value number The new number value.\nfunction SceneObject:setFieldNumberValue(name, value)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(type(value) == \"number\", \"value must be a number\")\n name = capitalizeFirstLetter(name)\n _internal.sendMessage('sceneobject.set', { obj=self._handle, name=name, value=value })\nend\n\n---Set a field of the scene object to a new enum value\n--- @param name string\n--- @param value number\nfunction SceneObject:setFieldEnumValue(name, value)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n name = capitalizeFirstLetter(name)\n _internal.sendMessage('sceneobject.set', { obj=self._handle, name=name, value=value })\nend\n\n---Set a field of the scene object to a new boolean value\n---@deprecated 25.09 Use ``set`` which handle the correct type automatically.\n--- @param name string\n--- @param value boolean\nfunction SceneObject:setFieldBooleanValue(name, value)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n if value then value = true else value = false end\n name = capitalizeFirstLetter(name)\n _internal.sendMessage('sceneobject.set', { obj=self._handle, name=name, value=value })\nend\n\n--- Get the layers of the scene object\n--- @return table A table containing layer indices\nfunction SceneObject:getLayers()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n local internal_layers = self:getFieldValue(\"Layers\")\n __assertTrace(type(internal_layers) == \"table\", \"Expected 'Layers' to be a table\")\n\n -- convert internal 0-based indices to frontend 1-based indices\n local layers = {}\n for _, layer_idx in ipairs(internal_layers) do\n table.insert(layers, layer_idx + 1)\n end\n\n return layers\nend\n\n--- Set the layers of the scene object.\n--- Layers control rendering visibility and interaction with other objects.\n---\n--- @param layers table A table containing layer indices.\n--- @usage\n--- local obj = SceneObject.findByName(\"Character\")\n--- obj:setLayers({1, 3, 5}) -- Assigns the object to layers 1, 3, and 5.\nfunction SceneObject:setLayers(layers)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(type(layers) == \"table\", \"Layers must be provided as a table\")\n self:setFieldValue(\"Layers\", layers)\nend\n\n--- Get the value of a scene object's field as color value.\n---@deprecated 25.09 Use ``get`` which always returns the correct type.\n--- @return Color value of the field\n--- @usage\n--- local obj = SceneObject.findByName(\"Lamp\")\n--- local color = obj:getFieldColorValue(\"Color\")\n--- print(\"Color: \" .. color)\nfunction SceneObject:getFieldColorValue(name)\n return self:getFieldValue(name)\nend\n\n--- Get the value of a scene object's field as number value.\n---@deprecated 25.09 Use ``get`` which always returns the correct type.\n--- @return number value of the field\nfunction SceneObject:getFieldNumberValue(name)\n return self:getFieldValue(name)\nend\n\n--- Get the value of a scene object's field as boolean value.\n---@deprecated 25.09 Use ``get`` which always returns the correct type.\n--- @return boolean value of the field\nfunction SceneObject:getFieldBooleanValue(name)\n return self:getFieldValue(name)\nend\n\n--- Get the value of a scene object's field as string value.\n---@deprecated 25.09 Use ``get`` which always returns the correct type.\n--- @return string value of the field\nfunction SceneObject:getFieldEnumValue(name)\n return self:getFieldValue(name)\nend\n\n--- Get the value of a scene object's field as string value\n--- @return string value of the field\nfunction SceneObject:getFieldEnumOptions(name)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return _internal.sendMessage('sceneobject.getFieldOptions', { obj=self._handle, name=name })\nend\n\n--- Set a field of the scene object to a new boolean value.\n---@deprecated 25.09 Use ``set`` which handle the correct type automatically.\n--- @param name string The name of the field.\n--- @param value boolean The new boolean value.\n--- @usage\n--- local obj = SceneObject.findByName(\"Door\")\n--- obj:setFieldBooleanValue(\"PhysicsEnabled\", true)\nfunction SceneObject:setFieldBooleanValue(name, value)\n self:setFieldValue(name, not not value)\nend\n\n---Get a link of the scene object to a new value\n---@deprecated 25.11 Use ``get`` which handles items now too\n--- @param name string name of the link field\n--- @return number handle of the linked item or nil if not set\nfunction SceneObject:getLinkItem(name)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n name = capitalizeFirstLetter(name)\n return handle.createObject(_internal.sendMessage('sceneobject.getLinkItem', { obj=self._handle, name=name }))\nend\n\n---Set a link from the scene object\n---@deprecated 25.11 Use ``set`` which handles items now too\n--- @param name string name of the link field\n--- @param item string value can be either an item ID or an Item object\nfunction SceneObject:setLinkItem(name, item)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(not item or (item and item._handle and item._isItem), \"item has to be an object of Item class or nil!\");\n name = capitalizeFirstLetter(name)\n _internal.sendMessage('sceneobject.setLinkItem', { obj=self._handle, name=name, item=item })\nend\n\n--- Set the position of the scene object.\n--- Sets the object's local position to the given coordinates.\n---\n--- @param x number Position along the X-axis.\n--- @param y number Position along the Y-axis.\n--- @param z number Position along the Z-axis.\n--- @usage\n--- local obj = SceneObject.findByName(\"Player\")\n--- if obj then\n--- obj:setPosition(0, 5, 0) -- Places the object at (0, 5, 0)\n--- end\nfunction SceneObject:setPosition(x, y, z)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n\n _internal.sendMessage('sceneobject.setPosition', {\n obj = self._handle,\n x = x,\n y = y,\n z = z\n })\nend\n\n--- Translate (move) the scene object by an offset.\n--- Adds the given offset to the object's current local position.\n---\n--- @param x number Offset along the X-axis.\n--- @param y number Offset along the Y-axis.\n--- @param z number Offset along the Z-axis.\n--- @usage\n--- local obj = SceneObject.findByName(\"Player\")\n--- if obj then\n--- obj:translate(0, 1, 0) -- Moves the object up by 1 unit from its current position\n--- end\nfunction SceneObject:translate(x, y, z)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n _internal.sendMessage('sceneobject.translate', {\n obj = self._handle,\n x = x,\n y = y,\n z = z\n })\nend\n\n--- Rotate the scene object.\n--- Rotation is applied in degrees and follows Euler angles (XYZ order).\n---\n--- @param x number Rotation around the X-axis in degrees.\n--- @param y number Rotation around the Y-axis in degrees.\n--- @param z number Rotation around the Z-axis in degrees.\n--- @usage\n--- local obj = SceneObject.findByName(\"Cube\")\n--- if obj then\n--- obj:rotate(45, 0, 0) -- Rotates 45 degrees around the X-axis\n--- end\nfunction SceneObject:rotate(x, y, z)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n _internal.sendMessage('sceneobject.rotate', { obj=self._handle, x=x, y=y, z=z })\nend\n\n--- Scale the scene object.\n---\n--- @param x number Scale factor along the X-axis.\n--- @param y number Scale factor along the Y-axis.\n--- @param z number Scale factor along the Z-axis.\n--- @usage\n--- local obj = SceneObject.findByName(\"Tree\")\n--- if obj then\n--- obj:scale(2, 2, 2) -- Doubles the size of the object\n--- end\nfunction SceneObject:scale(x, y, z)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n _internal.sendMessage('sceneobject.scale', { obj=self._handle, x=x, y=y, z=z })\nend\n\n--- Get the local transform of a scene object.\n--- The transform contains position, rotation, and scale relative to the object's parent.\n---\n--- @param cacheLocal boolean if set to true, the transform will be cached locally for the future for performance reasons. This should only be used if no other script changes the transform\n--- @return Transform The object's local transform.\n--- @usage\n--- local obj = SceneObject.findByName(\"Character\")\n--- local transform = obj:getTransform()\n--- print(\"Local position:\", transform.position)\nfunction SceneObject:getTransform(cacheLocal)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n if self._transform == nil or not cacheLocal then\n self._transform = Transform.fromData(_internal.sendMessage('sceneobject.getTransform', { obj=self._handle }))\n end\n return self._transform:clone()\nend\n\n--- Apply a function to modify the object's transform, then update it.\n--- This allows making changes to the transform while ensuring they are properly applied back.\n---\n--- @param func function A function that takes a Transform object as its only argument.\n--- @param cacheLocal boolean if set to true, the transform will be cached locally for the future for performance reasons. This should only be used if no other script changes the transform\n--- @usage\n--- local obj = SceneObject.findByName(\"Cube\")\n--- obj:withTransform(function(transform)\n--- transform.position.x = transform.position.x + 1 -- Move object 1 unit to the right\n--- end)\nfunction SceneObject:withTransform(func, cacheLocal)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(type(func) == 'function', \"argument func is not a function\")\n local transform = self:getTransform(cacheLocal)\n func(transform)\n self:setTransform(transform)\nend\n\n--- Get the world transform of a scene object.\n--- The world transform includes absolute position, rotation, and scale in the scene.\n---\n--- @return Transform The object's world transform.\n--- @usage\n--- local obj = SceneObject.findByName(\"Light\")\n--- local worldTransform = obj:getWorldTransform()\n--- print(\"World position:\", worldTransform.position)\nfunction SceneObject:getWorldTransform()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return Transform.fromData(_internal.sendMessage('sceneobject.getWorldTransform', { obj=self._handle }))\nend\n\n--- Get the forward direction vector in world space.\n--- Returns the local -Z axis transformed by the object's rotation.\n---\n--- @return Vector3 The forward direction in world space.\nfunction SceneObject:getForward()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return Vector3.fromData(_internal.sendMessage('sceneobject.getForward', { obj=self._handle }))\nend\n\n--- Get the right direction vector in world space.\n--- Returns the local +X axis transformed by the object's rotation.\n---\n--- @return Vector3 The right direction in world space.\nfunction SceneObject:getRight()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return Vector3.fromData(_internal.sendMessage('sceneobject.getRight', { obj=self._handle }))\nend\n\n--- Get the up direction vector in world space.\n--- Returns the local +Y axis transformed by the object's rotation.\n---\n--- @return Vector3 The up direction in world space.\nfunction SceneObject:getUp()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return Vector3.fromData(_internal.sendMessage('sceneobject.getUp', { obj=self._handle }))\nend\n\n--- Set the local transform of a scene object.\n--- Updates the object's position, rotation, and scale relative to its parent.\n---\n--- @param transform Transform The new local transform to apply.\n--- @usage\n--- local obj = SceneObject.findByName(\"Door\")\n--- local newTransform = Transform.new()\n--- newTransform.position = Vector3.new(0, 2, 0) -- Move the object up 2 units\n--- obj:setTransform(newTransform)\nfunction SceneObject:setTransform(transform)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(transform and transform._isTransform, \"transform has to be an object of type Transform\")\n self._transform = transform\n _internal.sendMessage('sceneobject.setTransform', { obj=self._handle, transform=self._transform:toData() })\nend\n\n--- Set the physics position of the scene object.\n---\n--- This directly updates the position of the object inside the physics engine.\n--- The position is expressed in world coordinates.\n--- Only works for objects added to the physics engine\n--- @param position Vector3 New world position of the object.\n--- @usage\n--- local obj = SceneObject.findByName(\"Box\")\n--- obj:setPhysicsPosition(Vector3.new(0, 5, 0))\nfunction SceneObject:setPhysicsPosition(position)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(position and position._isVector3, \"position has to be an object of type Vector3\")\n _internal.sendMessage('sceneobject.setPhysicsPosition', { obj=self._handle, position=position:toData() })\nend\n\n--- Set the physics rotation of the scene object.\n---\n--- This directly updates the rotation of the object inside the physics engine.\n--- The rotation is expressed in world space.\n--- Only works for objects added to the physics engine\n--- @param rotation Quaternion New world rotation of the object.\n--- @usage\n--- local obj = SceneObject.findByName(\"Box\")\n--- obj:setPhysicsRotation(Quaternion.fromEuler(0, math.pi, 0))\nfunction SceneObject:setPhysicsRotation(rotation)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(rotation and rotation._isQuaternion, \"rotation has to be an object of type Quaternion\")\n _internal.sendMessage('sceneobject.setPhysicsRotation', { obj=self._handle, rotation=rotation:toData() })\nend\n\nfunction SceneObject:setPhysicsRotation(rotation)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(rotation and rotation._isQuaternion, \"rotation has to be an object of type Quaternion\")\n _internal.sendMessage('sceneobject.setPhysicsRotation', { obj=self._handle, rotation=rotation:toData() })\nend\n\n--- Get the linear velocity of the scene object.\n--- This function returns the object's velocity in world coordinates.\n--- Only works for objects added to the physics engine with `watchLinearVelocity` enabled.\n---\n--- @return Vector3 The linear velocity of the object.\n--- @usage\n--- local obj = SceneObject.findByName(\"Ball\")\n--- local velocity = obj:getLinearVelocity()\n--- print(\"Velocity:\", velocity)\nfunction SceneObject:getLinearVelocity()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return Vector3.fromData(_internal.sendMessage('sceneobject.getLinearVelocity', { obj=self._handle }))\nend\n\n--- Set the linear velocity of the scene object.\n--- This function assigns a new velocity to the object, but only works if the object is in the physics engine.\n---\n--- @param velocity Vector3 The new linear velocity to apply.\n--- @usage\n--- local obj = SceneObject.findByName(\"Car\")\n--- obj:setLinearVelocity(Vector3.new(10, 0, 0)) -- Move object at speed 10 in the X direction.\nfunction SceneObject:setLinearVelocity(velocity)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(velocity and velocity._isVector3, \"velocity must be an object of type Vector3\")\n local data = velocity:toData()\n _internal.sendMessage('sceneobject.setLinearVelocity', { obj=self._handle, velocity=data })\nend\n\n--- Get the angular velocity of the scene object.\n--- Only works for objects added to the physics engine with `watchAngularVelocity` enabled.\n---\n--- @return Vector3 The angular velocity of the object.\n--- @usage\n--- local obj = SceneObject.findByName(\"Wheel\")\n--- local angVel = obj:getAngularVelocity()\n--- print(\"Angular velocity:\", angVel)\nfunction SceneObject:getAngularVelocity()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return Vector3.fromData(_internal.sendMessage('sceneobject.getAngularVelocity', { obj=self._handle }))\nend\n\n--- Set the angular velocity of the scene object.\n---\n--- @param velocity Vector3 The new angular velocity to apply.\n--- @usage\n--- local obj = SceneObject.findByName(\"Propeller\")\n--- obj:setAngularVelocity(Vector3.new(0, 10, 0)) -- Rotate around Y-axis.\nfunction SceneObject:setAngularVelocity(velocity)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(velocity and velocity._isVector3, \"velocity must be an object of type Vector3\")\n local data = velocity:toData()\n _internal.sendMessage('sceneobject.setAngularVelocity', { obj=self._handle, velocity=data })\nend\n\n--- Apply an impulse to the scene object.\n---\n--- An **impulse** is a sudden force applied to an object that immediately\n--- changes its velocity. This is different from a continuous force, which\n--- is applied over time.\n---\n--- This function only works on objects that are physics-enabled.\n---\n--- @param impulse Vector3 The force impulse to apply.\n--- @param relPos Vector3 The relative position where the impulse is applied. Default is (0, 0, 0)\nfunction SceneObject:applyImpulse(impulse, relPos)\n relPos = relPos or Vector3.new(0, 0, 0)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(impulse and impulse._isVector3, \"impulse must be an object of type Vector3\")\n __assertTrace(relPos and relPos._isVector3, \"relPos must be an object of type Vector3\")\n local impulseData = impulse:toData()\n local relPosData = relPos:toData()\n _internal.sendMessage('sceneobject.applyImpulse', { obj=self._handle, impulse=impulseData, relPos=relPosData })\nend\n\n--- Apply an impulse to the scene object that respects constraints.\n---\n--- Only works on physics-enabled objects.\n---\n--- @param impulse Vector3 The force impulse to apply.\n--- @param relPos Vector3 The relative position where the impulse is applied. Default is (0, 0, 0)\nfunction SceneObject:applyPushImpulse(impulse, relPos)\n relPos = relPos or Vector3.new(0, 0, 0)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(impulse and impulse._isVector3, \"impulse must be an object of type Vector3\")\n __assertTrace(relPos and relPos._isVector3, \"relPos must be an object of type Vector3\")\n _internal.sendMessage('sceneobject.applyPushImpulse', { obj=self._handle, impulse=impulse:toData(), relPos=relPos:toData() })\nend\n\n--- Apply an impulse to the center of the object.\n---\n--- Applies a sudden velocity change at the object's center. Only works on physics-enabled objects.\n---\n--- @param impulse Vector3 The force impulse to apply.\n--- @usage\n--- local obj = SceneObject.findByName(\"Box\")\n--- obj:applyCentralImpulse(Vector3.new(0, 5, 0)) -- Apply upward impulse.\nfunction SceneObject:applyCentralImpulse(impulse)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(impulse and impulse._isVector3, \"impulse must be an object of type Vector3\")\n _internal.sendMessage('sceneobject.applyCentralImpulse', { obj=self._handle, impulse=impulse:toData() })\nend\n\n--- Apply a central impulse that respects constraints.\n---\n--- Only works on physics-enabled objects and respects any joint or constraint applied.\n---\n--- @param impulse Vector3 The force impulse to apply.\n--- @usage\n--- local obj = SceneObject.findByName(\"Box\")\n--- obj:applyCentralPushImpulse(Vector3.new(0, 5, 0)) -- Apply upward impulse.\nfunction SceneObject:applyCentralPushImpulse(impulse)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(impulse and impulse._isVector3, \"impulse must be an object of type Vector3\")\n _internal.sendMessage('sceneobject.applyCentralPushImpulse', { obj=self._handle, impulse=impulse:toData() })\nend\n\n--- Apply a force to the scene object.\n---\n--- Unlike impulses, **forces** are applied over time, influencing the object's acceleration.\n--- Only works on physics-enabled objects.\n---\n--- @param force Vector3 The force vector to apply.\n--- @param relPos Vector3 The relative position where the force is applied. Default is (0, 0, 0)\nfunction SceneObject:applyForce(force, relPos)\n relPos = relPos or Vector3.new(0, 0, 0)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(force and force._isVector3, \"force must be an object of type Vector3\")\n __assertTrace(relPos and relPos._isVector3, \"relPos must be an object of type Vector3\")\n _internal.sendMessage('sceneobject.applyForce', { obj=self._handle, force=force:toData(), relPos=relPos:toData() })\nend\n\n--- Clear any forces on a scene object.\n--- Only works on physics-enabled objects.\n--- @usage\n--- local obj = SceneObject.findByName(\"Ball\")\n--- obj:clearForces()\nfunction SceneObject:clearForces()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n _internal.sendMessage('sceneobject.clearForces', { obj=self._handle })\nend\n\n--- Delete the scene object from the scene.\n---\n--- @usage\n--- local obj = scene:findByName(\"TemporaryObject\")\n--- if obj then\n--- obj:delete()\n--- end\nfunction SceneObject:delete()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n _internal.sendMessage('sceneobject.delete', { obj=self._handle })\n if self._handle then\n handle.invalidate(self._handle)\n end\n self._handle = nil\nend\n\n--- Clone a scene object to a new position and return it.\n---\n--- The position can be provided as:\n--- 1. Separate `x, y, z` coordinates.\n--- 2. A `Vector3` containing the position.\n---\n--- If no position is provided, the clone will appear in the same location as the original.\n---\n--- @param x number | Vector3 The X-coordinate of the new position, or a `Vector3` containing `x, y, z`. If a `Vector3` is passed, `y` and `z` should be omitted.\n--- @param y number (optional) The Y-coordinate of the new position. Omit this if passing a `Vector3`.\n--- @param z number (optional) The Z-coordinate of the new position. Omit this if passing a `Vector3`.\n--- @param parent SceneObject (optional) The parent object to attach the new object to.\n--- @return Promise A promise resolving to a SceneObject.\n---\n--- @usage\n--- local obj = scene:findByName(\"Tree\")\n--- obj:clone(5, 0, 2):next(function(clone)\n--- clone:setActive(true) -- Activate the cloned object\n--- end)\n---\n--- local pos = Vector3.new(3, 1, 0)\n--- obj:clone(pos):next(function(clone)\n--- clone:setFieldValue(\"Name\", \"ClonedTree\") -- Rename the cloned object\n--- end)\n---\n--- local parentObj = scene:findByName(\"Group\")\n--- obj:clone(pos, parentObj):next(function(clone)\n--- clone:setFieldValue(\"Name\", \"AnotherClonedTree\") -- Rename the cloned object\n--- end)\nfunction SceneObject:clone(x, y, z, parent)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n\n -- Handle case where first argument is a Vector3 and second argument is the parent\n if type(x) == \"table\" and x._isVector3 then\n x, y, z, parent = x.x, x.y, x.z, y -- Shift arguments\n end\n\n local p = _internal.sendMessage('sceneobject.clone', {\n obj = self._handle,\n x = x,\n y = y,\n z = z,\n parent = parent and parent._handle or nil\n })\n\n return Promise:new(p)\nend\n\n--- Create a new object of same type from this one. If no options are specified this will be basically a clone.\n--- If an options table is passed, this will specify all fields with their values that should be changed.\n--- At the very least, this should contain a new Transform, otherwise the new object will be at the exact location\n--- of the old one.\n--- @param options table the table of fields to set on the new object\n--- @param parent SceneObject (optional) The parent object to attach the new object to.\n--- @return Promise A promise resolving to a SceneObject.\n---\n--- @usage\n--- local obj = SceneObject.findByName(\"Tree\")\n--- local parentObj = SceneObject.findByName(\"Group\")\n--- local clone = await(obj:createFromThis({\n--- transform = Transform.new(Vector3.new(4, 6, 8)),\n--- active = true,\n--- name = \"Cloned tree\"\n--- }, parentObj)\nfunction SceneObject:createFromThis(options, parent)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(parent == nil or parent._isSceneObject, \"parent is not nil or a SceneObject\")\n\n local p = _internal.sendMessage('sceneobject.createFromThis', {\n obj = self._handle,\n options = options,\n parent = parent and parent._handle or nil\n })\n\n return Promise:new(p)\nend\n\n--- Move the scene object to a different parent. This parent can not be a child of the scene object\n--- @param parent SceneObject (optional) The parent object to attach the new object to. if nil, the object will be moved to the scenegraph root\nfunction SceneObject:moveToParent(parent)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(not parent or parent._isSceneObject, \"parent is not a SceneObject\")\n _internal.sendMessage('sceneobject.moveToParent', { obj = self._handle, parent = parent and parent._handle or nil })\nend\n\n--- Set the active state of the scene object.\n--- @param value boolean True to activate, false to deactivate.\nfunction SceneObject:setActive(value)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n self:setFieldValue(\"Active\", value)\nend\n\n--- Get the active state of the scene object.\n--- @return boolean True if the object is active, false otherwise.\nfunction SceneObject:getActive()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return self:getFieldBooleanValue(\"Active\")\nend\n\n--- Check if the object has a specific tag.\n--- @param tagName string The tag name to check.\n--- @return boolean True if the object has the tag, false otherwise.\nfunction SceneObject:hasTag(tagName)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n local tags = self:getFieldValue(\"Tags\")\n for _, value in pairs(tags) do\n if value == tagName then\n return true\n end\n end\n return false\nend\n\n--- Get a list of all tags assigned to the object.\n--- @return table An array of tag names.\nfunction SceneObject:getTags()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return self:getFieldValue(\"Tags\")\nend\n\n--- Assign a set of tags to the object.\n--- @param tags table An array of tag names.\nfunction SceneObject:setTags(tags)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n Tools.validateArrayOfStrings(tags)\n self:setFieldValue(\"Tags\", tags)\nend\n\n--- Add a tag to the object.\n--- @param tag string The tag to add.\nfunction SceneObject:addTag(tag)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(type(tag) == 'string', \"tag needs to be a string\")\n local tags = self:getTags()\n table.insert(tags, tag)\n self:setTags(tags)\nend\n\n--- Remove all tags from the object.\nfunction SceneObject:clearTags()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n self:setTags({})\nend\n\n--- Take a snapshot of the object and its children, if specified.\n--- This allows restoring the object to a previous state.\n--- @param recursive boolean Whether to include child objects in the snapshot.\n--- @return number The snapshot handle.\nfunction SceneObject:takeSnapshot(recursive)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return _internal.sendMessage('sceneobject.takeSnapshot', { obj=self._handle, recursive=recursive })\nend\n\n--- Restore a snapshot, reverting any changes made after the snapshot was taken.\n--- @param snapshot number The snapshot handle to restore.\nfunction SceneObject:rollbackSnapshot(snapshot)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n _internal.sendMessage('sceneobject.rollbackSnapshot', { obj=self._handle, snapshot=snapshot })\nend\n\n--- Check if the object is enabled.\n--- @return boolean True if the object is enabled, false otherwise.\nfunction SceneObject:isEnabled()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return _internal.sendMessage('sceneobject.isEnabled', { obj=self._handle })\nend\n\n--- Enable the object.\nfunction SceneObject:enable()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n _internal.sendMessage('sceneobject.enable', { obj=self._handle })\nend\n\n--- Disable the object.\nfunction SceneObject:disable()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n _internal.sendMessage('sceneobject.disable', { obj=self._handle })\nend\n\n--- Get the material assigned to the object.\n--- @return Material The material, or nil if none is assigned.\nfunction SceneObject:getMaterial()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return self:getLinkItem(\"Material\")\nend\n\n--- Set the object's material.\n--- @param mat Material The material to set or nil to clear the material\nfunction SceneObject:setMaterial(mat)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(mat == nil or (type(mat) == 'table' and mat._isMaterial), \"self is not a SceneObject\")\n self:setLinkItem(\"Material\", mat)\nend\n\n--- Get all behaviours attached to this object.\n---@deprecated 25.12 use getBehaviours.\n--- @return table A list of Behaviour objects.\nfunction SceneObject:getEntities()\n return self:getBehaviours()\nend\n\n--- Get all behaviours attached to this object.\n--- @return table A list of Behaviour objects.\nfunction SceneObject:getBehaviours()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n if not self._nodeId then\n error(\"This scene object does not have a node Id. Cannot get its behaviours.\")\n end\n return Behaviour.getByNodeId(self._nodeId)\nend\n\n--- Get a behaviour attached to this object by its script name.\n--- @param name string The script name.\n--- @return Behaviour The corresponding behaviour, or nil if not found.\nfunction SceneObject:getBehaviourByScriptName(name)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n if not self._nodeId then\n error(\"This scene object does not have a node Id. Cannot get its entities.\")\n end\n return Behaviour.getByNodeIdAndScriptName(self._nodeId, name)\nend\n\n--- Get a behaviour attached to this object by its script name.\n---@deprecated\n--- @param name string The script name.\n--- @return Behaviour The corresponding behaviour, or nil if not found.\nfunction SceneObject:getEntityByScriptName(name)\n return self:getBehaviourByScriptName(name)\nend\n\n--- Get a behaviour attached to this object by its script name.\n--- @param name string The script name.\n--- @return Behaviour The corresponding behaviour, or nil if not found.\nfunction SceneObject:behaviour(name)\n return self:getBehaviourByScriptName(name)\nend\n\n--- Get a behaviour attached to this object by its script name.\n--- @param name string The script name.\n--- @return Behaviour The corresponding behaviour, or nil if not found.\nfunction SceneObject:entity(name)\n return self:getBehaviourByScriptName(name)\nend\n\n--- Get the parent of the object.\n--- @return SceneObject The parent object, or nil if none exists.\nfunction SceneObject:getParent()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return handle.createObject(_internal.sendMessage('sceneobject.getParent', { obj=self._handle }))\nend\n\n--- Get the children of the object.\n--- @return table A table of child objects.\nfunction SceneObject:getChildren()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n local objects = _internal.sendMessage('sceneobject.getChildren', { obj=self._handle })\n for key, value in pairs(objects) do\n objects[key] = handle.createObject(value)\n end\n return objects\nend\n\n--- Enable or disable automatic recreation of the scene object between play and stop.\n---\n--- When `value` is true, the object will be automatically recreated every time\n--- the scene starts or stops. This is useful for objects that need to reset\n--- physics, state, or procedural components at each run.\n---\n--- @param value boolean Enable (`true`) or disable (`false`) automatic recreation.\nfunction SceneObject:setAutoRecreate(value)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n _internal.sendMessage('sceneobject.setAutoRecreate', { obj=self._handle, value=value })\nend\n\n--- Immediately recreate the scene object.\n---\n--- This forces the object to reset its state, physics, and components as if\n--- it was newly instantiated in the scene.\nfunction SceneObject:recreate()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n _internal.sendMessage('sceneobject.recreate', { obj=self._handle })\nend\n\nreturn SceneObject\n";
|
|
130991
|
+
var lua_api_sceneobject = "\nlocal _internal = require('engine/_internal');\nlocal Object = require 'engine/object'\nlocal handle = require 'engine/handle'\nlocal Transform = require 'engine/math/transform'\nlocal Vector3 = require 'engine/math/vector3'\nlocal Tools = require 'engine/tools'\nlocal Promise = require 'engine/promise'\n\n------------------------------------------------------------------\n-- SceneObject class\n------------------------------------------------------------------\n\n--- @class SceneObject\nlocal SceneObject = Class.new(Object)\nSceneObject._isSceneObject = true\nSceneObject._type = \"SceneObject\"\n\n--- Enumeration of the available types to use with SceneObject.create()\n--- @enum Type\nSceneObject.Type = {\n Audio = \"SgAudio\",\n AudioListener = \"AudioListener\",\n Billboard = \"SgBillboard\",\n Box = \"SgBox\",\n Camera = \"SgCamera\",\n CircleShadow = \"SgCircleShadow\",\n Cone = \"SgCone\",\n Cylinder = \"SgCylinder\",\n GaussianSplats = \"SgGaussianSplats\",\n Group = \"SgGroup\",\n Lightsource = \"SgLightsource\",\n Mesh = \"SgMesh\",\n Particles = \"SgParticles\",\n Plane = \"SgPlane\",\n Points = \"SgPoints\",\n PositionalAudio = \"SgPositionalAudio\",\n Prefab = \"SgPrefab\",\n Ring = \"SgRing\",\n Scene = \"Scene\",\n Sky = \"SgSky\",\n Sphere = \"SgSphere\",\n Text = \"SgText\",\n Torus = \"SgTorus\",\n Vehicle = \"SgVehicle\"\n}\n\n---@private\nfunction SceneObject:__new(handle, nodeId)\n Object.__new(self, handle)\n self._type = \"SceneObject\"\n self._isSceneObject = true\n self._nodeId = nodeId\nend\n\nfunction capitalizeFirstLetter(str)\n local firstChar = str:sub(1, 1)\n if firstChar:lower() == firstChar then\n firstChar = firstChar:upper()\n return firstChar .. str:sub(2)\n end\n return str\nend\n\n---@private\nfunction SceneObject:__customIndex(key)\n -- any private properties of scene objects start with an underscore. if so, just use rawget, otherwise\n -- get the value of the field from the engine and return it\n local value = rawget(self, key)\n if value or type(key) ~= 'string' or string.sub(key, 1, 1) == '_' then\n return value\n else\n return self:get(key)\n end\nend\n\n---@private\nfunction SceneObject:__customNewIndex(key, value)\n -- any private properties of scene objects start with an underscore. if so, just use rawset, otherwise\n -- write the value to the field in the engine\n if type(key) ~= 'string' or string.sub(key, 1, 1) == '_' then\n rawset(self, key, value)\n else\n self:set(key, value)\n end\nend\n\n--- Finds all objects with the given name.\n---\n--- The search can be restricted to a specific hierarchy by passing a `root` node.\n--- If no `root` is provided, the search covers the entire scene.\n---\n--- This function supports both static and instance usage:\n---\n--- **Static call**\n--- SceneObject.findAllByName(name root?)\n--- - Searches the entire scene unless a `root` node is provided.\n---\n--- **Instance call**\n--- obj:findAllByName(name, root?)\n--- - Uses `obj` as the root of the search unless an explicit `root`\n--- argument is passed.\n--- - Ideal when searching only within a specific hierarchy.\n---\n--- @param name string Name of the objects in the scenegraph.\n--- @param root (optional) SceneObject The root node to restrict the search to.\n--- @return table A table containing all found objects, or an empty table if none are found.\n--- @usage\n--- -- Global search\n--- local objects = SceneObject.findAllByName(\"Enemy\")\n--- for _, obj in ipairs(objects) do\n--- print(\"Found object with type:\", obj:getType())\n--- end\n---\n--- -- Scoped search under a specific parent node\n--- local level = SceneObject.findByName(\"Level1\")\n--- local objects = SceneObject.findAllByName(\"Enemy\", level)\n--- for _, obj in ipairs(objects) do\n--- print(\"Found object under parent with type:\", obj:getType())\n--- end\n---\n--- -- Instance call: search within a specific object's hierarchy\n--- local level = SceneObject.findByName(\"Level1\")\n--- local enemies = level:findAllByName(\"Enemy\")\n--- for _, obj in ipairs(enemies) do\n--- print(\"Found enemy under level:\", obj:getName())\n--- end\nfunction SceneObject.findAllByName(self, name, root)\n -- Detect if called as instance method\n if type(self) == \"table\" and self._isSceneObject then\n -- Instance call: default root to self if not provided (and self is not the class)\n if root == nil and self ~= SceneObject then\n root = self\n end\n else\n -- Static call: shift parameters\n name, root = self, name\n end\n \n __assertTrace(name, \"name is empty\")\n \n local objects = _internal.sendMessage('sceneobject.findAllByName', { \n name = name, \n root = root and root._handle or nil \n })\n \n for key, value in pairs(objects) do\n objects[key] = handle.createObject(value)\n end\n \n return objects\nend\n\n--- Finds the first occurrence of an object with the given name.\n---\n--- The search can be restricted to a specific hierarchy by passing a `root` node.\n--- If no `root` is provided, the search covers the entire scene.\n---\n--- This function supports both static and instance usage:\n---\n--- **Static call**\n--- SceneObject.findByName(name root)\n--- - Searches the entire scene unless a `root` node is provided.\n---\n--- **Instance call**\n--- obj:findByName(name root)\n--- - Uses `obj` as the root of the search unless an explicit `root`\n--- argument is passed.\n--- - Ideal when searching only within a specific hierarchy.\n---\n--- @param name string Name of the object in the scenegraph.\n--- @param root (optional) SceneObject The root node to restrict the search to.\n--- @return Object|nil The first object found with the given name, or `nil` if not found.\n--- @usage\n--- -- Global search\n--- local obj = SceneObject.findByName(\"Player\")\n--- if obj then\n--- print(\"Found object:\", obj:getName())\n--- end\n---\n--- -- Scoped search under a specific parent node\n--- local obj = SceneObject.findByName(\"Player\", parentNode)\n--- if obj then\n--- print(\"Found object under parent:\", obj:getName())\n--- end\n---\n--- -- Instance call: search within a specific object's hierarchy\n--- local player = SceneObject.findByName(\"Player\")\n--- local weapon = player:findByName(\"Weapon\")\n--- if weapon then\n--- print(\"Found weapon under player:\", weapon:getName())\n--- end\nfunction SceneObject.findByName(self, name, root)\n -- Detect if called as instance method\n if type(self) == \"table\" and self._isSceneObject then\n -- Instance call: default root to self if not provided\n if root == nil and self ~= SceneObject then\n root = self\n end\n else\n -- Static call: shift parameters\n name, root = self, name\n end\n \n __assertTrace(name, \"name is empty\")\n \n return handle.createObject(_internal.sendMessage('sceneobject.findByName', { \n name = name, \n root = root and root._handle or nil \n }))\nend\n\n---Find an object by its unique ID and return it.\n---\n--- @param id string The unique ID of the object.\n--- @return Object The found object or nil if not found.\n--- @usage\n--- local obj = SceneObject.findById(\"2135a78324fe\")\n--- if obj then\n--- print(\"Found object: \", obj:getName())\n--- end\nfunction SceneObject.findById(self, id)\n if type(self) == 'string' then\n id = self\n end\n if not id then\n return nil\n end\n return handle.createObject(_internal.sendMessage('sceneobject.findById', { id=id }))\nend\n\n--- Finds all objects that have the specified tag.\n---\n--- The search can be limited to a specific hierarchy by passing a `root` node.\n--- If no `root` is provided, the search scans the entire scene.\n---\n--- This function supports both static and instance usage:\n---\n--- **Static call**\n--- SceneObject.findByTag(tag, root)\n--- - Searches the entire scene unless a `root` node is provided.\n---\n--- **Instance call**\n--- obj:findByTag(tag, root)\n--- - Uses `obj` as the root of the search unless an explicit `root`\n--- argument is passed.\n--- - Ideal when searching only within a specific hierarchy.\n---\n--- @param tag string The tag to look for.\n--- @param root (optional) SceneObject The root node to restrict the search to.\n--- @return table A table of objects that have the given tag. May be empty if no matches are found.\n--- @usage\n--- -- Global search\n--- local enemies = SceneObject.findByTag(\"Enemy\")\n--- for _, enemy in ipairs(enemies) do\n--- print(\"Found enemy:\", enemy:getName())\n--- end\n---\n--- -- Scoped search under a specific parent node\n--- local tagged = SceneObject.findByTag(\"Interactable\", parentNode)\n--- for _, obj in ipairs(tagged) do\n--- print(\"Found interactable under parent:\", obj:getName())\n--- end\n---\n--- -- Instance call: search within a specific object's hierarchy\n--- local level = SceneObject.findByName(\"Level1\")\n--- local enemies = level:findByTag(\"Enemy\")\n--- for _, enemy in ipairs(enemies) do\n--- print(\"Found enemy under level:\", enemy:getName())\n--- end\nfunction SceneObject.findByTag(self, tag, root)\n -- Detect if called as instance method\n if type(self) == \"table\" and self._isSceneObject then\n -- Instance call: default root to self if not provided (and self is not the class)\n if root == nil and self ~= SceneObject then\n root = self\n end\n else\n -- Static call: shift parameters\n tag, root = self, tag\n end\n \n __assertTrace(tag, \"tag is empty\")\n \n local objects = _internal.sendMessage('sceneobject.findByTag', { \n tag = tag, \n root = root and root._handle or nil \n })\n \n for key, value in pairs(objects) do\n objects[key] = handle.createObject(value)\n end\n \n return objects\nend\n\n---Create a new object in the scenegraph. This is a generic function, for specialized versions, see the respective Sg<name> classes like SgBox.\n--- @param objectType string Type of object (e.g., SceneObject.Type.Sphere).\n--- @param options table The options to use. Common options are listed below. Additional type-specific options are documented in the specialized functions (e.g., SgBox.create, SgSphere.create).\n--- @param parent Object the parent object to add the new one to or nil to put it at root level\n--- @return Promise a promise resolving to a SceneObject\n--- @usage\n--- -- Options can be omitted. This example shows the defaults,\n--- -- only specify the ones you want different.\n--- SceneObject.create(SceneObject.Type.Sphere, {\n--- active = true,\n--- static = false,\n--- name = \"\",\n--- transform = Transform.new(),\n--- layers = {0},\n--- tags = {},\n--- receiveShadow = false,\n--- castShadow = false,\n--- -- Type-specific options (e.g., for Sphere):\n--- radius = 1,\n--- widthSegments = 8,\n--- heightSegments = 6\n--- }, nil):next(function(obj)\n--- obj:setActive(true)\n--- end)\nfunction SceneObject.create(self, objectType, options, parent)\n if (type(self) == \"string\") then\n objectType, options, parent = self, objectType, options\n end\n\n __assertTrace(type(objectType) == 'string', 'objectType must be a string')\n __assertTrace(parent == nil or (type(parent) == 'table' and parent._isSceneObject), 'parent must be a SceneObject')\n\n local p = _internal.sendMessage('sceneobject.create', {\n type = objectType,\n options = options,\n parent = parent and parent._handle or nil\n })\n return Promise:new(p)\nend\n\n--- Get the ID of the scene object.\n--- @return string The unique ID of the object.\n--- @usage\n--- local obj = SceneObject.findByName(\"Cube\")\n--- print(\"Object ID:\", obj:getId())\nfunction SceneObject:getId()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return self._nodeId\nend\n\n--- Get the name of the scene object.\n--- @return string The user-defined name of the object.\n--- @usage\n--- local obj = SceneObject.findByName(\"Cube\")\n--- print(\"Object name:\", obj:getName())\nfunction SceneObject:getName()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return _internal.sendMessage('sceneobject.getName', { obj=self._handle })\nend\n\n--- Return the display name of the scene object.\n--- In case the object has no user-given name, a name will be generated\n--- in the format \"type <id>\"\n--- @return string Displayname\n--- @usage\n--- local obj = SceneObject.findByName(\"Enemy\")\n--- print(\"Display name:\", obj:getDisplayName())\nfunction SceneObject:getDisplayName()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return _internal.sendMessage('sceneobject.getDisplayName', { obj=self._handle })\nend\n\n--- Return the type of the object\n--- @return string Type\n--- @usage\n--- local obj = SceneObject.findByName(\"Wall\")\n--- print(\"Object type:\", obj:getType())\nfunction SceneObject:getType()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return _internal.sendMessage('sceneobject.getType', { obj=self._handle })\nend\n\n--- Set a field of the scene object to a new value.\n---\n--- @param name string The name of the field.\n--- @param value any The new value to set.\n--- @usage\n--- local obj = SceneObject.findByName(\"Light\")\n--- obj:set(\"Brightness\", \"High\")\nfunction SceneObject:set(name, value)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n name = capitalizeFirstLetter(name)\n _internal.sendMessage('sceneobject.set', { obj=self._handle, name=name, value=value })\nend\n\n--- Get a field value from the scene object.\n---\n--- @param name string The name of the field.\n--- @return string The value of the field.\n--- @usage\n--- local obj = SceneObject.findByName(\"Lamp\")\n--- local intensity = obj:get(\"Intensity\")\n--- print(\"Intensity: \" .. intensity)\nfunction SceneObject:get(name)\n\n -- This is a replacement for the old get() function without parameters that would just return a node reference\n -- It needs to stay in place as long as there are still scripts that depend on it.\n if name == nil then\n return self\n end\n\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n name = capitalizeFirstLetter(name)\n local field = _internal.sendMessage('sceneobject.get', { obj=self._handle, name=name })\n if field == nil then\n return nil\n end\n return toType(field.value, field.type)\nend\n\n--- Set a field of the scene object to a new value.\n---@deprecated 25.11 Use ``set`` which is the new shorter version\n--- @param name string The name of the field.\n--- @param value any The new value to set.\n--- @usage\n--- local obj = SceneObject.findByName(\"Light\")\n--- obj:setFieldValue(\"Brightness\", \"High\")\nfunction SceneObject:setFieldValue(name, value)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n name = capitalizeFirstLetter(name)\n _internal.sendMessage('sceneobject.set', { obj=self._handle, name=name, value=value })\nend\n\n--- Get a field value from the scene object.\n---@deprecated 25.11 Use ``get`` which is the new shorter version\n--- @param name string The name of the field.\n--- @return string The value of the field.\n--- @usage\n--- local obj = SceneObject.findByName(\"Lamp\")\n--- local intensity = obj:getFieldValue(\"Intensity\")\n--- print(\"Intensity: \" .. intensity)\nfunction SceneObject:getFieldValue(name)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n name = capitalizeFirstLetter(name)\n local field = _internal.sendMessage('sceneobject.get', { obj=self._handle, name=name })\n if field == nil then\n return nil\n end\n return toType(field.value, field.type)\nend\n\n--- Animate a field from its current value to a new value.\n---\n--- @param name string The name of the field\n--- @param value any The new value to animate to.\n--- @param duration number The duration in milliseconds for the animation to take\n--- @param ease string The type of easing to use. Possible values: 'linear', 'easeInOutQuad'\n--- @return number animation id. Can be used to cancel animation using cancelAnimation(id)\nfunction SceneObject:animateFieldValue(name, value, duration, ease)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(not (type(value) == 'table'), \"Cannot animate objects!\");\n name = capitalizeFirstLetter(name)\n return _internal.sendMessage('sceneobject.animateFieldValue', { obj=self._handle, name=name, value=value, duration=duration, ease=ease })\nend\n\n--- Cancel a running animation\n---\n--- @param name string The name of the field\nfunction SceneObject:cancelAnimation(id)\n _internal.sendMessage('sceneobject.cancelAnimation', { obj=self._handle, id=id })\nend\n\n--- Set a field of the scene object to a new color value.\n---@deprecated 25.09 Use ``set`` which handle the correct type automatically.\n--- @param name string The name of the field.\n--- @param value Color The new color value.\n--- @usage\n--- local obj = SceneObject.findByName(\"Cube\")\n--- obj:setFieldColorValue(\"Color\", Color.new(1, 0, 0, 1)) -- Sets the object to red.\nfunction SceneObject:setFieldColorValue(name, value)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(value._isColor, \"value is not a Color\")\n name = capitalizeFirstLetter(name)\n _internal.sendMessage('sceneobject.set', { obj=self._handle, name=name, value=value:toData() })\nend\n\n--- Set a field of the scene object to a new number value.\n---@deprecated 25.09 Use ``set`` which handle the correct type automatically.\n--- @param name string The name of the field.\n--- @param value number The new number value.\nfunction SceneObject:setFieldNumberValue(name, value)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(type(value) == \"number\", \"value must be a number\")\n name = capitalizeFirstLetter(name)\n _internal.sendMessage('sceneobject.set', { obj=self._handle, name=name, value=value })\nend\n\n---Set a field of the scene object to a new enum value\n--- @param name string\n--- @param value number\nfunction SceneObject:setFieldEnumValue(name, value)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n name = capitalizeFirstLetter(name)\n _internal.sendMessage('sceneobject.set', { obj=self._handle, name=name, value=value })\nend\n\n---Set a field of the scene object to a new boolean value\n---@deprecated 25.09 Use ``set`` which handle the correct type automatically.\n--- @param name string\n--- @param value boolean\nfunction SceneObject:setFieldBooleanValue(name, value)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n if value then value = true else value = false end\n name = capitalizeFirstLetter(name)\n _internal.sendMessage('sceneobject.set', { obj=self._handle, name=name, value=value })\nend\n\n--- Get the layers of the scene object\n--- @return table A table containing layer indices\nfunction SceneObject:getLayers()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n local internal_layers = self:getFieldValue(\"Layers\")\n __assertTrace(type(internal_layers) == \"table\", \"Expected 'Layers' to be a table\")\n\n -- convert internal 0-based indices to frontend 1-based indices\n local layers = {}\n for _, layer_idx in ipairs(internal_layers) do\n table.insert(layers, layer_idx + 1)\n end\n\n return layers\nend\n\n--- Set the layers of the scene object.\n--- Layers control rendering visibility and interaction with other objects.\n---\n--- @param layers table A table containing layer indices.\n--- @usage\n--- local obj = SceneObject.findByName(\"Character\")\n--- obj:setLayers({1, 3, 5}) -- Assigns the object to layers 1, 3, and 5.\nfunction SceneObject:setLayers(layers)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(type(layers) == \"table\", \"Layers must be provided as a table\")\n self:setFieldValue(\"Layers\", layers)\nend\n\n--- Get the value of a scene object's field as color value.\n---@deprecated 25.09 Use ``get`` which always returns the correct type.\n--- @return Color value of the field\n--- @usage\n--- local obj = SceneObject.findByName(\"Lamp\")\n--- local color = obj:getFieldColorValue(\"Color\")\n--- print(\"Color: \" .. color)\nfunction SceneObject:getFieldColorValue(name)\n return self:getFieldValue(name)\nend\n\n--- Get the value of a scene object's field as number value.\n---@deprecated 25.09 Use ``get`` which always returns the correct type.\n--- @return number value of the field\nfunction SceneObject:getFieldNumberValue(name)\n return self:getFieldValue(name)\nend\n\n--- Get the value of a scene object's field as boolean value.\n---@deprecated 25.09 Use ``get`` which always returns the correct type.\n--- @return boolean value of the field\nfunction SceneObject:getFieldBooleanValue(name)\n return self:getFieldValue(name)\nend\n\n--- Get the value of a scene object's field as string value.\n---@deprecated 25.09 Use ``get`` which always returns the correct type.\n--- @return string value of the field\nfunction SceneObject:getFieldEnumValue(name)\n return self:getFieldValue(name)\nend\n\n--- Get the value of a scene object's field as string value\n--- @return string value of the field\nfunction SceneObject:getFieldEnumOptions(name)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return _internal.sendMessage('sceneobject.getFieldOptions', { obj=self._handle, name=name })\nend\n\n--- Set a field of the scene object to a new boolean value.\n---@deprecated 25.09 Use ``set`` which handle the correct type automatically.\n--- @param name string The name of the field.\n--- @param value boolean The new boolean value.\n--- @usage\n--- local obj = SceneObject.findByName(\"Door\")\n--- obj:setFieldBooleanValue(\"PhysicsEnabled\", true)\nfunction SceneObject:setFieldBooleanValue(name, value)\n self:setFieldValue(name, not not value)\nend\n\n---Get a link of the scene object to a new value\n---@deprecated 25.11 Use ``get`` which handles items now too\n--- @param name string name of the link field\n--- @return number handle of the linked item or nil if not set\nfunction SceneObject:getLinkItem(name)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n name = capitalizeFirstLetter(name)\n return handle.createObject(_internal.sendMessage('sceneobject.getLinkItem', { obj=self._handle, name=name }))\nend\n\n---Set a link from the scene object\n---@deprecated 25.11 Use ``set`` which handles items now too\n--- @param name string name of the link field\n--- @param item string value can be either an item ID or an Item object\nfunction SceneObject:setLinkItem(name, item)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(not item or (item and item._handle and item._isItem), \"item has to be an object of Item class or nil!\");\n name = capitalizeFirstLetter(name)\n _internal.sendMessage('sceneobject.setLinkItem', { obj=self._handle, name=name, item=item })\nend\n\n--- Set the position of the scene object.\n--- Sets the object's local position to the given coordinates.\n---\n--- @param x number Position along the X-axis.\n--- @param y number Position along the Y-axis.\n--- @param z number Position along the Z-axis.\n--- @usage\n--- local obj = SceneObject.findByName(\"Player\")\n--- if obj then\n--- obj:setPosition(0, 5, 0) -- Places the object at (0, 5, 0)\n--- end\nfunction SceneObject:setPosition(x, y, z)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n\n _internal.sendMessage('sceneobject.setPosition', {\n obj = self._handle,\n x = x,\n y = y,\n z = z\n })\nend\n\n--- Translate (move) the scene object by an offset.\n--- Adds the given offset to the object's current local position.\n---\n--- @param x number Offset along the X-axis.\n--- @param y number Offset along the Y-axis.\n--- @param z number Offset along the Z-axis.\n--- @usage\n--- local obj = SceneObject.findByName(\"Player\")\n--- if obj then\n--- obj:translate(0, 1, 0) -- Moves the object up by 1 unit from its current position\n--- end\nfunction SceneObject:translate(x, y, z)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n _internal.sendMessage('sceneobject.translate', {\n obj = self._handle,\n x = x,\n y = y,\n z = z\n })\nend\n\n--- Rotate the scene object.\n--- Rotation is applied in degrees and follows Euler angles (XYZ order).\n---\n--- @param x number Rotation around the X-axis in degrees.\n--- @param y number Rotation around the Y-axis in degrees.\n--- @param z number Rotation around the Z-axis in degrees.\n--- @usage\n--- local obj = SceneObject.findByName(\"Cube\")\n--- if obj then\n--- obj:rotate(45, 0, 0) -- Rotates 45 degrees around the X-axis\n--- end\nfunction SceneObject:rotate(x, y, z)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n _internal.sendMessage('sceneobject.rotate', { obj=self._handle, x=x, y=y, z=z })\nend\n\n--- Scale the scene object.\n---\n--- @param x number Scale factor along the X-axis.\n--- @param y number Scale factor along the Y-axis.\n--- @param z number Scale factor along the Z-axis.\n--- @usage\n--- local obj = SceneObject.findByName(\"Tree\")\n--- if obj then\n--- obj:scale(2, 2, 2) -- Doubles the size of the object\n--- end\nfunction SceneObject:scale(x, y, z)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n _internal.sendMessage('sceneobject.scale', { obj=self._handle, x=x, y=y, z=z })\nend\n\n--- Get the local transform of a scene object.\n--- The transform contains position, rotation, and scale relative to the object's parent.\n---\n--- @param cacheLocal boolean if set to true, the transform will be cached locally for the future for performance reasons. This should only be used if no other script changes the transform\n--- @return Transform The object's local transform.\n--- @usage\n--- local obj = SceneObject.findByName(\"Character\")\n--- local transform = obj:getTransform()\n--- print(\"Local position:\", transform.position)\nfunction SceneObject:getTransform(cacheLocal)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n if self._transform == nil or not cacheLocal then\n self._transform = Transform.fromData(_internal.sendMessage('sceneobject.getTransform', { obj=self._handle }))\n end\n return self._transform:clone()\nend\n\n--- Apply a function to modify the object's transform, then update it.\n--- This allows making changes to the transform while ensuring they are properly applied back.\n---\n--- @param func function A function that takes a Transform object as its only argument.\n--- @param cacheLocal boolean if set to true, the transform will be cached locally for the future for performance reasons. This should only be used if no other script changes the transform\n--- @usage\n--- local obj = SceneObject.findByName(\"Cube\")\n--- obj:withTransform(function(transform)\n--- transform.position.x = transform.position.x + 1 -- Move object 1 unit to the right\n--- end)\nfunction SceneObject:withTransform(func, cacheLocal)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(type(func) == 'function', \"argument func is not a function\")\n local transform = self:getTransform(cacheLocal)\n func(transform)\n self:setTransform(transform)\nend\n\n--- Get the world transform of a scene object.\n--- The world transform includes absolute position, rotation, and scale in the scene.\n---\n--- @return Transform The object's world transform.\n--- @usage\n--- local obj = SceneObject.findByName(\"Light\")\n--- local worldTransform = obj:getWorldTransform()\n--- print(\"World position:\", worldTransform.position)\nfunction SceneObject:getWorldTransform()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return Transform.fromData(_internal.sendMessage('sceneobject.getWorldTransform', { obj=self._handle }))\nend\n\n--- Get the forward direction vector in world space.\n--- Returns the local -Z axis transformed by the object's rotation.\n---\n--- @return Vector3 The forward direction in world space.\nfunction SceneObject:getForward()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return Vector3.fromData(_internal.sendMessage('sceneobject.getForward', { obj=self._handle }))\nend\n\n--- Get the right direction vector in world space.\n--- Returns the local +X axis transformed by the object's rotation.\n---\n--- @return Vector3 The right direction in world space.\nfunction SceneObject:getRight()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return Vector3.fromData(_internal.sendMessage('sceneobject.getRight', { obj=self._handle }))\nend\n\n--- Get the up direction vector in world space.\n--- Returns the local +Y axis transformed by the object's rotation.\n---\n--- @return Vector3 The up direction in world space.\nfunction SceneObject:getUp()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return Vector3.fromData(_internal.sendMessage('sceneobject.getUp', { obj=self._handle }))\nend\n\n--- Set the local transform of a scene object.\n--- Updates the object's position, rotation, and scale relative to its parent.\n---\n--- @param transform Transform The new local transform to apply.\n--- @usage\n--- local obj = SceneObject.findByName(\"Door\")\n--- local newTransform = Transform.new()\n--- newTransform.position = Vector3.new(0, 2, 0) -- Move the object up 2 units\n--- obj:setTransform(newTransform)\nfunction SceneObject:setTransform(transform)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(transform and transform._isTransform, \"transform has to be an object of type Transform\")\n self._transform = transform\n _internal.sendMessage('sceneobject.setTransform', { obj=self._handle, transform=self._transform:toData() })\nend\n\n--- Set the physics position of the scene object.\n---\n--- This directly updates the position of the object inside the physics engine.\n--- The position is expressed in world coordinates.\n--- Only works for objects added to the physics engine\n--- @param position Vector3 New world position of the object.\n--- @usage\n--- local obj = SceneObject.findByName(\"Box\")\n--- obj:setPhysicsPosition(Vector3.new(0, 5, 0))\nfunction SceneObject:setPhysicsPosition(position)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(position and position._isVector3, \"position has to be an object of type Vector3\")\n _internal.sendMessage('sceneobject.setPhysicsPosition', { obj=self._handle, position=position:toData() })\nend\n\n--- Set the physics rotation of the scene object.\n---\n--- This directly updates the rotation of the object inside the physics engine.\n--- The rotation is expressed in world space.\n--- Only works for objects added to the physics engine\n--- @param rotation Quaternion New world rotation of the object.\n--- @usage\n--- local obj = SceneObject.findByName(\"Box\")\n--- obj:setPhysicsRotation(Quaternion.fromEuler(0, math.pi, 0))\nfunction SceneObject:setPhysicsRotation(rotation)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(rotation and rotation._isQuaternion, \"rotation has to be an object of type Quaternion\")\n _internal.sendMessage('sceneobject.setPhysicsRotation', { obj=self._handle, rotation=rotation:toData() })\nend\n\nfunction SceneObject:setPhysicsRotation(rotation)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(rotation and rotation._isQuaternion, \"rotation has to be an object of type Quaternion\")\n _internal.sendMessage('sceneobject.setPhysicsRotation', { obj=self._handle, rotation=rotation:toData() })\nend\n\n--- Get the linear velocity of the scene object.\n--- This function returns the object's velocity in world coordinates.\n--- Only works for objects added to the physics engine with `watchLinearVelocity` enabled.\n---\n--- @return Vector3 The linear velocity of the object.\n--- @usage\n--- local obj = SceneObject.findByName(\"Ball\")\n--- local velocity = obj:getLinearVelocity()\n--- print(\"Velocity:\", velocity)\nfunction SceneObject:getLinearVelocity()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return Vector3.fromData(_internal.sendMessage('sceneobject.getLinearVelocity', { obj=self._handle }))\nend\n\n--- Set the linear velocity of the scene object.\n--- This function assigns a new velocity to the object, but only works if the object is in the physics engine.\n---\n--- @param velocity Vector3 The new linear velocity to apply.\n--- @usage\n--- local obj = SceneObject.findByName(\"Car\")\n--- obj:setLinearVelocity(Vector3.new(10, 0, 0)) -- Move object at speed 10 in the X direction.\nfunction SceneObject:setLinearVelocity(velocity)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(velocity and velocity._isVector3, \"velocity must be an object of type Vector3\")\n local data = velocity:toData()\n _internal.sendMessage('sceneobject.setLinearVelocity', { obj=self._handle, velocity=data })\nend\n\n--- Get the angular velocity of the scene object.\n--- Only works for objects added to the physics engine with `watchAngularVelocity` enabled.\n---\n--- @return Vector3 The angular velocity of the object.\n--- @usage\n--- local obj = SceneObject.findByName(\"Wheel\")\n--- local angVel = obj:getAngularVelocity()\n--- print(\"Angular velocity:\", angVel)\nfunction SceneObject:getAngularVelocity()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return Vector3.fromData(_internal.sendMessage('sceneobject.getAngularVelocity', { obj=self._handle }))\nend\n\n--- Set the angular velocity of the scene object.\n---\n--- @param velocity Vector3 The new angular velocity to apply.\n--- @usage\n--- local obj = SceneObject.findByName(\"Propeller\")\n--- obj:setAngularVelocity(Vector3.new(0, 10, 0)) -- Rotate around Y-axis.\nfunction SceneObject:setAngularVelocity(velocity)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(velocity and velocity._isVector3, \"velocity must be an object of type Vector3\")\n local data = velocity:toData()\n _internal.sendMessage('sceneobject.setAngularVelocity', { obj=self._handle, velocity=data })\nend\n\n--- Apply an impulse to the scene object.\n---\n--- An **impulse** is a sudden force applied to an object that immediately\n--- changes its velocity. This is different from a continuous force, which\n--- is applied over time.\n---\n--- This function only works on objects that are physics-enabled.\n---\n--- @param impulse Vector3 The force impulse to apply.\n--- @param relPos Vector3 The relative position where the impulse is applied. Default is (0, 0, 0)\nfunction SceneObject:applyImpulse(impulse, relPos)\n relPos = relPos or Vector3.new(0, 0, 0)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(impulse and impulse._isVector3, \"impulse must be an object of type Vector3\")\n __assertTrace(relPos and relPos._isVector3, \"relPos must be an object of type Vector3\")\n local impulseData = impulse:toData()\n local relPosData = relPos:toData()\n _internal.sendMessage('sceneobject.applyImpulse', { obj=self._handle, impulse=impulseData, relPos=relPosData })\nend\n\n--- Apply an impulse to the scene object that respects constraints.\n---\n--- Only works on physics-enabled objects.\n---\n--- @param impulse Vector3 The force impulse to apply.\n--- @param relPos Vector3 The relative position where the impulse is applied. Default is (0, 0, 0)\nfunction SceneObject:applyPushImpulse(impulse, relPos)\n relPos = relPos or Vector3.new(0, 0, 0)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(impulse and impulse._isVector3, \"impulse must be an object of type Vector3\")\n __assertTrace(relPos and relPos._isVector3, \"relPos must be an object of type Vector3\")\n _internal.sendMessage('sceneobject.applyPushImpulse', { obj=self._handle, impulse=impulse:toData(), relPos=relPos:toData() })\nend\n\n--- Apply an impulse to the center of the object.\n---\n--- Applies a sudden velocity change at the object's center. Only works on physics-enabled objects.\n---\n--- @param impulse Vector3 The force impulse to apply.\n--- @usage\n--- local obj = SceneObject.findByName(\"Box\")\n--- obj:applyCentralImpulse(Vector3.new(0, 5, 0)) -- Apply upward impulse.\nfunction SceneObject:applyCentralImpulse(impulse)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(impulse and impulse._isVector3, \"impulse must be an object of type Vector3\")\n _internal.sendMessage('sceneobject.applyCentralImpulse', { obj=self._handle, impulse=impulse:toData() })\nend\n\n--- Apply a central impulse that respects constraints.\n---\n--- Only works on physics-enabled objects and respects any joint or constraint applied.\n---\n--- @param impulse Vector3 The force impulse to apply.\n--- @usage\n--- local obj = SceneObject.findByName(\"Box\")\n--- obj:applyCentralPushImpulse(Vector3.new(0, 5, 0)) -- Apply upward impulse.\nfunction SceneObject:applyCentralPushImpulse(impulse)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(impulse and impulse._isVector3, \"impulse must be an object of type Vector3\")\n _internal.sendMessage('sceneobject.applyCentralPushImpulse', { obj=self._handle, impulse=impulse:toData() })\nend\n\n--- Apply a force to the scene object.\n---\n--- Unlike impulses, **forces** are applied over time, influencing the object's acceleration.\n--- Only works on physics-enabled objects.\n---\n--- @param force Vector3 The force vector to apply.\n--- @param relPos Vector3 The relative position where the force is applied. Default is (0, 0, 0)\nfunction SceneObject:applyForce(force, relPos)\n relPos = relPos or Vector3.new(0, 0, 0)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(force and force._isVector3, \"force must be an object of type Vector3\")\n __assertTrace(relPos and relPos._isVector3, \"relPos must be an object of type Vector3\")\n _internal.sendMessage('sceneobject.applyForce', { obj=self._handle, force=force:toData(), relPos=relPos:toData() })\nend\n\n--- Clear any forces on a scene object.\n--- Only works on physics-enabled objects.\n--- @usage\n--- local obj = SceneObject.findByName(\"Ball\")\n--- obj:clearForces()\nfunction SceneObject:clearForces()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n _internal.sendMessage('sceneobject.clearForces', { obj=self._handle })\nend\n\n--- Delete the scene object from the scene.\n---\n--- @usage\n--- local obj = scene:findByName(\"TemporaryObject\")\n--- if obj then\n--- obj:delete()\n--- end\nfunction SceneObject:delete()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n _internal.sendMessage('sceneobject.delete', { obj=self._handle })\n if self._handle then\n handle.invalidate(self._handle)\n end\n self._handle = nil\nend\n\n--- Clone a scene object to a new position and return it.\n---\n--- The position can be provided as:\n--- 1. Separate `x, y, z` coordinates.\n--- 2. A `Vector3` containing the position.\n---\n--- If no position is provided, the clone will appear in the same location as the original.\n---\n--- @param x number | Vector3 The X-coordinate of the new position, or a `Vector3` containing `x, y, z`. If a `Vector3` is passed, `y` and `z` should be omitted.\n--- @param y number (optional) The Y-coordinate of the new position. Omit this if passing a `Vector3`.\n--- @param z number (optional) The Z-coordinate of the new position. Omit this if passing a `Vector3`.\n--- @param parent SceneObject (optional) The parent object to attach the new object to.\n--- @return Promise A promise resolving to a SceneObject.\n---\n--- @usage\n--- local obj = scene:findByName(\"Tree\")\n--- obj:clone(5, 0, 2):next(function(clone)\n--- clone:setActive(true) -- Activate the cloned object\n--- end)\n---\n--- local pos = Vector3.new(3, 1, 0)\n--- obj:clone(pos):next(function(clone)\n--- clone:setFieldValue(\"Name\", \"ClonedTree\") -- Rename the cloned object\n--- end)\n---\n--- local parentObj = scene:findByName(\"Group\")\n--- obj:clone(pos, parentObj):next(function(clone)\n--- clone:setFieldValue(\"Name\", \"AnotherClonedTree\") -- Rename the cloned object\n--- end)\nfunction SceneObject:clone(x, y, z, parent)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n\n -- Handle case where first argument is a Vector3 and second argument is the parent\n if type(x) == \"table\" and x._isVector3 then\n x, y, z, parent = x.x, x.y, x.z, y -- Shift arguments\n end\n\n local p = _internal.sendMessage('sceneobject.clone', {\n obj = self._handle,\n x = x,\n y = y,\n z = z,\n parent = parent and parent._handle or nil\n })\n\n return Promise:new(p)\nend\n\n--- Create a new object of same type from this one. If no options are specified this will be basically a clone.\n--- If an options table is passed, this will specify all fields with their values that should be changed.\n--- At the very least, this should contain a new Transform, otherwise the new object will be at the exact location\n--- of the old one.\n--- @param options table the table of fields to set on the new object\n--- @param parent SceneObject (optional) The parent object to attach the new object to.\n--- @return Promise A promise resolving to a SceneObject.\n---\n--- @usage\n--- local obj = SceneObject.findByName(\"Tree\")\n--- local parentObj = SceneObject.findByName(\"Group\")\n--- local clone = await(obj:createFromThis({\n--- transform = Transform.new(Vector3.new(4, 6, 8)),\n--- active = true,\n--- name = \"Cloned tree\"\n--- }, parentObj)\nfunction SceneObject:createFromThis(options, parent)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(parent == nil or parent._isSceneObject, \"parent is not nil or a SceneObject\")\n\n local p = _internal.sendMessage('sceneobject.createFromThis', {\n obj = self._handle,\n options = options,\n parent = parent and parent._handle or nil\n })\n\n return Promise:new(p)\nend\n\n--- Move the scene object to a different parent. This parent can not be a child of the scene object\n--- @param parent SceneObject (optional) The parent object to attach the new object to. if nil, the object will be moved to the scenegraph root\nfunction SceneObject:moveToParent(parent)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(not parent or parent._isSceneObject, \"parent is not a SceneObject\")\n _internal.sendMessage('sceneobject.moveToParent', { obj = self._handle, parent = parent and parent._handle or nil })\nend\n\n--- Set the active state of the scene object.\n--- @param value boolean True to activate, false to deactivate.\nfunction SceneObject:setActive(value)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n self:setFieldValue(\"Active\", value)\nend\n\n--- Get the active state of the scene object.\n--- @return boolean True if the object is active, false otherwise.\nfunction SceneObject:getActive()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return self:getFieldBooleanValue(\"Active\")\nend\n\n--- Check if the object has a specific tag.\n--- @param tagName string The tag name to check.\n--- @return boolean True if the object has the tag, false otherwise.\nfunction SceneObject:hasTag(tagName)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n local tags = self:getFieldValue(\"Tags\")\n for _, value in pairs(tags) do\n if value == tagName then\n return true\n end\n end\n return false\nend\n\n--- Get a list of all tags assigned to the object.\n--- @return table An array of tag names.\nfunction SceneObject:getTags()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return self:getFieldValue(\"Tags\")\nend\n\n--- Assign a set of tags to the object.\n--- @param tags table An array of tag names.\nfunction SceneObject:setTags(tags)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n Tools.validateArrayOfStrings(tags)\n self:setFieldValue(\"Tags\", tags)\nend\n\n--- Add a tag to the object.\n--- @param tag string The tag to add.\nfunction SceneObject:addTag(tag)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(type(tag) == 'string', \"tag needs to be a string\")\n local tags = self:getTags()\n table.insert(tags, tag)\n self:setTags(tags)\nend\n\n--- Remove all tags from the object.\nfunction SceneObject:clearTags()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n self:setTags({})\nend\n\n--- Take a snapshot of the object and its children, if specified.\n--- This allows restoring the object to a previous state.\n--- @param recursive boolean Whether to include child objects in the snapshot.\n--- @return number The snapshot handle.\nfunction SceneObject:takeSnapshot(recursive)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return _internal.sendMessage('sceneobject.takeSnapshot', { obj=self._handle, recursive=recursive })\nend\n\n--- Restore a snapshot, reverting any changes made after the snapshot was taken.\n--- @param snapshot number The snapshot handle to restore.\nfunction SceneObject:rollbackSnapshot(snapshot)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n _internal.sendMessage('sceneobject.rollbackSnapshot', { obj=self._handle, snapshot=snapshot })\nend\n\n--- Check if the object is enabled.\n--- @return boolean True if the object is enabled, false otherwise.\nfunction SceneObject:isEnabled()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return _internal.sendMessage('sceneobject.isEnabled', { obj=self._handle })\nend\n\n--- Enable the object.\nfunction SceneObject:enable()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n _internal.sendMessage('sceneobject.enable', { obj=self._handle })\nend\n\n--- Disable the object.\nfunction SceneObject:disable()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n _internal.sendMessage('sceneobject.disable', { obj=self._handle })\nend\n\n--- Get the material assigned to the object.\n--- @return Material The material, or nil if none is assigned.\nfunction SceneObject:getMaterial()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return self:getLinkItem(\"Material\")\nend\n\n--- Set the object's material.\n--- @param mat Material The material to set or nil to clear the material\nfunction SceneObject:setMaterial(mat)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n __assertTrace(mat == nil or (type(mat) == 'table' and mat._isMaterial), \"self is not a SceneObject\")\n self:setLinkItem(\"Material\", mat)\nend\n\n--- Get all behaviours attached to this object.\n---@deprecated 25.12 use getBehaviours.\n--- @return table A list of Behaviour objects.\nfunction SceneObject:getEntities()\n return self:getBehaviours()\nend\n\n--- Get all behaviours attached to this object.\n--- @return table A list of Behaviour objects.\nfunction SceneObject:getBehaviours()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n if not self._nodeId then\n error(\"This scene object does not have a node Id. Cannot get its behaviours.\")\n end\n return Behaviour.getByNodeId(self._nodeId)\nend\n\n--- Get a behaviour attached to this object by its script name.\n--- @param name string The script name.\n--- @return Behaviour The corresponding behaviour, or nil if not found.\nfunction SceneObject:getBehaviourByScriptName(name)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n if not self._nodeId then\n error(\"This scene object does not have a node Id. Cannot get its entities.\")\n end\n return Behaviour.getByNodeIdAndScriptName(self._nodeId, name)\nend\n\n--- Get a behaviour attached to this object by its script name.\n---@deprecated\n--- @param name string The script name.\n--- @return Behaviour The corresponding behaviour, or nil if not found.\nfunction SceneObject:getEntityByScriptName(name)\n return self:getBehaviourByScriptName(name)\nend\n\n--- Get a behaviour attached to this object by its script name.\n--- @param name string The script name.\n--- @return Behaviour The corresponding behaviour, or nil if not found.\nfunction SceneObject:behaviour(name)\n return self:getBehaviourByScriptName(name)\nend\n\n--- Get a behaviour attached to this object by its script name.\n--- @param name string The script name.\n--- @return Behaviour The corresponding behaviour, or nil if not found.\nfunction SceneObject:entity(name)\n return self:getBehaviourByScriptName(name)\nend\n\n--- Get the parent of the object.\n--- @return SceneObject The parent object, or nil if none exists.\nfunction SceneObject:getParent()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n return handle.createObject(_internal.sendMessage('sceneobject.getParent', { obj=self._handle }))\nend\n\n--- Get the children of the object.\n--- @return table A table of child objects.\nfunction SceneObject:getChildren()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n local objects = _internal.sendMessage('sceneobject.getChildren', { obj=self._handle })\n for key, value in pairs(objects) do\n objects[key] = handle.createObject(value)\n end\n return objects\nend\n\n--- Enable or disable automatic recreation of the scene object between play and stop.\n---\n--- When `value` is true, the object will be automatically recreated every time\n--- the scene starts or stops. This is useful for objects that need to reset\n--- physics, state, or procedural components at each run.\n---\n--- @param value boolean Enable (`true`) or disable (`false`) automatic recreation.\nfunction SceneObject:setAutoRecreate(value)\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n _internal.sendMessage('sceneobject.setAutoRecreate', { obj=self._handle, value=value })\nend\n\n--- Immediately recreate the scene object.\n---\n--- This forces the object to reset its state, physics, and components as if\n--- it was newly instantiated in the scene.\nfunction SceneObject:recreate()\n __assertTrace(self._isSceneObject, \"self is not a SceneObject\")\n _internal.sendMessage('sceneobject.recreate', { obj=self._handle })\nend\n\nreturn SceneObject\n";
|
|
130992
130992
|
|
|
130993
|
-
var lua_api_sceneobjects_audio = "\nlocal _internal = require('engine/_internal')\nlocal SceneObject = require('engine/sceneobject')\n\n------------------------------------------------------------------\n-- SgAudio class\n------------------------------------------------------------------\n\n--- @class SgAudio\nlocal SgAudio = Class.new(SceneObject)\n\n--- @private\nfunction SgAudio:__new(handle, nodeId)\n SceneObject.__new(self, handle, nodeId)\n self._type = \"SgAudio\"\n self._isSgAudio = true\nend\n\n--- Create a new audio object in the scenegraph.\n---@param options table A table of options to fill the parameters\n---@param parent SceneObject The parent scene object to add this to\n---@return Promise a promise which will resolve to the created object\nfunction SgAudio.create(self, options, parent)\n -- check if static function was called as method. if so, shift the parameters\n if not (type(self) == 'table' and type(self.new) == 'function') then\n parent, options = options, self\n end\n return SceneObject.create(\"SgAudio\", options, parent)\nend\n\n--- playback the audio\n---@param force boolean Force the sound to replay even if it is already playing\nfunction SgAudio:play(force)\n assert(self._isSgAudio, \"self is not an SgAudio object\")\n _internal.sendMessage('sgaudio.play', { obj=self._handle, force=force })\nend\n\n--- stop the audio\nfunction SgAudio:stop()\n assert(self._isSgAudio, \"self is not an SgAudio object\")\n _internal.sendMessage('sgaudio.stop', { obj=self._handle })\nend\n\n--- Checks if the audio is playing\n---@return boolean true, if sound is playing, false otherwise\nfunction SgAudio:isPlaying()\n assert(self._isSgAudio, \"self is not an SgAudio object\")\n return _internal.sendMessage('sgaudio.isPlaying', { obj=self._handle })\nend\n\nfunction SgAudio:setPlaybackRate(value)\n assert(self._isSgAudio, \"self is not an SgAudio object\")\n self:setFieldNumberValue(\"PlaybackRate\", value)\nend\n\nfunction SgAudio:getPlaybackRate()\n assert(self._isSgAudio, \"self is not an SgAudio object\")\n return self:getFieldNumberValue(\"PlaybackRate\");\nend\n\nfunction SgAudio:getAudioCollectionEntry()\n assert(self._isSgAudio, \"self is not an SgAudio object\")\n return self:getFieldValue(\"AudioCollectionEntry\")\nend\n\nfunction SgAudio:setAudioCollectionEntry(name)\n assert(self._isSgAudio, \"self is not an SgAudio object\")\n self:setFieldValue(\"AudioCollectionEntry\", name)\nend\n\nreturn SgAudio\n";
|
|
130993
|
+
var lua_api_sceneobjects_audio = "\nlocal _internal = require('engine/_internal')\nlocal SceneObject = require('engine/sceneobject')\n\n------------------------------------------------------------------\n-- SgAudio class\n------------------------------------------------------------------\n\n--- @class SgAudio\nlocal SgAudio = Class.new(SceneObject)\n\n--- @private\nfunction SgAudio:__new(handle, nodeId)\n SceneObject.__new(self, handle, nodeId)\n self._type = \"SgAudio\"\n self._isSgAudio = true\nend\n\n--- Create a new audio object in the scenegraph.\n---@param options table A table of options to fill the parameters\n---@param parent SceneObject The parent scene object to add this to\n---@return Promise a promise which will resolve to the created object\n---@usage\n--- -- Options can be omitted. This example shows the defaults,\n--- -- only specify the ones you want different.\n--- SgAudio.create({\n--- active = true,\n--- name = \"\",\n--- transform = Transform.new(),\n--- layers = {0},\n--- tags = {},\n--- autoplay = false,\n--- loop = false,\n--- volume = 1,\n--- panning = 0,\n--- playbackRate = 1,\n--- offset = 0\n--- })\nfunction SgAudio.create(self, options, parent)\n -- check if static function was called as method. if so, shift the parameters\n if not (type(self) == 'table' and type(self.new) == 'function') then\n parent, options = options, self\n end\n return SceneObject.create(\"SgAudio\", options, parent)\nend\n\n--- playback the audio\n---@param force boolean Force the sound to replay even if it is already playing\nfunction SgAudio:play(force)\n assert(self._isSgAudio, \"self is not an SgAudio object\")\n _internal.sendMessage('sgaudio.play', { obj=self._handle, force=force })\nend\n\n--- stop the audio\nfunction SgAudio:stop()\n assert(self._isSgAudio, \"self is not an SgAudio object\")\n _internal.sendMessage('sgaudio.stop', { obj=self._handle })\nend\n\n--- Checks if the audio is playing\n---@return boolean true, if sound is playing, false otherwise\nfunction SgAudio:isPlaying()\n assert(self._isSgAudio, \"self is not an SgAudio object\")\n return _internal.sendMessage('sgaudio.isPlaying', { obj=self._handle })\nend\n\nfunction SgAudio:setPlaybackRate(value)\n assert(self._isSgAudio, \"self is not an SgAudio object\")\n self:setFieldNumberValue(\"PlaybackRate\", value)\nend\n\nfunction SgAudio:getPlaybackRate()\n assert(self._isSgAudio, \"self is not an SgAudio object\")\n return self:getFieldNumberValue(\"PlaybackRate\");\nend\n\nfunction SgAudio:getAudioCollectionEntry()\n assert(self._isSgAudio, \"self is not an SgAudio object\")\n return self:getFieldValue(\"AudioCollectionEntry\")\nend\n\nfunction SgAudio:setAudioCollectionEntry(name)\n assert(self._isSgAudio, \"self is not an SgAudio object\")\n self:setFieldValue(\"AudioCollectionEntry\", name)\nend\n\nreturn SgAudio\n";
|
|
130994
130994
|
|
|
130995
|
-
var lua_api_sceneobjects_audiolistener = "\nlocal SceneObject = require('engine/sceneobject')\n\n------------------------------------------------------------------\n-- SgAudioListener class\n------------------------------------------------------------------\n\n--- @class SgAudioListener\nlocal SgAudioListener = Class.new(SceneObject)\n\n--- @private\nfunction SgAudioListener:__new(handle, nodeId)\n SceneObject.__new(self, handle, nodeId)\n self._type = \"SgAudioListener\"\n self._isSgAudioListener = true\nend\n\n--- Create a new audio listener object in the scenegraph.\n---@param options table A table of options to fill the parameters\n---@param parent SceneObject The parent scene object to add this to\n---@return Promise a promise which will resolve to the created object\nfunction SgAudioListener.create(self, options, parent)\n -- check if static function was called as method. if so, shift the parameters\n if not (type(self) == 'table' and type(self.new) == 'function') then\n parent, options = options, self\n end\n return SceneObject.create(\"SgAudioListener\", options, parent)\nend\n\nreturn SgAudioListener\n";
|
|
130995
|
+
var lua_api_sceneobjects_audiolistener = "\nlocal SceneObject = require('engine/sceneobject')\n\n------------------------------------------------------------------\n-- SgAudioListener class\n------------------------------------------------------------------\n\n--- @class SgAudioListener\nlocal SgAudioListener = Class.new(SceneObject)\n\n--- @private\nfunction SgAudioListener:__new(handle, nodeId)\n SceneObject.__new(self, handle, nodeId)\n self._type = \"SgAudioListener\"\n self._isSgAudioListener = true\nend\n\n--- Create a new audio listener object in the scenegraph.\n---@param options table A table of options to fill the parameters\n---@param parent SceneObject The parent scene object to add this to\n---@return Promise a promise which will resolve to the created object\n---@usage\n--- -- Options can be omitted. This example shows the defaults,\n--- -- only specify the ones you want different.\n--- SgAudioListener.create({\n--- active = true,\n--- name = \"\",\n--- transform = Transform.new(),\n--- layers = {0},\n--- tags = {}\n--- })\nfunction SgAudioListener.create(self, options, parent)\n -- check if static function was called as method. if so, shift the parameters\n if not (type(self) == 'table' and type(self.new) == 'function') then\n parent, options = options, self\n end\n return SceneObject.create(\"SgAudioListener\", options, parent)\nend\n\nreturn SgAudioListener\n";
|
|
130996
130996
|
|
|
130997
|
-
var lua_api_sceneobjects_billboard = "\nlocal SceneObject = require('engine/sceneobject')\n\n------------------------------------------------------------------\n-- SgBillboard class\n------------------------------------------------------------------\n\n--- @class SgBillboard\nlocal SgBillboard = Class.new(SceneObject)\n\n--- @private\nfunction SgBillboard:__new(handle, nodeId)\n SceneObject.__new(self, handle, nodeId)\n self._type = \"SgBillboard\"\n self._isSgBillboard = true\nend\n\n--- Create a new billboard object in the scenegraph.\n---@param options table A table of options to fill the parameters\n---@param parent SceneObject The parent scene object to add this to\n---@return Promise a promise which will resolve to the created object\nfunction SgBillboard.create(self, options, parent)\n -- check if static function was called as method. if so, shift the parameters\n if not (type(self) == 'table' and type(self.new) == 'function') then\n parent, options = options, self\n end\n return SceneObject.create(\"SgBillboard\", options, parent)\nend\n\nreturn SgBillboard\n";
|
|
130997
|
+
var lua_api_sceneobjects_billboard = "\nlocal SceneObject = require('engine/sceneobject')\n\n------------------------------------------------------------------\n-- SgBillboard class\n------------------------------------------------------------------\n\n--- @class SgBillboard\nlocal SgBillboard = Class.new(SceneObject)\n\n--- @private\nfunction SgBillboard:__new(handle, nodeId)\n SceneObject.__new(self, handle, nodeId)\n self._type = \"SgBillboard\"\n self._isSgBillboard = true\nend\n\n--- Create a new billboard object in the scenegraph.\n---@param options table A table of options to fill the parameters\n---@param parent SceneObject The parent scene object to add this to\n---@return Promise a promise which will resolve to the created object\n---@usage\n--- -- Options can be omitted. This example shows the defaults,\n--- -- only specify the ones you want different.\n--- SgBillboard.create({\n--- active = true,\n--- name = \"\",\n--- transform = Transform.new(),\n--- layers = {0},\n--- tags = {},\n--- receiveShadow = false,\n--- castShadow = false\n--- })\nfunction SgBillboard.create(self, options, parent)\n -- check if static function was called as method. if so, shift the parameters\n if not (type(self) == 'table' and type(self.new) == 'function') then\n parent, options = options, self\n end\n return SceneObject.create(\"SgBillboard\", options, parent)\nend\n\nreturn SgBillboard\n";
|
|
130998
130998
|
|
|
130999
130999
|
var lua_api_sceneobjects_box = "\nlocal SceneObject = require('engine/sceneobject')\n\n------------------------------------------------------------------\n-- SgBox class\n------------------------------------------------------------------\n\n--- @class SgBox\nlocal SgBox = Class.new(SceneObject)\n\n--- @private\nfunction SgBox:__new(handle, nodeId)\n SceneObject.__new(self, handle, nodeId)\n self._type = \"SgBox\"\n self._isSgBox = true\nend\n\n--- Create a new box object in the scenegraph. See possible options below.\n---@param options table A table of options to fill the parameters\n---@param parent SceneObject The parent scene object to add this to\n---@return Promise a promise which will resolve to the created object\n---@usage\n--- -- Options can be omitted. This example shows the defaults,\n--- -- only specify the ones you want different.\n--- SgBox.create({\n--- active = true,\n--- name = \"\",\n--- transform = Transform.new(),\n--- layers = {0},\n--- tags = {},\n--- receiveShadow = false,\n--- castShadow = false,\n--- material = nil,\n--- size = Vector3.new(1, 1, 1),\n--- segments = Vector3.new(1, 1, 1)\n--- })\nfunction SgBox.create(self, options, parent)\n -- check if static function was called as method. if so, shift the parameters\n if not (type(self) == 'table' and type(self.new) == 'function') then\n parent, options = options, self\n end\n return SceneObject.create(\"SgBox\", options, parent)\nend\n\nreturn SgBox\n";
|
|
131000
131000
|
|
|
@@ -131022,7 +131022,7 @@ var lua_api_sceneobjects_plane = "\nlocal SceneObject = require('engine/sceneobj
|
|
|
131022
131022
|
|
|
131023
131023
|
var lua_api_sceneobjects_points = "\nlocal SceneObject = require('engine/sceneobject')\n\n------------------------------------------------------------------\n-- SgPoints class\n------------------------------------------------------------------\n\n--- @class SgPoints\nlocal SgPoints = Class.new(SceneObject)\n\n--- @private\nfunction SgPoints:__new(handle, nodeId)\n SceneObject.__new(self, handle, nodeId)\n self._type = \"SgPoints\"\n self._isSgPoints = true\nend\n\n--- Create a new points object in the scenegraph.\n---@param options table A table of options to fill the parameters\n---@param parent SceneObject The parent scene object to add this to\n---@return Promise a promise which will resolve to the created object\n---@usage\n--- -- Options can be omitted. This example shows the defaults,\n--- -- only specify the ones you want different.\n--- SgPoints.create({\n--- active = true,\n--- name = \"\",\n--- transform = Transform.new(),\n--- layers = {0},\n--- tags = {},\n--- mesh = nil\n--- })\nfunction SgPoints.create(self, options, parent)\n -- check if static function was called as method. if so, shift the parameters\n if not (type(self) == 'table' and type(self.new) == 'function') then\n parent, options = options, self\n end\n return SceneObject.create(\"SgPoints\", options, parent)\nend\n\nreturn SgPoints\n";
|
|
131024
131024
|
|
|
131025
|
-
var lua_api_sceneobjects_positionalaudio = "\nlocal _internal = require('engine/_internal')\nlocal SceneObject = require('engine/sceneobject')\n\n------------------------------------------------------------------\n-- SgPositionalAudio class\n------------------------------------------------------------------\n\n--- @class SgPositionalAudio\nlocal SgPositionalAudio = Class.new(SceneObject)\n\n--- @private\nfunction SgPositionalAudio:__new(handle, nodeId)\n SceneObject.__new(self, handle, nodeId)\n self._type = \"SgPositionalAudio\"\n self._isSgPositionalAudio = true\nend\n\n--- Create a new positional audio object in the scenegraph.\n---@param options table A table of options to fill the parameters\n---@param parent SceneObject The parent scene object to add this to\n---@return Promise a promise which will resolve to the created object\nfunction SgPositionalAudio.create(self, options, parent)\n -- check if static function was called as method. if so, shift the parameters\n if not (type(self) == 'table' and type(self.new) == 'function') then\n parent, options = options, self\n end\n return SceneObject.create(\"SgPositionalAudio\", options, parent)\nend\n\n--- playback the audio\n---@param force boolean Force the sound to replay even if it is already playing\nfunction SgPositionalAudio:play(force)\n assert(self._isSgPositionalAudio, \"self is not an SgPositionalAudio object\")\n _internal.sendMessage('sgpositionalaudio.play', { obj=self._handle, force=force })\nend\n\n--- stop the audio\nfunction SgPositionalAudio:stop()\n assert(self._isSgPositionalAudio, \"self is not an SgPositionalAudio object\")\n _internal.sendMessage('sgpositionalaudio.stop', { obj=self._handle })\nend\n\n--- Checks if the audio is playing\n---@return boolean true, if sound is playing, false otherwise\nfunction SgPositionalAudio:isPlaying()\n assert(self._isSgPositionalAudio, \"self is not an SgPositionalAudio object\")\n return _internal.sendMessage('sgpositionalaudio.isPlaying', { obj=self._handle })\nend\n\nfunction SgPositionalAudio:getAudioCollectionEntry()\n assert(self._isSgPositionalAudio, \"self is not an SgPositionalAudio object\")\n return self:getFieldValue(\"AudioCollectionEntry\")\nend\n\nfunction SgPositionalAudio:setAudioCollectionEntry(name)\n assert(self._isSgPositionalAudio, \"self is not an SgPositionalAudio object\")\n self:setFieldValue(\"AudioCollectionEntry\", name)\nend\n\nreturn SgPositionalAudio\n";
|
|
131025
|
+
var lua_api_sceneobjects_positionalaudio = "\nlocal _internal = require('engine/_internal')\nlocal SceneObject = require('engine/sceneobject')\n\n------------------------------------------------------------------\n-- SgPositionalAudio class\n------------------------------------------------------------------\n\n--- @class SgPositionalAudio\nlocal SgPositionalAudio = Class.new(SceneObject)\n\n--- @private\nfunction SgPositionalAudio:__new(handle, nodeId)\n SceneObject.__new(self, handle, nodeId)\n self._type = \"SgPositionalAudio\"\n self._isSgPositionalAudio = true\nend\n\n--- Create a new positional audio object in the scenegraph.\n---@param options table A table of options to fill the parameters\n---@param parent SceneObject The parent scene object to add this to\n---@return Promise a promise which will resolve to the created object\n---@usage\n--- -- Options can be omitted. This example shows the defaults,\n--- -- only specify the ones you want different.\n--- SgPositionalAudio.create({\n--- active = true,\n--- name = \"\",\n--- transform = Transform.new(),\n--- layers = {0},\n--- tags = {},\n--- autoplay = false,\n--- loop = false,\n--- volume = 1,\n--- panning = 0,\n--- playbackRate = 1,\n--- offset = 0,\n--- refDistance = 1,\n--- maxDistance = 10000,\n--- rolloffFactor = 1,\n--- direction = \"Omnidirectional\",\n--- coneInnerAngle = 90,\n--- coneOuterAngle = 180,\n--- coneOuterGain = 0.2\n--- })\nfunction SgPositionalAudio.create(self, options, parent)\n -- check if static function was called as method. if so, shift the parameters\n if not (type(self) == 'table' and type(self.new) == 'function') then\n parent, options = options, self\n end\n return SceneObject.create(\"SgPositionalAudio\", options, parent)\nend\n\n--- playback the audio\n---@param force boolean Force the sound to replay even if it is already playing\nfunction SgPositionalAudio:play(force)\n assert(self._isSgPositionalAudio, \"self is not an SgPositionalAudio object\")\n _internal.sendMessage('sgpositionalaudio.play', { obj=self._handle, force=force })\nend\n\n--- stop the audio\nfunction SgPositionalAudio:stop()\n assert(self._isSgPositionalAudio, \"self is not an SgPositionalAudio object\")\n _internal.sendMessage('sgpositionalaudio.stop', { obj=self._handle })\nend\n\n--- Checks if the audio is playing\n---@return boolean true, if sound is playing, false otherwise\nfunction SgPositionalAudio:isPlaying()\n assert(self._isSgPositionalAudio, \"self is not an SgPositionalAudio object\")\n return _internal.sendMessage('sgpositionalaudio.isPlaying', { obj=self._handle })\nend\n\nfunction SgPositionalAudio:getAudioCollectionEntry()\n assert(self._isSgPositionalAudio, \"self is not an SgPositionalAudio object\")\n return self:getFieldValue(\"AudioCollectionEntry\")\nend\n\nfunction SgPositionalAudio:setAudioCollectionEntry(name)\n assert(self._isSgPositionalAudio, \"self is not an SgPositionalAudio object\")\n self:setFieldValue(\"AudioCollectionEntry\", name)\nend\n\nreturn SgPositionalAudio\n";
|
|
131026
131026
|
|
|
131027
131027
|
var lua_api_sceneobjects_prefab = "\nlocal SceneObject = require('engine/sceneobject')\n\n------------------------------------------------------------------\n-- SgPrefab class\n------------------------------------------------------------------\n\n--- @class SgPrefab\nlocal SgPrefab = Class.new(SceneObject)\n\n--- @private\nfunction SgPrefab:__new(handle, nodeId)\n SceneObject.__new(self, handle, nodeId)\n self._type = \"SgPrefab\"\n self._isSgPrefab = true\nend\n\n--- Create a new prefab object in the scenegraph.\n---@param options table A table of options to fill the parameters\n---@param parent SceneObject The parent scene object to add this to\n---@return Promise a promise which will resolve to the created object\n---@usage\n--- -- Options can be omitted. This example shows the defaults,\n--- -- only specify the ones you want different.\n--- SgPrefab.create({\n--- active = true,\n--- name = \"\",\n--- transform = Transform.new(),\n--- layers = {0},\n--- tags = {},\n--- receiveShadow = false,\n--- castShadow = false,\n--- prefab = nil,\n--- })\nfunction SgPrefab.create(self, options, parent)\n -- check if static function was called as method. if so, shift the parameters\n if not (type(self) == 'table' and type(self.new) == 'function') then\n parent, options = options, self\n end\n return SceneObject.create(\"SgPrefab\", options, parent)\nend\n\nreturn SgPrefab\n";
|
|
131028
131028
|
|
|
@@ -131030,7 +131030,7 @@ var lua_api_sceneobjects_ribbon = "\nlocal SceneObject = require('engine/sceneob
|
|
|
131030
131030
|
|
|
131031
131031
|
var lua_api_sceneobjects_ring = "\nlocal SceneObject = require('engine/sceneobject')\n\n------------------------------------------------------------------\n-- SgRing class\n------------------------------------------------------------------\n\n--- @class SgRing\nlocal SgRing = Class.new(SceneObject)\n\n--- @private\nfunction SgRing:__new(handle, nodeId)\n SceneObject.__new(self, handle, nodeId)\n self._type = \"SgRing\"\n self._isSgRing = true\nend\n\n--- Create a new ring object in the scenegraph.\n---@param options table A table of options to fill the parameters\n---@param parent SceneObject The parent scene object to add this to\n---@return Promise a promise which will resolve to the created object\n---@usage\n--- -- Options can be omitted. This example shows the defaults,\n--- -- only specify the ones you want different.\n--- SgRing.create({\n--- active = true,\n--- name = \"\",\n--- transform = Transform.new(),\n--- layers = {0},\n--- tags = {},\n--- receiveShadow = false,\n--- castShadow = false,\n--- material = nil,\n--- innerRadius = 0.5,\n--- outerRadius = 1,\n--- thetaSegments = 8,\n--- phiSegments = 1,\n--- thetaStart = 0,\n--- thetaLength = 360\n--- })\nfunction SgRing.create(self, options, parent)\n -- check if static function was called as method. if so, shift the parameters\n if not (type(self) == 'table' and type(self.new) == 'function') then\n parent, options = options, self\n end\n return SceneObject.create(\"SgRing\", options, parent)\nend\n\nreturn SgRing\n";
|
|
131032
131032
|
|
|
131033
|
-
var lua_api_sceneobjects_scene = "\nlocal SceneObject = require('engine/sceneobject')\n\n------------------------------------------------------------------\n-- SgScene class\n------------------------------------------------------------------\n\n--- @class SgScene\nlocal SgScene = Class.new(SceneObject)\n\n--- @private\nfunction SgScene:__new(handle, nodeId)\n SceneObject.__new(self, handle, nodeId)\n self._type = \"SgScene\"\n self._isSgScene = true\nend\n\n--- Create a new scene object in the scenegraph.\n---@param options table A table of options to fill the parameters\n---@param parent SceneObject The parent scene object to add this to\n---@return Promise a promise which will resolve to the created object\nfunction SgScene.create(self, options, parent)\n -- check if static function was called as method. if so, shift the parameters\n if not (type(self) == 'table' and type(self.new) == 'function') then\n parent, options = options, self\n end\n return SceneObject.create(\"SgScene\", options, parent)\nend\n\nreturn SgScene\n";
|
|
131033
|
+
var lua_api_sceneobjects_scene = "\nlocal SceneObject = require('engine/sceneobject')\n\n------------------------------------------------------------------\n-- SgScene class\n------------------------------------------------------------------\n\n--- @class SgScene\nlocal SgScene = Class.new(SceneObject)\n\n--- @private\nfunction SgScene:__new(handle, nodeId)\n SceneObject.__new(self, handle, nodeId)\n self._type = \"SgScene\"\n self._isSgScene = true\nend\n\n--- Create a new scene object in the scenegraph.\n---@param options table A table of options to fill the parameters\n---@param parent SceneObject The parent scene object to add this to\n---@return Promise a promise which will resolve to the created object\n---@usage\n--- -- Options can be omitted. This example shows the defaults,\n--- -- only specify the ones you want different.\n--- SgScene.create({\n--- active = true,\n--- name = \"\",\n--- transform = Transform.new(),\n--- layers = {0},\n--- tags = {}\n--- })\nfunction SgScene.create(self, options, parent)\n -- check if static function was called as method. if so, shift the parameters\n if not (type(self) == 'table' and type(self.new) == 'function') then\n parent, options = options, self\n end\n return SceneObject.create(\"SgScene\", options, parent)\nend\n\nreturn SgScene\n";
|
|
131034
131034
|
|
|
131035
131035
|
var lua_api_sceneobjects_scriptedmesh = "\nlocal _internal = require('engine/_internal')\nlocal SceneObject = require('engine/sceneobject')\n\n------------------------------------------------------------------\n-- SgScriptedMesh class\n------------------------------------------------------------------\n\n--- @class SgScriptedMesh\nlocal SgScriptedMesh = Class.new(SceneObject)\n\n--- @private\nfunction SgScriptedMesh:__new(handle, nodeId)\n SceneObject.__new(self, handle, nodeId)\n self._type = \"SgScriptedMesh\"\n self._isSgScriptedMesh = true\n self._offset = 1\nend\n\n--- Create a new scripted mesh object in the scenegraph.\n---@param options table A table of options to fill the parameters\n---@param parent SceneObject The parent scene object to add this to\n---@return Promise a promise which will resolve to the created object\n---@usage\n--- -- Options can be omitted. This example shows the defaults,\n--- -- only specify the ones you want different.\n--- SgScriptedMesh.create({\n--- active = true,\n--- name = \"\",\n--- transform = Transform.new(),\n--- layers = {0},\n--- tags = {},\n--- receiveShadow = false,\n--- castShadow = false,\n--- materials = nil,\n--- indexed = false,\n--- havePositions = true,\n--- haveNormals = false,\n--- haveColors = false,\n--- haveUVs = false\n--- })\nfunction SgScriptedMesh.create(self, options, parent)\n -- check if static function was called as method. if so, shift the parameters\n if not (type(self) == 'table' and type(self.new) == 'function') then\n parent, options = options, self\n end\n return SceneObject.create(\"SgScriptedMesh\", options, parent)\nend\n\n--- Set position data of the vertex. Any number of values can be written at once.\n---@param data table Array of position data.\n---@usage\n--- mesh:setPositions({{1, 2, 3}, {2, 3, 4}}, 0)\nfunction SgScriptedMesh:setPositions(data, offset)\n self:setAttributeData(\"position\", data, offset or 0);\nend\n\n--- Set color data of the vertex. Any number of values can be written at once.\n---@param data table Array of color data.\n---@usage\n--- mesh:setColors({{1, 0, 1}, {1, 1, 1}}, 0)\nfunction SgScriptedMesh:setColors(data, offset)\n self:setAttributeData(\"color\", data, offset or 0);\nend\n\n--- Set normal data of the vertex. Any number of values can be written at once.\n---@param data table Array of normal data.\n---@usage\n--- mesh:setNormals({{1, 0, 1}, {1, 1, 1}}, 0)\nfunction SgScriptedMesh:setNormals(data, offset)\n self:setAttributeData(\"normal\", data, offset or 0);\nend\n\n--- Set UV data of the vertex. Any number of values can be written at once.\n---@param data table Array of UV data.\n---@usage\n--- mesh:setUvs({{1, 0}, {1, 1}}, 0)\nfunction SgScriptedMesh:setUvs(data, offset)\n self:setAttributeData(\"uv\", data, offset or 0);\nend\n\n--- Allocate space for the vertex data.\n---@param size number Vertex count to allocate. This will allocate enough space to fit the requested positions, colors, normals and UVs.\nfunction SgScriptedMesh:alloc(size)\n local havePositions = self:get(\"HavePositions\")\n if havePositions then\n self._positions = {}\n self._positions[size*3] = 0\n end\n\n local haveColors = self:get(\"HaveColors\")\n if haveColors then\n self._colors = {}\n self._colors[size*3] = 0\n end\n\n local haveNormals = self:get(\"HaveNormals\")\n if haveNormals then\n self._normals = {}\n self._normals[size*3] = 0\n end\n\n local haveUvs = self:get(\"HaveUVs\")\n if haveUvs then\n self._uvs = {}\n self._uvs[size*2] = 0\n end\nend\n\n--- Set attribute data. This function is used to set any type of attribute (positions, normals, colors or UVs) on the\n--- mesh. You can use the specialized functions setPositions, setNormals, setColors, setUvs instead.\n--- After doing all changes, call update() to actually write the changes to the engine.\n---@param type string Type of attribute. Has to be one of \"position\", \"normal\", \"color\", or \"uv\"\n---@param data table Array of data to write.\n---@param offset number Offset within the vertex data to write the new entries to.\n---@usage\n--- mesh:setAttributeData(\"position\", {{ 1, 2, 3}, {2, 3, 4}}, 0)\nfunction SgScriptedMesh:setAttributeData(type, data, offset)\n assert(self._isSgScriptedMesh, \"self is not an SgScriptedMesh\")\n _internal.sendMessage('sgscriptedmesh.setAttributeData', { obj=self._handle, type=type, data=data, offset=offset or 0 })\nend\n\n--- Writes all changed vertex data to the engine and updates the mesh\n---@param computeBounds boolean If set to true, bounding box and sphere will be recalculated.\nfunction SgScriptedMesh:update(computeBounds)\n if self._positions then\n self:setAttributeData(\"position\", self._positions)\n end\n if self._colors then\n self:setAttributeData(\"color\", self._colors)\n end\n if self._normals then\n self:setAttributeData(\"normal\", self._normals)\n end\n if self._uvs then\n self:setAttributeData(\"uv\", self._uvs)\n end\n\n if computeBounds then\n self:computeBoundingBox()\n self:computeBoundingSphere()\n end\nend\n\n--- Set a specific vertex in the mesh. Write all attributes at once.\n---@param offset number Vertex offset in the mesh.\n---@param pos table position of the vertex as array of 3 number values. Can be nil if you don't want to set it\n---@param uv table UV coords of the vertex as array of 2 number values. Can be nil if you don't want to set it\n---@param col table color of the vertex as array of 3 number values. Can be nil if you don't want to set it\n---@param normal table normal of the vertex as array of 3 number values. Can be nil if you don't want to set it\nfunction SgScriptedMesh:setVertex(offset, pos, uv, col, normal)\n local offs3 = (offset-1)*3\n local offs2 = (offset-1)*2\n\n if pos and self._positions then\n self._positions[offs3+1] = pos[1]\n self._positions[offs3+2] = pos[2]\n self._positions[offs3+3] = pos[3]\n end\n\n if col and self._colors then\n self._colors[offs3+1] = col[1]\n self._colors[offs3+2] = col[2]\n self._colors[offs3+3] = col[3]\n end\n\n if normal and self._normals then\n self._normals[offs3+1] = normal[1]\n self._normals[offs3+2] = normal[2]\n self._normals[offs3+3] = normal[3]\n end\n\n if uv and self._uvs then\n self._uvs[offs2+1] = uv[1]\n self._uvs[offs2+2] = uv[2]\n end\n\n return offset+1\nend\n\n--- Rewind the internal offset to the first vertex. This is used together with the addVertex function that\n--- increases the internal offset by 1 with each call.\nfunction SgScriptedMesh:rewind()\n self._offset = 1\nend\n\n--- Set the internal offset to a specific value\n---@param offset number offset of the vertex. First vertex has offset 1\nfunction SgScriptedMesh:setOffset(offset)\n self._offset = offset\nend\n\n--- Add a new vertex at the internal offset value. This function will increase the offset by one after writing the data\n---@param pos table position of the vertex as array of 3 number values. Can be nil if you don't want to set it\n---@param uv table UV coords of the vertex as array of 2 number values. Can be nil if you don't want to set it\n---@param col table color of the vertex as array of 3 number values. Can be nil if you don't want to set it\n---@param normal table normal of the vertex as array of 3 number values. Can be nil if you don't want to set it\nfunction SgScriptedMesh:addVertex(pos, uv, col, normals)\n self._offset = self:setVertex(self._offset, pos, uv, col, normals)\nend\n\n--- Compute the bounding box of the mesh after updating the vertex data. update() should be called before calling this.\nfunction SgScriptedMesh:computeBoundingBox()\n assert(self._isSgScriptedMesh, \"self is not an SgScriptedMesh\")\n _internal.sendMessage('sgscriptedmesh.computeBoundingBox', { obj=self._handle })\nend\n\n--- Compute the bounding sphere of the mesh after updating the vertex data. update() should be called before calling this.\nfunction SgScriptedMesh:computeBoundingSphere()\n assert(self._isSgScriptedMesh, \"self is not an SgScriptedMesh\")\n _internal.sendMessage('sgscriptedmesh.computeBoundingSphere', { obj=self._handle })\nend\n\n--- Compute the vertex tangents of the mesh after updating the vertex data. update() should be called before calling this.\nfunction SgScriptedMesh:computeTangents()\n assert(self._isSgScriptedMesh, \"self is not an SgScriptedMesh\")\n _internal.sendMessage('sgscriptedmesh.computeTangents', { obj=self._handle })\nend\n\n--- Compute the vertex normals of the mesh after updating the vertex data. update() should be called before calling this.\nfunction SgScriptedMesh:computeVertexNormals()\n assert(self._isSgScriptedMesh, \"self is not an SgScriptedMesh\")\n _internal.sendMessage('sgscriptedmesh.computeVertexNormals', { obj=self._handle })\nend\n\nreturn SgScriptedMesh\n";
|
|
131036
131036
|
|
|
@@ -131044,7 +131044,7 @@ var lua_api_sceneobjects_torus = "\nlocal SceneObject = require('engine/sceneobj
|
|
|
131044
131044
|
|
|
131045
131045
|
var lua_api_sceneobjects_vehicle = "\nlocal _internal = require('engine/_internal');\nlocal SceneObject = require('engine/sceneobject')\n\n------------------------------------------------------------------\n-- SgVehicle class\n------------------------------------------------------------------\n\n--- @class SgVehicle\nlocal SgVehicle = Class.new(SceneObject)\n\n--- @private\nfunction SgVehicle:__new(handle, nodeId)\n SceneObject.__new(self, handle, nodeId)\n self._type = \"SgVehicle\"\n self._isSgVehicle = true\nend\n\n--- Create a new vehicle object in the scenegraph.\n---@param options table A table of options to fill the parameters\n---@param parent SceneObject The parent scene object to add this to\n---@return Promise a promise which will resolve to the created object\n---@usage\n--- -- Options can be omitted. This example shows the defaults,\n--- -- only specify the ones you want different.\n--- SgVehicle.create({\n--- active = true,\n--- name = \"\",\n--- transform = Transform.new(),\n--- layers = {0},\n--- tags = {},\n--- receiveShadow = false,\n--- castShadow = false\n--- })\nfunction SgVehicle.create(self, options, parent)\n -- check if static function was called as method. if so, shift the parameters\n if not (type(self) == 'table' and type(self.new) == 'function') then\n parent, options = options, self\n end\n return SceneObject.create(\"SgVehicle\", options, parent)\nend\n\n---Get speed in km/h of the vehicle\nfunction SgVehicle:getSpeed()\n assert(self._isSgVehicle, \"self is not an SgVehicle object\")\n return _internal.sendMessage('sgvehicle.getSpeed', { obj=self._handle })\nend\n\n---Set the steering of the vehicle\n---@param wheels table an array of { index, value } objects setting a new steering value for wheels\nfunction SgVehicle:setSteering(wheels)\n assert(self._isSgVehicle, \"self is not an SgVehicle object\")\n _internal.sendMessage('sgvehicle.setSteering', { obj=self._handle, wheels=wheels })\nend\n\n---Set the brakes of the vehicle\n---@param wheels table an array of { index, value } objects setting a new brake value for wheels\nfunction SgVehicle:setBrakes(wheels)\n assert(self._isSgVehicle, \"self is not an SgVehicle object\")\n _internal.sendMessage('sgvehicle.setBrakes', { obj=self._handle, wheels=wheels })\nend\n\n---Set the acceleration of the vehicle\n---@param wheels table an array of { index, value } objects setting a new acceleration value for wheels\nfunction SgVehicle:setAcceleration(wheels)\n assert(self._isSgVehicle, \"self is not an SgVehicle object\")\n _internal.sendMessage('sgvehicle.setAcceleration', { obj=self._handle, wheels=wheels })\nend\n\nreturn SgVehicle\n";
|
|
131046
131046
|
|
|
131047
|
-
var lua_api_sceneobjects_particles = "\nlocal _internal = require('engine/_internal')\nlocal SceneObject = require('engine/sceneobject')\nlocal Tools = require(\"engine/tools\")\n\n------------------------------------------------------------------\n-- SgParticleSystem class\n------------------------------------------------------------------\n\n--- @class SgParticleSystem\nlocal SgParticleSystem = Class.new(SceneObject)\n\n--- @private\nfunction SgParticleSystem:__new(handle, nodeId)\n SceneObject.__new(self, handle, nodeId)\n self._type = \"SgParticleSystem\"\n self._isSgParticleSystem = true\nend\n\n--- Create a new particle system object in the scenegraph.\n---@param options table A table of options to fill the parameters\n---@param parent SceneObject The parent scene object to add this to\n---@return Promise a promise which will resolve to the created object\nfunction SgParticleSystem.create(self, options, parent)\n -- check if static function was called as method. if so, shift the parameters\n if not (type(self) == 'table' and type(self.new) == 'function') then\n parent, options = options, self\n end\n return SceneObject.create(\"SgParticleSystem\", options, parent)\nend\n\n--- Destroys the particle system.\nfunction SgParticleSystem:destroy()\n _internal.sendMessage('sgparticles.destroy', { obj=self._handle })\nend\n\n--- Returns the number of particles in the particle system.\n---@return number The number of particles.\nfunction SgParticleSystem:getParticlesCount()\n return _internal.sendMessage('sgparticles.getParticlesCount', { obj=self._handle })\nend\n\n--- Returns the pause state of the particle system.\n---@return boolean The pause state.\nfunction SgParticleSystem:getPause()\n return _internal.sendMessage('sgparticles.getPause', { obj=self._handle })\nend\n\n--- Returns the spawn amount.\n---@return number The number of particles to spawn.\nfunction SgParticleSystem:getSpawnAmount()\n return _internal.sendMessage('sgparticles.getSpawnAmount', { obj=self._handle })\nend\n\n--- Returns the spawn rate.\n---@return number The rate of particle spawning.\nfunction SgParticleSystem:getSpawnRate()\n return _internal.sendMessage('sgparticles.getSpawnRate', { obj=self._handle })\nend\n\n--- Sets the respawn flag for the particle system.\nfunction SgParticleSystem:getRespawn()\n return _internal.sendMessage('sgparticles.getRespawn', { obj=self._handle })\nend\n\n-- --- Returns the prewarm flag state. WIP\n-- ---@return boolean The prewarm flag state.\n-- function SgParticleSystem:getPrewarm()\n-- return _internal.sendMessage('sgparticles.getPrewarm', { obj=self._handle })\n-- end\n\n-- --- Returns the prewarm amount.\n-- ---@return number The number of particles prewarmed.\n-- function SgParticleSystem:getPrewarmAmount()\n-- return _internal.sendMessage('sgparticles.getPrewarmAmount', { obj=self._handle })\n-- end\n\n--- Returns the emitter parameters.\n---@return table A table containing the shape, type, size.\nfunction SgParticleSystem:getEmitter()\n return _internal.sendMessage('sgparticles.getEmitter', { obj=self._handle })\nend\n\n--- Returns the duration of the particle system.\n---@return number The duration of the particle system.\nfunction SgParticleSystem:getDuration()\n return _internal.sendMessage('sgparticles.getDuration', { obj=self._handle })\nend\n\n--- Returns the emission flag state describing whether or not the particle system is emitting new particles.\n---@return boolean The emission flag state.\nfunction SgParticleSystem:getEmissionFlag()\n return _internal.sendMessage('sgparticles.getEmissionFlag', { obj=self._handle })\nend\n\n--- Returns the continuous emission flag state.\n---@return boolean The continuous emission flag state.\nfunction SgParticleSystem:getContinuousEmissionFlag()\n return _internal.sendMessage('sgparticles.getContinuousEmissionFlag', { obj=self._handle })\nend\n\n--- Returns the local coordinates flag state.\n---@return boolean The local coordinates flag state.\nfunction SgParticleSystem:getLocalCoordsFlag()\n return _internal.sendMessage('sgparticles.getLocalCoordsFlag', { obj=self._handle })\nend\n\n--- Returns the angular velocity of the particles.\n---@return number The angular velocity of the particles.\nfunction SgParticleSystem:getAngularVelocity()\n return _internal.sendMessage('sgparticles.getAngularVelocity', { obj=self._handle })\nend\n\n--- Returns the direction the particles will rotate to.\n---@return number The rotation of particles. 1 will make the particles move clockwise, -1\n--- anti-clockwise and 0 stand still.\nfunction SgParticleSystem:getRotationDirection()\n return _internal.sendMessage('sgparticles.getRotationDirection', { obj=self._handle })\nend\n\n--- Returns the life delta of the particles.\n---@return number The life delta value for particles.\n---@deprecated 25.09 The particle's life logic has been changed and this method is now deprecated Use ``getLife()`` instead.\nfunction SgParticleSystem:getLifeDelta()\n print(\"The method is deprecated!\")\n return\nend\n\n--- Returns the random life delta of the particles.\n---@return number The random life delta value for particles.\n---@deprecated 25.09 The particle's life logic has been changed and this method is now deprecated Use ``getLife()`` instead.\nfunction SgParticleSystem:getLifeDeltaRandom()\n print(\"The method is deprecated!\")\n return\nend\n\n--- Returns the gravity applied to the particles.\n---@return number The gravity value affecting the particles.\nfunction SgParticleSystem:getGravity()\n return _internal.sendMessage('sgparticles.getGravity', { obj=self._handle })\nend\n\n--- Returns the orbital velocity of the particles.\n---@return number The orbital velocity value.\nfunction SgParticleSystem:getOrbitalVelocity()\n return _internal.sendMessage('sgparticles.getOrbitalVelocity', { obj=self._handle })\nend\n\n--- Returns the orbital decay of the particles.\n---@return number The orbital decay value.\nfunction SgParticleSystem:getOrbitalDecay()\n return _internal.sendMessage('sgparticles.getOrbitalDecay', { obj=self._handle })\nend\n\n--- Returns the orbital center point of the particles.\n---@return Vector3 The orbital center point vector.\nfunction SgParticleSystem:getOrbitalCenterPoint()\n return _internal.sendMessage('sgparticles.getOrbitalCenterPoint', { obj=self._handle })\nend\n--- Returns the orbital plane of the particles.\n---@return Vector3 The orbital plane vector.\nfunction SgParticleSystem:getOrbitalPlane()\n return _internal.sendMessage('sgparticles.getOrbitalPlane', { obj=self._handle })\nend\n\n-- TODO requires a refactor of the emitter class\n--- Returns the life of the particles.\n---@return number The life value of the particles.\nfunction SgParticleSystem:getParticleLife()\n return _internal.sendMessage('sgparticles.getParticleLife', { obj=self._handle })\nend\n\n--- Returns the life of the particles.\n---@return number The life value of the particles.\nfunction SgParticleSystem:getParticleLife()\n return _internal.sendMessage('sgparticles.getParticleLife', { obj=self._handle })\nend\n\n--- Returns the particle size.\n---@return table A table containing minSize, maxSize, and approach.\nfunction SgParticleSystem:getParticleSize()\n return _internal.sendMessage('sgparticles.getParticleSize', { obj=self._handle })\nend\n\n--- Returns the particle initial velocity.\n---@return table The initial velocity of the particles encoded as a table for x, y, z values.\nfunction SgParticleSystem:getInitialVelocity()\n return _internal.sendMessage('sgparticles.getInitialVelocity', { obj=self._handle })\nend\n\n--- Returns the particle final velocity.\n---@return table The final velocity of the particles encoded as a table for x, y, z values.\nfunction SgParticleSystem:getFinalVelocity()\n return _internal.sendMessage('sgparticles.getFinalVelocity', { obj=self._handle })\nend\n\n--- Returns the particle final velocity approach value.\n---@return number The final velocity approach value of the particles.\nfunction SgParticleSystem:getFinalVelocityApproachValue()\n return _internal.sendMessage('sgparticles.getFinalVelocityApproachValue', { obj=self._handle })\nend\n\n--- Returns the target direction.\n---@return table The target direction vector.\nfunction SgParticleSystem:getTarget()\n return _internal.sendMessage('sgparticles.getTarget', { obj=self._handle })\nend\n\n--- Returns the target force strength.\n---@return number The target force strength.\nfunction SgParticleSystem:getTargetForce()\n return _internal.sendMessage('sgparticles.getTargetForce', { obj=self._handle })\nend\n\n--- Sets the target deletion threshold.\n---@return number The target delete threshold. A value of -1 will not kill particles.\nfunction SgParticleSystem:getTargetDeletionThreshold()\n return _internal.sendMessage('sgparticles.getTargetDeletionThreshold', { obj=self._handle })\nend\n\n--- Returns the random velocity factor.\n---@return number The random velocity factor.\nfunction SgParticleSystem:getRandomVelocity()\n return _internal.sendMessage('sgparticles.getRandomVelocity', { obj=self._handle })\nend\n\n--- Returns the velocity applied on the direction of normals on a emitter.\n---@return number The velocity factor.\nfunction SgParticleSystem:getNormalVelocity()\n return _internal.sendMessage('sgparticles.getNormalVelocity', { obj=self._handle })\nend\n\n--- Returns the spread factor.\n---@return number The spread applied to the particles at emission.\nfunction SgParticleSystem:getSpread()\n return _internal.sendMessage('sgparticles.getSpread', { obj=self._handle })\nend\n\n--- Returns the bounding box flag state.\n---@return boolean The bounding box flag state.\nfunction SgParticleSystem:getBBoxFlag()\n return _internal.sendMessage('sgparticles.getBBoxFlag', { obj=self._handle })\nend\n\n--- Returns the bounding box dimensions.\n---@return table The bounding box bottom left and top right corners encoded as min, max.\nfunction SgParticleSystem:getBoundingBox()\n return _internal.sendMessage('sgparticles.getBoundingBox', { obj=self._handle })\nend\n\n--- Returns the particle color.\n---@return table A table containing r, g, b, a values.\nfunction SgParticleSystem:getParticleColor()\n return _internal.sendMessage('sgparticles.getParticleColor', { obj=self._handle })\nend\n\n--- Returns the particle random color factor.\n---@return number The random color factor.\nfunction SgParticleSystem:getParticleRandomColorFactor()\n return _internal.sendMessage('sgparticles.getParticleRandomColorFactor', { obj=self._handle })\nend\n\n--- Returns the final color flag for the particles.\n--- This indicates whether the final color property is enabled.\n--- @return boolean True if the final color flag is enabled, false otherwise.\nfunction SgParticleSystem:getEnableFinalColorFlag()\n return _internal.sendMessage('sgparticles.getEnableFinalColorFlag', { obj=self._handle })\nend\n\n--- Returns the final color of the particles.\n---@return table A table containing r, g, b, a values.\nfunction SgParticleSystem:getFinalColor()\n return _internal.sendMessage('sgparticles.getFinalColor', { obj=self._handle })\nend\n\n--- Returns the texture blending flag for the particles.\n--- This indicates whether texture blending is enabled.\n--- @return boolean True if texture blending is enabled, false otherwise.\nfunction SgParticleSystem:getTextureBlendingFlag()\n return _internal.sendMessage('sgparticles.getTextureBlendingFlag', { obj=self._handle })\nend\n\n--- Returns the texture blending value for the particles. The value is between 0 and 1.\n--- @return number The blending value.\nfunction SgParticleSystem:getTextureBlendingFlag()\n return _internal.sendMessage('sgparticles.getBlendingValue', { obj=self._handle })\nend\n\n--- Returns the hue of the particle's texture.\n--- @return number The hue value of the particle's texture.\nfunction SgParticleSystem:getTextureHue()\n return _internal.sendMessage('sgparticles.getTextureHue', { obj=self._handle })\nend\n\n-- TODO implement texture getters\n\n--- Sets the noise strength for the particle system.\n---@return number The noise strength value.\nfunction SgParticleSystem:getNoiseStrength()\n return _internal.sendMessage('sgparticles.getNoiseStrength', { obj=self._handle })\nend\n\n--- Sets the noise frequency for the particle system.\n---@return number The noise frequency value.\nfunction SgParticleSystem:getNoiseFrequency()\n return _internal.sendMessage('sgparticles.getNoiseFrequency', { obj=self._handle })\nend\n\n--- Sets the noise octaves for the particle system.\n---@return number The noise octaves value.\nfunction SgParticleSystem:getNoiseOctaves()\n return _internal.sendMessage('sgparticles.getNoiseOctaves', { obj=self._handle })\nend\n\nSgParticleSystem.Point = \"point\"\nSgParticleSystem.Box = \"box\"\nSgParticleSystem.Sphere = \"sphere\"\nSgParticleSystem.Hemisphere = \"hemisphere\"\nSgParticleSystem.Torus = \"torus\"\nSgParticleSystem.Cone = \"cone\"\nSgParticleSystem.Circle = \"circle\"\nSgParticleSystem.Edge = \"edge\"\nSgParticleSystem.TypeSurface = \"surface\"\nSgParticleSystem.TypeVolume = \"volume\"\nSgParticleSystem.TypeNormals = \"normals\"\n\n-- Arrays are still available for convenience\nSgParticleSystem.EmissionShapes = {\n SgParticleSystem.Point, SgParticleSystem.Box, SgParticleSystem.Sphere,\n SgParticleSystem.Hemisphere, SgParticleSystem.Torus, SgParticleSystem.Cone,\n SgParticleSystem.Circle, SgParticleSystem.Edge\n}\nSgParticleSystem.EmissionTypes = {\n SgParticleSystem.TypeSurface, SgParticleSystem.TypeVolume, SgParticleSystem.TypeNormals\n}\n\n--- Sets the emitter parameters.\n---@param shape string The shape of the emitter.\n---@param type string The type of the emitter.\n---@param size number The size of the emitter.\n--- @usage\n--- local emitterShape\n--- local emitterType\n--- local emitterConfig = {\n--- size = 10,\n--- radius = 5,\n--- outerRadius = 8,\n--- height = 20,\n--- width = 15,\n--- depth = 10,\n--- life = 5.0,\n--- lifeRandomness = 0.2\n--- }\n--- function update()\n--- particleSystem:setEmitter(SgParticleSystem.EmissionShapes[emitterShape:getValue() + 1],\n--- SgParticleSystem.EmissionTypes[emitterType:getValue() + 1], emitterConfig)\n--- end\n--- function rendergui()\n--- gui.text(\"Emitter shape\")\n--- gui.combo(\"Emtiter shape\", emitterShape, SgParticleSystem.EmissionShapes)\n--- gui.combo(\"Emtiter type\", emitterType, SgParticleSystem.EmissionTypes)\n--- gui.endDialog()\n--- end\nfunction SgParticleSystem:setEmitter(shape, type, config)\n if not Tools.isValueInTable(SgParticleSystem.EmissionShapes, shape) then\n error(\"Invalid emission shape: \" .. tostring(shape))\n end\n\n if not Tools.isValueInTable(SgParticleSystem.EmissionTypes, type) then\n error(\"Invalid emission type: \" .. tostring(type))\n end\n\n -- TODO add checks if the config has all the information needed\n _internal.sendMessage('sgparticles.setEmitter', { obj=self._handle, shape=shape, type=type,\n config=config })\nend\n\n--- Sets the pause state of the particle system.\n---@param value boolean The pause state to set.\nfunction SgParticleSystem:setPause(value)\n _internal.sendMessage('sgparticles.setPause', { obj=self._handle, value=value })\nend\n\n--- Kills all particles in the system.\nfunction SgParticleSystem:killAllParticles()\n _internal.sendMessage('sgparticles.killAllParticles', { obj=self._handle })\nend\n\n--- Hides all particles in the system.\nfunction SgParticleSystem:hideParticles()\n _internal.sendMessage('sgparticles.hideParticles', { obj=self._handle })\nend\n\n--- Shows all particles in the system.\nfunction SgParticleSystem:showParticles()\n _internal.sendMessage('sgparticles.showParticles', { obj=self._handle })\nend\n\n--- Restarts the particle system.\nfunction SgParticleSystem:restart()\n _internal.sendMessage('sgparticles.restart', { obj=self._handle })\nend\n\n--- Sets the respawn flag for the particle system.\n---@param value boolean The respawn flag state to set.\nfunction SgParticleSystem:setRespawn(value)\n _internal.sendMessage('sgparticles.setRespawn', { obj=self._handle, value=value })\nend\n\n--- Sets the spawn amount.\n---@param value number The number of particles to spawn.\nfunction SgParticleSystem:setSpawnAmount(value)\n _internal.sendMessage('sgparticles.setSpawnAmount', { obj=self._handle, value=value })\nend\n\n--- Sets the spawn rate.\n---@param value number The rate of particle spawning.\nfunction SgParticleSystem:setSpawnRate(value)\n _internal.sendMessage('sgparticles.setSpawnRate', { obj=self._handle, value=value })\nend\n\n--- Sets the prewarm flag.\n---@param value boolean The prewarm flag state to set.\nfunction SgParticleSystem:setPrewarm(value)\n _internal.sendMessage('sgparticles.setPrewarm', { obj=self._handle, value=value })\nend\n\n-- --- Sets the prewarm amount.\n-- ---@param value number The number of particles to prewarm.\n-- function SgParticleSystem:setPrewarmAmount(value)\n-- _internal.sendMessage('sgparticles.setPrewarmAmount', { obj=self._handle, value=value })\n-- end\n\n-- --- Runs the prewarm process.\n-- function SgParticleSystem:runPrewarm()\n-- _internal.sendMessage('sgparticles.runPrewarm', { obj=self._handle })\n-- end\n\n--- Sets the duration of the particle system.\n---@param value number The duration of the particle system.\nfunction SgParticleSystem:setDuration(value)\n _internal.sendMessage('sgparticles.setDuration', { obj=self._handle, value=value })\nend\n\n--- Sets the continuous emission flag.\n---@param value boolean The continuous emission flag state to set.\nfunction SgParticleSystem:setContinuousEmissionFlag(value)\n _internal.sendMessage('sgparticles.setContinuousEmissionFlag', { obj=self._handle, value=value })\nend\n\n--- Sets the local coordinates flag.\n---@param value boolean The local coordinates flag state to set.\nfunction SgParticleSystem:setLocalCoordsFlag(value)\n _internal.sendMessage('sgparticles.setLocalCoordsFlag', { obj=self._handle, value=value })\nend\n\n--- Emits all particles at once.\nfunction SgParticleSystem:emitAllParticles()\n _internal.sendMessage('sgparticles.emitAllParticles', { obj=self._handle })\nend\n\n--- Emits new particles.\n---@param particleCount number The number of particles to emit.\n---@param continuous boolean Whether to emit particles continuously.\nfunction SgParticleSystem:emitNewParticles(particleCount, continuous)\n _internal.sendMessage('sgparticles.emitNewParticles', { obj=self._handle, particleCount=particleCount or 1, continuous=continuous or true })\nend\n\n--- Sets the particle life parameters.\n---@param life number The lifespan of the particles in seconds.\nfunction SgParticleSystem:setParticleLife(life)\n _internal.sendMessage('sgparticles.setParticleLife', { obj=self._handle, value=life })\nend\n\n--- Sets the particle life parameters.\n---@param lifeRandomness number The randomness factor for the lifespan.\nfunction SgParticleSystem:setParticleLife(lifeRandomness)\n _internal.sendMessage('sgparticles.setParticleLifeRandomness', { obj=self._handle, value=lifeRandomness })\nend\n\n--- Sets the gravity for the particle system.\n---@param value number The gravity value.\nfunction SgParticleSystem:setGravity(value)\n _internal.sendMessage('sgparticles.setGravity', { obj=self._handle, value=value })\nend\n\n--- Sets the orbital velocity.\n---@param value number The orbital velocity value.\nfunction SgParticleSystem:setOrbitalVelocity(value)\n _internal.sendMessage('sgparticles.setOrbitalVelocity', { obj=self._handle, value=value })\nend\n\n--- Sets the orbital decay.\n---@param value number The orbital decay value.\nfunction SgParticleSystem:setOrbitalDecay(value)\n _internal.sendMessage('sgparticles.setOrbitalDecay', { obj=self._handle, value=value })\nend\n\n--- Sets the orbital center point.\n---@param value table The center point coordinates for the orbital motion.\nfunction SgParticleSystem:setOrbitalCenterPoint(value)\n _internal.sendMessage('sgparticles.setOrbitalCenterPoint', { obj=self._handle, value=value })\nend\n\n--- Sets the orbital plane.\n---@param value table The orbital plane identifier.\nfunction SgParticleSystem:setOrbitalPlane(value)\n _internal.sendMessage('sgparticles.setOrbitalPlane', { obj=self._handle, value=value })\nend\n\n--- Sets the target direction for the particle system.\n---@param direction table The target direction vector.\nfunction SgParticleSystem:setTarget(direction)\n _internal.sendMessage('sgparticles.setTarget', { obj=self._handle, direction=direction })\nend\n\n--- Sets the target force strength.\n---@param strength number The strength of the force towards the target.\nfunction SgParticleSystem:setTargetForce(strength)\n _internal.sendMessage('sgparticles.setTargetForce', { obj=self._handle, strength=strength })\nend\n\n--- Sets the target deletion threshold.\n---@param value number The deletion threshold value for particles targeting an object. A value of -1 will not kill particles.\nfunction SgParticleSystem:setTargetDeletionThreshold(value)\n _internal.sendMessage('sgparticles.setTargetDeletionThreshold', { obj=self._handle, value=value })\nend\n\n--- Sets the random velocity factor.\n---@param value number The random velocity factor.\nfunction SgParticleSystem:setRandomVelocity(value)\n _internal.sendMessage('sgparticles.setRandomVelocity', { obj=self._handle, value=value })\nend\n\n--- Sets the initial velocity for particles.\n---@param velocity table The initial velocity vector.\nfunction SgParticleSystem:setInitialVelocity(velocity)\n _internal.sendMessage('sgparticles.setInitialVelocity', { obj=self._handle, velocity=velocity })\nend\n\n--- Sets the final velocity parameters.\n---@param target table The target velocity vector.\nfunction SgParticleSystem:setFinalVelocity(target)\n _internal.sendMessage('sgparticles.setFinalVelocity', { obj=self._handle, target=target })\nend\n\n--- Sets the final velocity appraoch value.\n---@param approachValue number The approach value of the final velocity.\nfunction SgParticleSystem:setFinalVelocityApproachValue(approachValue)\n _internal.sendMessage('sgparticles.setFinalVelocityApproachValue', { obj=self._handle, value=approachValue })\nend\n\n--- Sets the velocity applied on the direction of normals on a emitter. Used when emission type is set to normals. @see setEmitter()\n---@param velocityFactor number The velocity factor.\nfunction SgParticleSystem:setNormalVelocity(velocityFactor)\n _internal.sendMessage('sgparticles.setNormalVelocity', { obj=self._handle, value=velocityFactor })\nend\n\n--- Sets the spread value for the particle system.\n---@param value number The spread value.\nfunction SgParticleSystem:setSpread(value)\n _internal.sendMessage('sgparticles.setSpread', { obj=self._handle, value=value })\nend\n\n--- Sets the bounding box flag.\n---@param boolean boolean The bounding box flag state to set.\nfunction SgParticleSystem:setBBoxFlag(boolean)\n _internal.sendMessage('sgparticles.setBBoxFlag', { obj=self._handle, value=boolean })\nend\n\n--- Sets the bounding box dimensions.\n---@param bboxMin table The minimum boundary of the bounding box.\n---@param bboxMax table The maximum boundary of the bounding box.\nfunction SgParticleSystem:setBoundingBox(bboxMin, bboxMax)\n _internal.sendMessage('sgparticles.setBoundingBox', { obj=self._handle, bboxMin=bboxMin, bboxMax=bboxMax })\nend\n\n--- Sets the particle size.\n---@param minSize number The minimum size of the particles.\n---@param maxSize number The maximum size of the particles.\n---@param approach string The approach to transition between sizes.\nfunction SgParticleSystem:setParticleSize(minSize, maxSize, approach)\n _internal.sendMessage('sgparticles.setParticleSize', { obj=self._handle, minSize=minSize, maxSize=maxSize, approach=approach })\nend\n\n--- Sets the angular velocity and direction.\n---@param velocity number The angular velocity.\n---@param direction table The direction vector for angular velocity.\nfunction SgParticleSystem:setAngularVelocity(velocity, direction)\n _internal.sendMessage('sgparticles.setAngularVelocity', { obj=self._handle, velocity=velocity, direction=direction })\nend\n\n--- Sets the particle random color factor.\n---@param factor number The random color factor.\nfunction SgParticleSystem:setParticleRandomColorFactor(factor)\n _internal.sendMessage('sgparticles.setParticleRandomColorFactor', { obj=self._handle, factor=factor })\nend\n\n-- TODO\n-- --- Sets the particle texture.\n-- ---@param texture string The texture identifier for the particles.\n-- function SgParticleSystem:setParticleTexture(texture)\n-- _internal.sendMessage('sgparticles.setParticleTexture', { obj=self._handle, texture=texture })\n-- end\n\n--- Sets the particle color.\n---@param r number The red component of the color.\n---@param g number The green component of the color.\n---@param b number The blue component of the color.\n---@param a number The alpha (transparency) component of the color.\nfunction SgParticleSystem:setParticleColor(r, g, b, a)\n _internal.sendMessage('sgparticles.setParticleColor', { obj=self._handle, r=r, g=g, b=b, a=a })\nend\n\n--- Sets the particle final color.\n---@param r number The red component of the final color.\n---@param g number The green component of the final color.\n---@param b number The blue component of the final color.\n---@param a number The alpha (transparency) component of the final color.\nfunction SgParticleSystem:setParticleFinalColor(r, g, b, a)\n _internal.sendMessage('sgparticles.setParticleFinalColor', { obj=self._handle, r=r, g=g, b=b, a=a })\nend\n\n--- Sets the final color flag.\n---@param value boolean The final color flag state to set.\nfunction SgParticleSystem:setEnableFinalColorFlag(value)\n _internal.sendMessage('sgparticles.setEnableFinalColorFlag', { obj=self._handle, value=value })\nend\n\n--- Sets the texture blending flag.\n---@param value boolean The texture blending flag state to set.\nfunction SgParticleSystem:setTextureBlendingFlag(value)\n _internal.sendMessage('sgparticles.setTextureBlendingFlag', { obj=self._handle, value=value })\nend\n\n--- Sets the texture blending value.\n---@param value number The texture blending value to set.\nfunction SgParticleSystem:setBlendingValue(value)\n _internal.sendMessage('sgparticles.setBlendingValue', { obj=self._handle, value=value })\nend\n\n--- Sets the texture hue shift.\n---@param value number The hue shift value for the texture.\nfunction SgParticleSystem:setTextureHue(value)\n _internal.sendMessage('sgparticles.setTextureHue', { obj=self._handle, value=value })\nend\n\n--- Gets the texture hue shift.\n---@return number The hue shift value for the texture.\nfunction SgParticleSystem:getTextureHue()\n return _internal.sendMessage('sgparticles.getTextureHue', { obj=self._handle })\nend\n\n--- Sets the sprite animation speed.\n---@param fps number The frames per second for the sprite animation.\nfunction SgParticleSystem:setSpriteSpeed(fps)\n _internal.sendMessage('sgparticles.setSpriteSpeed', { obj=self._handle, fps=fps })\nend\n\n--- Gets the sprite animation speed.\n---@return number The frames per second for the sprite animation.\nfunction SgParticleSystem:getSpriteSpeed()\n return _internal.sendMessage('sgparticles.getSpriteSpeed', { obj=self._handle })\nend\n\n--- Sets the sprite rolling with life flag.\n---@param boolean boolean The sprite rolling with life flag state to set.\nfunction SgParticleSystem:setSpriteRollingWithLifeFlag(boolean)\n _internal.sendMessage('sgparticles.setSpriteRollingWithLifeFlag', { obj=self._handle, value=boolean })\nend\n\n--- Gets the sprite rolling with life flag.\n---@return boolean The sprite rolling with life flag state.\nfunction SgParticleSystem:getSpriteRollingWithLifeFlag()\n return _internal.sendMessage('sgparticles.getSpriteRollingWithLifeFlag', { obj=self._handle })\nend\n\n--- Sets the number of columns in the sprite sheet.\n---@param nCols number The number of columns in the sprite sheet.\nfunction SgParticleSystem:setSpriteCols(nCols)\n _internal.sendMessage('sgparticles.setSpriteCols', { obj=self._handle, nCols=nCols })\nend\n\n--- Gets the number of colums in the sprite sheet.\n---@return number The number of columns in the sprite sheet.\nfunction SgParticleSystem:getSpriteCols(width, height)\n return _internal.sendMessage('sgparticles.getSpriteCols', { obj=self._handle })\nend\n\n--- Sets the number of rows in the sprite sheet.\n---@param nRows number The number of rows in the sprite sheet.\nfunction SgParticleSystem:setSpriteRows(nRows)\n _internal.sendMessage('sgparticles.setSpriteRows', { obj=self._handle, nRows=nRows })\nend\n\n--- Gets the number of rows in the sprite sheet.\n---@return number The number of rows in the sprite sheet.\nfunction SgParticleSystem:getSpriteRows(width, height)\n return _internal.sendMessage('sgparticles.getSpriteRows', { obj=self._handle })\nend\n\n--- Sets the atlas size for the sprites.\n---@param width number The width of the sprite atlas.\n---@param height number The height of the sprite atlas.\nfunction SgParticleSystem:setAtlasSize(width, height)\n _internal.sendMessage('sgparticles.setAtlasSize', { obj=self._handle, width=width, height=height })\nend\n\n--- Gets the atlas size for the sprites.\n---@return table A table containing the width and height of the atlas.\nfunction SgParticleSystem:getAtlasSize(width, height)\n return _internal.sendMessage('sgparticles.getAtlasSize', { obj=self._handle })\nend\n\n--- Sets the noise strength for the particle system.\n---@param value number The noise strength value.\nfunction SgParticleSystem:setNoiseStrength(value)\n _internal.sendMessage('sgparticles.setNoiseStrength', { obj=self._handle, value=value })\nend\n\n--- Sets the noise frequency for the particle system.\n---@param value number The noise frequency value.\nfunction SgParticleSystem:setNoiseFrequency(value)\n _internal.sendMessage('sgparticles.setNoiseFrequency', { obj=self._handle, value=value })\nend\n\n--- Sets the noise octaves for the particle system.\n---@param value number The noise octaves value.\nfunction SgParticleSystem:setNoiseOctaves(value)\n _internal.sendMessage('sgparticles.setNoiseOctaves', { obj=self._handle, value=value })\nend\n\n--- Renders a new noise texture to be applied to the particle system.\n--- An expensive call. Use only when required.\nfunction SgParticleSystem:generateNoise()\n _internal.sendMessage('sgparticles.generateNoise', { obj=self._handle })\nend\n\nreturn SgParticleSystem\n";
|
|
131047
|
+
var lua_api_sceneobjects_particles = "\nlocal _internal = require('engine/_internal')\nlocal SceneObject = require('engine/sceneobject')\nlocal Tools = require(\"engine/tools\")\n\n------------------------------------------------------------------\n-- SgParticleSystem class\n------------------------------------------------------------------\n\n--- @class SgParticleSystem\nlocal SgParticleSystem = Class.new(SceneObject)\n\n--- @private\nfunction SgParticleSystem:__new(handle, nodeId)\n SceneObject.__new(self, handle, nodeId)\n self._type = \"SgParticleSystem\"\n self._isSgParticleSystem = true\nend\n\n--- Create a new particle system object in the scenegraph.\n---@param options table A table of options to fill the parameters\n---@param parent SceneObject The parent scene object to add this to\n---@return Promise a promise which will resolve to the created object\n---@usage\n--- -- Options can be omitted. This example shows the defaults,\n--- -- only specify the ones you want different.\n--- SgParticleSystem.create({\n--- active = true,\n--- name = \"\",\n--- transform = Transform.new(),\n--- layers = {0},\n--- tags = {}\n--- })\nfunction SgParticleSystem.create(self, options, parent)\n -- check if static function was called as method. if so, shift the parameters\n if not (type(self) == 'table' and type(self.new) == 'function') then\n parent, options = options, self\n end\n return SceneObject.create(\"SgParticleSystem\", options, parent)\nend\n\n--- Destroys the particle system.\nfunction SgParticleSystem:destroy()\n _internal.sendMessage('sgparticles.destroy', { obj=self._handle })\nend\n\n--- Returns the number of particles in the particle system.\n---@return number The number of particles.\nfunction SgParticleSystem:getParticlesCount()\n return _internal.sendMessage('sgparticles.getParticlesCount', { obj=self._handle })\nend\n\n--- Returns the pause state of the particle system.\n---@return boolean The pause state.\nfunction SgParticleSystem:getPause()\n return _internal.sendMessage('sgparticles.getPause', { obj=self._handle })\nend\n\n--- Returns the spawn amount.\n---@return number The number of particles to spawn.\nfunction SgParticleSystem:getSpawnAmount()\n return _internal.sendMessage('sgparticles.getSpawnAmount', { obj=self._handle })\nend\n\n--- Returns the spawn rate.\n---@return number The rate of particle spawning.\nfunction SgParticleSystem:getSpawnRate()\n return _internal.sendMessage('sgparticles.getSpawnRate', { obj=self._handle })\nend\n\n--- Sets the respawn flag for the particle system.\nfunction SgParticleSystem:getRespawn()\n return _internal.sendMessage('sgparticles.getRespawn', { obj=self._handle })\nend\n\n-- --- Returns the prewarm flag state. WIP\n-- ---@return boolean The prewarm flag state.\n-- function SgParticleSystem:getPrewarm()\n-- return _internal.sendMessage('sgparticles.getPrewarm', { obj=self._handle })\n-- end\n\n-- --- Returns the prewarm amount.\n-- ---@return number The number of particles prewarmed.\n-- function SgParticleSystem:getPrewarmAmount()\n-- return _internal.sendMessage('sgparticles.getPrewarmAmount', { obj=self._handle })\n-- end\n\n--- Returns the emitter parameters.\n---@return table A table containing the shape, type, size.\nfunction SgParticleSystem:getEmitter()\n return _internal.sendMessage('sgparticles.getEmitter', { obj=self._handle })\nend\n\n--- Returns the duration of the particle system.\n---@return number The duration of the particle system.\nfunction SgParticleSystem:getDuration()\n return _internal.sendMessage('sgparticles.getDuration', { obj=self._handle })\nend\n\n--- Returns the emission flag state describing whether or not the particle system is emitting new particles.\n---@return boolean The emission flag state.\nfunction SgParticleSystem:getEmissionFlag()\n return _internal.sendMessage('sgparticles.getEmissionFlag', { obj=self._handle })\nend\n\n--- Returns the continuous emission flag state.\n---@return boolean The continuous emission flag state.\nfunction SgParticleSystem:getContinuousEmissionFlag()\n return _internal.sendMessage('sgparticles.getContinuousEmissionFlag', { obj=self._handle })\nend\n\n--- Returns the local coordinates flag state.\n---@return boolean The local coordinates flag state.\nfunction SgParticleSystem:getLocalCoordsFlag()\n return _internal.sendMessage('sgparticles.getLocalCoordsFlag', { obj=self._handle })\nend\n\n--- Returns the angular velocity of the particles.\n---@return number The angular velocity of the particles.\nfunction SgParticleSystem:getAngularVelocity()\n return _internal.sendMessage('sgparticles.getAngularVelocity', { obj=self._handle })\nend\n\n--- Returns the direction the particles will rotate to.\n---@return number The rotation of particles. 1 will make the particles move clockwise, -1\n--- anti-clockwise and 0 stand still.\nfunction SgParticleSystem:getRotationDirection()\n return _internal.sendMessage('sgparticles.getRotationDirection', { obj=self._handle })\nend\n\n--- Returns the life delta of the particles.\n---@return number The life delta value for particles.\n---@deprecated 25.09 The particle's life logic has been changed and this method is now deprecated Use ``getLife()`` instead.\nfunction SgParticleSystem:getLifeDelta()\n print(\"The method is deprecated!\")\n return\nend\n\n--- Returns the random life delta of the particles.\n---@return number The random life delta value for particles.\n---@deprecated 25.09 The particle's life logic has been changed and this method is now deprecated Use ``getLife()`` instead.\nfunction SgParticleSystem:getLifeDeltaRandom()\n print(\"The method is deprecated!\")\n return\nend\n\n--- Returns the gravity applied to the particles.\n---@return number The gravity value affecting the particles.\nfunction SgParticleSystem:getGravity()\n return _internal.sendMessage('sgparticles.getGravity', { obj=self._handle })\nend\n\n--- Returns the orbital velocity of the particles.\n---@return number The orbital velocity value.\nfunction SgParticleSystem:getOrbitalVelocity()\n return _internal.sendMessage('sgparticles.getOrbitalVelocity', { obj=self._handle })\nend\n\n--- Returns the orbital decay of the particles.\n---@return number The orbital decay value.\nfunction SgParticleSystem:getOrbitalDecay()\n return _internal.sendMessage('sgparticles.getOrbitalDecay', { obj=self._handle })\nend\n\n--- Returns the orbital center point of the particles.\n---@return Vector3 The orbital center point vector.\nfunction SgParticleSystem:getOrbitalCenterPoint()\n return _internal.sendMessage('sgparticles.getOrbitalCenterPoint', { obj=self._handle })\nend\n--- Returns the orbital plane of the particles.\n---@return Vector3 The orbital plane vector.\nfunction SgParticleSystem:getOrbitalPlane()\n return _internal.sendMessage('sgparticles.getOrbitalPlane', { obj=self._handle })\nend\n\n-- TODO requires a refactor of the emitter class\n--- Returns the life of the particles.\n---@return number The life value of the particles.\nfunction SgParticleSystem:getParticleLife()\n return _internal.sendMessage('sgparticles.getParticleLife', { obj=self._handle })\nend\n\n--- Returns the life of the particles.\n---@return number The life value of the particles.\nfunction SgParticleSystem:getParticleLife()\n return _internal.sendMessage('sgparticles.getParticleLife', { obj=self._handle })\nend\n\n--- Returns the particle size.\n---@return table A table containing minSize, maxSize, and approach.\nfunction SgParticleSystem:getParticleSize()\n return _internal.sendMessage('sgparticles.getParticleSize', { obj=self._handle })\nend\n\n--- Returns the particle initial velocity.\n---@return table The initial velocity of the particles encoded as a table for x, y, z values.\nfunction SgParticleSystem:getInitialVelocity()\n return _internal.sendMessage('sgparticles.getInitialVelocity', { obj=self._handle })\nend\n\n--- Returns the particle final velocity.\n---@return table The final velocity of the particles encoded as a table for x, y, z values.\nfunction SgParticleSystem:getFinalVelocity()\n return _internal.sendMessage('sgparticles.getFinalVelocity', { obj=self._handle })\nend\n\n--- Returns the particle final velocity approach value.\n---@return number The final velocity approach value of the particles.\nfunction SgParticleSystem:getFinalVelocityApproachValue()\n return _internal.sendMessage('sgparticles.getFinalVelocityApproachValue', { obj=self._handle })\nend\n\n--- Returns the target direction.\n---@return table The target direction vector.\nfunction SgParticleSystem:getTarget()\n return _internal.sendMessage('sgparticles.getTarget', { obj=self._handle })\nend\n\n--- Returns the target force strength.\n---@return number The target force strength.\nfunction SgParticleSystem:getTargetForce()\n return _internal.sendMessage('sgparticles.getTargetForce', { obj=self._handle })\nend\n\n--- Sets the target deletion threshold.\n---@return number The target delete threshold. A value of -1 will not kill particles.\nfunction SgParticleSystem:getTargetDeletionThreshold()\n return _internal.sendMessage('sgparticles.getTargetDeletionThreshold', { obj=self._handle })\nend\n\n--- Returns the random velocity factor.\n---@return number The random velocity factor.\nfunction SgParticleSystem:getRandomVelocity()\n return _internal.sendMessage('sgparticles.getRandomVelocity', { obj=self._handle })\nend\n\n--- Returns the velocity applied on the direction of normals on a emitter.\n---@return number The velocity factor.\nfunction SgParticleSystem:getNormalVelocity()\n return _internal.sendMessage('sgparticles.getNormalVelocity', { obj=self._handle })\nend\n\n--- Returns the spread factor.\n---@return number The spread applied to the particles at emission.\nfunction SgParticleSystem:getSpread()\n return _internal.sendMessage('sgparticles.getSpread', { obj=self._handle })\nend\n\n--- Returns the bounding box flag state.\n---@return boolean The bounding box flag state.\nfunction SgParticleSystem:getBBoxFlag()\n return _internal.sendMessage('sgparticles.getBBoxFlag', { obj=self._handle })\nend\n\n--- Returns the bounding box dimensions.\n---@return table The bounding box bottom left and top right corners encoded as min, max.\nfunction SgParticleSystem:getBoundingBox()\n return _internal.sendMessage('sgparticles.getBoundingBox', { obj=self._handle })\nend\n\n--- Returns the particle color.\n---@return table A table containing r, g, b, a values.\nfunction SgParticleSystem:getParticleColor()\n return _internal.sendMessage('sgparticles.getParticleColor', { obj=self._handle })\nend\n\n--- Returns the particle random color factor.\n---@return number The random color factor.\nfunction SgParticleSystem:getParticleRandomColorFactor()\n return _internal.sendMessage('sgparticles.getParticleRandomColorFactor', { obj=self._handle })\nend\n\n--- Returns the final color flag for the particles.\n--- This indicates whether the final color property is enabled.\n--- @return boolean True if the final color flag is enabled, false otherwise.\nfunction SgParticleSystem:getEnableFinalColorFlag()\n return _internal.sendMessage('sgparticles.getEnableFinalColorFlag', { obj=self._handle })\nend\n\n--- Returns the final color of the particles.\n---@return table A table containing r, g, b, a values.\nfunction SgParticleSystem:getFinalColor()\n return _internal.sendMessage('sgparticles.getFinalColor', { obj=self._handle })\nend\n\n--- Returns the texture blending flag for the particles.\n--- This indicates whether texture blending is enabled.\n--- @return boolean True if texture blending is enabled, false otherwise.\nfunction SgParticleSystem:getTextureBlendingFlag()\n return _internal.sendMessage('sgparticles.getTextureBlendingFlag', { obj=self._handle })\nend\n\n--- Returns the texture blending value for the particles. The value is between 0 and 1.\n--- @return number The blending value.\nfunction SgParticleSystem:getTextureBlendingFlag()\n return _internal.sendMessage('sgparticles.getBlendingValue', { obj=self._handle })\nend\n\n--- Returns the hue of the particle's texture.\n--- @return number The hue value of the particle's texture.\nfunction SgParticleSystem:getTextureHue()\n return _internal.sendMessage('sgparticles.getTextureHue', { obj=self._handle })\nend\n\n-- TODO implement texture getters\n\n--- Sets the noise strength for the particle system.\n---@return number The noise strength value.\nfunction SgParticleSystem:getNoiseStrength()\n return _internal.sendMessage('sgparticles.getNoiseStrength', { obj=self._handle })\nend\n\n--- Sets the noise frequency for the particle system.\n---@return number The noise frequency value.\nfunction SgParticleSystem:getNoiseFrequency()\n return _internal.sendMessage('sgparticles.getNoiseFrequency', { obj=self._handle })\nend\n\n--- Sets the noise octaves for the particle system.\n---@return number The noise octaves value.\nfunction SgParticleSystem:getNoiseOctaves()\n return _internal.sendMessage('sgparticles.getNoiseOctaves', { obj=self._handle })\nend\n\nSgParticleSystem.Point = \"point\"\nSgParticleSystem.Box = \"box\"\nSgParticleSystem.Sphere = \"sphere\"\nSgParticleSystem.Hemisphere = \"hemisphere\"\nSgParticleSystem.Torus = \"torus\"\nSgParticleSystem.Cone = \"cone\"\nSgParticleSystem.Circle = \"circle\"\nSgParticleSystem.Edge = \"edge\"\nSgParticleSystem.TypeSurface = \"surface\"\nSgParticleSystem.TypeVolume = \"volume\"\nSgParticleSystem.TypeNormals = \"normals\"\n\n-- Arrays are still available for convenience\nSgParticleSystem.EmissionShapes = {\n SgParticleSystem.Point, SgParticleSystem.Box, SgParticleSystem.Sphere,\n SgParticleSystem.Hemisphere, SgParticleSystem.Torus, SgParticleSystem.Cone,\n SgParticleSystem.Circle, SgParticleSystem.Edge\n}\nSgParticleSystem.EmissionTypes = {\n SgParticleSystem.TypeSurface, SgParticleSystem.TypeVolume, SgParticleSystem.TypeNormals\n}\n\n--- Sets the emitter parameters.\n---@param shape string The shape of the emitter.\n---@param type string The type of the emitter.\n---@param size number The size of the emitter.\n--- @usage\n--- local emitterShape\n--- local emitterType\n--- local emitterConfig = {\n--- size = 10,\n--- radius = 5,\n--- outerRadius = 8,\n--- height = 20,\n--- width = 15,\n--- depth = 10,\n--- life = 5.0,\n--- lifeRandomness = 0.2\n--- }\n--- function update()\n--- particleSystem:setEmitter(SgParticleSystem.EmissionShapes[emitterShape:getValue() + 1],\n--- SgParticleSystem.EmissionTypes[emitterType:getValue() + 1], emitterConfig)\n--- end\n--- function rendergui()\n--- gui.text(\"Emitter shape\")\n--- gui.combo(\"Emtiter shape\", emitterShape, SgParticleSystem.EmissionShapes)\n--- gui.combo(\"Emtiter type\", emitterType, SgParticleSystem.EmissionTypes)\n--- gui.endDialog()\n--- end\nfunction SgParticleSystem:setEmitter(shape, type, config)\n if not Tools.isValueInTable(SgParticleSystem.EmissionShapes, shape) then\n error(\"Invalid emission shape: \" .. tostring(shape))\n end\n\n if not Tools.isValueInTable(SgParticleSystem.EmissionTypes, type) then\n error(\"Invalid emission type: \" .. tostring(type))\n end\n\n -- TODO add checks if the config has all the information needed\n _internal.sendMessage('sgparticles.setEmitter', { obj=self._handle, shape=shape, type=type,\n config=config })\nend\n\n--- Sets the pause state of the particle system.\n---@param value boolean The pause state to set.\nfunction SgParticleSystem:setPause(value)\n _internal.sendMessage('sgparticles.setPause', { obj=self._handle, value=value })\nend\n\n--- Kills all particles in the system.\nfunction SgParticleSystem:killAllParticles()\n _internal.sendMessage('sgparticles.killAllParticles', { obj=self._handle })\nend\n\n--- Hides all particles in the system.\nfunction SgParticleSystem:hideParticles()\n _internal.sendMessage('sgparticles.hideParticles', { obj=self._handle })\nend\n\n--- Shows all particles in the system.\nfunction SgParticleSystem:showParticles()\n _internal.sendMessage('sgparticles.showParticles', { obj=self._handle })\nend\n\n--- Restarts the particle system.\nfunction SgParticleSystem:restart()\n _internal.sendMessage('sgparticles.restart', { obj=self._handle })\nend\n\n--- Sets the respawn flag for the particle system.\n---@param value boolean The respawn flag state to set.\nfunction SgParticleSystem:setRespawn(value)\n _internal.sendMessage('sgparticles.setRespawn', { obj=self._handle, value=value })\nend\n\n--- Sets the spawn amount.\n---@param value number The number of particles to spawn.\nfunction SgParticleSystem:setSpawnAmount(value)\n _internal.sendMessage('sgparticles.setSpawnAmount', { obj=self._handle, value=value })\nend\n\n--- Sets the spawn rate.\n---@param value number The rate of particle spawning.\nfunction SgParticleSystem:setSpawnRate(value)\n _internal.sendMessage('sgparticles.setSpawnRate', { obj=self._handle, value=value })\nend\n\n--- Sets the prewarm flag.\n---@param value boolean The prewarm flag state to set.\nfunction SgParticleSystem:setPrewarm(value)\n _internal.sendMessage('sgparticles.setPrewarm', { obj=self._handle, value=value })\nend\n\n-- --- Sets the prewarm amount.\n-- ---@param value number The number of particles to prewarm.\n-- function SgParticleSystem:setPrewarmAmount(value)\n-- _internal.sendMessage('sgparticles.setPrewarmAmount', { obj=self._handle, value=value })\n-- end\n\n-- --- Runs the prewarm process.\n-- function SgParticleSystem:runPrewarm()\n-- _internal.sendMessage('sgparticles.runPrewarm', { obj=self._handle })\n-- end\n\n--- Sets the duration of the particle system.\n---@param value number The duration of the particle system.\nfunction SgParticleSystem:setDuration(value)\n _internal.sendMessage('sgparticles.setDuration', { obj=self._handle, value=value })\nend\n\n--- Sets the continuous emission flag.\n---@param value boolean The continuous emission flag state to set.\nfunction SgParticleSystem:setContinuousEmissionFlag(value)\n _internal.sendMessage('sgparticles.setContinuousEmissionFlag', { obj=self._handle, value=value })\nend\n\n--- Sets the local coordinates flag.\n---@param value boolean The local coordinates flag state to set.\nfunction SgParticleSystem:setLocalCoordsFlag(value)\n _internal.sendMessage('sgparticles.setLocalCoordsFlag', { obj=self._handle, value=value })\nend\n\n--- Emits all particles at once.\nfunction SgParticleSystem:emitAllParticles()\n _internal.sendMessage('sgparticles.emitAllParticles', { obj=self._handle })\nend\n\n--- Emits new particles.\n---@param particleCount number The number of particles to emit.\n---@param continuous boolean Whether to emit particles continuously.\nfunction SgParticleSystem:emitNewParticles(particleCount, continuous)\n _internal.sendMessage('sgparticles.emitNewParticles', { obj=self._handle, particleCount=particleCount or 1, continuous=continuous or true })\nend\n\n--- Sets the particle life parameters.\n---@param life number The lifespan of the particles in seconds.\nfunction SgParticleSystem:setParticleLife(life)\n _internal.sendMessage('sgparticles.setParticleLife', { obj=self._handle, value=life })\nend\n\n--- Sets the particle life parameters.\n---@param lifeRandomness number The randomness factor for the lifespan.\nfunction SgParticleSystem:setParticleLife(lifeRandomness)\n _internal.sendMessage('sgparticles.setParticleLifeRandomness', { obj=self._handle, value=lifeRandomness })\nend\n\n--- Sets the gravity for the particle system.\n---@param value number The gravity value.\nfunction SgParticleSystem:setGravity(value)\n _internal.sendMessage('sgparticles.setGravity', { obj=self._handle, value=value })\nend\n\n--- Sets the orbital velocity.\n---@param value number The orbital velocity value.\nfunction SgParticleSystem:setOrbitalVelocity(value)\n _internal.sendMessage('sgparticles.setOrbitalVelocity', { obj=self._handle, value=value })\nend\n\n--- Sets the orbital decay.\n---@param value number The orbital decay value.\nfunction SgParticleSystem:setOrbitalDecay(value)\n _internal.sendMessage('sgparticles.setOrbitalDecay', { obj=self._handle, value=value })\nend\n\n--- Sets the orbital center point.\n---@param value table The center point coordinates for the orbital motion.\nfunction SgParticleSystem:setOrbitalCenterPoint(value)\n _internal.sendMessage('sgparticles.setOrbitalCenterPoint', { obj=self._handle, value=value })\nend\n\n--- Sets the orbital plane.\n---@param value table The orbital plane identifier.\nfunction SgParticleSystem:setOrbitalPlane(value)\n _internal.sendMessage('sgparticles.setOrbitalPlane', { obj=self._handle, value=value })\nend\n\n--- Sets the target direction for the particle system.\n---@param direction table The target direction vector.\nfunction SgParticleSystem:setTarget(direction)\n _internal.sendMessage('sgparticles.setTarget', { obj=self._handle, direction=direction })\nend\n\n--- Sets the target force strength.\n---@param strength number The strength of the force towards the target.\nfunction SgParticleSystem:setTargetForce(strength)\n _internal.sendMessage('sgparticles.setTargetForce', { obj=self._handle, strength=strength })\nend\n\n--- Sets the target deletion threshold.\n---@param value number The deletion threshold value for particles targeting an object. A value of -1 will not kill particles.\nfunction SgParticleSystem:setTargetDeletionThreshold(value)\n _internal.sendMessage('sgparticles.setTargetDeletionThreshold', { obj=self._handle, value=value })\nend\n\n--- Sets the random velocity factor.\n---@param value number The random velocity factor.\nfunction SgParticleSystem:setRandomVelocity(value)\n _internal.sendMessage('sgparticles.setRandomVelocity', { obj=self._handle, value=value })\nend\n\n--- Sets the initial velocity for particles.\n---@param velocity table The initial velocity vector.\nfunction SgParticleSystem:setInitialVelocity(velocity)\n _internal.sendMessage('sgparticles.setInitialVelocity', { obj=self._handle, velocity=velocity })\nend\n\n--- Sets the final velocity parameters.\n---@param target table The target velocity vector.\nfunction SgParticleSystem:setFinalVelocity(target)\n _internal.sendMessage('sgparticles.setFinalVelocity', { obj=self._handle, target=target })\nend\n\n--- Sets the final velocity appraoch value.\n---@param approachValue number The approach value of the final velocity.\nfunction SgParticleSystem:setFinalVelocityApproachValue(approachValue)\n _internal.sendMessage('sgparticles.setFinalVelocityApproachValue', { obj=self._handle, value=approachValue })\nend\n\n--- Sets the velocity applied on the direction of normals on a emitter. Used when emission type is set to normals. @see setEmitter()\n---@param velocityFactor number The velocity factor.\nfunction SgParticleSystem:setNormalVelocity(velocityFactor)\n _internal.sendMessage('sgparticles.setNormalVelocity', { obj=self._handle, value=velocityFactor })\nend\n\n--- Sets the spread value for the particle system.\n---@param value number The spread value.\nfunction SgParticleSystem:setSpread(value)\n _internal.sendMessage('sgparticles.setSpread', { obj=self._handle, value=value })\nend\n\n--- Sets the bounding box flag.\n---@param boolean boolean The bounding box flag state to set.\nfunction SgParticleSystem:setBBoxFlag(boolean)\n _internal.sendMessage('sgparticles.setBBoxFlag', { obj=self._handle, value=boolean })\nend\n\n--- Sets the bounding box dimensions.\n---@param bboxMin table The minimum boundary of the bounding box.\n---@param bboxMax table The maximum boundary of the bounding box.\nfunction SgParticleSystem:setBoundingBox(bboxMin, bboxMax)\n _internal.sendMessage('sgparticles.setBoundingBox', { obj=self._handle, bboxMin=bboxMin, bboxMax=bboxMax })\nend\n\n--- Sets the particle size.\n---@param minSize number The minimum size of the particles.\n---@param maxSize number The maximum size of the particles.\n---@param approach string The approach to transition between sizes.\nfunction SgParticleSystem:setParticleSize(minSize, maxSize, approach)\n _internal.sendMessage('sgparticles.setParticleSize', { obj=self._handle, minSize=minSize, maxSize=maxSize, approach=approach })\nend\n\n--- Sets the angular velocity and direction.\n---@param velocity number The angular velocity.\n---@param direction table The direction vector for angular velocity.\nfunction SgParticleSystem:setAngularVelocity(velocity, direction)\n _internal.sendMessage('sgparticles.setAngularVelocity', { obj=self._handle, velocity=velocity, direction=direction })\nend\n\n--- Sets the particle random color factor.\n---@param factor number The random color factor.\nfunction SgParticleSystem:setParticleRandomColorFactor(factor)\n _internal.sendMessage('sgparticles.setParticleRandomColorFactor', { obj=self._handle, factor=factor })\nend\n\n-- TODO\n-- --- Sets the particle texture.\n-- ---@param texture string The texture identifier for the particles.\n-- function SgParticleSystem:setParticleTexture(texture)\n-- _internal.sendMessage('sgparticles.setParticleTexture', { obj=self._handle, texture=texture })\n-- end\n\n--- Sets the particle color.\n---@param r number The red component of the color.\n---@param g number The green component of the color.\n---@param b number The blue component of the color.\n---@param a number The alpha (transparency) component of the color.\nfunction SgParticleSystem:setParticleColor(r, g, b, a)\n _internal.sendMessage('sgparticles.setParticleColor', { obj=self._handle, r=r, g=g, b=b, a=a })\nend\n\n--- Sets the particle final color.\n---@param r number The red component of the final color.\n---@param g number The green component of the final color.\n---@param b number The blue component of the final color.\n---@param a number The alpha (transparency) component of the final color.\nfunction SgParticleSystem:setParticleFinalColor(r, g, b, a)\n _internal.sendMessage('sgparticles.setParticleFinalColor', { obj=self._handle, r=r, g=g, b=b, a=a })\nend\n\n--- Sets the final color flag.\n---@param value boolean The final color flag state to set.\nfunction SgParticleSystem:setEnableFinalColorFlag(value)\n _internal.sendMessage('sgparticles.setEnableFinalColorFlag', { obj=self._handle, value=value })\nend\n\n--- Sets the texture blending flag.\n---@param value boolean The texture blending flag state to set.\nfunction SgParticleSystem:setTextureBlendingFlag(value)\n _internal.sendMessage('sgparticles.setTextureBlendingFlag', { obj=self._handle, value=value })\nend\n\n--- Sets the texture blending value.\n---@param value number The texture blending value to set.\nfunction SgParticleSystem:setBlendingValue(value)\n _internal.sendMessage('sgparticles.setBlendingValue', { obj=self._handle, value=value })\nend\n\n--- Sets the texture hue shift.\n---@param value number The hue shift value for the texture.\nfunction SgParticleSystem:setTextureHue(value)\n _internal.sendMessage('sgparticles.setTextureHue', { obj=self._handle, value=value })\nend\n\n--- Gets the texture hue shift.\n---@return number The hue shift value for the texture.\nfunction SgParticleSystem:getTextureHue()\n return _internal.sendMessage('sgparticles.getTextureHue', { obj=self._handle })\nend\n\n--- Sets the sprite animation speed.\n---@param fps number The frames per second for the sprite animation.\nfunction SgParticleSystem:setSpriteSpeed(fps)\n _internal.sendMessage('sgparticles.setSpriteSpeed', { obj=self._handle, fps=fps })\nend\n\n--- Gets the sprite animation speed.\n---@return number The frames per second for the sprite animation.\nfunction SgParticleSystem:getSpriteSpeed()\n return _internal.sendMessage('sgparticles.getSpriteSpeed', { obj=self._handle })\nend\n\n--- Sets the sprite rolling with life flag.\n---@param boolean boolean The sprite rolling with life flag state to set.\nfunction SgParticleSystem:setSpriteRollingWithLifeFlag(boolean)\n _internal.sendMessage('sgparticles.setSpriteRollingWithLifeFlag', { obj=self._handle, value=boolean })\nend\n\n--- Gets the sprite rolling with life flag.\n---@return boolean The sprite rolling with life flag state.\nfunction SgParticleSystem:getSpriteRollingWithLifeFlag()\n return _internal.sendMessage('sgparticles.getSpriteRollingWithLifeFlag', { obj=self._handle })\nend\n\n--- Sets the number of columns in the sprite sheet.\n---@param nCols number The number of columns in the sprite sheet.\nfunction SgParticleSystem:setSpriteCols(nCols)\n _internal.sendMessage('sgparticles.setSpriteCols', { obj=self._handle, nCols=nCols })\nend\n\n--- Gets the number of colums in the sprite sheet.\n---@return number The number of columns in the sprite sheet.\nfunction SgParticleSystem:getSpriteCols(width, height)\n return _internal.sendMessage('sgparticles.getSpriteCols', { obj=self._handle })\nend\n\n--- Sets the number of rows in the sprite sheet.\n---@param nRows number The number of rows in the sprite sheet.\nfunction SgParticleSystem:setSpriteRows(nRows)\n _internal.sendMessage('sgparticles.setSpriteRows', { obj=self._handle, nRows=nRows })\nend\n\n--- Gets the number of rows in the sprite sheet.\n---@return number The number of rows in the sprite sheet.\nfunction SgParticleSystem:getSpriteRows(width, height)\n return _internal.sendMessage('sgparticles.getSpriteRows', { obj=self._handle })\nend\n\n--- Sets the atlas size for the sprites.\n---@param width number The width of the sprite atlas.\n---@param height number The height of the sprite atlas.\nfunction SgParticleSystem:setAtlasSize(width, height)\n _internal.sendMessage('sgparticles.setAtlasSize', { obj=self._handle, width=width, height=height })\nend\n\n--- Gets the atlas size for the sprites.\n---@return table A table containing the width and height of the atlas.\nfunction SgParticleSystem:getAtlasSize(width, height)\n return _internal.sendMessage('sgparticles.getAtlasSize', { obj=self._handle })\nend\n\n--- Sets the noise strength for the particle system.\n---@param value number The noise strength value.\nfunction SgParticleSystem:setNoiseStrength(value)\n _internal.sendMessage('sgparticles.setNoiseStrength', { obj=self._handle, value=value })\nend\n\n--- Sets the noise frequency for the particle system.\n---@param value number The noise frequency value.\nfunction SgParticleSystem:setNoiseFrequency(value)\n _internal.sendMessage('sgparticles.setNoiseFrequency', { obj=self._handle, value=value })\nend\n\n--- Sets the noise octaves for the particle system.\n---@param value number The noise octaves value.\nfunction SgParticleSystem:setNoiseOctaves(value)\n _internal.sendMessage('sgparticles.setNoiseOctaves', { obj=self._handle, value=value })\nend\n\n--- Renders a new noise texture to be applied to the particle system.\n--- An expensive call. Use only when required.\nfunction SgParticleSystem:generateNoise()\n _internal.sendMessage('sgparticles.generateNoise', { obj=self._handle })\nend\n\nreturn SgParticleSystem\n";
|
|
131048
131048
|
|
|
131049
131049
|
var lua_api_storage = "\nlocal _internal = require('engine/_internal');\nlocal Promise = require 'engine/promise'\n\n--- @module storage\nlocal storage = {}\n\n---Retrieve a value from storage. The function will not directly return the value but the value is fetched from storage asynchronously and an event is generated once the value is available. See examples.\n---@param key string the key to retrieve\nfunction storage.get(key)\n local p = _internal.sendMessage('storage.get', { key=key })\n return Promise:new(p)\nend\n\n---Set a value in storage\n---@param key string the key to write to\n---@param value any the value to write\nfunction storage.set(key, value)\n _internal.sendMessage('storage.set', { key=key, value=value })\nend\n\n---Remove a value from storage\n---@param key string the key to remove\nfunction storage.remove(key)\n _internal.sendMessage('storage.remove', { key=key })\nend\n\n---Clear the storage\n---@function\nfunction storage.clear()\n _internal.sendMessage('storage.clear')\nend\n\n--- Retrieve all keys from storage. The function will not directly return the values but the data is fetched from storage asynchronously and an event is generated once the data is available. See examples.\n--- @function\nfunction storage.keys()\n local p = _internal.sendMessage('storage.keys')\n return Promise:new(p)\nend\n\nreturn storage\n";
|
|
131050
131050
|
|