def draw_callback_water_drops(self, context):
     
     mx = self.ob.matrix_world
     
     draw_3d_points(context, [self.com], (1,.1,1,.5), 6)
     if not self.consensus_generated:
         for droplet in self.drops:
             vs = [mx * self.bme.verts[i].co for i in droplet.ind_path]
         
             #draw_3d_points(context, vs, (.2,.3,.8,1), 2)
             draw_3d_points(context, [vs[-1]], (1,.3,.3,1), 3)
             #draw_3d_points(context, [vs[0]], (.3,1,.3,1), 4)
     
     if self.consensus_generated:
         
         vs = [mx * self.bme.verts[i].co for i in self.consensus_list]
         draw_3d_points(context, vs, (.2,.8,.8,1), 5)
         
     if self.sorted_by_value:
         vs = [mx * self.bme.verts[i].co for i in self.best_verts]
         draw_3d_points(context, vs, (.8,.8,.2,1), 3)
     
     
     if len(self.clipped_verts):
         vs = [mx * v for v in self.clipped_verts]
         draw_3d_points(context, vs, (1,.3,1,1), 4)
         
         
     if len(self.bez_curve):
         vs = [mx * v for v in self.bez_curve]
         draw_polyline_from_3dpoints(context, vs, (.2,1,.2,1), 3)
         draw_3d_points(context, vs, (.2,1,.2,1), 5)
Пример #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)
Пример #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)
Пример #4
0
def articulator_draw(dummy, context):
    if 'Articulator' not in context.scene.objects: return
    Art = context.scene.objects['Articulator']
    if Art.hide == True: return

    global articulator_draw_data

    region = context.region
    rv3d = context.space_data.region_3d

    lcp_loc = articulator_draw_data['LCP']
    rcp_loc = articulator_draw_data['RCP']
    inc_loc = articulator_draw_data['INC']
    r_arm_mid = articulator_draw_data['r_arm_mid']
    l_arm_mid = articulator_draw_data['l_arm_mid']
    balkwill_angle = articulator_draw_data['balkwill_angle']
    R_len = articulator_draw_data['R_len']
    L_len = articulator_draw_data['L_len']

    common_drawing.draw_polyline_from_3dpoints(context, [lcp_loc, inc_loc],
                                               (.1, .8, .1, .5), 2,
                                               'GL_LINE_STRIP')
    common_drawing.draw_polyline_from_3dpoints(context, [rcp_loc, inc_loc],
                                               (.1, .8, .1, .5), 2,
                                               'GL_LINE_STRIP')

    bgl.glColor4f(.8, .8, .8, 1)
    blf.size(0, 24, 72)
    vector2d = view3d_utils.location_3d_to_region_2d(region, rv3d, r_arm_mid)
    blf.position(0, vector2d[0], vector2d[1], 0)
    blf.draw(0, str(R_len)[0:4])

    vector2d = view3d_utils.location_3d_to_region_2d(region, rv3d, l_arm_mid)
    blf.position(0, vector2d[0], vector2d[1], 0)
    blf.draw(0, str(L_len)[0:4])

    inc_vector = inc_loc.normalized()
    angle_vec = inc_vector.lerp(Vector((1, 0, 0)), .5)
    angle_position = 15 * angle_vec

    msg = str(balkwill_angle)[0:4] + ' deg'
    dimension = blf.dimensions(0, msg)

    vector2d = view3d_utils.location_3d_to_region_2d(region, rv3d,
                                                     angle_position)
    blf.position(0, vector2d[0], vector2d[1] - .5 * dimension[1], 0)
    blf.draw(0, msg)
Пример #5
0
 def draw(self,context):
     #draw a box
     #draw a box outline
     #draw a 2D represntation of the cross section
     if self.slice_points_x != []:
         common_drawing.draw_polyline_from_3dpoints(context, self.slice_points_x, (.1,.8,.4,.8), 2, 'GL_LINE')
     if self.slice_points_y != []:
         common_drawing.draw_polyline_from_3dpoints(context, self.slice_points_y, (.1,.8,.4,.8), 2, 'GL_LINE')
         
     if self.reference_L != []:
         common_drawing.draw_polyline_from_3dpoints(context, self.reference_L[0:3], (.1,.2,.8,.8), 2, 'GL_LINE')
         common_drawing.draw_polyline_from_3dpoints(context, self.reference_L[3:5], (.1,.2,.8,.8), 2, 'GL_LINE')
Пример #6
0
 def draw(self,context):
     #draw a box
     #draw a box outline
     #draw a 2D represntation of the cross section
     if self.slice_points_x != []:
         common_drawing.draw_polyline_from_3dpoints(context, self.slice_points_x, (.1,.8,.4,.8), 2, 'GL_LINE')
     if self.slice_points_y != []:
         common_drawing.draw_polyline_from_3dpoints(context, self.slice_points_y, (.1,.8,.4,.8), 2, 'GL_LINE')
         
     if self.reference_L != []:
         common_drawing.draw_polyline_from_3dpoints(context, self.reference_L[0:3], (.1,.2,.8,.8), 2, 'GL_LINE')
         common_drawing.draw_polyline_from_3dpoints(context, self.reference_L[3:5], (.1,.2,.8,.8), 2, 'GL_LINE')
Пример #7
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')
Пример #8
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')