[Bf-extensions-cvs] [c63bb5ab] master: Dynamic Brush Menus: return to release: T68350 T63750 437e41a06681
Ryan Inch
noreply at git.blender.org
Sat Aug 31 06:07:16 CEST 2019
Commit: c63bb5abce16b85dd0f6888b0114c65092747e7a
Author: Ryan Inch
Date: Sat Aug 31 00:04:43 2019 -0400
Branches: master
https://developer.blender.org/rBAc63bb5abce16b85dd0f6888b0114c65092747e7a
Dynamic Brush Menus: return to release: T68350 T63750 437e41a06681
===================================================================
A space_view3d_brush_menus/__init__.py
A space_view3d_brush_menus/brush_menu.py
A space_view3d_brush_menus/brushes.py
A space_view3d_brush_menus/curve_menu.py
A space_view3d_brush_menus/dyntopo_menu.py
A space_view3d_brush_menus/stroke_menu.py
A space_view3d_brush_menus/symmetry_menu.py
A space_view3d_brush_menus/texture_menu.py
A space_view3d_brush_menus/utils_core.py
===================================================================
diff --git a/space_view3d_brush_menus/__init__.py b/space_view3d_brush_menus/__init__.py
new file mode 100644
index 00000000..5381d14c
--- /dev/null
+++ b/space_view3d_brush_menus/__init__.py
@@ -0,0 +1,135 @@
+# ##### BEGIN GPL LICENSE BLOCK #####
+#
+# 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 the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+#
+# ##### END GPL LICENSE BLOCK #####
+# Modified by Meta-Androcto
+
+""" Copyright 2011 GPL licence applies"""
+
+bl_info = {
+ "name": "Dynamic Brush Menus",
+ "description": "Fast access to brushes & tools in Sculpt and Paint Modes",
+ "author": "Ryan Inch (Imaginer)",
+ "version": (1, 1, 7),
+ "blender": (2, 80, 0),
+ "location": "Spacebar in Sculpt/Paint Modes",
+ "warning": '',
+ "wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/Py/"
+ "Scripts/3D_interaction/Advanced_UI_Menus",
+ "category": "3D View"}
+
+
+if "bpy" in locals():
+ import importlib
+ importlib.reload(utils_core)
+ importlib.reload(brush_menu)
+ importlib.reload(brushes)
+ importlib.reload(curve_menu)
+ importlib.reload(dyntopo_menu)
+ importlib.reload(stroke_menu)
+ importlib.reload(symmetry_menu)
+ importlib.reload(texture_menu)
+else:
+ from . import utils_core
+ from . import brush_menu
+ from . import brushes
+ from . import curve_menu
+ from . import dyntopo_menu
+ from . import stroke_menu
+ from . import symmetry_menu
+ from . import texture_menu
+
+
+import bpy
+from bpy.types import AddonPreferences
+from bpy.props import (
+ EnumProperty,
+ IntProperty,
+ )
+
+
+addon_files = (
+ brush_menu,
+ brushes,
+ curve_menu,
+ dyntopo_menu,
+ stroke_menu,
+ symmetry_menu,
+ texture_menu,
+ )
+
+
+
+class VIEW3D_MT_Brushes_Pref(AddonPreferences):
+ bl_idname = __name__
+
+ column_set: IntProperty(
+ name="Number of Columns",
+ description="Number of columns used for the brushes menu",
+ default=2,
+ min=1,
+ max=10
+ )
+
+ def draw(self, context):
+ layout = self.layout
+
+ col = layout.column(align=True)
+ col.prop(self, "column_set", slider=True)
+
+
+# New hotkeys and registration
+
+addon_keymaps = []
+
+
+def register():
+ # register all files
+ for addon_file in addon_files:
+ addon_file.register()
+
+ # set the add-on name variable to access the preferences
+ utils_core.get_addon_name = __name__
+
+ # register preferences
+ bpy.utils.register_class(VIEW3D_MT_Brushes_Pref)
+
+ # register hotkeys
+ wm = bpy.context.window_manager
+ modes = ('Sculpt', 'Vertex Paint', 'Weight Paint', 'Image Paint', 'Particle')
+
+ for mode in modes:
+ km = wm.keyconfigs.addon.keymaps.new(name=mode)
+ kmi = km.keymap_items.new('wm.call_menu', 'SPACE', 'PRESS')
+ kmi.properties.name = "VIEW3D_MT_sv3_brush_options"
+ addon_keymaps.append((km, kmi))
+
+
+def unregister():
+ # unregister all files
+ for addon_file in addon_files:
+ addon_file.unregister()
+
+ # unregister preferences
+ bpy.utils.unregister_class(VIEW3D_MT_Brushes_Pref)
+
+ for km, kmi in addon_keymaps:
+ km.keymap_items.remove(kmi)
+ addon_keymaps.clear()
+
+
+if __name__ == "__main__":
+ register()
diff --git a/space_view3d_brush_menus/brush_menu.py b/space_view3d_brush_menus/brush_menu.py
new file mode 100644
index 00000000..28caf747
--- /dev/null
+++ b/space_view3d_brush_menus/brush_menu.py
@@ -0,0 +1,630 @@
+# gpl author: Ryan Inch (Imaginer)
+
+import bpy
+from bpy.types import (
+ Operator,
+ Menu,
+ )
+from bpy.props import BoolProperty
+from . import utils_core
+from . import brushes
+from bl_ui.properties_paint_common import UnifiedPaintPanel
+
+class BrushOptionsMenu(Menu):
+ bl_label = "Brush Options"
+ bl_idname = "VIEW3D_MT_sv3_brush_options"
+
+ @classmethod
+ def poll(self, context):
+ return utils_core.get_mode() in (
+ 'SCULPT', 'VERTEX_PAINT',
+ 'WEIGHT_PAINT', 'TEXTURE_PAINT',
+ 'PARTICLE_EDIT'
+ )
+
+ def draw(self, context):
+ mode = utils_core.get_mode()
+ layout = self.layout
+
+ if mode == 'SCULPT':
+ self.sculpt(mode, layout, context)
+
+ elif mode in ('VERTEX_PAINT', 'WEIGHT_PAINT'):
+ self.vw_paint(mode, layout, context)
+
+ elif mode == 'TEXTURE_PAINT':
+ self.texpaint(mode, layout, context)
+
+ else:
+ self.particle(layout, context)
+
+ def sculpt(self, mode, layout, context):
+ has_brush = utils_core.get_brush_link(context, types="brush")
+ icons = brushes.brush_icon[mode][has_brush.sculpt_tool] if \
+ has_brush else "BRUSH_DATA"
+ layout.operator("wm.toolbar", text="Tools", icon='TOOL_SETTINGS')
+ layout.row().menu("VIEW3D_MT_sv3_brushes_menu",
+ icon=icons)
+
+ layout.row().menu(BrushRadiusMenu.bl_idname)
+
+ if has_brush:
+ # if the active brush is unlinked these menus don't do anything
+ layout.row().menu(BrushStrengthMenu.bl_idname)
+ layout.row().menu(BrushAutosmoothMenu.bl_idname)
+ layout.row().menu(BrushModeMenu.bl_idname)
+ layout.row().menu("VIEW3D_MT_sv3_texture_menu")
+ layout.row().menu("VIEW3D_MT_sv3_stroke_options")
+ layout.row().menu("VIEW3D_MT_sv3_brush_curve_menu")
+
+ layout.row().menu("VIEW3D_MT_sv3_dyntopo")
+ layout.row().menu("VIEW3D_MT_sv3_master_symmetry_menu")
+
+ def vw_paint(self, mode, layout, context):
+ has_brush = utils_core.get_brush_link(context, types="brush")
+ icons = brushes.brush_icon[mode][has_brush.vertex_tool] if \
+ has_brush else "BRUSH_DATA"
+
+ layout.operator("wm.toolbar", text="Tools", icon='TOOL_SETTINGS')
+
+ if mode == 'VERTEX_PAINT':
+ layout.row().operator(ColorPickerPopup.bl_idname, icon="COLOR")
+ layout.row().separator()
+
+ layout.row().menu("VIEW3D_MT_sv3_brushes_menu",
+ icon=icons)
+
+ if mode == 'VERTEX_PAINT':
+ layout.row().menu(BrushRadiusMenu.bl_idname)
+
+ if has_brush:
+ # if the active brush is unlinked these menus don't do anything
+ layout.row().menu(BrushStrengthMenu.bl_idname)
+ layout.row().menu(BrushModeMenu.bl_idname)
+ layout.row().menu("VIEW3D_MT_sv3_texture_menu")
+ layout.row().menu("VIEW3D_MT_sv3_stroke_options")
+ layout.row().menu("VIEW3D_MT_sv3_brush_curve_menu")
+
+ if mode == 'WEIGHT_PAINT':
+ layout.row().menu(BrushWeightMenu.bl_idname)
+ layout.row().menu(BrushRadiusMenu.bl_idname)
+
+ if has_brush:
+ # if the active brush is unlinked these menus don't do anything
+ layout.row().menu(BrushStrengthMenu.bl_idname)
+ layout.row().menu(BrushModeMenu.bl_idname)
+ layout.row().menu("VIEW3D_MT_sv3_stroke_options")
+ layout.row().menu("VIEW3D_MT_sv3_brush_curve_menu")
+
+ def texpaint(self, mode, layout, context):
+ toolsettings = context.tool_settings.image_paint
+
+ has_brush = utils_core.get_brush_link(context, types="brush")
+ icons = brushes.brush_icon[mode][has_brush.image_tool] if \
+ has_brush else "BRUSH_DATA"
+
+ if context.image_paint_object and not toolsettings.detect_data():
+ if toolsettings.missing_uvs or toolsettings.missing_materials or \
+ toolsettings.missing_texture:
+ layout.row().label(text="Missing Data", icon='ERROR')
+ layout.row().operator_menu_enum("paint.add_texture_paint_slot", \
+ "type", \
+ icon='ADD', \
+ text="Add Texture Paint Slot")
+
+ return
+
+ elif toolsettings.missing_stencil:
+ layout.row().label(text="Missing Data", icon='ERROR')
+ layout.row().label(text="See Mask Properties", icon='FORWARD')
+ layout.row().separator()
+ layout.operator("wm.toolbar", text="Tools", icon='TOOL_SETTINGS')
+ layout.row().menu("VIEW3D_MT_sv3_brushes_menu",
+ icon=icons)
+
+ return
+
+ else:
+ layout.row().label(text="Missing Data", icon="INFO")
+
+ else:
+ layout.operator("wm.toolbar", text="Tools", icon='TOOL_SETTINGS')
+
+ if has_brush and has_brush.image_tool in {'DRAW', 'FILL'} and \
+ has_brush.blend not in {'ERASE_ALPHA', 'ADD_ALPHA'}:
+ layout.row().operator(ColorPickerPopup.bl_idname, icon="COLOR")
+ layout.row().separator()
+
+ layout.row().menu("VIEW3D_MT_sv3_brushes_menu",
+ icon=icons)
+
+ if has_brush:
+ # if the active brush is unlinked these menus don't do anything
+ if has_brush and has_brush.image_tool in {'MASK'}:
+ layout.row().menu(BrushWeightMenu.bl_idname, text="Mask Val
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list