Support Blender 4.0
This commit is contained in:
+11
-10
@@ -1,5 +1,5 @@
|
||||
'''
|
||||
Copyright (C) 2021 - 2023 Akaneyu
|
||||
Copyright (C) 2021 - 2024 Akaneyu
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -152,22 +152,23 @@ def draw_handler():
|
||||
or area_session.layer_rotating \
|
||||
or area_session.layer_scaling:
|
||||
|
||||
info_text = "LMB: Perform\n" \
|
||||
info_text = "LMB: Perform " \
|
||||
+ "RMB: Cancel"
|
||||
|
||||
area_height = context.area.height
|
||||
area_width = context.area.width
|
||||
|
||||
# info text
|
||||
if info_text:
|
||||
blf.enable(0, blf.WORD_WRAP)
|
||||
blf.word_wrap(0, 100)
|
||||
ui_scale = context.preferences.system.ui_scale
|
||||
|
||||
blf.position(0, 30, area_height - 70, 0)
|
||||
blf.size(0, 14, 72)
|
||||
session.ui_renderer.render_info_box((0, 0), (area_width, 20 * ui_scale))
|
||||
|
||||
blf.position(0, 8 * ui_scale, 6 * ui_scale, 0)
|
||||
blf.size(0, 11 * ui_scale) if bpy.app.version >= (3, 6) \
|
||||
else blf.size(0, 11 * ui_scale, 72)
|
||||
blf.color(0, 0.7, 0.7, 0.7, 1.0)
|
||||
blf.draw(0, info_text)
|
||||
|
||||
blf.disable(0, blf.WORD_WRAP)
|
||||
|
||||
def get_curve_node():
|
||||
node_group = bpy.data.node_groups.get('imageeditorplus')
|
||||
if not node_group:
|
||||
@@ -392,7 +393,7 @@ def apply_layer_transform(img, rot, scale):
|
||||
|
||||
buff, width, height = session.ui_renderer.render_image_offscreen(img, rot, scale)
|
||||
|
||||
pixels = np.reshape(buff, (height, width, 4)).astype(np.float32) / 255.0
|
||||
pixels = np.array([[pixel for pixel in row] for row in buff], np.float32) / 255.0
|
||||
|
||||
# gamma correction
|
||||
utils.convert_colorspace(pixels, 'Linear',
|
||||
|
||||
Reference in New Issue
Block a user