2023-08-16 00:20:26 +10:00
|
|
|
# SPDX-FileCopyrightText: 2009-2023 Blender Authors
|
2023-06-15 13:09:04 +10:00
|
|
|
#
|
2022-02-11 09:07:11 +11:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
2023-06-15 13:09:04 +10:00
|
|
|
|
2023-09-05 16:44:08 +02:00
|
|
|
import bpy
|
|
|
|
|
from bpy.types import Panel, Menu, Operator
|
2013-02-10 09:09:26 +00:00
|
|
|
|
2011-09-20 18:29:19 +00:00
|
|
|
|
2015-01-29 15:35:06 +11:00
|
|
|
class ModifierButtonsPanel:
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_space_type = 'PROPERTIES'
|
|
|
|
|
bl_region_type = 'WINDOW'
|
|
|
|
|
bl_context = "modifier"
|
2012-03-10 20:08:25 +00:00
|
|
|
bl_options = {'HIDE_HEADER'}
|
2009-10-31 19:31:45 +00:00
|
|
|
|
2018-07-31 21:06:08 +10:00
|
|
|
|
2023-09-11 19:50:29 +02:00
|
|
|
class ModifierAddMenu:
|
2023-09-29 14:32:54 +10:00
|
|
|
MODIFIER_TYPES_TO_LABELS = {
|
|
|
|
|
enum_it.identifier: enum_it.name
|
2023-10-04 10:30:28 +11:00
|
|
|
for enum_it in bpy.types.Modifier.bl_rna.properties["type"].enum_items_static
|
2023-09-29 14:32:54 +10:00
|
|
|
}
|
|
|
|
|
MODIFIER_TYPES_TO_ICONS = {
|
|
|
|
|
enum_it.identifier: enum_it.icon
|
2023-10-04 10:30:28 +11:00
|
|
|
for enum_it in bpy.types.Modifier.bl_rna.properties["type"].enum_items_static
|
2023-09-29 14:32:54 +10:00
|
|
|
}
|
2023-10-04 10:30:28 +11:00
|
|
|
MODIFIER_TYPES_I18N_CONTEXT = bpy.types.Modifier.bl_rna.properties["type"].translation_context
|
2023-09-11 19:50:29 +02:00
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def operator_modifier_add(cls, layout, mod_type):
|
|
|
|
|
layout.operator(
|
|
|
|
|
"object.modifier_add",
|
|
|
|
|
text=cls.MODIFIER_TYPES_TO_LABELS[mod_type],
|
|
|
|
|
# Although these are operators, the label actually comes from an (enum) property,
|
|
|
|
|
# so the property's translation context must be used here.
|
|
|
|
|
text_ctxt=cls.MODIFIER_TYPES_I18N_CONTEXT,
|
|
|
|
|
icon=cls.MODIFIER_TYPES_TO_ICONS[mod_type],
|
|
|
|
|
).type = mod_type
|
|
|
|
|
|
|
|
|
|
|
2011-08-12 06:57:00 +00:00
|
|
|
class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
|
2009-10-31 19:31:45 +00:00
|
|
|
bl_label = "Modifiers"
|
|
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
@classmethod
|
|
|
|
|
def poll(cls, context):
|
|
|
|
|
ob = context.object
|
|
|
|
|
return ob and ob.type != 'GPENCIL'
|
|
|
|
|
|
2021-03-06 18:21:17 +11:00
|
|
|
def draw(self, _context):
|
2009-10-31 19:31:45 +00:00
|
|
|
layout = self.layout
|
2023-09-06 19:15:47 +10:00
|
|
|
layout.operator("wm.call_menu", text="Add Modifier", icon='ADD').name = "OBJECT_MT_modifier_add"
|
2020-06-05 10:41:03 -04:00
|
|
|
layout.template_modifiers()
|
2020-05-13 12:39:17 +02:00
|
|
|
|
2013-12-22 07:08:35 +11:00
|
|
|
|
2023-09-11 19:50:29 +02:00
|
|
|
class OBJECT_MT_modifier_add(ModifierAddMenu, Menu):
|
2023-09-05 14:47:18 +02:00
|
|
|
bl_label = "Add Modifier"
|
2023-10-12 17:54:59 +02:00
|
|
|
bl_options = {'SEARCH_ON_KEY_PRESS'}
|
2023-09-05 14:47:18 +02:00
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
|
layout = self.layout
|
2024-05-01 14:15:53 +02:00
|
|
|
ob = context.object
|
|
|
|
|
if not ob:
|
|
|
|
|
return
|
|
|
|
|
ob_type = ob.type
|
2024-04-30 12:46:05 +10:00
|
|
|
geometry_nodes_supported = ob_type in {
|
|
|
|
|
'MESH', 'CURVE', 'CURVES',
|
|
|
|
|
'FONT', 'VOLUME', 'POINTCLOUD', 'GREASEPENCIL',
|
|
|
|
|
}
|
2023-10-12 17:54:59 +02:00
|
|
|
|
|
|
|
|
if layout.operator_context == 'EXEC_REGION_WIN':
|
|
|
|
|
layout.operator_context = 'INVOKE_REGION_WIN'
|
2023-10-13 07:38:24 +02:00
|
|
|
layout.operator("WM_OT_search_single_menu", text="Search...",
|
|
|
|
|
icon='VIEWZOOM').menu_idname = "OBJECT_MT_modifier_add"
|
2023-10-12 17:54:59 +02:00
|
|
|
layout.separator()
|
|
|
|
|
|
2024-04-18 17:40:50 +02:00
|
|
|
layout.operator_context = 'INVOKE_REGION_WIN'
|
2023-10-12 17:54:59 +02:00
|
|
|
|
2023-09-05 14:47:18 +02:00
|
|
|
if geometry_nodes_supported:
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'NODES')
|
2023-09-06 08:59:40 -04:00
|
|
|
layout.separator()
|
2024-02-16 12:30:43 +01:00
|
|
|
if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE', 'LATTICE', 'GREASEPENCIL'}:
|
2023-09-05 14:47:18 +02:00
|
|
|
layout.menu("OBJECT_MT_modifier_add_edit")
|
2024-01-18 13:02:53 +01:00
|
|
|
if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE', 'VOLUME', 'GREASEPENCIL'}:
|
2023-09-05 14:47:18 +02:00
|
|
|
layout.menu("OBJECT_MT_modifier_add_generate")
|
2024-01-24 04:36:36 +01:00
|
|
|
if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE', 'LATTICE', 'VOLUME', 'GREASEPENCIL'}:
|
2023-09-05 14:47:18 +02:00
|
|
|
layout.menu("OBJECT_MT_modifier_add_deform")
|
|
|
|
|
if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE', 'LATTICE'}:
|
|
|
|
|
layout.menu("OBJECT_MT_modifier_add_physics")
|
2024-01-19 11:35:26 +01:00
|
|
|
if ob_type in {'GREASEPENCIL'}:
|
|
|
|
|
layout.menu("OBJECT_MT_modifier_add_color")
|
2023-09-05 14:47:18 +02:00
|
|
|
|
|
|
|
|
if geometry_nodes_supported:
|
|
|
|
|
layout.menu_contents("OBJECT_MT_modifier_add_root_catalogs")
|
|
|
|
|
|
|
|
|
|
|
2023-09-11 19:50:29 +02:00
|
|
|
class OBJECT_MT_modifier_add_edit(ModifierAddMenu, Menu):
|
2023-09-05 14:47:18 +02:00
|
|
|
bl_label = "Edit"
|
2023-10-12 17:54:59 +02:00
|
|
|
bl_options = {'SEARCH_ON_KEY_PRESS'}
|
2023-09-05 14:47:18 +02:00
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
|
layout = self.layout
|
|
|
|
|
ob_type = context.object.type
|
|
|
|
|
if ob_type == 'MESH':
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'DATA_TRANSFER')
|
2023-09-05 14:47:18 +02:00
|
|
|
if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE', 'LATTICE'}:
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'MESH_CACHE')
|
2023-09-05 14:47:18 +02:00
|
|
|
if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE'}:
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'MESH_SEQUENCE_CACHE')
|
2023-09-05 14:47:18 +02:00
|
|
|
if ob_type == 'MESH':
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'NORMAL_EDIT')
|
|
|
|
|
self.operator_modifier_add(layout, 'WEIGHTED_NORMAL')
|
|
|
|
|
self.operator_modifier_add(layout, 'UV_PROJECT')
|
|
|
|
|
self.operator_modifier_add(layout, 'UV_WARP')
|
|
|
|
|
self.operator_modifier_add(layout, 'VERTEX_WEIGHT_EDIT')
|
|
|
|
|
self.operator_modifier_add(layout, 'VERTEX_WEIGHT_MIX')
|
|
|
|
|
self.operator_modifier_add(layout, 'VERTEX_WEIGHT_PROXIMITY')
|
2024-02-16 12:30:43 +01:00
|
|
|
if ob_type == 'GREASEPENCIL':
|
2024-03-29 21:42:30 +01:00
|
|
|
self.operator_modifier_add(layout, 'GREASE_PENCIL_TEXTURE')
|
2024-02-27 14:17:22 +01:00
|
|
|
self.operator_modifier_add(layout, 'GREASE_PENCIL_TIME')
|
2024-02-19 11:16:38 +01:00
|
|
|
self.operator_modifier_add(layout, 'GREASE_PENCIL_VERTEX_WEIGHT_PROXIMITY')
|
2024-02-16 12:30:43 +01:00
|
|
|
self.operator_modifier_add(layout, 'GREASE_PENCIL_VERTEX_WEIGHT_ANGLE')
|
2023-09-05 14:47:18 +02:00
|
|
|
layout.template_modifier_asset_menu_items(catalog_path=self.bl_label)
|
|
|
|
|
|
|
|
|
|
|
2023-09-11 19:50:29 +02:00
|
|
|
class OBJECT_MT_modifier_add_generate(ModifierAddMenu, Menu):
|
2023-09-05 14:47:18 +02:00
|
|
|
bl_label = "Generate"
|
2023-10-12 17:54:59 +02:00
|
|
|
bl_options = {'SEARCH_ON_KEY_PRESS'}
|
2023-09-05 14:47:18 +02:00
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
|
layout = self.layout
|
|
|
|
|
ob_type = context.object.type
|
|
|
|
|
if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE'}:
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'ARRAY')
|
|
|
|
|
self.operator_modifier_add(layout, 'BEVEL')
|
2023-09-05 14:47:18 +02:00
|
|
|
if ob_type == 'MESH':
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'BOOLEAN')
|
2023-09-05 14:47:18 +02:00
|
|
|
if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE'}:
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'BUILD')
|
|
|
|
|
self.operator_modifier_add(layout, 'DECIMATE')
|
|
|
|
|
self.operator_modifier_add(layout, 'EDGE_SPLIT')
|
2023-09-05 14:47:18 +02:00
|
|
|
if ob_type == 'MESH':
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'MASK')
|
2023-09-05 14:47:18 +02:00
|
|
|
if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE'}:
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'MIRROR')
|
2023-09-05 14:47:18 +02:00
|
|
|
if ob_type == 'VOLUME':
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'MESH_TO_VOLUME')
|
2023-09-05 14:47:18 +02:00
|
|
|
if ob_type == 'MESH':
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'MULTIRES')
|
2023-09-05 14:47:18 +02:00
|
|
|
if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE'}:
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'REMESH')
|
|
|
|
|
self.operator_modifier_add(layout, 'SCREW')
|
2023-09-05 14:47:18 +02:00
|
|
|
if ob_type == 'MESH':
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'SKIN')
|
2023-09-05 14:47:18 +02:00
|
|
|
if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE'}:
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'SOLIDIFY')
|
|
|
|
|
self.operator_modifier_add(layout, 'SUBSURF')
|
|
|
|
|
self.operator_modifier_add(layout, 'TRIANGULATE')
|
2023-09-05 14:47:18 +02:00
|
|
|
if ob_type == 'MESH':
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'VOLUME_TO_MESH')
|
2023-09-05 14:47:18 +02:00
|
|
|
if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE'}:
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'WELD')
|
2023-09-05 14:47:18 +02:00
|
|
|
if ob_type == 'MESH':
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'WIREFRAME')
|
2024-01-18 13:02:53 +01:00
|
|
|
if ob_type == 'GREASEPENCIL':
|
2024-02-16 14:04:01 +01:00
|
|
|
self.operator_modifier_add(layout, 'GREASE_PENCIL_ARRAY')
|
2024-03-20 13:28:28 +01:00
|
|
|
self.operator_modifier_add(layout, 'GREASE_PENCIL_BUILD')
|
2024-02-08 15:35:20 +01:00
|
|
|
self.operator_modifier_add(layout, 'GREASE_PENCIL_DASH')
|
2024-03-01 10:42:41 +01:00
|
|
|
self.operator_modifier_add(layout, 'GREASE_PENCIL_ENVELOPE')
|
2024-02-15 16:37:54 +01:00
|
|
|
self.operator_modifier_add(layout, 'GREASE_PENCIL_LENGTH')
|
2024-01-30 12:10:33 +01:00
|
|
|
self.operator_modifier_add(layout, 'GREASE_PENCIL_MIRROR')
|
2024-02-15 14:19:50 +01:00
|
|
|
self.operator_modifier_add(layout, 'GREASE_PENCIL_MULTIPLY')
|
2024-03-04 16:54:07 +01:00
|
|
|
self.operator_modifier_add(layout, 'GREASE_PENCIL_OUTLINE')
|
2024-03-28 18:16:14 +01:00
|
|
|
self.operator_modifier_add(layout, 'GREASE_PENCIL_SIMPLIFY')
|
2024-01-24 21:19:18 +08:00
|
|
|
self.operator_modifier_add(layout, 'GREASE_PENCIL_SUBDIV')
|
2024-02-26 15:28:15 +01:00
|
|
|
self.operator_modifier_add(layout, 'LINEART')
|
2023-09-05 14:47:18 +02:00
|
|
|
layout.template_modifier_asset_menu_items(catalog_path=self.bl_label)
|
|
|
|
|
|
|
|
|
|
|
2023-09-11 19:50:29 +02:00
|
|
|
class OBJECT_MT_modifier_add_deform(ModifierAddMenu, Menu):
|
2023-09-05 14:47:18 +02:00
|
|
|
bl_label = "Deform"
|
2023-10-12 17:54:59 +02:00
|
|
|
bl_options = {'SEARCH_ON_KEY_PRESS'}
|
2023-09-05 14:47:18 +02:00
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
|
layout = self.layout
|
|
|
|
|
ob_type = context.object.type
|
|
|
|
|
if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE', 'LATTICE'}:
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'ARMATURE')
|
|
|
|
|
self.operator_modifier_add(layout, 'CAST')
|
|
|
|
|
self.operator_modifier_add(layout, 'CURVE')
|
2023-09-05 14:47:18 +02:00
|
|
|
if ob_type == 'MESH':
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'DISPLACE')
|
2023-09-05 14:47:18 +02:00
|
|
|
if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE', 'LATTICE'}:
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'HOOK')
|
2023-09-05 14:47:18 +02:00
|
|
|
if ob_type == 'MESH':
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'LAPLACIANDEFORM')
|
2023-09-05 14:47:18 +02:00
|
|
|
if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE', 'LATTICE'}:
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'LATTICE')
|
|
|
|
|
self.operator_modifier_add(layout, 'MESH_DEFORM')
|
|
|
|
|
self.operator_modifier_add(layout, 'SHRINKWRAP')
|
|
|
|
|
self.operator_modifier_add(layout, 'SIMPLE_DEFORM')
|
2023-09-05 14:47:18 +02:00
|
|
|
if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE'}:
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'SMOOTH')
|
2023-09-05 14:47:18 +02:00
|
|
|
if ob_type == 'MESH':
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'CORRECTIVE_SMOOTH')
|
|
|
|
|
self.operator_modifier_add(layout, 'LAPLACIANSMOOTH')
|
|
|
|
|
self.operator_modifier_add(layout, 'SURFACE_DEFORM')
|
2023-09-05 14:47:18 +02:00
|
|
|
if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE', 'LATTICE'}:
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'WARP')
|
|
|
|
|
self.operator_modifier_add(layout, 'WAVE')
|
2023-09-05 14:47:18 +02:00
|
|
|
if ob_type == 'VOLUME':
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'VOLUME_DISPLACE')
|
2024-01-24 04:36:36 +01:00
|
|
|
if ob_type == 'GREASEPENCIL':
|
2024-02-26 19:36:10 +01:00
|
|
|
self.operator_modifier_add(layout, 'GREASE_PENCIL_ARMATURE')
|
2024-02-21 14:20:47 +01:00
|
|
|
self.operator_modifier_add(layout, 'GREASE_PENCIL_HOOK')
|
2024-02-08 14:09:11 +01:00
|
|
|
self.operator_modifier_add(layout, 'GREASE_PENCIL_LATTICE')
|
2024-01-29 16:49:16 +01:00
|
|
|
self.operator_modifier_add(layout, 'GREASE_PENCIL_NOISE')
|
2024-01-30 13:04:30 +01:00
|
|
|
self.operator_modifier_add(layout, 'GREASE_PENCIL_OFFSET')
|
2024-03-06 12:05:00 +01:00
|
|
|
self.operator_modifier_add(layout, 'GREASE_PENCIL_SHRINKWRAP')
|
2024-01-30 13:04:30 +01:00
|
|
|
self.operator_modifier_add(layout, 'GREASE_PENCIL_SMOOTH')
|
|
|
|
|
self.operator_modifier_add(layout, 'GREASE_PENCIL_THICKNESS')
|
2023-09-05 14:47:18 +02:00
|
|
|
layout.template_modifier_asset_menu_items(catalog_path=self.bl_label)
|
|
|
|
|
|
|
|
|
|
|
2023-09-11 19:50:29 +02:00
|
|
|
class OBJECT_MT_modifier_add_physics(ModifierAddMenu, Menu):
|
2023-09-05 14:47:18 +02:00
|
|
|
bl_label = "Physics"
|
2023-10-12 17:54:59 +02:00
|
|
|
bl_options = {'SEARCH_ON_KEY_PRESS'}
|
2023-09-05 14:47:18 +02:00
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
|
layout = self.layout
|
|
|
|
|
ob_type = context.object.type
|
|
|
|
|
if ob_type == 'MESH':
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'CLOTH')
|
|
|
|
|
self.operator_modifier_add(layout, 'COLLISION')
|
|
|
|
|
self.operator_modifier_add(layout, 'DYNAMIC_PAINT')
|
|
|
|
|
self.operator_modifier_add(layout, 'EXPLODE')
|
|
|
|
|
self.operator_modifier_add(layout, 'FLUID')
|
|
|
|
|
self.operator_modifier_add(layout, 'OCEAN')
|
|
|
|
|
self.operator_modifier_add(layout, 'PARTICLE_INSTANCE')
|
|
|
|
|
self.operator_modifier_add(layout, 'PARTICLE_SYSTEM')
|
2023-09-05 14:47:18 +02:00
|
|
|
if ob_type in {'MESH', 'CURVE', 'FONT', 'SURFACE', 'LATTICE'}:
|
2023-09-11 19:50:29 +02:00
|
|
|
self.operator_modifier_add(layout, 'SOFT_BODY')
|
2023-09-05 14:47:18 +02:00
|
|
|
layout.template_modifier_asset_menu_items(catalog_path=self.bl_label)
|
|
|
|
|
|
|
|
|
|
|
2024-01-19 11:35:26 +01:00
|
|
|
class OBJECT_MT_modifier_add_color(ModifierAddMenu, Menu):
|
|
|
|
|
bl_label = "Color"
|
|
|
|
|
bl_options = {'SEARCH_ON_KEY_PRESS'}
|
|
|
|
|
|
|
|
|
|
def draw(self, context):
|
|
|
|
|
layout = self.layout
|
|
|
|
|
ob_type = context.object.type
|
|
|
|
|
if ob_type == 'GREASEPENCIL':
|
2024-01-19 16:59:39 +01:00
|
|
|
self.operator_modifier_add(layout, 'GREASE_PENCIL_COLOR')
|
|
|
|
|
self.operator_modifier_add(layout, 'GREASE_PENCIL_TINT')
|
2024-01-19 11:35:26 +01:00
|
|
|
self.operator_modifier_add(layout, 'GREASE_PENCIL_OPACITY')
|
|
|
|
|
layout.template_modifier_asset_menu_items(catalog_path=self.bl_label)
|
|
|
|
|
|
|
|
|
|
|
2018-07-31 10:22:19 +02:00
|
|
|
class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
|
|
|
|
|
bl_label = "Modifiers"
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def poll(cls, context):
|
|
|
|
|
ob = context.object
|
|
|
|
|
return ob and ob.type == 'GPENCIL'
|
|
|
|
|
|
2021-03-06 18:21:17 +11:00
|
|
|
def draw(self, _context):
|
2018-07-31 10:22:19 +02:00
|
|
|
layout = self.layout
|
|
|
|
|
layout.operator_menu_enum("object.gpencil_modifier_add", "type")
|
2020-06-19 14:42:08 -04:00
|
|
|
layout.template_grease_pencil_modifiers()
|
2019-11-14 19:18:23 +01:00
|
|
|
|
2019-12-16 14:29:03 +11:00
|
|
|
|
2023-09-05 16:44:08 +02:00
|
|
|
class AddModifierMenu(Operator):
|
|
|
|
|
bl_idname = "object.add_modifier_menu"
|
|
|
|
|
bl_label = "Add Modifier"
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def poll(cls, context):
|
2023-09-07 07:54:29 -04:00
|
|
|
# NOTE: This operator only exists to add a poll to the add modifier shortcut in the property editor.
|
2023-11-09 11:57:07 +01:00
|
|
|
object = context.object
|
2023-09-05 16:44:08 +02:00
|
|
|
space = context.space_data
|
2023-11-09 11:57:07 +01:00
|
|
|
if object and object.type == 'GPENCIL':
|
|
|
|
|
return False
|
2023-09-13 13:36:00 +10:00
|
|
|
return space and space.type == 'PROPERTIES' and space.context == 'MODIFIER'
|
2023-09-05 16:44:08 +02:00
|
|
|
|
|
|
|
|
def invoke(self, context, event):
|
|
|
|
|
return bpy.ops.wm.call_menu(name="OBJECT_MT_modifier_add")
|
|
|
|
|
|
|
|
|
|
|
2017-03-18 20:03:24 +11:00
|
|
|
classes = (
|
|
|
|
|
DATA_PT_modifiers,
|
2023-09-05 14:47:18 +02:00
|
|
|
OBJECT_MT_modifier_add,
|
|
|
|
|
OBJECT_MT_modifier_add_edit,
|
|
|
|
|
OBJECT_MT_modifier_add_generate,
|
|
|
|
|
OBJECT_MT_modifier_add_deform,
|
|
|
|
|
OBJECT_MT_modifier_add_physics,
|
2024-01-19 11:35:26 +01:00
|
|
|
OBJECT_MT_modifier_add_color,
|
2018-07-31 10:22:19 +02:00
|
|
|
DATA_PT_gpencil_modifiers,
|
2023-09-05 16:44:08 +02:00
|
|
|
AddModifierMenu,
|
2017-03-18 20:03:24 +11:00
|
|
|
)
|
|
|
|
|
|
2011-04-04 10:13:04 +00:00
|
|
|
if __name__ == "__main__": # only for live edit.
|
2017-03-18 20:03:24 +11:00
|
|
|
from bpy.utils import register_class
|
2020-03-09 16:27:24 +01:00
|
|
|
|
2017-03-18 20:03:24 +11:00
|
|
|
for cls in classes:
|
|
|
|
|
register_class(cls)
|