4.3 Compatibility & Editable Hotkeys #1
@ -1,7 +1,7 @@
|
||||
schema_version = "1.0.0"
|
||||
id = "viewport_pie_menus"
|
||||
name = "3D Viewport Pie Menus"
|
||||
version = "1.3.0"
|
||||
version = "1.3.1"
|
||||
tagline = "Pie Menu Activation"
|
||||
maintainer = "Community"
|
||||
type = "add-on"
|
||||
@ -10,3 +10,5 @@ blender_version_min = "4.2.0"
|
||||
license = ["SPDX:GPL-2.0-or-later"]
|
||||
website = "https://projects.blender.org/extensions/space_view3d_pie_menus"
|
||||
copyright = ["2024 meta-androcto"]
|
||||
[permissions]
|
||||
files = "To load brush icons from disk"
|
BIN
source/icons/brush.sculpt.blob.dat
Normal file
BIN
source/icons/brush.sculpt.blob.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.boundary.dat
Normal file
BIN
source/icons/brush.sculpt.boundary.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.clay.dat
Normal file
BIN
source/icons/brush.sculpt.clay.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.clay_strips.dat
Normal file
BIN
source/icons/brush.sculpt.clay_strips.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.clay_thumb.dat
Normal file
BIN
source/icons/brush.sculpt.clay_thumb.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.cloth.dat
Normal file
BIN
source/icons/brush.sculpt.cloth.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.crease.dat
Normal file
BIN
source/icons/brush.sculpt.crease.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.displacement_eraser.dat
Normal file
BIN
source/icons/brush.sculpt.displacement_eraser.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.displacement_smear.dat
Normal file
BIN
source/icons/brush.sculpt.displacement_smear.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.draw.dat
Normal file
BIN
source/icons/brush.sculpt.draw.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.draw_face_sets.dat
Normal file
BIN
source/icons/brush.sculpt.draw_face_sets.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.draw_sharp.dat
Normal file
BIN
source/icons/brush.sculpt.draw_sharp.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.elastic_deform.dat
Normal file
BIN
source/icons/brush.sculpt.elastic_deform.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.fill.dat
Normal file
BIN
source/icons/brush.sculpt.fill.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.flatten.dat
Normal file
BIN
source/icons/brush.sculpt.flatten.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.grab.dat
Normal file
BIN
source/icons/brush.sculpt.grab.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.inflate.dat
Normal file
BIN
source/icons/brush.sculpt.inflate.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.layer.dat
Normal file
BIN
source/icons/brush.sculpt.layer.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.mask.dat
Normal file
BIN
source/icons/brush.sculpt.mask.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.multiplane_scrape.dat
Normal file
BIN
source/icons/brush.sculpt.multiplane_scrape.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.nudge.dat
Normal file
BIN
source/icons/brush.sculpt.nudge.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.paint.dat
Normal file
BIN
source/icons/brush.sculpt.paint.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.pinch.dat
Normal file
BIN
source/icons/brush.sculpt.pinch.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.pose.dat
Normal file
BIN
source/icons/brush.sculpt.pose.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.rotate.dat
Normal file
BIN
source/icons/brush.sculpt.rotate.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.scrape.dat
Normal file
BIN
source/icons/brush.sculpt.scrape.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.simplify.dat
Normal file
BIN
source/icons/brush.sculpt.simplify.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.smear.dat
Normal file
BIN
source/icons/brush.sculpt.smear.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.smooth.dat
Normal file
BIN
source/icons/brush.sculpt.smooth.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.snake_hook.dat
Normal file
BIN
source/icons/brush.sculpt.snake_hook.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.thumb.dat
Normal file
BIN
source/icons/brush.sculpt.thumb.dat
Normal file
Binary file not shown.
BIN
source/icons/brush.sculpt.topology.dat
Normal file
BIN
source/icons/brush.sculpt.topology.dat
Normal file
Binary file not shown.
@ -6,35 +6,21 @@ bl_info = {
|
||||
"name": "Hotkey: 'W'",
|
||||
"description": "Sculpt Brush Menu",
|
||||
"author": "pitiwazou, meta-androcto",
|
||||
"version": (0, 1, 0),
|
||||
"blender": (2, 80, 0),
|
||||
"version": (1, 4, 1),
|
||||
"blender": (4, 3, 0),
|
||||
"location": "W key",
|
||||
"warning": "",
|
||||
"doc_url": "",
|
||||
"category": "Sculpt Pie"
|
||||
"category": "Sculpt Pie",
|
||||
}
|
||||
|
||||
import os
|
||||
import bpy
|
||||
from bpy.types import (
|
||||
Menu,
|
||||
Operator,
|
||||
)
|
||||
from bpy.types import Menu
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
# Sculpt Draw
|
||||
class PIE_OT_SculptSculptDraw(Operator):
|
||||
bl_idname = "sculpt.sculptraw"
|
||||
bl_label = "Sculpt SculptDraw"
|
||||
bl_options = {'REGISTER', 'UNDO'}
|
||||
|
||||
def execute(self, context):
|
||||
context.tool_settings.sculpt.brush = bpy.data.brushes['SculptDraw']
|
||||
return {'FINISHED'}
|
||||
|
||||
|
||||
# Pie Sculp Pie Menus - W
|
||||
class PIE_MT_SculptPie(Menu):
|
||||
# Pie Sculpt Pie Menus - W
|
||||
class PIE_MT_sculpt_brush_select(Menu):
|
||||
bl_idname = "PIE_MT_sculpt"
|
||||
bl_label = "Pie Sculpt"
|
||||
|
||||
@ -43,77 +29,102 @@ class PIE_MT_SculptPie(Menu):
|
||||
layout = self.layout
|
||||
pie = layout.menu_pie()
|
||||
pie.scale_y = 1.2
|
||||
|
||||
# 4 - LEFT
|
||||
pie.operator("paint.brush_select",
|
||||
text=" Crease", icon_value=brush_icons["crease"]).sculpt_tool = 'CREASE'
|
||||
draw_brush_operator(pie, 'Crease', 'crease')
|
||||
# 6 - RIGHT
|
||||
pie.operator("paint.brush_select",
|
||||
text=" Blob", icon_value=brush_icons["blob"]).sculpt_tool = 'BLOB'
|
||||
draw_brush_operator(pie, 'Blob', 'blob')
|
||||
# 2 - BOTTOM
|
||||
pie.menu(PIE_MT_Sculpttwo.bl_idname, text="More Brushes")
|
||||
pie.menu(PIE_MT_sculpt_brush_select_misc.bl_idname, text="More Brushes")
|
||||
# 8 - TOP
|
||||
pie.operator("sculpt.sculptraw",
|
||||
text=" Draw", icon_value=brush_icons["draw"])
|
||||
draw_brush_operator(pie, 'Draw', 'draw')
|
||||
# 7 - TOP - LEFT
|
||||
pie.operator("paint.brush_select",
|
||||
text=" Clay", icon_value=brush_icons["clay"]).sculpt_tool = 'CLAY'
|
||||
draw_brush_operator(pie, 'Clay', 'clay')
|
||||
# 9 - TOP - RIGHT
|
||||
pie.operator("paint.brush_select",
|
||||
text=" Clay Strips", icon_value=brush_icons["clay_strips"]).sculpt_tool = 'CLAY_STRIPS'
|
||||
draw_brush_operator(pie, 'Clay Strips', 'clay_strips')
|
||||
# 1 - BOTTOM - LEFT
|
||||
pie.operator("paint.brush_select",
|
||||
text=" Inflate/Deflate", icon_value=brush_icons["inflate"]).sculpt_tool = 'INFLATE'
|
||||
draw_brush_operator(pie, 'Inflate/Deflate', 'inflate')
|
||||
# 3 - BOTTOM - RIGHT
|
||||
pie.menu(PIE_MT_Sculptthree.bl_idname,
|
||||
text=" Grab Brushes", icon_value=brush_icons["grab"])
|
||||
pie.menu(
|
||||
PIE_MT_sculpt_brush_select_grab.bl_idname,
|
||||
text=" Grab Brushes",
|
||||
icon_value=brush_icons["grab"],
|
||||
)
|
||||
|
||||
|
||||
# Pie Sculpt 2
|
||||
class PIE_MT_Sculpttwo(Menu):
|
||||
bl_idname = "PIE_MT_sculpttwo"
|
||||
bl_label = "Pie Sculpt 2"
|
||||
class PIE_MT_sculpt_brush_select_misc(Menu):
|
||||
bl_idname = "PIE_MT_sculpt_brush_select_misc"
|
||||
bl_label = "More Brushes"
|
||||
|
||||
def draw(self, context):
|
||||
global brush_icons
|
||||
layout = self.layout
|
||||
layout.scale_y = 1.5
|
||||
|
||||
layout.operator("paint.brush_select", text=' Smooth',
|
||||
icon_value=brush_icons["smooth"]).sculpt_tool = 'SMOOTH'
|
||||
layout.operator("paint.brush_select", text=' Flatten',
|
||||
icon_value=brush_icons["flatten"]).sculpt_tool = 'FLATTEN'
|
||||
layout.operator("paint.brush_select", text=' Scrape/Peaks',
|
||||
icon_value=brush_icons["scrape"]).sculpt_tool = 'SCRAPE'
|
||||
layout.operator("paint.brush_select", text=' Fill/Deepen',
|
||||
icon_value=brush_icons["fill"]).sculpt_tool = 'FILL'
|
||||
layout.operator("paint.brush_select", text=' Pinch/Magnify',
|
||||
icon_value=brush_icons["pinch"]).sculpt_tool = 'PINCH'
|
||||
layout.operator("paint.brush_select", text=' Layer',
|
||||
icon_value=brush_icons["layer"]).sculpt_tool = 'LAYER'
|
||||
layout.operator("paint.brush_select", text=' Mask',
|
||||
icon_value=brush_icons["mask"]).sculpt_tool = 'MASK'
|
||||
# 4 - LEFT
|
||||
draw_brush_operator(layout, 'Smooth', 'smooth')
|
||||
# 6 - RIGHT
|
||||
draw_brush_operator(layout, 'Flatten/Contrast', 'flatten')
|
||||
# 2 - BOTTOM
|
||||
draw_brush_operator(layout, 'Scrape/Fill', 'scrape')
|
||||
# 8 - TOP
|
||||
draw_brush_operator(layout, 'Fill/Deepen', 'fill')
|
||||
# 7 - TOP - LEFT
|
||||
draw_brush_operator(layout, 'Pinch/Magnify', 'pinch')
|
||||
# 9 - TOP - RIGHT
|
||||
draw_brush_operator(layout, 'Layer', 'layer')
|
||||
# 1 - BOTTOM - LEFT
|
||||
draw_brush_operator(layout, 'Mask', 'mask')
|
||||
# 3 - BOTTOM - RIGHT
|
||||
|
||||
|
||||
# Pie Sculpt Three
|
||||
class PIE_MT_Sculptthree(Menu):
|
||||
bl_idname = "PIE_MT_sculptthree"
|
||||
bl_label = "Pie Sculpt 3"
|
||||
class PIE_MT_sculpt_brush_select_grab(Menu):
|
||||
bl_idname = "PIE_MT_sculpt_brush_select_grab"
|
||||
bl_label = "Grab Brushes"
|
||||
|
||||
def draw(self, context):
|
||||
global brush_icons
|
||||
layout = self.layout
|
||||
layout.scale_y = 1.5
|
||||
|
||||
layout.operator("paint.brush_select",
|
||||
text=' Grab', icon_value=brush_icons["grab"]).sculpt_tool = 'GRAB'
|
||||
layout.operator("paint.brush_select",
|
||||
text=' Nudge', icon_value=brush_icons["nudge"]).sculpt_tool = 'NUDGE'
|
||||
layout.operator("paint.brush_select",
|
||||
text=' Thumb', icon_value=brush_icons["thumb"]).sculpt_tool = 'THUMB'
|
||||
layout.operator("paint.brush_select",
|
||||
text=' Snakehook', icon_value=brush_icons["snake_hook"]).sculpt_tool = 'SNAKE_HOOK'
|
||||
layout.operator("paint.brush_select",
|
||||
text=' Rotate', icon_value=brush_icons["rotate"]).sculpt_tool = 'ROTATE'
|
||||
# 4 - LEFT
|
||||
draw_brush_operator(layout, 'Grab', 'grab')
|
||||
# 6 - RIGHT
|
||||
draw_brush_operator(layout, 'Nudge', 'nudge')
|
||||
# 2 - BOTTOM
|
||||
draw_brush_operator(layout, 'Thumb', 'thumb')
|
||||
# 8 - TOP
|
||||
draw_brush_operator(layout, 'Snake Hook', 'snake_hook')
|
||||
# 7 - TOP - LEFT
|
||||
draw_brush_operator(layout, 'Twist', 'rotate')
|
||||
|
||||
|
||||
def draw_brush_operator(layout, brush_name: str, brush_icon: str):
|
||||
"""Draw a brush select operator in the provided UI element with the pre-4.3 icons.
|
||||
brush_name must match the name of the Brush Asset.
|
||||
brush_icon must match the name of a file in this add-on's icons folder.
|
||||
"""
|
||||
Mets marked this conversation as resolved
Outdated
|
||||
if 'asset_activate' in dir(bpy.ops.brush):
|
||||
# 4.3
|
||||
op = layout.operator(
|
||||
'brush.asset_activate',
|
||||
text=" " + brush_name,
|
||||
icon_value=brush_icons[brush_icon],
|
||||
)
|
||||
op.asset_library_type = 'ESSENTIALS'
|
||||
op.relative_asset_identifier = (
|
||||
"brushes\\essentials_brushes.blend\\Brush\\" + brush_name
|
||||
)
|
||||
else:
|
||||
# Pre-4.3
|
||||
op = layout.operator(
|
||||
"paint.brush_select",
|
||||
text=" " + brush_name,
|
||||
icon_value=brush_icons[brush_icon],
|
||||
)
|
||||
op.sculpt_tool = brush_icon.upper()
|
||||
|
||||
|
||||
brush_icons = {}
|
||||
@ -121,16 +132,12 @@ brush_icons = {}
|
||||
|
||||
def create_icons():
|
||||
global brush_icons
|
||||
icons_directory = bpy.utils.system_resource('DATAFILES', path="icons")
|
||||
brushes = (
|
||||
"crease", "blob", "smooth", "draw", "clay", "clay_strips", "inflate", "grab",
|
||||
"nudge", "thumb", "snake_hook", "rotate", "flatten", "scrape", "fill", "pinch",
|
||||
"layer", "mask",
|
||||
)
|
||||
for brush in brushes:
|
||||
filename = os.path.join(icons_directory, f"brush.sculpt.{brush}.dat")
|
||||
icon_value = bpy.app.icons.new_triangles_from_file(filename)
|
||||
brush_icons[brush] = icon_value
|
||||
icons_directory = Path(__file__).parent / "icons"
|
||||
|
||||
for icon_path in icons_directory.iterdir():
|
||||
icon_value = bpy.app.icons.new_triangles_from_file(icon_path.as_posix())
|
||||
brush_name = icon_path.stem.split(".")[-1]
|
||||
brush_icons[brush_name] = icon_value
|
||||
|
||||
|
||||
def release_icons():
|
||||
@ -140,10 +147,9 @@ def release_icons():
|
||||
|
||||
|
||||
classes = (
|
||||
PIE_MT_SculptPie,
|
||||
PIE_MT_Sculpttwo,
|
||||
PIE_MT_Sculptthree,
|
||||
PIE_OT_SculptSculptDraw,
|
||||
PIE_MT_sculpt_brush_select,
|
||||
PIE_MT_sculpt_brush_select_misc,
|
||||
PIE_MT_sculpt_brush_select_grab,
|
||||
)
|
||||
|
||||
addon_keymaps = []
|
||||
|
Loading…
Reference in New Issue
Block a user
Non-portable backslashes here as well. Causes incorrect filepaths on some systems.
Use
os
here and let it handle thatNot sure but I THINK it should recognize blend file as a directory, I remember that being the case.
Great point, fixed!