当前位置: 首页>>代码示例>>Python>>正文


Python bgl.glLineWidth方法代码示例

本文整理汇总了Python中bgl.glLineWidth方法的典型用法代码示例。如果您正苦于以下问题:Python bgl.glLineWidth方法的具体用法?Python bgl.glLineWidth怎么用?Python bgl.glLineWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bgl的用法示例。


在下文中一共展示了bgl.glLineWidth方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: draw_line

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glLineWidth [as 别名]
def draw_line(p1, p2, color, shadow=False, shadow_color=None):
    bgl.glEnable(bgl.GL_BLEND)
    bgl.glEnable(bgl.GL_LINE_SMOOTH)

    # Draw shadow.
    if shadow:
        bgl.glLineWidth(3.0)
        bgl.glColor4f(*shadow_color, 1.0)
        bgl.glBegin(bgl.GL_LINES)
        bgl.glVertex2f(*p1)
        bgl.glVertex2f(*p2)
        bgl.glEnd()

    # Draw line.
    bgl.glLineWidth(1.5 if shadow else 1.0)
    bgl.glColor3f(*color)
    bgl.glBegin(bgl.GL_LINES)
    bgl.glVertex2f(*p1)
    bgl.glVertex2f(*p2)
    bgl.glEnd()

    bgl.glLineWidth(1.0)
    bgl.glDisable(bgl.GL_LINE_SMOOTH) 
开发者ID:nutti,项目名称:Screencast-Keys,代码行数:25,代码来源:ops.py

示例2: draw_callback_px

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glLineWidth [as 别名]
def draw_callback_px(self, context):
    print("mouse points", len(self.mouse_path))

    font_id = 0  # XXX, need to find out how best to get this.

    # draw some text
    blf.position(font_id, 15, 30, 0)
    blf.size(font_id, 20, 72)
    blf.draw(font_id, "Hello Word " + str(len(self.mouse_path)))

    # 50% alpha, 2 pixel width line
    bgl.glEnable(bgl.GL_BLEND)
    bgl.glColor4f(0.0, 0.0, 0.0, 0.5)
    bgl.glLineWidth(2)

    bgl.glBegin(bgl.GL_LINE_STRIP)
    for x, y in self.mouse_path:
        bgl.glVertex2i(x, y)

    bgl.glEnd()

    # restore opengl defaults
    bgl.glLineWidth(1)
    bgl.glDisable(bgl.GL_BLEND)
    bgl.glColor4f(0.0, 0.0, 0.0, 1.0) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:27,代码来源:operator_modal_draw.py

示例3: draw_callback_px

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glLineWidth [as 别名]
def draw_callback_px(self, context):
    global cursor_save_location
    settings = find_settings()
    if settings is None:
        return
    library = settings.libraries.get_item()

    tfm_operator = CursorDynamicSettings.active_transform_operator

    if settings.show_bookmarks and library:
        library.draw_bookmark(context)

    if tfm_operator:
        tfm_operator.draw_2d(context)

    # restore opengl defaults
    bgl.glLineWidth(1)
    bgl.glDisable(bgl.GL_BLEND)
    bgl.glColor4f(0.0, 0.0, 0.0, 1.0)


# ===== UTILITY FUNCTIONS ===== # 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:24,代码来源:space_view3d_enhanced_3d_cursor.py

示例4: draw_callback_px

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glLineWidth [as 别名]
def draw_callback_px(self, context):
    """From blender's operator_modal_draw.py modal operator template"""
    if self.do_draw:
        bgl.glEnable(bgl.GL_BLEND)
        bgl.glEnable(bgl.GL_LINE_STIPPLE)
        bgl.glColor4f(0.0, 0.0, 0.0, 1.0)
        bgl.glLineWidth(1)

        bgl.glBegin(bgl.GL_LINE_STRIP)
        bgl.glVertex2i(int(self.draw_start.x), int(self.draw_start.y))
        bgl.glVertex2i(int(self.draw_end.x), int(self.draw_end.y))

        bgl.glEnd()

        # restore opengl defaults
        bgl.glLineWidth(1)
        bgl.glDisable(bgl.GL_BLEND)
        bgl.glDisable(bgl.GL_LINE_STIPPLE)
        bgl.glColor4f(0.0, 0.0, 0.0, 1.0) 
