Like I said before, I tried to translate the French documentation of your script to Portuguese and English languages… I realy don’t understand French Language very well, but except by some errors, I think this translation can help some newbie people to understand the script.
####################################################
Script de traduction d’export povanim vers “.n3d”
© jm soler, Mai 2003
Ce script est proposé dans l’état. L’auteur
ne sera pas tenu pour responsable de l’usage qu’on
en fera, ni des dommages causé par son utilisation
quelles que soient les conditions d’utilisation.
NE FONCTIONNE QUE SUR LES FICHIERS STATIQUES
Somente funciona com arquivos estaticos
Only works without animation
#####################################################
####################################################
Pour fonctionner correctement le script doit être
chargé dans le fichier blender que l’on vient d’exporter
English
To correctly get the script working, you need to specify
the blender file name that you want to export without .blend extension
#portuguese
Para o script funcionar corretamente você deverá fornecer o nome
#do arquivo blender que você deseja exportar mas sem a extensão .blend
#####################################################
####################################################
Veuillez donner le nom du fichier blender :
Englis
Give the blender file name…
Portuguese
Forneça o nome do arquivo
#####################################################
file=‘new_name’
####################################################
Le resultat se trouve dans ‘mesh’+file+’.comp’
English
The resulting file will be as follow: ‘mesh’+file+’.comp’
Protuguese
O resultado será encontrado em ‘mesh’+nome do arquivo dado em file+’.comp’
I’m not certain that it’s a correct translation because the file name was
mesh_type+.n3d in povanim\objects folder…
Eu nao estou certo de que esta traducao esteja correta pois o nome do arquivo
foi tipo_de_mesh_.n3d no diretorio povanim\objects
#####################################################
filtre={
“vertex_vectors” : [‘v’, ‘verts.inc’],
“normal_vectors” : [‘vn’, ‘norm.inc’],
“face_indices” : [‘f’, ‘faces.inc’],
“normal_indices” : [’’, ‘nindice.inc’],
“uv_vectors” : [‘vt’, ‘uvco.inc’],
“texture_list” : [’’, ‘text_list.inc’],
“uv_indices” : [’’, ‘uvind.inc’]
}
#----------------------------------------
export type : pov, n3d
english
export to a pov or n3d file
portuguese
tipo de arquivo a exportar : POV, n3d (deve ser deixado em n3d para gerar n3d)
may it was miss translated at now…
devo ter traduzido isto errado…
#----------------------------------------
type=‘n3d’
#----------------------------------------
developpement hors blender
English
Development outside blender (some type of debug feature?)
Portuguese
desenvolvimento fora do blender
#----------------------------------------
devel=0
#----------------------------------------
gestion des repertoires supplémentaires
English
Auxiliar libraries call
Portuguese
Gestão das bibliotecas auxiliares
#----------------------------------------
import os
#----------------------------------------
recuperation de l’adresse absolue des
fichiers
English
getting the absolute adresses of the files
Portuguese
Obtendo os endereços absolutos dos arquivos
#----------------------------------------
if devel==0:
import sys
import Blender
L=sys.path
maybe I need to specify the system path variable in winxp like
was said in a phython tutorial site…
ls=Blender.Get(‘filename’)
I need to give the filename or it’s a know parameter at this time?
ls=Blender.sys.dirname(ls)
if ls not in sys.path:
sys.path.append(ls)
else:
#----------------------------------------
developpement hors blender :blenderfile/py
#----------------------------------------
ls=’…’
#----------------------------------------
exportation groupée : 1 = oui, 0 = non
English
Administrating the exportation : 1 = yes, 0 = no
Portuguese
Administrando a exportação : 1 = sim, 0 = não
#----------------------------------------
bloc=0
if bloc==0:
#----------------------------------------
exportation groupée : 1 = oui, 0 = non
#----------------------------------------
Tout est rangé dans le répertoire objet
il faut vérifier qui’l existe
English
I can’t understand what this phrase means…
but I see that if the directory doen’t exists
the script try to make dir… os.mkdir(variable++povanim++objects
in wich will place the results…
Portuguese
…
#----------------------------------------
try:
os.stat(ls+os.sep+‘povanim’+os.sep+‘objects’)
except:
os.mkdir(ls+os.sep+‘povanim’+os.sep+‘objects’)
try:
#if 1==1:
#----------------------------------------
# ouverture et lecture du fichier cible
# qui contient toutes les informations
# la localisation des données.
# English
# Informational and data locational target file opening and reading
# Portuguese
# Abertura e leitura do arquivo alvo que contém
# todas as informações sobre a localização dos dados
#----------------------------------------
f=open(ls+os.sep+‘povanim’+os.sep+‘mesh’+file+’.inc’,‘r’)
contenu=f.readlines()
f.close()
f=None
f_o=None
#-----------------------------------------
# Quel que soit le type de regroupement
# que l'on choisisse, on garde une trace des
# fichiers que l'on doit importés dans un
# fichier *.comp
# English
# I can't understand the above phrase...
# Portuguese
# ...
#------------------------------------------
if type=='pov':
f=open(ls+os.sep+'povanim'+os.sep+'mesh'+file+'.comp','w')
l=0
nom=''
nom_objet=''
#-----------------------------------------
# Boucle principale :
# Main loop
# Anel principal
#------------------------------------------
while l <=len(contenu)-1:
if contenu[l].find('#declare')!=-1 and\
contenu[l].find('mesh2')!=-1 :
#------------------------------------------
# s'il s'agit d'un fichier unique
# if we want a lone file, only for pov-type tranformation
#------------------------------------------
if (contenu[l].find('#declare')==-1 and\
contenu[l].find('mesh2')==-1) and type=='pov':
f.write(contenu[l]+'
‘)
#-------------------------------------------
# si on veut l’export d’objets séparés
# if we want exportation of separate object
#-------------------------------------------
if bloc==0:
n0=contenu[l].find(’#declare’)+len(’#declare ‘)
n1=contenu[l].find(’ =’)
nom_objet=contenu[l][n0:n1]
#---------------------------
# controle des objets traites
# control the current objects the script is working upon
#---------------------------
print nom_objet
#---------------------------
# ouverture des fichiers objets
# English
# Opening the objects file
#---------------------------
if type==‘pov’:
f_o=open(ls+os.sep+‘povanim’+os.sep+‘objects’+
os.sep+nom_objet+’.inc’,‘w’)
f_o.write(contenu[l])
elif type=='n3d':
f_o=open(ls+os.sep+'povanim'+os.sep+'objects'+\
os.sep+nom_objet+'.n3d','w')
f_o.write('#translation of povanim exported files to .n3d')
print '#translation of povanim files to .n3d'
#---------------------------
# prise en compte des donnes
# dans le fichier mesh "global"
# English
# Take in account the mesh file "global"'s data
# Portuguese
# Leve em conta os dados do arquivo de meshes "global"
#---------------------------
if type=='pov':
f.write('#include "'+ls+os.sep+'povanim'+\
os.sep+'objects'+os.sep+nom_objet+'.inc"
')
while contenu[l].find('}')!=0:
l+=1
if contenu[l].find('}')!=0 and contenu[l].find('uv_mapping')==-1:
d=contenu[l].find('{ #include "')
tag=contenu[l][22:d]
d1=d+len('{ #include "')
#print tag
d2=contenu[l].find(filtre[tag][1])
nom=contenu[l][d1:d2]
d3=filtre[tag][0]
#------------------------------------------
# récupérations des données
# English
# getting the data
# Portuguese
# obtendo os dados
#------------------------------------------
f2=open(ls+os.sep+'povanim'+os.sep+'mesh'+\
os.sep+nom+filtre[tag][1],'r')
fichier_inc=f2.readlines()
f2.close()
#------------------------------------------
# si il s'agit d'un fichier unique
# English
# for a single file
#------------------------------------------
if bloc==1 and type=='pov':
f.write(tag+'{
‘)
f.writelines(fichier_inc)
f.write(’}
// ‘+tag+’
‘)
#-------------------------------------------
# si on veut l’export d’objets séparés
# English
# For several object files
#-------------------------------------------
elif bloc==0 and type==‘pov’:
f_o.write(tag+’{
‘)
f_o.writelines(fichier_inc)
f_o.write(’}
// ‘+tag+’
‘)
#-------------------------------------------
# si on veut l’export d’objets séparés
#-------------------------------------------
elif type==‘n3d’:
if d3!=’’:
if d3==‘v’:
f_o.writelines(’
vertex number '+\
fichier_inc[0])
v=1
while v < len(fichier_inc):
Vl=fichier_inc[v].replace(',','')
Vl=Vl.replace('<','')
Vl=Vl.replace('>','')
f_o.writelines('v'+Vl)
v+=1
if d3=='vn':
f_o.writelines('# normal vector '+fichier_inc[0])
v=1
while v < len(fichier_inc):
Vl=fichier_inc[v].replace(',','')
Vl=Vl.replace('<','')
Vl=Vl.replace('>','')
f_o.writelines('vn'+Vl)
v+=1
"""
#can't be used because data are face based
if d3=='vt':
f_o.writelines('# texture vector '+fichier_inc[0])
v=1
while v < len(fichier_inc):
Vl=fichier_inc[v].replace(',',' ')
Vl=Vl.replace('<','')
Vl=Vl.replace('>','')
f_o.writelines('vt '+Vl)
v+=1
"""
if d3=='f':
f_o.writelines('# faces number '+fichier_inc[0])
ft=1
while ft < len(fichier_inc):
fd=fichier_inc[ft].find('<')+1
ff=fichier_inc[ft].find('>')
Fl=fichier_inc[ft][fd:ff].replace(',',' ')
f_o.writelines('f '+Fl+'
')
#print Fl
ft+=1
pass
if l> len(contenu):
print "arret"
break
else:
if bloc==1 and type=='pov':
if f!=None and contenu[l].find('}')==-1 :
f.write(contenu[l])
elif bloc==0 and type=='pov':
if f_o!=None and contenu[l].find('}')==-1 :
f_o.write(contenu[l])
elif type=='n3d':
pass
#------------------------------------------
# si il s'agit d'un fichier unique
#------------------------------------------
if bloc==1 and type=='pov':
f.write('}// fin de '+nom+'
‘)
elif bloc==0 and type==‘pov’:
#-------------------------------------------
# si on veut l’export d’objets séparés
#-------------------------------------------
f_o.write(’} // fin de ‘+nom+’
‘)
elif type==‘n3d’:
#-------------------------------------------
# si on veut l’export d’objets séparés
#-------------------------------------------
f_o.write(’# end of ‘+nom+’
')
elif type=='pov':
#------------------------------------------
# si il s'agit d'un fichier unique
#------------------------------------------
if (contenu[l].find('#declare')==-1 and\
contenu[l].find('mesh2')==-1) and\
bloc==0 and\
contenu[l].find('
')!=0:
f.write(contenu[l])
elif contenu[l].find('mesh2')==-1 and\
contenu[l].find('
')!=0:
f.write(contenu[l])
if bloc==0:
#-------------------------------------------
# si on veut l'export d'objets séparés
#-------------------------------------------
if f_o!=None:
f_o.close()
l+=1
if f!=None:
f.close()
except:
l=""" vous êtes en train d’essayer d’exporter un fichier d’animation ou un ficher contenant une macro"""
print l