Add Remove Modifiers

This commit is contained in:
Eugenio Pignataro 2019-02-25 12:48:03 -03:00
parent 80ad5c85bd
commit 85bda1d3f7
2 changed files with 52 additions and 1 deletions

View File

@ -41,6 +41,7 @@ from oscurart_tools.mesh import overlap_uvs
from oscurart_tools.mesh import overlap_island
from oscurart_tools.mesh import select_doubles
from oscurart_tools.mesh import shapes_to_objects
from oscurart_tools.mesh import remove_modifiers
from oscurart_tools.object import distribute
from oscurart_tools.object import selection
from oscurart_tools.object import search_and_select
@ -48,6 +49,7 @@ from oscurart_tools.mesh import apply_linked_meshes
from oscurart_tools.render import render_tokens
from oscurart_tools.render import batch_maker
from bpy.types import (
AddonPreferences,
Panel,
@ -110,6 +112,7 @@ class VIEW3D_MT_object_oscurarttools(Menu):
layout = self.layout
layout.operator("object.distribute_osc")
layout.operator("mesh.remove_modifiers")
layout.operator("object.search_and_select_osc")
layout.operator("object.shape_key_to_objects_osc")
layout.operator("mesh.apply_linked_meshes")
@ -142,7 +145,8 @@ classes = (
shapes_to_objects.ShapeToObjects,
search_and_select.SearchAndSelectOt,
apply_linked_meshes.ApplyLRT,
batch_maker.oscBatchMaker
batch_maker.oscBatchMaker,
remove_modifiers.RemoveModifiers
)
def register():

View File

@ -0,0 +1,47 @@
# ##### 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 #####
# <pep8 compliant>
import bpy
def funcRemoveModifiers(self,context):
for ob in bpy.context.selected_objects:
if ob.type == "MESH":
for mod in ob.modifiers:
ob.modifiers.remove(mod)
class RemoveModifiers(bpy.types.Operator):
"""Remove all mesh modifiers"""
bl_idname = "mesh.remove_modifiers"
bl_label = "Remove Modifiers"
bl_options = {"REGISTER", "UNDO"}
@classmethod
def poll(cls, context):
return (context.view_layer.objects.active is not None and
context.view_layer.objects.active.type == 'MESH')
def execute(self, context):
funcRemoveModifiers(self,context)
return {'FINISHED'}