def draw_text(text, x, y, size, color=(1, 1, 1, 0.5)): font_id = 0 # bgl.glColor4f(*color) blf.color(font_id, color[0], color[1], color[2], color[3]) blf.position(font_id, x, y, 0) blf.size(font_id, size, 72) blf.draw(font_id, text)
def onscreen_gem_table(self, x, y, color=(0.95, 0.95, 0.95, 1.0)): fontid = 1 blf.size(fontid, self.prefs.view_font_size_report, 72) blf.color(fontid, *color) _, font_h = blf.dimensions(fontid, "Row Height") font_baseline = font_h * 0.4 font_row_height = font_h * 2 box_size = font_h * 1.5 y += font_baseline for row, color in self.table_data: y -= font_row_height shader.bind() shader.uniform_float("color", color) batch_font = batch_for_shader( shader, "TRI_FAN", {"pos": self.rect_coords(x, y, box_size, box_size)}) batch_font.draw(shader) blf.position(fontid, x + font_row_height, y + font_baseline, 0.0) blf.draw(fontid, row) return y
def draw_pipe_options(self, context): if context.object.type == 'CURVE': segments = context.object.data.bevel_resolution pipe_width = context.object.data.bevel_depth width = context.area.width font_id = 0 blf.color(font_id, 1, 1, 1, 1) blf.position(font_id, width / 2 - 100, 140, 0) blf.size(font_id, 30, 60) blf.draw(font_id, "Segments: ") blf.position(font_id, width / 2 - 100, 100, 0) blf.draw(font_id, "Width: ") blf.position(font_id, width / 2 - 100, 60, 0) blf.draw(font_id, "Fill Caps: ") blf.color(font_id, 253, 253, 0, 1) blf.position(font_id, width / 2 + 35, 140, 0) blf.size(font_id, 30, 60) blf.draw(font_id, str(4 + segments * 2)) blf.position(font_id, width / 2 - 14, 100, 0) blf.draw(font_id, str("%.3f" % pipe_width)) blf.position(font_id, width / 2 + 16, 60, 0)
def simple_exception_display(context, args, xy): """ a simple bgl/blf exception showing tool for nodeview """ text, config = args x, y = xy x, y = int(x), int(y) r, g, b = (1.0, 1.0, 1.0) font_id = 0 scale = config.scale * 1.5 text_height = 15 * scale line_height = 14 * scale blf.size(font_id, int(text_height), 72) blf.color(font_id, r, g, b, 1.0) ypos = y if isinstance(text.body, list): for line in text.body: blf.position(0, x, ypos, 0) blf.draw(font_id, line) ypos -= int(line_height * 1.3) elif isinstance(text.body, str): blf.position(0, x, ypos, 0) blf.draw(font_id, text.body) ypos -= int(line_height * 1.3) blf.color(font_id, 0.911393, 0.090249, 0.257536, 1.0) blf.position(0, x, ypos, 0) blf.draw(font_id, text.final_error_message)
def draw_surface_slide_HUD(context, color=(1, 1, 1), alpha=1, width=2): if context.space_data.overlay.show_overlays: region = context.region view = context.space_data # check if title needs to be offset down due to the header position area = context.area headers = [r for r in area.regions if r.type == 'HEADER'] scale = context.preferences.view.ui_scale offset = 0 if headers: header = headers[0] # only offset when the header is on top and when show_region_tool_header is disabled if not (area.y - header.y) and not view.show_region_tool_header: offset += int(25 * scale) title = "Surface Sliding" font = 1 fontsize = int(12 * scale) blf.size(font, fontsize, 72) blf.color(font, *color, alpha) blf.position(font, (region.width / 2) - int(60 * scale), 0 + offset + int(fontsize), 0) blf.draw(font, title)
def draw_text(text, position, color, size): bgl.glEnable(bgl.GL_BLEND) blf.size(font_id, size, DPI) blf.position(font_id, *position) blf.color(font_id, *color) blf.draw(font_id, text) bgl.glDisable(bgl.GL_BLEND)
def draw_label(context, title='', coords=None, center=True, color=(1, 1, 1), alpha=1): # centered, but slighly below if not coords: region = context.region width = region.width / 2 height = region.height / 2 else: width, height = coords scale = context.preferences.view.ui_scale font = 1 fontsize = int(12 * scale) blf.size(font, fontsize, 72) blf.color(font, *color, alpha) if center: blf.position(font, width - (int(len(title) * scale * 7) / 2), height + int(fontsize), 0) else: blf.position(font, *(coords), 1) # blf.position(font, 10, 10, 0) blf.draw(font, title)
def drawCallback(op: MouseStrafingOperator, context: bpy.types.Context, event: bpy.types.Event): if context.area != op.area: return sv3d, rv3d = getViews3D(context) if rv3d != op.region: return fontId = 0 blf.size(fontId, 20, 72) if op.prefs.showCrosshair: x, y = context.region.width // 2 - 8, context.region.height // 2 - 7 blf.color(fontId, 0, 0, 0, 0.8) blf.position(fontId, x, y, 0) blf.draw(fontId, "+") color = (0.75, 0.75, 0.75, 1) if op.keyDownRelocatePivot: if op.prefs.adjustPivot: color = (1, 1, 0.05, 1) elif op.adjustPivotSuccess: color = (0.1, 1, 0.05, 1) else: color = (1, 0.1, 0.05, 1) elif op.keySaveStateDown: color = (1, 0.05, 1, 1) elif op.isInMouseMode: color = (1, 1, 1, 1) blf.color(fontId, *color) blf.position(fontId, x, y+1, 0) blf.draw(fontId, "+")
def draw_all_text_at_once(final_draw_data): # build bg mesh and vcol data full_bg_Verts = [] add_vert_list = full_bg_Verts.extend full_bg_colors = [] add_vcol = full_bg_colors.extend for counter, (_, _, _, _, _, type_draw, pts) in final_draw_data.items(): col = settings[f'bg_{type_draw}_col'] add_vert_list(pts) add_vcol((col, ) * 6) # draw background shader = gpu.shader.from_builtin('2D_SMOOTH_COLOR') batch = batch_for_shader(shader, 'TRIS', { "pos": full_bg_Verts, "color": full_bg_colors }) batch.draw(shader) # draw text for counter, (index_str, pos_x, pos_y, txt_width, txt_height, type_draw, pts) in final_draw_data.items(): text_color = settings[f'numid_{type_draw}_col'] blf.color(font_id, *text_color) blf.position(0, pos_x, pos_y, 0) blf.draw(0, index_str)
def draw(self): area_height = self.get_area_height() self.shader.bind() color = self._color text_color = self._text_color # pressed if self.__state == 1: color = self._select_color # hover elif self.__state == 2: color = self._hover_color # Draw background self.shader.uniform_float("color", self._bg_color) bgl.glEnable(bgl.GL_BLEND) self.batch_bg.draw(self.shader) # Draw slider self.shader.uniform_float("color", color) self.batch_slider.draw(self.shader) bgl.glDisable(bgl.GL_BLEND) # Draw value text sFormat = "{:0." + str(self._decimals) + "f}" blf.size(0, self._text_size, 72) sValue = sFormat.format(self.__slider_value) size = blf.dimensions(0, sValue) blf.position(0, self.__slider_pos + 1 + self.x_screen - size[0] / 2.0, area_height - self.y_screen + self.__slider_offset_y, 0) blf.draw(0, sValue) # Draw min and max if self._show_min_max: sMin = sFormat.format(self._min) size = blf.dimensions(0, sMin) blf.position(0, self.x_screen - size[0] / 2.0, area_height - self.height - self.y_screen, 0) blf.draw(0, sMin) sMax = sFormat.format(self._max) size = blf.dimensions(0, sMax) r, g, b, a = self._text_color blf.color(0, r, g, b, a) blf.position(0, self.x_screen + self.width - size[0] / 2.0, area_height - self.height - self.y_screen, 0) blf.draw(0, sMax)
def draw(self): super().draw() area_height = self.get_area_height() # Draw text self.draw_text(area_height) self.shader.bind() self.shader.uniform_float("color", self._carret_color) bgl.glEnable(bgl.GL_LINE_SMOOTH) bgl.glLineWidth(2) self.batch_carret.draw(self.shader) if self.has_label: self.shader.uniform_float("color", self._label_color) bgl.glLineWidth(1) self.batch_outline.draw(self.shader) self.batch_label_bg.draw(self.shader) size = blf.dimensions(0, self._label) textpos_y = area_height - self.y_screen - (self.height + size[1]) / 2.0 blf.position(0, self.x_screen + self.width + (self._label_width / 2.0) - (size[0] / 2.0), textpos_y + 1, 0) r, g, b, a = self._label_text_color blf.color(0, r, g, b, a) blf.draw(0, self._label)
def drawText(text, x, y, font=0, align="LEFT", verticalAlignment="BASELINE", size=12, color=(1, 1, 1, 1)): text = str(text) blf.size(font, size, int(dpi)) blf.color(font, *color) if align == "LEFT" and verticalAlignment == "BASELINE": blf.position(font, x, y, 0) else: width, height = blf.dimensions(font, text) newX, newY = x, y if align == "RIGHT": newX -= width elif align == "CENTER": newX -= width / 2 if verticalAlignment == "CENTER": newY -= blf.dimensions(font, "x")[1] * 0.75 blf.position(font, newX, newY, 0) blf.draw(font, text)
def draw_callback_px(self, context): font_id = 0 y = 60 y_offset = 0 lines = [ 'SPACE | Finish', 'C | Color', 'ALT | Rotate', 'S | Shape = ' + self.shape.capitalize(), 'CTRL B | Show/Hide Cutters', 'X | Live = ' + str(self.live), 'B | Cut Type = ' + str(self.bool), 'SHIFT | Extrude', ] blf.size(font_id, 20, 42) for l in lines: blf.position(font_id, 30, (y + y_offset), 0) blf.color(font_id, .02, .02, .02, 1) blf.draw(font_id, l) y_offset += 30 # if self.dragging: # if self.shape == 'circle': # blf.position(font_id, 300, 30, 0) # blf.draw(font_id, 'A / D = Resolution = ' + str(self.res*100) + '%') blf.size(font_id, 20, 72) blf.position(font_id, 30, y_offset + 60, 0) blf.draw(font_id, 'DRAG | Draw')
def onscreen_gem_table(self, x: int, y: int, color: Optional[Color] = None) -> int: fontid = 1 shader = gpu.shader.from_builtin("2D_UNIFORM_COLOR") if color is None: color = bpy.context.preferences.themes[0].view_3d.space.text_hi blf.size(fontid, self.prefs.gem_map_fontsize_table, 72) blf.color(fontid, *color, 1.0) _, font_h = blf.dimensions(fontid, "Row Height") font_baseline = round(font_h * 0.4) font_row_height = font_h * 2 icon_size = font_h * 1.5 y += font_baseline for row, icon_color in self.table_data: y -= font_row_height shader.bind() shader.uniform_float("color", icon_color) batch_font = batch_for_shader( shader, "TRI_FAN", {"pos": self.rect_coords(x, y, icon_size, icon_size)}) batch_font.draw(shader) blf.position(fontid, x + font_row_height, y + font_baseline, 0.0) blf.draw(fontid, row) return y
def draw_text(self, text, size, offset=0, HUDcolor=None, HUDalpha=0.5, shadow=True): if not HUDcolor: #HUDcolor = (1, 1, 1) HUDcolor = get_prefs().hud_Color shadow = (0, 0, 0) scale = 1 scale = bpy.context.preferences.view.ui_scale * get_prefs().hud_scale offset = self.offset + int(offset * scale) self.offset = offset if shadow: blf.color(self.font_id, *shadow, HUDalpha * 0.7) blf.position(self.font_id, self.HUD_x + int(20 * scale) + 1, self.HUD_y - offset - 1, 0) blf.size(self.font_id, int(size * scale), 72) blf.draw(self.font_id, text) blf.color(self.font_id, *HUDcolor, HUDalpha) blf.position(self.font_id, self.HUD_x + int(20 * scale), self.HUD_y - offset, 0) blf.size(self.font_id, int(size * scale), 72) blf.draw(self.font_id, text)
def _draw_pixels(self, context, depsgraph): scene = depsgraph.scene w = context.region.width h = context.region.height # Draw text area that RenderMan is running. if get_pref('draw_ipr_text', False) and not self.rman_render.rman_is_viewport_rendering: pos_x = w / 2 - 100 pos_y = 20 blf.enable(0, blf.SHADOW) blf.shadow_offset(0, 1, -1) blf.shadow(0, 5, 0.0, 0.0, 0.0, 0.8) blf.size(0, 32, 36) blf.position(0, pos_x, pos_y, 0) blf.color(0, 1.0, 0.0, 0.0, 1.0) blf.draw(0, "%s" % ('RenderMan Interactive Mode Running')) blf.disable(0, blf.SHADOW) if not self.rman_render.rman_is_viewport_rendering: return # Bind shader that converts from scene linear to display space, bgl.glEnable(bgl.GL_BLEND) bgl.glBlendFunc(bgl.GL_ONE, bgl.GL_ONE_MINUS_SRC_ALPHA) self.bind_display_space_shader(scene) self.rman_render.draw_pixels(w, h) self.unbind_display_space_shader() bgl.glDisable(bgl.GL_BLEND)
def view_draw(self, context, depsgraph): """Called whenever Blender redraws the 3D viewport""" scene = depsgraph.scene # debug('[RENDER] start') self.update_viewport_camera(context) self.update_render_texture() # glEnable(GL_DEPTH_TEST) if self.connected and self.bindcode != -1: self.bind_display_space_shader(scene) self.shader.bind() glActiveTexture(GL_TEXTURE0) glBindTexture(GL_TEXTURE_2D, self.bindcode) self.shader.uniform_int('image', 0) self.batch.draw(self.shader) self.unbind_display_space_shader() elif not self.connected: glClearColor(0, 0, 0, 1.0) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) blf.position(0, 15, 30, 0) blf.size(0, 20, 72) blf.color(0, 0.8, 0, 0, 1.0) blf.draw(0, 'Not Connected to Unity')
def draw_text(v1): font_id = 0 font_size = 48 dpi = 72 blf.position(font_id, v1[0], v1[1], 0) blf.color(font_id, 1.0, 1.0, 1.0, 1.0) blf.size(font_id, font_size, dpi) blf.draw(font_id, "Hello World")
def draw(self): blf.size(self.font_id,self.font_size,72) blf.color(self.font_id,*self.color) if self.direction == 'down': self.space = -self.space for i, text in enumerate(self.texts): blf.position(self.font_id, self.pos[0], self.pos[1] + self.space * i, 0) blf.draw(self.font_id, text)
def draw_text(text, x, y, size=12, color=(1, 1, 1, 1)): dpi = bpy.context.preferences.system.dpi font = 0 blf.size(font, size, int(dpi)) blf.color(font, *color) blf.position(font, x, y, 0) blf.draw(font, text)
def draw_disconnected_view(self): glClearColor(0, 0, 0, 1.0) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) blf.position(0, 15, 30, 0) blf.size(0, 20, 72) blf.color(0, 0.8, 0, 0, 1.0) blf.draw(0, 'Not Connected to Unity')
def draw_normal(self): blf.size(self.textData.font_id, self.textData.fontSize, 72) if self.textData.color: blf.color(self.textData.font_id, *self.textData.color) blf.position(self.textData.font_id, self.xPos, self.yPos, 0) blf.draw(self.textData.font_id, self.text)
def draw_callback_px(self, context): '''Draw callback use by modal to draw in viewport''' if context.area != self.current_area: return # text font_id = 0 shader = gpu.shader.from_builtin('2D_UNIFORM_COLOR') # initiate shader bgl.glEnable(bgl.GL_BLEND) bgl.glLineWidth(1) # Draw HUD if self.use_hud_time_line: shader.bind() shader.uniform_float("color", self.color_timeline) self.batch_timeline.draw(shader) # Display keyframes if self.use_hud_keyframes: if self.keyframe_aspect == 'LINE': bgl.glLineWidth(3) shader.bind() shader.uniform_float("color", self.color_timeline) self.batch_keyframes.draw(shader) else: bgl.glLineWidth(1) shader.bind() shader.uniform_float("color", self.color_timeline) self.batch_keyframes.draw(shader) # Show current frame line bgl.glLineWidth(1) if self.use_hud_playhead: playhead = [(self.cursor_x, self.my + self.playhead_size/2), (self.cursor_x, self.my - self.playhead_size/2)] batch = batch_for_shader(shader, 'LINES', {"pos": playhead}) shader.bind() shader.uniform_float("color", self.color_playhead) batch.draw(shader) # restore opengl defaults bgl.glDisable(bgl.GL_BLEND) # Display current frame text blf.color(font_id, *self.color_text) if self.use_hud_frame_current: blf.position(font_id, self.mouse[0]+10, self.mouse[1]+10, 0) blf.size(font_id, 30, self.dpi) blf.draw(font_id, f'{self.new_frame:.0f}') # Display frame offset text if self.use_hud_frame_offset: blf.position(font_id, self.mouse[0]+10, self.mouse[1]+(40*self.ui_scale), 0) blf.size(font_id, 16, self.dpi) sign = '+' if self.offset > 0 else '' blf.draw(font_id, f'{sign}{self.offset:.0f}')
def draw_gems(self, context, ratio_w=1, ratio_h=1): from_scene_scale = unit.Scale(context).from_scene view_normal = Vector((0.0, 0.0, 1.0)) @ self.region_3d.view_matrix angle_thold = pi / 1.8 fontid = 0 blf.size(fontid, self.prefs.view_font_size_gem_size, 72) blf.color(fontid, 0.0, 0.0, 0.0, 1.0) shader = gpu.shader.from_builtin("2D_UNIFORM_COLOR") depsgraph = context.depsgraph for dup in depsgraph.object_instances: if dup.is_instance: ob = dup.instance_object.original else: ob = dup.object.original if "gem" not in ob or (self.use_select and not ob.select_get()): continue shader.bind() ob_stone = ob["gem"]["stone"] ob_cut = ob["gem"]["cut"] ob_size = tuple(round(x, 2) for x in from_scene_scale(ob.dimensions, batch=True)) for stone, cut, size, size_fmt, color in self.gems_raw: if ob_stone == stone and ob_cut == cut and ob_size == size: shader.uniform_float("color", color) break me = ob.to_mesh(depsgraph, True) me.transform(dup.matrix_world) verts = me.vertices for poly in me.polygons: if view_normal.angle(poly.normal) < angle_thold: cos = [ loc_3d_to_2d(self.region, self.region_3d, verts[v].co, ratio_w, ratio_h) for v in poly.vertices ] batch = batch_for_shader(shader, "TRI_FAN", {"pos": cos}) batch.draw(shader) bpy.data.meshes.remove(me) # Size # ----------------------------- ob_loc = dup.matrix_world.translation.to_tuple() loc_x, loc_y = loc_3d_to_2d(self.region, self.region_3d, ob_loc, ratio_w, ratio_h) dim_x, dim_y = blf.dimensions(fontid, size_fmt) blf.position(fontid, loc_x - dim_x / 2, loc_y - dim_y / 2, 0.0) blf.draw(fontid, size_fmt)
def draw_text(text, size, y, color, context): font_id = 0 middle = int(context.region.width * 0.5) blf.size(font_id, size, SCREEN_DPI) blf.position(font_id, middle - blf.dimensions(font_id, text)[0] / 2, y, 0) blf.color(font_id, color.x, color.y, color.z, color.w) blf.draw(font_id, text)
def draw(self, ov_manager): if self.coords is None: return blf.color(ov_manager.font_id, *self.color) region_coord = ov_manager.context.region.view2d.view_to_region( self.coords[0], self.coords[1]) blf.position(ov_manager.font_id, region_coord[0], region_coord[1], 0) blf.draw(ov_manager.font_id, self.text)
def print_text(self, coords, text, color, z_coord=0.0): blf.size(self.font_id, self.TEXT_SIZE, 72) blf.color(self.font_id, *color) blf.position(self.font_id, coords[0], coords[1], z_coord) blf.draw(self.font_id, text) blf.color(self.font_id, *(0, 0, 0, 1))
def drawLines(self): offset = blf.dimensions(font, "Vg")[1] textBoundary = self.boundary.getInsetRectangle(self.padding) blf.color(font, 0, 0, 0, 1) for i, line in enumerate(self.lines): blf.position(font, textBoundary.left, textBoundary.top - i * self.lineHeight - offset, 0) blf.draw(font, line)
def draw_text(x, y, size, text, justify="left", color=(1.0, 1.0, 1.0, 1.0)): font_id = 0 blf.color(font_id, *color) if justify == "right": text_width, text_height = blf.dimensions(font_id, text) else: text_width = 0 blf.position(font_id, x - text_width, y, 0) blf.size(font_id, size, 72) blf.draw(font_id, text)
def draw(self): circle_co = draw_circle_2d((self._x, self._y), self._color, self._radius, 32) blf.size(1, 14, 72) blf.color(1, 0, 0, 0, 1) dim = blf.dimensions(1, self._axis) blf.position(1, self._x - dim[0] / 2, self._y - dim[1] / 2, 0) blf.draw(1, self._axis)
def draw_text(x_pos, y_pos, display_text, rgba, fsize, right=False): gap = 12 font_id = 0 blf.size(font_id, fsize, 72) text_width, text_height = blf.dimensions(font_id, display_text) if right is True: newx = x_pos - text_width - gap else: newx = x_pos blf.position(font_id, newx, y_pos, 0) blf.color(font_id, rgba[0], rgba[1], rgba[2], rgba[3]) blf.draw(font_id, display_text) return
def onscreen_warning(self, x, y): fontid = 1 blf.size(fontid, self.prefs.view_font_size_report, 72) blf.color(fontid, 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
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.preferences.system.dpi, 0 # self.cbuff[0:4] = self.colour # bgl.glEnableClientState(bgl.GL_COLOR_ARRAY) # bgl.glColorPointer(4, bgl.GL_FLOAT, 0, self.cbuff) blf.color(0, *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)
def onscreen_gem_table(self, x, y, color=(0.97, 0.97, 0.97, 1.0)): fontid = 1 blf.size(fontid, self.prefs.view_font_size_report, 72) blf.color(fontid, *color) _, font_h = blf.dimensions(fontid, "Row Height") font_baseline = font_h * 0.4 font_row_height = font_h * 2 box_size = font_h * 1.5 y += font_baseline for row, color in self.gems_fmt: y -= font_row_height shader.bind() shader.uniform_float("color", color) batch_font = batch_for_shader(shader, "TRI_FAN", {"pos": self.rect_coords(x, y, box_size, box_size)}) batch_font.draw(shader) blf.position(fontid, x + font_row_height, y + font_baseline, 0.0) blf.draw(fontid, row) return y
def set_blf_font_color(font_id, r, g, b, a): if check_version(2, 80, 0) >= 0: blf.color(font_id, r, g, b, a) else: bgl.glColor4f(r, g, b, a)
def onscreen_options(self, x, y): fontid = 1 blf.size(fontid, self.prefs.view_font_size_option, 72) font_w_1, font_h = blf.dimensions(fontid, self.option_col_1_max) font_w_2, _ = blf.dimensions(fontid, self.option_col_2_max) font_row_height = font_h * 1.5 for option, hotkey, value, prop_type in self.option_list: y -= font_row_height x_ofst = x blf.position(fontid, x, y, 0.0) blf.color(fontid, 0.97, 0.97, 0.97, 1.0) blf.draw(fontid, option) x_ofst += font_w_1 + 20 blf.position(fontid, x_ofst, y, 0.0) blf.color(fontid, 0.7, 0.7, 0.7, 1.0) blf.draw(fontid, hotkey) if prop_type == self.TYPE_BOOL: x_ofst += font_w_2 + 10 blf.position(fontid, x_ofst, y, 0.0) blf.color(fontid, 0.97, 0.97, 0.97, 1.0) blf.draw(fontid, ":") x_ofst += 20 blf.position(fontid, x_ofst, y, 0.0) if getattr(self, value): blf.color(fontid, 0.3, 1.0, 0.3, 1.0) blf.draw(fontid, "ON") else: blf.color(fontid, 1.0, 0.3, 0.3, 1.0) blf.draw(fontid, "OFF") else: if getattr(self, value): x_ofst += font_w_2 + 10 blf.position(fontid, x_ofst, y, 0.0) blf.color(fontid, 0.97, 0.97, 0.97, 1.0) blf.draw(fontid, ":") x_ofst += 20 blf.position(fontid, x_ofst, y, 0.0) blf.color(fontid, 0.9, 0.9, 0.0, 1.0) blf.draw(fontid, "PROCESSING...")