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


Python blf.draw方法代码示例

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


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

示例1: draw_callback_text

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

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

        if pt_buf.sws == 'on':
            layout.active = False
            layout.label('Pen Tool On')
        else:
            layout.label('Font:')
            row = layout.split(0.50, align = True)
            row.prop(context.scene.pt_custom_props, 'fs', text = 'Size', slider = True)
            row.prop(context.scene.pt_custom_props, 'a', text = 'Alpha', slider = True)
            layout.prop(context.scene.pt_custom_props, 'b0', text = 'Angles')
            layout.prop(context.scene.pt_custom_props, 'b1', text = 'Edge Length')
            layout.prop(context.scene.pt_custom_props, 'b2', text = 'Mouse Location 3d')
            row1 = layout.split(0.80, align = True)
            row1.operator('pt.op0_id', text = 'Draw')
            row1.operator('pt.op1_id', text = '?')

# ------ operator 0 ------ 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:21,代码来源:mesh_pen_tool.py

示例4: create_properties

# 需要导入模块: import blf [as 别名]
# 或者: from blf import draw [as 别名]
def create_properties():
    bpy.types.WindowManager.show_vgroups_show_all = bpy.props.BoolProperty(
        name = "Show All Selected Vertices",
        description = "Show all vertices with vertex groups assigned to them",
        default=False)

    bpy.types.Mesh.assign_vgroup = bpy.props.StringProperty()

    bpy.types.Scene.show_vgroups_weights = bpy.props.BoolProperty(
        name="Show Vertex Groups/Weights",
        default=False)

    bpy.types.Scene.show_vgroups_weights_limit = bpy.props.IntProperty(
        name="Limit",
        description="Maximum number of weight overlays to draw",
        default=20,
        min=1,
        max=1000,
        soft_max=100)

# removal of ID-properties when script is disabled 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:23,代码来源:mesh_show_vgroup_weights.py

示例5: draw

# 需要导入模块: import blf [as 别名]
# 或者: from blf import draw [as 别名]
def draw(self, context, layout):
        if len(self.collection) == 0:
            if self.op_new:
                layout.operator(self.op_new, icon=self.icon)
            else:
                layout.label(
                    text="({})".format(self.data_name),
                    icon=self.icon)
            return

        row = layout.row(align=True)
        row.prop_menu_enum(self, "enum", text="", icon=self.icon)
        row.prop(self, "active", text="")
        if self.op_new:
            row.operator(self.op_new, text="", icon='ZOOMIN')
        if self.op_delete:
            row.operator(self.op_delete, text="", icon='X')
# end class
#============================================================================#
# ===== PROPERTY DEFINITIONS ===== #

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

示例6: _draw_callback_px

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

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

示例8: DrawRightText

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

示例9: draw

# 需要导入模块: import blf [as 别名]
# 或者: from blf import draw [as 别名]
def draw(self,obj_1,obj_2):
        p1 = (obj_1.matrix_world[0][3], obj_1.matrix_world[1][3],obj_1.matrix_world[2][3])
        p2 = (obj_2.matrix_world[0][3], obj_2.matrix_world[1][3],obj_2.matrix_world[2][3])
        
        dist = distance(p1,p2)
        
        if dist > 0:
            
            dim_text = unit.dim_as_string(dist)
            text_width = self.txt_width(dim_text)
            text_height = self.txt_height(dim_text)
            
            txtpoint3d = interpolate3d(p1, p2, math.fabs(dist / 2))
            txtpoint2d = view3d_utils.location_3d_to_region_2d(self.region, self.rv3d, txtpoint3d)
            
            self.draw_dim_box(txtpoint2d, (text_width,text_height))
            self.draw_dim_text(txtpoint2d, dim_text, (text_width,text_height)) 
开发者ID:CreativeDesigner3D,项目名称:BlenderPro,代码行数:19,代码来源:opengl.py

示例10: _draw

