Exemplo n.º 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")
Exemplo n.º 2
0
 def draw(self,context):
     #draw a box
     #draw a box outline
     #draw a 2D represntation of the cross section
     if self.slice_points != []:
         common_drawing.draw_polyline_from_3dpoints(context, self.slice_points, (.1,.8,.4,.8), 2, 'GL_LINE')
         common_drawing.draw_polyline_from_points(context, self.points_2d, (1,1,1,1), 2, 'GL_LINE')
         common_drawing.draw_points(context, [self.active_pt2d], (1,.1,.1,1), 5)
Exemplo n.º 3
0
 def draw(self, context):
     #draw a box
     #draw a box outline
     #draw a 2D represntation of the cross section
     if self.slice_points != []:
         common_drawing.draw_polyline_from_3dpoints(context,
                                                    self.slice_points,
                                                    (.1, .8, .4, .8), 2,
                                                    'GL_LINE')
         common_drawing.draw_polyline_from_points(context, self.points_2d,
                                                  (1, 1, 1, 1), 2,
                                                  'GL_LINE')
         common_drawing.draw_points(context, [self.active_pt2d],
                                    (1, .1, .1, 1), 5)
Exemplo n.º 4
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")    
Exemplo n.º 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')
Exemplo n.º 6
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')
Exemplo n.º 7
0
def plyknife_draw_callback(self, context):
    self.knife.draw(context)
    self.help_box.draw()
    if len(self.sketch):
        common_drawing.draw_polyline_from_points(context, self.sketch, (.3,.3,.3,.8), 2, "GL_LINE_SMOOTH")