Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'space_view3d_brush_menus/dyntopo_menu.py')
-rw-r--r--space_view3d_brush_menus/dyntopo_menu.py77
1 files changed, 47 insertions, 30 deletions
diff --git a/space_view3d_brush_menus/dyntopo_menu.py b/space_view3d_brush_menus/dyntopo_menu.py
index a15c562c..bab317f6 100644
--- a/space_view3d_brush_menus/dyntopo_menu.py
+++ b/space_view3d_brush_menus/dyntopo_menu.py
@@ -1,22 +1,24 @@
-from bpy.props import *
-from .Utils.core import *
+# gpl author: Ryan Inch (Imaginer)
-class DynTopoMenu(bpy.types.Menu):
+import bpy
+from bpy.types import Menu
+from . import utils_core
+
+
+class DynTopoMenu(Menu):
bl_label = "Dyntopo"
bl_idname = "VIEW3D_MT_sv3_dyntopo"
@classmethod
def poll(self, context):
- if get_mode() == sculpt:
- return True
- else:
- return False
+ return utils_core.get_mode() == utils_core.sculpt
def draw(self, context):
- menu = Menu(self)
+ menu = utils_core.Menu(self)
if context.object.use_dynamic_topology_sculpting:
- menu.add_item().operator("sculpt.dynamic_topology_toggle", "Disable Dynamic Topology")
+ menu.add_item().operator("sculpt.dynamic_topology_toggle",
+ "Disable Dynamic Topology")
menu.add_item().separator()
@@ -26,19 +28,21 @@ class DynTopoMenu(bpy.types.Menu):
menu.add_item().separator()
menu.add_item().operator("sculpt.optimize")
- if bpy.context.tool_settings.sculpt.detail_type_method == 'CONSTANT':
+ if context.tool_settings.sculpt.detail_type_method == 'CONSTANT':
menu.add_item().operator("sculpt.detail_flood_fill")
menu.add_item().menu(SymmetrizeMenu.bl_idname)
- menu.add_item().prop(context.tool_settings.sculpt, "use_smooth_shading", toggle=True)
+ menu.add_item().prop(context.tool_settings.sculpt,
+ "use_smooth_shading", toggle=True)
else:
menu.add_item()
menu.current_item.operator_context = 'INVOKE_DEFAULT'
- menu.current_item.operator("sculpt.dynamic_topology_toggle", "Enable Dynamic Topology")
+ menu.current_item.operator("sculpt.dynamic_topology_toggle",
+ "Enable Dynamic Topology")
-class DynDetailMenu(bpy.types.Menu):
+class DynDetailMenu(Menu):
bl_label = "Detail Size"
bl_idname = "VIEW3D_MT_sv3_dyn_detail"
@@ -58,25 +62,28 @@ class DynDetailMenu(bpy.types.Menu):
def draw(self, context):
settings, datapath, slider_setting = self.init()
- menu = Menu(self)
+ menu = utils_core.Menu(self)
# add the top slider
- menu.add_item().prop(context.tool_settings.sculpt, slider_setting, slider=True)
+ menu.add_item().prop(context.tool_settings.sculpt,
+ slider_setting, slider=True)
menu.add_item().separator()
# add the rest of the menu items
for i in range(len(settings)):
- menuprop(menu.add_item(), settings[i][0], settings[i][1], datapath,
- icon='RADIOBUT_OFF', disable=True,
- disable_icon='RADIOBUT_ON')
+ utils_core.menuprop(
+ menu.add_item(), settings[i][0], settings[i][1], datapath,
+ icon='RADIOBUT_OFF', disable=True,
+ disable_icon='RADIOBUT_ON'
+ )
-class DetailMethodMenu(bpy.types.Menu):
+class DetailMethodMenu(Menu):
bl_label = "Detail Method"
bl_idname = "VIEW3D_MT_sv3_detail_method_menu"
def draw(self, context):
- menu = Menu(self)
+ menu = utils_core.Menu(self)
refine_path = "tool_settings.sculpt.detail_refine_method"
type_path = "tool_settings.sculpt.detail_type_method"
@@ -92,8 +99,12 @@ class DetailMethodMenu(bpy.types.Menu):
# add the refine menu items
for item in refine_items:
- menuprop(menu.add_item(), item[0], item[1], refine_path, disable=True,
- icon='RADIOBUT_OFF', disable_icon='RADIOBUT_ON')
+ utils_core.menuprop(
+ menu.add_item(), item[0], item[1],
+ refine_path, disable=True,
+ icon='RADIOBUT_OFF',
+ disable_icon='RADIOBUT_ON'
+ )
menu.add_item().label("")
@@ -102,16 +113,19 @@ class DetailMethodMenu(bpy.types.Menu):
# add the type menu items
for item in type_items:
- menuprop(menu.add_item(), item[0], item[1], type_path, disable=True,
- icon='RADIOBUT_OFF', disable_icon='RADIOBUT_ON')
+ utils_core.menuprop(
+ menu.add_item(), item[0], item[1],
+ type_path, disable=True,
+ icon='RADIOBUT_OFF', disable_icon='RADIOBUT_ON'
+ )
-class SymmetrizeMenu(bpy.types.Menu):
+class SymmetrizeMenu(Menu):
bl_label = "Symmetrize"
bl_idname = "VIEW3D_MT_sv3_symmetrize_menu"
def draw(self, context):
- menu = Menu(self)
+ menu = utils_core.Menu(self)
path = "tool_settings.sculpt.symmetrize_direction"
# add the the symmetrize operator to the menu
@@ -119,7 +133,10 @@ class SymmetrizeMenu(bpy.types.Menu):
menu.add_item().separator()
# add the rest of the menu items
- for item in context.tool_settings.sculpt.bl_rna.properties['symmetrize_direction'].enum_items:
- menuprop(menu.add_item(), item.name, item.identifier, path, disable=True,
- icon='RADIOBUT_OFF', disable_icon='RADIOBUT_ON')
-
+ for item in context.tool_settings.sculpt. \
+ bl_rna.properties['symmetrize_direction'].enum_items:
+ utils_core.menuprop(
+ menu.add_item(), item.name, item.identifier,
+ path, disable=True,
+ icon='RADIOBUT_OFF', disable_icon='RADIOBUT_ON'
+ )