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


Python blf.size方法代码示例

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


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

示例1: draw_callback_text

# 需要导入模块: import blf [as 别名]
# 或者: from blf import size [as 别名]
def draw_callback_text(self):
        obj = bpy.context.active_object
        ### draw text for edge length detection
        if self.shift and self.point_type == "EDGE":
            p1 = obj.matrix_world * self.verts_edges_data[0]
            p2 = obj.matrix_world * self.verts_edges_data[1]
            length = (p1-p2).magnitude

            font_id = 0
            line = str(round(length,2))
            bgl.glEnable(bgl.GL_BLEND)
            bgl.glColor4f(1,1,1,1)

            blf.position(font_id, self.mouse_2d_x-15, self.mouse_2d_y+30, 0)
            blf.size(font_id, 20, 72)
            blf.draw(font_id, line)

        if self.mode == "EDIT_MESH":
            draw_edit_mode(self,bpy.context,color=[1.0, 0.39, 0.41, 1.0],text="Edit Mesh Mode",offset=-20)
        elif self.mode == "DRAW_BONE_SHAPE":
            draw_edit_mode(self,bpy.context,color=[1.0, 0.39, 0.41, 1.0],text="Draw Bone Shape",offset=-20) 
开发者ID:ndee85,项目名称:coa_tools,代码行数:23,代码来源:edit_mesh.py

示例2: draw_callback_px

# 需要导入模块: import blf [as 别名]
# 或者: from blf import size [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_extension_lines

# 需要导入模块: import blf [as 别名]
# 或者: from blf import size [as 别名]
def draw_extension_lines(v1, v2, size=20):
    rad_a = math.radians(90)
    rad_b = math.radians(270)

    v = interpolate3d((v1[0], v1[1], 0.0), (v2[0], v2[1], 0.0), size)
    v1i = (v[0] - v1[0], v[1] - v1[1])

    v = interpolate3d((v2[0], v2[1], 0.0), (v1[0], v1[1], 0.0), size)
    v2i = (v[0] - v2[0], v[1] - v2[1])

    v1a = (int(v1i[0] * math.cos(rad_a) - v1i[1] * math.sin(rad_a) + v1[0]),
           int(v1i[1] * math.cos(rad_a) + v1i[0] * math.sin(rad_a)) + v1[1])
    v1b = (int(v1i[0] * math.cos(rad_b) - v1i[1] * math.sin(rad_b) + v1[0]),
           int(v1i[1] * math.cos(rad_b) + v1i[0] * math.sin(rad_b) + v1[1]))

    v2a = (int(v2i[0] * math.cos(rad_a) - v2i[1] * math.sin(rad_a) + v2[0]),
           int(v2i[1] * math.cos(rad_a) + v2i[0] * math.sin(rad_a)) + v2[1])
    v2b = (int(v2i[0] * math.cos(rad_b) - v2i[1] * math.sin(rad_b) + v2[0]),
           int(v2i[1] * math.cos(rad_b) + v2i[0] * math.sin(rad_b) + v2[1]))
    
    draw_line(v1, v1a)
    draw_line(v1, v1b)
    
    draw_line(v2, v2a)
    draw_line(v2, v2b) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:27,代码来源:opengl_dim.py

示例4: create_cube_mesh

# 需要导入模块: import blf [as 别名]
# 或者: from blf import size [as 别名]
def create_cube_mesh(name,size):
    
    verts = [(0.0, 0.0, 0.0),
             (0.0, size[1], 0.0),
             (size[0], size[1], 0.0),
             (size[0], 0.0, 0.0),
             (0.0, 0.0, size[2]),
             (0.0, size[1], size[2]),
             (size[0], size[1], size[2]),
             (size[0], 0.0, size[2]),
             ]

    faces = [(0, 1, 2, 3),
             (4, 7, 6, 5),
             (0, 4, 5, 1),
             (1, 5, 6, 2),
             (2, 6, 7, 3),
             (4, 0, 3, 7),
            ]
    
    return create_object_from_verts_and_faces(verts,faces,name) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:23,代码来源:utils.py

示例5: MatrixDecompose

