X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=blender%2Fio_mspgl%2Futil.py;h=70b005f6df60e84db38ea8c35c03fc0bbcc79123;hb=bde3ec824d300e9aff11914406fb76dd9016e387;hp=3b5e8cd56f3349d6ab1f094b8a25cde41015f558;hpb=dc2e08621ad586663e4c11475f03886a91463907;p=libs%2Fgl.git diff --git a/blender/io_mspgl/util.py b/blender/io_mspgl/util.py index 3b5e8cd5..70b005f6 100644 --- a/blender/io_mspgl/util.py +++ b/blender/io_mspgl/util.py @@ -1,3 +1,5 @@ +import os + class Progress: def __init__(self, context): self.task = "" @@ -48,3 +50,23 @@ class Progress: if self.window_manager: self.window_manager.progress_update(value) self.last = value + + +def linear_to_srgb(l): + if l<0.0031308: + return 12.92*l + else: + return 1.055*(l**(1/2.4))-0.055 + +def get_colormap(srgb): + if srgb: + return linear_to_srgb + else: + return lambda x: x + +def image_name(img): + fp = img.filepath + if fp: + return os.path.split(fp)[1] + else: + return img.name