[Bf-extensions-cvs] [1e571dc] master: Add features: Flip/Rotate UVs, Transfer UV
nutti
noreply at git.blender.org
Mon Jun 15 16:01:03 CEST 2015
Commit: 1e571dc311406bbd52fc25d4dbea597bafdc30e1
Author: nutti
Date: Mon Jun 15 22:48:39 2015 +0900
Branches: master
https://developer.blender.org/rBAC1e571dc311406bbd52fc25d4dbea597bafdc30e1
Add features: Flip/Rotate UVs, Transfer UV
===================================================================
D uv_copy_and_paste_uv.py
A uv_copy_and_paste_uv/__init__.py
A uv_copy_and_paste_uv/cpuv_common.py
A uv_copy_and_paste_uv/cpuv_default_operation.py
A uv_copy_and_paste_uv/cpuv_fliprot_operation.py
A uv_copy_and_paste_uv/cpuv_menu.py
A uv_copy_and_paste_uv/cpuv_properties.py
A uv_copy_and_paste_uv/cpuv_selseq_operation.py
A uv_copy_and_paste_uv/cpuv_transfer_uv_operation.py
A uv_copy_and_paste_uv/cpuv_uvmap_operation.py
===================================================================
diff --git a/uv_copy_and_paste_uv.py b/uv_copy_and_paste_uv.py
deleted file mode 100644
index 0b17eec..0000000
--- a/uv_copy_and_paste_uv.py
+++ /dev/null
@@ -1,597 +0,0 @@
-# <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 #####
-
-import bpy
-import bmesh
-import math
-from collections import namedtuple
-from bpy.props import *
-
-__author__ = "Nutti <nutti.metro at gmail.com>"
-__status__ = "production"
-__version__ = "2.2"
-__date__ = "3 April 2015"
-
-bl_info = {
- "name" : "Copy and Paste UV",
- "author" : "Nutti",
- "version" : (2,2),
- "blender" : (2, 7, 3),
- "location" : "UV Mapping > Copy and Paste UV",
- "description" : "Copy and Paste UV data",
- "warning" : "",
- "wiki_url" : "",
- "tracker_url" : "",
- "category" : "UV"
-}
-
-SelectedFaceInfo = namedtuple('SelectedFaceInfo', 'normal indices')
-
-# master menu
-class CopyAndPasteUVMenu(bpy.types.Menu):
- bl_idname = "uv.copy_and_paste_uv_menu"
- bl_label = "Copy/Paste UV"
- bl_description = "Copy and Paste UV Menu"
-
- def draw(self, context):
- self.layout.operator(CopyAndPasteUVCopyUV.bl_idname)
- self.layout.operator(CopyAndPasteUVPasteUV.bl_idname)
- self.layout.operator(CopyAndPasteUVCopyUVBySelSeq.bl_idname)
- self.layout.operator(CopyAndPasteUVPasteUVBySelSeq.bl_idname)
- self.layout.menu(CopyAndPasteUVCopyUVMap.bl_idname)
- self.layout.menu(CopyAndPasteUVPasteUVMap.bl_idname)
-
-
-# copy UV
-class CopyAndPasteUVCopyUV(bpy.types.Operator):
- """Copying UV coordinate on selected object."""
-
- bl_idname = "uv.copy_uv"
- bl_label = "Copy UV"
- bl_description = "Copy UV data"
- bl_options = {'REGISTER', 'UNDO'}
-
- # static variables
- src_uv_map = None # source uv map
- src_obj = None # source object
- src_sel_face_info = None # source selected faces information
-
- def __init__(self):
- CopyAndPasteUVCopyUV.src_uv_map = None
- CopyAndPasteUVCopyUV.src_obj = None
- CopyAndPasteUVCopyUV.src_sel_face_info = None
-
- def execute(self, context):
-
- self.report({'INFO'}, "Copy UV coordinate.")
-
- # prepare for coping
- ret, CopyAndPasteUVCopyUV.src_obj, mode_orig = prep_copy(self)
- if ret != 0:
- return {'CANCELLED'}
-
- # copy
- CopyAndPasteUVCopyUV.src_sel_face_info = get_selected_faces(
- CopyAndPasteUVCopyUV.src_obj)
- ret, CopyAndPasteUVCopyUV.src_uv_map = copy_opt(
- self, "", CopyAndPasteUVCopyUV.src_obj,
- CopyAndPasteUVCopyUV.src_sel_face_info)
-
- # finish coping
- fini_copy(mode_orig)
- if ret != 0:
- return {'CANCELLED'}
-
- return {'FINISHED'}
-
-
-# paste UV
-class CopyAndPasteUVPasteUV(bpy.types.Operator):
- """Paste UV coordinate which is copied."""
-
- bl_idname = "uv.paste_uv"
- bl_label = "Paste UV"
- bl_description = "Paste UV data"
- bl_options = {'REGISTER', 'UNDO'}
-
- flip_copied_uv = BoolProperty(
- name = "Flip Copied UV",
- description = "Flip Copied UV...",
- default = False)
-
- rotate_copied_uv = IntProperty(
- default = 0,
- name = "Rotate Copied UV",
- min = 0,
- max = 30)
-
- def __init__(self):
- self.src_uv_map = CopyAndPasteUVCopyUV.src_uv_map
- self.src_obj = CopyAndPasteUVCopyUV.src_obj
- self.src_sel_face_info = CopyAndPasteUVCopyUV.src_sel_face_info
-
- def execute(self, context):
-
- self.report({'INFO'}, "Paste UV coordinate.")
-
- # prepare for pasting
- ret, dest_obj, mode_orig = prep_paste(
- self, self.src_obj, self.src_sel_face_info)
- if ret != 0:
- return {'CANCELLED'}
-
- # paste
- dest_sel_face_info = get_selected_faces(dest_obj)
- ret = paste_opt(
- self, "", self.src_obj, self.src_sel_face_info,
- self.src_uv_map, dest_obj, dest_sel_face_info)
-
- # finish pasting
- fini_paste(mode_orig)
- if ret != 0:
- return {'CANCELLED'}
-
- return {'FINISHED'}
-
-
-# copy UV (by selection sequence)
-class CopyAndPasteUVCopyUVBySelSeq(bpy.types.Operator):
- """Copying UV coordinate on selected object by selection sequence."""
-
- bl_idname = "uv.copy_uv_sel_seq"
- bl_label = "Copy UV (Selection Sequence)"
- bl_description = "Copy UV data by selection sequence."
- bl_options = {'REGISTER', 'UNDO'}
-
- # static variables
- src_uv_map = None # source uv map
- src_obj = None # source object
- src_sel_face_info = None # source selected faces information
-
- def __init__(self):
- CopyAndPasteUVCopyUVBySelSeq.src_uv_map = None
- CopyAndPasteUVCopyUVBySelSeq.src_obj = None
- CopyAndPasteUVCopyUVBySelSeq.src_sel_face_info = None
-
- def execute(self, context):
-
- self.report({'INFO'}, "Copy UV coordinate. (sequence)")
-
- # prepare for coping
- ret, CopyAndPasteUVCopyUVBySelSeq.src_obj, mode_orig = prep_copy(self)
- if ret != 0:
- return {'CANCELLED'}
-
- # copy
- CopyAndPasteUVCopyUVBySelSeq.src_sel_face_info = get_selected_faces_by_sel_seq(CopyAndPasteUVCopyUVBySelSeq.src_obj)
- ret, CopyAndPasteUVCopyUVBySelSeq.src_uv_map = copy_opt(
- self, "", CopyAndPasteUVCopyUVBySelSeq.src_obj,
- CopyAndPasteUVCopyUVBySelSeq.src_sel_face_info)
-
- # finish coping
- fini_copy(mode_orig)
- if ret != 0:
- return {'CANCELLED'}
-
- return {'FINISHED'}
-
-
-# paste UV (by selection sequence)
-class CopyAndPasteUVPasteUVBySelSeq(bpy.types.Operator):
- """Paste UV coordinate which is copied by selection sequence."""
-
- bl_idname = "uv.paste_uv_sel_seq"
- bl_label = "Paste UV (Selection Sequence)"
- bl_description = "Paste UV data by selection sequence."
- bl_options = {'REGISTER', 'UNDO'}
-
- flip_copied_uv = BoolProperty(
- name = "Flip Copied UV",
- description = "Flip Copied UV...",
- default = False)
-
- rotate_copied_uv = IntProperty(
- default = 0,
- name = "Rotate Copied UV",
- min = 0,
- max = 30)
-
- def __init__(self):
- self.src_uv_map = CopyAndPasteUVCopyUVBySelSeq.src_uv_map
- self.src_obj = CopyAndPasteUVCopyUVBySelSeq.src_obj
- self.src_sel_face_info = CopyAndPasteUVCopyUVBySelSeq.src_sel_face_info
-
- def execute(self, context):
-
- self.report({'INFO'}, "Paste UV coordinate. (sequence)")
-
- # prepare for pasting
- ret, dest_obj, mode_orig = prep_paste(
- self, self.src_obj, self.src_sel_face_info)
- if ret != 0:
- return {'CANCELLED'}
-
- # paste
- dest_sel_face_info = get_selected_faces_by_sel_seq(dest_obj)
- ret = paste_opt(
- self, "", self.src_obj, self.src_sel_face_info,
- self.src_uv_map, dest_obj, dest_sel_face_info)
-
- # finish pasting
- fini_paste(mode_orig)
- if ret != 0:
- return {'CANCELLED'}
-
- return {'FINISHED'}
-
-
-# copy UV map (sub menu operator)
-class CopyAndPasteUVCopyUVMapSubOpt(bpy.types.Operator):
- bl_idname = "uv.copy_uv_map_sub_opt"
- bl_label = "Copy UV Map (Sub Menu Operator)"
- uv_map = bpy.props.StringProperty()
-
- # static variables
- src_uv_map = None # source uv map
- src_obj = None # source object
- src_sel_face_info = None # source selected faces information
-
- def __init__(self):
- CopyAndPasteUVCopyUVMapSubOpt.src_uv_map = None
- CopyAndPasteUVCopyUVMapSubOpt.src_obj = None
- CopyAndPasteUVCopyUVMapSubOpt.src_sel_face_info = None
-
- def execute(self, context):
-
- self.report(
- {'INFO'},
- "Copy UV coordinate. (UV map:" + self.uv_map + ")")
-
- # prepare for coping
- ret, CopyAndPasteUVCopyUVMapSubOpt.src_obj, mode_orig = prep_copy(self)
- if ret != 0:
- return {'CANCELLED'}
-
- # copy
- CopyAndPasteUVCopyUVMapSubOpt.src_sel_face_info = get_selected_faces(
- CopyAndPasteUVCopyUVMapSubOpt.src_obj)
- ret, CopyAndPasteUVCopyUVMapSubOpt.src_uv_map = copy_opt(
- self, self.uv_map, CopyAndPasteUVCopyUVMapSubOpt.src_obj,
- CopyAndPasteUVCopyUVMapSubOpt.src_sel_face_info)
-
- # finish coping
- fini_copy(mode_orig)
- if ret != 0:
- return {'CANCELLED'}
-
- return {'FINISHED'}
-
-
-# copy UV map
-class CopyAndPasteUVCopyUVMap(bpy.types.Menu):
- """Copying UV map coordinate on selected object."""
-
- bl_idname = "uv.copy_uv_map"
- bl_label = "Copy UV Map"
- bl_description = "Copy UV map data"
- bl_options = {'REGISTER', 'UNDO'}
-
- def draw(self, context):
- global menu_count
-
- layout = self.layout
-
- # create sub menu
- uv_maps = bpy.context.active_object.data.uv_textures.keys()
- for m in uv_maps:
- layout.operator(
- CopyAndPasteUVCopyUVMapSubOpt.bl_idname,
- text=m).uv_map = m
-
-
-# paste UV map (s
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list