[Bf-extensions-cvs] [85bda1d3] master: Add Remove Modifiers

Eugenio Pignataro noreply at git.blender.org
Mon Feb 25 16:48:12 CET 2019


Commit: 85bda1d3f7d20766561ef73c864a4a6872d93a23
Author: Eugenio Pignataro
Date:   Mon Feb 25 12:48:03 2019 -0300
Branches: master
https://developer.blender.org/rBA85bda1d3f7d20766561ef73c864a4a6872d93a23

Add Remove Modifiers

===================================================================

M	oscurart_tools/__init__.py
A	oscurart_tools/mesh/remove_modifiers.py

===================================================================

diff --git a/oscurart_tools/__init__.py b/oscurart_tools/__init__.py
index b5bcaae9..4986ef82 100644
--- a/oscurart_tools/__init__.py
+++ b/oscurart_tools/__init__.py
@@ -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():   
diff --git a/oscurart_tools/mesh/remove_modifiers.py b/oscurart_tools/mesh/remove_modifiers.py
new file mode 100644
index 00000000..186588ce
--- /dev/null
+++ b/oscurart_tools/mesh/remove_modifiers.py
@@ -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'}
+
+
+



More information about the Bf-extensions-cvs mailing list