# 需要导入模块: import blf [as 别名]
# 或者: from blf import size [as 别名]
def MatrixDecompose(m, res_size=None):
    size = len(m)
    axes = m.col # m.row
    if res_size is None:
        res_size = size

    if res_size == 2:
        return (axes[0].to_2d(), axes[1].to_2d())
    else:
        x = axes[0].to_3d()
        y = axes[1].to_3d()
        z = (axes[2].to_3d() if size > 2 else Vector())
        if res_size == 3:
            return (x, y, z)

        t = (m.translation.to_3d() if size == 4 else Vector())
        if res_size == 4:
            return (x, y, z, t) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:20,代码来源:space_view3d_enhanced_3d_cursor.py

示例6: _draw_callback_px

# 需要导入模块: import blf [as 别名]
# 或者: from blf import size [as 别名]
def _draw_callback_px(self, context):

    try:
        print("SELF", self)
    except:
        print("red err?")

    r_width = context.region.width
    r_height = context.region.height
    font_id = 0  # TODO: need to find out how best to get font_id

    blf.size(font_id, 11, 72)
    text_size = blf.dimensions(0, self.view_name)

    text_x = r_width - text_size[0] - 10
    text_y = r_height - text_size[1] - 8
    blf.position(font_id, text_x, text_y, 0)
    blf.draw(font_id, self.view_name) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:20,代码来源:ui.py

示例7: DrawCenterText

# 需要导入模块: import blf [as 别名]
# 或者: from blf import size [as 别名]
def DrawCenterText(text, xt, yt, Size, Color, self):
    font_id = 0
    # Decalage Ombre
    Sshadow_x = 2
    Sshadow_y = -2

    blf.size(font_id, Size, 72)
    blf.position(font_id, xt + Sshadow_x - blf.dimensions(font_id, text)[0] / 2, yt + Sshadow_y, 0)
    bgl.glColor4f(0.0, 0.0, 0.0, 1.0)

    blf.draw(font_id, text)
    blf.position(font_id, xt - blf.dimensions(font_id, text)[0] / 2, yt, 0)
    if Color is not None:
        mColor = mathutils.Color((Color[0], Color[1], Color[2]))
        bgl.glColor4f(mColor.r, mColor.g, mColor.b, 1.0)
    else:
        bgl.glColor4f(1.0, 1.0, 1.0, 1.0)
    blf.draw(font_id, text)


# Draw text (Left position) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:23,代码来源:mesh_carver.py

示例8: DrawLeftText

# 需要导入模块: import blf [as 别名]
# 或者: from blf import size [as 别名]
def DrawLeftText(text, xt, yt, Size, Color, self):
    font_id = 0
    # Decalage Ombre
    Sshadow_x = 2
    Sshadow_y = -2

    blf.size(font_id, Size, 72)
    blf.position(font_id, xt + Sshadow_x, yt + Sshadow_y, 0)
    bgl.glColor4f(0.0, 0.0, 0.0, 1.0)
    blf.draw(font_id, text)
    blf.position(font_id, xt, yt, 0)
    if Color is not None:
        mColor = mathutils.Color((Color[0], Color[1], Color[2]))
        bgl.glColor4f(mColor.r, mColor.g, mColor.b, 1.0)
    else:
        bgl.glColor4f(1.0, 1.0, 1.0, 1.0)
    blf.draw(font_id, text)


# Draw text (Right position) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:22,代码来源:mesh_carver.py

示例9: DrawRightText

# 需要导入模块: import blf [as 别名]
# 或者: from blf import size [as 别名]
def DrawRightText(text, xt, yt, Size, Color, self):
    font_id = 0
    # Decalage Ombre
    Sshadow_x = 2
    Sshadow_y = -2

    blf.size(font_id, Size, 72)
    blf.position(font_id, xt + Sshadow_x - blf.dimensions(font_id, text)[0], yt + Sshadow_y, 0)
    bgl.glColor4f(0.0, 0.0, 0.0, 1.0)
    blf.draw(font_id, text)
    blf.position(font_id, xt - blf.dimensions(font_id, text)[0], yt, 0)
    if Color is not None:
        mColor = mathutils.Color((Color[0], Color[1], Color[2]))
        bgl.glColor4f(mColor.r, mColor.g, mColor.b, 1.0)
    else:
        bgl.glColor4f(1.0, 1.0, 1.0, 1.0)
    blf.draw(font_id, text)


# Opengl draws 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:22,代码来源:mesh_carver.py

示例10: onscreen_warning

