Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToni Alatalo <antont@kyperjokki.fi>2006-01-31 22:47:52 +0300
committerToni Alatalo <antont@kyperjokki.fi>2006-01-31 22:47:52 +0300
commit436d682406525186d926ef0a79c23b1654e02256 (patch)
tree184dded43add8dcfd7d0029994a45351fab7cd53 /release
parente53bb5b34282c7141438522ac604434bd14b92b3 (diff)
an initial version of a simple UV copy script, gotta decide and implement the UI integration still, is .. eh suboptimal here, but is noted with XXX in comments with suggestions :) .. thanks for theeth and others on Elysiun who made this, and for Unnamed on irc for digging up .. seems that NMesh -> Mesh conversion was not necessary, but might be a nice excercise.
Diffstat (limited to 'release')
-rw-r--r--release/scripts/uvcopy.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/release/scripts/uvcopy.py b/release/scripts/uvcopy.py
new file mode 100644
index 00000000000..b201d31e2a8
--- /dev/null
+++ b/release/scripts/uvcopy.py
@@ -0,0 +1,41 @@
+#!BPY
+""" Registration info for Blender menus: <- these words are ignored
+Name: 'UVcopy'
+Blender: 242
+Group: 'UV'
+Tip: 'Copy UV coords from a mesh to another that has same vertex indices'
+"""
+
+__author__ = "Martin Poirier, Toni Alatalo et. al."
+__url__ = ("blender", "elysiun",
+"Script's homepage, http://www.elysiun.com/forum/viewtopic.php?t=14897",
+"Communicate problems and errors, http://www.elysiun.com/forum/viewtopic.php?t=14897")
+__version__ = "0.1 01/2006"
+
+__bpydoc__ = """\
+This script copies UV coords from a mesh to another (version of the same mesh).
+"""
+
+import Blender
+
+Name_From = "Unwrapped" #XXX active and 1st selected object, or what? two first selected?
+Name_To = "Original"
+
+me1 = Blender.Object.Get(Name_To)
+me2 = Blender.Object.Get(Name_From)
+
+if me1:
+ me1 = me1.getData()
+else:
+ print "No object named "+Name_To+"."
+
+if me2:
+ me2 = me2.getData()
+else:
+ print "No object named "+Name_From+"."
+
+if me1 and me2:
+ for i in range(len(me1.faces)):
+ me1.faces[i].uv = me2.faces[i].uv
+ me1.update()
+ print "Copied UV from object "+Name_From+" to object "+Name_To+"."