diff options
Diffstat (limited to 'space_view3d_brush_menus/dyntopo_menu.py')
-rw-r--r-- | space_view3d_brush_menus/dyntopo_menu.py | 78 |
1 files changed, 41 insertions, 37 deletions
diff --git a/space_view3d_brush_menus/dyntopo_menu.py b/space_view3d_brush_menus/dyntopo_menu.py index bab317f6..acc216d0 100644 --- a/space_view3d_brush_menus/dyntopo_menu.py +++ b/space_view3d_brush_menus/dyntopo_menu.py @@ -11,34 +11,34 @@ class DynTopoMenu(Menu): @classmethod def poll(self, context): - return utils_core.get_mode() == utils_core.sculpt + return utils_core.get_mode() == 'SCULPT' def draw(self, context): - menu = utils_core.Menu(self) + layout = self.layout if context.object.use_dynamic_topology_sculpting: - menu.add_item().operator("sculpt.dynamic_topology_toggle", + layout.row().operator("sculpt.dynamic_topology_toggle", "Disable Dynamic Topology") - menu.add_item().separator() + layout.row().separator() - menu.add_item().menu(DynDetailMenu.bl_idname) - menu.add_item().menu(DetailMethodMenu.bl_idname) + layout.row().menu(DynDetailMenu.bl_idname) + layout.row().menu(DetailMethodMenu.bl_idname) - menu.add_item().separator() + layout.row().separator() - menu.add_item().operator("sculpt.optimize") + layout.row().operator("sculpt.optimize") if context.tool_settings.sculpt.detail_type_method == 'CONSTANT': - menu.add_item().operator("sculpt.detail_flood_fill") + layout.row().operator("sculpt.detail_flood_fill") - menu.add_item().menu(SymmetrizeMenu.bl_idname) - menu.add_item().prop(context.tool_settings.sculpt, + layout.row().menu(SymmetrizeMenu.bl_idname) + layout.row().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", + row = layout.row() + row.operator_context = 'INVOKE_DEFAULT' + row.operator("sculpt.dynamic_topology_toggle", "Enable Dynamic Topology") @@ -47,8 +47,12 @@ class DynDetailMenu(Menu): bl_idname = "VIEW3D_MT_sv3_dyn_detail" def init(self): - settings = [["40", 40], ["30", 30], ["20", 20], - ["10", 10], ["5", 5], ["1", 1]] + settings = (("40", 40), + ("30", 30), + ("20", 20), + ("10", 10), + ("5", 5), + ("1", 1)) if bpy.context.tool_settings.sculpt.detail_type_method == 'RELATIVE': datapath = "tool_settings.sculpt.detail_size" @@ -62,17 +66,17 @@ class DynDetailMenu(Menu): def draw(self, context): settings, datapath, slider_setting = self.init() - menu = utils_core.Menu(self) + layout = self.layout # add the top slider - menu.add_item().prop(context.tool_settings.sculpt, + layout.row().prop(context.tool_settings.sculpt, slider_setting, slider=True) - menu.add_item().separator() + layout.row().separator() # add the rest of the menu items for i in range(len(settings)): utils_core.menuprop( - menu.add_item(), settings[i][0], settings[i][1], datapath, + layout.row(), settings[i][0], settings[i][1], datapath, icon='RADIOBUT_OFF', disable=True, disable_icon='RADIOBUT_ON' ) @@ -83,38 +87,38 @@ class DetailMethodMenu(Menu): bl_idname = "VIEW3D_MT_sv3_detail_method_menu" def draw(self, context): - menu = utils_core.Menu(self) + layout = self.layout refine_path = "tool_settings.sculpt.detail_refine_method" type_path = "tool_settings.sculpt.detail_type_method" - refine_items = [["Subdivide Edges", 'SUBDIVIDE'], - ["Collapse Edges", 'COLLAPSE'], - ["Subdivide Collapse", 'SUBDIVIDE_COLLAPSE']] + refine_items = (("Subdivide Edges", 'SUBDIVIDE'), + ("Collapse Edges", 'COLLAPSE'), + ("Subdivide Collapse", 'SUBDIVIDE_COLLAPSE')) - type_items = [["Relative Detail", 'RELATIVE'], - ["Constant Detail", 'CONSTANT']] + type_items = (("Relative Detail", 'RELATIVE'), + ("Constant Detail", 'CONSTANT')) - menu.add_item().label("Refine") - menu.add_item().separator() + layout.row().label("Refine") + layout.row().separator() # add the refine menu items for item in refine_items: utils_core.menuprop( - menu.add_item(), item[0], item[1], + layout.row(), item[0], item[1], refine_path, disable=True, icon='RADIOBUT_OFF', disable_icon='RADIOBUT_ON' ) - menu.add_item().label("") + layout.row().label("") - menu.add_item().label("Type") - menu.add_item().separator() + layout.row().label("Type") + layout.row().separator() # add the type menu items for item in type_items: utils_core.menuprop( - menu.add_item(), item[0], item[1], + layout.row(), item[0], item[1], type_path, disable=True, icon='RADIOBUT_OFF', disable_icon='RADIOBUT_ON' ) @@ -125,18 +129,18 @@ class SymmetrizeMenu(Menu): bl_idname = "VIEW3D_MT_sv3_symmetrize_menu" def draw(self, context): - menu = utils_core.Menu(self) + layout = self.layout path = "tool_settings.sculpt.symmetrize_direction" # add the the symmetrize operator to the menu - menu.add_item().operator("sculpt.symmetrize") - menu.add_item().separator() + layout.row().operator("sculpt.symmetrize") + layout.row().separator() # add the rest of the menu items for item in context.tool_settings.sculpt. \ bl_rna.properties['symmetrize_direction'].enum_items: utils_core.menuprop( - menu.add_item(), item.name, item.identifier, + layout.row(), item.name, item.identifier, path, disable=True, icon='RADIOBUT_OFF', disable_icon='RADIOBUT_ON' ) |