Changes
Jump to navigation
Jump to search
← Older edit
Newer edit →
Howto:Dynamic Liveries via Canvas
(view source)
Revision as of 22:43, 17 September 2014
41 bytes added
,
22:43, 17 September 2014
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
Hooray
Administrators
19,527
edits
Navigation menu
Personal tools
Create account
Log in
Namespaces
Howto
Discussion
Variants
Views
Read
View source
View history
More
Search
Navigation
Main page
Recent changes
Random page
Village pump
Help
Portals
User
Developer
Wiki
FlightGear
Website
Forum
Mailing lists
Bug tracker
Source
Scenery
Liveries
Build server
Tools
Upload file
Special pages
Printable version