def pull_from_prop(self): self.pctg = getattr(self.data, self.prop) / self.soft_max boxes = pmu.make_round_slider(-self.width / 2, -self.height / 2, self.width / 2, self.height / 2, self.pctg, self.corner_radius) self.left_box = boxes[0] self.right_box = boxes[1]
def __init__(self, id, data, property, width, height, x, y, rot = 0, scale = 1, rad = 5): self.type = "SLIDER" self.id = id self.data = data self.prop = property self.width = width self.height = height self.x = x self.y = y self.rot = rot self.scale = scale self.corner_radius = rad self.soft_min = data.bl_rna.properties[self.prop].soft_min self.soft_max = data.bl_rna.properties[self.prop].soft_max self.pctg = getattr(data, property, 0)/self.soft_max self.precision_pctg = self.pctg boxes = pmu.make_round_slider(-width/2, -height/2, width/2, height/2, self.pctg, self.corner_radius) self.left_box = boxes[0] self.right_box = boxes[1] self.cheap_box = pmu.make_quad(self.width, self.height, 0,0,0) #dont rotate this because mouse test happens locally..the whole slider is rotated already. #this will be update based on x,y, ang and scale only when self.update_local_to_screen #use these for drawing, but use self.calc to mouse test. That way only the mouse coord #gets transformed for the test and you only have to recalc everything to draw when #position/loc/scale or menu changes. self.screen_left = [] self.screen_right = []