HookObjectChange(function, handle, handle[, handle])

grandMA3 ユーザマニュアル » プラグイン » Lua 関数 - Object-Free API » HookObjectChange(function, handle, handle[, handle])
Version 2.2

説明

The HookObjectChange Lua function automatically calls a function when a grandMA3 object changes.

引数

  • function:
    関数名です。これは、指定された grandMA3 オブジェクトが変更されるたびにトリガーされます。
  • handle:
    変更を監視する必要がある grandMA3 オブジェクトのハンドルです。トリガーされた関数は、このハンドルを最初の引数として渡します。
  • handle:
    ハンドルは、この HookObjectChange を作成するプラグイン用である必要があります。これは、「この」プラグインのハンドルです。
  • handle (オプション):
    このハンドルは、トリガーされた関数に渡されるオブジェクト用です。

戻り値

  • integer:
    フックを識別する整数を返します。これを保存して、後でオブジェクトのフックを解除することができます。
ヒント
See also these related functions: DumpAllHooks, Unhook, UnhookMultiple.

Sequence プールの内容が変更されるたびに関数を呼び出すには、以下のようなコードでプラグインを作成します。

Lua
-- Get the handle to this Lua component.
local luaComponentHandle = select(4,...)

function Main()
-- Get a handle to the sequence pool.
local hookObject = DataPool().Sequences
-- Get a handle to this plugin.
local pluginHandle = luaComponentHandle:Parent()
-- Create the hook and save the Hook ID.
SequenceHookId = HookObjectChange(MySequencePoolCallback, hookObject, pluginHandle)
-- Print the returned Hook ID.
Printf("HookId: " .. SequenceHookId)
end

-- This function is called when there are changes in the sequence pool.
function MySequencePoolCallback(obj)
Printf(tostring(obj.name) .. " changed!")
end

return Main