开发者ID:LesFeesSpeciales,项目名称:image-background-transform,代码行数:21,代码来源:image_background_transform.py

示例5: glSetOptions

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glLineWidth [as 别名]
def glSetOptions(prefix, opts):
    if not opts:
        return

    prefix = '%s ' % prefix if prefix else ''

    def set_if_set(opt, cb):
        opt = '%s%s' % (prefix, opt)
        if opt in opts:
            cb(opts[opt])
    dpi_mult = opts.get('dpi mult', 1.0)
    set_if_set('offset', lambda v: bmeshShader.assign('offset', v))
    set_if_set('dotoffset', lambda v: bmeshShader.assign('dotoffset', v))
    set_if_set('color', lambda v: bmeshShader.assign('color', v))
    set_if_set('color selected',
               lambda v: bmeshShader.assign('color_selected', v))
    set_if_set('hidden', lambda v: bmeshShader.assign('hidden', v))
    set_if_set('width', lambda v: bgl.glLineWidth(v*dpi_mult))
    set_if_set('size', lambda v: bgl.glPointSize(v*dpi_mult))
    set_if_set('stipple', lambda v: glEnableStipple(v)) 
开发者ID:CGCookie,项目名称:addon_common,代码行数:22,代码来源:bmesh_render.py

示例6: mi_draw_2d_point

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glLineWidth [as 别名]
def mi_draw_2d_point(point_x, point_y, p_size=4, p_col=(1.0,1.0,1.0,1.0)):
    bgl.glEnable(bgl.GL_BLEND)
    #bgl.glColor4f(1.0, 1.0, 1.0, 0.5)
    #bgl.glLineWidth(2)

    bgl.glPointSize(p_size)
#    bgl.glBegin(bgl.GL_LINE_LOOP)
    bgl.glBegin(bgl.GL_POINTS)
 #   bgl.glBegin(bgl.GL_POLYGON)
    bgl.glColor4f(p_col[0], p_col[1], p_col[2], p_col[3])
    bgl.glVertex2f(point_x, point_y)
    bgl.glEnd()

    # restore opengl defaults
    bgl.glLineWidth(1)
    bgl.glDisable(bgl.GL_BLEND)
    bgl.glColor4f(0.0, 0.0, 0.0, 1.0)


# TODO MOVE TO UTILITIES 
开发者ID:mifth,项目名称:mifthtools,代码行数:22,代码来源:mi_curve_test.py

示例7: mi_curve_draw_3d_polyline

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glLineWidth [as 别名]
def mi_curve_draw_3d_polyline(points, p_size, p_col, x_ray):
    bgl.glEnable(bgl.GL_BLEND)
    bgl.glLineWidth(1)

    if x_ray is True:
        bgl.glDisable(bgl.GL_DEPTH_TEST)

    bgl.glPointSize(p_size)
#    bgl.glBegin(bgl.GL_LINE_LOOP)
    bgl.glBegin(bgl.GL_LINE_STRIP)
    bgl.glColor4f(p_col[0], p_col[1], p_col[2], p_col[3])
 #   bgl.glBegin(bgl.GL_POLYGON)

    for point in points:
        bgl.glVertex3f(point[0], point[1], point[2])

    if x_ray is True:
        bgl.glEnable(bgl.GL_DEPTH_TEST)

    bgl.glEnd()

    # restore opengl defaults
    bgl.glLineWidth(1)
    bgl.glDisable(bgl.GL_BLEND)
    bgl.glColor4f(0.0, 0.0, 0.0, 1.0) 
开发者ID:mifth,项目名称:mifthtools,代码行数:27,代码来源:mi_curve_test.py

示例8: draw_3d_polyline

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glLineWidth [as 别名]
def draw_3d_polyline(points, p_size, p_col, x_ray):
    bgl.glEnable(bgl.GL_BLEND)
    bgl.glLineWidth(1)

    if x_ray is True:
        bgl.glDisable(bgl.GL_DEPTH_TEST)

    bgl.glPointSize(p_size)
