Difference between revisions of "Paint"

From Silhouette Wiki
Jump to navigation Jump to search
Line 74: Line 74:
 
|Sets the value for [[Paint State]]
 
|Sets the value for [[Paint State]]
 
|}
 
|}
 +
 +
== Scripting Examples ==
 +
 +
Here is a replacement for the <tt>toggleOnionSkin</tt> function in the keybinds.py file. Instead of toggling Onion-Skin mode on and off, this toggles between no clone overlay and the last-used clone view mode.
 +
 +
<syntaxhighlight lang="python">
 +
# desired default clone view mode
 +
clone_view_mode = fx.paint.View_Onion
 +
 +
def toggleOnionSkin():
 +
    global clone_view_mode
 +
    current_mode = fx.paint.cloneViewMode
 +
    if current_mode == fx.paint.View_Normal:
 +
        current_mode = clone_view_mode
 +
    else:
 +
        # save the current state for later
 +
        clone_view_mode = current_mode
 +
        current_mode = fx.paint.View_Normal
 +
    fx.paint.cloneViewMode = current_mode
 +
 +
    # disable quick mode when doing this
 +
    if fx.viewer.toolName == "Clone":
 +
        cmds = ["translate", "rotate", "scale"]
 +
        for c in cmds:
 +
            if fx.viewer.queryTool(c) == "1":
 +
                fx.viewer.toolCommand(c, False)
 +
 +
</syntaxhighlight>

Revision as of 17:53, 10 December 2012

The Paint object is a global object used to interact with the Paint UI while in the Paint Node.

Attributes

Name Description
align True if the Clone overlay mode is set to Align.
alphaSource The current alpha source used for Obey Alpha. (0=input, 1=output)
brush The current brush name.
brushes The List of available brush names. (read-only)
brushSize The current brush size (diameter in pixels).
channelMask The target channel mask as a Color.
cloneOffset The current clone offset as a Point3D.
invertAlpha True if Invert Alpha is on.
matchMove True if Match Move is on.
opaqueAlpha True if Opaque Alpha is on.
onionSkin True if the Clone overlay mode is on.
onionSkinMix The mix value of the Clone overlay.
opacity The current brush opacity.
preset The current Preset index.
profileType The current Brush Profile index (0=Circle, 1=Square)
transformMode True if Clone Interactive Transform mode is enabled.
cloneOffsetModifier The Modifier used for setting the Clone Offset
brushEditModifier The Modifier used for editing the Brush Size.

Methods

Name Description
getState(state) Returns the value for the Paint State.
setState(state, value) Sets the value for Paint State

Scripting Examples

Here is a replacement for the toggleOnionSkin function in the keybinds.py file. Instead of toggling Onion-Skin mode on and off, this toggles between no clone overlay and the last-used clone view mode.

# desired default clone view mode
clone_view_mode = fx.paint.View_Onion

def toggleOnionSkin():
    global clone_view_mode
    current_mode = fx.paint.cloneViewMode
    if current_mode == fx.paint.View_Normal:
        current_mode = clone_view_mode
    else:
        # save the current state for later
        clone_view_mode = current_mode
        current_mode = fx.paint.View_Normal
    fx.paint.cloneViewMode = current_mode

    # disable quick mode when doing this
    if fx.viewer.toolName == "Clone":
        cmds = ["translate", "rotate", "scale"]
        for c in cmds:
            if fx.viewer.queryTool(c) == "1":
                fx.viewer.toolCommand(c, False)