1
0
Fork 0

Merge pull request #294 from PlayeRom/dev

Remove the hardcoded canvas texture indexes
This commit is contained in:
legoboyvdlp 2023-04-15 11:48:00 +01:00 committed by GitHub
commit 6c8ecaf039
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 2 deletions

View file

@ -179,11 +179,20 @@
<nasal>
<load>
<![CDATA[
var textureIndex = 15;
foreach (var texture; props.globals.getNode("/canvas/by-index").getChildren("texture")) {
var name = texture.getChild("name");
if (name != nil and name.getValue() == "MCDU1") {
textureIndex = texture.getIndex();
break;
}
}
var mcdu_canvas_dlg = canvas.get(cmdarg());
var root = mcdu_canvas_dlg.createGroup();
root.setScale(0.285, 0.25);
mcdu_canvas_dlg.setColorBackground(0, 0, 0, 1.0);
root.createChild("image").set("src", "canvas://by-index/texture[15]");
root.createChild("image").set("src", "canvas://by-index/texture[" ~ textureIndex ~ "]");
]]>
</load>
<unload>

View file

@ -179,11 +179,20 @@
<nasal>
<load>
<![CDATA[
var textureIndex = 16;
foreach (var texture; props.globals.getNode("/canvas/by-index").getChildren("texture")) {
var name = texture.getChild("name");
if (name != nil and name.getValue() == "MCDU2") {
textureIndex = texture.getIndex();
break;
}
}
var mcdu_canvas_dlg = canvas.get(cmdarg());
var root = mcdu_canvas_dlg.createGroup();
root.setScale(0.285, 0.25);
mcdu_canvas_dlg.setColorBackground(0, 0, 0, 1.0);
root.createChild("image").set("src", "canvas://by-index/texture[16]");
root.createChild("image").set("src", "canvas://by-index/texture[" ~ textureIndex ~ "]");
]]>
</load>
<unload>