Example #1
0
    def draw(self, context):
        if len(self.b_pts) == 0: return
        bgl_utils.draw_3d_points(context, self.b_pts, 3)
        bgl_utils.draw_3d_points(context, [self.b_pts[0]],
                                 8,
                                 color=(1, 1, 0, 1))

        if self.selected != -1:
            bgl_utils.draw_3d_points(context, [self.b_pts[self.selected]],
                                     8,
                                     color=(0, 1, 1, 1))

        if self.hovered[0] == 'POINT':
            bgl_utils.draw_3d_points(context, [self.b_pts[self.hovered[1]]],
                                     8,
                                     color=(0, 1, 0, 1))

        elif self.hovered[0] == 'EDGE':
            loc3d_reg2D = view3d_utils.location_3d_to_region_2d
            a = loc3d_reg2D(context.region, context.space_data.region_3d,
                            self.b_pts[self.hovered[1]])
            next = (self.hovered[1] + 1) % len(self.b_pts)
            b = loc3d_reg2D(context.region, context.space_data.region_3d,
                            self.b_pts[next])
            common_drawing.draw_polyline_from_points(context,
                                                     [a, self.mouse, b],
                                                     (0, .2, .2, .5), 2,
                                                     "GL_LINE_STRIP")
Example #2
0
 def draw(self,context):
     if len(self.b_pts) == 0: return
     bgl_utils.draw_3d_points(context,self.b_pts, 3)
     bgl_utils.draw_3d_points(context,[self.b_pts[0]], 8, color = (1,1,0,1))
     
     if self.selected != -1:
         bgl_utils.draw_3d_points(context,[self.b_pts[self.selected]], 8, color = (0,1,1,1))
             
     if self.hovered[0] == 'POINT':
         bgl_utils.draw_3d_points(context,[self.b_pts[self.hovered[1]]], 8, color = (0,1,0,1))
  
     elif self.hovered[0] == 'EDGE':
         loc3d_reg2D = view3d_utils.location_3d_to_region_2d
         a = loc3d_reg2D(context.region, context.space_data.region_3d, self.b_pts[self.hovered[1]])
         next = (self.hovered[1] + 1) % len(self.b_pts)
         b = loc3d_reg2D(context.region, context.space_data.region_3d, self.b_pts[next])
         common_drawing.draw_polyline_from_points(context, [a,self.mouse, b], (0,.2,.2,.5), 2,"GL_LINE_STRIP")    
Example #3
0
 def draw(self,context):
     region = context.region  
     rv3d = context.space_data.region_3d  
   
     if len(self.b_pts) == 0: return
     bgl_utils.draw_3d_points(context,self.b_pts, 3)
     
     if self.selected != -1:
         bgl_utils.draw_3d_points(context,[self.b_pts[self.selected]], 8, color = (0,1,1,1))
             
     if self.hovered[0] == 'POINT':
         bgl_utils.draw_3d_points(context,[self.b_pts[self.hovered[1]]], 8, color = (0,1,0,1))
  
     blf.size(0, 20, 72) #fond_id = 0 
     for txt, vect in zip(self.labels, self.b_pts):
         if txt:
             vector2d = view3d_utils.location_3d_to_region_2d(region, rv3d, vect)
             blf.position(0, vector2d[0], vector2d[1], 0)
             blf.draw(0, txt) #font_id = 0
             
     return
