### Get Object Track Mode Example Source: https://docs.aviutl2.jp/lua Example demonstrating how to get the track mode for a track bar named 'vx'. The track bar is assumed to be defined elsewhere, e.g., '--track@vx:X速度,-10,10,0'. ```lua --track@vx:X速度,-10,10,0 obj.getoption("track_mode", "vx") ``` -------------------------------- ### Display Anchor Points and Get Coordinates (Variable Array) Source: https://docs.aviutl2.jp/lua/examples This example shows how to display anchor points and retrieve their coordinates using a variable array. It sets up a 'Position' anchor and loops through the retrieved coordinates. ```aulua --value@pos:座標,{} num = 3 obj.setanchor("pos", num, "loop") for i = 0, num - 1 do x = pos[i * 2 + 1] y = pos[i * 2 + 2] end ``` -------------------------------- ### Get Object Value Example - Scene Change Ratio Source: https://docs.aviutl2.jp/lua Retrieves the display ratio during a scene change. This value ranges from 0.0 to 1.0 and is only applicable during scene transitions. Refer to scene change scripts for usage examples. ```lua obj.getvalue("scenechange") ``` -------------------------------- ### AviUtl2 Installer Command-Line Options Source: https://docs.aviutl2.jp/usage These are the available command-line options for the AviUtl2 installer. They allow for automated installation, uninstallation, file association, shortcut creation, and language file copying. Some options require administrator privileges and must be specified before the installation path option (-I). ```bash AviUtl2_setup.exe [option] (引数無し) : インストールウィザード -uninstall : アンインストールウィザード -I (インストールパス) : インストール実行 ※管理権限で実行する必要があります -U : アンインストール実行 ※管理権限で実行する必要があります -F : ファイルをアプリケーションに関連付け ※-Iの前に指定する必要があります -S : デスクトップにショートカットを作成 ※-Iの前に指定する必要があります -L : 言語ファイルをコピー ※-Iの前に指定する必要があります ``` -------------------------------- ### Get Camera Parameters Example Source: https://docs.aviutl2.jp/lua Retrieves the current camera parameters into a table variable 'cam'. This table can then be modified and reapplied using obj.setoption('camera_param', cam). ```lua cam = obj.getoption("camera_param") ``` -------------------------------- ### Get Object Value Example - Time and Frame Source: https://docs.aviutl2.jp/lua Retrieves the object's reference time ('time') or its start ('frame_s') and end ('frame_e') frames within the scene. These are 0-based integer values. ```lua obj.getvalue("time") obj.getvalue("frame_s") obj.getvalue("frame_e") ``` -------------------------------- ### Get Script Name Comparison Example Source: https://docs.aviutl2.jp/lua Compares the current script's name with the name of the script directly above it in the filter list. This is useful for conditional logic based on script order. ```lua if obj.getoption("script_name") == obj.getoption("script_name", -1) then ``` -------------------------------- ### Get Application Uptime Source: https://docs.aviutl2.jp/lua Gets the elapsed time in seconds since the AviUtl application was launched. ```lua sec = obj.getinfo("clock") ``` -------------------------------- ### Get Object Value Example - Zoom and Aspect Ratio Source: https://docs.aviutl2.jp/lua Retrieves the zoom level ('zoom') and aspect ratio ('aspect') of the object's reference. Note that 'zoom' is a scale factor (100=normal) and differs from obj.zoom. ```lua obj.getvalue("zoom") obj.getvalue("aspect") ``` -------------------------------- ### Get Object Value Example - Track Bar Source: https://docs.aviutl2.jp/lua Example of retrieving the value of a track bar named 'track.xxx'. The 'target' parameter specifies the track bar variable name. ```lua obj.getvalue("track.xxx") ``` -------------------------------- ### Get Grid (BPM) Information Source: https://docs.aviutl2.jp/lua Retrieves tempo, beat, and offset information for the grid or BPM settings. ```lua tempo, beat, offset = obj.getinfo("bpm") ``` -------------------------------- ### Get Object Value Example - Scale Source: https://docs.aviutl2.jp/lua Retrieves the X, Y, or Z axis scale factor of the object's reference. 'sx', 'sy', 'sz' represent scale factors (1.0 = normal), while 'scale' gets all three. ```lua obj.getvalue("sx") obj.getvalue("sy") obj.getvalue("sz") obj.getvalue("scale") ``` -------------------------------- ### Register Multiple Scripts in One File Source: https://docs.aviutl2.jp/lua/examples This example demonstrates how to define multiple animation, object, scene, camera, or transition scripts within a single file by prefixing each script with `@ScriptName`. This is useful for organizing related effects. ```aulua @sample1 --track0:速度,-10,10,10 obj.ox = obj.ox + obj.track0 * obj.time @sample2 --track0:速度,-10,10,10 obj.oy = obj.oy + obj.track0 * obj.time ``` -------------------------------- ### Display Anchor Points with Multiple Setanchor Calls Source: https://docs.aviutl2.jp/lua/examples This example demonstrates using `obj.setanchor` multiple times with different anchor names and settings, including color. It sets up two distinct anchor points for position data. ```aulua --value@pos1:座標1,{} --value@pos2:座標2,{} obj.setanchor("pos1", 4, "loop", "color", RGB(0, 255, 255)) obj.setanchor("pos2", 2, "line", "color", RGB(0, 255, 0)) ``` -------------------------------- ### Get Object Value Example - Alpha (Opacity) Source: https://docs.aviutl2.jp/lua Retrieves the reference opacity of the object. The value ranges from 0.0 (fully transparent) to 1.0 (fully opaque). ```lua obj.getvalue("alpha") ``` -------------------------------- ### Get Object Value Example - Position Source: https://docs.aviutl2.jp/lua Retrieves the X, Y, or Z coordinate of the object's reference position. The 'target' parameter can be 'x', 'y', or 'z'. ```lua obj.getvalue("x") obj.getvalue("y") obj.getvalue("z") ``` -------------------------------- ### Get Object Value Example - Layered Object Source: https://docs.aviutl2.jp/lua Retrieves a specific setting (e.g., X coordinate) for an object on a different layer. Use the format 'layer[layer_number].[setting_type]'. You can also check for the object's existence on that layer. ```lua obj.getvalue("layer7.x") obj.getvalue("layer[レイヤー番号]") ``` -------------------------------- ### Adjust Object Brightness with Pixel Shader Source: https://docs.aviutl2.jp/lua/examples This example uses a pixel shader to adjust the brightness of an object. It defines a `bright` constant and a `psmain` function that outputs a color based on this brightness value. ```aulua --track@bright:明るさ,-100,100,0,0.01 --[[pixelshader@psmain: cbuffer constant0: register(b0) { float bright; }; float4 psmain(float4 pos: SV_Position): SV_Target { return float4(bright, bright, bright, 1); } ]] obj.pixelshader("psmain", "object", nil, { bright / 100 }, "add") ``` -------------------------------- ### Defining a Compute Shader in Lua Source: https://docs.aviutl2.jp/lua Example of embedding an HLSL compute shader definition within a Lua script using a multi-line comment. The registration name serves as the entry point. ```lua --[[computeshader@csmain: [numthreads(1, 1, 1)] void csmain(uint2 id: SV_DispatchThreadID) { ... } ]] ``` -------------------------------- ### Display Anchor Points and Get Coordinates (Trackbars) Source: https://docs.aviutl2.jp/lua/examples This script uses trackbars for X, Y, and Z coordinates to define anchor points. It retrieves the number of points and then iterates through each point's XYZ values. ```aulua --track@x:X,-100000,100000,0 --track@y:Y,-100000,100000,0 --track@z:Z,-100000,100000,0 --trackgroup@x,y,z:Group num = obj.setanchor("x,y,z", 0, "xyz", "line") for i = 0, num - 1 do x = obj.getvalue("track.x", 0, i) y = obj.getvalue("track.y", 0, i) z = obj.getvalue("track.z", 0, i) end ``` -------------------------------- ### Get Script Folder Path Source: https://docs.aviutl2.jp/lua Retrieves the absolute path to the directory where the current script is located. ```lua obj.getinfo("script_path") ``` -------------------------------- ### obj.getoption Source: https://docs.aviutl2.jp/lua/index Retrieves various options for the current object. This function can be used to get information about track modes, section numbers, script names, GUI visibility, camera mode, and camera parameters. ```APIDOC ## obj.getoption(name, ...) ### Description Retrieves various options for the current object. ### Parameters * `name` (string) - Required - The name of the option to retrieve. * `...` - Optional - Additional arguments may be required for specific options. ### Options: #### Track Mode * `name`: "track_mode" * `value` (string or number) - Required - The variable name or number of the track bar. * Returns: The name of the movement mode (0 for no movement). #### Section Number * `name`: "section_num" * Returns: The number of sections (number of intermediate points + 1). #### Script Name * `name`: "script_name" * `value` (number) - Optional - Relative position of the filter effect (0 for self, negative for above, positive for below). * `skip` (boolean) - Optional - Whether to skip disabled filter effects (`true` to skip, `false` (default) not to skip). * Returns: The script name (empty string if not a script). #### GUI Visibility * `name`: "gui" * Returns: `true` if the GUI is displayed, `false` otherwise. #### Camera Mode * `name`: "camera_mode" * Returns: 0 if the object is not a camera control target, otherwise non-zero (effectively `true`). #### Camera Parameters * `name`: "camera_param" * Returns: A table containing the camera parameters (x, y, z, tx, ty, tz, rz, ux, uy, uz, d). #### Multi Object * `name`: "multi_object" * Returns: `true` if individual objects are enabled, `false` otherwise. ### Example ```lua -- Get the track mode for a track bar named 'vx' local mode = obj.getoption("track_mode", "vx") -- Get the number of sections local sections = obj.getoption("section_num") -- Get the name of the script above the current one local script_name = obj.getoption("script_name", -1) -- Check if the GUI is visible if obj.getoption("gui") then print("GUI is visible") end -- Get camera parameters local cam = obj.getoption("camera_param") ``` ``` -------------------------------- ### Get Audio Data from File or Buffer Source: https://docs.aviutl2.jp/lua Retrieves audio data from a specified file or the current audio buffer. Supports different data types like PCM, spectrum, and Fourier transforms. ```lua n = obj.getaudio(buf, "audiobuffer", "spectrum", 32) ``` ```lua n, rate = obj.getaudio(buf, "c:\\test.wav", "pcm", 1000) ``` ```lua n, rate, buf = obj.getaudio(nil, "c:\\test.wav", "pcm.r", 1000) ``` -------------------------------- ### Defining a Pixel Shader in Lua Source: https://docs.aviutl2.jp/lua Example of embedding an HLSL pixel shader definition within a Lua script using a multi-line comment. The registration name serves as the entry point. ```lua --[[pixelshader@psmain: float4 psmain(float4 pos: SV_Position): SV_Target { ... } ]] ``` -------------------------------- ### obj.getoption Source: https://docs.aviutl2.jp/lua Retrieves various options for the current object. This function can be used to get information about track bar modes, script names, GUI status, camera control status, camera parameters, and multi-object status. ```APIDOC ## obj.getoption(name[, value][, skip]) Retrieves various options for the current object. * `name`: Option name ### Options: #### Track Bar Movement Mode `obj.getoption("track_mode", value)` * `value`: Track bar variable name or number (e.g., `"vx"` or `0` for `--track0:`) * Returns: 0 for no movement, otherwise the movement mode name. Example: ```aulua --track@vx:X speed,-10,10,0 obj.getoption("track_mode", "vx") ``` #### Number of Sections `obj.getoption("section_num")` * Returns: The number of sections (number of intermediate points + 1). #### Get Script Name `obj.getoption("script_name"[, value][, skip])` * `value`: Relative vertical position of the filter effect (0=self, negative=above, positive=below). * `skip`: Whether to skip disabled filter effects (`true` to skip, `false` (default) not to). * Returns: Script name (empty string if not a script). Example: ```aulua if obj.getoption("script_name") == obj.getoption("script_name", -1) then ``` #### Check GUI Display Status `obj.getoption("gui")` * Returns: `true` if displayed, `false` if hidden. Hidden during video output. #### Get Camera Control Status `obj.getoption("camera_mode")` * Returns: 0 if not a camera control target, non-zero otherwise. (Actually returns `true`/`false`) #### Get Camera Parameters `obj.getoption("camera_param")` * Returns: Camera parameter table (same contents as `obj.setoption("camera_param")`). Example: ```aulua cam = obj.getoption("camera_param") ``` #### Check if Individual Object is Enabled `obj.getoption("multi_object")` * Returns: `true` if enabled, `false` if disabled. ``` -------------------------------- ### Trackbar Movement Script (Linear Interpolation) Source: https://docs.aviutl2.jp/lua/examples This script moves a trackbar value linearly from a start point to an end point. It retrieves the current point index and ratio to calculate the interpolated value. ```aulua index, ratio = math.modf(obj.getpoint("index")) st = obj.getpoint(index) ed = obj.getpoint(index + 1) return st + (ed - st) * ratio ``` -------------------------------- ### Get Pixel Data (Color/RGB) Source: https://docs.aviutl2.jp/lua/index Retrieves pixel information at a given coordinate. Can fetch color (hex/alpha) or RGB(A) values. Caching is used, so manual cache invalidation might be needed. ```lua col, a = obj.getpixel(0, 0, "col") r, g, b, a = obj.getpixel(0, 0, "rgb") ``` -------------------------------- ### obj.getinfo Source: https://docs.aviutl2.jp/lua Retrieves various environment information. ```APIDOC ## obj.getinfo(name, ...) ### Description Retrieves various environment information. ### Parameters * `name`: The name of the information to retrieve. ### Examples #### Get script folder path ```aulua obj.getinfo("script_path") ``` * Returns: The path to the script folder. #### Check if currently processing a filter object ```aulua obj.getinfo("filter") ``` * Returns: `true` if processing a filter object, `false` otherwise. #### Check if video is being output ```aulua obj.getinfo("saving") ``` * Returns: `true` if outputting, `false` otherwise. #### Get maximum image size ```aulua max_x, max_y = obj.getinfo("image_max") ``` * Returns: Maximum image size (width, height). #### Get grid (BPM) information ```aulua tempo, beat, offset = obj.getinfo("bpm") ``` * Returns: Tempo, beat, and reference time. #### Get elapsed time since application start ```aulua sec = obj.getinfo("clock") ``` * Returns: Elapsed time since application start (in seconds). Measured using the performance counter. #### Get script processing time ```aulua msec = obj.getinfo("script_time") ``` * Returns: Elapsed time since script execution started (in milliseconds). Measured using the performance counter. #### Get version information ```aulua version = obj.getinfo("version") ``` * Returns: The version number of the main application. ``` -------------------------------- ### Load Image File Source: https://docs.aviutl2.jp/lua Loads an image file. Returns true on success and false on failure. ```aulua obj.load("image", "c:\\test.bmp") ``` -------------------------------- ### Set and Print Global Variable in Lua Source: https://docs.aviutl2.jp/lua Demonstrates how to set a global variable and print its value using Lua within AviUtl. ```aulua global.test = 123 print(global.test) ``` -------------------------------- ### Get Object Value Example - Rotation Source: https://docs.aviutl2.jp/lua Retrieves the X, Y, or Z axis rotation angle of the object's reference. The 'target' parameter can be 'rx', 'ry', or 'rz'. ```lua obj.getvalue("rx") obj.getvalue("ry") obj.getvalue("rz") ``` -------------------------------- ### Register a Single Script in a File Source: https://docs.aviutl2.jp/lua/examples This shows the standard format for defining a single script within a file, without the `@ScriptName` prefix. It includes a trackbar definition for speed adjustment. ```aulua --track0:速度,-10,10,10 obj.ox = obj.ox + obj.track0 * obj.time ``` -------------------------------- ### Get AviUtl Version Source: https://docs.aviutl2.jp/lua Retrieves the version number of the main AviUtl application. ```lua version = obj.getinfo("version") ``` -------------------------------- ### obj.pixeloption Source: https://docs.aviutl2.jp/lua Sets options for `obj.getpixel()`, `obj.putpixel()`, and `obj.copypixel()`. Options include pixel information type, read/write targets, and blend types. ```APIDOC ## obj.pixeloption(name, value) ### Description Sets options for `obj.getpixel()`, `obj.putpixel()`, and `obj.copypixel()`. Note: This must be specified for each script call. ### Parameters #### Path Parameters * `name` (string) - Required - The option name. * `value` (any) - Required - The option value. ### Options #### Pixel Information Type `obj.pixeloption("type", value)` * `value` (string): `"col"` / `"rgb"` / `"yc"` #### Pixel Information Read Target `obj.pixeloption("get", value)` * `value` (string): `"object"`: Object / `"framebuffer"`: Framebuffer #### Pixel Information Write Target `obj.pixeloption("put", value)` * `value` (string): `"object"`: Object / `"framebuffer"`: Framebuffer #### Blend Type for Writing `obj.pixeloption("blend", value)` * `value` (number): No argument = Replace / 0 = Normal / 1 = Add / 2 = Subtract / 3 = Multiply. ``` -------------------------------- ### obj.module Source: https://docs.aviutl2.jp/lua Retrieves functions from a script module (.mod2). ```APIDOC ## obj.module(name) ### Description Retrieves functions from a script module (.mod2). ### Parameters * `name`: The name of the module (the base filename of the script module). ### Returns A function table for the script module. ### Example ```aulua local func = obj.module("ScriptModule") local total = func.sum(1, 2, 3) ``` ``` -------------------------------- ### Get Maximum Image Size Source: https://docs.aviutl2.jp/lua Retrieves the maximum supported width and height for images in AviUtl. ```lua max_x, max_y = obj.getinfo("image_max") ``` -------------------------------- ### Get Script Module Function Source: https://docs.aviutl2.jp/lua Obtains a function table from a loaded script module (.mod2 file). ```lua local func = obj.module("ScriptModule") local total = func.sum(1, 2, 3) ``` -------------------------------- ### Get Script Execution Time Source: https://docs.aviutl2.jp/lua Measures the elapsed time in milliseconds since the script execution began. ```lua msec = obj.getinfo("script_time") ``` -------------------------------- ### Define Object Addition Menu Label Source: https://docs.aviutl2.jp/lua Sets the initial label for a hierarchical menu in the object addition menu. ```aulua --label:加工 ``` -------------------------------- ### obj.setoption Source: https://docs.aviutl2.jp/lua Sets various options for the current object. These settings need to be specified for each script call. Options include controlling visibility, camera alignment, blending modes, draw targets, focus modes, camera parameters, and sampler modes. ```APIDOC ## obj.setoption(name, value) Sets various options for the current object. These settings need to be specified for each script call. * `name`: Option name * `value`: Option value ### Options: #### Culling (Hide Backface) `obj.setoption("culling", value)` * `value`: 0 = Display / 1 = Hide #### Billboard (Face Camera) `obj.setoption("billboard", value)` * `value`: 0 = Do not face / 1 = Horizontal only / 2 = Vertical only / 3 = Face #### Blend Mode `obj.setoption("blend", value[, option])` * `value`: * `"none"`: Normal * `"add"`: Additive * `"sub"`: Subtractive * `"mul"`: Multiplicative * `"screen"`: Screen * `"overlay"`: Overlay * `"light"`: Lighten * `"dark"`: Darken * `"brightness"`: Color Dodge * `"chroma"`: Color Burn * `"shadow"`: Linear Burn * `"light_dark"`: Difference * `"diff"`: Exclusion * For virtual buffers: * `"alpha_add"`: Weighted average for color, additive for alpha * `"alpha_max"`: Weighted average for color, max for alpha * `"alpha_sub"`: No color change, subtractive for alpha * `"alpha_add2"`: Overlay for color, additive for alpha * `"rgba_add"`: Simple additive RGBA (Direct3D BlendState only) *Note: Numeric values from old script formats are also supported. Using blend modes can increase processing load. #### Draw Target to Virtual Buffer `obj.setoption("drawtarget", "tempbuffer"[, w, h])` * `w, h`: Virtual buffer size (optional, initializes if specified) * Changes the draw target to a virtual buffer for `obj.draw()` and `obj.drawpoly()`. Coordinates are used directly without object's settings. Specifying size initializes the buffer with transparency. The virtual buffer is shared among all objects. #### Draw Target to Frame Buffer `obj.setoption("drawtarget", "framebuffer")` * Changes the draw target back to the frame buffer for `obj.draw()` and `obj.drawpoly()`. If no drawing has been done to the frame buffer, it defaults to this after script execution. #### Draw State in Script `obj.setoption("draw_state", flag)` * `flag`: `true` = Drawn / `false` = Not drawn #### Object Focus Frame Mode `obj.setoption("focus_mode", value)` * `value`: * `"fixed_size"`: Fixed size frame * `"no_resize"`: No resize frame #### Set Camera Parameters `obj.setoption("camera_param", cam)` * `cam`: Camera parameter table * `.x`, `.y`, `.z`: Camera position * `.tx`, `.ty`, `.tz`: Target position * `.rz`: Camera tilt * `.ux`, `.uy`, `.uz`: Upward unit vector * `.d`: Distance from camera to screen (focal length) #### Sampler Mode `obj.setoption("sampler", value)` * `value`: * `"clip"`: Transparent outside region (default for `obj.draw()`) * `"clamp"`: Edge color outside region (default for `obj.drawpoly()`) * `"loop"`: Loop outside region * `"mirror"`: Mirror loop outside region * `"dot"`: No magnification/reduction interpolation (transparent outside region) *Note: If UV coordinates are specified in `obj.drawpoly()`, they are clipped within the region. Defaults are applied if `value` is omitted. ``` -------------------------------- ### Get Object Section Count Source: https://docs.aviutl2.jp/lua Retrieves the number of sections (intermediate points + 1) for the current object. ```lua obj.getoption("section_num") ``` -------------------------------- ### Get Pixel Data (YCbCr) Source: https://docs.aviutl2.jp/lua/index Retrieves pixel information in YCbCr format at a given coordinate. This is an older internal format. ```lua y, cb, cr, a = obj.getpixel(0, 0, "yc") ``` -------------------------------- ### Trackbar Movement Script (Multiple Parameters) Source: https://docs.aviutl2.jp/lua/examples This snippet shows how to access multiple parameter values set for a trackbar movement script. It retrieves `param1` and `param2` which would be defined in the trackbar settings. ```aulua param1, param2 = obj.getpoint("param") ``` -------------------------------- ### Get Generic Data Pointer Source: https://docs.aviutl2.jp/lua Retrieves a pointer to a generic data area, typically used for script modules or DLLs. ```lua obj.data(name) ``` -------------------------------- ### obj.load Source: https://docs.aviutl2.jp/lua/index Loads various types of media into the current object. This includes video files, image files, text, figures, framebuffers, virtual buffers, layers, and previous objects. ```APIDOC ## obj.load ### Description Loads various types of media into the current object. This includes video files, image files, text, figures, framebuffers, virtual buffers, layers, and previous objects. Previously loaded images are discarded. ### Method `obj.load([type],...)` ### Parameters #### Path Parameters - **type** (string) - Optional - The type of media to load. If omitted, it is determined automatically. Supported types include: - `"movie"`: Load image from a video file. - `"movie.frame"`: Load image from a video file by frame number. - `"movie.info"`: Get information about a video file without updating the current object. - `"image"`: Load an image file. - `"text"`: Load text as an image. - `"text.layout"`: Get the image size of text to be loaded by `obj.load("text")`. - `"figure"`: Load a figure or SVG file. - `"framebuffer"`: Load from a framebuffer. - `"tempbuffer"`: Load from a virtual buffer. - `"layer"`: Load an object from a specified layer. - `"before"`: Load the immediately preceding object. #### Arguments for specific types: - **For `"movie"` and `"movie.frame"`:** - `file` (string) - Required - The path to the video file. - `time` (number) - Optional - The time in seconds to capture the image (defaults to the object's current time). Returns the total duration of the video in seconds (0 on failure). - `frame` (number) - Optional - The frame number to capture. - **For `"movie.info"`:** - `file` (string) - Required - The path to the video file. Returns the total frames, frame rate (rate), and frame rate (scale) (all 0 on failure). - **For `"image"`:** - `file` (string) - Required - The path to the image file. Returns `true` on success, `false` on failure. - **For `"text"`:** - `text` (string) - Required - The text to load. - `speed` (number) - Optional - Characters displayed per second. - `time` (number) - Optional - Elapsed time for the `speed` parameter. - `align` (number) - Optional - Text alignment type (0-17). Returns `true` on success, `false` on failure. - **For `"text.layout"`:** - `text` (string) - Required - The text to measure. - `speed` (number) - Optional - Characters displayed per second. - `time` (number) - Optional - Elapsed time for the `speed` parameter. - `align` (number) - Optional - Text alignment type (0-17). Returns width and height in pixels. If alignment is specified, center coordinates are also returned. - **For `"figure"`:** - `name` (string) - Required - The name of the figure or SVG file. - `color` (number) - Optional - The color of the figure (0x000000 to 0xffffff). - `size` (number) - Optional - The size of the figure. - `line` (number) - Optional - The line width of the figure. - `round` (boolean) - Optional - Whether to round the corners (`true`) or not (`false`, default). Returns `true` on success, `false` on failure. - **For `"framebuffer"`:** - `x, y, w, h` (number) - Optional - The range to capture from the framebuffer (defaults to the entire buffer). - `alpha` (boolean) - Optional - Whether to preserve the alpha channel (`true`) or not (`false`, default). Returns `true` on success, `false` on failure. - **For `"tempbuffer"`:** - `x, y, w, h` (number) - Optional - The range to capture from the virtual buffer (defaults to the entire buffer). Returns `true` on success, `false` on failure. - **For `"layer"`:** - `no` (number) - Required - The layer number (1-based). - `effect` (boolean) - Optional - Whether to execute additional effects (`true`) or not (`false`, default). Returns `true` on success, `false` on failure. - **For `"before"`:** No additional parameters. Usable only in custom objects before loading other objects. Returns `true` on success, `false` on failure. ### Request Example ```lua -- Load video obj.load("movie", "c:\\test.avi") -- Load image obj.load("image", "c:\\test.bmp") -- Load text obj.load("text", "This text will be loaded as an image") -- Get text layout size w, h = obj.load("text.layout", "The size of this text loaded as an image") w, h, cx, cy = obj.load("text.layout", "With center coordinates", 0, 0, 0) -- Load figure obj.load("figure", "Circle", 0xffffff, 100, true) ``` ``` -------------------------------- ### Get Object Pixel Dimensions Source: https://docs.aviutl2.jp/lua Retrieves the width and height of an object's pixel data when called without arguments. ```lua w, h = obj.getpixel() ``` -------------------------------- ### Get Pixel RGBA Source: https://docs.aviutl2.jp/lua Retrieves the RGBA values (0-255) for a specific pixel. This function is useful for detailed pixel manipulation. ```lua r, g, b, a = obj.getpixel(0, 0, "rgb") ``` -------------------------------- ### Get Script Name Source: https://docs.aviutl2.jp/lua Retrieves the name of the current script. Optionally filter by relative position to other filters and skip disabled filters. ```lua obj.getoption("script_name"[, value][, skip]) ``` -------------------------------- ### obj.load Source: https://docs.aviutl2.jp/lua Loads various types of media into the current object. This includes video frames, image files, text, figures, frame buffers, virtual buffers, layers, and previous objects. The behavior and parameters vary significantly based on the 'type' argument. ```APIDOC ## obj.load ### Description Loads various types of media into the current object. The type of media to load is specified by the first argument. If the type is omitted, it is determined automatically. The currently loaded image will be discarded. ### Method `obj.load(type, ...)` ### Parameters * `type` (string) - The type of media to load. Examples include "movie", "movie.frame", "movie.info", "image", "text", "text.layout", "figure", "framebuffer", "tempbuffer", "layer", "before". * `...` - Additional arguments specific to the media type being loaded. #### Video File `obj.load("movie", file[, time])` `obj.load("movie.frame", file[, frame])` Loads an image from a video file at a specified time or frame. * `file` (string): The path to the video file. * `time` (number): The time in seconds to capture the image (defaults to the object's current time). * `frame` (number): The frame number to capture. * Returns: The total duration of the video in seconds (0 if loading fails). #### Video File Information `obj.load("movie.info", file)` Retrieves information about a video file without updating the current object. * `file` (string): The path to the video file. * Returns: A table containing the number of frames, frame rate (rate), and frame rate (scale) (all 0 if loading fails). #### Image File `obj.load("image", file)` Loads an image file. * `file` (string): The path to the image file. * Returns: `true` for success, `false` for failure. #### Text `obj.load("text", text[, speed, time, align])` Loads text as an image. Color, size, and font control characters can be used. `speed` and `time` can control the number of characters displayed. * `text` (string): The text to load. * `speed` (number): The number of characters to display per second (used with `time`). * `time` (number): The elapsed time for the `speed` parameter. * `align` (number): Text alignment type (0-17 for horizontal and vertical text). * Returns: `true` for success, `false` for failure. #### Text Layout `obj.load("text.layout", text[, speed, time, align])` Gets the image size of text that would be loaded by `obj.load("text")`. The arguments are the same as for `obj.load("text")`. * Returns: The width and height in pixels. If `align` is specified, the center coordinates (cx, cy) are also returned. #### Figure `obj.load("figure", name[, color, size, line, round])` Loads a figure (e.g., circle, SVG file). * `name` (string): The name of the figure or SVG file. * `color` (number): The color in 0x000000 to 0xffffff format. * `size` (number): The size of the figure. * `line` (number): The line width of the figure. * `round` (boolean): Whether to round the corners (`true`) or not (`false`, default). * Returns: `true` for success, `false` for failure. #### Frame Buffer `obj.load("framebuffer"[, x, y, w, h][, alpha])` Loads from a frame buffer. * `x, y, w, h` (number): The range to capture from the frame buffer (defaults to the entire buffer). * `alpha` (boolean): Whether to preserve the alpha channel (`true`) or not (`false`, default). * Returns: `true` for success, `false` for failure. #### Virtual Buffer `obj.load("tempbuffer"[, x, y, w, h])` Loads from a virtual buffer (created using `obj.copybuffer()` or `obj.setoption()`). * `x, y, w, h` (number): The range to capture from the virtual buffer (defaults to the entire buffer). * Returns: `true` for success, `false` for failure. #### Object on Layer `obj.load("layer", no[, effect])` Loads an object from a specified layer. * `no` (number): The layer number (1-based). * `effect` (boolean): Whether to execute additional effects (`true`) or not (`false`, default). * Returns: `true` for success, `false` for failure. #### Previous Object `obj.load("before")` Loads the immediately preceding object. This can only be used within custom objects when loading another object. * Returns: `true` for success, `false` for failure. ### Request Example ```aulua obj.load("movie", "c:\\test.avi") obj.load("image", "c:\\test.bmp") obj.load("text", "This text will be loaded as an image") ``` ``` -------------------------------- ### Get Value from Specified Layer Object Source: https://docs.aviutl2.jp/lua/index Retrieves the setting value of an object in a specified layer. This function targets the object at the current time. ```lua obj.getvalue(layer, effect, item) ``` -------------------------------- ### Load Movie Frame from File Source: https://docs.aviutl2.jp/lua Loads an image from a video file at a specified time. The return value is the total duration of the video in seconds. Returns 0 on failure. ```aulua obj.load("movie", "c:\\test.avi") ``` -------------------------------- ### obj.getpixel Source: https://docs.aviutl2.jp/lua Retrieves pixel information of the current object. Can be used to get pixel count, color, RGB, or YCbCr values at specific coordinates. ```APIDOC ## obj.getpixel([x, y[, type]]) ### Description Retrieves pixel information of the current object. Calling without arguments returns the object's pixel count. Note: `getpixel()` returns values from a cached version to reduce VRAM access. In some situations, the cache may not be updated, leading to incorrect values (e.g., with draw or pixel-related drawing functions). You can actively discard the cache by processing `obj.pixeloption("get", xxx)`. ### Parameters #### Path Parameters * `x` (number) - Optional - The x-coordinate of the pixel to retrieve. * `y` (number) - Optional - The y-coordinate of the pixel to retrieve. * `type` (string) - Optional - The type of pixel information (`"col"`, `"rgb"`, or `"yc"`). Defaults to the type specified by `obj.pixeloption("type")` (usually `"col"`). ### Returns * If `type` is `"col"`: Color information (0x000000 to 0xffffff) and opacity (0.0=transparent/1.0=opaque). ```aulua col, a = obj.getpixel(0, 0, "col") ``` * If `type` is `"rgb"`: RGBA information for each 8-bit channel (0-255). ```aulua r, g, b, a = obj.getpixel(0, 0, "rgb") ``` * If `type` is `"yc"`: YCbCr old internal format. ```aulua y, cb, cr, a = obj.getpixel(0, 0, "yc") ``` * If called without arguments: Width and height in pixels. ```aulua w, h = obj.getpixel() ``` ``` -------------------------------- ### Get Trackbar Value Source: https://docs.aviutl2.jp/lua/index Retrieves values from trackbars, such as their current position, total count, or acceleration/deceleration status. This function is only usable within trackbar movement scripts. ```lua obj.getpoint(target[, option, option2]) ``` -------------------------------- ### Get Pixel Color and Alpha Source: https://docs.aviutl2.jp/lua Retrieves the color and alpha value of a specific pixel within an object. The default type is 'col', but 'rgb' and 'yc' are also supported. ```lua col, a = obj.getpixel(0, 0, "col") ``` -------------------------------- ### Execute Pixel Shader Source: https://docs.aviutl2.jp/lua Executes a registered pixel shader. Allows specifying input resources, constants, blend modes, and sampler states. ```lua obj.pixelshader(name, target, {resource, ...}[, {constant, ...}, blend, sampler]) ``` -------------------------------- ### Get Object Setting Value Source: https://docs.aviutl2.jp/lua Retrieves the current setting value of an object's effect or item. Supports specifying index for multiple effects and time/section for specific values. ```lua font = obj.getvalue("テキスト", "フォント") range = obj.getvalue("ぼかし:1", "範囲") ``` -------------------------------- ### Get Camera Control State Source: https://docs.aviutl2.jp/lua Checks if the current object is under camera control. Returns a non-zero value if it is, and 0 otherwise. Note: The actual return values are boolean 'true'/'false'. ```lua obj.getoption("camera_mode") ``` -------------------------------- ### Load Text as Image Source: https://docs.aviutl2.jp/lua Loads provided text as an image. Supports color, size, and font control characters. Speed and time parameters can modify character display. Not usable with text objects. ```aulua obj.load("text", "この文字が画像として読み込まれます") ```