#    bgl.glBegin(bgl.GL_LINE_LOOP)
    bgl.glBegin(bgl.GL_LINE_STRIP)
    bgl.glColor4f(p_col[0], p_col[1], p_col[2], p_col[3])
 #   bgl.glBegin(bgl.GL_POLYGON)

    for point in points:
        bgl.glVertex3f(point[0], point[1], point[2])

    if x_ray is True:
        bgl.glEnable(bgl.GL_DEPTH_TEST)

    bgl.glEnd()

    # restore opengl defaults
    bgl.glLineWidth(1)
    bgl.glDisable(bgl.GL_BLEND)
    bgl.glColor4f(0.0, 0.0, 0.0, 1.0) 
开发者ID:mifth,项目名称:mifthtools,代码行数:27,代码来源:mi_widget_curve.py

示例9: draw_text_2d

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glLineWidth [as 别名]
def draw_text_2d(self, context):

    cur_stretch_settings = context.scene.mi_cur_stretch_settings
    rh = context.region.height
    rw = context.region.width

    font_id = 0
    font_size = 30

    #Set font color
    bgl.glEnable(bgl.GL_BLEND)
    #bgl.glColor(1, 0.75, 0.1, 1)
    blf.color(0, 1, 0.75, 0.1, 1)
    bgl.glLineWidth(2)

    #Draw text
    blf.position(font_id, rw - 400, 210 - font_size, 0)
    blf.size(font_id, font_size, 72)
    blf.draw(font_id, str(cur_stretch_settings.points_number))

    # restore opengl defaults
    bgl.glLineWidth(1)
    blf.color(0, 0.0, 0.0, 0.0, 1.0)
    bgl.glDisable(bgl.GL_BLEND)
    #bgl.glColor(0, 0.0, 0.0, 0.0, 1.0) 
开发者ID:mifth,项目名称:mifthtools,代码行数:27,代码来源:mi_curve_stretch.py

示例10: draw

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glLineWidth [as 别名]
def draw(self, context, render=False):
        """
            render flag when rendering
        """

        # print("draw_line %s" % (type(self).__name__))
        bgl.glPushAttrib(bgl.GL_ENABLE_BIT)
        if self.style == bgl.GL_LINE_STIPPLE:
            bgl.glLineStipple(1, 0x9999)
        bgl.glEnable(self.style)
        bgl.glEnable(bgl.GL_BLEND)
        if render:
            # enable anti-alias on lines
            bgl.glEnable(bgl.GL_LINE_SMOOTH)
        bgl.glColor4f(*self.colour)
        bgl.glLineWidth(self.width)
        if self.closed:
            bgl.glBegin(bgl.GL_LINE_LOOP)
        else:
            bgl.glBegin(bgl.GL_LINE_STRIP)

        for pt in self.pts:
            p = self.position_2d_from_coord(context, pt, render)
            bgl.glVertex2f(p.x, p.y)
        self._end() 
开发者ID:s-leger,项目名称:archipack,代码行数:27,代码来源:archipack_gl.py

示例11: draw3d_polyline

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glLineWidth [as 别名]
def draw3d_polyline(points, color, thickness, view_loc, view_ortho, stipple=False, zfar=0.997):
    if not points: return
    if stipple:
        bgl.glLineStipple(4, 0x5555)  #play with this later
        bgl.glEnable(bgl.GL_LINE_STIPPLE)
    bgl.glEnable(bgl.GL_BLEND)
    bgl.glColor4f(*color)
    bgl.glLineWidth(thickness)
    set_depthrange(0.0, zfar, points, view_loc, view_ortho)
    bgl.glBegin(bgl.GL_LINE_STRIP)
    for coord in points: bgl.glVertex3f(*coord)
    bgl.glEnd()
    bgl.glLineWidth(1)
    if stipple:
        bgl.glDisable(bgl.GL_LINE_STIPPLE)
        bgl.glEnable(bgl.GL_BLEND)  # back to uninterrupted lines 
开发者ID:patmo141,项目名称:object_alignment,代码行数:18,代码来源:skeleton_ui_draw.py

示例12: draw_joint

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glLineWidth [as 别名]
def draw_joint(joint, length):
    """

    Args:
      joint: 
      length: 

    Returns:

    """
    origin = Vector(joint.matrix_world.to_translation())
    axis = joint.matrix_world * (length * joint.data.bones[0].vector.normalized())
    endpoint = axis

    bgl.glColor4f(0.0, 1.0, 0.0, 0.5)
    bgl.glLineWidth(2)
    bgl.glBegin(bgl.GL_LINE_STRIP)
    bgl.glVertex3f(*origin)
    bgl.glVertex3f(*endpoint)
    bgl.glEnd() 
