One thing that I always wanted to do is the ability to import some sort of vector file as a Roto node. The reason for this is that I wanted to load a logo or a shape that I wanted to use a mask and just didn't want to render out a huge PNG image or something. So finally I decide to give it a go with Scalable Vector Graphics (SVG). Since it's an XML based vector file this shouldn't be too complicated. In the end I wound up with a satisfying result, which allows me to import shapes and colors or objects. 

It is not perfect, as the SVG format is quite complex supporting outlines, gradients, animations, images etc. and those things would require quite a bit of coding, but probabaly wouldn't be worth doing, at least not as a gizmo.

The shapes that are supported are:

  • Circle
  • Ellipse
  • Square
  • Polygon
  • Path (all path types except arc, which I just didn't have the time to do as it requires extra coding, considering it has many options)

SVG to RotoPaint v0.9 Version: 0.9 Author: Vladislav Bakic Filesize: 23.68K License: Apache 2.0 License
The pivot points are centered, based on the bounding box, and any subpaths have transparency to simulate the holes in shapes, which is not an ideal solution, but the only other way I found of doing it is making every path a separate node, and I didn't want to do that.

The node is created from a string, not through the API, as it was too buggy and slow, basically in Nuke 7 and up, it would crash once I tried to move the points unless I converted the node to Nuke 6, and also creating points took minutes for larger files (more than 400KB, so not reeally large) compared to seconds when creating from string.

The script has been tested with nuke 6, 7, 8 and 9.