[Bf-extensions-cvs] [8a17c01] master: uv_magic_uv commit to addons release: T51064
Nutti
noreply at git.blender.org
Sun Apr 2 04:23:39 CEST 2017
Commit: 8a17c01627bae97a66a237d5ab3cfd19c8f7adc1
Author: Nutti
Date: Sun Apr 2 11:21:28 2017 +0900
Branches: master
https://developer.blender.org/rBA8a17c01627bae97a66a237d5ab3cfd19c8f7adc1
uv_magic_uv commit to addons release: T51064
Initial commit to addons release.
Task: T51064
===================================================================
A uv_magic_uv/__init__.py
A uv_magic_uv/muv_common.py
A uv_magic_uv/muv_cpuv_ops.py
A uv_magic_uv/muv_cpuv_selseq_ops.py
A uv_magic_uv/muv_fliprot_ops.py
A uv_magic_uv/muv_menu.py
A uv_magic_uv/muv_mirroruv_ops.py
A uv_magic_uv/muv_mvuv_ops.py
A uv_magic_uv/muv_packuv_ops.py
A uv_magic_uv/muv_preferences.py
A uv_magic_uv/muv_preserve_uv_aspect.py
A uv_magic_uv/muv_props.py
A uv_magic_uv/muv_texlock_ops.py
A uv_magic_uv/muv_texproj_ops.py
A uv_magic_uv/muv_transuv_ops.py
A uv_magic_uv/muv_unwrapconst_ops.py
A uv_magic_uv/muv_uvbb_ops.py
A uv_magic_uv/muv_wsuv_ops.py
===================================================================
diff --git a/uv_magic_uv/__init__.py b/uv_magic_uv/__init__.py
new file mode 100644
index 0000000..7d18c15
--- /dev/null
+++ b/uv_magic_uv/__init__.py
@@ -0,0 +1,126 @@
+# <pep8-80 compliant>
+
+# ##### 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 #####
+
+__author__ = "Nutti <nutti.metro at gmail.com>"
+__status__ = "production"
+__version__ = "4.3"
+__date__ = "1 Apr 2017"
+
+
+bl_info = {
+ "name": "Magic UV",
+ "author": "Nutti, Mifth, Jace Priester, kgeogeo, mem, Keith (Wahooney) Boshoff, McBuff, MaxRobinot",
+ "version": (4, 3),
+ "blender": (2, 77, 0),
+ "location": "See Add-ons Preferences",
+ "description": "UV Manipulator Tools. See Add-ons Preferences for details",
+ "warning": "",
+ "support": "COMMUNITY",
+ "wiki_url": "https://github.com/nutti/Magic-UV/wikil",
+ "tracker_url": "https://github.com/nutti/Copy-And-Paste-UV",
+ "category": "UV"
+}
+
+if "bpy" in locals():
+ import imp
+ imp.reload(muv_preferences)
+ imp.reload(muv_menu)
+ imp.reload(muv_common)
+ imp.reload(muv_props)
+ imp.reload(muv_cpuv_ops)
+ imp.reload(muv_cpuv_selseq_ops)
+ imp.reload(muv_fliprot_ops)
+ imp.reload(muv_transuv_ops)
+ imp.reload(muv_uvbb_ops)
+ imp.reload(muv_mvuv_ops)
+ imp.reload(muv_texproj_ops)
+ imp.reload(muv_packuv_ops)
+ imp.reload(muv_texlock_ops)
+ imp.reload(muv_mirroruv_ops)
+ imp.reload(muv_wsuv_ops)
+ imp.reload(muv_unwrapconst_ops)
+ imp.reload(muv_preserve_uv_aspect)
+else:
+ from . import muv_preferences
+ from . import muv_menu
+ from . import muv_common
+ from . import muv_props
+ from . import muv_cpuv_ops
+ from . import muv_cpuv_selseq_ops
+ from . import muv_fliprot_ops
+ from . import muv_transuv_ops
+ from . import muv_uvbb_ops
+ from . import muv_mvuv_ops
+ from . import muv_texproj_ops
+ from . import muv_packuv_ops
+ from . import muv_texlock_ops
+ from . import muv_mirroruv_ops
+ from . import muv_wsuv_ops
+ from . import muv_unwrapconst_ops
+ from . import muv_preserve_uv_aspect
+
+import bpy
+
+
+def view3d_uvmap_menu_fn(self, context):
+ self.layout.separator()
+ self.layout.menu(muv_menu.MUV_CPUVMenu.bl_idname, icon="PLUGIN")
+ self.layout.operator(muv_fliprot_ops.MUV_FlipRot.bl_idname, icon="PLUGIN")
+ self.layout.menu(muv_menu.MUV_TransUVMenu.bl_idname, icon="PLUGIN")
+ self.layout.operator(muv_mvuv_ops.MUV_MVUV.bl_idname, icon="PLUGIN")
+ self.layout.menu(muv_menu.MUV_TexLockMenu.bl_idname, icon="PLUGIN")
+ self.layout.operator(
+ muv_mirroruv_ops.MUV_MirrorUV.bl_idname, icon="PLUGIN")
+ self.layout.menu(muv_menu.MUV_WSUVMenu.bl_idname, icon="PLUGIN")
+ self.layout.operator(
+ muv_unwrapconst_ops.MUV_UnwrapConstraint.bl_idname, icon='PLUGIN')
+ self.layout.menu(
+ muv_preserve_uv_aspect.MUV_PreserveUVAspectMenu.bl_idname,
+ icon='PLUGIN')
+
+
+def image_uvs_menu_fn(self, context):
+ self.layout.separator()
+ self.layout.operator(muv_packuv_ops.MUV_PackUV.bl_idname, icon="PLUGIN")
+
+
+def view3d_object_menu_fn(self, context):
+ self.layout.separator()
+ self.layout.menu(muv_menu.MUV_CPUVObjMenu.bl_idname, icon="PLUGIN")
+
+
+def register():
+ bpy.utils.register_module(__name__)
+ bpy.types.VIEW3D_MT_uv_map.append(view3d_uvmap_menu_fn)
+ bpy.types.IMAGE_MT_uvs.append(image_uvs_menu_fn)
+ bpy.types.VIEW3D_MT_object.append(view3d_object_menu_fn)
+ muv_props.init_props(bpy.types.Scene)
+
+
+def unregister():
+ bpy.utils.unregister_module(__name__)
+ bpy.types.VIEW3D_MT_uv_map.remove(view3d_uvmap_menu_fn)
+ bpy.types.IMAGE_MT_uvs.remove(image_uvs_menu_fn)
+ bpy.types.VIEW3D_MT_object.remove(view3d_object_menu_fn)
+ muv_props.clear_props(bpy.types.Scene)
+
+
+if __name__ == "__main__":
+ register()
diff --git a/uv_magic_uv/muv_common.py b/uv_magic_uv/muv_common.py
new file mode 100644
index 0000000..66f2a54
--- /dev/null
+++ b/uv_magic_uv/muv_common.py
@@ -0,0 +1,86 @@
+# <pep8-80 compliant>
+
+# ##### 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 #####
+
+__author__ = "Nutti <nutti.metro at gmail.com>"
+__status__ = "production"
+__version__ = "4.3"
+__date__ = "1 Apr 2017"
+
+
+import bpy
+from . import muv_props
+
+
+def debug_print(*s):
+ """
+ Print message to console in debugging mode
+ """
+
+ if muv_props.DEBUG:
+ print(s)
+
+
+def check_version(major, minor, _):
+ """
+ Check blender version
+ """
+
+ if bpy.app.version[0] == major and bpy.app.version[1] == minor:
+ return 0
+ if bpy.app.version[0] > major:
+ return 1
+ else:
+ if bpy.app.version[1] > minor:
+ return 1
+ else:
+ return -1
+
+
+def redraw_all_areas():
+ """
+ Redraw all areas
+ """
+
+ for area in bpy.context.screen.areas:
+ area.tag_redraw()
+
+
+def get_space(area_type, region_type, space_type):
+ """
+ Get current area/region/space
+ """
+
+ area = None
+ region = None
+ space = None
+
+ for area in bpy.context.screen.areas:
+ if area.type == area_type:
+ break
+ else:
+ return (None, None, None)
+ for region in area.regions:
+ if region.type == region_type:
+ break
+ for space in area.spaces:
+ if space.type == space_type:
+ break
+
+ return (area, region, space)
diff --git a/uv_magic_uv/muv_cpuv_ops.py b/uv_magic_uv/muv_cpuv_ops.py
new file mode 100644
index 0000000..3c5e968
--- /dev/null
+++ b/uv_magic_uv/muv_cpuv_ops.py
@@ -0,0 +1,455 @@
+# <pep8-80 compliant>
+
+# ##### 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 #####
+
+__author__ = "Nutti <nutti.metro at gmail.com>, Jace Priester"
+__status__ = "production"
+__version__ = "4.3"
+__date__ = "1 Apr 2017"
+
+
+import bpy
+import bmesh
+from bpy.props import StringProperty, BoolProperty, IntProperty, EnumProperty
+from . import muv_common
+
+
+def memorize_view_3d_mode(fn):
+ def __memorize_view_3d_mode(self, context):
+ mode_orig = bpy.context.object.mode
+ result = fn(self, context)
+ bpy.ops.object.mode_set(mode=mode_orig)
+ return result
+ return __memorize_view_3d_mode
+
+
+class MUV_CPUVCopyUV(bpy.types.Operator):
+ """
+ Operation class: Copy UV coordinate
+ """
+
+ bl_idname = "uv.muv_cpuv_copy_uv"
+ bl_label = "Copy UV (Operation)"
+ bl_description = "Copy UV coordinate (Operation)"
+ bl_options = {'REGISTER', 'UNDO'}
+
+ uv_map = StringProperty(options={'HIDDEN'})
+
+ def execute(self, context):
+ props = context.scene.muv_props.cpuv
+ if self.uv_map == "":
+ self.report({'INFO'}, "Copy UV coordinate")
+ else:
+ self.report(
+ {'INFO'}, "Copy UV coordinate (UV map:%s)" % (self.uv_map))
+ obj = context.active_object
+ bm = bmesh.from_edit_mesh(obj.data)
+ if muv_common.check_version(2, 73, 0) >= 0:
+ bm.faces.ensure_lookup_table()
+
+ # get UV layer
+ if self.uv_map == "":
+ if not bm.loops.layers.uv:
+ self.report(
+ {'WARNING'}, "Object must have more than one UV map")
+ return {'CANCELLED'}
+ uv_layer = bm.loops.layers.uv.verify()
+ else:
+ uv_layer = bm.loops.layers.uv[self.uv_map]
+
+ # get selected face
+ props.src_uvs = []
+ props.src_pin_uvs = []
+ for face in bm.faces:
+ if face.select:
+ uvs = [l[uv_layer].uv.copy() for l in face.loops]
+ pin_uvs = [l[uv_layer].pin_uv for l in face.loops]
+ props.src_uvs.append(uvs)
+ props.src_pin_uvs.append(pin_uvs)
+ if len(props.src_uvs) == 0 or len(props.src_pin_uvs) == 0:
+ self.report({'WARNING'}, "No faces are selected")
+ return {'CANCELLED'}
+ self.report({'INFO'}, "%d face(s) are selected" % len(props.src_uvs)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list