[Bf-extensions-cvs] [1f36b196] master: Add Oscurart Tools for 2.8

Eugenio Pignataro noreply at git.blender.org
Fri Dec 21 15:32:21 CET 2018


Commit: 1f36b19604c4b62ac6acf47f93ad5863af2032de
Author: Eugenio Pignataro
Date:   Fri Dec 21 11:32:12 2018 -0300
Branches: master
https://developer.blender.org/rBA1f36b19604c4b62ac6acf47f93ad5863af2032de

Add Oscurart Tools for 2.8

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

A	oscurart_tools/__init__.py
A	oscurart_tools/files/collect_images.py
A	oscurart_tools/files/reload_images.py
A	oscurart_tools/files/save_incremental.py
A	oscurart_tools/mesh/apply_linked_meshes.py
A	oscurart_tools/mesh/overlap_island.py
A	oscurart_tools/mesh/overlap_uvs.py
A	oscurart_tools/mesh/select_doubles.py
A	oscurart_tools/mesh/shapes_to_objects.py
A	oscurart_tools/object/distribute.py
A	oscurart_tools/object/search_and_select.py
A	oscurart_tools/object/selection.py

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

diff --git a/oscurart_tools/__init__.py b/oscurart_tools/__init__.py
new file mode 100644
index 00000000..9b2817cd
--- /dev/null
+++ b/oscurart_tools/__init__.py
@@ -0,0 +1,166 @@
+# ##### 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>
+
+bl_info = {
+    "name": "Oscurart Tools",
+    "author": "Oscurart, CodemanX",
+    "version": (4, 0, 0),
+    "blender": (2, 80, 0),
+    "location": "View3D > Toolbar and View3D > Specials (W-key)",
+    "description": "Tools for objects, render, shapes, and files.",
+    "warning": "",
+    "wiki_url": "https://wiki.blender.org/index.php/Extensions:2.6/Py/"
+                "Scripts/3D_interaction/Oscurart_Tools",
+    "category": "Object",
+    }
+    
+
+import bpy
+from bpy.types import Menu
+from oscurart_tools.files import reload_images
+from oscurart_tools.files import save_incremental
+from oscurart_tools.files import collect_images
+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.object import distribute
+from oscurart_tools.object import selection
+from oscurart_tools.object import search_and_select
+from oscurart_tools.mesh import apply_linked_meshes
+
+from bpy.types import (
+        AddonPreferences,
+        Panel,
+        PropertyGroup,
+        )
+from bpy.props import (
+        StringProperty,
+        BoolProperty,
+        IntProperty,
+        PointerProperty,
+        CollectionProperty,
+        )
+
+# mesh
+class VIEW3D_MT_edit_mesh_oscurarttools(Menu):
+    bl_label = "OscurartTools"   
+    
+    def draw(self, context):
+        layout = self.layout
+        
+        layout.operator("mesh.uv_island_copy")
+        layout.operator("mesh.uv_island_paste")
+        layout.operator("mesh.select_doubles")
+        layout.separator()          
+        layout.operator("image.reload_images_osc")      
+        layout.operator("file.save_incremental_backup")
+        layout.operator("file.collect_all_images")
+
+def menu_funcMesh(self, context):
+    self.layout.menu("VIEW3D_MT_edit_mesh_oscurarttools")
+    self.layout.separator()
+
+# image
+class IMAGE_MT_uvs_oscurarttools(Menu):
+    bl_label = "OscurartTools"   
+    
+    def draw(self, context):
+        layout = self.layout
+        
+        layout.operator("mesh.uv_island_copy")
+        layout.operator("mesh.uv_island_paste")
+        layout.operator("mesh.overlap_uv_faces")
+        layout.separator()          
+        layout.operator("image.reload_images_osc")      
+        layout.operator("file.save_incremental_backup")
+        layout.operator("file.collect_all_images")
+
+def menu_funcImage(self, context):
+    self.layout.menu("IMAGE_MT_uvs_oscurarttools")
+    self.layout.separator()
+
+
+# object
+class VIEW3D_MT_object_oscurarttools(Menu):
+    bl_label = "OscurartTools"   
+    
+    def draw(self, context):
+        layout = self.layout
+
+        layout.operator("object.distribute_osc")
+        layout.operator("object.search_and_select_osc")
+        layout.operator("object.shape_key_to_objects_osc")
+        layout.operator("mesh.apply_linked_meshes")        
+        layout.separator()          
+        layout.operator("image.reload_images_osc")      
+        layout.operator("file.save_incremental_backup")
+        layout.operator("file.collect_all_images")
+
+def menu_funcObject(self, context):
+    self.layout.menu("VIEW3D_MT_object_oscurarttools")
+    self.layout.separator()
+
+# ========================= End of Scripts =========================
+
+
+classes = (
+    VIEW3D_MT_edit_mesh_oscurarttools,
+    IMAGE_MT_uvs_oscurarttools,
+    VIEW3D_MT_object_oscurarttools,
+    reload_images.reloadImages,  
+    overlap_uvs.CopyUvIsland, 
+    overlap_uvs.PasteUvIsland,
+    distribute.DistributeOsc,
+    selection.OscSelection,
+    save_incremental.saveIncrementalBackup,
+    collect_images.collectImagesOsc,
+    overlap_island.OscOverlapUv,
+    select_doubles.SelectDoubles,
+    shapes_to_objects.ShapeToObjects,
+    search_and_select.SearchAndSelectOt,
+    apply_linked_meshes.ApplyLRT,
+    )
+
+def register():
+    from bpy.types import Scene
+    Scene.multimeshedit = StringProperty()
+    bpy.types.VIEW3D_MT_edit_mesh_specials.prepend(menu_funcMesh)
+    bpy.types.IMAGE_MT_specials.prepend(menu_funcImage)
+    bpy.types.VIEW3D_MT_object_specials.prepend(menu_funcObject)
+
+    from bpy.utils import register_class
+    for cls in classes:
+        register_class(cls)                                            
+                                                                              
+
+def unregister():
+    del bpy.types.Scene.SearchAndSelectOt
+    bpy.types.VIEW3D_MT_edit_mesh_specials.remove(menu_funcMesh)
+    bpy.types.IMAGE_MT_specials.remove(menu_funcImage)
+    bpy.types.VIEW3D_MT_object_specials.remove(menu_funcObject)
+
+    from bpy.utils import unregister_class
+    for cls in reversed(classes):
+        unregister_class(cls)
+
+
+if __name__ == "__main__":
+    register()
diff --git a/oscurart_tools/files/collect_images.py b/oscurart_tools/files/collect_images.py
new file mode 100644
index 00000000..ce22700a
--- /dev/null
+++ b/oscurart_tools/files/collect_images.py
@@ -0,0 +1,59 @@
+# ##### 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
+from bpy.types import Operator
+import os
+import shutil
+
+
+class collectImagesOsc(Operator):
+    """Collect all images in the blend file and put them in IMAGES folder"""
+    bl_idname = "file.collect_all_images"
+    bl_label = "Collect Images"
+    bl_options = {"REGISTER", "UNDO"}
+
+    def execute(self, context):
+
+        imagespath = "%s/IMAGES"  % (os.path.dirname(bpy.data.filepath))
+
+        if not os.path.exists(imagespath):
+            os.mkdir(imagespath)
+
+        bpy.ops.file.make_paths_absolute()
+
+        for image in bpy.data.images:
+            try:
+                image.update()
+
+                if image.has_data:
+                    if not os.path.exists(os.path.join(imagespath,os.path.basename(image.filepath))):
+                        shutil.copy(image.filepath, os.path.join(imagespath,os.path.basename(image.filepath)))
+                        image.filepath = os.path.join(imagespath,os.path.basename(image.filepath))
+                    else:
+                        print("%s exists." % (image.name))
+                else:
+                    print("%s missing path." % (image.name))
+            except:
+                print("%s missing path." % (image.name))
+
+        bpy.ops.file.make_paths_relative()
+
+        return {'FINISHED'}
diff --git a/oscurart_tools/files/reload_images.py b/oscurart_tools/files/reload_images.py
new file mode 100644
index 00000000..68b5c61b
--- /dev/null
+++ b/oscurart_tools/files/reload_images.py
@@ -0,0 +1,37 @@
+# ##### 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
+from bpy.types import Operator
+
+
+
+class reloadImages (Operator):
+    """Reloads all bitmaps in the scene"""
+    bl_idname = "image.reload_images_osc"
+    bl_label = "Reload Images"
+    bl_options = {"REGISTER", "UNDO"}
+
+    def execute(self, context):
+        for imgs in bpy.data.images:
+            imgs.reload()
+        return {'FINISHED'}
+
+
diff --git a/oscurart_tools/files/save_incremental.py b/oscurart_tools/files/save_incremental.py
new file mode 100644
index 00000000..d655b08e
--- /dev/null
+++ b/oscurart_tools/files/save_incremental.py
@@ -0,0 +1,70 @@
+# ##### 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 usefu

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list