All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Friends Modules Pages
Classes | Public Member Functions | List of all members
VectorizeUtils Class Reference



Public Member Functions

QVariant importDrawingInNewElementNode (const char **filename, QVariant options)
QVariant importDrawingInElementNode (const char **filename, QVariant options)

Detailed Description

This class is available through the require function. It implements import bitmap operation. The import can be done in 3 different ways. As a plain bitmap, as a TVG Bitmap layer or by vectorizing the bitmap.

// To use the class
var Utils = require("VectorizeUtils.js");
// There are 2 methods that can be called: importDrawingInNewElementNode and importDrawingInElementNode.
// the 2 methods take the bitmap filename as argument and an options object.
// This will create a new element for the bitmap
// It will create the timing in the timeline using the imported bitmap.
// If the bitmap is a multi-layer (e.g. PSD) it will create one element module per
// top level group in the PSD document. It will also create an exposure per layer in each
// of these groups.
Utils.importDrawingInNewElementNode("MyBitmap.png", { undoLabel : "Custom Undo/redo label", importType : utils.IMPORT_TYPE.TVG_BITMAP});
// This will import the bitmap in the first selected node
// It will not change the timing in the timeline
Utils.importDrawingInElementNode("MyBitmap.png", { node: selection.selectedNode(0) });
// Here are the general options
// They are all optional except the elementId or the node.
var options = {
elementId : 1, node : "", // elementId or node must be set to either the elementId to importTo or the Element Module linked to the element to import to.
showProgressUI : true, // If set to false, will not show progress bar. Useful if doing batch processing
noScale : false, // If true, will not scale the bitmap when importing to TVG. Will use the default scaling.
importType : Utils.IMPORT_TYPE.TVG_BITMAP // One of the IMPORT_TYPE enum
bitmapAlignment : Utils.ALIGNMENT.VERTICAL_FIT, // One of the ALIGNMENT enum
premultiply : Utils.PREMULTIPLY.STRAIGHT, // One of the PREMULTIPLY enum
timing: "", // The timing of the drawing in case of single layer file
timingPrefix : "myfile-", // The timing prefix to which the layer name will be appended in case of multi layer file
forceSingleLayer : false, // If true, will for multi-layer bitmap (e.g. PSD) to single layer
vectorizeOptions : [ ] // The options to pass to the Vectorize function.
// Here are the importDrawingInNewElementNode options
// They are all optional. The composite used is determined
// by the selection if a single composite is selected or the
// first composite reached from the scene default display.
// The base element name will be based on the drawing filename
var newElementOptions = {
composite : "Top/Composite",
baseElementName : "MyDrawing"
// Here are the options specific to Utils.IMPORT_TYPE.PLAIN_BITMAP import
var plainOptions = {
pixmapType : "PNG", // The pixmap type of the created element. If omitted the filename extension will be used
fieldChart : 12 // The field size of the newly created element

Member Function Documentation

QVariant VectorizeUtils::importDrawingInElementNode ( const char **  filename,
QVariant  options 

Will import the drawing in filename in existing element node(s) based on the options.

filename: The bitmap file to be imported.
optionsA javascript object containing the list of import options. Mandatory arguments: One of: node : The element node named used in the node interface. This element node must be connected to an element. elementId : The elementId to import files to. Optional arguments:
QVariant VectorizeUtils::importDrawingInNewElementNode ( const char **  filename,
QVariant  options 

Will import the drawing in filename in new element node(s). Many nodes might get created if the input file is a multi-layer file like PSD with proper grouping.

filename: The name of the bitmap file
options: a javascript object containing the list of import options