- Code: Select all
var id_prec = 0;
ca = canvas.new({"name": "Arm_fuselage",
"size": [4096,4096],
"view": [4096,4096],
"mipmapping": 1});
ca.addPlacement({"node": "A__G91_fuselage_canopy"});
ca.addPlacement({"node": "A__G91_fuselage_int.weapon.door.004"});
ca.addPlacement({"node": "F_canopY_ant"});
ca.addPlacement({"node": "F_CANPOPY.005"});
ca_root = ca.createGroup();
ca_child = ca_root.createChild("image").setSize(4096,4096);
setlistener("sim/G91/liveries/active/ID", func {
var id = props.globals.getNode("sim/G91/liveries/active/ID",1).getValue();
var livery_001 = props.globals.getNode("sim/G91/liveries/active/livery_001",1).getValue();
print(livery_001);
ca_child.setFile(livery_001);
id_prec = id;
}, 1, 0);
The listener listens to the modifying of the livery at the end of the configuration of the poerty-tree always configured by the dialog that activates the livery:
This is the dialog example code:
- Code: Select all
...
<binding>
<command>nasal</command>
<script>
setprop("sim/G91/liveries/active/livery_001","Aircraft/G91-R1B_HD/Models/Liveries/pan_1_001.png");
setprop("sim/G91/liveries/active/livery_002","Aircraft/G91-R1B_HD/Models/Liveries/pan_1_002.png");
setprop("sim/G91/liveries/active/luminosity",0.0);
setprop("sim/G91/liveries/active/reflective",0.0);
setprop("sim/G91/liveries/active/ID",1);
</script>
</binding>
...
In these three examples of livery we note that these do not change (but the effect configurations change proving that the selection procedure works correctly) and the names and paths of the images I send to the NASAL application are correct as they are printed before the actual assignment to the canvas of the image and match perfectly those I want to load ... Only one of the NASAL procedures (they are all identical) works well and is the one that modifies the livery of the horizontal tail planes, as you can see.
This should be the livery of the Italian military acrobatic team, it should be all blue, but as you can see it is the military livery that is loaded by default, but the horizontal tail plane is correct!
This is the military livery and it is correct, is also the first livery loaded (if load as before livery some other livery this will be displayed correctly, but only in the case that it is the default)
With this livery the plane should be all silver ...
It should be noted that the first loading also takes place by means of the same procedure and is CORRECT for all the objects present in the scene. At this point I suspect that I do something wrong with NASAL ... but it is also true that what I do, for the horizontal queues works! AND IT IS EXACTLY THE SAME CODE!
Can someone help me to unveil the mystery?
Thanks for all.