Copy and Paste UV Coordinates
Closed, ResolvedPublic

Description

Project: Blender Extensions
Tracker: Python Scripts Upload
Blender: 2.69 - 2.71
Category: UV
Python: 3.3 - 3.4
Script name: Copy And Paste UV
Author(s): Nutti
Status: Open

I'm the first time posting.
So, please comment if there are some problems.

This is a duplicate development with T32562.
https://developer.blender.org/T32562

I rewrite add-on, because above add-on can not copy adjacent vertices.
Since most of parts are rewritten, I posted new task instead of comments on T32562.

[github]
https://github.com/nutti/Copy-And-Paste-UV

Usage is almost same.

  1. Select vertices which UV will be copied.
  2. Click 'U' - Copy UV.
  3. Select vertices which UV will be pasted.
  4. Click 'U' - Paste UV.

Any problems and comments are welcome.

Thanks.

Details

Type
Patch
There are a very large number of changes, so older changes are hidden. Show Older Changes
Nutti (Nutti) raised the priority of this task from to Needs Triage.Feb 3 2014, 2:53 PM
Nutti (Nutti) claimed this task.
Nutti (Nutti) added a project: Addons.
Nutti (Nutti) set Type to Patch.
Nutti (Nutti) triaged this task as Normal priority.
Nutti (Nutti) added a subscriber: Nutti (Nutti).

Too bad this does not copy seams aswell :(

Thanks for your comment!

Please, let me know your operation more detail.
Is there any relation to seam data and "raw" UV coordinate?
This add-on targets to copy raw UV coordinate, so it's reasonable not to copy seams.

I'd like to know what your expected behavior on this plugin about seams.

I did not expect this plugin to copy seams. I just wish it somehow was possible to, as after making several alterations of my character hands I came to realization I had made the materials wrong. As all hands need to be exactly the same texture-wise ( I am making an animated object for Second Life) if I want to use the same texture on all of them. Remaking all UV maps was painstakingly slow, although this did help tremendously.

WOW!
Your version of the addon works 10 times faster!
i think we can replace this addon https://developer.blender.org/T32562 with your one. Your addon is really fast!

I have just tested it. The only issue i found - you need to make a check if copied uvs and selected uvs have the same size.
Can you fix it and talk to @ideasman42 on IRC to replace the addon?

Thanks.

Nutti (Nutti) added a comment.EditedAug 18 2014, 3:45 PM

Thanks for your comment and bug report.
I fixed it now.

https://github.com/nutti/Copy-And-Paste-UV_Blender-Ext

Can you fix it and talk to @ideasman42 on IRC to replace the addon?

OK, but I'm newcommer, I would like to know where should I talk to @ideasman42.

Great!

Go here http://webchat.freenode.net/
Channel #blendercoders

You can pick Ideasman42.
Or me mifth.

But Ideasman_42 offline right now. You need to get him.
Or get Mont29. He is a boss there too. :)

They will give you commit access ti git repository. Also you will need to add your ssh-public key in developer.blender.org settings.

Thanks for sharing information!

Go here http://webchat.freenode.net/

chat tool !?
Oops, I can't speak English well :(
Is there another way to contact @Ideasman42 ?
For example, e-mail or bbs etc...

I know no other way.
If you have issues, then i can commit it as i committed previous script .

But you will have no chance to make fixes. As i can't give you commit access.

I know no other way.

On IRC, I speak many developers and they teach me following links.
http://wiki.blender.org/index.php/Dev:Doc/Process/Addons

I will start to read it, and commit to git repository.

Thanks.

