Blender (jusqu'à 2.49)
Python 
To force all the faces 
of all the selected meshes objects 
to pass in mode TWOSIDE
or anything else selected 
in the list .
(version française)
    Début   Index
previous Script Python
Under construction Next 

Download the script  : UV_AllFacesfForceModes.py
 

#!BPY

""" Registration info for Blender menus: <- these words are ignored
Name: 'Force all UVs to TwoSide'
Blender: 241
Group: 'UV'
Tip: 'Force all faces of all selected objects with uvcoordinates to be set as selected modes and transparency  .'
"""
"""
(c) jm soler 2006 (updated 26/09/2009)
""" 
import Blender
from Blender import NMesh,Scene,Object

name=['All ',
      'Tex ',
      'Tiles ',
      'Light ',
      'Invisible ',
      'Collision ',
   'Shared ',
   'Twoside ',
      'ObColor ',
   'Halo ',
   'BillBoard ',
      'Shadow ',
   'Text ',
   'Select only one ',
   'Opaque ',
   'Add ',
   'Alpha ',
   'Sub ',
   'Only Selected',
   'OK']

tooltips=['All, set all UV face modes',
          'Tex,Render face with texture',
     'Tiles, Use tilemode for face',
     'Light, Use light for face',
     'Invisible, Make face invisible',
         'Collision,Use face for collision detection',
     'Shared,Blend vertex colors across face when vertices are shared',
     'Twoside,Render face twosided',
         'ObColor,Use ObColor instead of vertex colors',
     'Halo,Screen aligned billboard',
     'BillBoard,Billboard with Z-axis constraint',
         'Shadow,Face is used for shadow',
     'Text,Enable bitmap text on face',
          'Transparency : select only one  ',
       'Opaque, transparency settings you should  select only one   ',
       'Add, transparency settings you should  select only one  ',
       'Alpha,transparency settings you should  select only one   ',
       'Sub,transparency settings you should  select only one   ',
       'Only Selected,  only text', 
     'OK, Process only selected faces']

modes=[32725,#ALL
       4,    #TEX
    128,  #TILES
    16,   #LIGHT
    1024, #INVISIBLE
    1,    #COLLISION
    64,   #'SHAREDVERT',
    512,  #'TWOSIDE', 
    2048, #'OBCOL', 
    256,  #'HALO', 
    4096, #'BILLBOARD', 
    8192, #'SHADOW', 
    16384,   #'TEXT',
       '',
    0,    #'Opaque ',
    1,    #'Add ',
    2,    #'Alpha ',
    3,    #'Sub ',
    ''  'Only Selected,  only text', 
       ''
   ]

""" 
SOLID  :  0
ALPHA  :  2
ADD  :  1
SUB  :  3
"""

"""
ALL : 16381
DYNAMIC  :  1
TEX  :  4
SHAREDVERT  :  8
LIGHT  :  16
SHAREDCOL  :  64
TILES  :  128
HALO  :  256
TWOSIDE  :  512
INVISIBLE  :  1024
OBCOL  :  2048
BILLBOARD  :  4096
SHADOW  :  8192
"""

tog = [[Blender.Draw.Create(0),name[n],tooltips[n],modes[n]] for n in range(20)]

block = []

block.append("UV options")
for n in range(13) :
 block.append((name[n], tog[n][0])) 
block.append(name[13])
for n in range(14,18,1) :
 block.append((name[n], tog[n][0])) 
block.append(name[18])
block.append((name[19], tog[19][0])) 
 

retval = Blender.Draw.PupBlock("Force UV data", block)
if retval :
 mode=1
 transp=0
 #prepare la variable modes
 if tog[0][0].val==1 :
  print tog[3]
  mode=tog[0][3]
  print mode
 else : 
  for t in tog[:13]:
   if t[0].val==1 : 
    print t[3]
    mode |= t[3]
 for t in tog[14:18]:
   if t[0].val==1 : 
    print t[3]
    transp = t[3]
 

 # on recupere tous mesh abec de l'uvmapping 
 Mesh_objects=[M for M in Scene.getCurrent().getChildren() 
                  if M in Object.GetSelected() 
                          and M.getType()=='Mesh' 
                          and  M.getData().hasFaceUV()]

 for O in  Mesh_objects :
  M= O.getData()
  if tog[13][0]:
    for f in M.faces :
     if f.sel : 
       f.mode=mode
       f.transp=transp
  else :
    for f in M.faces : 
      f.mode=mode
      f.transp=transp

  M.update()


 
précédentScript Python
 En Chantier Suivant
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