

"Prepend Selected Layer Names": (scripts_menu,layer_label),įor key, value in list(actions_ems()):

"Shade Mattes By Layer Order": (scripts_menu,shade_mattes), "Randomise Matte Colors": (scripts_menu,random_colors), "Surface to Spline": (scripts_menu, set_surface), "Frame Jump": (scripts_menu, frame_jump), Scripts_menu = mocha_menubar.addMenu('Scripts') #create a new Scripts menu optionįrom set_surface_to_spline import SetSurfaceToSplineįrom randomise_layer_colours import RandomiseColoursįrom shade_layers_by_order import ShadeMattesByOrderĭialog = FrameJump(parent=main_window) #Set parent so dialog doesn't sit behind Mocha window Mocha_menubar = list(filter(lambda wgt: isinstance(wgt, QMenuBar), widgets))

Main_window = mocha_widget # Define the MainWidget UI to use as a parent Some knowledge of PySide and Qt is helpful here, but if you follow along the script you can see how the widgets are created. We also list code at the end to show how to add this to the file menu in mocha and load a dialog for user entry.

Setting up init.pyīelow we show a detailed example of using init.py for creating a user-entry tool to prepend a word onto the front of all selected layers. If unset, the default locations above will be used. If the 'MOCHA_INIT_SCRIPT' environment variable points to a file, that file will be used, if it points to a directory, it will look specifically for init.py in that directory. You can also set the environment variable 'MOCHA_INIT_SCRIPT' to control where the path of the init.py initialization script resides.