Example #4
0
    def draw(self, context):
        if len(self.pts) == 0: return

        if self.cyclic and len(self.pts):
            common_drawing.draw_polyline_from_3dpoints(
                context, self.pts + [self.pts[0]], (.1, .2, 1, .8), 2,
                'GL_LINE_STRIP')

        else:
            common_drawing.draw_polyline_from_3dpoints(context, self.pts,
                                                       (.1, .2, 1, .8), 2,
                                                       'GL_LINE')

        if self.ui_type != 'DENSE_POLY':
            bgl_utils.draw_3d_points(context, self.pts, 3)
            bgl_utils.draw_3d_points(context, [self.pts[0]],
                                     8,
                                     color=(1, 1, 0, 1))

        else:
            common_drawing.draw_3d_points(context, self.pts, (1, 1, 1, 1), 4)
            bgl_utils.draw_3d_points(context, [self.pts[0]],
                                     4,
                                     color=(1, 1, 0, 1))

        if self.selected != -1 and len(self.pts) >= self.selected + 1:
            bgl_utils.draw_3d_points(context, [self.pts[self.selected]],
                                     8,
                                     color=(0, 1, 1, 1))

        if self.hovered[0] == 'POINT':
            bgl_utils.draw_3d_points(context, [self.pts[self.hovered[1]]],
                                     8,
                                     color=(0, 1, 0, 1))

        elif self.hovered[0] == 'EDGE':
            loc3d_reg2D = view3d_utils.location_3d_to_region_2d
            a = loc3d_reg2D(context.region, context.space_data.region_3d,
                            self.pts[self.hovered[1]])
            next = (self.hovered[1] + 1) % len(self.pts)
            b = loc3d_reg2D(context.region, context.space_data.region_3d,
                            self.pts[next])
            common_drawing.draw_polyline_from_points(context,
                                                     [a, self.mouse, b],
                                                     (0, .2, .2, .5), 2,
                                                     "GL_LINE_STRIP")

        if self.face_seed:
            #TODO direct bmesh face drawing util
            vs = self.bme.faces[self.face_seed].verts
            bgl_utils.draw_3d_points(
                context, [self.cut_ob.matrix_world * v.co for v in vs],
                4,
                color=(1, 1, .1, 1))

        if len(self.new_cos):
            bgl_utils.draw_3d_points(
                context, [self.cut_ob.matrix_world * v for v in self.new_cos],
                6,
                color=(.2, .5, .2, 1))
        if len(self.bad_segments):
            for ind in self.bad_segments:
                m = self.face_changes.index(ind)
                m_p1 = (m + 1) % len(self.face_changes)
                ind_p1 = self.face_changes[m_p1]
                common_drawing.draw_polyline_from_3dpoints(
                    context, [self.cut_pts[ind], self.cut_pts[ind_p1]],
                    (1, .1, .1, 1), 4, 'GL_LINE')
Example #5
0
    def draw(self,context):
        if len(self.pts) == 0: return
        
        if self.cyclic and len(self.pts):
            common_drawing.draw_polyline_from_3dpoints(context, self.pts + [self.pts[0]], (.1,.2,1,.8), 2, 'GL_LINE_STRIP')
        
        else:
            common_drawing.draw_polyline_from_3dpoints(context, self.pts, (.1,.2,1,.8), 2, 'GL_LINE')
        
        if self.ui_type != 'DENSE_POLY':    
            bgl_utils.draw_3d_points(context,self.pts, 3)
            bgl_utils.draw_3d_points(context,[self.pts[0]], 8, color = (1,1,0,1))
            
        else:
            common_drawing.draw_3d_points(context,self.pts,(1,1,1,1),4) 
            bgl_utils.draw_3d_points(context,[self.pts[0]], 4, color = (1,1,0,1))
        
        
        if self.selected != -1 and len(self.pts) >= self.selected + 1:
            bgl_utils.draw_3d_points(context,[self.pts[self.selected]], 8, color = (0,1,1,1))
                
        if self.hovered[0] == 'POINT':
            bgl_utils.draw_3d_points(context,[self.pts[self.hovered[1]]], 8, color = (0,1,0,1))
     
        elif self.hovered[0] == 'EDGE':
            loc3d_reg2D = view3d_utils.location_3d_to_region_2d
            a = loc3d_reg2D(context.region, context.space_data.region_3d, self.pts[self.hovered[1]])
            next = (self.hovered[1] + 1) % len(self.pts)
            b = loc3d_reg2D(context.region, context.space_data.region_3d, self.pts[next])
            common_drawing.draw_polyline_from_points(context, [a,self.mouse, b], (0,.2,.2,.5), 2,"GL_LINE_STRIP")  

        if self.face_seed:
            #TODO direct bmesh face drawing util
            vs = self.bme.faces[self.face_seed].verts
            bgl_utils.draw_3d_points(context,[self.cut_ob.matrix_world * v.co for v in vs], 4, color = (1,1,.1,1))
            
            
        if len(self.new_cos):
            bgl_utils.draw_3d_points(context,[self.cut_ob.matrix_world * v for v in self.new_cos], 6, color = (.2,.5,.2,1))
        if len(self.bad_segments):
            for ind in self.bad_segments:
                m = self.face_changes.index(ind)
                m_p1 = (m + 1) % len(self.face_changes)
                ind_p1 = self.face_changes[m_p1]
                common_drawing.draw_polyline_from_3dpoints(context, [self.cut_pts[ind], self.cut_pts[ind_p1]], (1,.1,.1,1), 4, 'GL_LINE')