开发者ID:dfki-ric,项目名称:phobos,代码行数:22,代码来源:display.py

示例13: draw_callback_3d

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glLineWidth [as 别名]
def draw_callback_3d(self, context):
    """Callback function for 3d drawing.

    Args:
      context: 

    Returns:

    """
    active = context.object
    selected = context.selected_objects
    wm = context.window_manager

    bgl.glEnable(bgl.GL_BLEND)

    # joint axes
    if len(selected) > 0:
        if wm.draw_jointaxes:
            for j in [o for o in selected if o.phobostype == 'link']:
                draw_joint(j, wm.jointaxes_length)

    # restore opengl defaults
    bgl.glLineWidth(1)
    bgl.glDisable(bgl.GL_BLEND)
    bgl.glColor4f(0.0, 0.0, 0.0, 1.0) 
开发者ID:dfki-ric,项目名称:phobos,代码行数:27,代码来源:display.py

示例14: draw_opengl

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glLineWidth [as 别名]
def draw_opengl(self, context):
    context = bpy.context
    
    if context.window_manager.mv.use_opengl_dimensions:
        region = context.region
        rv3d = get_rv3d(context, region)
        
        
        if not rv3d: return

        layers = []
        for x in range(0, 20):
            if bpy.context.scene.layers[x] is True:
                layers.extend([x])
    
        bgl.glEnable(bgl.GL_BLEND)
    
        for obj in context.scene.objects:
            if obj.mv.type == 'VISDIM_A':
                for x in range(0, 20):
                    if obj.layers[x] is True:
                        if x in layers:
                            opengl_dim = obj.mv.opengl_dim
                            if not opengl_dim.hide:
                                draw_dimensions(context, obj, opengl_dim, region, rv3d)
                        break
    
        #---------- restore opengl defaults
        bgl.glLineWidth(1)
        bgl.glDisable(bgl.GL_BLEND)
        bgl.glColor4f(0.0, 0.0, 0.0, 1.0)    
    
    else:
        return 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:36,代码来源:opengl_dim.py

示例15: draw_callback_px

# 需要导入模块: import bgl [as 别名]
# 或者: from bgl import glLineWidth [as 别名]
def draw_callback_px(self, context):
    font_id = 0  # XXX, need to find out how best to get this.

    offset = 10
    text_height = 10
    text_length = int(len(self.mouse_text) * 7.3)
    
    if self.header_text != "":
        blf.size(font_id, 17, 72)
        text_w, text_h = blf.dimensions(font_id,self.header_text)
        blf.position(font_id, context.area.width/2 - text_w/2, context.area.height - 50, 0)
        blf.draw(font_id, self.header_text)

    # 50% alpha, 2 pixel width line
    if self.mouse_text != "":
        bgl.glEnable(bgl.GL_BLEND)
        bgl.glColor4f(0.0, 0.0, 0.0, 0.5)
        bgl.glLineWidth(10)
    
        bgl.glBegin(bgl.GL_LINE_STRIP)
        bgl.glVertex2i(self.mouse_loc[0]-offset-5, self.mouse_loc[1]+offset)
        bgl.glVertex2i(self.mouse_loc[0]+text_length-offset, self.mouse_loc[1]+offset)
        bgl.glVertex2i(self.mouse_loc[0]+text_length-offset, self.mouse_loc[1]+offset+text_height)
        bgl.glVertex2i(self.mouse_loc[0]-offset-5, self.mouse_loc[1]+offset+text_height)
        bgl.glEnd()
        
        bgl.glColor4f(1.0, 1.0, 1.0, 1.0)
        blf.position(font_id, self.mouse_loc[0]-offset, self.mouse_loc[1]+offset, 0)
        blf.size(font_id, 15, 72)
        blf.draw(font_id, self.mouse_text)
        
    # restore opengl defaults
    bgl.glLineWidth(1)
    bgl.glDisable(bgl.GL_BLEND)
    bgl.glColor4f(0.0, 0.0, 0.0, 1.0) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:37,代码来源:utils.py


注:本文中的bgl.glLineWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。