I'm reading wiki page.
I have some questions about it.

  • Should this add-on be code reviewed?
  • How to create wiki pages? (From "create" tab, I couldn't create new page.)
  • Which directory should I commit add-on, release/scripts/addons_contrib or release/scripts/addons?

Thank you!

I could edit wiki page : http://wiki.blender.org/index.php/Extensions:2.6/Py/Scripts/UV/Copy_Paste_UVs
However I couldn't push module to remote repos.
Error was shown as follows.

...(already commited to local repos)
$ git push origin master
fatal: remote error: access denied of repository not exported: /blender-addons-contrib.git

They will give you commit access ti git repository. Also you will need to add your ssh-public key in developer.blender.org settings

Is this old comment solve the problem?

Looking at log - issue is with commit access.

yes you must to add public ssh key. commit access is going through the ssh key.

also, does blender devs add you to commit access?

I added public ssh key from setting in developer.blender.org.

does blender devs add you to commit access?

Maybe, not yet.
Will commit access be added by Ideasman_42 or Mont29?

I guess both can add the access.
For my scripts - Ideasman_42 added me the the access.

I contacted Mont29, but he says that he hasn't commit right in git.
And, I can't see Ideasman_42 in right window in IRC.

Is there any person who can give me access git master repos?

Ideasman_42 right now is in IRC. his nick "Ideasman42". Can you go into IRC right now?

Ok, i talked him. But you need to find him in the IRC. But he has Austarlian time.

<ideasman42> hi
<mifth> we have a discussion in the blender.developer here https://developer.blender.org/T38460
<mifth> @Nutti (Nutti) will contact you to commit new refactored CopyanPaste addon
<mifth> CopyAndPaste*
<ideasman42> eeh, I was going to head off to bed soon
<ideasman42> so - if its quick its fine
<ideasman42> but now isnt great time
<mifth> :)
<mifth> ahh sorry
<ideasman42> in ~8hrs is 8am

Thank you for talking to Ideasman42.

But he has Austarlian time.

It's too bad :(
I can talk at 21:00 to 1:00 in Australian time on a week day.
OK, I will talk him on a holiday.

No rush. You will do it! :)

Also, could you make a blenderartists thread? So that people can make posts abut bugs/features.

Nutti (Nutti) renamed this task from Copy And Paste UV Coordinates to Copy and Paste UV Coordinates.Aug 31 2014, 1:23 PM
Nutti (Nutti) updated the task description. (Show Details)

I contacted @Ideasman42.

However, @Ideasman42 says that this add-on should be reviewed before commit.
so, i revised add-on to meet the pep8 and best practice.
and, i created code review site here: https://developer.blender.org/D768

please teach me, what should I do next before commit?

Hello!

Great that you did it! Actually, i have never did commit-review. I just committed to "release/scripts/addons_contrib" blender git repo. I think you need to talk to @Ideasman42 again and show him your new created commit.
If you will have any troubles just write me here again.

@Nutti (Nutti) @Ideasman_42 accepted your commit review.
https://developer.blender.org/D768

Can you commit it? Or it's committed?

Nutti (Nutti) updated the task description. (Show Details)Sep 5 2014, 3:36 PM

I revised scripts to reflect review.
And I tried to push master repo in reference to http://wiki.blender.org/index.php/Dev:Doc/Tools/Git, however I couldn't.

The last two procedure failed with "Permission denied".
@Ideasman_42 may add me to commit access, so I have no idea to solve this error.

git pull --rebase
git push

Just contact to @Ideasman42 in IRC. And ask him to add you to commit access. he should add you.

The last thing left! :) You will do it!

Finally, i commited my plugin!

i created account on http://blenderartists.org/forum/index.php, however i couldn't post new thread on there.
How should i to post new thread?

Great news! Thank you for your super cool contribution! I'll use it every day on my job for UV matters.

Just login. And press "Post New Thread" orang button. Here http://blenderartists.org/forum/forumdisplay.php?48-Released-Scripts-and-Themes

I could post new thread about this plugin.
http://blenderartists.org/forum/showthread.php?348421-Addon-Copy-and-Paste-UV-Coordinates

All tasks may be completed, but I will continue developing and maintaining this plugin.

Thanks for your kindness in this task.
It's a great opportunity for me to develop add-on.

I've run into a problem with this script. I'm not sure if it's a limitation of Blender, an error in the script, or user error but it goes as follows:

I have 2 nearly identical models which were built separately: Wall, Rounded Corner Wall. These two objects have the exact same number of faces, identical indexes manually setup via selecting rows of faces, and using (W > Sort Mesh Elements > Selected) and I've confirmed they are identical face indexes using an add on called: "Index Visualiser (BMesh)" to show the index of each face.

