Support > Scripts > Create a new Scene and its Contents I

ToonzScript Code

//Define the Input and Output folders

dir1 = "C:\\Toonz 7.0 stuff\\SCRIPT IMAGES IN\\"; dir2 = "C:\\Toonz 7.0 stuff\\SCRIPT IMAGES OUT\\"; dir3 = "C:\\Toonz 7.0 stuff\\projects\\Plastic\\scenes\\";

// Define two new levels loading the B.pli and C.pli sequences you want to trasform

b = new Level(dir1+"B.pli");
print ("Loaded b : ",b);

c = new Level(dir1+"C.pli");
print ("Loaded c : ",c);

// Define the transformations you want to apply to the levels

t1 = new Transform().translate(0.1,0.5).rotate(45).scale(0.5);

t2 = new Transform().rotate(180);

// Set a new Scene, create a new level (conv1) and fill it with the trasformed images of the b level

sc = new Scene(dir3+"rifle shot.tnz");

conv1 = sc.newLevel("Vector", "conv1");
fids = b.getFrameIds();
for(i=0; i<b.frameCount;i++)
image = b.getFrameByIndex(i);
imb = new ImageBuilder();
conv1.setFrame(fids[i], imb.add(image, t1).image);

print ("B -> conv1: completed: ", conv1);

// Insert the conv1 level in the column 10 (columns count starts from 0) frame by frame

for(i=0; i<conv1.frameCount;i++)

// Do the same for level conv2

conv2 = sc.newLevel("Vector", "conv2");
for(i=0; i<c.frameCount;i++)
image = c.getFrameByIndex(i);
imb = new ImageBuilder();
conv2.setFrame(fids[i], imb.add(image, t2).image);
print ("C -> conv2: completed: ", conv2);

// Insert the conv2 level in the column 11 (columns count starts from 0) frame by frame

for(i=0; i<conv2.frameCount;i++)

// Save the scene (the levels in the scene will be automatically saved)"rif4.tnz");

print ("conv1, conv2 added to scene1 and saved as scene2");