31 lines
896 B
Python
31 lines
896 B
Python
import bpy
|
|
|
|
from ...common.viewport import draw_crop_settings
|
|
from .selection import CropImageSelection
|
|
|
|
|
|
class CropBoxTool(bpy.types.WorkSpaceTool):
|
|
bl_space_type = "VIEW_3D"
|
|
bl_context_mode = "OBJECT"
|
|
bl_idname = "anyimage.crop_box"
|
|
bl_label = "Crop Box"
|
|
bl_description = "Crop an Image Empty with a rectangular selection"
|
|
bl_icon = "ops.sculpt.border_mask"
|
|
bl_operator = CropImageSelection.bl_idname
|
|
bl_keymap = (
|
|
(
|
|
CropImageSelection.bl_idname,
|
|
{"type": "LEFTMOUSE", "value": "PRESS"},
|
|
{"properties": [("gesture", "BOX")]},
|
|
),
|
|
)
|
|
|
|
def draw_settings(context, layout, _tool):
|
|
draw_crop_settings(
|
|
context,
|
|
layout,
|
|
refine_selection="crop_box_refine_selection",
|
|
invert="crop_box_invert",
|
|
keep_original="crop_box_keep_original",
|
|
)
|