Line 30: |
Line 30: |
| | | |
| <syntaxhighlight lang="nasal"> | | <syntaxhighlight lang="nasal"> |
− | # Create a Canvas | + | # Create a standalone Canvas (not attached to any GUI dialog/aircraft etc) |
| var myCanvas = canvas.new({ | | var myCanvas = canvas.new({ |
| "name": "Livery Test", # The name is optional but allow for easier identification | | "name": "Livery Test", # The name is optional but allow for easier identification |
Line 39: |
Line 39: |
| }); | | }); |
| | | |
| + | # create our top-level/root group that contains all other Canvas elements |
| var root = myCanvas.createGroup(); | | var root = myCanvas.createGroup(); |
| | | |
| # Add a placement by replacing the textured face "Fuselage" in the 3D model | | # Add a placement by replacing the textured face "Fuselage" in the 3D model |
| + | # This replaces the texture on the aircraft and attaches the Canvas texture |
| myCanvas.addPlacement({"node": "Fuselage"}); | | myCanvas.addPlacement({"node": "Fuselage"}); |
| | | |
Line 50: |
Line 52: |
| | | |
| # 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 |
| + | # the Canvas is now standalone, i.e. continues to live once the dialog is closed! |
| var window = canvas.Window.new([512,512],"dialog"); | | var window = canvas.Window.new([512,512],"dialog"); |
| window.setCanvas(myCanvas); | | window.setCanvas(myCanvas); |
− |
| |
| </syntaxhighlight> | | </syntaxhighlight> |
| | | |