When I copy the UV from my properly set up mesh "Wall" and copy paste it to the new mesh "Rounded Corner Wall", the placement of the UV is correct, but each piece seems to be rotated 90 degrees, and squashed because of the rotation giving it the wrong ratio.

I've not been able to find any work around for this short of:

  • Select 1 face on Object 1.
  • Copy UVs
  • Select 1 face on Object 2.
  • Paste UVs.
  • Repeat until every last face has been copy-pasted 1 by 1.

(Obviously not an efficient use of this script.)

Any help would be greatly appreciated. The script seems very promising, and I hope there's a solution for this problem. Thanks.

Hi there,

I was testing this addon again and wanted to copy a part of a uv map from the same mesh over to another uv map in the mesh. This couldnt be done or at least i wasnt able to do so. My workaround was copying the mesh than copy the part of the uvmap over to the copied mesh stitch it all together and copy all of this back to the original mesh. Is there a possibility to make it work on a single mesh between different uv maps?

When I copy the UV from my properly set up mesh "Wall" and copy paste it to the new mesh "Rounded Corner Wall", the placement of the UV is correct, but each piece seems to be rotated 90 degrees, and squashed because of the rotation giving it the wrong ratio.

Sorry, I couldn't understand your problems.
Please show me your problems with some screenshots.
I think this script may have problem at copying ordering.

I've not been able to find any work around for this short of:

  • Select 1 face on Object 1.
  • Copy UVs
  • Select 1 face on Object 2.
  • Paste UVs.
  • Repeat until every last face has been copy-pasted 1 by 1. (Obviously not an efficient use of this script.)

From this, do you intend to copy more than two faces at once?

I was testing this addon again and wanted to copy a part of a uv map from the same mesh over to another uv map in the mesh. This couldnt be done or at least i wasnt able to do so. My workaround was copying the mesh than copy the part of the uvmap over to the copied mesh stitch it all together and copy all of this back to the original mesh. Is there a possibility to make it work on a single mesh between different uv maps?

Do you want to copy mesh between "UV maps" rather than between "Meshes"?
Some research must be needed to work this. Please wait for me...

When I copy the UV from my properly set up mesh "Wall" and copy paste it to the new mesh "Rounded Corner Wall", the placement of the UV is correct, but each piece seems to be rotated 90 degrees, and squashed because of the rotation giving it the wrong ratio.

Sorry, I couldn't understand your problems.
Please show me your problems with some screenshots.
I think this script may have problem at copying ordering.

I've not been able to find any work around for this short of:

  • Select 1 face on Object 1.
  • Copy UVs
  • Select 1 face on Object 2.
  • Paste UVs.
  • Repeat until every last face has been copy-pasted 1 by 1. (Obviously not an efficient use of this script.)

From this, do you intend to copy more than two faces at once?

I've made a video to demonstrate the issue on a simple plane.

http://youtu.be/nOq35BBCNKo

This is meant to show the problem on something very simple, but should be applicable to more complicated things as well. This script would be way more powerful if it could take into account HOW a selection is made, and how the object sits in relation to the world. (Currently, the faces will sometimes copy over with odd rotations if the faces were created using fill, or extrude.) So, being able to use the object's rotation in relation to the environment, could be really useful.

I was testing this addon again and wanted to copy a part of a uv map from the same mesh over to another uv map in the mesh. This couldnt be done or at least i wasnt able to do so. My workaround was copying the mesh than copy the part of the uvmap over to the copied mesh stitch it all together and copy all of this back to the original mesh. Is there a possibility to make it work on a single mesh between different uv maps?

OK, I have revised script, and this script supports copy/paste between UV maps.
New menu (Copy UV Map, Paste UV Map) are added.
You can try this script below link. (Download from "Download ZIP" button.)

https://github.com/nutti/Copy-And-Paste-UV_Blender-Ext

Some bugs may be exist, because this script has not tested yet.
If you have no problem, I will submit this plugin to blender repos.
Thanks.

