X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=blender%2Fio_mspgl%2Futil.py;fp=blender%2Fio_mspgl%2Futil.py;h=8ca41bd8e845657edf33463dd643e259c80afc3d;hb=308dc6b8f5ee1aa3bb8f205e2ed6464749eebbe5;hp=4141e9f77600891eb7ef405ecf2cc6bb3d642944;hpb=cc270481e3e2f74d060ce2c63551970c835b06b8;p=libs%2Fgl.git diff --git a/blender/io_mspgl/util.py b/blender/io_mspgl/util.py index 4141e9f7..8ca41bd8 100644 --- a/blender/io_mspgl/util.py +++ b/blender/io_mspgl/util.py @@ -1,57 +1,5 @@ import os -class Progress: - def __init__(self, context): - self.task = "" - self.start = 0.0 - self.delta = 1.0 - self.last = 0.0 - self.stack = [] - if context: - self.window_manager = context.window_manager - self.window_manager.progress_begin(0.0, 1.0) - else: - self.window_manager = None - - def push_task(self, task, low, high): - self.stack.append((self.task, self.start, self.delta)) - self.set_task(task, low, high) - - def push_task_slice(self, task, index, count): - self.push_task(task, index/count, (index+1)/count) - - def pop_task(self): - if not self.stack: - return - - self.set_progress(1.0) - self.task, self.start, self.delta = self.stack.pop() - - def set_task(self, task, low, high): - if self.stack: - outer = self.stack[-1] - if outer[0]: - task = "{}: {}".format(outer[0], task) - low = outer[1]+low*outer[2] - high = outer[1]+high*outer[2] - - self.task = task - self.start = low - self.delta = high-low - - self.set_progress(0.0) - - def set_task_slice(self, task, index, count): - self.set_task(task, index/count, (index+1)/count) - - def set_progress(self, value): - value = self.start+self.delta*value - if value>self.last+0.001: - 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