CreateMultiPatch({handles}, integer[, string])

grandMA3 ユーザマニュアル » プラグイン » Lua 関数 - Object-Free API » CreateMultiPatch({handles}, integer[, string])
Version 2.2

説明

CreateMultiPatch 関数は、テーブルに一連のマルチパッチ・フィクスチャを作成します。

引数

  • table:
    テーブルには、マルチパッチ・フィクスチャを持つフィクスチャへのハンドルが含まれている必要があります。
  • integer:
    作成するマルチパッチ・フィクスチャの数です。
  • string (オプション):
    元に戻す際の文字列です。引用符で囲む必要があります。

戻り値

  • integer または nil:
    作成されたマルチパッチ・フィクスチャの数を返します。

Patch で最初のフィクスチャ(Universal を除く)に2つのマルチパッチ・フィクスチャを作成します。

Lua
return function()
    -- Enter Patch.
    Cmd("ChangeDestination Root");
    -- Enter the SetupPatch.
    Cmd("ChangeDestination 'ShowData'.'Patch'");
    -- Get the handle for the first fixture in the patch.
    local myFixture = Patch().Stages[1].Fixtures[2]
    -- Add the handle a list element in an table.
    local myFixtureTable = {myFixture}
    -- Add a variable with the amount of multipatch fixtures needed.
    local multiPatchAmount = 2
    -- Count the number of elements in the fixture table and store in a variable.
    local count = 0
    for _ in pairs(myFixtureTable) do
         count = count + 1
    end
    -- Create an unto text string.
    local undoText = string.format("Create %d multipatch fixtures for up to %d fixtures", multiPatchAmount, count)
    -- Create the multipatch fixtures to the each fixture handle in the table and store the returned value.
    local multiPatchAmount = CreateMultiPatch(myFixtureTable, multiPatchAmount, undoText)
    if multiPatchAmount ~= nil then
        Printf(multiPatchAmount .. " multi patch objects was created")
    else
        Printf("An error occured")
    end
    -- Return the command line destination to the root.
    Cmd("ChangeDestination Root")
end