I've made a video to demonstrate the issue on a simple plane.

http://youtu.be/nOq35BBCNKo

This is meant to show the problem on something very simple, but should be applicable to more complicated things as well. This script would be way more powerful if it could take into account HOW a selection is made, and how the object sits in relation to the world. (Currently, the faces will sometimes copy over with odd rotations if the faces were created using fill, or extrude.) So, being able to use the object's rotation in relation to the environment, could be really useful.

Thank you for your great sample.
I'll check this problem.

I understood this problem.
However, this script can't associate faces between source and destination, and I don't know how.

So, some rules are needed.
I'm thinking that select ordering is best for determining copy ordering.
However, I don't know how to get history of face selection.
BMesh may be a good candidate, but there is no tutorials.

If anyone who know how to get history of face selection, please tell me about it.

I was testing this addon again and wanted to copy a part of a uv map from the same mesh over to another uv map in the mesh. This couldnt be done or at least i wasnt able to do so. My workaround was copying the mesh than copy the part of the uvmap over to the copied mesh stitch it all together and copy all of this back to the original mesh. Is there a possibility to make it work on a single mesh between different uv maps?

OK, I have revised script, and this script supports copy/paste between UV maps.
New menu (Copy UV Map, Paste UV Map) are added.
You can try this script below link. (Download from "Download ZIP" button.)

https://github.com/nutti/Copy-And-Paste-UV_Blender-Ext

Some bugs may be exist, because this script has not tested yet.
If you have no problem, I will submit this plugin to blender repos.
Thanks.

Wow thanks Nutti! Works perfect... this saves a shit load of time. I havent noticed or bumped into errors yet!
Thanks for the help

Nutti (Nutti) added a comment.EditedDec 13 2014, 2:30 PM

I've made a video to demonstrate the issue on a simple plane.

http://youtu.be/nOq35BBCNKo

This is meant to show the problem on something very simple, but should be applicable to more complicated things as well. This script would be way more powerful if it could take into account HOW a selection is made, and how the object sits in relation to the world. (Currently, the faces will sometimes copy over with odd rotations if the faces were created using fill, or extrude.) So, being able to use the object's rotation in relation to the environment, could be really useful.

OK, I released rc2 version about this plugin.
Selection sequence copy/paste is now available at this version.
You can try this script below link. (Download from "Download ZIP" button.)
https://github.com/nutti/Copy-And-Paste-UV_Blender-Ext

This plugin will meet the requirement what you want.
Procedure is as follows.

  1. Select faces by clicking (to be copied)
  2. Execute "U" - "Copy UV (Selection Sequence)"
  3. Select faces by clicking (to be pasted)
  4. Execute "U" - "Paste UV (Selection Sequence)"

If you have no problem, I will submit this plugin to blender repos.
Thanks.

Hi @Nutty .

I found the way how to fix UVs flipping.

I did Pull Request on Github: https://github.com/nutti/Copy-And-Paste-UV_Blender-Ext/pull/2
And here is my test video of how it works: http://youtu.be/QCg2TL-NQOw

I also wrote at the forum.

Hi.
There was change in bmesh in 2.73.
Do we need to change something?
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.73/Addons

I submit patch for review.

https://developer.blender.org/D956

@paul geraskin (mifth)
I changed to my plugin for 2.73.
However, this is ad hoc revision.
I will fix this issue for next release.

By the way, should I assign reviewer to this patch?
If yes, who?

If you have commit access - you can just commit without the review. I think.
As you are the creator and the maintainer of this cool script.

But if you want to commit a new addon - then you need to make a review request sure.

Anyway - you can always pick @ideasman_42 in IRC channel. He is cool and always can help.

Finally, I pushed latest plugin to master blender repos.
And, I released ver2.0 on my GitHub page.

https://github.com/nutti/Copy-And-Paste-UV_Blender-Ext/releases/tag/v2.0

Thank you for your help.

Hi.

I downloaded 2.73 nightly build. https://builder.blender.org/download/
But i get crash when i copied then pasted UVs:
Traceback (most recent call last):

