Support > Scripts > Create Scene

ToonzScript Code

// Define the Input and Output folders

dir = "C:\\Toonz 7.0 stuff\\SCRIPT IMAGES IN\\";
dir2 = "C:\\Toonz 7.0 stuff\\SCRIPT IMAGES OUT\\";

// Create a new scene that contains two vector levels: B and C
scene = new Scene();
level = scene.newLevel("Vector", "lev1");
level2 = scene.newLevel("Vector", "lev2");

// Create two new levels (level_b and level_c) where the files lev1.pli and lev2.pli are uploaded

level_b = new Level(dir+"lev1.pli");
level_c = new Level(dir+"lev2.pli");

// Create a for cycle that runs for the level_b frames-lenght, and stores each frames of the level_b into a row of a selected column of the xsheet (step 1 animation)

for(i=0; i<level_b.frameCount; i++)
{
level.setFrame(i+1,level_b.getFrameByIndex(i));
scene.setCell(i,0,level,i+1);
}

// Create a for cycle that runs for the level_c frames-lenght, and stores each frames of the level_b into 2 consecutive rows of a selected column of the xsheet (step 2 animation)

for(i=0; i<level_c.frameCount;i++)
{
level2.setFrame(i+1,level_c.getFrameByIndex(i));
scene.setCell(i*2,1,level2,i+1),scene.setCell(i*2+1,1,level2,i+1);
}

// Save the scene

scene.save("C:/Toonz 7.0 stuff/sandbox/scenes/scenename.tnz");