コード例 #1
0
ファイル: pie_menu.py プロジェクト: Gi3d/myblendercontrib
 def calc_boxes(self):
     
     x = .5 * self.biggest_dim_x
     y = .5 * self.biggest_dim_y
     radio_x = self.dimension_radio
     
     op_box = pmu.make_round_box(-(x + 20), -(y + 5), x + 20, y + 5, self.corner_radius)
     radio_box = pmu.make_round_box(-(radio_x + 20), -(y + 5), radio_x + 5, y + 5, self.corner_radius)
     ic_quad = pmu.make_quad(16, 16, -(x+20)+11, 0, 0)
     ic_quad_radio = pmu.make_quad(16, 16, -(radio_x+20)+11, 0, 0)
     
     for it in self.menu_items:
         
         if not it.poly_bound:
             if it.type == "OP":
                 it.poly_bound = op_box
             elif it.type == "RADIO":
                 it.poly_bound = radio_box
                 it.cheap_box = pmu.make_quad(radio_x + 40, y + 10, 0, 0, 0)
                 
         if it.icon:
             if not it.icon_quad:
                 if it.type == "OP":
                     it.icon_quad = ic_quad
                 elif it.type == "RADIO":
                     it.icon_quad = ic_quad_radio
コード例 #2
0
ファイル: pie_menu.py プロジェクト: brendanaaa/Learnbgame
    def calc_boxes(self):

        x = .5 * self.biggest_dim_x
        y = .5 * self.biggest_dim_y
        radio_x = self.dimension_radio

        op_box = pmu.make_round_box(-(x + 20), -(y + 5), x + 20, y + 5,
                                    self.corner_radius)
        radio_box = pmu.make_round_box(-(radio_x + 20), -(y + 5), radio_x + 5,
                                       y + 5, self.corner_radius)
        ic_quad = pmu.make_quad(16, 16, -(x + 20) + 11, 0, 0)
        ic_quad_radio = pmu.make_quad(16, 16, -(radio_x + 20) + 11, 0, 0)

        for it in self.menu_items:

            if not it.poly_bound:
                if it.type == "OP":
                    it.poly_bound = op_box
                elif it.type == "RADIO":
                    it.poly_bound = radio_box
                    it.cheap_box = pmu.make_quad(radio_x + 40, y + 10, 0, 0, 0)

            if it.icon:
                if not it.icon_quad:
                    if it.type == "OP":
                        it.icon_quad = ic_quad
                    elif it.type == "RADIO":
                        it.icon_quad = ic_quad_radio
コード例 #3
0
ファイル: pie_menu.py プロジェクト: Mitsu1/creaturas-magicas
    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 = []