File "/home/mifth/Documents/soft/blender/2.73/scripts/addons_contrib/uv_copy_and_paste_uv.py", line 126, in execute
  src_uv_map, dest_obj, dest_sel_face_info)
File "/home/mifth/Documents/soft/blender/2.73/scripts/addons_contrib/uv_copy_and_paste_uv.py", line 499, in paste_opt
  if self.flip_copied_uv is True:
File "/home/mifth/Documents/soft/blender/2.73/scripts/modules/bpy_types.py", line 594, in __getattribute__
  return super().__getattribute__(attr)

AttributeError: 'CopyAndPasteUVPasteUV' object has no attribute 'flip_copied_uv'

location: <unknown location>:-1

@nutty it works great now! Thanks a lot!

@Nutti (Nutti) Hi, just downloaded 2.73 had the same issue as @paul geraskin (mifth), downloaded the dev version. It copies the uv correctly in blender but when a texture is applied its all messed up.
http://i.imgur.com/5kIQUYY.png
http://i.imgur.com/tGDOIC7.png
http://i.imgur.com/M6FNCPw.png

Does this problem arise after this version(2.1)?
And did you copy many UVs all at once?

If you want copy more than one UVs, you should use selection sequence.
Normal copy/paste operation support only one polygon.

@Dustin (shadoskill) Normal copy/paste operation is supposed to copy UVs from the same meshes. For example, you duplicated 20 cubes but you forgot to uwrap your original cube. You can unwrap one original cube then paste its UVs into other duplicates.

Does this problem arise after this version(2.1)?
And did you copy many UVs all at once?

If you want copy more than one UVs, you should use selection sequence.
Normal copy/paste operation support only one polygon.

Selection sequence worked, but that is going to be a pain to select 2.5k faces manually in the exact same order on 4 separate meshes..
They all are identical, just they are stretched differently.

@Dustin (shadoskill) could you support your mesh? I'll test on my machine.

@Dustin (shadoskill)

Yeah, I think it's painful to select many faces manually.

This issue is reported while ago, and I'm trying to support.
However, I have no idea to implement this one now.
I want to know the answer "How to identify same shapes?".
Human can identify similar or same shapes, however "computer" not.

But... Thanks for your report!!
I will make efforts to support your suggestion.

@Dustin (shadoskill) could you support your mesh? I'll test on my machine.

@Dustin (shadoskill)

Yeah, I think it's painful to select many faces manually.

This issue is reported while ago, and I'm trying to support.
However, I have no idea to implement this one now.
I want to know the answer "How to identify same shapes?".
Human can identify similar or same shapes, however "computer" not.

But... Thanks for your report!!
I will make efforts to support your suggestion.

Not sure how any of that stuff works. But in my head, If you seam the orginal mesh and the one to copy to the exact same way, maby something similar to how blender does its unrapping. Its a thought, but no idea if it helps or not.

It can work only in this way http://youtu.be/Z-nJKG1lLic
Original and duplicate should have the same ammount of vertices and the same polygons.
This script is very useful for game development. For example to copy UVs into 10 wooden bulks.

Nutti (Nutti) added a comment.EditedJan 24 2015, 12:56 PM

Released v2.1.

https://github.com/nutti/Copy-And-Paste-UV_Blender-Ext/releases/tag/v2.1

This version added no new features, and only fixed bugs for blender 2.73.

I released v2.2-rc2.

https://github.com/nutti/Copy-And-Paste-UV_Blender-Ext/tree/develop

If there is a problem, please tell me.
If there are no problem until next week, I will release v2.2 and push this plugin to blender's master repos.

Currently, UV editor have a toolbar. Is it possible to give access of this addon tools from UVeditor ?

Nutti (Nutti) added a comment.EditedApr 11 2015, 3:23 PM

@ronan ducluzeau (zeauro)

Year, OK.
What do you want to do by accessing this add-on?

@ronan ducluzeau (zeauro) I think it does not need to n\be in UV editor. As we use only selected faces. Not UVs.