# 需要导入模块: import blf [as 别名]
# 或者: from blf import draw [as 别名]
def _draw(self, context, event):
        # first draw to reset buffer
        shader2Dcolor.uniform_float("color", (.5, .5, .5, .5))
        batch_for_shader(shader2Dcolor, 'LINES', {"pos": ((0,0), (0,0))}).draw(shader2Dcolor)
        
        if self.draw_guide:
            shader2Dcolor.uniform_float("color", (.5, .5, .5, .5))
            batch_for_shader(shader2Dcolor, 'LINES', {"pos": ((self._start_position[:]), (self._end_position[:]))}).draw(shader2Dcolor)

        if self.allow_xy_keys:
            if self.x_key:
                shader2Dcolor.uniform_float("color", (1, 0, 0, .5))
                batch_for_shader(shader2Dcolor, 'LINES', {"pos": ((0, self._start_position.y), (context.area.width, self._start_position.y))}).draw(shader2Dcolor)
            elif self.y_key:
                shader2Dcolor.uniform_float("color", (0, 1, 0, .5))
                batch_for_shader(shader2Dcolor, 'LINES', {"pos": ((self._start_position.x, 0), (self._start_position.x, context.area.height))}).draw(shader2Dcolor) 
开发者ID:leomoon-studios,项目名称:leomoon-lightstudio,代码行数:18,代码来源:modal_utils.py

示例11: draw

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

        area_height = self.get_area_height()

        self.shader.bind()
        
        self.set_colors()
        
        bgl.glEnable(bgl.GL_BLEND)

        self.batch_panel.draw(self.shader) 

        self.draw_image()   

        bgl.glDisable(bgl.GL_BLEND)

        # Draw text
        self.draw_text(area_height) 
开发者ID:jayanam,项目名称:bl_ui_widgets,代码行数:20,代码来源:bl_ui_button.py

示例12: draw

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

        area_height = self.get_area_height()
        self.shader_chb.bind()

        if self.is_checked:
            bgl.glLineWidth(3)
            self.shader_chb.uniform_float("color", self._cross_color)

            self.batch_cross.draw(self.shader_chb) 

        bgl.glLineWidth(2)
        self.shader_chb.uniform_float("color", self._box_color)

        self.batch_box.draw(self.shader_chb) 

        # Draw text
        self.draw_text(area_height) 
开发者ID:jayanam,项目名称:bl_ui_widgets,代码行数:20,代码来源:bl_ui_checkbox.py

示例13: onscreen_warning

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

示例14: write_text

# 需要导入模块: import blf [as 别名]
# 或者: from blf import draw [as 别名]
def write_text(self,text,size=20,pos_y=0,color=(1,1,1,1)):
        start_pos = self.region_height - 60*self.scale_y
        lines = text.split("\n")
        
        pos_y = start_pos - (pos_y * self.scale_y)
        size = int(size * self.scale_y)
        
        bgl.glColor4f(color[0],color[1],color[2],color[3]*self.alpha_current)
        line_height = (size + size*.5) * self.scale_y
        for i,line in enumerate(lines):
            
            blf.position(self.font_id, 15+self.region_offset, pos_y-(line_height*i), 0)
            blf.size(self.font_id, size, 72)
            blf.draw(self.font_id, line) 
开发者ID:ndee85,项目名称:coa_tools,代码行数:16,代码来源:help_display.py

示例15: draw_line

# 需要导入模块: import blf [as 别名]
# 或者: from blf import draw [as 别名]
def draw_line(shader, start, end, color=(1.0, 1.0, 1.0, 1.0)):
    """Draws a line using two Vector-based points"""
    batch = batch_for_shader(shader, "LINES", {"pos": (start, end)})

    shader.bind()
    shader.uniform_float("color", color)
    batch.draw(shader) 
开发者ID:GDQuest,项目名称:blender-power-sequencer,代码行数:9,代码来源:draw.py


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