from Blender import Draw, Image, Window from math import log from XPlaneUtils import PanelRegionHandler image = Image.GetCurrent() # may be None h = PanelRegionHandler() opts = [] if not image: pass elif h.isRegion(image): opts.append('Delete this region%x1') opts.append('Reload all regions%x3') elif h.isPanel(image): if h.countRegions() < PanelRegionHandler.REGIONCOUNT: opts.append('Create new region...%x2') else: opts.append( 'Can\'t create new region - already using maximum of %d regions%%x0' % PanelRegionHandler.REGIONCOUNT) opts.append('Reload all regions%x3') elif image and 'panel.' in image.name.lower( ) and '.region' not in image.name.lower(): opts.append('Create new region...%x2') if not opts: r = Draw.PupMenu('This is not a Panel Texture or Region%t') else: r = Draw.PupMenu('X-Plane panel regions%t|' + ('|'.join(opts)))
from Blender import Draw, Image, Window from math import log from XPlaneUtils import PanelRegionHandler image=Image.GetCurrent() # may be None h=PanelRegionHandler() opts=[] if not image: pass elif h.isRegion(image): opts.append('Delete this region%x1') opts.append('Reload all regions%x3') elif h.isPanel(image): if h.countRegions()<PanelRegionHandler.REGIONCOUNT: opts.append('Create new region...%x2') else: opts.append('Can\'t create new region - already using maximum of %d regions%%x0' % PanelRegionHandler.REGIONCOUNT) opts.append('Reload all regions%x3') elif image and 'panel.' in image.name.lower() and '.region' not in image.name.lower(): opts.append('Create new region...%x2') if not opts: r=Draw.PupMenu('This is not a Panel Texture or Region%t') else: r=Draw.PupMenu('X-Plane panel regions%t|'+('|'.join(opts))) if r==1: h.delRegion(image) h.panelimage().makeCurrent()