Changes

Jump to navigation Jump to search
m
simplify code using foreach loop (untested)
Line 64: Line 64:  
# This replaces the texture on the aircraft and attaches the Canvas texture
 
# This replaces the texture on the aircraft and attaches the Canvas texture
 
myCanvas.addPlacement({"node": "Fuselage"});
 
myCanvas.addPlacement({"node": "Fuselage"});
+
 
 +
var layer = [];
 +
var path="Aircraft/EF2000/Models/";
 +
foreach(var image; ['EF2000.png','EF2000-dirt.png']) {
 +
# append each added image to a vector so that we can address them later on
 +
append(layers,
 
# Put a raster image into the canvas
 
# Put a raster image into the canvas
 
root.createChild("image")
 
root.createChild("image")
     .setFile("Aircraft/EF2000/Models/EF2000.png")
+
     .setFile( path~image )
     .setSize(2048,2048);
+
     .setSize(2048,2048)
 
+
);
# And another, if required
+
}
root.createChild("image")
  −
    .setFile("Aircraft/EF2000/Models/EF2000-dirt.png")
  −
    .setSize(2048,2048);
      
# Create a Canvas dialog window to hold the canvas and show that it's working
 
# Create a Canvas dialog window to hold the canvas and show that it's working

Navigation menu