1 # SPDX-License-Identifier: GPL-2.0-or-later
4 from bpy
.types
import (
8 from . import utils_core
11 class BrushCurveMenu(Menu
):
13 bl_idname
= "VIEW3D_MT_sv3_brush_curve_menu"
16 def poll(self
, context
):
17 return utils_core
.get_mode() in (
18 'SCULPT', 'VERTEX_PAINT',
19 'WEIGHT_PAINT', 'TEXTURE_PAINT',
23 def draw(self
, context
):
25 curves
= (("Smooth", "SMOOTH", "SMOOTHCURVE"),
26 ("Sphere", "ROUND", "SPHERECURVE"),
27 ("Root", "ROOT", "ROOTCURVE"),
28 ("Sharp", "SHARP", "SHARPCURVE"),
29 ("Linear", "LINE", "LINCURVE"),
30 ("Constant", "MAX", "NOCURVE"))
33 layout
.row().operator(CurvePopup
.bl_idname
, icon
="RNDCURVE")
34 layout
.row().separator()
36 # add the rest of the menu items
38 item
= layout
.row().operator("brush.curve_preset",
39 text
=curve
[0], icon
=curve
[2])
43 class CurvePopup(Operator
):
44 """Edit Falloff Curve"""
45 bl_label
= "Adjust Curve"
46 bl_idname
= "view3d.sv3_curve_popup"
47 bl_description
= "Edit Falloff Curve"
48 bl_options
= {'REGISTER'}
51 def poll(self
, context
):
52 return utils_core
.get_mode() in (
53 'SCULPT', 'VERTEX_PAINT',
54 'WEIGHT_PAINT', 'TEXTURE_PAINT'
57 def draw(self
, context
):
59 has_brush
= utils_core
.get_brush_link(context
, types
="brush")
61 if utils_core
.get_mode() == 'SCULPT' or \
62 utils_core
.get_mode() == 'VERTEX_PAINT' or \
63 utils_core
.get_mode() == 'WEIGHT_PAINT' or \
64 utils_core
.get_mode() == 'TEXTURE_PAINT':
66 layout
.column().template_curve_mapping(has_brush
,
69 layout
.row().label(text
="No brushes available", icon
="INFO")
71 layout
.row().label(text
="No brushes available", icon
="INFO")
73 def execute(self
, context
):
74 return context
.window_manager
.invoke_popup(self
, width
=180)
84 bpy
.utils
.register_class(cls
)
88 bpy
.utils
.unregister_class(cls
)