Silhouette Python Scripts

sfx_logo


Quick Alpha Script:
#Quick Alpha python script for Silhouette
#script by Gordon Marshall

import fx

matte = 0
def view_matte():
    '''Cycles between between foreground view and matte output view for roto and paint output and matte output for paint in silhouette. '''
    node = fx.activeNode()
    if node.type == 'RotoNode': #in roto mode
        global matte
        if matte == 0:
            matte = 1
            fx.viewer.setChannelMask(fx.Color(0, 0, 0, 1))
            fx.viewer.setViewMode(0)
        else:
            matte = 0
            fx.viewer.setChannelMask(fx.Color(1, 1, 1, 1))
            fx.viewer.setViewMode(1)
    elif node.type == 'PaintNode': #in paint mode
        if matte == 0:
            matte = 1
            fx.viewer.setChannelMask(fx.Color(0, 0, 0, 1))
            fx.viewer.setViewMode(0)
        else:
            matte = 0
            fx.viewer.setChannelMask(fx.Color(1, 1, 1, 0))
            fx.viewer.setViewMode(0)

fx.bind('Alt+a', view_matte) #change hotkey here to suit preferences



Interactive Transform Shortcut:
#Interactive Transform Shortcut python script for Silhouette
#script by Gordon Marshall

import fx

interactive = 0
def interactive_view():
    '''Toggles Interactive mode on and off via a hotkey '''
    node = fx.activeNode()
    if node.type == 'PaintNode':
        global interactive
        if interactive == 0:
            interactive = 1
            fx.paint.setTransformMode(True)
            fx.paint.setOnionSkin(True)
        else:
            interactive = 0
            fx.paint.setTransformMode(False)
            fx.paint.setOnionSkin(False)

fx.bind('Alt+q', interactive_view) #change hotkey here to suit preference
 

Brush Opacity Shortcuts:
#Brush Opacity Value Shortcut python script for Silhouette
#script by Gordon Marshall

import fx

def opacity_up():
    """increases the brush opacity by a value of 10"""
    node = fx.activeNode()
    if node.type == 'PaintNode':
        x = fx.paint.opacity
        i = (x + 10) / 100
        fx.paint.opacity = i
 
fx.bind(']', opacity_up) #change hotkey here to suit preference

def opacity_down():
    """decreases the brush opacity by a value of 10"""
    node = fx.activeNode()
    if node.type == 'PaintNode':
        x = fx.paint.opacity
        i = (x - 10) / 100
        fx.paint.opacity = i

fx.bind('[', opacity_down) #change hotkey here to suit preference