Also, if you check new Modo 901 features of Copy/Paste UVs - they do it in 3d viewport. https://vimeo.com/124320824

Right now i think all is ok and works perfectly in 3d viewport menu.

@paul geraskin (mifth) , in this video, it is a continuous mesh.It looks more like data transfer between two objects than copy/paste UVs between selection sets of same mesh.

@Nutti (Nutti), I would like to copy/paste UVs for similar face region selections sets in UV editor.
After an automatic unwrap, Islands would be packed as 2d elements all easily accessible into UVeditor bounds.
But to select your islands into 3D, you may have to pan, to zoom in/ zoom out or rotate around your 3D model.

With synchronization on, there is no difference between selection of face sets in 3Dview and selection of corresponding UV Islands in UV Editor.

And for people that want to use copy/paste into 3Dview, there could be also an addon panel into shading/UVs Tab.

@ronan ducluzeau (zeauro) no. This is left panel of the 3d viewport in modo. Just like our left panel. But in modo it can be detatched to any panel.
As i said before - all the work happens in 3d viewport mostly.

GitHub repository name has changed.

Newer link is bellow.

Repository: https://github.com/nutti/Copy-And-Paste-UV
Newest release: https://github.com/nutti/Copy-And-Paste-UV/releases/tag/v2.2

Nutti (Nutti) added a comment.EditedMay 3 2015, 3:41 PM

@ronan ducluzeau (zeauro)
I'll released v3.0-rc version near future.
Please confirm this version.
If you want to request new feature to this version, you can request feature from issues on GitHub.
https://github.com/nutti/Copy-And-Paste-UV/issues
Your request is interesting, so I want to discuss about your request too.
Thanks!

Hi,

I made a milestone to v4.0.
If anyone has feature request or bug report, please make issues.
https://github.com/nutti/Copy-And-Paste-UV/milestones/Version%204.0

Thanks.

I released v3.0-rc1.
If there are any problem, I'll submit source code review and push blender's master repos.

https://github.com/nutti/Copy-And-Paste-UV/tree/develop

In this version, I added new features as follows.

  1. Flip/Rotate UV

You can flip or rotate UVs.
https://www.youtube.com/watch?v=qp2Kn1fN96Q

  1. Transfer UV

You can copy/paste many UVs at once.
You NEED only select one face.
https://www.youtube.com/watch?v=rbP0hExl3Zc
https://www.youtube.com/watch?v=p1W6jugsyZw

Nutti (Nutti) added a comment.EditedMay 5 2015, 2:26 PM

@Nutti (Nutti), I would like to copy/paste UVs for similar face region selections sets in UV editor.
After an automatic unwrap, Islands would be packed as 2d elements all easily accessible into UVeditor bounds.
But to select your islands into 3D, you may have to pan, to zoom in/ zoom out or rotate around your 3D model.

With synchronization on, there is no difference between selection of face sets in 3Dview and selection of corresponding UV Islands in UV Editor.

And for people that want to use copy/paste into 3Dview, there could be also an addon panel into shading/UVs Tab.

@ronan ducluzeau (zeauro), @paul geraskin (mifth)
I make issue about this.
https://github.com/nutti/Copy-And-Paste-UV/issues/19

@Nutti (Nutti)
hi, I'm closing this task as the addon is already in contrib, it looks like we have a more recent/same version than the diff:
https://developer.blender.org/D1315 has version 3.0, contrib has version 3.2.
I think the diff could be closed too.
No need to make diffs for each change, minor updates & bug fixes are fine to commit on your own. If your concerned about a new update, please create a new task in the patch section & we can help you. https://developer.blender.org/maniphest/project/3/type/Patch/
Thanks.

By the way, 3.2 version has a good feature.
Topology based copy/paste.
Just like in Houdini and modo.

http://www.youtube.com/watch?v=ddq1J_y1RMc

@Brendon Murphy (meta-androcto)

Thanks.
I think you can close this task.
I will create new task if big change is occurred about this add-on.

@paul geraskin (mifth)

Thank you for your contribution.
But I think we should close this task because it's too old task.