Media Viewer: Update for 4.x #169
@ -16,7 +16,6 @@ from copy import copy
|
||||
|
||||
import bpy
|
||||
import gpu
|
||||
import bgl
|
||||
import blf
|
||||
from gpu_extras.batch import batch_for_shader
|
||||
from bpy.app.handlers import persistent
|
||||
@ -94,7 +93,7 @@ def draw_toggle(region_name: str):
|
||||
bot_right = (top_left[0] + width, top_left[1] - height)
|
||||
|
||||
coordinates = [top_left, top_right, bot_left, bot_right]
|
||||
shader = gpu.shader.from_builtin("2D_UNIFORM_COLOR")
|
||||
shader = gpu.shader.from_builtin("UNIFORM_COLOR")
|
||||
batch = batch_for_shader(
|
||||
shader,
|
||||
"TRIS",
|
||||
@ -114,7 +113,7 @@ def draw_text(region_name: str):
|
||||
y = region.height + offset_y
|
||||
x = 0 + offset_x
|
||||
font_id = 0
|
||||
bgl.glEnable(bgl.GL_BLEND)
|
||||
gpu.state.blend_set('ALPHA')
|
||||
blf.position(font_id, x, y, 0)
|
||||
blf.size(font_id, 12, 72)
|
||||
blf.color(font_id, 1, 1, 1, 0.9)
|
||||
@ -375,7 +374,7 @@ class ButtonDrawer:
|
||||
def __init__(
|
||||
self,
|
||||
):
|
||||
self._shader = gpu.shader.from_builtin("2D_UNIFORM_COLOR")
|
||||
self._shader = gpu.shader.from_builtin("UNIFORM_COLOR")
|
||||
self.draw_arrow = True
|
||||
self.draw_rect = False
|
||||
self._arrow_direction = "UP"
|
||||
@ -398,8 +397,8 @@ class ButtonDrawer:
|
||||
def draw_button(
|
||||
self, button: Button, region: bpy.types.Region, color: Float4
|
||||
) -> None:
|
||||
bgl.glEnable(bgl.GL_BLEND)
|
||||
bgl.glLineWidth(0)
|
||||
gpu.state.blend_set('ALPHA')
|
||||
gpu.state.line_width_set(0)
|
||||
coords = button.get_region_coords(region)
|
||||
|
||||
# Draw rectangle.
|
||||
@ -441,7 +440,7 @@ class ButtonDrawer:
|
||||
return
|
||||
|
||||
# Create line batch and draw it.
|
||||
bgl.glLineWidth(3)
|
||||
gpu.state.line_width_set(3)
|
||||
self._shader.bind()
|
||||
self._shader.uniform_float("color", color)
|
||||
# print(f"Drawing points: {line_pos}")
|
||||
|
@ -625,7 +625,9 @@ class MV_OT_set_media_area_type(bpy.types.Operator):
|
||||
|
||||
# Set annotate tool as active.
|
||||
if area_media.type in ["SEQUENCE_EDITOR", "IMAGE_EDITOR"]:
|
||||
bpy.ops.wm.tool_set_by_id({"area": area_media}, name="builtin.annotate")
|
||||
ctx = opsdata.get_context_for_area(area_media)
|
||||
with context.temp_override(**ctx):
|
||||
bpy.ops.wm.tool_set_by_id(name="builtin.annotate")
|
||||
|
||||
logger.info(f"Changed active media area to: {area_media.type}")
|
||||
|
||||
|
@ -216,7 +216,7 @@ def close_area(context: bpy.types.Context, area: bpy.types.Area) -> None:
|
||||
def setup_filebrowser_area(filebrowser_area: bpy.types.Area) -> None:
|
||||
params = filebrowser_area.spaces.active.params
|
||||
params.display_type = "THUMBNAIL"
|
||||
params.display_size = "NORMAL"
|
||||
params.display_size_discrete = "NORMAL"
|
||||
params.use_filter = True
|
||||
params.use_filter_image = True
|
||||
params.use_filter_folder = True
|
||||
|
@ -88,7 +88,7 @@ class SpaceData:
|
||||
class FbParams:
|
||||
directory: str = ""
|
||||
display_type: str = "THUMBNAIL"
|
||||
display_size: str = "NORMAL"
|
||||
display_size_discrete: str = "NORMAL"
|
||||
use_filter: bool = True
|
||||
use_filter_image: bool = True
|
||||
use_filter_folder: bool = True
|
||||
|
Loading…
Reference in New Issue
Block a user