Skip to content

Commit

Permalink
Version 3.1 released
Browse files Browse the repository at this point in the history
  • Loading branch information
nutti committed Jun 16, 2015
1 parent 041d9b7 commit 16e5ae7
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 64 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ If you want to try newest but unstable version, you can download it from [unstab
|Version|Download URL|
|---|---|
|*unstable*|[Download](https://github.com/nutti/Copy-And-Paste-UV/archive/develop.zip)|
|3.1|[Download](https://github.com/nutti/Copy-And-Paste-UV/releases/tag/v3.1)|
|3.0|[Download](https://github.com/nutti/Copy-And-Paste-UV/releases/tag/v3.0)|
|2.2|[Download](https://github.com/nutti/Copy-And-Paste-UV/releases/tag/v2.2)|
|2.1|[Download](https://github.com/nutti/Copy-And-Paste-UV/releases/tag/v2.1)|
Expand Down Expand Up @@ -94,7 +95,8 @@ This add-on's features are as follows.
7. (*optional*) You can control precision or strategy from toolshelf option when UVs are transfered incorrectly.

[![](http://img.youtube.com/vi/rbP0hExl3Zc/0.jpg)](https://www.youtube.com/watch?v=rbP0hExl3Zc)
[![](http://img.youtube.com/vi/p1W6jugsyZw/0.jpg)](https://www.youtube.com/watch?v=p1W6jugsyZw)
[![](http://img.youtube.com/vi/p1W6jugsyZw/0.jpg)](https://www.youtube.com/watch?v=p1W6jugsyZw)
[![](http://img.youtube.com/vi/LicrCKTV5kM/0.jpg)](https://www.youtube.com/watch?v=LicrCKTV5kM)

## Related Links

Expand All @@ -109,6 +111,7 @@ See the link below for further details.
## Change Log
|Version|Release Date|Change Log|
|---|---|---|
|3.1|2015.6.17|Improve feature<br> - Transfer UV|
|3.0|2015.6.15|[1] **Add feature**<br> - Flip/Rotate UVs<br> - Transfer UV<br>[2] Optimization/Refactoring<br>[3] Fixed bugs|
|2.2|2015.4.11|[1] Fixed bug<br>[2] Refactoring|
|2.1|2015.1.23|Fixed bug for Blender 2.73|
Expand Down
6 changes: 3 additions & 3 deletions uv_copy_and_paste_uv/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@

__author__ = "Nutti <nutti.metro@gmail.com>"
__status__ = "production"
__version__ = "3.0"
__date__ = "15 Jun 2015"
__version__ = "3.1"
__date__ = "17 Jun 2015"

bl_info = {
"name": "Copy and Paste UV",
"author": "Nutti",
"version": (3, 0),
"version": (3, 1),
"blender": (2, 73, 0),
"location": "UV Mapping > Copy and Paste UV",
"description": "Copy and Paste UV data",
Expand Down
10 changes: 8 additions & 2 deletions uv_copy_and_paste_uv/cpuv_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,21 @@
import bpy
import bmesh
from collections import namedtuple
from . import cpuv_properties

__author__ = "Nutti <nutti.metro@gmail.com>"
__status__ = "production"
__version__ = "3.0"
__date__ = "15 Jun 2015"
__version__ = "3.1"
__date__ = "17 Jun 2015"

SelectedFaceInfo = namedtuple('SelectedFaceInfo', 'normal indices center')


def debug_print(*s):
if cpuv_properties.DEBUG:
print(s)


class View3DModeMemory():
__mode_orig = None

Expand Down
4 changes: 2 additions & 2 deletions uv_copy_and_paste_uv/cpuv_default_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

__author__ = "Nutti <nutti.metro@gmail.com>"
__status__ = "production"
__version__ = "3.0"
__date__ = "15 Jun 2015"
__version__ = "3.1"
__date__ = "17 Jun 2015"


# copy UV
Expand Down
6 changes: 3 additions & 3 deletions uv_copy_and_paste_uv/cpuv_fliprot_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

__author__ = "Nutti <nutti.metro@gmail.com>"
__status__ = "production"
__version__ = "3.0"
__date__ = "15 Jun 2015"
__version__ = "3.1"
__date__ = "17 Jun 2015"


# flip/rotate
Expand All @@ -34,7 +34,7 @@ class CPUVFlipRotate(bpy.types.Operator):

bl_idname = "uv.flip_rotate"
bl_label = "Flip/Rotate UV"
bl_description = "Flip/Rotate UV."
bl_description = "Flip/Rotate UV"
bl_options = {'REGISTER', 'UNDO'}

flip = BoolProperty(
Expand Down
4 changes: 2 additions & 2 deletions uv_copy_and_paste_uv/cpuv_menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

__author__ = "Nutti <nutti.metro@gmail.com>"
__status__ = "production"
__version__ = "3.0"
__date__ = "15 Jun 2015"
__version__ = "3.1"
__date__ = "17 Jun 2015"

from . import cpuv_default_operation
from . import cpuv_selseq_operation
Expand Down
9 changes: 7 additions & 2 deletions uv_copy_and_paste_uv/cpuv_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@

__author__ = "Nutti <nutti.metro@gmail.com>"
__status__ = "production"
__version__ = "3.0"
__date__ = "15 Jun 2015"
__version__ = "3.1"
__date__ = "17 Jun 2015"


global topology_copied
topology_copied = []

DEBUG = False

# Properties used in this add-on.
class CPUVProperties():
default = None
Expand Down
8 changes: 4 additions & 4 deletions uv_copy_and_paste_uv/cpuv_selseq_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

__author__ = "Nutti <nutti.metro@gmail.com>"
__status__ = "production"
__version__ = "3.0"
__date__ = "15 Jun 2015"
__version__ = "3.1"
__date__ = "17 Jun 2015"


# copy UV (by selection sequence)
Expand All @@ -34,7 +34,7 @@ class CPUVSelSeqCopyUV(bpy.types.Operator):

bl_idname = "uv.cpuv_selseq_copy_uv"
bl_label = "Copy UV (Selection Sequence)"
bl_description = "Copy UV data by selection sequence."
bl_description = "Copy UV data by selection sequence"
bl_options = {'REGISTER', 'UNDO'}

def execute(self, context):
Expand Down Expand Up @@ -65,7 +65,7 @@ class CPUVSelSeqPasteUV(bpy.types.Operator):

bl_idname = "uv.cpuv_selseq_paste_uv"
bl_label = "Paste UV (Selection Sequence)"
bl_description = "Paste UV data by selection sequence."
bl_description = "Paste UV data by selection sequence"
bl_options = {'REGISTER', 'UNDO'}

flip_copied_uv = BoolProperty(
Expand Down
64 changes: 21 additions & 43 deletions uv_copy_and_paste_uv/cpuv_transfer_uv_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,15 @@

import bpy
import bmesh

from collections import OrderedDict
from . import cpuv_properties
from . import cpuv_common

__author__ = "Nutti <nutti.metro@gmail.com>, Mifth"
__status__ = "production"
__version__ = "3.0"
__date__ = "15 Jun 2015"
__version__ = "3.1"
__date__ = "17 Jun 2015"

global topology_copied
topology_copied = []

class CPUVCopiedStuff():

Expand All @@ -45,7 +44,7 @@ class CPUVTransferUVCopy(bpy.types.Operator):

bl_idname = "uv.transfer_uv_copy"
bl_label = "Transfer UV Copy"
bl_description = "Transfer UV Copy."
bl_description = "Transfer UV Copy"
bl_options = {'REGISTER', 'UNDO'}

def execute(self, context):
Expand All @@ -56,11 +55,8 @@ def execute(self, context):
self.report({'WARNING'}, "No UV Map!!")
return {'CANCELLED'}

uv_layer = bm.loops.layers.uv.active
#uv_layer = bm.loops.layers.uv.verify()

topology_copied.clear()

uv_layer = bm.loops.layers.uv.verify()
cpuv_properties.topology_copied.clear()
all_sorted_faces = main_parse(self, active_obj, bm, uv_layer)
if all_sorted_faces:
for face_data in all_sorted_faces.values():
Expand All @@ -71,7 +67,7 @@ def execute(self, context):
uvs.append(loop.uv.copy())
pin_uvs.append(loop.pin_uv)

topology_copied.append([uvs, pin_uvs])
cpuv_properties.topology_copied.append([uvs, pin_uvs])

bmesh.update_edit_mesh(active_obj.data)

Expand All @@ -84,7 +80,7 @@ class CPUVTransferUVPaste(bpy.types.Operator):

bl_idname = "uv.transfer_uv_paste"
bl_label = "Transfer UV Paste"
bl_description = "Transfer UV Paste."
bl_description = "Transfer UV Paste"
bl_options = {'REGISTER', 'UNDO'}

def execute(self, context):
Expand All @@ -95,25 +91,24 @@ def execute(self, context):
self.report({'WARNING'}, "No UV Map!!")
return {'CANCELLED'}

uv_layer = bm.loops.layers.uv.active
#uv_layer = bm.loops.layers.uv.verify() # another approach
uv_layer = bm.loops.layers.uv.verify() # another approach

all_sorted_faces = main_parse(self, active_obj, bm, uv_layer)
if all_sorted_faces:
# check ammount of copied/pasted faces
if len(all_sorted_faces) != len(topology_copied):
self.report({'WARNING'}, "Mesh has different ammount of faces!!")
# check amount of copied/pasted faces
if len(all_sorted_faces) != len(cpuv_properties.topology_copied):
self.report({'WARNING'}, "Mesh has different amount of faces!!")
return {'CANCELLED'}

for i, face_data in enumerate(all_sorted_faces.values()):
copied_data = topology_copied[i]
copied_data = cpuv_properties.topology_copied[i]

# check ammount of copied/pasted verts
# check amount of copied/pasted verts
if len(copied_data[0]) != len(face_data[2]):
bpy.ops.mesh.select_all(action='DESELECT')
list(all_sorted_faces.keys())[i].select = True # select problematic face

self.report({'WARNING'}, "Face have different ammount of verts!!")
self.report({'WARNING'}, "Face have different amount of verts!!")
return {'CANCELLED'}

for j, uvloop in enumerate(face_data[2]):
Expand Down Expand Up @@ -203,7 +198,6 @@ def main_parse(self, active_obj, bm, uv_layer):
new_faces = parse_faces(face, face_stuff, used_verts, used_edges, all_sorted_faces, uv_layer, self)

if new_faces == 'CANCELLED':
#break
self.report({'WARNING'}, "More than 2 faces share edge!!")
return None

Expand All @@ -229,37 +223,36 @@ def parse_faces(check_face, face_stuff, used_verts, used_edges, all_sorted_faces
face_sel.select = True

shared_faces = []
#break
return 'CANCELLED'

clear_shared_faces = get_new_shared_faces(check_face, sorted_edge, shared_faces, all_sorted_faces.keys())

if clear_shared_faces:
shared_face = clear_shared_faces[0]
#if check_face is shared_face:
#shared_face = clear_shared_faces[1]

# get verts of the edge
vert1 = sorted_edge.verts[0]
vert2 = sorted_edge.verts[1]

#print(face_stuff[0], vert1, vert2)
cpuv_common.debug_print(face_stuff[0], vert1, vert2)
if face_stuff[0].index(vert1) > face_stuff[0].index(vert2):
vert1 = sorted_edge.verts[1]
vert2 = sorted_edge.verts[0]

#print(shared_face.verts, vert1, vert2)
cpuv_common.debug_print(shared_face.verts, vert1, vert2)
new_face_stuff = get_other_verts_edges(shared_face, vert1, vert2, sorted_edge, uv_layer)
all_sorted_faces[shared_face] = new_face_stuff
used_verts.update(shared_face.verts)
used_edges.update(shared_face.edges)

#shared_face.select = True # test which faces are parsed
if cpuv_properties.DEBUG:
shared_face.select = True # test which faces are parsed

new_shared_faces.append(shared_face)

return new_shared_faces


def get_new_shared_faces(orig_face, shared_edge, check_faces, used_faces):
shared_faces = []

Expand All @@ -270,21 +263,6 @@ def get_new_shared_faces(orig_face, shared_edge, check_faces, used_faces):
return shared_faces


#def grow_selection(used_verts, used_faces, bm):
#growed_faces = []
#growed_verts = []

#for face in bm.faces:
#if face not in used_faces:
#for vert in face.verts:
#if vert in used_verts:
#growed_faces.append(face)
#growed_verts += [vert2 for vert2 in face.verts]
#break

#return [growed_faces, growed_verts]


def get_other_verts_edges(face, vert1, vert2, first_edge, uv_layer):
face_edges = [first_edge]
face_verts = [vert1, vert2]
Expand Down
4 changes: 2 additions & 2 deletions uv_copy_and_paste_uv/cpuv_uvmap_operation.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

__author__ = "Nutti <nutti.metro@gmail.com>"
__status__ = "production"
__version__ = "3.0"
__date__ = "15 Jun 2015"
__version__ = "3.1"
__date__ = "17 Jun 2015"


# copy UV map (sub menu operator)
Expand Down

0 comments on commit 16e5ae7

Please sign in to comment.