# 需要导入模块: import blf [as 别名]
# 或者: from blf import size [as 别名]
def onscreen_warning(self, x, y):
        gamma = self.gamma_correction

        fontid = 1
        blf.size(fontid, self.prefs.view_font_size_report, 72)
        blf.color(fontid, *gamma((1.0, 0.3, 0.3, 1.0)))

        _, font_h = blf.dimensions(fontid, "Row Height")
        font_row_height = font_h * 2
        y += font_h

        for row in self.warn:
            y -= font_row_height

            blf.position(fontid, x, y, 0.0)
            blf.draw(fontid, row)

        return y 
开发者ID:mrachinskiy,项目名称:jewelcraft,代码行数:20,代码来源:onscreen_text.py

示例11: draw_text_2d

# 需要导入模块: import blf [as 别名]
# 或者: from blf import size [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

示例12: draw

# 需要导入模块: import blf [as 别名]
# 或者: from blf import size [as 别名]
def draw(self, context, render=False):

        # print("draw_text %s %s" % (self.text, type(self).__name__))
        self.render = render
        p = self.position_2d_from_coord(context, self.pts[0], render)
        # dirty fast assignment
        dpi, font_id = context.user_preferences.system.dpi, 0
        bgl.glColor4f(*self.colour)
        if self.angle != 0:
            blf.enable(font_id, blf.ROTATION)
            blf.rotation(font_id, self.angle)
        blf.size(font_id, self.font_size, dpi)
        blf.position(font_id, p.x, p.y, 0)
        blf.draw(font_id, self.text)
        if self.angle != 0:
            blf.disable(font_id, blf.ROTATION) 
开发者ID:s-leger,项目名称:archipack,代码行数:18,代码来源:archipack_gl.py

示例13: set_pos

# 需要导入模块: import blf [as 别名]
# 或者: from blf import size [as 别名]
def set_pos(self, context, pos_3d, direction, normal=Vector((0, 0, 1))):
        self.pos_3d = pos_3d
        self.pos_2d = self.position_2d_from_coord(context, self.sensor_center)
        o = self.pos_3d
        w = self.size
        s = 0.25 * w
        x = direction.normalized()
        y = x.cross(normal)
        xs = x * s
        xw = x * w
        ys = y * s
        yw = y * w
        p0 = o - xw + ys
        p1 = o + xw + ys
        p2 = o + xw - ys
        p3 = o - xw - ys
        p4 = o - xs + yw
        p5 = o + xs + yw
        p6 = o + xs - yw
        p7 = o - xs - yw
        self.branch_0.set_pos([p0, p1, p2, p3])
        self.branch_1.set_pos([p4, p5, p6, p7]) 
开发者ID:s-leger,项目名称:archipack,代码行数:24,代码来源:archipack_gl.py

示例14: size

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

        system = context.user_preferences.system
        w = context.region.width
        h = context.region.height
        y_min = self.margin
        y_max = h - self.margin
        x_min = self.margin
        x_max = w - self.margin
        if (system.use_region_overlap and
                system.window_draw_method in {'TRIPLE_BUFFER', 'AUTOMATIC'}):
            area = context.area

            for r in area.regions:
                if r.type == 'TOOLS':
                    x_min += r.width
                elif r.type == 'UI':
                    x_max -= r.width
        return x_min, x_max, y_min, y_max 
开发者ID:s-leger,项目名称:archipack,代码行数:21,代码来源:archipack_gl.py

示例15: draw_callback_px

# 需要导入模块: import blf [as 别名]
# 或者: from blf import size [as 别名]
def draw_callback_px(self, context):

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

    # draw some text
    y = context.region.height
    dims = blf.dimensions(0, 'A')

    blf.position(font_id, 10, y - 20 - dims[1], 0)
    blf.size(font_id, 20, 72)

    if context.area.x == self.area_align.x:
        blf.draw(font_id, "Align: "+ self.align_msg)
        points = [self.obj_align.matrix_world * p for p in self.align_points]
        color = (1,0,0,1)
    else:
        blf.draw(font_id, "Base: " + self.base_msg)
        points = [self.obj_align.matrix_world * p for p in self.base_points]
        color = (0,1,0,1)

    draw_3d_points_revised(context, points, color, 4)

    for i, vec in enumerate(points):
        ind = str(i)
        draw_3d_text(context, font_id, ind, vec) 
开发者ID:patmo141,项目名称:object_alignment,代码行数:27,代码来源:align_pick_points.py


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