Remove the hardcoded canvas texture indexes
Add index search by texture name instead.
This commit is contained in:
parent
f67812fd96
commit
3f4b996f07
2 changed files with 20 additions and 2 deletions
|
@ -179,11 +179,20 @@
|
||||||
<nasal>
|
<nasal>
|
||||||
<load>
|
<load>
|
||||||
<![CDATA[
|
<![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 mcdu_canvas_dlg = canvas.get(cmdarg());
|
||||||
var root = mcdu_canvas_dlg.createGroup();
|
var root = mcdu_canvas_dlg.createGroup();
|
||||||
root.setScale(0.285, 0.25);
|
root.setScale(0.285, 0.25);
|
||||||
mcdu_canvas_dlg.setColorBackground(0, 0, 0, 1.0);
|
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>
|
</load>
|
||||||
<unload>
|
<unload>
|
||||||
|
|
|
@ -179,11 +179,20 @@
|
||||||
<nasal>
|
<nasal>
|
||||||
<load>
|
<load>
|
||||||
<![CDATA[
|
<![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 mcdu_canvas_dlg = canvas.get(cmdarg());
|
||||||
var root = mcdu_canvas_dlg.createGroup();
|
var root = mcdu_canvas_dlg.createGroup();
|
||||||
root.setScale(0.285, 0.25);
|
root.setScale(0.285, 0.25);
|
||||||
mcdu_canvas_dlg.setColorBackground(0, 0, 0, 1.0);
|
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>
|
</load>
|
||||||
<unload>
|
<unload>
|
||||||
|
|
Loading…
Reference in a new issue