Marco Pontello's Home Page
(Last updated: 30/05/15)
 

 


Project Dogwaffle + The Programming Language Lua

DogLua - Project Dogwaffle Lua scriptable interface

Reference info

Intro - gluas API - Dogwaffle API - GUI Server API - Misc.
 


Dogwaffle API

These functions interact directly with capabilities exposed by Project Dogwaffle, or are anyway specific to DogLua.

User I/O
Dog_MessageBox()
Dog_ValueBox()
Frame(s) management
Dog_Refresh()
Dog_GetTotalFrames()
Dog_GetCurrentFrame()
Dog_GotoFrame()
Dog_GetBuffer()
Undo buffers
Dog_SaveUndo()
Dog_RestoreUndo()
Misc
Dog_ShellExe()
 


Dog_MessageBox(line1, line2, linen)

Display a simple message box in the Dogwaffle main window.
Every parameter passed (string, number, expression) will go an a different line.

Example:


Dog_MessageBox("Hello, World!", 1+2)

 


x = Dog_ValueBox(title, prompt, min, max, default)

Create and display a simple dialog box, giving the user the ability to choose a value in a predefined range. If the user click on the cancel button, a value of -1 is returned.

Example:


level = Dog_ValueBox("Threshold",
        "Choose level", 0, 100, 50)

 


Dog_Refresh()

Update Dogwaffle display from the current working buffer, to reflect all modification made. A refresh is issued automatically when a Lua script execution end, but Dog_Refresh can be used to update the display whenever needed, for example during the execution of a long multipass script.

 


x = Dog_GetTotalFrames()

Return the total number of frames present in the current animation, or 0 if working on a single frame.

 


x = Dog_GetCurrentFrame()

Return the current frame number, starting from 0.

 


Dog_GotoFrame(x)

Move to the specified frame of the current animation.
When a Dog_GotoFrame is issued, the current frame is refreshed from the working buffer; then the new frame become current, and the working buffer is updated with the new frame.

Example:


-- Get the number of frames in the animation
topframe = Dog_GetTotalFrames() - 1
-- Loop trough every frame
for i = 0, topframe do
 Dog_GotoFrame(i)

 -- Do something

 progress(i / topframe)
end

 


Dog_GetBuffer()

Update the working buffer with the current frame.
It's most useful for example after running another (external) plugin trough Dog_ShellExe, to make the buffer reflect the frames' modifications.

 


Dog_SaveUndo()

Save an Undo point. It can be used to save a frame before doing some modifications, before asking the user to accept the changes and/or continue the work. This way the previous situation could be restored trough Dog_RestoreUndo(), if needed.
N.B. What is saved is the current Dogwaffle frame/display, so if the script has done some modifications that need to be saved, a Dog_Refresh() have to called before using Dog_SaveUndo().

 


Dog_RestoreUndo()

Restore a previously saved Undo point. Since that will alter the Dogwaffle frame/display, a Dog_GetBuffer() is then needed to updated the DogLua working buffer.

Example:


-- Save an undo point before starting
Dog_SaveUndo()

-- do some works...

-- Update the display
Dog_Refresh()

Dog_MessageBox("Now the frame will be restored!")
Dog_RestoreUndo()
Dog_GetBuffer()

 


Dog_ShellExe(command_string)

Run the external command specified. It could be anything from a Dogwaffle plugin, any other executable, etc. Generally speaking, anything that could be executed from the Start - Run... Windows menu.
The execution of the Lua script will be suspended until the executed command is terminated.

Example 1:


-- Run a Dogwaffle plugin
Dog_ShellExe("fogfilter_pf.exe")
-- Update the working buffer
Dog_GetBuffer()

Example 2:


-- Run another Lua script trough DogLua plugin
Dog_ShellExe("doglua_pm dogluascripts/negative.lua")
-- Update the working buffer
Dog_GetBuffer()