From f0124e6e2ad084acf6c2c405920f1bb4aee81f84 Mon Sep 17 00:00:00 2001 From: fly Date: Mon, 30 Nov 2020 09:39:42 +1100 Subject: [PATCH] Works Signed-off-by: fly --- Materials/regions/materials.xml | 12 +++++++++--- Nasal/aircraft.nas | 24 ++++++++++++++---------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/Materials/regions/materials.xml b/Materials/regions/materials.xml index 6d6d30d69..f6c9c1290 100644 --- a/Materials/regions/materials.xml +++ b/Materials/regions/materials.xml @@ -43,10 +43,16 @@ - - - + + + + + + + + + diff --git a/Nasal/aircraft.nas b/Nasal/aircraft.nas index b53623269..b0709eb09 100644 --- a/Nasal/aircraft.nas +++ b/Nasal/aircraft.nas @@ -623,18 +623,15 @@ var findTexByRes = func(path, file, maxRes) { # Class for Canvas based liveries # var canvas_livery = { - new: func(liveriesdir, interval = 10.01, callback = nili, resolution=4096) { - var m = { parents: [canvas_livery, overlay_update.new()] }; - m.parents[1].add(getprop("/sim/aircraft-dir") ~ "/" ~ liveriesdir, "sim/model/livery/file", callback); - m.parents[1].interval = interval; - m.liveriesdir = liveriesdir; + init: func(dir, nameprop = "sim/model/livery/name", sortprop = nil, resolution=4096) { + var m = { parents: [canvas_livery, gui.OverlaySelector.new("Select Livery", dir, nameprop, + sortprop, "sim/model/livery/file")] }; + m.dialog = m.parents[1]; + m.liveriesdir = dir; m.resolution = resolution; m.targets = {}; return m; }, - stop: func { - me.parents[1].stop(); - }, setResolution: func(resolution) { }, createTarget: func(name, objects, property, resolution=4096) { @@ -646,15 +643,22 @@ var canvas_livery = { resolution: resolution, }; maxRes = getprop("/sim/model/livery/max-resolution"); - # Make sure we never load too large textures if (resolution > maxRes) { resolution = maxRes; + me.targets[name].resolution = maxRes; + } + # Make sure we never load too large textures + maxSupportedRes = getprop("/sim/rendering/max-texture-size"); + if (resolution > maxSupportedRes) { + resolution = maxSupportedRes; + me.targets[name].resolution = maxSupportedRes; } me.targets[name].canvas = canvas.new({ "name": name, "size": [resolution, resolution], "view": [resolution, resolution], - "mipmapping": 1 + "mipmapping": 1, + # "anisotropy": 1.0 }); foreach (var object; objects) { me.targets[name].canvas.addPlacement({"node": object});