Fix black plane when loaded with non available livery
Signed-off-by: fly <merspieler@airmail.cc>
This commit is contained in:
parent
c887cd4962
commit
bb46115735
4 changed files with 26 additions and 12 deletions
|
@ -30,10 +30,10 @@
|
|||
<load><![CDATA[
|
||||
var livery_update = aircraft.canvas_livery_update.init("Models/Liveries/A320/CFM", _module_id);
|
||||
var elements = ["AileronL","AileronR","Antenna1","Antenna2","ApuFlap","AvionicsVentDoor","Cargo1","Cargo2","Cargo3","DoorL1","DoorL4","DoorR1","DoorR4","ElevatorL","ElevatorR","EngineFairingL","EngineFairingR","FairingL1","FairingL2","FairingL3","FairingR1","FairingR2","FairingR3","FlapL1","FlapL2","FlapR1","FlapR2","Fuselage","GPUServiceDoor","Hstabs","MLGGearDoorL","MLGGearDoorR","MLGWingDoorL1","MLGWingDoorL2","MLGWingDoorR1","MLGWingDoorR2","NLGAftDoorL","NLGAftDoorR","NLGFittingPanel","NLGForewardDoorL","NLGForewardDoorR","OutflowValveDoor1","OutflowValveDoor2","RatDoorL","RatDoorR","Rudder","Sharklet","SlatL1","SlatL2","SlatR1","SlatR2","SpoilerL1","SpoilerL2","SpoilerL3","SpoilerL4","SpoilerL5","SpoilerR1","SpoilerR2","SpoilerR3","SpoilerR4","SpoilerR5","Wings","WingtipFence"];
|
||||
livery_update.createTarget("fuselage", elements, "sim/model/livery/texture-fuselage", resolution=8192);
|
||||
livery_update.createTarget("fuselage", elements, "sim/model/livery/texture-fuselage", "Aircraft/A320-family/Models/Liveries/A320/CFM/4k/SWR-fuselage.png", resolution=8192);
|
||||
|
||||
elements = ["EngineCFM56L","EngineCFM56R","ReverserLDoor1","ReverserLDoor2","ReverserLDoor3","ReverserLDoor4","ReverserRDoor1","ReverserRDoor2","ReverserRDoor3","ReverserRDoor4","PylonCFM56L","PylonCFM56R","IntakeCFM56L","IntakeCFM56R"];
|
||||
livery_update.createTarget("engines", elements, "sim/model/livery/texture-engine");
|
||||
livery_update.createTarget("engines", elements, "sim/model/livery/texture-engine", "Aircraft/A320-family/Models/Liveries/A320/CFM/2k/SWR-engine.png");
|
||||
]]></load>
|
||||
<unload>
|
||||
livery_update.stop();
|
||||
|
|
|
@ -29,10 +29,10 @@
|
|||
<load><![CDATA[
|
||||
var livery_update = aircraft.canvas_livery_update.init("Models/Liveries/A320/IAE", _module_id);
|
||||
var elements = ["AileronL","AileronR","Antenna1","Antenna2","ApuFlap","AvionicsVentDoor","Cargo1","Cargo2","Cargo3","DoorL1","DoorL4","DoorR1","DoorR4","ElevatorL","ElevatorR","EngineFairingL","EngineFairingR","FairingL1","FairingL2","FairingL3","FairingR1","FairingR2","FairingR3","FlapL1","FlapL2","FlapR1","FlapR2","Fuselage","GPUServiceDoor","Hstabs","MLGGearDoorL","MLGGearDoorR","MLGWingDoorL1","MLGWingDoorL2","MLGWingDoorR1","MLGWingDoorR2","NLGAftDoorL","NLGAftDoorR","NLGFittingPanel","NLGForewardDoorL","NLGForewardDoorR","OutflowValveDoor1","OutflowValveDoor2","RatDoorL","RatDoorR","Rudder","Sharklet","SlatL1","SlatL2","SlatR1","SlatR2","SpoilerL1","SpoilerL2","SpoilerL3","SpoilerL4","SpoilerL5","SpoilerR1","SpoilerR2","SpoilerR3","SpoilerR4","SpoilerR5","Wings","WingtipFence"];
|
||||
livery_update.createTarget("fuselage", elements, "sim/model/livery/texture-fuselage", resolution=8192);
|
||||
livery_update.createTarget("fuselage", elements, "sim/model/livery/texture-fuselage", "Aircraft/A320-family/Models/Liveries/A320/IAE/4k/QTR-fuselage.png", resolution=8192);
|
||||
|
||||
elements = ["EngineIAEV2500L","EngineIAEV2500R","ReverserLDoor","ReverserRDoor","PylonIAEV2500L","PylonIAEV2500R","IntakeIAEV2500L","IntakeIAEV2500R"];
|
||||
livery_update.createTarget("engines", elements, "sim/model/livery/texture-engine");
|
||||
livery_update.createTarget("engines", elements, "sim/model/livery/texture-engine", "Aircraft/A320-family/Models/Liveries/A320/IAE/2k/QTR-engine.png");
|
||||
]]></load>
|
||||
<unload>
|
||||
livery_update.stop();
|
||||
|
|
|
@ -38,7 +38,7 @@ var findTexByRes = func(path, file, maxRes) {
|
|||
}
|
||||
res = res / 2;
|
||||
}
|
||||
logprint(LOG_WARN, "No suiting texture found", me.path);
|
||||
print("No suiting texture found");
|
||||
return nil;
|
||||
};
|
||||
|
||||
|
@ -60,12 +60,13 @@ var canvas_livery = {
|
|||
},
|
||||
setResolution: func(resolution) {
|
||||
},
|
||||
createTarget: func(name, objects, property, resolution=4096) {
|
||||
createTarget: func(name, objects, property, defLiv, resolution=4096) {
|
||||
me.targets[name] = {
|
||||
canvas: nil,
|
||||
layers: {},
|
||||
groups: {},
|
||||
listener: nil,
|
||||
defaultLiv: defLiv,
|
||||
resolution: resolution,
|
||||
};
|
||||
maxRes = getprop("/sim/model/livery/max-resolution");
|
||||
|
@ -100,11 +101,16 @@ var canvas_livery = {
|
|||
me.targets[name].canvas.addPlacement({"node": object});
|
||||
}
|
||||
me.targets[name].groups["base"] = me.targets[name].canvas.createGroup("base");
|
||||
var livery = "";
|
||||
resStr = findTexByRes(me.liveriesdir, getprop(property), resolution);
|
||||
if (resStr == nil) {
|
||||
return nil;
|
||||
livery = me.targets[name].defaultLiv;
|
||||
}
|
||||
me.targets[name].layers["base"] = me.targets[name].groups["base"].createChild("image").setFile(me.liveriesdir ~ "/" ~ resStr ~ "/" ~ getprop(property)).setSize(resolution,resolution);
|
||||
else
|
||||
{
|
||||
livery = me.liveriesdir ~ "/" ~ resStr ~ "/" ~ getprop(property)
|
||||
}
|
||||
me.targets[name].layers["base"] = me.targets[name].groups["base"].createChild("image").setFile(livery).setSize(resolution,resolution);
|
||||
me.targets[name].listener = setlistener(property, func(property) {
|
||||
resStr = findTexByRes(me.liveriesdir, property.getValue(), resolution);
|
||||
if (resStr == nil) {
|
||||
|
@ -189,9 +195,14 @@ var canvas_livery_update = {
|
|||
me.targets[name].canvas.addPlacement({"module-id": me.module_id, "type": "scenery-object", "node": object});
|
||||
}
|
||||
me.targets[name].groups["base"] = me.targets[name].canvas.createGroup("base");
|
||||
var livery = "";
|
||||
resStr = findTexByRes(me.liveriesdir, getprop(property), resolution);
|
||||
if (resStr == nil) {
|
||||
return nil;
|
||||
livery = me.targets[name].defaultLiv;
|
||||
}
|
||||
else
|
||||
{
|
||||
livery = me.liveriesdir ~ "/" ~ resStr ~ "/" ~ getprop(property)
|
||||
}
|
||||
me.targets[name].layers["base"] = me.targets[name].groups["base"].createChild("image").setFile(me.liveriesdir ~ "/" ~ resStr ~ "/" ~ getprop(property)).setSize(resolution,resolution);
|
||||
me.targets[name].listener = setlistener("/ai/models/multiplayer[" ~ me.module_id ~ "]/" ~ property, func(property) {
|
||||
|
|
|
@ -37,16 +37,19 @@ var tiresmoke_system = aircraft.tyresmoke_system.new(0, 1, 2);
|
|||
aircraft.rain.init();
|
||||
|
||||
var aero = getprop("/sim/aero");
|
||||
var defaultFuseLiv = "";
|
||||
if (aero == "A320-200-CFM") {
|
||||
var livery = aircraft.canvas_livery.init("Models/Liveries/A320/CFM");
|
||||
elements = ["EngineCFM56L","EngineCFM56R","ReverserLDoor1","ReverserLDoor2","ReverserLDoor3","ReverserLDoor4","ReverserRDoor1","ReverserRDoor2","ReverserRDoor3","ReverserRDoor4","PylonCFM56L","PylonCFM56R","IntakeCFM56L","IntakeCFM56R"];
|
||||
livery.createTarget("engines", elements, "sim/model/livery/texture-engine");
|
||||
livery.createTarget("engines", elements, "sim/model/livery/texture-engine", "Aircraft/A320-family/Models/Liveries/A320/CFM/2k/SWR-engine.png");
|
||||
livery.addLayer("engines", "dirt", "Aircraft/A320-family/Models/Liveries/A320/CFM/engine-dirt.png");
|
||||
defaultFuseLiv = "Aircraft/A320-family/Models/Liveries/A320/CFM/4k/SWR-fuselage.png";
|
||||
} else if (aero == "A320-200-IAE") {
|
||||
var livery = aircraft.canvas_livery.init("Models/Liveries/A320/IAE");
|
||||
elements = ["EngineIAEV2500L","EngineIAEV2500R","ReverserLDoor","ReverserRDoor","PylonIAEV2500L","PylonIAEV2500R","IntakeIAEV2500L","IntakeIAEV2500R"];
|
||||
livery.createTarget("engines", elements, "sim/model/livery/texture-engine");
|
||||
livery.createTarget("engines", elements, "sim/model/livery/texture-engine", "Aircraft/A320-family/Models/Liveries/A320/IAE/2k/QTR-engine.png");
|
||||
livery.addLayer("engines", "dirt", "Aircraft/A320-family/Models/Liveries/A320/IAE/engine-dirt.png");
|
||||
defaultFuseLiv = "Aircraft/A320-family/Models/Liveries/A320/IAE/4k/QTR-fuselage.png";
|
||||
} else if (aero == "A320neo-CFM") {
|
||||
var livery = aircraft.canvas_livery.init("Models/Liveries/A320/CFM-NEO");
|
||||
elements = ["EngineLEAPL", "EngineLEAPL.007", "EngineLEAPL.Inner", "EngineLEAPR", "EngineLEAPR.Inner", "Exhaust2LEAPL", "Exhaust2LEAPR", "Exhaust3LEAPL", "Exhaust3LEAPR", "IntakeLEAPL", "IntakeLEAPR", "PylonLEAPL", "PylonLEAPR", "ReverserLDoorLEAP", "ReverserRDoorLEAP"];
|
||||
|
@ -60,7 +63,7 @@ if (aero == "A320-200-CFM") {
|
|||
}
|
||||
|
||||
var elements = ["AileronL","AileronR","Antenna1","Antenna2","ApuFlap","AvionicsVentDoor","Cargo1","Cargo2","Cargo3","DoorL1","DoorL4","DoorR1","DoorR4","ElevatorL","ElevatorR","EngineFairingL","EngineFairingR","FairingL1","FairingL2","FairingL3","FairingR1","FairingR2","FairingR3","FlapL1","FlapL2","FlapR1","FlapR2","Fuselage","GPUServiceDoor","Hstabs","MLGGearDoorL","MLGGearDoorR","MLGWingDoorL1","MLGWingDoorL2","MLGWingDoorR1","MLGWingDoorR2","NLGAftDoorL","NLGAftDoorR","NLGFittingPanel","NLGForewardDoorL","NLGForewardDoorR","OutflowValveDoor1","OutflowValveDoor2","RatDoorL","RatDoorR","Rudder","Sharklet","SlatL1","SlatL2","SlatR1","SlatR2","SpoilerL1","SpoilerL2","SpoilerL3","SpoilerL4","SpoilerL5","SpoilerR1","SpoilerR2","SpoilerR3","SpoilerR4","SpoilerR5","Wings","WingtipFence"];
|
||||
livery.createTarget("fuselage", elements, "sim/model/livery/texture-fuselage", resolution=16384);
|
||||
livery.createTarget("fuselage", elements, "sim/model/livery/texture-fuselage", defaultFuseLiv, resolution=16384);
|
||||
livery.addLayer("fuselage", "dirt", "Aircraft/A320-family/Models/Liveries/A320/fuselage-dirt.png");
|
||||
|
||||
#########
|
||||
|
|
Loading…
Reference in a new issue