mirror of
https://github.com/blender/blender
synced 2026-11-22 03:45:13 +03:00
This commit bumps the `ios` branch from 5.0.0 alpha to 5.1.2 release. I merged v5.0-release first then v5.1-release. So it was a sequential merge. I'm just waiting to the approval of continuing development. The stuff that are missing (those are so close to implement): - #145484 iOS: Keyboard Input Support: https://projects.blender.org/blender/blender/pulls/145484 - #145702 iOS: Add clipboard Image: https://projects.blender.org/blender/blender/pulls/145702 - Fix QOS threading - Expose Downloads - UIScene Migration `make deps` needs to run two times. (still hacky....) OSL occurs racing conditions. Disclaimer: I used AI for searching in Documentation of Deps. So the implementation is by hand. **SACRED PINKY FINGER PROMISE** Pull Request: https://projects.blender.org/blender/blender/pulls/161073
45 lines
1.1 KiB
Python
45 lines
1.1 KiB
Python
"""
|
|
Hello World Text Example
|
|
++++++++++++++++++++++++
|
|
|
|
Example of using the blf module. For this module to work we
|
|
need to use the GPU module :mod:`gpu` as well.
|
|
"""
|
|
# Import stand alone modules.
|
|
import blf
|
|
import bpy
|
|
|
|
font_info = {
|
|
"font_id": 0,
|
|
"handler": None,
|
|
}
|
|
|
|
|
|
def init():
|
|
"""init function - runs once"""
|
|
import os
|
|
# Create a new font object, use external TTF file.
|
|
font_path = bpy.path.abspath('//Zeyada.ttf')
|
|
# Store the font index - to use later.
|
|
if os.path.exists(font_path):
|
|
font_info["font_id"] = blf.load(font_path)
|
|
else:
|
|
# Default font.
|
|
font_info["font_id"] = 0
|
|
|
|
# Set the font drawing routine to run every frame.
|
|
font_info["handler"] = bpy.types.SpaceView3D.draw_handler_add(
|
|
draw_callback_px, (None, None), 'WINDOW', 'POST_PIXEL')
|
|
|
|
|
|
def draw_callback_px(self, context):
|
|
"""Draw on the viewports"""
|
|
# BLF drawing routine.
|
|
font_id = font_info["font_id"]
|
|
blf.position(font_id, 2, 80, 0)
|
|
blf.size(font_id, 50.0)
|
|
blf.draw(font_id, "Hello World")
|
|
|
|
|
|
if __name__ == '__main__':
|
|
init()
|