Blender (jusqu'à 2.49)
Python
Copie les coordonnées uv 
vers les sommets du mesh sélectionné
(version française)
    Début   Index
previoustScript Python
Script color 2 material Nextt

Copy co-ordinates UV towards the vertices of the selected mesh

Download the script 

In  development .  For the moment, the script does not take account of the unfoldings of co-ordinates on the vertices displayed in the uv window . it works with a single face at once . But iIt can be very useful to get correctl position image in background uvmapped mesh  for a modelling.  See this page:  cpl_uvmappingdiedre.htm

Just a few notes :

1/ this script returns better aspcet ratio values than the alt-v shortcut when the original object shape is not a perfect square or a rectangle 

2/ It is also naturally faster, lighter since one do not have to add a material + a texture image .

3/ More intuitive since one can draw directly the shape around the wanted part of the image in the uvwindow .


 
#!BPY

""" Registration info for Blender menus: <- these words are ignored
Name: 'UVcoord2mesh'
Blender: 237
Group: 'UV'
Tip: 'Use UV coord to deform selected mesh . It currently only works a lone face, sorry . '
"""
__author__ = "Jean-Michel Soler (jms)"
__url__ = ("blender", "elysiun",
"Script's homepage, http://jmsoler.free.fr/didacticiel/blender/tutor/python_uv2mesh.htm",
"Communicate problems and errors, http://www.zoo-logique.org/3D.Blender/newsportal/thread.php?group=3D.Blender")
__version__ = "0.1 08/2005"

__bpydoc__ = """\

"""

#----------------------------------------------
# uvcoord2meshr script (c) 08/2005  jean-michel soler
# http://jmsoler.free.fr/didacticiel/blender/tutor/python_uv2mesh.htm
# this script is released under GPL licence
# for the Blender 2.33 scripts distribution
#----------------------------------------------
# Official page :
# http://jmsoler.free.fr/didacticiel/blender/tutor/cpl_uvpainting.htm
# Communicate problems and errors on:
# http://www.zoo-logique.org/3D.Blender/newsportal/thread.php?group=3D.Blender 
#----------------------------------------------
#--------------------------------------------- 
# ce script est proposé sous licence GPL pour etre associe
# a la distribution de Blender 2.33 et suivant
# --------------------------------------------------------------------------
# this script is released under GPL licence
# for the Blender 2.37/2.38 scripts package
# --------------------------------------------------------------------------
# ***** BEGIN GPL LICENSE BLOCK *****
#
# Script copyright (C) 2005: Jean-Michel Soler 
#
# 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
#
# ***** END GPL LICENCE BLOCK *****
# --------------------------------------------------------------------------

import Blender 
from Blender import NMesh,Object 
try :
  MESH=Blender.Object.GetSelected()[0].getData() 
  Blender.Object.GetSelected()[0].setSize(1.0,1.0,1.0)
  SF=[s for s in MESH.faces if s.sel==1 or s in MESH.getSelectedFaces()] 
  prop=1.0
  verbose=1
  for f in SF:
    if f.image:
       im=Blender.Image.Get(f.image.name)
       if verbose:   print 'images :',im
       break
  if im:
     imX,imY = im.getMaxXY() 
     prop=float(imX)/float(imY)
     if verbose: print 'prop : ',prop 
  for   f in SF: 
     n=0 
     for v in f.uv: 
        if verbose:  print 'v',v 
        if verbose:  print 'f.v[%s].co'%n,f.v[n].co 
        f.v[n].co[0]=v[0]*prop 
        f.v[n].co[1]=v[1]
        f.v[n].co[2]=0.0 
        n+=1 
  MESH.update()
except :
 print "perhaps not a mesh or no object selected ."

Link to the elysiun page
 
previous Script Python
 Script color 2 material Nextt
Vers le  Haut de page

 

 


 
 

Les questions concernant cette page  peuvent être posées sur  :
news://news.zoo-logique.org/3D.Blender

Livre en français
Blender : apprenez, pratiquez, Créez, livre, Ed. Campus Press, coll. Starter Kit
Blender Starter Kit

Forum
FAQ
Lexique
Didacticiels
Compilations
Blender2KT
Débuter
Modelage
Blender python
Materiaux
Lumière
Animation
API python (eng)
Archives nzn
Statistiques
Doc flash Sculptris
Galerie Sculptris

mon site de démos sur youtube