| grandMA3 ユーザマニュアル » プラグイン » Lua 関数 - Object-Free API » CreateUndo(string) | Version 2.2 |
CreateUndo 関数は、同じ Oops アクションにグループ化されたコマンドや機能呼び出しのリストへのハンドルを返します。
アンドゥ・ハンドルへの参照を付けて機能を実行すると、それがアンドゥ・リストに追加されます。
作成したアンドゥ・リストは、CloseUndo 関数によって閉じる必要があります。
アンドゥ・リストを作成し、リストに追加される一連のコマンドを実行してからリストを閉じます。これによって、一連のコマンドを Oops コマンド1つで取り消せるようになります。
Lua |
return function() -- Create the undo group. local MyNewUndo = CreateUndo("MySelection") -- Make some command line actions linked to the undo. Cmd("ClearAll", MyNewUndo) Cmd("Fixture 1", MyNewUndo) Cmd("Fixture 2", MyNewUndo) Cmd("Fixture 5", MyNewUndo) Cmd("Fixture 7", MyNewUndo) -- Closing the undo group and store it's return in a variable. local closeSuccess = CloseUndo(MyNewUndo) -- Print the feedback from the closing action - 1 = Success / 0 = Failure. if closeSuccess == false then ErrPrintf("The CloseUndo was not successful") elseif closeSuccess == true then Printf("The CloseUndo was successful") else Printf("The CloseUndo did not return a meaningful result") end end |