- removed 2.4x release/scripts
authorCampbell Barton <ideasman42@gmail.com>
Mon, 28 Sep 2009 03:19:52 +0000 (03:19 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 28 Sep 2009 03:19:52 +0000 (03:19 +0000)
- moved release/io and release/ui into release/scripts/io, ui
- updated scons, cmake, make

When porting 2.4x scripts back, use a command like this so as not to loose the commit history...

 svn cp https://svn.blender.org/svnroot/bf-blender/branches/blender2.4/release/scripts/raw_import.py release/scripts/io/import_raw.py

229 files changed:
SConstruct
release/Makefile
release/scripts/3ds_export.py [deleted file]
release/scripts/3ds_import.py [deleted file]
release/scripts/Axiscopy.py [deleted file]
release/scripts/DirectX8Exporter.py [deleted file]
release/scripts/DirectX8Importer.py [deleted file]
release/scripts/IDPropBrowser.py [deleted file]
release/scripts/ac3d_export.py [deleted file]
release/scripts/ac3d_import.py [deleted file]
release/scripts/add_mesh_empty.py [deleted file]
release/scripts/add_mesh_torus.py [deleted file]
release/scripts/animation_bake_constraints.py [deleted file]
release/scripts/animation_clean.py [deleted file]
release/scripts/animation_trajectory.py [deleted file]
release/scripts/armature_symmetry.py [deleted file]
release/scripts/bevel_center.py [deleted file]
release/scripts/blenderLipSynchro.py [deleted file]
release/scripts/bpydata/KUlang.txt [deleted file]
release/scripts/bpydata/config/readme.txt [deleted file]
release/scripts/bpydata/readme.txt [deleted file]
release/scripts/bpymodules/BPyAddMesh.py [deleted file]
release/scripts/bpymodules/BPyArmature.py [deleted file]
release/scripts/bpymodules/BPyBlender.py [deleted file]
release/scripts/bpymodules/BPyCurve.py [deleted file]
release/scripts/bpymodules/BPyImage.py [deleted file]
release/scripts/bpymodules/BPyMathutils.py [deleted file]
release/scripts/bpymodules/BPyMesh.py [deleted file]
release/scripts/bpymodules/BPyMesh_redux.py [deleted file]
release/scripts/bpymodules/BPyMessages.py [deleted file]
release/scripts/bpymodules/BPyNMesh.py [deleted file]
release/scripts/bpymodules/BPyObject.py [deleted file]
release/scripts/bpymodules/BPyRegistry.py [deleted file]
release/scripts/bpymodules/BPyRender.py [deleted file]
release/scripts/bpymodules/BPySys.py [deleted file]
release/scripts/bpymodules/BPyTextPlugin.py [deleted file]
release/scripts/bpymodules/BPyWindow.py [deleted file]
release/scripts/bpymodules/blend2renderinfo.py [deleted file]
release/scripts/bpymodules/defaultdoodads.py [deleted file]
release/scripts/bpymodules/dxfColorMap.py [deleted file]
release/scripts/bpymodules/dxfLibrary.py [deleted file]
release/scripts/bpymodules/dxfReader.py [deleted file]
release/scripts/bpymodules/mesh_gradient.py [deleted file]
release/scripts/bpymodules/meshtools.py [deleted file]
release/scripts/bpymodules/paths_ai2obj.py [deleted file]
release/scripts/bpymodules/paths_eps2obj.py [deleted file]
release/scripts/bpymodules/paths_gimp2obj.py [deleted file]
release/scripts/bpymodules/paths_svg2obj.py [deleted file]
release/scripts/bvh_import.py [deleted file]
release/scripts/c3d_import.py [deleted file]
release/scripts/camera_changer.py [deleted file]
release/scripts/config.py [deleted file]
release/scripts/console.py [deleted file]
release/scripts/discombobulator.py [deleted file]
release/scripts/envelope_symmetry.py [deleted file]
release/scripts/export-iv-0.1.py [deleted file]
release/scripts/export_dxf.py [deleted file]
release/scripts/export_fbx.py [deleted file]
release/scripts/export_lightwave_motion.py [deleted file]
release/scripts/export_m3g.py [deleted file]
release/scripts/export_map.py [deleted file]
release/scripts/export_mdd.py [deleted file]
release/scripts/export_obj.py [deleted file]
release/scripts/faceselect_same_weights.py [deleted file]
release/scripts/flt_defaultp.py [deleted file]
release/scripts/flt_dofedit.py [deleted file]
release/scripts/flt_export.py [deleted file]
release/scripts/flt_filewalker.py [deleted file]
release/scripts/flt_import.py [deleted file]
release/scripts/flt_lodedit.py [deleted file]
release/scripts/flt_palettemanager.py [deleted file]
release/scripts/flt_properties.py [deleted file]
release/scripts/flt_toolbar.py [deleted file]
release/scripts/help_bpy_api.py [deleted file]
release/scripts/help_browser.py [deleted file]
release/scripts/hotkeys.py [deleted file]
release/scripts/image_2d_cutout.py [deleted file]
release/scripts/image_auto_layout.py [deleted file]
release/scripts/image_billboard.py [deleted file]
release/scripts/image_edit.py [deleted file]
release/scripts/import_dxf.py [deleted file]
release/scripts/import_edl.py [deleted file]
release/scripts/import_lightwave_motion.py [deleted file]
release/scripts/import_mdd.py [deleted file]
release/scripts/import_obj.py [deleted file]
release/scripts/import_web3d.py [deleted file]
release/scripts/io/engine_render_pov.py [moved from release/io/engine_render_pov.py with 100% similarity]
release/scripts/io/export_3ds.py [moved from release/io/export_3ds.py with 100% similarity]
release/scripts/io/export_fbx.py [moved from release/io/export_fbx.py with 100% similarity]
release/scripts/io/export_obj.py [moved from release/io/export_obj.py with 100% similarity]
release/scripts/io/export_ply.py [moved from release/io/export_ply.py with 100% similarity]
release/scripts/io/export_x3d.py [moved from release/io/export_x3d.py with 100% similarity]
release/scripts/io/import_3ds.py [moved from release/io/import_3ds.py with 100% similarity]
release/scripts/io/import_obj.py [moved from release/io/import_obj.py with 100% similarity]
release/scripts/io/netrender/__init__.py [moved from release/io/netrender/__init__.py with 100% similarity]
release/scripts/io/netrender/balancing.py [moved from release/io/netrender/balancing.py with 100% similarity]
release/scripts/io/netrender/client.py [moved from release/io/netrender/client.py with 100% similarity]
release/scripts/io/netrender/master.py [moved from release/io/netrender/master.py with 100% similarity]
release/scripts/io/netrender/master_html.py [moved from release/io/netrender/master_html.py with 100% similarity]
release/scripts/io/netrender/model.py [moved from release/io/netrender/model.py with 100% similarity]
release/scripts/io/netrender/operators.py [moved from release/io/netrender/operators.py with 100% similarity]
release/scripts/io/netrender/slave.py [moved from release/io/netrender/slave.py with 100% similarity]
release/scripts/io/netrender/ui.py [moved from release/io/netrender/ui.py with 100% similarity]
release/scripts/io/netrender/utils.py [moved from release/io/netrender/utils.py with 100% similarity]
release/scripts/lightwave_export.py [deleted file]
release/scripts/lightwave_import.py [deleted file]
release/scripts/md2_export.py [deleted file]
release/scripts/md2_import.py [deleted file]
release/scripts/mesh_boneweight_copy.py [deleted file]
release/scripts/mesh_cleanup.py [deleted file]
release/scripts/mesh_edges2curves.py [deleted file]
release/scripts/mesh_mirror_tool.py [deleted file]
release/scripts/mesh_poly_reduce.py [deleted file]
release/scripts/mesh_poly_reduce_grid.py [deleted file]
release/scripts/mesh_skin.py [deleted file]
release/scripts/mesh_solidify.py [deleted file]
release/scripts/mesh_unfolder.py [deleted file]
release/scripts/mesh_wire.py [deleted file]
release/scripts/ms3d_import.py [deleted file]
release/scripts/ms3d_import_ascii.py [deleted file]
release/scripts/obdatacopier.py [deleted file]
release/scripts/object_active_to_other.py [deleted file]
release/scripts/object_apply_def.py [deleted file]
release/scripts/object_batch_name_edit.py [deleted file]
release/scripts/object_cookie_cutter.py [deleted file]
release/scripts/object_drop.py [deleted file]
release/scripts/object_find.py [deleted file]
release/scripts/object_random_loc_sz_rot.py [deleted file]
release/scripts/object_sel2dupgroup.py [deleted file]
release/scripts/object_timeofs_follow_act.py [deleted file]
release/scripts/off_export.py [deleted file]
release/scripts/off_import.py [deleted file]
release/scripts/paths_import.py [deleted file]
release/scripts/ply_import.py [deleted file]
release/scripts/raw_export.py [deleted file]
release/scripts/raw_import.py [deleted file]
release/scripts/renameobjectbyblock.py [deleted file]
release/scripts/render_save_layers.py [deleted file]
release/scripts/rvk1_torvk2.py [deleted file]
release/scripts/save_theme.py [deleted file]
release/scripts/scripttemplate_background_job.py [deleted file]
release/scripts/scripttemplate_camera_object.py [deleted file]
release/scripts/scripttemplate_gamelogic.py [deleted file]
release/scripts/scripttemplate_gamelogic_basic.py [deleted file]
release/scripts/scripttemplate_gamelogic_module.py [deleted file]
release/scripts/scripttemplate_ipo_gen.py [deleted file]
release/scripts/scripttemplate_mesh_edit.py [deleted file]
release/scripts/scripttemplate_metaball_create.py [deleted file]
release/scripts/scripttemplate_object_edit.py [deleted file]
release/scripts/scripttemplate_pyconstraint.py [deleted file]
release/scripts/scripttemplate_text_plugin.py [deleted file]
release/scripts/slp_import.py [deleted file]
release/scripts/sysinfo.py [deleted file]
release/scripts/textplugin_convert_ge.py [deleted file]
release/scripts/textplugin_functiondocs.py [deleted file]
release/scripts/textplugin_imports.py [deleted file]
release/scripts/textplugin_membersuggest.py [deleted file]
release/scripts/textplugin_outliner.py [deleted file]
release/scripts/textplugin_suggest.py [deleted file]
release/scripts/textplugin_templates.py [deleted file]
release/scripts/ui/bpy_ops.py [moved from release/ui/bpy_ops.py with 100% similarity]
release/scripts/ui/buttons_data_armature.py [moved from release/ui/buttons_data_armature.py with 100% similarity]
release/scripts/ui/buttons_data_bone.py [moved from release/ui/buttons_data_bone.py with 100% similarity]
release/scripts/ui/buttons_data_camera.py [moved from release/ui/buttons_data_camera.py with 100% similarity]
release/scripts/ui/buttons_data_curve.py [moved from release/ui/buttons_data_curve.py with 100% similarity]
release/scripts/ui/buttons_data_empty.py [moved from release/ui/buttons_data_empty.py with 100% similarity]
release/scripts/ui/buttons_data_lamp.py [moved from release/ui/buttons_data_lamp.py with 100% similarity]
release/scripts/ui/buttons_data_lattice.py [moved from release/ui/buttons_data_lattice.py with 100% similarity]
release/scripts/ui/buttons_data_mesh.py [moved from release/ui/buttons_data_mesh.py with 100% similarity]
release/scripts/ui/buttons_data_metaball.py [moved from release/ui/buttons_data_metaball.py with 100% similarity]
release/scripts/ui/buttons_data_modifier.py [moved from release/ui/buttons_data_modifier.py with 100% similarity]
release/scripts/ui/buttons_data_text.py [moved from release/ui/buttons_data_text.py with 100% similarity]
release/scripts/ui/buttons_game.py [moved from release/ui/buttons_game.py with 100% similarity]
release/scripts/ui/buttons_material.py [moved from release/ui/buttons_material.py with 100% similarity]
release/scripts/ui/buttons_object.py [moved from release/ui/buttons_object.py with 100% similarity]
release/scripts/ui/buttons_object_constraint.py [moved from release/ui/buttons_object_constraint.py with 100% similarity]
release/scripts/ui/buttons_particle.py [moved from release/ui/buttons_particle.py with 100% similarity]
release/scripts/ui/buttons_physics_cloth.py [moved from release/ui/buttons_physics_cloth.py with 100% similarity]
release/scripts/ui/buttons_physics_field.py [moved from release/ui/buttons_physics_field.py with 100% similarity]
release/scripts/ui/buttons_physics_fluid.py [moved from release/ui/buttons_physics_fluid.py with 100% similarity]
release/scripts/ui/buttons_physics_smoke.py [moved from release/ui/buttons_physics_smoke.py with 100% similarity]
release/scripts/ui/buttons_physics_softbody.py [moved from release/ui/buttons_physics_softbody.py with 100% similarity]
release/scripts/ui/buttons_scene.py [moved from release/ui/buttons_scene.py with 100% similarity]
release/scripts/ui/buttons_texture.py [moved from release/ui/buttons_texture.py with 100% similarity]
release/scripts/ui/buttons_world.py [moved from release/ui/buttons_world.py with 100% similarity]
release/scripts/ui/space_buttons.py [moved from release/ui/space_buttons.py with 100% similarity]
release/scripts/ui/space_console.py [moved from release/ui/space_console.py with 100% similarity]
release/scripts/ui/space_filebrowser.py [moved from release/ui/space_filebrowser.py with 100% similarity]
release/scripts/ui/space_image.py [moved from release/ui/space_image.py with 100% similarity]
release/scripts/ui/space_info.py [moved from release/ui/space_info.py with 100% similarity]
release/scripts/ui/space_logic.py [moved from release/ui/space_logic.py with 100% similarity]
release/scripts/ui/space_node.py [moved from release/ui/space_node.py with 100% similarity]
release/scripts/ui/space_outliner.py [moved from release/ui/space_outliner.py with 100% similarity]
release/scripts/ui/space_sequencer.py [moved from release/ui/space_sequencer.py with 100% similarity]
release/scripts/ui/space_text.py [moved from release/ui/space_text.py with 100% similarity]
release/scripts/ui/space_time.py [moved from release/ui/space_time.py with 100% similarity]
release/scripts/ui/space_userpref.py [moved from release/ui/space_userpref.py with 100% similarity]
release/scripts/ui/space_view3d.py [moved from release/ui/space_view3d.py with 100% similarity]
release/scripts/ui/space_view3d_toolbar.py [moved from release/ui/space_view3d_toolbar.py with 100% similarity]
release/scripts/unweld.py [deleted file]
release/scripts/uv_export.py [deleted file]
release/scripts/uv_seams_from_islands.py [deleted file]
release/scripts/uvcalc_follow_active_coords.py [deleted file]
release/scripts/uvcalc_lightmap.py [deleted file]
release/scripts/uvcalc_quad_clickproj.py [deleted file]
release/scripts/uvcalc_smart_project.py [deleted file]
release/scripts/uvcopy.py [deleted file]
release/scripts/vertexpaint_from_material.py [deleted file]
release/scripts/vertexpaint_gradient.py [deleted file]
release/scripts/vertexpaint_selfshadow_ao.py [deleted file]
release/scripts/vrml97_export.py [deleted file]
release/scripts/weightpaint_average.py [deleted file]
release/scripts/weightpaint_clean.py [deleted file]
release/scripts/weightpaint_copy.py [deleted file]
release/scripts/weightpaint_envelope_assign.py [deleted file]
release/scripts/weightpaint_gradient.py [deleted file]
release/scripts/weightpaint_grow_shrink.py [deleted file]
release/scripts/weightpaint_invert.py [deleted file]
release/scripts/weightpaint_normalize.py [deleted file]
release/scripts/widgetwizard.py [deleted file]
release/scripts/wizard_bolt_factory.py [deleted file]
release/scripts/wizard_curve2tree.py [deleted file]
release/scripts/wizard_landscape_ant.py [deleted file]
release/scripts/x3d_export.py [deleted file]
release/scripts/xsi_export.py [deleted file]
source/blender/blenloader/BLO_readfile.h
source/blender/python/intern/bpy_interface.c
source/creator/CMakeLists.txt
source/darwin/Makefile

index 7e3d23970cbaeb72c5f53580587ef0088feceef8..5c4af9163276e87dc810b944b1a8a8e0dc1fda86 100644 (file)
@@ -476,8 +476,8 @@ if  env['OURPLATFORM']!='darwin':
                        dotblenderinstall.append(env.Install(dir=td, source=srcfile))
                
                if env['WITH_BF_PYTHON']:
-                       #-- .blender/scripts, .blender/ui, .blender/io
-                       scriptpaths=['release/scripts', 'release/ui', 'release/io']
+                       #-- .blender/scripts
+                       scriptpaths=['release/scripts']
                        for scriptpath in scriptpaths:
                                for dp, dn, df in os.walk(scriptpath):
                                        if '.svn' in dn:
index 94bb902646d5256b3eef881a7b0e27a737260432..9fe83ef349423e7c046cd3cf7b4ec38517b683c6 100644 (file)
@@ -153,9 +153,6 @@ endif
 
        @echo "----> Copy python infrastructure"
        @[ ! -d scripts ] || cp -r scripts $(CONFDIR)/scripts
-
-       @echo "----> Copy python UI files"
-       @[ ! -d ui ] || cp -r ui $(CONFDIR)/ui
        
     ifeq ($(OS),darwin)
        @echo "----> Copy python modules"
diff --git a/release/scripts/3ds_export.py b/release/scripts/3ds_export.py
deleted file mode 100644 (file)
index 87680bc..0000000
+++ /dev/null
@@ -1,1019 +0,0 @@
-#!BPY
-# coding: utf-8
-""" 
-Name: '3D Studio (.3ds)...'
-Blender: 243
-Group: 'Export'
-Tooltip: 'Export to 3DS file format (.3ds).'
-"""
-
-__author__ = ["Campbell Barton", "Bob Holcomb", "Richard Lärkäng", "Damien McGinnes", "Mark Stijnman"]
-__url__ = ("blenderartists.org", "www.blender.org", "www.gametutorials.com", "lib3ds.sourceforge.net/")
-__version__ = "0.90a"
-__bpydoc__ = """\
-
-3ds Exporter
-
-This script Exports a 3ds file.
-
-Exporting is based on 3ds loader from www.gametutorials.com(Thanks DigiBen) and using information
-from the lib3ds project (http://lib3ds.sourceforge.net/) sourcecode.
-"""
-
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# Script copyright (C) Bob Holcomb 
-#
-# 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 *****
-# --------------------------------------------------------------------------
-
-
-######################################################
-# Importing modules
-######################################################
-
-import Blender
-import bpy
-from BPyMesh import getMeshFromObject
-from BPyObject import getDerivedObjects
-try: 
-    import struct
-except: 
-    struct = None
-
-# So 3ds max can open files, limit names to 12 in length
-# this is verry annoying for filenames!
-name_unique = []
-name_mapping = {}
-def sane_name(name):
-       name_fixed = name_mapping.get(name)
-       if name_fixed != None:
-               return name_fixed
-       
-       if len(name) > 12:
-               new_name = name[:12]
-       else:
-               new_name = name
-       
-       i = 0
-       
-       while new_name in name_unique:
-               new_name = new_name[:-4] + '.%.3d' % i
-               i+=1
-       
-       name_unique.append(new_name)
-       name_mapping[name] = new_name
-       return new_name
-
-######################################################
-# Data Structures
-######################################################
-
-#Some of the chunks that we will export
-#----- Primary Chunk, at the beginning of each file
-PRIMARY= long("0x4D4D",16)
-
-#------ Main Chunks
-OBJECTINFO   =      long("0x3D3D",16);      #This gives the version of the mesh and is found right before the material and object information
-VERSION      =      long("0x0002",16);      #This gives the version of the .3ds file
-KFDATA       =      long("0xB000",16);      #This is the header for all of the key frame info
-
-#------ sub defines of OBJECTINFO
-MATERIAL=45055         #0xAFFF                         // This stored the texture info
-OBJECT=16384           #0x4000                         // This stores the faces, vertices, etc...
-
-#>------ sub defines of MATERIAL
-MATNAME    =      long("0xA000",16);      # This holds the material name
-MATAMBIENT   =      long("0xA010",16);      # Ambient color of the object/material
-MATDIFFUSE   =      long("0xA020",16);      # This holds the color of the object/material
-MATSPECULAR   =      long("0xA030",16);      # SPecular color of the object/material
-MATSHINESS   =      long("0xA040",16);      # ??
-MATMAP       =      long("0xA200",16);      # This is a header for a new material
-MATMAPFILE    =      long("0xA300",16);      # This holds the file name of the texture
-
-RGB1=  long("0x0011",16)
-RGB2=  long("0x0012",16)
-
-#>------ sub defines of OBJECT
-OBJECT_MESH  =      long("0x4100",16);      # This lets us know that we are reading a new object
-OBJECT_LIGHT =      long("0x4600",16);      # This lets un know we are reading a light object
-OBJECT_CAMERA=      long("0x4700",16);      # This lets un know we are reading a camera object
-
-#>------ sub defines of CAMERA
-OBJECT_CAM_RANGES=   long("0x4720",16);      # The camera range values
-
-#>------ sub defines of OBJECT_MESH
-OBJECT_VERTICES =   long("0x4110",16);      # The objects vertices
-OBJECT_FACES    =   long("0x4120",16);      # The objects faces
-OBJECT_MATERIAL =   long("0x4130",16);      # This is found if the object has a material, either texture map or color
-OBJECT_UV       =   long("0x4140",16);      # The UV texture coordinates
-OBJECT_TRANS_MATRIX  =   long("0x4160",16); # The Object Matrix
-
-#>------ sub defines of KFDATA
-KFDATA_KFHDR            = long("0xB00A",16);
-KFDATA_KFSEG            = long("0xB008",16);
-KFDATA_KFCURTIME        = long("0xB009",16);
-KFDATA_OBJECT_NODE_TAG  = long("0xB002",16);
-
-#>------ sub defines of OBJECT_NODE_TAG
-OBJECT_NODE_ID          = long("0xB030",16);
-OBJECT_NODE_HDR         = long("0xB010",16);
-OBJECT_PIVOT            = long("0xB013",16);
-OBJECT_INSTANCE_NAME    = long("0xB011",16);
-POS_TRACK_TAG                  = long("0xB020",16);
-ROT_TRACK_TAG                  = long("0xB021",16);
-SCL_TRACK_TAG                  = long("0xB022",16);
-
-def uv_key(uv):
-       return round(uv.x, 6), round(uv.y, 6)
-
-# size defines:        
-SZ_SHORT = 2
-SZ_INT   = 4
-SZ_FLOAT = 4
-
-class _3ds_short(object):
-       '''Class representing a short (2-byte integer) for a 3ds file.
-       *** This looks like an unsigned short H is unsigned from the struct docs - Cam***'''
-       __slots__ = 'value'
-       def __init__(self, val=0):
-               self.value=val
-       
-       def get_size(self):
-               return SZ_SHORT
-
-       def write(self,file):
-               file.write(struct.pack("<H", self.value))
-               
-       def __str__(self):
-               return str(self.value)
-
-class _3ds_int(object):
-       '''Class representing an int (4-byte integer) for a 3ds file.'''
-       __slots__ = 'value'
-       def __init__(self, val=0):
-               self.value=val
-       
-       def get_size(self):
-               return SZ_INT
-
-       def write(self,file):
-               file.write(struct.pack("<I", self.value))
-       
-       def __str__(self):
-               return str(self.value)
-
-class _3ds_float(object):
-       '''Class representing a 4-byte IEEE floating point number for a 3ds file.'''
-       __slots__ = 'value'
-       def __init__(self, val=0.0):
-               self.value=val
-       
-       def get_size(self):
-               return SZ_FLOAT
-
-       def write(self,file):
-               file.write(struct.pack("<f", self.value))
-       
-       def __str__(self):
-               return str(self.value)
-
-
-class _3ds_string(object):
-       '''Class representing a zero-terminated string for a 3ds file.'''
-       __slots__ = 'value'
-       def __init__(self, val=""):
-               self.value=val
-       
-       def get_size(self):
-               return (len(self.value)+1)
-
-       def write(self,file):
-               binary_format = "<%ds" % (len(self.value)+1)
-               file.write(struct.pack(binary_format, self.value))
-       
-       def __str__(self):
-               return self.value
-
-class _3ds_point_3d(object):
-       '''Class representing a three-dimensional point for a 3ds file.'''
-       __slots__ = 'x','y','z'
-       def __init__(self, point=(0.0,0.0,0.0)):
-               self.x, self.y, self.z = point
-               
-       def get_size(self):
-               return 3*SZ_FLOAT
-
-       def write(self,file):
-               file.write(struct.pack('<3f', self.x, self.y, self.z))
-       
-       def __str__(self):
-               return '(%f, %f, %f)' % (self.x, self.y, self.z)
-               
-# Used for writing a track
-"""
-class _3ds_point_4d(object):
-       '''Class representing a four-dimensional point for a 3ds file, for instance a quaternion.'''
-       __slots__ = 'x','y','z','w'
-       def __init__(self, point=(0.0,0.0,0.0,0.0)):
-               self.x, self.y, self.z, self.w = point  
-       
-       def get_size(self):
-               return 4*SZ_FLOAT
-
-       def write(self,file):
-               data=struct.pack('<4f', self.x, self.y, self.z, self.w)
-               file.write(data)
-
-       def __str__(self):
-               return '(%f, %f, %f, %f)' % (self.x, self.y, self.z, self.w)
-"""
-
-class _3ds_point_uv(object):
-       '''Class representing a UV-coordinate for a 3ds file.'''
-       __slots__ = 'uv'
-       def __init__(self, point=(0.0,0.0)):
-               self.uv = point
-       
-       def __cmp__(self, other):
-               return cmp(self.uv,other.uv)    
-       
-       def get_size(self):
-               return 2*SZ_FLOAT
-       
-       def write(self,file):
-               data=struct.pack('<2f', self.uv[0], self.uv[1])
-               file.write(data)
-       
-       def __str__(self):
-               return '(%g, %g)' % self.uv
-
-class _3ds_rgb_color(object):
-       '''Class representing a (24-bit) rgb color for a 3ds file.'''
-       __slots__ = 'r','g','b'
-       def __init__(self, col=(0,0,0)):
-               self.r, self.g, self.b = col
-       
-       def get_size(self):
-               return 3
-       
-       def write(self,file):
-               file.write( struct.pack('<3c', chr(int(255*self.r)), chr(int(255*self.g)), chr(int(255*self.b)) ) )
-       
-       def __str__(self):
-               return '{%f, %f, %f}' % (self.r, self.g, self.b)
-
-class _3ds_face(object):
-       '''Class representing a face for a 3ds file.'''
-       __slots__ = 'vindex'
-       def __init__(self, vindex):
-               self.vindex = vindex
-       
-       def get_size(self):
-               return 4*SZ_SHORT
-       
-       def write(self,file):
-               # The last zero is only used by 3d studio
-               file.write(struct.pack("<4H", self.vindex[0],self.vindex[1], self.vindex[2], 0))
-       
-       def __str__(self):
-               return '[%d %d %d]' % (self.vindex[0],self.vindex[1], self.vindex[2])
-
-class _3ds_array(object):
-       '''Class representing an array of variables for a 3ds file.
-
-       Consists of a _3ds_short to indicate the number of items, followed by the items themselves.
-       '''
-       __slots__ = 'values', 'size'
-       def __init__(self):
-               self.values=[]
-               self.size=SZ_SHORT
-       
-       # add an item:
-       def add(self,item):
-               self.values.append(item)
-               self.size+=item.get_size()
-       
-       def get_size(self):
-               return self.size
-       
-       def write(self,file):
-               _3ds_short(len(self.values)).write(file)
-               #_3ds_int(len(self.values)).write(file)
-               for value in self.values:
-                       value.write(file)
-       
-       # To not overwhelm the output in a dump, a _3ds_array only
-       # outputs the number of items, not all of the actual items. 
-       def __str__(self):
-               return '(%d items)' % len(self.values)
-
-class _3ds_named_variable(object):
-       '''Convenience class for named variables.'''
-       
-       __slots__ = 'value', 'name'
-       def __init__(self, name, val=None):
-               self.name=name
-               self.value=val
-       
-       def get_size(self):
-               if (self.value==None): 
-                       return 0
-               else:
-                       return self.value.get_size()
-       
-       def write(self, file):
-               if (self.value!=None): 
-                       self.value.write(file)
-       
-       def dump(self,indent):
-               if (self.value!=None):
-                       spaces=""
-                       for i in xrange(indent):
-                               spaces+="  ";
-                       if (self.name!=""):
-                               print spaces, self.name, " = ", self.value
-                       else:
-                               print spaces, "[unnamed]", " = ", self.value
-
-
-#the chunk class
-class _3ds_chunk(object):
-       '''Class representing a chunk in a 3ds file.
-
-       Chunks contain zero or more variables, followed by zero or more subchunks.
-       '''
-       __slots__ = 'ID', 'size', 'variables', 'subchunks'
-       def __init__(self, id=0):
-               self.ID=_3ds_short(id)
-               self.size=_3ds_int(0)
-               self.variables=[]
-               self.subchunks=[]
-       
-       def set_ID(id):
-               self.ID=_3ds_short(id)
-       
-       def add_variable(self, name, var):
-               '''Add a named variable. 
-               
-               The name is mostly for debugging purposes.'''
-               self.variables.append(_3ds_named_variable(name,var))
-       
-       def add_subchunk(self, chunk):
-               '''Add a subchunk.'''
-               self.subchunks.append(chunk)
-
-       def get_size(self):
-               '''Calculate the size of the chunk and return it.
-               
-               The sizes of the variables and subchunks are used to determine this chunk\'s size.'''
-               tmpsize=self.ID.get_size()+self.size.get_size()
-               for variable in self.variables:
-                       tmpsize+=variable.get_size()
-               for subchunk in self.subchunks:
-                       tmpsize+=subchunk.get_size()
-               self.size.value=tmpsize
-               return self.size.value
-
-       def write(self, file):
-               '''Write the chunk to a file.
-               
-               Uses the write function of the variables and the subchunks to do the actual work.'''
-               #write header
-               self.ID.write(file)
-               self.size.write(file)
-               for variable in self.variables:
-                       variable.write(file)
-               for subchunk in self.subchunks:
-                       subchunk.write(file)
-               
-               
-       def dump(self, indent=0):
-               '''Write the chunk to a file.
-               
-               Dump is used for debugging purposes, to dump the contents of a chunk to the standard output. 
-               Uses the dump function of the named variables and the subchunks to do the actual work.'''
-               spaces=""
-               for i in xrange(indent):
-                       spaces+="  ";
-               print spaces, "ID=", hex(self.ID.value), "size=", self.get_size()
-               for variable in self.variables:
-                       variable.dump(indent+1)
-               for subchunk in self.subchunks:
-                       subchunk.dump(indent+1)
-
-
-
-######################################################
-# EXPORT
-######################################################
-
-def get_material_images(material):
-       # blender utility func.
-       images = []
-       if material:
-               for mtex in material.getTextures():
-                       if mtex and mtex.tex.type == Blender.Texture.Types.IMAGE:
-                               image = mtex.tex.image
-                               if image:
-                                       images.append(image) # maye want to include info like diffuse, spec here.
-       return images
-
-def make_material_subchunk(id, color):
-       '''Make a material subchunk.
-       
-       Used for color subchunks, such as diffuse color or ambient color subchunks.'''
-       mat_sub = _3ds_chunk(id)
-       col1 = _3ds_chunk(RGB1)
-       col1.add_variable("color1", _3ds_rgb_color(color));
-       mat_sub.add_subchunk(col1)
-# optional:
-#      col2 = _3ds_chunk(RGB1)
-#      col2.add_variable("color2", _3ds_rgb_color(color));
-#      mat_sub.add_subchunk(col2)
-       return mat_sub
-
-
-def make_material_texture_chunk(id, images):
-       """Make Material Map texture chunk
-       """
-       mat_sub = _3ds_chunk(id)
-       
-       def add_image(img):
-               filename = image.filename.split('\\')[-1].split('/')[-1]
-               mat_sub_file = _3ds_chunk(MATMAPFILE)
-               mat_sub_file.add_variable("mapfile", _3ds_string(sane_name(filename)))
-               mat_sub.add_subchunk(mat_sub_file)
-       
-       for image in images:
-               add_image(image)
-       
-       return mat_sub
-
-def make_material_chunk(material, image):
-       '''Make a material chunk out of a blender material.'''
-       material_chunk = _3ds_chunk(MATERIAL)
-       name = _3ds_chunk(MATNAME)
-       
-       if material:    name_str = material.name
-       else:                   name_str = 'None'
-       if image:       name_str += image.name
-               
-       name.add_variable("name", _3ds_string(sane_name(name_str)))
-       material_chunk.add_subchunk(name)
-       
-       if not material:
-               material_chunk.add_subchunk(make_material_subchunk(MATAMBIENT, (0,0,0) ))
-               material_chunk.add_subchunk(make_material_subchunk(MATDIFFUSE, (.8, .8, .8) ))
-               material_chunk.add_subchunk(make_material_subchunk(MATSPECULAR, (1,1,1) ))
-       
-       else:
-               material_chunk.add_subchunk(make_material_subchunk(MATAMBIENT, [a*material.amb for a in material.rgbCol] ))
-               material_chunk.add_subchunk(make_material_subchunk(MATDIFFUSE, material.rgbCol))
-               material_chunk.add_subchunk(make_material_subchunk(MATSPECULAR, material.specCol))
-               
-               images = get_material_images(material) # can be None
-               if image: images.append(image)
-               
-               if images:
-                       material_chunk.add_subchunk(make_material_texture_chunk(MATMAP, images))
-       
-       return material_chunk
-
-class tri_wrapper(object):
-       '''Class representing a triangle.
-       
-       Used when converting faces to triangles'''
-       
-       __slots__ = 'vertex_index', 'mat', 'image', 'faceuvs', 'offset'
-       def __init__(self, vindex=(0,0,0), mat=None, image=None, faceuvs=None):
-               self.vertex_index= vindex
-               self.mat= mat
-               self.image= image
-               self.faceuvs= faceuvs
-               self.offset= [0, 0, 0] # offset indicies
-
-
-def extract_triangles(mesh):
-       '''Extract triangles from a mesh.
-       
-       If the mesh contains quads, they will be split into triangles.'''
-       tri_list = []
-       do_uv = mesh.faceUV
-       
-       if not do_uv:
-               face_uv = None
-       
-       img = None
-       for face in mesh.faces:
-               f_v = face.v
-               
-               if do_uv:
-                       f_uv = face.uv
-                       img = face.image
-                       if img: img = img.name
-               
-               if len(f_v)==3:
-                       new_tri = tri_wrapper((f_v[0].index, f_v[1].index, f_v[2].index), face.mat, img)
-                       if (do_uv): new_tri.faceuvs= uv_key(f_uv[0]), uv_key(f_uv[1]), uv_key(f_uv[2])
-                       tri_list.append(new_tri)
-               
-               else: #it's a quad
-                       new_tri = tri_wrapper((f_v[0].index, f_v[1].index, f_v[2].index), face.mat, img)
-                       new_tri_2 = tri_wrapper((f_v[0].index, f_v[2].index, f_v[3].index), face.mat, img)
-                       
-                       if (do_uv):
-                               new_tri.faceuvs= uv_key(f_uv[0]), uv_key(f_uv[1]), uv_key(f_uv[2])
-                               new_tri_2.faceuvs= uv_key(f_uv[0]), uv_key(f_uv[2]), uv_key(f_uv[3])
-                       
-                       tri_list.append( new_tri )
-                       tri_list.append( new_tri_2 )
-               
-       return tri_list
-       
-       
-def remove_face_uv(verts, tri_list):
-       '''Remove face UV coordinates from a list of triangles.
-               
-       Since 3ds files only support one pair of uv coordinates for each vertex, face uv coordinates
-       need to be converted to vertex uv coordinates. That means that vertices need to be duplicated when
-       there are multiple uv coordinates per vertex.'''
-       
-       # initialize a list of UniqueLists, one per vertex:
-       #uv_list = [UniqueList() for i in xrange(len(verts))]
-       unique_uvs= [{} for i in xrange(len(verts))]
-       
-       # for each face uv coordinate, add it to the UniqueList of the vertex
-       for tri in tri_list:
-               for i in xrange(3):
-                       # store the index into the UniqueList for future reference:
-                       # offset.append(uv_list[tri.vertex_index[i]].add(_3ds_point_uv(tri.faceuvs[i])))
-                       
-                       context_uv_vert= unique_uvs[tri.vertex_index[i]]
-                       uvkey= tri.faceuvs[i]
-                       
-                       offset_index__uv_3ds = context_uv_vert.get(uvkey)
-                       
-                       if not offset_index__uv_3ds:                            
-                               offset_index__uv_3ds = context_uv_vert[uvkey] = len(context_uv_vert), _3ds_point_uv(uvkey)
-                       
-                       tri.offset[i] = offset_index__uv_3ds[0]
-                       
-                       
-               
-       # At this point, each vertex has a UniqueList containing every uv coordinate that is associated with it
-       # only once.
-       
-       # Now we need to duplicate every vertex as many times as it has uv coordinates and make sure the
-       # faces refer to the new face indices:
-       vert_index = 0
-       vert_array = _3ds_array()
-       uv_array = _3ds_array()
-       index_list = []
-       for i,vert in enumerate(verts):
-               index_list.append(vert_index)
-               
-               pt = _3ds_point_3d(vert.co) # reuse, should be ok
-               uvmap = [None] * len(unique_uvs[i])
-               for ii, uv_3ds in unique_uvs[i].itervalues():
-                       # add a vertex duplicate to the vertex_array for every uv associated with this vertex:
-                       vert_array.add(pt)
-                       # add the uv coordinate to the uv array:
-                       # This for loop does not give uv's ordered by ii, so we create a new map
-                       # and add the uv's later
-                       # uv_array.add(uv_3ds)
-                       uvmap[ii] = uv_3ds
-               
-               # Add the uv's in the correct order
-               for uv_3ds in uvmap:
-                       # add the uv coordinate to the uv array:
-                       uv_array.add(uv_3ds)
-               
-               vert_index += len(unique_uvs[i])
-       
-       # Make sure the triangle vertex indices now refer to the new vertex list:
-       for tri in tri_list:
-               for i in xrange(3):
-                       tri.offset[i]+=index_list[tri.vertex_index[i]]
-               tri.vertex_index= tri.offset
-       
-       return vert_array, uv_array, tri_list
-
-def make_faces_chunk(tri_list, mesh, materialDict):
-       '''Make a chunk for the faces.
-       
-       Also adds subchunks assigning materials to all faces.'''
-       
-       materials = mesh.materials
-       if not materials:
-               mat = None
-       
-       face_chunk = _3ds_chunk(OBJECT_FACES)
-       face_list = _3ds_array()
-       
-       
-       if mesh.faceUV:
-               # Gather materials used in this mesh - mat/image pairs
-               unique_mats = {}
-               for i,tri in enumerate(tri_list):
-                       
-                       face_list.add(_3ds_face(tri.vertex_index))
-                       
-                       if materials:
-                               mat = materials[tri.mat]
-                               if mat: mat = mat.name
-                       
-                       img = tri.image
-                       
-                       try:
-                               context_mat_face_array = unique_mats[mat, img][1]
-                       except:
-                               
-                               if mat: name_str = mat
-                               else:   name_str = 'None'
-                               if img: name_str += img
-                               
-                               context_mat_face_array = _3ds_array()
-                               unique_mats[mat, img] = _3ds_string(sane_name(name_str)), context_mat_face_array
-                               
-                       
-                       context_mat_face_array.add(_3ds_short(i))
-                       # obj_material_faces[tri.mat].add(_3ds_short(i))
-               
-               face_chunk.add_variable("faces", face_list)
-               for mat_name, mat_faces in unique_mats.itervalues():
-                       obj_material_chunk=_3ds_chunk(OBJECT_MATERIAL)
-                       obj_material_chunk.add_variable("name", mat_name)
-                       obj_material_chunk.add_variable("face_list", mat_faces)
-                       face_chunk.add_subchunk(obj_material_chunk)
-                       
-       else:
-               
-               obj_material_faces=[]
-               obj_material_names=[]
-               for m in materials:
-                       if m:
-                               obj_material_names.append(_3ds_string(sane_name(m.name)))
-                               obj_material_faces.append(_3ds_array())
-               n_materials = len(obj_material_names)
-               
-               for i,tri in enumerate(tri_list):
-                       face_list.add(_3ds_face(tri.vertex_index))
-                       if (tri.mat < n_materials):
-                               obj_material_faces[tri.mat].add(_3ds_short(i))
-               
-               face_chunk.add_variable("faces", face_list)
-               for i in xrange(n_materials):
-                       obj_material_chunk=_3ds_chunk(OBJECT_MATERIAL)
-                       obj_material_chunk.add_variable("name", obj_material_names[i])
-                       obj_material_chunk.add_variable("face_list", obj_material_faces[i])
-                       face_chunk.add_subchunk(obj_material_chunk)
-       
-       return face_chunk
-
-def make_vert_chunk(vert_array):
-       '''Make a vertex chunk out of an array of vertices.'''
-       vert_chunk = _3ds_chunk(OBJECT_VERTICES)
-       vert_chunk.add_variable("vertices",vert_array)
-       return vert_chunk
-
-def make_uv_chunk(uv_array):
-       '''Make a UV chunk out of an array of UVs.'''
-       uv_chunk = _3ds_chunk(OBJECT_UV)
-       uv_chunk.add_variable("uv coords", uv_array)
-       return uv_chunk
-
-def make_mesh_chunk(mesh, materialDict):
-       '''Make a chunk out of a Blender mesh.'''
-       
-       # Extract the triangles from the mesh:
-       tri_list = extract_triangles(mesh)
-       
-       if mesh.faceUV:
-               # Remove the face UVs and convert it to vertex UV:
-               vert_array, uv_array, tri_list = remove_face_uv(mesh.verts, tri_list)
-       else:
-               # Add the vertices to the vertex array:
-               vert_array = _3ds_array()
-               for vert in mesh.verts:
-                       vert_array.add(_3ds_point_3d(vert.co))
-               # If the mesh has vertex UVs, create an array of UVs:
-               if mesh.vertexUV:
-                       uv_array = _3ds_array()
-                       for vert in mesh.verts:
-                               uv_array.add(_3ds_point_uv(vert.uvco))
-               else:
-                       # no UV at all:
-                       uv_array = None
-
-       # create the chunk:
-       mesh_chunk = _3ds_chunk(OBJECT_MESH)
-       
-       # add vertex chunk:
-       mesh_chunk.add_subchunk(make_vert_chunk(vert_array))
-       # add faces chunk:
-       
-       mesh_chunk.add_subchunk(make_faces_chunk(tri_list, mesh, materialDict))
-       
-       # if available, add uv chunk:
-       if uv_array:
-               mesh_chunk.add_subchunk(make_uv_chunk(uv_array))
-       
-       return mesh_chunk
-
-""" # COMMENTED OUT FOR 2.42 RELEASE!! CRASHES 3DS MAX
-def make_kfdata(start=0, stop=0, curtime=0):
-       '''Make the basic keyframe data chunk'''
-       kfdata = _3ds_chunk(KFDATA)
-       
-       kfhdr = _3ds_chunk(KFDATA_KFHDR)
-       kfhdr.add_variable("revision", _3ds_short(0))
-       # Not really sure what filename is used for, but it seems it is usually used
-       # to identify the program that generated the .3ds:
-       kfhdr.add_variable("filename", _3ds_string("Blender"))
-       kfhdr.add_variable("animlen", _3ds_int(stop-start))
-       
-       kfseg = _3ds_chunk(KFDATA_KFSEG)
-       kfseg.add_variable("start", _3ds_int(start))
-       kfseg.add_variable("stop", _3ds_int(stop))
-       
-       kfcurtime = _3ds_chunk(KFDATA_KFCURTIME)
-       kfcurtime.add_variable("curtime", _3ds_int(curtime))
-       
-       kfdata.add_subchunk(kfhdr)
-       kfdata.add_subchunk(kfseg)
-       kfdata.add_subchunk(kfcurtime)
-       return kfdata
-"""
-
-"""
-def make_track_chunk(ID, obj):
-       '''Make a chunk for track data.
-       
-       Depending on the ID, this will construct a position, rotation or scale track.'''
-       track_chunk = _3ds_chunk(ID)
-       track_chunk.add_variable("track_flags", _3ds_short())
-       track_chunk.add_variable("unknown", _3ds_int())
-       track_chunk.add_variable("unknown", _3ds_int())
-       track_chunk.add_variable("nkeys", _3ds_int(1))
-       # Next section should be repeated for every keyframe, but for now, animation is not actually supported.
-       track_chunk.add_variable("tcb_frame", _3ds_int(0))
-       track_chunk.add_variable("tcb_flags", _3ds_short())
-       if obj.type=='Empty':
-               if ID==POS_TRACK_TAG:
-                       # position vector:
-                       track_chunk.add_variable("position", _3ds_point_3d(obj.getLocation()))
-               elif ID==ROT_TRACK_TAG:
-                       # rotation (quaternion, angle first, followed by axis):
-                       q = obj.getEuler().toQuat()
-                       track_chunk.add_variable("rotation", _3ds_point_4d((q.angle, q.axis[0], q.axis[1], q.axis[2])))
-               elif ID==SCL_TRACK_TAG:
-                       # scale vector:
-                       track_chunk.add_variable("scale", _3ds_point_3d(obj.getSize()))
-       else:
-               # meshes have their transformations applied before 
-               # exporting, so write identity transforms here:
-               if ID==POS_TRACK_TAG:
-                       # position vector:
-                       track_chunk.add_variable("position", _3ds_point_3d((0.0,0.0,0.0)))
-               elif ID==ROT_TRACK_TAG:
-                       # rotation (quaternion, angle first, followed by axis):
-                       track_chunk.add_variable("rotation", _3ds_point_4d((0.0, 1.0, 0.0, 0.0)))
-               elif ID==SCL_TRACK_TAG:
-                       # scale vector:
-                       track_chunk.add_variable("scale", _3ds_point_3d((1.0, 1.0, 1.0)))
-       
-       return track_chunk
-"""
-
-"""
-def make_kf_obj_node(obj, name_to_id):
-       '''Make a node chunk for a Blender object.
-       
-       Takes the Blender object as a parameter. Object id's are taken from the dictionary name_to_id.
-       Blender Empty objects are converted to dummy nodes.'''
-       
-       name = obj.name
-       # main object node chunk:
-       kf_obj_node = _3ds_chunk(KFDATA_OBJECT_NODE_TAG)
-       # chunk for the object id: 
-       obj_id_chunk = _3ds_chunk(OBJECT_NODE_ID)
-       # object id is from the name_to_id dictionary:
-       obj_id_chunk.add_variable("node_id", _3ds_short(name_to_id[name]))
-       
-       # object node header:
-       obj_node_header_chunk = _3ds_chunk(OBJECT_NODE_HDR)
-       # object name:
-       if obj.type == 'Empty':
-               # Empties are called "$$$DUMMY" and use the OBJECT_INSTANCE_NAME chunk 
-               # for their name (see below):
-               obj_node_header_chunk.add_variable("name", _3ds_string("$$$DUMMY"))
-       else:
-               # Add the name:
-               obj_node_header_chunk.add_variable("name", _3ds_string(sane_name(name)))
-       # Add Flag variables (not sure what they do):
-       obj_node_header_chunk.add_variable("flags1", _3ds_short(0))
-       obj_node_header_chunk.add_variable("flags2", _3ds_short(0))
-       
-       # Check parent-child relationships:
-       parent = obj.parent
-       if (parent == None) or (parent.name not in name_to_id):
-               # If no parent, or the parents name is not in the name_to_id dictionary,
-               # parent id becomes -1:
-               obj_node_header_chunk.add_variable("parent", _3ds_short(-1))
-       else:
-               # Get the parent's id from the name_to_id dictionary:
-               obj_node_header_chunk.add_variable("parent", _3ds_short(name_to_id[parent.name]))
-       
-       # Add pivot chunk:
-       obj_pivot_chunk = _3ds_chunk(OBJECT_PIVOT)
-       obj_pivot_chunk.add_variable("pivot", _3ds_point_3d(obj.getLocation()))
-       kf_obj_node.add_subchunk(obj_pivot_chunk)
-       
-       # add subchunks for object id and node header:
-       kf_obj_node.add_subchunk(obj_id_chunk)
-       kf_obj_node.add_subchunk(obj_node_header_chunk)
-
-       # Empty objects need to have an extra chunk for the instance name:
-       if obj.type == 'Empty':
-               obj_instance_name_chunk = _3ds_chunk(OBJECT_INSTANCE_NAME)
-               obj_instance_name_chunk.add_variable("name", _3ds_string(sane_name(name)))
-               kf_obj_node.add_subchunk(obj_instance_name_chunk)
-       
-       # Add track chunks for position, rotation and scale:
-       kf_obj_node.add_subchunk(make_track_chunk(POS_TRACK_TAG, obj))
-       kf_obj_node.add_subchunk(make_track_chunk(ROT_TRACK_TAG, obj))
-       kf_obj_node.add_subchunk(make_track_chunk(SCL_TRACK_TAG, obj))
-
-       return kf_obj_node
-"""
-
-import BPyMessages
-def save_3ds(filename):
-       '''Save the Blender scene to a 3ds file.'''
-       # Time the export
-       
-       if not filename.lower().endswith('.3ds'):
-               filename += '.3ds'
-       
-       if not BPyMessages.Warning_SaveOver(filename):
-               return
-       
-       time1= Blender.sys.time()
-       Blender.Window.WaitCursor(1)
-       sce= bpy.data.scenes.active
-       
-       # Initialize the main chunk (primary):
-       primary = _3ds_chunk(PRIMARY)
-       # Add version chunk:
-       version_chunk = _3ds_chunk(VERSION)
-       version_chunk.add_variable("version", _3ds_int(3))
-       primary.add_subchunk(version_chunk)
-       
-       # init main object info chunk:
-       object_info = _3ds_chunk(OBJECTINFO)
-       
-       ''' # COMMENTED OUT FOR 2.42 RELEASE!! CRASHES 3DS MAX
-       # init main key frame data chunk:
-       kfdata = make_kfdata()
-       '''
-       
-       # Get all the supported objects selected in this scene:
-       # ob_sel= list(sce.objects.context)
-       # mesh_objects = [ (ob, me) for ob in ob_sel   for me in (BPyMesh.getMeshFromObject(ob, None, True, False, sce),) if me ]
-       # empty_objects = [ ob for ob in ob_sel if ob.type == 'Empty' ]
-       
-       # Make a list of all materials used in the selected meshes (use a dictionary,
-       # each material is added once):
-       materialDict = {}
-       mesh_objects = []
-       for ob in sce.objects.context:
-               for ob_derived, mat in getDerivedObjects(ob, False):
-                       data = getMeshFromObject(ob_derived, None, True, False, sce)
-                       if data:
-                               data.transform(mat, recalc_normals=False)
-                               mesh_objects.append((ob_derived, data))
-                               mat_ls = data.materials
-                               mat_ls_len = len(mat_ls)
-                               # get material/image tuples.
-                               if data.faceUV:
-                                       if not mat_ls:
-                                               mat = mat_name = None
-                                       
-                                       for f in data.faces:
-                                               if mat_ls:
-                                                       mat_index = f.mat
-                                                       if mat_index >= mat_ls_len:
-                                                               mat_index = f.mat = 0
-                                                       mat = mat_ls[mat_index]
-                                                       if mat: mat_name = mat.name
-                                                       else:   mat_name = None
-                                               # else there alredy set to none
-                                                       
-                                               img = f.image
-                                               if img: img_name = img.name
-                                               else:   img_name = None
-                                               
-                                               materialDict.setdefault((mat_name, img_name), (mat, img) )
-                                               
-                                       
-                               else:
-                                       for mat in mat_ls:
-                                               if mat: # material may be None so check its not.
-                                                       materialDict.setdefault((mat.name, None), (mat, None) )
-                                       
-                                       # Why 0 Why!
-                                       for f in data.faces:
-                                               if f.mat >= mat_ls_len:
-                                                       f.mat = 0 
-       
-       # Make material chunks for all materials used in the meshes:
-       for mat_and_image in materialDict.itervalues():
-               object_info.add_subchunk(make_material_chunk(mat_and_image[0], mat_and_image[1]))
-       
-       # Give all objects a unique ID and build a dictionary from object name to object id:
-       """
-       name_to_id = {}
-       for ob, data in mesh_objects:
-               name_to_id[ob.name]= len(name_to_id)
-       #for ob in empty_objects:
-       #       name_to_id[ob.name]= len(name_to_id)
-       """
-       
-       # Create object chunks for all meshes:
-       i = 0
-       for ob, blender_mesh in mesh_objects:
-               # create a new object chunk
-               object_chunk = _3ds_chunk(OBJECT)
-               
-               # set the object name
-               object_chunk.add_variable("name", _3ds_string(sane_name(ob.name)))
-               
-               # make a mesh chunk out of the mesh:
-               object_chunk.add_subchunk(make_mesh_chunk(blender_mesh, materialDict))
-               object_info.add_subchunk(object_chunk)
-               
-               ''' # COMMENTED OUT FOR 2.42 RELEASE!! CRASHES 3DS MAX
-               # make a kf object node for the object:
-               kfdata.add_subchunk(make_kf_obj_node(ob, name_to_id))
-               '''
-               blender_mesh.verts = None
-               i+=i
-
-       # Create chunks for all empties:
-       ''' # COMMENTED OUT FOR 2.42 RELEASE!! CRASHES 3DS MAX
-       for ob in empty_objects:
-               # Empties only require a kf object node:
-               kfdata.add_subchunk(make_kf_obj_node(ob, name_to_id))
-               pass
-       '''
-       
-       # Add main object info chunk to primary chunk:
-       primary.add_subchunk(object_info)
-       
-       ''' # COMMENTED OUT FOR 2.42 RELEASE!! CRASHES 3DS MAX
-       # Add main keyframe data chunk to primary chunk:
-       primary.add_subchunk(kfdata)
-       '''
-       
-       # At this point, the chunk hierarchy is completely built.
-       
-       # Check the size:
-       primary.get_size()
-       # Open the file for writing:
-       file = open( filename, 'wb' )
-       
-       # Recursively write the chunks to file:
-       primary.write(file)
-       
-       # Close the file:
-       file.close()
-       
-       # Debugging only: report the exporting time:
-       Blender.Window.WaitCursor(0)
-       print "3ds export time: %.2f" % (Blender.sys.time() - time1)
-       
-       # Debugging only: dump the chunk hierarchy:
-       #primary.dump()
-
-
-if __name__=='__main__':
-    if struct:
-        Blender.Window.FileSelector(save_3ds, "Export 3DS", Blender.sys.makename(ext='.3ds'))
-    else:
-        Blender.Draw.PupMenu("Error%t|This script requires a full python installation")
-# save_3ds('/test_b.3ds')
diff --git a/release/scripts/3ds_import.py b/release/scripts/3ds_import.py
deleted file mode 100644 (file)
index bcde82c..0000000
+++ /dev/null
@@ -1,1007 +0,0 @@
-#!BPY
-""" 
-Name: '3D Studio (.3ds)...'
-Blender: 244
-Group: 'Import'
-Tooltip: 'Import from 3DS file format (.3ds)'
-"""
-
-__author__= ['Bob Holcomb', 'Richard L?rk?ng', 'Damien McGinnes', 'Campbell Barton', 'Mario Lapin']
-__url__ = ("blenderartists.org", "www.blender.org", "www.gametutorials.com", "lib3ds.sourceforge.net/")
-__version__= '0.996'
-__bpydoc__= '''\
-
-3ds Importer
-
-This script imports a 3ds file and the materials into Blender for editing.
-
-Loader is based on 3ds loader from www.gametutorials.com (Thanks DigiBen).
-
-0.996 by Mario Lapin (mario.lapin@gmail.com) 13/04/200 <br>
- - Implemented workaround to correct association between name, geometry and materials of
-   imported meshes.
-   
-   Without this patch, version 0.995 of this importer would associate to each mesh object the
-   geometry and the materials of the previously parsed mesh object. By so, the name of the
-   first mesh object would be thrown away, and the name of the last mesh object would be
-   automatically merged with a '.001' at the end. No object would desappear, however object's
-   names and materials would be completely jumbled.
-
-0.995 by Campbell Barton<br>
-- workaround for buggy mesh vert delete
-- minor tweaks
-
-0.99 by Bob Holcomb<br>
-- added support for floating point color values that previously broke on import.
-
-0.98 by Campbell Barton<br>
-- import faces and verts to lists instead of a mesh, convert to a mesh later
-- use new index mapping feature of mesh to re-map faces that were not added.
-
-0.97 by Campbell Barton<br>
-- Strip material names of spaces
-- Added import as instance to import the 3ds into its own
-  scene and add a group instance to the current scene
-- New option to scale down imported objects so they are within a limited bounding area.
-
-0.96 by Campbell Barton<br>
-- Added workaround for bug in setting UV's for Zero vert index UV faces.
-- Removed unique name function, let blender make the names unique.
-
-0.95 by Campbell Barton<br>
-- Removed workarounds for Blender 2.41
-- Mesh objects split by material- many 3ds objects used more then 16 per mesh.
-- Removed a lot of unneeded variable creation.
-
-0.94 by Campbell Barton<br> 
-- Face import tested to be about overall 16x speedup over 0.93.
-- Material importing speedup.
-- Tested with more models.
-- Support some corrupt models.
-
-0.93 by Campbell Barton<br> 
-- Tested with 400 3ds files from turbosquid and samples.
-- Tactfully ignore faces that used the same verts twice.
-- Rollback to 0.83 sloppy un-reorganized code, this broke UV coord loading.
-- Converted from NMesh to Mesh.
-- Faster and cleaner new names.
-- Use external comprehensive image loader.
-- Re intergrated 0.92 and 0.9 changes
-- Fixes for 2.41 compat.
-- Non textured faces do not use a texture flag.
-
-0.92<br>
-- Added support for diffuse, alpha, spec, bump maps in a single material
-
-0.9<br>
-- Reorganized code into object/material block functions<br>
-- Use of Matrix() to copy matrix data<br>
-- added support for material transparency<br>
-
-0.83 2005-08-07: Campell Barton
--  Aggressive image finding and case insensitivy for posisx systems.
-
-0.82a 2005-07-22
-- image texture loading (both for face uv and renderer)
-
-0.82 - image texture loading (for face uv)
-
-0.81a (fork- not 0.9) Campbell Barton 2005-06-08
-- Simplified import code
-- Never overwrite data
-- Faster list handling
-- Leaves import selected
-
-0.81 Damien McGinnes 2005-01-09
-- handle missing images better
-    
-0.8 Damien McGinnes 2005-01-08
-- copies sticky UV coords to face ones
-- handles images better
-- Recommend that you run 'RemoveDoubles' on each imported mesh after using this script
-
-'''
-
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# Script copyright (C) Bob Holcomb 
-#
-# 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 *****
-# --------------------------------------------------------------------------
-
-# Importing modules
-
-import Blender
-import bpy
-from Blender import Mesh, Object, Material, Image, Texture, Lamp, Mathutils
-from Blender.Mathutils import Vector
-import BPyImage
-
-import BPyMessages
-
-try:
-       from struct import calcsize, unpack
-except:
-       calcsize= unpack= None
-
-
-
-# If python version is less than 2.4, try to get set stuff from module
-try:
-       set
-except:
-       from sets import Set as set
-
-BOUNDS_3DS= []
-
-
-#this script imports uvcoords as sticky vertex coords
-#this parameter enables copying these to face uv coords
-#which shold be more useful.
-
-def createBlenderTexture(material, name, image):
-       texture= bpy.data.textures.new(name)
-       texture.setType('Image')
-       texture.image= image
-       material.setTexture(0, texture, Texture.TexCo.UV, Texture.MapTo.COL)
-
-
-
-######################################################
-# Data Structures
-######################################################
-
-#Some of the chunks that we will see
-#----- Primary Chunk, at the beginning of each file
-PRIMARY= long('0x4D4D',16)
-
-#------ Main Chunks
-OBJECTINFO   =      long('0x3D3D',16);      #This gives the version of the mesh and is found right before the material and object information
-VERSION      =      long('0x0002',16);      #This gives the version of the .3ds file
-EDITKEYFRAME=      long('0xB000',16);      #This is the header for all of the key frame info
-
-#------ sub defines of OBJECTINFO
-MATERIAL=45055         #0xAFFF                         // This stored the texture info
-OBJECT=16384           #0x4000                         // This stores the faces, vertices, etc...
-
-#>------ sub defines of MATERIAL
-#------ sub defines of MATERIAL_BLOCK
-MAT_NAME               =       long('0xA000',16)       # This holds the material name
-MAT_AMBIENT            =       long('0xA010',16)       # Ambient color of the object/material
-MAT_DIFFUSE            =       long('0xA020',16)       # This holds the color of the object/material
-MAT_SPECULAR   =       long('0xA030',16)       # SPecular color of the object/material
-MAT_SHINESS            =       long('0xA040',16)       # ??
-MAT_TRANSPARENCY=      long('0xA050',16)       # Transparency value of material
-MAT_SELF_ILLUM =       long('0xA080',16)       # Self Illumination value of material
-MAT_WIRE               =       long('0xA085',16)       # Only render's wireframe
-
-MAT_TEXTURE_MAP        =       long('0xA200',16)       # This is a header for a new texture map
-MAT_SPECULAR_MAP=      long('0xA204',16)       # This is a header for a new specular map
-MAT_OPACITY_MAP        =       long('0xA210',16)       # This is a header for a new opacity map
-MAT_REFLECTION_MAP=    long('0xA220',16)       # This is a header for a new reflection map
-MAT_BUMP_MAP   =       long('0xA230',16)       # This is a header for a new bump map
-MAT_MAP_FILENAME =      long('0xA300',16)      # This holds the file name of the texture
-
-MAT_FLOAT_COLOR = long ('0x0010', 16) #color defined as 3 floats
-MAT_24BIT_COLOR        = long ('0x0011', 16) #color defined as 3 bytes
-
-#>------ sub defines of OBJECT
-OBJECT_MESH  =      long('0x4100',16);      # This lets us know that we are reading a new object
-OBJECT_LAMP =      long('0x4600',16);      # This lets un know we are reading a light object
-OBJECT_LAMP_SPOT = long('0x4610',16);          # The light is a spotloght.
-OBJECT_LAMP_OFF = long('0x4620',16);           # The light off.
-OBJECT_LAMP_ATTENUATE = long('0x4625',16);     
-OBJECT_LAMP_RAYSHADE = long('0x4627',16);      
-OBJECT_LAMP_SHADOWED = long('0x4630',16);      
-OBJECT_LAMP_LOCAL_SHADOW = long('0x4640',16);  
-OBJECT_LAMP_LOCAL_SHADOW2 = long('0x4641',16); 
-OBJECT_LAMP_SEE_CONE = long('0x4650',16);      
-OBJECT_LAMP_SPOT_RECTANGULAR= long('0x4651',16);
-OBJECT_LAMP_SPOT_OVERSHOOT= long('0x4652',16);
-OBJECT_LAMP_SPOT_PROJECTOR= long('0x4653',16);
-OBJECT_LAMP_EXCLUDE= long('0x4654',16);
-OBJECT_LAMP_RANGE= long('0x4655',16);
-OBJECT_LAMP_ROLL= long('0x4656',16);
-OBJECT_LAMP_SPOT_ASPECT= long('0x4657',16);
-OBJECT_LAMP_RAY_BIAS= long('0x4658',16);
-OBJECT_LAMP_INNER_RANGE= long('0x4659',16);
-OBJECT_LAMP_OUTER_RANGE= long('0x465A',16);
-OBJECT_LAMP_MULTIPLIER = long('0x465B',16);
-OBJECT_LAMP_AMBIENT_LIGHT = long('0x4680',16);
-
-
-
-OBJECT_CAMERA=      long('0x4700',16);      # This lets un know we are reading a camera object
-
-#>------ sub defines of CAMERA
-OBJECT_CAM_RANGES=   long('0x4720',16);      # The camera range values
-
-#>------ sub defines of OBJECT_MESH
-OBJECT_VERTICES =   long('0x4110',16);      # The objects vertices
-OBJECT_FACES    =   long('0x4120',16);      # The objects faces
-OBJECT_MATERIAL =   long('0x4130',16);      # This is found if the object has a material, either texture map or color
-OBJECT_UV       =   long('0x4140',16);      # The UV texture coordinates
-OBJECT_TRANS_MATRIX  =   long('0x4160',16); # The Object Matrix
-
-global scn
-scn= None
-
-#the chunk class
-class chunk:
-       ID=0
-       length=0
-       bytes_read=0
-
-       #we don't read in the bytes_read, we compute that
-       binary_format='<HI'
-
-       def __init__(self):
-               self.ID=0
-               self.length=0
-               self.bytes_read=0
-
-       def dump(self):
-               print 'ID: ', self.ID
-               print 'ID in hex: ', hex(self.ID)
-               print 'length: ', self.length
-               print 'bytes_read: ', self.bytes_read
-
-def read_chunk(file, chunk):
-       temp_data=file.read(calcsize(chunk.binary_format))
-       data=unpack(chunk.binary_format, temp_data)
-       chunk.ID=data[0]
-       chunk.length=data[1]
-       #update the bytes read function
-       chunk.bytes_read=6
-
-       #if debugging
-       #chunk.dump()
-
-def read_string(file):
-       #read in the characters till we get a null character
-       s=''
-       while not s.endswith('\x00'):
-               s+=unpack( '<c', file.read(1) )[0]
-               #print 'string: ',s
-       
-       #remove the null character from the string
-       return s[:-1]
-
-######################################################
-# IMPORT
-######################################################
-def process_next_object_chunk(file, previous_chunk):
-       new_chunk=chunk()
-       temp_chunk=chunk()
-
-       while (previous_chunk.bytes_read<previous_chunk.length):
-               #read the next chunk
-               read_chunk(file, new_chunk)
-
-def skip_to_end(file, skip_chunk):
-       buffer_size=skip_chunk.length-skip_chunk.bytes_read
-       binary_format='%ic' % buffer_size
-       temp_data=file.read(calcsize(binary_format))
-       skip_chunk.bytes_read+=buffer_size
-
-
-def add_texture_to_material(image, texture, material, mapto):
-       if mapto=='DIFFUSE':
-               map=Texture.MapTo.COL
-       elif mapto=='SPECULAR':
-               map=Texture.MapTo.SPEC
-       elif mapto=='OPACITY':
-               map=Texture.MapTo.ALPHA
-       elif mapto=='BUMP':
-               map=Texture.MapTo.NOR
-       else:
-               print '/tError:  Cannot map to "%s"\n\tassuming diffuse color. modify material "%s" later.' % (mapto, material.name)
-               map=Texture.MapTo.COL
-
-       if image: texture.setImage(image) # double check its an image.
-       free_tex_slots= [i for i, tex in enumerate( material.getTextures() ) if tex==None]
-       if not free_tex_slots:
-               print '/tError: Cannot add "%s" map. 10 Texture slots alredy used.' % mapto
-       else:
-               material.setTexture(free_tex_slots[0],texture,Texture.TexCo.UV,map)
-
-
-def process_next_chunk(file, previous_chunk, importedObjects, IMAGE_SEARCH):
-       #print previous_chunk.bytes_read, 'BYTES READ'
-       contextObName= None
-       contextLamp= [None, None] # object, Data
-       contextMaterial= None
-       contextMatrix_rot= None # Blender.Mathutils.Matrix(); contextMatrix.identity()
-       #contextMatrix_tx= None # Blender.Mathutils.Matrix(); contextMatrix.identity()
-       contextMesh_vertls= None
-       contextMesh_facels= None
-       contextMeshMaterials= {} # matname:[face_idxs]
-       contextMeshUV= None
-       
-       TEXTURE_DICT={}
-       MATDICT={}
-       TEXMODE= Mesh.FaceModes['TEX']
-       
-       # Localspace variable names, faster.
-       STRUCT_SIZE_1CHAR= calcsize('c')
-       STRUCT_SIZE_2FLOAT= calcsize('2f')
-       STRUCT_SIZE_3FLOAT= calcsize('3f')
-       STRUCT_SIZE_UNSIGNED_SHORT= calcsize('H')
-       STRUCT_SIZE_4UNSIGNED_SHORT= calcsize('4H')
-       STRUCT_SIZE_4x3MAT= calcsize('ffffffffffff')
-       _STRUCT_SIZE_4x3MAT= calcsize('fffffffffffff')
-       # STRUCT_SIZE_4x3MAT= calcsize('ffffffffffff')
-       # print STRUCT_SIZE_4x3MAT, ' STRUCT_SIZE_4x3MAT'
-       
-       def putContextMesh(myContextMesh_vertls, myContextMesh_facels, myContextMeshMaterials):
-               
-               materialFaces= set() # faces that have a material. Can optimize?
-               
-               # Now make copies with assigned materils.
-               
-               def makeMeshMaterialCopy(matName, faces):                       
-                       '''
-                       Make a new mesh with only face the faces that use this material.
-                       faces can be any iterable object - containing ints.
-                       '''
-                       
-                       faceVertUsers = [False] * len(myContextMesh_vertls)
-                       ok=0
-                       for fIdx in faces:
-                               for vindex in myContextMesh_facels[fIdx]:
-                                       faceVertUsers[vindex] = True
-                                       if matName != None: # if matName is none then this is a set(), meaning we are using the untextured faces and do not need to store textured faces.
-                                               materialFaces.add(fIdx)
-                                       ok=1
-                       
-                       if not ok:
-                               return
-                                       
-                       myVertMapping = {}
-                       vertMappingIndex = 0
-                       
-                       vertsToUse = [i for i in xrange(len(myContextMesh_vertls)) if faceVertUsers[i]]
-                       myVertMapping = dict( [ (ii, i) for i, ii in enumerate(vertsToUse) ] )
-                       
-                       tempName= '%s_%s' % (contextObName, matName) # matName may be None.
-                       bmesh = bpy.data.meshes.new(tempName)
-                       
-                       if matName == None:
-                               img= None
-                       else:
-                               bmat = MATDICT[matName][1]
-                               bmesh.materials= [bmat]
-                               try:    img= TEXTURE_DICT[bmat.name]
-                               except: img= None
-                               
-                       bmesh_verts = bmesh.verts
-                       bmesh_verts.extend( [Vector()] )
-                       bmesh_verts.extend( [myContextMesh_vertls[i] for i in vertsToUse] )
-                       # +1 because of DUMMYVERT
-                       face_mapping= bmesh.faces.extend( [ [ bmesh_verts[ myVertMapping[vindex]+1] for vindex in myContextMesh_facels[fIdx]] for fIdx in faces ], indexList=True )
-                       
-                       if bmesh.faces and (contextMeshUV or img):
-                               bmesh.faceUV= 1
-                               for ii, i in enumerate(faces):
-                                       
-                                       # Mapped index- faces may have not been added- if so, then map to the correct index
-                                       # BUGGY API - face_mapping is not always the right length
-                                       map_index= face_mapping[ii]
-                                       
-                                       if map_index != None:
-                                               targetFace= bmesh.faces[map_index]
-                                               if contextMeshUV:
-                                                       # v.index-1 because of the DUMMYVERT
-                                                       targetFace.uv= [contextMeshUV[vindex] for vindex in myContextMesh_facels[i]]
-                                               if img:
-                                                       targetFace.image= img
-                       
-                       # bmesh.transform(contextMatrix)
-                       ob = SCN_OBJECTS.new(bmesh, tempName)
-                       '''
-                       if contextMatrix_tx:
-                               ob.setMatrix(contextMatrix_tx)
-                       '''
-                       
-                       if contextMatrix_rot:
-                               ob.setMatrix(contextMatrix_rot)
-                       
-                       importedObjects.append(ob)
-                       bmesh.calcNormals()
-               
-               for matName, faces in myContextMeshMaterials.iteritems():
-                       makeMeshMaterialCopy(matName, faces)
-                       
-               if len(materialFaces)!=len(myContextMesh_facels):
-                       # Invert material faces.
-                       makeMeshMaterialCopy(None, set(range(len( myContextMesh_facels ))) - materialFaces)
-                       #raise 'Some UnMaterialed faces', len(contextMesh.faces)
-       
-       #a spare chunk
-       new_chunk= chunk()
-       temp_chunk= chunk()
-       
-       CreateBlenderObject = False
-
-       #loop through all the data for this chunk (previous chunk) and see what it is
-       while (previous_chunk.bytes_read<previous_chunk.length):
-               #print '\t', previous_chunk.bytes_read, 'keep going'
-               #read the next chunk
-               #print 'reading a chunk'
-               read_chunk(file, new_chunk)
-
-               #is it a Version chunk?
-               if (new_chunk.ID==VERSION):
-                       #print 'if (new_chunk.ID==VERSION):'
-                       #print 'found a VERSION chunk'
-                       #read in the version of the file
-                       #it's an unsigned short (H)
-                       temp_data= file.read(calcsize('I'))
-                       version = unpack('<I', temp_data)[0]
-                       new_chunk.bytes_read+= 4 #read the 4 bytes for the version number
-                       #this loader works with version 3 and below, but may not with 4 and above
-                       if (version>3):
-                               print '\tNon-Fatal Error:  Version greater than 3, may not load correctly: ', version
-
-               #is it an object info chunk?
-               elif (new_chunk.ID==OBJECTINFO):
-                       #print 'elif (new_chunk.ID==OBJECTINFO):'
-                       # print 'found an OBJECTINFO chunk'
-                       process_next_chunk(file, new_chunk, importedObjects, IMAGE_SEARCH)
-                       
-                       #keep track of how much we read in the main chunk
-                       new_chunk.bytes_read+=temp_chunk.bytes_read
-
-               #is it an object chunk?
-               elif (new_chunk.ID==OBJECT):
-                       
-                       if CreateBlenderObject:
-                               putContextMesh(contextMesh_vertls, contextMesh_facels, contextMeshMaterials)
-                               contextMesh_vertls= []; contextMesh_facels= []
-                       
-                               ## preparando para receber o proximo objeto
-                               contextMeshMaterials= {} # matname:[face_idxs]
-                               contextMeshUV= None
-                               #contextMesh.vertexUV= 1 # Make sticky coords.
-                               # Reset matrix
-                               contextMatrix_rot= None
-                               #contextMatrix_tx= None
-                               
-                       CreateBlenderObject= True
-                       tempName= read_string(file)
-                       contextObName= tempName
-                       new_chunk.bytes_read += len(tempName)+1
-               
-               #is it a material chunk?
-               elif (new_chunk.ID==MATERIAL):
-                       #print 'elif (new_chunk.ID==MATERIAL):'
-                       contextMaterial= bpy.data.materials.new('Material')
-               
-               elif (new_chunk.ID==MAT_NAME):
-                       #print 'elif (new_chunk.ID==MAT_NAME):'
-                       material_name= read_string(file)
-                       
-                       #plus one for the null character that ended the string
-                       new_chunk.bytes_read+= len(material_name)+1
-                       
-                       contextMaterial.name= material_name.rstrip() # remove trailing  whitespace
-                       MATDICT[material_name]= (contextMaterial.name, contextMaterial)
-               
-               elif (new_chunk.ID==MAT_AMBIENT):
-                       #print 'elif (new_chunk.ID==MAT_AMBIENT):'
-                       read_chunk(file, temp_chunk)
-                       if (temp_chunk.ID==MAT_FLOAT_COLOR):
-                               temp_data=file.read(calcsize('3f'))
-                               temp_chunk.bytes_read+=12
-                               contextMaterial.mirCol=[float(col) for col in unpack('<3f', temp_data)]
-                       elif (temp_chunk.ID==MAT_24BIT_COLOR):
-                               temp_data=file.read(calcsize('3B'))
-                               temp_chunk.bytes_read+= 3
-                               contextMaterial.mirCol= [float(col)/255 for col in unpack('<3B', temp_data)] # data [0,1,2] == rgb
-                       else:
-                               skip_to_end(file, temp_chunk)
-                       new_chunk.bytes_read+= temp_chunk.bytes_read
-
-               elif (new_chunk.ID==MAT_DIFFUSE):
-                       #print 'elif (new_chunk.ID==MAT_DIFFUSE):'
-                       read_chunk(file, temp_chunk)
-                       if (temp_chunk.ID==MAT_FLOAT_COLOR):
-                               temp_data=file.read(calcsize('3f'))
-                               temp_chunk.bytes_read+=12
-                               contextMaterial.rgbCol=[float(col) for col in unpack('<3f', temp_data)]
-                       elif (temp_chunk.ID==MAT_24BIT_COLOR):
-                               temp_data=file.read(calcsize('3B'))
-                               temp_chunk.bytes_read+= 3
-                               contextMaterial.rgbCol= [float(col)/255 for col in unpack('<3B', temp_data)] # data [0,1,2] == rgb
-                       else:
-                               skip_to_end(file, temp_chunk)
-                       new_chunk.bytes_read+= temp_chunk.bytes_read
-
-               elif (new_chunk.ID==MAT_SPECULAR):
-                       #print 'elif (new_chunk.ID==MAT_SPECULAR):'
-                       read_chunk(file, temp_chunk)
-                       if (temp_chunk.ID==MAT_FLOAT_COLOR):
-                               temp_data=file.read(calcsize('3f'))
-                               temp_chunk.bytes_read+=12
-                               contextMaterial.mirCol=[float(col) for col in unpack('<3f', temp_data)]
-                       elif (temp_chunk.ID==MAT_24BIT_COLOR):
-                               temp_data=file.read(calcsize('3B'))
-                               temp_chunk.bytes_read+= 3
-                               contextMaterial.mirCol= [float(col)/255 for col in unpack('<3B', temp_data)] # data [0,1,2] == rgb
-                       else:
-                               skip_to_end(file, temp_chunk)
-                       new_chunk.bytes_read+= temp_chunk.bytes_read
-                       
-               elif (new_chunk.ID==MAT_TEXTURE_MAP):
-                       #print 'elif (new_chunk.ID==MAT_TEXTURE_MAP):'
-                       new_texture= bpy.data.textures.new('Diffuse')
-                       new_texture.setType('Image')
-                       img = None
-                       while (new_chunk.bytes_read<new_chunk.length):
-                               #print 'MAT_TEXTURE_MAP..while', new_chunk.bytes_read, new_chunk.length
-                               read_chunk(file, temp_chunk)
-                               
-                               if (temp_chunk.ID==MAT_MAP_FILENAME):
-                                       texture_name=read_string(file)
-                                       #img= TEXTURE_DICT[contextMaterial.name]= BPyImage.comprehensiveImageLoad(texture_name, FILENAME)
-                                       img= TEXTURE_DICT[contextMaterial.name]= BPyImage.comprehensiveImageLoad(texture_name, FILENAME, PLACE_HOLDER= False, RECURSIVE= IMAGE_SEARCH)
-                                       new_chunk.bytes_read += (len(texture_name)+1) #plus one for the null character that gets removed
-                                       
-                               else:
-                                       skip_to_end(file, temp_chunk)
-                               
-                               new_chunk.bytes_read+= temp_chunk.bytes_read
-                       
-                       #add the map to the material in the right channel
-                       if img:
-                               add_texture_to_material(img, new_texture, contextMaterial, 'DIFFUSE')
-                       
-               elif (new_chunk.ID==MAT_SPECULAR_MAP):
-                       #print 'elif (new_chunk.ID==MAT_SPECULAR_MAP):'
-                       new_texture= bpy.data.textures.new('Specular')
-                       new_texture.setType('Image')
-                       img = None
-                       while (new_chunk.bytes_read<new_chunk.length):
-                               read_chunk(file, temp_chunk)
-                               
-                               if (temp_chunk.ID==MAT_MAP_FILENAME):
-                                       texture_name= read_string(file)
-                                       #img= BPyImage.comprehensiveImageLoad(texture_name, FILENAME)
-                                       img= BPyImage.comprehensiveImageLoad(texture_name, FILENAME, PLACE_HOLDER= False, RECURSIVE= IMAGE_SEARCH)
-                                       new_chunk.bytes_read+= (len(texture_name)+1) #plus one for the null character that gets removed
-                               else:
-                                       skip_to_end(file, temp_chunk)
-                               
-                               new_chunk.bytes_read+= temp_chunk.bytes_read
-                               
-                       #add the map to the material in the right channel
-                       if img:
-                               add_texture_to_material(img, new_texture, contextMaterial, 'SPECULAR')
-       
-               elif (new_chunk.ID==MAT_OPACITY_MAP):
-                       #print 'new_texture=Blender.Texture.New('Opacity')'
-                       new_texture= bpy.data.textures.new('Opacity')
-                       new_texture.setType('Image')
-                       img = None
-                       while (new_chunk.bytes_read<new_chunk.length):
-                               read_chunk(file, temp_chunk)
-                               
-                               if (temp_chunk.ID==MAT_MAP_FILENAME):
-                                       texture_name= read_string(file)
-                                       #img= BPyImage.comprehensiveImageLoad(texture_name, FILENAME)
-                                       img= BPyImage.comprehensiveImageLoad(texture_name, FILENAME, PLACE_HOLDER= False, RECURSIVE= IMAGE_SEARCH)
-                                       new_chunk.bytes_read += (len(texture_name)+1) #plus one for the null character that gets removed
-                               else:
-                                       skip_to_end(file, temp_chunk)
-                               
-                               new_chunk.bytes_read+= temp_chunk.bytes_read
-                       #add the map to the material in the right channel
-                       if img:
-                               add_texture_to_material(img, new_texture, contextMaterial, 'OPACITY')
-
-               elif (new_chunk.ID==MAT_BUMP_MAP):
-                       #print 'elif (new_chunk.ID==MAT_BUMP_MAP):'
-                       new_texture= bpy.data.textures.new('Bump')
-                       new_texture.setType('Image')
-                       img = None
-                       while (new_chunk.bytes_read<new_chunk.length):
-                               read_chunk(file, temp_chunk)
-                               
-                               if (temp_chunk.ID==MAT_MAP_FILENAME):
-                                       texture_name= read_string(file)
-                                       #img= BPyImage.comprehensiveImageLoad(texture_name, FILENAME)
-                                       img= BPyImage.comprehensiveImageLoad(texture_name, FILENAME, PLACE_HOLDER= False, RECURSIVE= IMAGE_SEARCH)
-                                       new_chunk.bytes_read += (len(texture_name)+1) #plus one for the null character that gets removed
-                               else:
-                                       skip_to_end(file, temp_chunk)
-                               
-                               new_chunk.bytes_read+=temp_chunk.bytes_read
-                               
-                       #add the map to the material in the right channel
-                       if img:
-                               add_texture_to_material(img, new_texture, contextMaterial, 'BUMP')
-                       
-               elif (new_chunk.ID==MAT_TRANSPARENCY):
-                       #print 'elif (new_chunk.ID==MAT_TRANSPARENCY):'
-                       read_chunk(file, temp_chunk)
-                       temp_data=file.read(STRUCT_SIZE_UNSIGNED_SHORT)
-                       
-                       temp_chunk.bytes_read+=2
-                       contextMaterial.alpha= 1-(float(unpack('<H', temp_data)[0])/100)
-                       new_chunk.bytes_read+=temp_chunk.bytes_read
-
-
-               elif (new_chunk.ID==OBJECT_LAMP): # Basic lamp support.
-                       
-                       temp_data=file.read(STRUCT_SIZE_3FLOAT)
-                       
-                       x,y,z=unpack('<3f', temp_data)
-                       new_chunk.bytes_read+=STRUCT_SIZE_3FLOAT
-                       
-                       contextLamp[1]= bpy.data.lamps.new()
-                       contextLamp[0]= SCN_OBJECTS.new(contextLamp[1])
-                       importedObjects.append(contextLamp[0])
-                       
-                       #print 'number of faces: ', num_faces
-                       #print x,y,z
-                       contextLamp[0].setLocation(x,y,z)
-                       
-                       # Reset matrix
-                       contextMatrix_rot= None
-                       #contextMatrix_tx= None
-                       #print contextLamp.name, 
-                       
-               elif (new_chunk.ID==OBJECT_MESH):
-                       # print 'Found an OBJECT_MESH chunk'
-                       pass
-               elif (new_chunk.ID==OBJECT_VERTICES):
-                       '''
-                       Worldspace vertex locations
-                       '''
-                       # print 'elif (new_chunk.ID==OBJECT_VERTICES):'
-                       temp_data=file.read(STRUCT_SIZE_UNSIGNED_SHORT)
-                       num_verts=unpack('<H', temp_data)[0]
-                       new_chunk.bytes_read+=2
-                       
-                       # print 'number of verts: ', num_verts
-                       def getvert():
-                               temp_data= unpack('<3f', file.read(STRUCT_SIZE_3FLOAT))
-                               new_chunk.bytes_read += STRUCT_SIZE_3FLOAT #12: 3 floats x 4 bytes each
-                               return temp_data
-                       
-                       #contextMesh.verts.extend( [Vector(),] ) # DUMMYVERT! - remove when blenders internals are fixed.
-                       contextMesh_vertls= [getvert() for i in xrange(num_verts)]
-                       
-                       #print 'object verts: bytes read: ', new_chunk.bytes_read
-
-               elif (new_chunk.ID==OBJECT_FACES):
-                       # print 'elif (new_chunk.ID==OBJECT_FACES):'
-                       temp_data= file.read(STRUCT_SIZE_UNSIGNED_SHORT)
-                       num_faces= unpack('<H', temp_data)[0]
-                       new_chunk.bytes_read+= 2
-                       #print 'number of faces: ', num_faces
-                       
-                       def getface():
-                               # print '\ngetting a face'
-                               temp_data= file.read(STRUCT_SIZE_4UNSIGNED_SHORT)
-                               new_chunk.bytes_read+= STRUCT_SIZE_4UNSIGNED_SHORT #4 short ints x 2 bytes each
-                               v1,v2,v3,dummy= unpack('<4H', temp_data)
-                               return v1, v2, v3
-                       
-                       contextMesh_facels= [ getface() for i in xrange(num_faces) ]
-
-
-               elif (new_chunk.ID==OBJECT_MATERIAL):
-                       # print 'elif (new_chunk.ID==OBJECT_MATERIAL):'
-                       material_name= read_string(file)
-                       new_chunk.bytes_read += len(material_name)+1 # remove 1 null character.
-                       
-                       temp_data=file.read(STRUCT_SIZE_UNSIGNED_SHORT)
-                       num_faces_using_mat = unpack('<H', temp_data)[0]
-                       new_chunk.bytes_read += STRUCT_SIZE_UNSIGNED_SHORT
-                       
-                       def getmat():
-                               temp_data= file.read(STRUCT_SIZE_UNSIGNED_SHORT)
-                               new_chunk.bytes_read+= STRUCT_SIZE_UNSIGNED_SHORT
-                               return unpack('<H', temp_data)[0]
-                       
-                       contextMeshMaterials[material_name]= [ getmat() for i in xrange(num_faces_using_mat) ]
-                       
-                       #look up the material in all the materials
-
-               elif (new_chunk.ID==OBJECT_UV):
-                       temp_data=file.read(STRUCT_SIZE_UNSIGNED_SHORT)
-                       num_uv=unpack('<H', temp_data)[0]
-                       new_chunk.bytes_read+= 2
-                       
-                       def getuv():
-                               temp_data=file.read(STRUCT_SIZE_2FLOAT)
-                               new_chunk.bytes_read += STRUCT_SIZE_2FLOAT #2 float x 4 bytes each
-                               return Vector( unpack('<2f', temp_data) )
-                               
-                       contextMeshUV= [ getuv() for i in xrange(num_uv) ]
-               
-               elif (new_chunk.ID== OBJECT_TRANS_MATRIX):
-                       # How do we know the matrix size? 54 == 4x4 48 == 4x3
-                       temp_data=file.read(STRUCT_SIZE_4x3MAT)
-                       data= list( unpack('<ffffffffffff', temp_data)  )
-                       new_chunk.bytes_read += STRUCT_SIZE_4x3MAT
-                       
-                       contextMatrix_rot= Blender.Mathutils.Matrix(\
-                        data[:3] + [0],\
-                        data[3:6] + [0],\
-                        data[6:9] + [0],\
-                        data[9:] + [1])
-                       
-                       
-                       '''
-                       contextMatrix_rot= Blender.Mathutils.Matrix(\
-                        data[:3] + [0],\
-                        data[3:6] + [0],\
-                        data[6:9] + [0],\
-                        [0,0,0,1])
-                       '''
-                       
-                       '''
-                       contextMatrix_rot= Blender.Mathutils.Matrix(\
-                        data[:3] ,\
-                        data[3:6],\
-                        data[6:9])
-                       '''
-                       
-                       '''
-                       contextMatrix_rot = Blender.Mathutils.Matrix()
-                       m = 0
-                       for j in xrange(4):
-                               for i in xrange(3):
-                                       contextMatrix_rot[j][i] = data[m]
-                                       m+=1
-                       
-                       contextMatrix_rot[0][3]=0;
-                       contextMatrix_rot[1][3]=0;
-                       contextMatrix_rot[2][3]=0;
-                       contextMatrix_rot[3][3]=1;
-                       '''
-                       
-                       #contextMatrix_rot.resize4x4()
-                       #print "MTX"
-                       #print contextMatrix_rot
-                       contextMatrix_rot.invert()
-                       #print contextMatrix_rot
-                       #contextMatrix_tx = Blender.Mathutils.TranslationMatrix(0.5 * Blender.Mathutils.Vector(data[9:]))
-                       #contextMatrix_tx.invert()
-                       
-                       #tx.invert()
-                       
-                       #contextMatrix = contextMatrix * tx
-                       #contextMatrix = contextMatrix  *tx
-                       
-               elif  (new_chunk.ID==MAT_MAP_FILENAME):
-                       texture_name=read_string(file)
-                       try:
-                               TEXTURE_DICT[contextMaterial.name]
-                       except:
-                               #img= TEXTURE_DICT[contextMaterial.name]= BPyImage.comprehensiveImageLoad(texture_name, FILENAME)
-                               img= TEXTURE_DICT[contextMaterial.name]= BPyImage.comprehensiveImageLoad(texture_name, FILENAME, PLACE_HOLDER= False, RECURSIVE= IMAGE_SEARCH)
-                       
-                       new_chunk.bytes_read+= len(texture_name)+1 #plus one for the null character that gets removed
-               
-               else: #(new_chunk.ID!=VERSION or new_chunk.ID!=OBJECTINFO or new_chunk.ID!=OBJECT or new_chunk.ID!=MATERIAL):
-                       # print 'skipping to end of this chunk'
-                       buffer_size=new_chunk.length-new_chunk.bytes_read
-                       binary_format='%ic' % buffer_size
-                       temp_data=file.read(calcsize(binary_format))
-                       new_chunk.bytes_read+=buffer_size
-
-
-               #update the previous chunk bytes read
-               # print 'previous_chunk.bytes_read += new_chunk.bytes_read'
-               # print previous_chunk.bytes_read, new_chunk.bytes_read
-               previous_chunk.bytes_read += new_chunk.bytes_read
-               ## print 'Bytes left in this chunk: ', previous_chunk.length-previous_chunk.bytes_read
-       
-       # FINISHED LOOP
-       # There will be a number of objects still not added
-       if contextMesh_facels != None:
-               putContextMesh(contextMesh_vertls, contextMesh_facels, contextMeshMaterials)
-
-def load_3ds(filename, PREF_UI= True):
-       global FILENAME, SCN_OBJECTS
-       
-       if BPyMessages.Error_NoFile(filename):
-               return
-       
-       print '\n\nImporting 3DS: "%s"' % (Blender.sys.expandpath(filename))
-       
-       time1= Blender.sys.time()
-       
-       FILENAME=filename
-       current_chunk=chunk()
-       
-       file=open(filename,'rb')
-       
-       #here we go!
-       # print 'reading the first chunk'
-       read_chunk(file, current_chunk)
-       if (current_chunk.ID!=PRIMARY):
-               print '\tFatal Error:  Not a valid 3ds file: ', filename
-               file.close()
-               return
-       
-       
-       # IMPORT_AS_INSTANCE= Blender.Draw.Create(0)
-       IMPORT_CONSTRAIN_BOUNDS= Blender.Draw.Create(10.0)
-       IMAGE_SEARCH= Blender.Draw.Create(1)
-       APPLY_MATRIX= Blender.Draw.Create(0)
-       
-       # Get USER Options
-       pup_block= [\
-       ('Size Constraint:', IMPORT_CONSTRAIN_BOUNDS, 0.0, 1000.0, 'Scale the model by 10 until it reacehs the size constraint. Zero Disables.'),\
-       ('Image Search', IMAGE_SEARCH, 'Search subdirs for any assosiated images (Warning, may be slow)'),\
-       ('Transform Fix', APPLY_MATRIX, 'Workaround for object transformations importing incorrectly'),\
-       #('Group Instance', IMPORT_AS_INSTANCE, 'Import objects into a new scene and group, creating an instance in the current scene.'),\
-       ]
-       
-       if PREF_UI:
-               if not Blender.Draw.PupBlock('Import 3DS...', pup_block):
-                       return
-       
-       Blender.Window.WaitCursor(1)
-       
-       IMPORT_CONSTRAIN_BOUNDS= IMPORT_CONSTRAIN_BOUNDS.val
-       # IMPORT_AS_INSTANCE= IMPORT_AS_INSTANCE.val
-       IMAGE_SEARCH = IMAGE_SEARCH.val
-       APPLY_MATRIX = APPLY_MATRIX.val
-       
-       if IMPORT_CONSTRAIN_BOUNDS:
-               BOUNDS_3DS[:]= [1<<30, 1<<30, 1<<30, -1<<30, -1<<30, -1<<30]
-       else:
-               BOUNDS_3DS[:]= []
-       
-       ##IMAGE_SEARCH
-       
-       scn= bpy.data.scenes.active
-       SCN_OBJECTS = scn.objects
-       SCN_OBJECTS.selected = [] # de select all
-       
-       importedObjects= [] # Fill this list with objects
-       process_next_chunk(file, current_chunk, importedObjects, IMAGE_SEARCH)
-       
-       
-       # Link the objects into this scene.
-       # Layers= scn.Layers
-       
-       # REMOVE DUMMYVERT, - remove this in the next release when blenders internal are fixed.
-       
-       
-       for ob in importedObjects:
-               if ob.type=='Mesh':
-                       me= ob.getData(mesh=1)
-                       me.verts.delete([me.verts[0],])
-                       if not APPLY_MATRIX:
-                               me.transform(ob.matrixWorld.copy().invert())
-       
-       # Done DUMMYVERT
-       """
-       if IMPORT_AS_INSTANCE:
-               name= filename.split('\\')[-1].split('/')[-1]
-               # Create a group for this import.
-               group_scn= Scene.New(name)
-               for ob in importedObjects:
-                       group_scn.link(ob) # dont worry about the layers
-               
-               grp= Blender.Group.New(name)
-               grp.objects= importedObjects
-               
-               grp_ob= Object.New('Empty', name)
-               grp_ob.enableDupGroup= True
-               grp_ob.DupGroup= grp
-               scn.link(grp_ob)
-               grp_ob.Layers= Layers
-               grp_ob.sel= 1
-       else:
-               # Select all imported objects.
-               for ob in importedObjects:
-                       scn.link(ob)
-                       ob.Layers= Layers
-                       ob.sel= 1
-       """
-       
-       if IMPORT_CONSTRAIN_BOUNDS!=0.0:
-               # Set bounds from objecyt bounding box
-               for ob in importedObjects:
-                       if ob.type=='Mesh':
-                               ob.makeDisplayList() # Why dosnt this update the bounds?
-                               for v in ob.getBoundBox():
-                                       for i in (0,1,2):
-                                               if v[i] < BOUNDS_3DS[i]:
-                                                       BOUNDS_3DS[i]= v[i] # min
-                                               
-                                               if v[i] > BOUNDS_3DS[i+3]:
-                                                       BOUNDS_3DS[i+3]= v[i] # min
-               
-               # Get the max axis x/y/z
-               max_axis= max(BOUNDS_3DS[3]-BOUNDS_3DS[0], BOUNDS_3DS[4]-BOUNDS_3DS[1], BOUNDS_3DS[5]-BOUNDS_3DS[2])
-               # print max_axis
-               if max_axis < 1<<30: # Should never be false but just make sure.
-                       
-                       # Get a new scale factor if set as an option
-                       SCALE=1.0
-                       while (max_axis*SCALE) > IMPORT_CONSTRAIN_BOUNDS:
-                               SCALE/=10
-                       
-                       # SCALE Matrix
-                       SCALE_MAT= Blender.Mathutils.Matrix([SCALE,0,0,0],[0,SCALE,0,0],[0,0,SCALE,0],[0,0,0,1])
-                       
-                       for ob in importedObjects:
-                               ob.setMatrix(ob.matrixWorld*SCALE_MAT)
-                               
-               # Done constraining to bounds.
-       
-       # Select all new objects.
-       print 'finished importing: "%s" in %.4f sec.' % (filename, (Blender.sys.time()-time1))
-       file.close()
-       Blender.Window.WaitCursor(0)
-       
-
-DEBUG= False
-if __name__=='__main__' and not DEBUG:
-       if calcsize==None:
-               Blender.Draw.PupMenu('Error%t|a full python installation not found') 
-       else:
-               Blender.Window.FileSelector(load_3ds, 'Import 3DS', '*.3ds')
-
-# For testing compatibility
-#load_3ds('/metavr/convert/vehicle/truck_002/TruckTanker1.3DS', False)
-#load_3ds('/metavr/archive/convert/old/arranged_3ds_to_hpx-2/only-need-engine-trains/Engine2.3DS', False)
-'''
-
-else:
-       import os
-       # DEBUG ONLY
-       TIME= Blender.sys.time()
-       import os
-       print 'Searching for files'
-       os.system('find /metavr/ -iname "*.3ds" > /tmp/temp3ds_list')
-       # os.system('find /storage/ -iname "*.3ds" > /tmp/temp3ds_list')
-       print '...Done'
-       file= open('/tmp/temp3ds_list', 'r')
-       lines= file.readlines()
-       file.close()
-       # sort by filesize for faster testing
-       lines_size = [(os.path.getsize(f[:-1]), f[:-1]) for f in lines]
-       lines_size.sort()
-       lines = [f[1] for f in lines_size]
-       
-
-       def between(v,a,b):
-               if v <= max(a,b) and v >= min(a,b):
-                       return True             
-               return False
-               
-       for i, _3ds in enumerate(lines):
-               if between(i, 650,800):
-                       #_3ds= _3ds[:-1]
-                       print 'Importing', _3ds, '\nNUMBER', i, 'of', len(lines)
-                       _3ds_file= _3ds.split('/')[-1].split('\\')[-1]
-                       newScn= Blender.Scene.New(_3ds_file)
-                       newScn.makeCurrent()
-                       load_3ds(_3ds, False)
-
-       print 'TOTAL TIME: %.6f' % (Blender.sys.time() - TIME)
-
-'''
diff --git a/release/scripts/Axiscopy.py b/release/scripts/Axiscopy.py
deleted file mode 100644 (file)
index 6a31432..0000000
+++ /dev/null
@@ -1,125 +0,0 @@
-#!BPY
-
-""" Registration info for Blender menus: <- these words are ignored
-Name: 'Axis Orientation Copy'
-Blender: 242
-Group: 'Object'
-Tip: 'Copy local axis orientation of active object to all selected meshes (changes mesh data)'
-"""
-
-__author__ = "A Vanpoucke (xand)"
-__url__ = ("blenderartists.org", "www.blender.org",
-"French Blender support forum, http://www.zoo-logique.org/3D.Blender/newsportal/thread.php?group=3D.Blender")
-__version__ = "2 17/12/05"
-
-__bpydoc__ = """\
-This script copies the axis orientation -- X, Y and Z rotations -- of the
-active object to all selected meshes.
-
-It's useful to align the orientations of all meshes of a structure, a human
-skeleton, for example.
-
-Usage:
-
-Select all mesh objects that need to have their orientations changed
-(reminder: keep SHIFT pressed after the first, to add each new one to the
-selection), then select the object whose orientation will be copied from and
-finally run this script to update the angles.
-
-Notes:<br>
-    This script changes mesh data: the vertices are transformed.<br>
-       Before copying the orientation to each object, the script stores its
-transformation matrix. Then the angles are copied and after that the object's
-vertices are transformed "back" so that they still have the same positions as
-before.  In other words, the rotations are updated, but you won't notice that
-just from looking at the objects.<br>
-       Checking their X, Y and Z rotation values with "Transform Properties" in
-the 3D View's Object menu shows the angles are now the same of the active
-object. Or simply look at the transform manipulator handles in local transform
-orientation.
-"""
-
-
-# $Id$
-#
-#----------------------------------------------
-# A Vanpoucke (xand)
-#from the previous script realignaxis
-#----------------------------------------------
-# Communiquer les problemes et erreurs sur:
-#      http://www.zoo-logique.org/3D.Blender/newsportal/thread.php?group=3D.Blender
-# --------------------------------------------------------------------------
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# Copyright (C) 2003, 2004: A Vanpoucke
-#
-# 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 *****
-# --------------------------------------------------------------------------
-
-from Blender import *
-from Blender import Mathutils
-from Blender.Mathutils import *
-import BPyMessages
-
-def realusers(data):
-       users = data.users
-       if data.fakeUser: users -= 1
-       return users
-
-       
-
-def main():
-       
-       scn_obs= Scene.GetCurrent().objects
-       ob_act = scn_obs.active
-       scn_obs = scn_obs.context
-       
-       if not ob_act:
-               BPyMessages.Error_NoActive()
-       
-       obs = [(ob, ob.getData(mesh=1)) for ob in scn_obs if ob != ob_act]
-       
-       for ob, me in obs:
-               
-               if ob.type != 'Mesh':
-                       Draw.PupMenu("Error%t|Selection must be made up of mesh objects only")
-                       return
-               
-               if realusers(me) != 1:
-                       Draw.PupMenu("Error%t|Meshes must be single user")
-                       return
-       
-       if len(obs) < 1:
-               Draw.PupMenu("Error: you must select at least 2 objects")
-               return
-       
-       result = Draw.PupMenu("Copy axis orientation from: " + ob_act.name + " ?%t|OK")
-       if result == -1:
-               return
-       
-       for ob_target, me_target in obs:
-               if ob_act.rot != ob_target.rot:
-                       rot_target = ob_target.matrixWorld.rotationPart().toEuler().toMatrix()
-                       rot_source = ob_act.matrixWorld.rotationPart().toEuler().toMatrix()
-                       rot_source_inv = rot_source.copy().invert()
-                       tx_mat = rot_target * rot_source_inv
-                       tx_mat.resize4x4()
-                       me_target.transform(tx_mat)
-                       ob_target.rot=ob_act.rot
-
-if __name__ == '__main__':
-       main()
\ No newline at end of file
diff --git a/release/scripts/DirectX8Exporter.py b/release/scripts/DirectX8Exporter.py
deleted file mode 100644 (file)
index 8a0ecaf..0000000
+++ /dev/null
@@ -1,1196 +0,0 @@
-#!BPY
-
-"""
-# Name: 'DirectX (.x)...'
-# Blender: 242
-# Group: 'Export'
-# Tooltip: 'Export to DirectX text file format format for XNA Animation Component Library.'
-"""
-__author__ = "vertex color exporting feature is added by mnemoto (original:minahito (original:Arben (Ben) Omari))"
-__url__ = ("blender.org", "blenderartists.org", "Adjuster's site http://sunday-lab.blogspot.com/, Author's site http://www.omariben.too.it","Adjuster's site http://ex.homeunix.net/")
-__version__ = "3.1"
-
-__bpydoc__ = """\
-This script exports a Blender mesh with armature to DirectX 8's text file
-format.
-
-Notes:<br>
-    Check author's site or the elYsiun forum for a new beta version of the
-DX exporter.
-"""
-# DirectXExporter.py version 3.0
-# Copyright (C) 2006  Arben OMARI -- omariarben@everyday.com 
-#
-# 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.
-
-# This script export meshes created with Blender in DirectX8 file format
-# it exports meshes,armatures,materials,normals,texturecoords and animations
-
-# Grab the latest version here :www.omariben.too.it
-
-# [Notice]
-# This script is the custom version of Mr.Arben Omari's great work.
-# If you have a question about the adjusted part, visit http://sunday-lab.blogspot.com/.
-
-import Blender
-from Blender import Types, Object, NMesh, Material,Armature,Mesh
-from Blender.Mathutils import *
-from Blender import Draw, BGL
-from Blender.BGL import *
-try: import math
-except: math = None
-
-global mat_flip,index_list,space,bone_list,mat_dict
-global anim,flip_norm,swap_zy,flip_z,speed,ticks,no_light,recalc_norm,Bl_norm
-bone_list =[]
-index_list = []
-mat_dict = {}
-space = 0;flip_z = 1;anim=0;swap_yz=0;flip_norm=0;speed=0;ticks= 25
-Bl_norm = 1;recalc_norm = 0;no_light = 0
-
-toggle_val = 0
-toggle1_val = 0
-toggle2_val = 0
-toggle3_val = 1
-toggle4_val = 0
-toggle5_val = 1
-toggle6_val = 0
-toggle7_val = 0
-anim_tick = Draw.Create(25)
-
-#***********************************************
-# DirectX file spec only allows letters, digits, and 
-# underscore in Names.
-#***********************************************
-def make_legal_name(starting_name):
-    new_name = starting_name.replace('.','_')
-    new_name = new_name.replace(' ','_')
-    if new_name[0].isdigit():
-        new_name = '_' + new_name
-    return new_name
-
-#***********************************************
-# MAIN
-#***********************************************
-
-def my_callback(filename):
-       if filename.find('.x', -2) <= 0: filename += '.x' 
-       xexport = xExport(filename)
-       xexport.SelectObjs()
-
-def my_callback_sel(filename):
-       if filename.find('.x', -2) <= 0: filename += '.x' 
-       xexport = xExport(filename)
-       xexport.exportSelMesh()
-def event(evt, val):   
-               if evt == Draw.ESCKEY:
-                       Draw.Exit()                
-                       return
-
-def button_event(evt): 
-       global toggle_val,toggle1_val,toggle2_val,toggle3_val,toggle4_val,toggle5_val,toggle6_val,toggle7_val
-       global flip_z,swap_yz,flip_norm,anim,ticks,speed,no_light,Bl_norm,recalc_norm
-       arg = __script__['arg']
-       if evt == 1:
-               toggle_val = 1 - toggle_val
-               anim = toggle_val
-               Draw.Redraw(1)
-       if evt == 2:
-               toggle1_val = 1 - toggle1_val
-               flip_norm = toggle1_val
-               Draw.Redraw(1)
-       if evt == 3:
-               toggle2_val = 1 - toggle2_val
-               swap_yz = toggle2_val
-               Draw.Redraw(1)
-       if evt == 4:
-               toggle3_val = 1 - toggle3_val
-               flip_z = toggle3_val
-               Draw.Redraw(1)
-       if evt == 5:
-               toggle4_val = 1 - toggle4_val
-               speed = toggle4_val
-               Draw.Redraw(1)
-       if evt == 10:
-               toggle5_val = 1 - toggle5_val
-               if toggle5_val==1:
-                       toggle6_val = 0
-                       toggle7_val = 0
-               else :
-                       toggle6_val = 1
-                       toggle7_val = 1
-               no_light = toggle7_val
-               recalc_norm = toggle6_val
-               Bl_norm = toggle5_val
-               Draw.Redraw(1)
-       if evt == 11:
-               toggle6_val = 1 - toggle6_val
-               if toggle6_val==1:
-                       toggle5_val = 0
-                       toggle7_val = 0
-               else :
-                       toggle5_val = 1
-                       toggle7_val = 1
-               no_light = toggle7_val
-               recalc_norm = toggle6_val
-               Bl_norm = toggle5_val
-               Draw.Redraw(1)
-       if evt == 12:
-               toggle7_val = 1 - toggle7_val
-               if toggle7_val==1:
-                       toggle6_val = 0
-                       toggle5_val = 0
-               else :
-                       toggle6_val = 1
-                       toggle5_val = 1
-               no_light = toggle7_val
-               recalc_norm = toggle6_val
-               Bl_norm = toggle5_val
-               Draw.Redraw(1)
-       if evt == 6:
-               ticks = anim_tick.val
-       if evt == 7:
-               fname = Blender.sys.makename(ext = ".x")
-               Blender.Window.FileSelector(my_callback, "Export DirectX", fname)
-       if evt == 8:
-               fname = Blender.sys.makename(ext = ".x")
-               Blender.Window.FileSelector(my_callback_sel, "Export DirectX", fname)
-       if evt == 9:
-               Draw.Exit()
-               
-       
-def draw():
-               global animsg,flipmsg,swapmsg,anim_tick
-               global flip_z,swap_yz,flip_norm,anim,ticks,speed,recalc_norm,Bl_norm,no_light
-               glClearColor(0.55,0.6,0.6,1)
-               glClear(BGL.GL_COLOR_BUFFER_BIT)
-               #external box
-               glColor3f(0.2,0.3,0.3)
-               rect(10,402,300,382)
-               #--
-               #glColor3f(0.3,0.4,0.4)
-               #rect(11,399,298,398)
-               #--
-               glColor3f(0.5,0.75,0.65)
-               rect(14,398,292,30)
-               #--
-               glColor3f(0.5,0.75,0.65)
-               rect(14,366,292,160)
-               #--
-               glColor3f(0.5,0.75,0.65)
-               rect(14,202,292,60)
-               #--
-               glColor3f(0.5,0.75,0.65)
-               rect(14,138,292,40)
-               #--
-               glColor3f(0.5,0.75,0.65)
-               rect(14,94,292,70)
-               
-               glColor3f(0.8,.8,0.6)
-               glRasterPos2i(20, 380)
-               Draw.Text("DirectX Exporter ",'large')
-               Draw.Text("(for Blender 2.41)", 'small')
-               #-------Aniamtion toggle---------------------------------------------
-               Draw.Toggle("Anim", 1, 20, 330, 55, 20, toggle_val,"export animations")
-               if toggle_val :
-                       anim = 1
-                       animsg = "animation will be exported"
-               else:
-                       anim = 0
-                       animsg = "animation will be not exported"
-               glRasterPos2i(100,335)
-               Draw.Text(animsg)
-               #---Flip normals toggle-----------------------------------------------
-               Draw.Toggle("Flip norm", 2, 20, 300, 55, 20, toggle1_val,"invert normals")
-               if toggle1_val :
-                       flip_norm = 1
-                       flipmsg = "flipped normals"
-               else:
-                       flip_norm = 0
-                       flipmsg = "not flipped normals"
-               glRasterPos2i(100,305)
-               Draw.Text(flipmsg)
-               #------Swap yz toggle----------------------------------------------------------------
-               Draw.Toggle("Swap zy", 3, 20, 270, 55, 20, toggle2_val,"swap z,y axis(y up)")
-               if toggle2_val :
-                       swap_yz = 1
-                       swapmsg = "Y-axis up"
-               else:
-                       swap_yz = 0
-                       swapmsg = "Z-axis up"
-               glRasterPos2i(100,275)
-               Draw.Text(swapmsg)
-               #------Flip z toggle----------------------------------------------------------------
-               Draw.Toggle("Flip z", 4, 20, 240, 55, 20, toggle3_val,"flip z axis")
-               if toggle3_val :
-                       flip_z = 1
-                       zmsg = "left handed system"
-               else:
-                       flip_z = 0
-                       zmsg = "right handed system"
-               glRasterPos2i(100,245)
-               Draw.Text(zmsg)
-               #------Speed toggle----------------------------------------------------------------
-               Draw.Toggle("Speed", 5, 20, 210, 55, 20, toggle4_val,"Animation speed")
-               if toggle4_val :
-                       speed = 1
-                       spedmsg = "set speed"
-                       anim_tick = Draw.Number("", 6,200, 210, 85, 20, anim_tick.val,1,100000,"ticks per second")
-               else:
-                       speed = 0
-                       spedmsg = ""
-               glRasterPos2i(100,215)
-               Draw.Text(spedmsg)
-               #------Blender Normals toggle----------------------------------------------------------------
-               Draw.Toggle("Bl.normals", 10, 20, 105, 75, 25, toggle5_val,"export normals as in Blender")
-               if toggle5_val :
-                       Bl_norm = 1
-               #------Recalculute Normals toggle----------------------------------------------------------------
-               Draw.Toggle("recalc.no", 11, 120, 105, 75, 25, toggle6_val,"export recalculated normals")
-               if toggle6_val :
-                       recalc_norm = 1
-               #------Recalculute Normals toggle----------------------------------------------------------------
-               Draw.Toggle("no smooth", 12, 220, 105, 75, 25, toggle7_val,"every vertex has the face normal,no smoothing")
-               if toggle7_val :
-                       no_light = 1
-               #------Draw Button export----------------------------------------------------------------
-               exp_butt = Draw.Button("Export All",7,20, 155, 75, 30, "export all the scene objects")
-               sel_butt = Draw.Button("Export Sel",8,120, 155, 75, 30, "export the selected object")
-               exit_butt = Draw.Button("Exit",9,220, 155, 75, 30, "exit")
-               glRasterPos2i(20,75)
-               Draw.Text("(C) 2006  Arben OMARI ")
-               glRasterPos2i(20,55)
-               Draw.Text("http://www.omariben.too.it")
-               glRasterPos2i(20,35)
-               Draw.Text("aromar@tin.it")
-               
-def rect(x,y,width,height):
-               glBegin(GL_LINE_LOOP)
-               glVertex2i(x,y)
-               glVertex2i(x+width,y)
-               glVertex2i(x+width,y-height)
-               glVertex2i(x,y-height)
-               glEnd()
-               
-def rectFill(x,y,width,height):
-               glBegin(GL_POLYGON)
-               glVertex2i(x,y)
-               glVertex2i(x+width,y)
-               glVertex2i(x+width,y-height)
-               glVertex2i(x,y-height)
-               glEnd()
-               
-               
-               
-Draw.Register(draw, event, button_event)
-
-
-#***********************************************
-#***********************************************
-#                EXPORTER
-#***********************************************
-#***********************************************
-
-class xExport:
-       def __init__(self, filename):
-               self.file = open(filename, "w")
-
-#*********************************************************************************************************************************************
-       #***********************************************
-       #Select Scene objects
-       #***********************************************
-       def analyzeScene(self):
-                       parent_list = []
-                       for obj in Blender.Scene.GetCurrent().objects:
-                               if obj.type in ('Mesh', 'Armature', 'Empty'):
-                                       if obj.parent == None :
-                                               parent_list.append(obj)
-                                               
-                       return parent_list
-               
-       def getChildren(self,obj):      
-               obs = Blender.Scene.GetCurrent().objects
-               return [ ob for ob in obs if ob.parent == obj ]
-       
-       def getArmChildren(self,obj):           
-               for ob in Blender.Scene.GetCurrent().objects: #Object.Get():
-                       if ob.parent == obj :
-                               return ob
-       
-       def getLocMat(self, obj):
-               pare = obj.parent
-               mat = obj.matrixWorld
-               mat_id = Matrix([1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1])
-               if pare:
-                       mat_p = pare.matrixWorld
-                       mat_c = Matrix(mat_p)
-                       mat_c.invert()
-                       mat_f = mat * mat_c
-               else :
-                       mat_id.invert()
-                       mat_f = mat * mat_id
-               return mat_f
-       
-       def writeObjFrames(self,obj):
-               global space,chld_obj,ch_list
-               mesh = obj.getData()
-               if obj.type == "Empty" :
-                       mat = self.getLocMat(obj)
-                       mat_c = Matrix(mat)
-                       self.writeArmFrames(mat_c, make_legal_name(obj.name))
-               if type(mesh) == Types.ArmatureType :
-                       Child_obj = self.getArmChildren(obj)
-                       chld_obj = obj
-                       ch_list.append(Child_obj)
-                       self.writeRootBone(obj, Child_obj)      
-               if obj.type == 'Mesh' and obj not in ch_list:
-                       self.exportMesh(obj)
-                       
-                       
-       def writeChildObj(self,obj):
-               global space,ch_list
-               space += 1
-               if obj :
-                       for ob in obj:
-                               if ob not in ch_list:
-                                       self.writeObjFrames(ob)
-                                       ch_list.append(ob)
-                                       ch_ob = self.getChildren(ob)
-                                       self.writeChildObj(ch_ob)
-                                       self.closeBrackets()
-                                       self.file.write(" // End of the Object %s \n" % (ob.name))
-                                       
-                                       
-       def writeRootFrame(self):
-               global flip_z,swap_yz,speed
-               if speed:
-                       self.writeAnimTicks()
-               if flip_z:
-                       mat_flip = Matrix([1, 0, 0, 0], [0, 1, 0, 0], [0, 0, -1, 0], [0, 0, 0, 1])
-               else :
-                       mat_flip = Matrix([1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1])
-               if swap_yz :
-                       mat_rot = RotationMatrix(-90, 4, 'x')
-                       mat_flip = mat_rot * mat_flip
-               self.writeArmFrames(mat_flip, "RootFrame")              
-                       
-       ##################################################################      
-       def SelectObjs(self):
-               global space,chld_obj,ch_list,flip_z,swap_yz,speed
-               print "exporting..."
-               self.writeHeader()
-               self.writeRootFrame()
-               obj_list = self.analyzeScene()
-               space += 1
-               ch_list = []
-               for obj in obj_list:
-                       self.writeObjFrames(obj)
-                       ch_l = self.getChildren(obj)
-                       for ch in ch_l:
-                       
-                       
-                               if ch and ch.type == "Armature":
-                                       ch_list.append(ch)
-                                       self.writeObjFrames(ch)
-                               else :  
-                                       self.writeChildObj(ch_l)
-                       if obj.type != "Armature":
-                               self.file.write("  }  // SI End of the Object %s \n" % (obj.name))      
-                               
-                               
-                               
-               self.file.write("}  // End of the Root Frame\n")                
-               if anim :
-                       self.file.write("AnimationSet AnimationSet0 {\n")
-                       for obj in Blender.Scene.GetCurrent().objects:
-                               if obj.type in ('Mesh', 'Empty'):
-                                       ip_list = obj.ipo
-                                       if ip_list != None :
-                                               self.writeAnimationObj(obj)
-                               elif obj.type == 'Armature':
-                                       act_list = obj.getAction()
-                                       if act_list != None :
-                                               self.writeAnimation(obj)
-                                       #ip_list = obj.ipo
-                                       #if ip_list != None :
-                                       #       self.writeAnimationObj(obj)
-
-                       self.file.write("} // End of Animation Set\n")
-               self.writeEnd()
-               #######################################################
-               
-                               
-       def writeAnimTicks(self):
-               global ticks
-               self.file.write("AnimTicksPerSecond {\n")
-               self.file.write("%d; \n" % (ticks))
-               self.file.write("}\n")
-       
-       #***********************************************
-       #Export Mesh without Armature
-       #***********************************************
-       def exportMesh(self, obj):
-               tex = []
-               mesh = obj.getData()
-               self.writeTextures(obj, tex)            
-               self.writeMeshcoordArm(obj, arm_ob = None)
-               self.writeMeshMaterialList(obj, mesh, tex)
-               self.writeMeshNormals(obj, mesh)
-               self.writeMeshTextureCoords(obj, mesh)
-               self.writeMeshVertexColors(obj, mesh)
-               self.file.write("  }  // End of the Mesh %s \n" % (obj.name))
-               
-                                       
-       #***********************************************
-       #Export the Selected Mesh
-       #***********************************************
-       def exportSelMesh(self):
-               print "exporting ..."
-               self.writeHeader()
-               self.writeRootFrame()
-               tex = []
-               objs = Object.GetSelected()
-               for obj in objs:
-                       if obj.type == 'Mesh':
-                               mesh = obj.data
-                               self.writeTextures(obj, tex)            
-                               self.writeMeshcoordArm(obj, arm_ob = None)
-                               self.writeMeshMaterialList(obj, mesh, tex)
-                               self.writeMeshNormals(obj, mesh)
-                               self.writeMeshTextureCoords(obj, mesh)
-                               self.writeMeshVertexColors(obj, mesh)
-                               self.file.write(" }\n")
-                               self.file.write("}\n")
-                               ind = objs.index(obj)
-                               if ind == len(objs)-1:
-                                       self.file.write("}\n")
-                               ip_list = obj.ipo
-                               if ip_list != None :
-                                       self.file.write("AnimationSet AnimationSet0 {\n")
-                                       self.writeAnimationObj(obj)
-                                       self.file.write("}\n")
-                       else :
-                               print "The selected object is not a mesh"
-               print "...finished"
-       #***********************************************
-       #Export Mesh with Armature
-       #***********************************************
-       def exportMeshArm(self,arm,arm_ob,ch_obj):
-               tex = []
-               mesh = ch_obj.getData()
-               self.writeTextures(ch_obj, tex)         
-               self.writeMeshcoordArm(ch_obj ,arm_ob)
-               self.writeMeshMaterialList(ch_obj, mesh, tex)
-               self.writeMeshNormals(ch_obj, mesh)
-               self.writeMeshTextureCoords(ch_obj, mesh)
-               self.writeSkinWeights(arm,mesh)
-               #self.file.write("  }  // End of the Frame %s \n" % (ch_obj.name))
-               self.file.write("  }  // End of the Object %s \n" % (ch_obj.name))
-                               
-       #***********************************************
-       #Export Root Bone
-       #***********************************************
-       def writeRootBone(self, chld_obj,  child_obj):
-               global space,root_bon
-               arms = chld_obj.getData()
-               mat_arm = self.getLocMat(chld_obj)
-               for bon in arms.bones.values():
-                       if bon.hasParent():
-                               pass
-                       else:
-                               root_bon = bon
-               space += 1
-               mat_r = self.writeAnimCombineMatrix(root_bon,1)
-               self.writeArmFrames(mat_r, make_legal_name(root_bon.name))
-               
-               bon_c = root_bon.children
-               self.writeChildren(bon_c)
-               self.file.write("  }  // End of the Bone %s \n" % (root_bon.name))      
-               self.exportMeshArm(arms, chld_obj ,child_obj)
-                       
-       #***********************************************
-       #Create Children structure
-       #***********************************************
-       def writeBon(self,bon):
-               global space
-               mat_r = self.writeAnimCombineMatrix(bon,1)
-               self.writeArmFrames(mat_r, make_legal_name(bon.name))
-               
-       
-       def writeChildren(self,bon_c):
-               global space,bone_list
-               space += 1
-               if bon_c:
-                       for bo in bon_c:
-                               if bo.name not in bone_list:
-                                       self.writeBon(bo)
-                                       bone_list.append(bo.name)
-                                       bo_c = bo.children 
-                                       self.writeChildren(bo_c)
-                                       self.closeBrackets()
-                               
-                               
-                                       
-       def closeBrackets(self):
-               global space
-               space = space-1
-               tab = "  "
-               self.file.write("%s" % (tab * space))
-               self.file.write("}\n")
-               
-               
-                       
-       #***********************************************
-       #Offset Matrix
-       #***********************************************
-       def writeMatrixOffset(self,bon):
-               global  chld_obj
-               Blender.Set('curframe', 1)
-               pose = chld_obj.getPose()
-               pos_b = pose.bones[bon.name]
-               mat_b = pos_b.poseMatrix
-               mat_c = Matrix(mat_b)
-               mat_c.invert()
-               return mat_c
-
-       
-       #***********************************************
-       #Combine Matrix
-       #***********************************************
-       def writeCombineMatrix(self,bon):
-               global  chld_obj
-               
-               Blender.Set('curframe', 1)
-               pose = chld_obj.getPose()
-               pos_b = pose.bones[bon.name]
-               mat_b = pos_b.poseMatrix
-               if bon.hasParent():
-                       pare = bon.parent
-                       pos_p = pose.bones[pare.name]
-                       mat_p = pos_p.poseMatrix
-                       
-               else:
-                       mat_p = Matrix([1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1])
-               mat_c = Matrix(mat_p)
-               mat_c.invert()
-               mat_f = mat_b * mat_c
-               
-               return mat_f
-       #***********************************************
-       #Combine Matrix
-       #***********************************************
-       def writeAnimCombineMatrix(self,bon,fre):
-               global  chld_obj
-               Blender.Set('curframe', fre)
-               pose = chld_obj.getPose()
-               pos_b = pose.bones[bon.name]
-               mat_b = pos_b.poseMatrix
-               if bon.hasParent():
-                       pare = bon.parent
-                       pos_p = pose.bones[pare.name]
-                       mat_p = pos_p.poseMatrix
-                       
-               else:
-                       mat_p = Matrix([1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1])
-               mat_c = Matrix(mat_p)
-               mat_c.invert()
-               mat_f = mat_b * mat_c
-               
-               return mat_f
-
-
-#*********************************************************************************************************************************************
-       #***********************************************
-       #Write SkinWeights
-       #***********************************************
-       def writeSkinWeights(self, arm, mesh):
-               global index_list
-               v_dict = {}
-               Blender.Set('curframe',1)
-               self.file.write("  XSkinMeshHeader {\n")
-               max_infl = 0
-               for bo in arm.bones.values() :
-                       name = bo.name
-                       try :
-                               vertx_list = mesh.getVertsFromGroup(name,1)
-                               for inde in vertx_list :
-                                       vert_infl = mesh.getVertexInfluences(inde[0])
-                                       ln_infl = len(vert_infl)
-                                       if ln_infl > max_infl :
-                                               max_infl = ln_infl
-                               
-                       except:
-                               pass
-               
-               self.file.write("    %d; \n" % (max_infl))
-               self.file.write("    %d; \n" % (max_infl * 3))
-               self.file.write("    %d; \n" % (len(arm.bones.values())))
-               self.file.write("  }\n")
-               
-               for bo in arm.bones.values() :
-                       bo_list = []
-                       weight_list = []
-                       name = bo.name 
-                       f_name = make_legal_name(name)
-                       try :
-                               vert_list = mesh.getVertsFromGroup(name,1)
-                               le = 0
-                               for indx in vert_list:
-                                       ver_infl = mesh.getVertexInfluences(indx[0])
-                                       infl = 0.0
-                                       if len(ver_infl) != 0:
-                                               sum = 0.0
-                                               for bone_n, weight in ver_infl:
-                                                       if bone_n == name:
-                                                               infl = weight
-                                                       sum += weight
-                                               infl /= sum
-                                       
-                                       i = -1
-                                       for el in index_list :
-                                               i += 1
-                                               if el == indx[0] :
-                                                       le +=1
-                                                       bo_list.append(i)
-                                                       weight_list.append(infl)
-
-
-                               self.file.write("  SkinWeights {\n")
-                               self.file.write('    "%s"; \n' % (f_name))
-                               self.file.write('     %d; \n' % (le))
-                               count = 0
-                               for ind in bo_list :
-                                       count += 1
-                                       if count == len(bo_list):
-                                               self.file.write("    %d; \n" % (ind))
-                                       else :
-                                               self.file.write("    %d, \n" % (ind))
-                               cou = 0
-                               for wegh in weight_list :
-                                       cou += 1
-                                       
-                                       if cou == len(weight_list):
-                                               self.file.write("    %f; \n" % (round(wegh,6)))
-                                       else :
-                                               self.file.write("    %f, \n" % (round(wegh,6)))
-
-                       
-                               matx = self.writeMatrixOffset(bo)
-                               self.writeOffsFrames(matx, name)
-                       except :
-                               pass
-               self.file.write("  } // End of XSkinMeshHeader\n")
-               
-
-       #***********************************************
-       # Write Matrices
-       #***********************************************
-       def writeArmFrames(self, matx, name):
-               global space
-               tab = "  "
-               self.file.write("%s" % (tab * space))
-               self.file.write("Frame ")  
-               self.file.write("%s {\n\n" % (name))
-               self.file.write("%s" % (tab * space))
-               self.file.write("  FrameTransformMatrix {\n")
-               self.writeFrame(matx)
-       
-       #***********************************************
-       # Write Frames
-       #***********************************************
-       def writeOffsFrames(self, matx, name):
-               space = 1
-               self.writeFrame(matx)
-       
-        #***********************************************
-       # Write Frames
-       #***********************************************
-       def writeFrame(self, matx):
-               tab = "  "
-               self.file.write("%s" % (tab * space))
-               self.file.write("    %f,%f,%f,%f,\n" %
-                                                       (round(matx[0][0],4),round(matx[0][1],4),round(matx[0][2],4),round(matx[0][3],4)))
-               self.file.write("%s" % (tab * space))
-               self.file.write("    %f,%f,%f,%f,\n" %
-                                                       (round(matx[1][0],4),round(matx[1][1],4),round(matx[1][2],4),round(matx[1][3],4)))
-               self.file.write("%s" % (tab * space))   
-               self.file.write("    %f,%f,%f,%f,\n" %
-                                                       (round(matx[2][0],4),round(matx[2][1],4),round(matx[2][2],4),round(matx[2][3],4)))
-               self.file.write("%s" % (tab * space))
-               self.file.write("    %f,%f,%f,%f;;\n" %
-                                                       (round(matx[3][0],4),round(matx[3][1],4),round(matx[3][2],4),round(matx[3][3],4)))
-               self.file.write("%s" % (tab * space))
-               self.file.write("  }\n")
-#*********************************************************************************************************************************************
-       
-       #***********************************************
-       #HEADER
-       #***********************************************  
-       def writeHeader(self):
-               self.file.write("xof 0303txt 0032\n\n\n")
-               self.file.write("template VertexDuplicationIndices { \n\
- <b8d65549-d7c9-4995-89cf-53a9a8b031e3>\n\
- DWORD nIndices;\n\
- DWORD nOriginalVertices;\n\
- array DWORD indices[nIndices];\n\
-}\n\
-template XSkinMeshHeader {\n\
- <3cf169ce-ff7c-44ab-93c0-f78f62d172e2>\n\
- WORD nMaxSkinWeightsPerVertex;\n\
- WORD nMaxSkinWeightsPerFace;\n\
- WORD nBones;\n\
-}\n\
-template SkinWeights {\n\
- <6f0d123b-bad2-4167-a0d0-80224f25fabb>\n\
- STRING transformNodeName;\n\
- DWORD nWeights;\n\
- array DWORD vertexIndices[nWeights];\n\
- array float weights[nWeights];\n\
- Matrix4x4 matrixOffset;\n\
-}\n\n")
-               
-       #***********************************************
-       #CLOSE FILE
-       #***********************************************
-       def writeEnd(self):
-               self.file.close()
-               print "... finished"
-
-
-       #***********************************************
-       #EXPORT TEXTURES
-       #***********************************************
-       def writeTextures(self,name, tex):
-               mesh = name.data
-               for face in mesh.faces:
-                       if face.image and face.image.name not in tex:
-                               tex.append(face.image.name)
-                               
-
-
-       #***********************************************
-       #EXPORT MESH DATA with Armature
-       #***********************************************
-       def writeMeshcoordArm(self, obj ,arm_ob):
-               global index_list,flip_z
-               #TransformMatrix
-               mat = self.getLocMat(obj)
-               self.writeArmFrames(mat, make_legal_name(obj.name))
-               mesh = NMesh.GetRawFromObject(obj.name)
-               self.file.write("Mesh {\n")    
-               numface=len(mesh.faces)
-               #VERTICES NUMBER
-               numvert = 0
-               for face in mesh.faces:
-                       numvert = numvert + len(face.v)
-               self.file.write("%d;\n" % (numvert))
-               if numvert == 0:
-                       print "Mesh named",mesh.name,"has no vertices.Problems may occur using the .x file"
-               #VERTICES COORDINATES
-               counter = 0
-               for face in mesh.faces:
-                       counter += 1
-                       for n in range(len(face.v)):
-                               index_list.append(face.v[n].index)
-                               vec_vert = Vector([(face.v[n].co[0]), face.v[n].co[1], face.v[n].co[2], 1])
-                               if arm_ob :
-                                       f_vec_vert = vec_vert * mat
-                               else :
-                                       f_vec_vert = vec_vert
-                               self.file.write("%f; %f; %f;" % (round(f_vec_vert[0],4), round(f_vec_vert[1],4), round(f_vec_vert[2],4)))
-                               if counter == numface :
-                                       if n == len(face.v)-1 :
-                                               self.file.write(";\n")
-                                       else :
-                                               self.file.write(",\n")
-                               else :
-                                       self.file.write(",\n")
-               if flip_z:
-                       a3 = 0;b3 = 2;c3 = 1
-                       a4 = 0;b4 = 3;c4 = 2;d4 = 1
-               else:
-                       a3 = 0;b3 = 1;c3 = 2
-                       a4 = 0;b4 = 1;c4 = 2;d4 = 3
-
-               #FACES NUMBER 
-               self.file.write("%s;\n" % (numface))  
-               coun,counter = 0, 0
-               for face in mesh.faces :
-                       coun += 1
-                       separator = ','
-                       if coun == numface:
-                           separator = ';'
-                       if len(face.v) == 3:
-                               self.file.write("3; %d, %d, %d;%c\n" % (counter + a3, counter + b3, counter + c3, separator))
-                               counter += 3
-                       elif len(face.v) == 4:
-                               self.file.write("4; %d, %d, %d, %d;%c\n" % (counter + a4, counter + b4, counter + c4, counter + d4, separator))
-                               counter += 4
-                       elif len(face.v) < 3:
-                               print "WARNING:the mesh has faces with less then 3 vertices"
-                               print "        It my be not exported correctly."
-
-       
-       #***********************************************
-       #MESH MATERIAL LIST
-       #***********************************************
-       def writeMeshMaterialList(self, obj, mesh, tex):
-               self.file.write("  MeshMaterialList {\n")
-               #HOW MANY MATERIALS ARE USED
-               count = 0
-               for mat in mesh.getMaterials():
-                       count+=1
-               self.file.write("    %d;\n" % (len(tex) + count))
-               #HOW MANY FACES IT HAS
-               numfaces=len(mesh.faces)
-               self.file.write("    %d;\n" % (numfaces))
-               ##MATERIALS INDEX FOR EVERY FACE
-               counter = 0
-               for face in mesh.faces :
-                       counter += 1
-                       mater = face.materialIndex
-                       if counter == numfaces:
-                               if face.image and face.image.name in tex :
-                                       self.file.write("    %d;;\n" % (tex.index(face.image.name) + count))
-                               else :
-                                       self.file.write("    %d;;\n" % (mater))
-                       else :
-                               if face.image and face.image.name in tex :
-                                       self.file.write("    %d,\n" % (tex.index(face.image.name) + count))
-                               else :
-                                       self.file.write("    %d,\n" % (mater))
-                       
-               ##MATERIAL NAME
-               for mat in mesh.getMaterials():
-                       self.file.write("  Material")
-                       self.file.write(" %s "% (make_legal_name(mat.name)))
-                       self.file.write("{\n")
-                       self.file.write("    %f; %f; %f;" % (mat.R, mat.G, mat.B))
-                       self.file.write("%s;;\n" % (mat.alpha))
-                       self.file.write("    %f;\n" % (mat.spec))
-                       self.file.write("    %f; %f; %f;;\n" % (mat.specR, mat.specG, mat.specB))
-                       self.file.write("    0.0; 0.0; 0.0;;\n")
-                       self.file.write("  }  //End of Material\n") 
-               
-               for mat in tex:
-                       self.file.write("  Material Mat")
-                       self.file.write("%s "% (len(tex)))
-                       self.file.write("{\n")
-                       self.file.write("    1.0; 1.0; 1.0; 1.0;;\n")
-                       self.file.write("    1.0;\n")
-                       self.file.write("    1.0; 1.0; 1.0;;\n")
-                       self.file.write("    0.0; 0.0; 0.0;;\n")
-                       self.file.write("  TextureFilename {")
-                       self.file.write('    "%s";'% (mat))
-                       self.file.write("  }\n")
-                       self.file.write("  }  // End of Material\n")
-               self.file.write("    }  //End of MeshMaterialList\n")
-
-       #***********************************************
-       #MESH NORMALS
-       #***********************************************
-       def writeMeshNormals(self,name,mesh):
-               global flip_norm,flip_z,no_light,recalc_norm,Bl_norm
-               
-               self.file.write("  MeshNormals {\n")
-               #VERTICES NUMBER
-               numvert = 0
-               for face in mesh.faces:
-                       numvert = numvert + len(face.v)
-               self.file.write("%d;\n" % (numvert))
-               numfaces=len(mesh.faces)
-               if flip_norm :
-                       fl = -1
-               else :
-                       fl = 1
-               #VERTICES NORMAL
-               if Bl_norm:
-                       self.writeBlenderNormals(mesh,fl)
-               if recalc_norm:
-                       self.writeRecalcNormals(mesh,fl)        
-               if no_light:
-                       self.writeNoSmothing(mesh,fl)
-                                               
-               
-               
-               if flip_z:
-                       a3 = 0;b3 = 2;c3 = 1
-                       a4 = 0;b4 = 3;c4 = 2;d4 = 1
-               else:
-                       a3 = 0;b3 = 1;c3 = 2
-                       a4 = 0;b4 = 1;c4 = 2;d4 = 3
-
-               #FACES NUMBER 
-               self.file.write("%s;\n" % (numfaces))  
-               coun,counter = 0, 0
-               for face in mesh.faces :
-                       coun += 1
-                       if coun == numfaces:
-                               if len(face.v) == 3:
-                                       self.file.write("3; %d, %d, %d;;\n" % (counter + a3, counter + b3, counter + c3))
-                                       counter += 3
-                               else :
-                                       self.file.write("4; %d, %d, %d, %d;;\n" % (counter + a4, counter + b4, counter + c4, counter + d4))
-                                       counter += 4
-                       else:
-                               
-                               if len(face.v) == 3:
-                                       self.file.write("3; %d, %d, %d;,\n" % (counter + a3, counter + b3, counter + c3))
-                                       counter += 3
-                               else :
-                                       self.file.write("4; %d, %d, %d, %d;,\n" % (counter + a4, counter + b4, counter + c4, counter + d4))
-                                       counter += 4
-               self.file.write("}  //End of MeshNormals\n")
-               
-       def writeBlenderNormals(self,mesh,fl):
-                       numfaces=len(mesh.faces)
-                       #VERTICES NORMAL
-                       counter = 0
-                       for face in mesh.faces:
-                               counter += 1  
-                               for n in range(len(face.v)):
-                                       self.file.write("    %f; %f; %f;" % (
-                                                                       (round(face.v[n].no[0],6)*fl),(round(face.v[n].no[1],6)*fl),(round(face.v[n].no[2],6)*fl)))
-                                       if counter == numfaces :
-                                               if n == len(face.v)-1 :
-                                                       self.file.write(";\n")
-                                               else :
-                                                       self.file.write(",\n")
-                                       else :
-                                               self.file.write(",\n")
-                                               
-       def writeRecalcNormals(self,mesh,fl):
-               numfaces=len(mesh.faces)
-               normal_list = {}
-               idx = 0
-               for vertex in mesh.verts:
-                       v_norm = Vector([0, 0, 0])
-                       normal_list[idx] = v_norm
-                       idx += 1
-                       for face in mesh.faces:
-                               for verts in face.v:
-                                       if verts.index == vertex.index :
-                                                       v_norm[0] += face.no[0]
-                                                       v_norm[1] += face.no[1]
-                                                       v_norm[2] += face.no[2]
-                       
-                       v_norm.normalize()
-                                               
-               counter = 0
-               for face in mesh.faces:
-                               counter += 1 
-                               n = 0 
-                               for vert in face.v:
-                                       n += 1
-                                       norm = normal_list[vert.index]
-                                       
-                                       self.file.write("    %f; %f; %f;" % (
-                                                                       (round(norm[0],6)*fl),(round(norm[1],6)*fl),(round(norm[2],6)*fl)))             
-                                       if counter == numfaces :
-                                               if n == len(face.v) :
-                                                       self.file.write(";\n")
-                                               else :
-                                                       self.file.write(",\n")
-                                       else :
-                                               self.file.write(",\n")
-                                               
-       def writeNoSmothing(self,mesh,fl):
-               numfaces=len(mesh.faces)
-               counter = 0
-               for face in mesh.faces:
-                               counter += 1 
-                               n = 0 
-                               for n in range(len(face.v)):
-                                       n += 1
-                                       self.file.write("    %f; %f; %f;" % (
-                                                                       (round(face.no[0],6)*fl),(round(face.no[1],6)*fl),(round(face.no[2],6)*fl)))
-                                       
-                                                       
-                                       if counter == numfaces :
-                                               if n == len(face.v) :
-                                                       self.file.write(";\n")
-                                               else :
-                                                       self.file.write(",\n")
-                                       else :
-                                               self.file.write(",\n")
-       #***********************************************
-       #MESH TEXTURE COORDS
-       #***********************************************
-       def writeMeshTextureCoords(self, name, mesh):
-               if mesh.hasFaceUV():
-                       self.file.write("MeshTextureCoords {\n")
-                       #VERTICES NUMBER
-                       numvert = 0
-                       for face in mesh.faces:
-                               numvert += len(face.v)
-                       self.file.write("%d;\n" % (numvert))
-                       #UV COORDS
-                       numfaces = len(mesh.faces)
-                       counter = -1
-                       co = 0
-                       for face in mesh.faces:
-                               counter += 1
-                               co += 1
-                               for n in range(len(face.v)):
-                                       self.file.write("%f;%f;" % (mesh.faces[counter].uv[n][0], -mesh.faces[counter].uv[n][1]))
-                                       if co == numfaces :
-                                               if n == len(face.v) - 1 :
-                                                       self.file.write(";\n")
-                                               else :
-                                                       self.file.write(",\n")
-                                       else :
-                                               self.file.write(",\n")
-
-                       self.file.write("}  //End of MeshTextureCoords\n")
-
-       #***********************************************
-       #MESH VORTEX COLORS
-       #***********************************************
-       def writeMeshVertexColors(self, name, mesh):
-               if mesh.hasVertexColours():
-                       self.file.write("MeshVertexColors {\n")
-                       #VERTICES NUMBER
-                       numvert = reduce( lambda i,f: len(f)+i, mesh.faces, 0)
-                       self.file.write("%d;\n" % (numvert))
-                       #VERTEX COLORS
-                       
-                       vcounter =0
-                       for f in mesh.faces:
-                               col = f.col
-                               for i,c in enumerate(col):
-                                       # Note vcol alpha has no meaning
-                                       self.file.write("%d;%f;%f;%f;%f;" % (vcounter,c.r/255.0, c.g/255.0, c.b/255.0, 1.0)) # c.a/255.0))
-                                       vcounter+=1
-                                       if vcounter == numvert :
-                                               self.file.write(";\n")
-                                       else :
-                                               self.file.write(",\n")
-
-                       self.file.write("}  //End of MeshVertexColors\n")
-
-#***********************************************#***********************************************#***********************************************
-       #***********************************************
-       #FRAMES
-       #***********************************************
-       def writeFrames(self, matx):
-               
-               self.file.write("%f,%f,%f,%f," %
-                                                       (round(matx[0][0],4),round(matx[0][1],4),round(matx[0][2],4),round(matx[0][3],4)))
-               self.file.write("%f,%f,%f,%f," %
-                                                       (round(matx[1][0],4),round(matx[1][1],4),round(matx[1][2],4),round(matx[1][3],4)))      
-               self.file.write("%f,%f,%f,%f," %
-                                                       (round(matx[2][0],4),round(matx[2][1],4),round(matx[2][2],4),round(matx[2][3],4)))
-               self.file.write("%f,%f,%f,%f;;" %
-                                                       (round(matx[3][0],4),round(matx[3][1],4),round(matx[3][2],4),round(matx[3][3],4)))
-               
-               
-               
-       
-       
-       #***********************************************
-       #WRITE ANIMATION KEYS
-       #***********************************************
-       def writeAnimation(self,arm_ob):
-               global mat_dict, root_bon
-               arm = arm_ob.getData()
-               act_list = arm_ob.getAction()
-               ip = act_list.getAllChannelIpos()
-               for bon in arm.bones.values() :
-                       point_list = []
-                       name = bon.name
-                       name_f = make_legal_name(name)
-                       try :
-                               ip_bon_channel = ip[bon.name]
-                               ip_bon_name = ip_bon_channel.getName()
-                               
-                               ip_bon = Blender.Ipo.Get(ip_bon_name)
-                               poi = ip_bon.getCurves()
-                               
-                               for po in poi[3].getPoints():
-                                       a = po.getPoints()
-                                       point_list.append(int(a[0]))
-                               #point_list.pop(0) 
-                               
-                               self.file.write(" Animation { \n")
-                               self.file.write("  { %s }\n" %(name_f))
-                               self.file.write("  AnimationKey { \n")
-                               self.file.write("   4;\n")
-                               self.file.write("   %d; \n" % (len(point_list)))
-
-                               for fr in point_list:
-                                       
-                                       if name == root_bon.name :
-                                               
-                                               
-                                               mat_b = self.writeAnimCombineMatrix(bon,fr)
-                                               mat_arm = self.getLocMat(arm_ob)
-                                               mat = mat_b * mat_arm
-                                       else:   
-                                               mat = self.writeAnimCombineMatrix(bon,fr)
-                                               
-                                       self.file.write("   %d;" % (fr))
-                                       self.file.write("16;")
-                               
-                                       self.writeFrames(mat)
-                               
-                                       if fr == point_list[len(point_list)-1]:
-                                               self.file.write(";\n")
-                                       else:
-                                               self.file.write(",\n")
-                               self.file.write("   }\n")
-                               self.file.write(" }\n")
-                               self.file.write("\n")
-                       except:
-                               pass
-               
-               
-
-       #***********************************************
-       #WRITE ANIMATION KEYS
-       #***********************************************
-       def writeAnimationObj(self, obj):
-               point_list = []
-               ip = obj.ipo
-               poi = ip.getCurves()
-               for po in poi[0].getPoints():
-                       a = po.getPoints()
-                       point_list.append(int(a[0]))
-               
-               self.file.write(" Animation {\n")
-               self.file.write("  { ")
-               self.file.write("%s }\n" % (make_legal_name(obj.name)))
-               self.file.write("   AnimationKey { \n")
-               self.file.write("   4;\n")
-               self.file.write("   %d; \n" % (len(point_list)))
-               for fr in point_list:
-                       self.file.write("   %d;" % (fr))
-                       self.file.write("16;")
-                       Blender.Set('curframe',fr)
-                               
-                       #mat_new = self.getLocMat(obj) 
-                       mat_new = obj.matrixLocal 
-                       self.writeFrames(mat_new)
-
-                       if fr == point_list[len(point_list)-1]:
-                               self.file.write(";\n")
-                       else:
-                               self.file.write(",\n")
-               self.file.write("   }\n")
-               self.file.write("  }\n")
-
-       
-               
-#***********************************************#***********************************************#***********************************************
-
-
-
-       
-       
diff --git a/release/scripts/DirectX8Importer.py b/release/scripts/DirectX8Importer.py
deleted file mode 100644 (file)
index 0dda654..0000000
+++ /dev/null
@@ -1,238 +0,0 @@
-#!BPY
-
-""" Registration info for Blender menus:
-Name: 'DirectX(.x)...'
-Blender: 244
-Group: 'Import'
-
-Tip: 'Import from DirectX text file format format.'
-"""
-# DirectXImporter.py version 1.2
-# Copyright (C) 2005  Arben OMARI -- omariarben@everyday.com 
-#
-# 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.
-
-# This script import meshes from DirectX text file format
-
-# Grab the latest version here :www.omariben.too.it
-import bpy
-import Blender
-from Blender import Mesh,Object,Material,Texture,Image,Draw
-
-
-class xImport:
-       def __init__(self, filename):
-               global my_path
-               self.file = open(filename, "r")
-               my_path = Blender.sys.dirname(filename)
-
-               # 
-               self.lines = [l_split for l in self.file.readlines() for l_split in (' '.join(l.split()),) if l_split]
-
-       def Import(self):
-               lines = self.lines
-               print "importing into Blender ..."
-               scene  = bpy.data.scenes.active
-               
-               mesh_indicies = {} # the index of each 'Mesh' is used as the key for those meshes indicies
-               context_indicies = None # will raise an error if used!
-               
-               
-               #Get the line of Texture Coords
-               nr_uv_ind = 0
-
-               #Get Materials
-               nr_fac_mat = 0
-               i = -1
-               mat_list = []
-               tex_list = []
-               mesh_line_indicies = []
-               for j, line in enumerate(lines):
-                       l = line.strip()
-                       words = line.split()
-                       if words[0] == "Material" :
-                               #context_indicies["Material"] = j
-                               self.loadMaterials(j, mat_list, tex_list)
-                       elif words[0] == "MeshTextureCoords" :
-                               context_indicies["MeshTextureCoords"] = j
-                               #nr_uv_ind = j
-                       elif words[0] == "MeshMaterialList" :
-                               context_indicies["MeshMaterialList"] = j+2
-                               #nr_fac_mat = j + 2
-                       elif words[0] == "Mesh": # Avoid a second loop
-                               context_indicies = mesh_indicies[j] = {'MeshTextureCoords':0, 'MeshMaterialList':0}
-               
-               for mesh_index, value in mesh_indicies.iteritems():
-                       mesh = Mesh.New()
-                       self.loadVertices(mesh_index, mesh, value['MeshTextureCoords'], value['MeshMaterialList'], tex_list)
-                       
-                       mesh.materials = mat_list[:16]
-                       if value['MeshMaterialList']:
-                               self.loadMeshMaterials(value['MeshMaterialList'], mesh)
-                       scene.objects.new(mesh)
-                       
-               self.file.close()
-               print "... finished"
-
-       #------------------------------------------------------------------------------
-       #        CREATE THE MESH
-       #------------------------------------------------------------------------------
-       def loadVertices(self, nr_vr_ind, mesh, nr_uv, nr_fac_mat, tex_list):
-               v_ind = nr_vr_ind + 1
-               lin = self.lines[v_ind]
-               if lin :
-                       lin_c = self.CleanLine(lin)
-                       nr_vert = int((lin_c.split()[0]))
-               else :
-                       v_ind = nr_vr_ind + 2
-                       lin = self.lines[v_ind]
-                       lin_c = self.CleanLine(lin)
-                       nr_vert = int((lin_c.split()[0]))
-
-               #--------------------------------------------------
-               nr_fac_li = v_ind + nr_vert +1
-               lin_f = self.lines[nr_fac_li]
-               if lin_f :
-                       lin_fc = self.CleanLine(lin_f)
-                       nr_face = int((lin_fc.split()[0]))
-               else :
-                       nr_fac_li = v_ind + nr_vert +1
-                       lin_f = self.lines[nr_fac_li]
-                       lin_fc = self.CleanLine(lin_f)
-                       nr_face = int((lin_fc.split()[0]))
-
-               #Get Coordinates
-               verts_list = [(0,0,0)] # WARNING - DUMMY VERT - solves EEKADOODLE ERROR
-               for l in xrange(v_ind + 1, (v_ind + nr_vert +1)):
-                       line_v = self.lines[l]
-                       lin_v = self.CleanLine(line_v)
-                       words = lin_v.split()
-                       if len(words)==3:
-                               verts_list.append((float(words[0]),float(words[1]),float(words[2])))
-               
-               mesh.verts.extend(verts_list)
-               del verts_list
-               
-               face_list = []
-               #Make Faces
-               i = 0
-               mesh_verts = mesh.verts
-               for f in xrange(nr_fac_li + 1, (nr_fac_li + nr_face + 1)):
-                       i += 1
-                       line_f = self.lines[f]
-                       lin_f = self.CleanLine(line_f)
-                       
-                       # +1 for dummy vert only!
-                       words = lin_f.split()
-                       if len(words) == 5:
-                               face_list.append((1+int(words[1]), 1+int(words[2]), 1+int(words[3]), 1+int(words[4])))
-                       elif len(words) == 4:
-                               face_list.append((1+int(words[1]), 1+int(words[2]), 1+int(words[3])))
-               
-               mesh.faces.extend(face_list)
-               del face_list
-               
-               if nr_uv :
-                       mesh.faceUV = True
-                       for f in mesh.faces:
-                               fuv = f.uv
-                               for ii, v in enumerate(f):
-                                       # _u, _v = self.CleanLine(self.lines[nr_uv + 2 + v.index]).split()
-                                       
-                                       # Use a dummy vert
-                                       _u, _v = self.CleanLine(self.lines[nr_uv + 1 + v.index]).split()
-                                       
-                                       fuv[ii].x = float(_u)
-                                       fuv[ii].y = float(_v)
-                       
-                               if nr_fac_mat :
-                                       fac_line = self.lines[nr_fac_mat + i]
-                                       fixed_fac = self.CleanLine(fac_line)
-                                       w_tex = int(fixed_fac.split()[0])
-                                       f.image = tex_list[w_tex]
-                                       
-               # remove dummy vert
-               mesh.verts.delete([0,])
-               
-       def CleanLine(self,line):
-               return line.replace(\
-                       ";", " ").replace(\
-                       '"', ' ').replace(\
-                       "{", " ").replace(\
-                       "}", " ").replace(\
-                       ",", " ").replace(\
-                       "'", " ")
-
-       #------------------------------------------------------------------
-       # CREATE MATERIALS
-       #------------------------------------------------------------------
-       def loadMaterials(self, nr_mat, mat_list, tex_list):
-               
-               def load_image(name):
-                       try:
-                               return Image.Load(Blender.sys.join(my_path,name))
-                       except:
-                               return None
-               
-               mat = bpy.data.materials.new()
-               line = self.lines[nr_mat + 1]
-               fixed_line = self.CleanLine(line)
-               words = fixed_line.split()
-               mat.rgbCol = [float(words[0]),float(words[1]),float(words[2])]
-               mat.setAlpha(float(words[3]))
-               mat_list.append(mat)
-               l = self.lines[nr_mat + 5]
-               fix_3_line = self.CleanLine(l)
-               tex_n = fix_3_line.split()
-               
-               if tex_n and tex_n[0] == "TextureFilename" :
-
-                       if len(tex_n) > 1:
-                               tex_list.append(load_image(tex_n[1]))
-
-                       if len(tex_n) <= 1 :
-
-                               l_succ = self.lines[nr_mat + 6]
-                               fix_3_succ = self.CleanLine(l_succ)
-                               tex_n_succ = fix_3_succ.split()
-                               tex_list.append(load_image(tex_n_succ[0]))
-               else :
-                       tex_list.append(None) # no texture for this index
-
-               return mat_list, tex_list
-       #------------------------------------------------------------------
-       # SET MATERIALS
-       #------------------------------------------------------------------
-       def loadMeshMaterials(self, nr_fc_mat, mesh):
-               for face in mesh.faces:
-                       nr_fc_mat += 1
-                       line = self.lines[nr_fc_mat]
-                       fixed_line = self.CleanLine(line)
-                       wrd = fixed_line.split()
-                       mat_idx = int(wrd[0])
-                       face.mat = mat_idx
-
-#------------------------------------------------------------------
-#  MAIN
-#------------------------------------------------------------------
-def my_callback(filename):
-       if not filename.lower().endswith('.x'): print "Not an .x file" 
-       ximport = xImport(filename)
-       ximport.Import()
-
-arg = __script__['arg']
-
-if __name__ == '__main__':
-       Blender.Window.FileSelector(my_callback, "Import DirectX", "*.x")
-
-#my_callback('/fe/x/directxterrain.x')
-#my_callback('/fe/x/Male_Normal_MAX.X')
-#my_callback('/fe/x/male_ms3d.x')
diff --git a/release/scripts/IDPropBrowser.py b/release/scripts/IDPropBrowser.py
deleted file mode 100644 (file)
index 2a14760..0000000
+++ /dev/null
@@ -1,523 +0,0 @@
-#!BPY
-
-"""
-Name: 'ID Property Browser'
-Blender: 242
-Group: 'Help'
-Tooltip: 'Browse ID properties'
-"""
-
-__author__ = "Joe Eagar"
-__version__ = "0.3.108"
-__email__ = "joeedh@gmail.com"
-__bpydoc__ = """\
-
-Allows browsing, creating and editing of ID Properties
-for various ID block types such as mesh, scene, object,
-etc.
-"""
-
-# --------------------------------------------------------------------------
-# ID Property Browser.
-# --------------------------------------------------------------------------
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# 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 *****
-# --------------------------------------------------------------------------
-
-
-from Blender import *
-from Blender.BGL import *
-from Blender.Types import IDGroupType, IDArrayType
-import Blender
-
-def IsInRectWH(mx, my, x, y, wid, hgt):
-       if mx >= x and mx <= x + wid:
-               if my >= y and my <= y + hgt:
-                       return 1
-       return 0
-
-Button_Back = 1
-Button_New = 2
-Button_MatMenu = 3
-Button_TypeMenu = 4
-
-ButStart = 55
-
-IDP_String = 0
-IDP_Int = 1
-IDP_Float = 2
-IDP_Array = 5
-IDP_Group = 6
-
-ButDelStart = 255
-#max limit for string input button
-strmax = 100
-
-State_Normal = 0
-State_InArray = 1
-
-#IDTypeModules entries are of form [module, active_object_index, module_name]
-IDTypeModules = [[Scene, 0, "Scenes"], [Object, 0, "Objects"], [Mesh, 0, "Meshes"]]
-IDTypeModules += [[Material, 0, "Materials"], [Texture, 0, "Textures"]]
-IDTypeModules += [[Image, 0, "Images"]]
-
-class IDArrayBrowser:
-       array = 0
-       parentbrowser = 0
-       buts = 0
-       
-       def __init__(self):
-               self.buts = []
-       
-       def Draw(self):
-               pb = self.parentbrowser
-               x = pb.x
-               y = pb.y
-               width = pb.width
-               height = pb.height
-               pad = pb.pad
-               itemhgt = pb.itemhgt
-               cellwid = 65
-               y = y + height - itemhgt - pad
-               
-               Draw.PushButton("Back", Button_Back, x, y, 40, 20)
-               y -= itemhgt + pad
-               
-               self.buts = []
-               Draw.BeginAlign()
-               for i in xrange(len(self.array)):
-                       st = ""
-                       if type(self.array[0]) == float:
-                               st = "%.5f" % self.array[i]
-                       else: st = str(self.array[i])
-                       
-                       b = Draw.String("", ButStart+i, x, y, cellwid, itemhgt, st, 30)
-                       self.buts.append(b)
-                       x += cellwid + pad
-                       if x + cellwid + pad > width:
-                               x = 0
-                               y -= itemhgt + pad
-               Draw.EndAlign()
-       def Button(self, bval):
-               if bval == Button_Back:
-                       self.parentbrowser.state = State_Normal
-                       self.parentbrowser.array = 0
-                       self.buts = []
-                       Draw.Draw()
-                       self.array = 0
-               elif bval >= ButStart:
-                       i = bval - ButStart
-                       st = self.buts[i].val
-                       n = 0
-                       if type(self.array[0]) == float:
-                               try:
-                                       n = int(st)
-                               except:
-                                       return
-                       elif type(self.array[0]) == int:
-                               try:
-                                       n = float(st)
-                               except:
-                                       return
-                       
-                       self.array[i] = n
-                       Draw.Draw()
-                       
-       def Evt(self, evt, val):
-               if evt == Draw.ESCKEY:
-                       Draw.Exit()
-       
-class IDPropertyBrowser:
-       width = 0
-       height = 0
-       x = 0
-       y = 0
-       scrollx = 0
-       scrolly = 0
-       itemhgt = 22
-       pad = 2
-       
-       group = 0
-       parents = 0 #list stack of parent groups
-       active_item = -1
-       mousecursor = 0
-       _i = 0
-       buts = []
-       
-       state = 0
-       array = 0
-       prop = 0
-       
-       IDList = 0
-       idindex = 0
-       idblock = 0
-       
-       type = 0 # attach buildin type() method to class
-                # since oddly it's not available to button
-                # callbacks! EEK! :(
-       
-       def __init__(self, idgroup, mat, x, y, wid, hgt):
-               self.group = idgroup
-               self.prop = idgroup
-               self.x = x
-               self.y = y
-               self.width = wid
-               self.height = hgt
-               self.mousecursor = [0, 0]
-               self.parents = []
-               self.idblock = mat
-               self.type = type
-               
-       def DrawBox(self, glmode, x, y, width, height):
-               glBegin(glmode)
-               glVertex2f(x, y)
-               glVertex2f(x+width, y)
-               glVertex2f(x+width, y+height)
-               glVertex2f(x, y+height)
-               glEnd()
-                       
-       def Draw(self):
-               global IDTypeModules
-               
-               #first draw outlining box :)
-               glColor3f(0, 0, 0)
-               self.DrawBox(GL_LINE_LOOP, self.x, self.y, self.width, self.height)
-                               
-               itemhgt = self.itemhgt
-               pad = self.pad
-               x = self.x
-               y = self.y + self.height - itemhgt - pad
-               
-               if self.state == State_InArray:
-                       self.array.Draw()
-                       return
-               
-               plist = []
-               self.buts = []
-               for p in self.group.iteritems():
-                       plist.append(p)
-               
-               #-------do top buttons----------#
-               Draw.BeginAlign()
-               Draw.PushButton("New", Button_New, x, y, 40, 20)
-               x += 40 + pad
-               #do the menu button for all materials
-               st = ""
-               
-               blocks =  IDTypeModules[self.IDList][0].Get()
-               i = 1
-               mi = 0
-               for m in blocks:
-                       if m.name == self.idblock.name:
-                               mi = i
-                       st += m.name + " %x" + str(i) + "|"
-                       i += 1
-               
-               self.menubut = Draw.Menu(st, Button_MatMenu, x, y, 100, 20, mi)
-               
-               x += 100 + pad
-               
-               st = ""
-               i = 0
-               for e in IDTypeModules:
-                       st += e[2] + " %x" + str(i+1) + "|"
-                       i += 1
-               
-               cur = self.IDList + 1
-               self.idmenu = Draw.Menu(st, Button_TypeMenu, x, y, 100, 20, cur)
-               x = self.x
-               y -= self.itemhgt + self.pad
-               Draw.EndAlign()
-               
-               
-               #-----------do property items---------#
-               i = 0
-               while y > self.y - 20 - pad and i < len(plist):
-                       k = plist[i][0]
-                       p = plist[i][1]
-                       if i == self.active_item:
-                               glColor3f(0.5, 0.4, 0.3)
-                               self.DrawBox(GL_POLYGON, x+pad, y, self.width-pad*2, itemhgt)
-                               
-                       glColor3f(0, 0, 0)      
-                       self.DrawBox(GL_LINE_LOOP, x+pad, y, self.width-pad*2, itemhgt)
-                       
-                       glRasterPos2f(x+pad*2, y+5)
-                       Draw.Text(str(k)) #str(self.mousecursor) + " " + str(self.active_item)) #p.name)
-                       tlen = Draw.GetStringWidth(str(k))
-                       
-                       type_p = type(p)
-                       if type_p == str:
-                               b = Draw.String("", ButStart+i, x+pad*5+tlen, y, 200, itemhgt, p, strmax)
-                               self.buts.append(b)
-                       elif type_p in [int, float]:
-                               #only do precision to 5 points on floats
-                               st = ""
-                               if type_p == float:
-                                       st = "%.5f" % p
-                               else: st = str(p)
-                               b = Draw.String("", ButStart+i, x+pad*5+tlen, y, 75, itemhgt, st, strmax)
-                               self.buts.append(b)
-                       else:
-                               glRasterPos2f(x+pad*2  +tlen+10, y+5)
-                               if type_p == Types.IDArrayType:
-                                       Draw.Text('(array, click to edit)')
-                               elif type_p == Types.IDGroupType:       
-                                       Draw.Text('(group, click to edit)')
-                                       
-                               
-                               self.buts.append(None)
-                               
-                       Draw.PushButton("Del", ButDelStart+i, x+self.width-35, y, 30, 20)
-                       
-                       i += 1
-                       y -= self.itemhgt + self.pad
-               
-               if len(self.parents) != 0:
-                       Draw.PushButton("Back", Button_Back, x, y, 40, 20)
-                       x = x + 40 + pad
-                       
-       def SetActive(self):
-               m = self.mousecursor
-               itemhgt = self.itemhgt
-               pad = self.pad
-               
-               x = self.x + pad
-               y = self.y + self.height - itemhgt - pad - itemhgt
-               
-               plist = []
-               for p in self.group.iteritems():
-                       plist.append(p)
-               
-               self.active_item = -1
-               i = 0
-               while y > self.y and i < len(plist):
-                       p = plist[i]
-                       if IsInRectWH(m[0], m[1], x, y, self.width-pad, itemhgt):
-                               self.active_item = i
-                               
-                       i += 1
-                       y -= self.itemhgt + self.pad
-               
-       def EventIn(self, evt, val):
-               if self.state == State_InArray:
-                       self.array.Evt(evt, val)
-               
-               if evt == Draw.ESCKEY:
-                       Draw.Exit()
-               if evt == Draw.MOUSEX or evt == Draw.MOUSEY:
-                       size = Buffer(GL_FLOAT, 4)
-                       glGetFloatv(GL_SCISSOR_BOX, size)
-                       if evt == Draw.MOUSEX:
-                               self.mousecursor[0] = val - size[0]
-                       else:
-                               self.mousecursor[1] = val - size[1]
-                       del size
-                       
-                       self.SetActive()
-                       self._i += 1
-                       if self._i == 5:
-                               Draw.Draw()
-                               self._i = 0
-
-               
-               if evt == Draw.LEFTMOUSE and val == 1:
-                       plist = list(self.group.iteritems())
-                       a = self.active_item
-                       if a >= 0 and a < len(plist):
-                               p = plist[a]
-                       
-                               basictypes = [IDGroupType, float, str, int]
-                               if type(p[1]) == IDGroupType:
-                                       self.parents.append(self.group)
-                                       self.group = p[1]
-                                       self.active_item = -1
-                                       Draw.Draw()
-                               elif type(p[1]) == IDArrayType:
-                                       self.array = IDArrayBrowser()
-                                       self.array.array = p[1]
-                                       self.array.parentbrowser = self
-                                       self.state = State_InArray
-                                       Draw.Draw()
-                                       
-               if evt == Draw.TKEY and val == 1:
-                       try:
-                               self.prop['float'] = 0.0
-                               self.prop['int'] = 1
-                               self.prop['string'] = "hi!"
-                               self.prop['float array'] = [0, 0, 1.0, 0]
-                               self.prop['int array'] = [0, 0, 0, 0]
-                               self.prop.data['a subgroup'] = {"int": 0, "float": 0.0, "anothergroup": {"a": 0.0, "intarr": [0, 0, 0, 0]}}
-                               Draw.Draw()
-                       except:
-                               Draw.PupMenu("Can only do T once per block, the test names are already taken!")
-                               
-                                               
-       def Button(self, bval):
-               global IDTypeModules
-               if self.state == State_InArray:
-                       self.array.Button(bval)
-                       return
-               
-               if bval == Button_MatMenu:
-                       global IDTypeModules
-                       
-                       val = self.idindex = self.menubut.val - 1
-                       i = self.IDList
-                       block = IDTypeModules[i][0].Get()[val]
-                       self.idblock = block
-                       self.prop = block.properties
-                       self.group = self.prop
-                       self.active_item = -1
-                       self.parents = []
-                       Draw.Draw()
-               
-               if bval == Button_TypeMenu:                     
-                       i = IDTypeModules[self.idmenu.val-1]
-                       if len(i[0].Get()) == 0:
-                               Draw.PupMenu("Error%t|There are no " + i[2] + "!")
-                               return
-                       
-                       IDTypeModules[self.IDList][1] = self.idindex
-                       self.IDList = self.idmenu.val-1
-                       val = self.idindex = IDTypeModules[self.IDList][1]
-                       i = self.IDList
-                       block = IDTypeModules[i][0].Get()[val]
-                       self.idblock = block
-                       self.prop = block.properties
-                       self.group = self.prop
-                       self.active_item = -1
-                       self.parents = []
-                       Draw.Draw()
-                       
-               if bval >= ButDelStart:
-                       plist = [p for p in self.group]
-                       prop = plist[bval - ButDelStart]
-                       del self.group[prop]
-                       Draw.Draw()
-                       
-               elif bval >= ButStart:
-                       plist = list(self.group.iteritems())
-                       
-                       prop = plist[bval - ButStart]
-                       print prop
-                       
-                       if self.type(prop[1]) == str:
-                               self.group[prop[0]] = self.buts[bval - ButStart].val
-                       elif self.type(prop[1]) == int:
-                               i = self.buts[bval - ButStart].val
-                               try:
-                                       i = int(i)
-                                       self.group[prop[0]] = i
-                               except:
-                                       Draw.Draw()
-                                       return
-                               Draw.Draw()
-                       elif self.type(prop[1]) == float:
-                               f = self.buts[bval - ButStart].val
-                               try:
-                                       f = float(f)
-                                       self.group[prop[0]] = f
-                               except:
-                                       Draw.Draw()
-                                       return
-                               Draw.Draw()
-                               
-               elif bval == Button_Back:
-                       self.group = self.parents[len(self.parents)-1]
-                       self.parents.pop(len(self.parents)-1)
-                       Draw.Draw()
-               
-               elif bval == Button_New:
-                       name = Draw.Create("untitled")
-                       stype = Draw.Create(0)
-                       gtype = Draw.Create(0)
-                       ftype = Draw.Create(0)
-                       itype = Draw.Create(0)
-                       atype = Draw.Create(0)
-
-                       block = []
-                       block.append(("Name: ", name, 0, 30, "Click to type in the name of the new ID property"))
-                       block.append("Type")
-                       block.append(("String", stype))
-                       block.append(("Subgroup", gtype))
-                       block.append(("Float", ftype))
-                       block.append(("Int", itype))
-                       block.append(("Array", atype))
-                       
-                       retval = Blender.Draw.PupBlock("New IDProperty", block)
-                       if retval == 0: return
-                       
-                       name = name.val
-                       i = 1
-                       stop = 0
-                       while stop == 0:
-                               stop = 1
-                               for p in self.group:
-                                       if p == name:
-                                               d = name.rfind(".")
-                                               if d != -1:
-                                                       name = name[:d]
-                                               name = name + "." + str(i).zfill(3)
-                                               i += 1
-                                               stop = 0
-                               
-                       type = "String"
-                       if stype.val: 
-                               self.group[name] = ""
-                       elif gtype.val: 
-                               self.group[name] = {}
-                       elif ftype.val: 
-                               self.group[name] = 0.0
-                       elif itype.val: 
-                               self.group[name] = 0 #newProperty("Int", name, 0)
-                       elif atype.val: 
-                               arrfloat = Draw.Create(1)
-                               arrint = Draw.Create(0)
-                               arrlen = Draw.Create(3)
-                               block = []
-                               block.append("Type")
-                               block.append(("Float", arrfloat, "Make a float array"))
-                               block.append(("Int", arrint, "Make an integer array"))
-                               block.append(("Len", arrlen, 2, 200))
-                               
-                               if Blender.Draw.PupBlock("Array Properties", block):
-                                       if arrfloat.val:
-                                               tmpl = 0.0
-                                       elif arrint.val:
-                                               tmpl = 0
-                                       else:
-                                               return
-                                       
-                                       self.group[name] = [tmpl] * arrlen.val
-
-                               
-       def Go(self):
-               Draw.Register(self.Draw, self.EventIn, self.Button)
-
-scenes = Scene.Get()
-
-size = Window.GetAreaSize()
-browser = IDPropertyBrowser(scenes[0].properties, scenes[0], 2, 2, size[0], size[1])
-browser.Go()
-
-#a = prop.newProperty("String", "hwello!", "bleh")
-#b = prop.newProperty("Group", "subgroup")
-
-#for p in prop:
-       #print p.name
diff --git a/release/scripts/ac3d_export.py b/release/scripts/ac3d_export.py
deleted file mode 100644 (file)
index 57f27c7..0000000
+++ /dev/null
@@ -1,828 +0,0 @@
-#!BPY
-
-""" Registration info for Blender menus:
-Name: 'AC3D (.ac)...'
-Blender: 243
-Group: 'Export'
-Tip: 'Export selected meshes to AC3D (.ac) format'
-"""
-
-__author__ = "Willian P. Germano"
-__url__ = ("blender", "blenderartists.org", "AC3D's homepage, http://www.ac3d.org",
-       "PLib 3d gaming lib, http://plib.sf.net")
-__version__ = "2.44 2007-05-05"
-
-__bpydoc__ = """\
-This script exports selected Blender meshes to AC3D's .ac file format.
-
-AC3D is a simple commercial 3d modeller also built with OpenGL.
-The .ac file format is an easy to parse text format well supported,
-for example, by the PLib 3d gaming library (AC3D 3.x).
-
-Supported:<br>
-    UV-textured meshes with hierarchy (grouping) information.
-
-Missing:<br>
-    The 'url' tag, specific to AC3D.  It is easy to add by hand to the exported
-file, if needed.
-
-Known issues:<br>
-    The ambient and emit data we can retrieve from Blender are single values,
-that this script copies to R, G, B, giving shades of gray.<br>
-    Loose edges (lines) receive the first material found in the mesh, if any, or a default white material.<br>
-    In AC3D 4 "compatibility mode":<br>
-    - shininess of materials is taken from the shader specularity value in Blender, mapped from [0.0, 2.0] to [0, 128];<br>
-    - crease angle is exported, but in Blender it is limited to [1, 80], since there are other more powerful ways to control surface smoothing.  In AC3D 4.0 crease's range is [0.0, 180.0];
-
-Config Options:<br>
-    toggle:<br>
-    - AC3D 4 mode: unset it to export without the 'crease' tag that was
-introduced with AC3D 4.0 and with the old material handling;<br>
-    - global coords: transform all vertices of all meshes to global coordinates;<br>
-    - skip data: set it if you don't want mesh names (ME:, not OB: field)
-to be exported as strings for AC's "data" tags (19 chars max);<br>
-    - rgb mirror color can be exported as ambient and/or emissive if needed,
-since Blender handles these differently;<br>
-    - default mat: a default (white) material is added if some mesh was
-left without mats -- it's better to always add your own materials;<br>
-    - no split: don't split meshes (see above);<br>
-    - set texture dir: override the actual textures path with a given default
-path (or simply export the texture names, without dir info, if the path is
-empty);<br>
-    - per face 1 or 2 sided: override the "Double Sided" button that defines this behavior per whole mesh in favor of the UV Face Select mode "twosided" per face atribute;<br>
-    - only selected: only consider selected objects when looking for meshes
-to export (read notes below about tokens, too);<br>
-    strings:<br>
-    - export dir: default dir to export to;<br>
-    - texture dir: override textures path with this path if 'set texture dir'
-toggle is "on".
-
-Notes:<br>
-       This version updates:<br>
-    - modified meshes are correctly exported, no need to apply the modifiers in Blender;<br>
-    - correctly export each used material, be it assigned to the object or to its mesh data;<br>
-    - exporting lines (edges) is again supported; color comes from first material found in the mesh, if any, or a default white one.<br>
-    - there's a new option to choose between exporting meshes with transformed (global) coordinates or local ones;<br>
-    Multiple textures per mesh are supported (mesh gets split);<br>
-       Parents are exported as a group containing both the parent and its children;<br>
-    Start mesh object names (OB: field) with "!" or "#" if you don't want them to be exported;<br>
-    Start mesh object names (OB: field) with "=" or "$" to prevent them from being split (meshes with multiple textures or both textured and non textured faces are split unless this trick is used or the "no split" option is set.
-"""
-
-# $Id$
-#
-# --------------------------------------------------------------------------
-# AC3DExport version 2.44
-# Program versions: Blender 2.42+ and AC3Db files (means version 0xb)
-# new: updated for new Blender version and Mesh module; supports lines (edges) again;
-# option to export vertices transformed to global coordinates or not; now the modified
-# (by existing mesh modifiers) mesh is exported; materials are properly exported, no
-# matter if each of them is linked to the mesh or to the object. New (2.43.1): loose
-# edges use color of first material found in the mesh, if any.
-# --------------------------------------------------------------------------
-# Thanks: Steve Baker for discussions and inspiration; for testing, bug
-# reports, suggestions, patches: David Megginson, Filippo di Natale,
-# Franz Melchior, Campbell Barton, Josh Babcock, Ralf Gerlich, Stewart Andreason.
-# --------------------------------------------------------------------------
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# Copyright (C) 2004-2007: Willian P. Germano, wgermano _at_ ig.com.br
-#
-# 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,
-# --------------------------------------------------------------------------
-
-import Blender
-from Blender import Object, Mesh, Material, Image, Mathutils, Registry
-from Blender import sys as bsys
-
-# Globals
-REPORT_DATA = {
-       'main': [],
-       'errors': [],
-       'warns': [],
-       'nosplit': [],
-       'noexport': []
-}
-TOKENS_DONT_EXPORT = ['!', '#']
-TOKENS_DONT_SPLIT  = ['=', '$']
-
-MATIDX_ERROR = 0
-
-# flags:
-LOOSE = Mesh.EdgeFlags['LOOSE']
-FACE_TWOSIDED = Mesh.FaceModes['TWOSIDE']
-MESH_TWOSIDED = Mesh.Modes['TWOSIDED']
-
-REG_KEY = 'ac3d_export'
-
-# config options:
-GLOBAL_COORDS = True
-SKIP_DATA = False
-MIRCOL_AS_AMB = False
-MIRCOL_AS_EMIS = False
-ADD_DEFAULT_MAT = True
-SET_TEX_DIR = True
-TEX_DIR = ''
-AC3D_4 = True # export crease value, compatible with AC3D 4 loaders
-NO_SPLIT = False
-ONLY_SELECTED = True
-EXPORT_DIR = ''
-PER_FACE_1_OR_2_SIDED = True
-
-tooltips = {
-       'GLOBAL_COORDS': "transform all vertices of all meshes to global coordinates",
-       'SKIP_DATA': "don't export mesh names as data fields",
-       'MIRCOL_AS_AMB': "export mirror color as ambient color",
-       'MIRCOL_AS_EMIS': "export mirror color as emissive color",
-       'ADD_DEFAULT_MAT': "always add a default white material",
-       'SET_TEX_DIR': "don't export default texture paths (edit also \"tex dir\")",
-       'EXPORT_DIR': "default / last folder used to export .ac files to",
-       'TEX_DIR': "(see \"set tex dir\") dir to prepend to all exported texture names (leave empty for no dir)",
-       'AC3D_4': "compatibility mode, adds 'crease' tag and slightly better material support",
-       'NO_SPLIT': "don't split meshes with multiple textures (or both textured and non textured polygons)",
-       'ONLY_SELECTED': "export only selected objects",
-       'PER_FACE_1_OR_2_SIDED': "override \"Double Sided\" button in favor of per face \"twosided\" attribute (UV Face Select mode)"
-}
-
-def update_RegistryInfo():
-       d = {}
-       d['SKIP_DATA'] = SKIP_DATA
-       d['MIRCOL_AS_AMB'] = MIRCOL_AS_AMB
-       d['MIRCOL_AS_EMIS'] = MIRCOL_AS_EMIS
-       d['ADD_DEFAULT_MAT'] = ADD_DEFAULT_MAT
-       d['SET_TEX_DIR'] = SET_TEX_DIR
-       d['TEX_DIR'] = TEX_DIR
-       d['AC3D_4'] = AC3D_4
-       d['NO_SPLIT'] = NO_SPLIT
-       d['EXPORT_DIR'] = EXPORT_DIR
-       d['ONLY_SELECTED'] = ONLY_SELECTED
-       d['PER_FACE_1_OR_2_SIDED'] = PER_FACE_1_OR_2_SIDED
-       d['tooltips'] = tooltips
-       d['GLOBAL_COORDS'] = GLOBAL_COORDS
-       Registry.SetKey(REG_KEY, d, True)
-
-# Looking for a saved key in Blender.Registry dict:
-rd = Registry.GetKey(REG_KEY, True)
-
-if rd:
-       try:
-               AC3D_4 = rd['AC3D_4']
-               SKIP_DATA = rd['SKIP_DATA']
-               MIRCOL_AS_AMB = rd['MIRCOL_AS_AMB']
-               MIRCOL_AS_EMIS = rd['MIRCOL_AS_EMIS']
-               ADD_DEFAULT_MAT = rd['ADD_DEFAULT_MAT']
-               SET_TEX_DIR = rd['SET_TEX_DIR']
-               TEX_DIR = rd['TEX_DIR']
-               EXPORT_DIR = rd['EXPORT_DIR']
-               ONLY_SELECTED = rd['ONLY_SELECTED']
-               NO_SPLIT = rd['NO_SPLIT']
-               PER_FACE_1_OR_2_SIDED = rd['PER_FACE_1_OR_2_SIDED']
-               GLOBAL_COORDS = rd['GLOBAL_COORDS']
-       except KeyError: update_RegistryInfo()
-
-else:
-       update_RegistryInfo()
-
-VERBOSE = True
-CONFIRM_OVERWRITE = True
-
-# check General scripts config key for default behaviors
-rd = Registry.GetKey('General', True)
-if rd:
-       try:
-               VERBOSE = rd['verbose']
-               CONFIRM_OVERWRITE = rd['confirm_overwrite']
-       except: pass
-
-
-# The default material to be used when necessary (see ADD_DEFAULT_MAT)
-DEFAULT_MAT = \
-'MATERIAL "DefaultWhite" rgb 1 1 1  amb 1 1 1  emis 0 0 0  \
-spec 0.5 0.5 0.5  shi 64  trans 0'
-
-# This transformation aligns Blender and AC3D coordinate systems:
-BLEND_TO_AC3D_MATRIX = Mathutils.Matrix([1,0,0,0], [0,0,-1,0], [0,1,0,0], [0,0,0,1])
-
-def Round_s(f):
-       "Round to default precision and turn value to a string"
-       r = round(f,6) # precision set to 10e-06
-       if r == int(r):
-               return str(int(r))
-       else:
-               return str(r)
-def transform_verts(verts, m):
-       vecs = []
-       for v in verts:
-               x, y, z = v.co
-               vec = Mathutils.Vector([x, y, z, 1])
-               vecs.append(vec*m)
-       return vecs
-
-def get_loose_edges(mesh):
-       loose = LOOSE
-       return [e for e in mesh.edges if e.flag & loose]
-
-# ---
-
-# meshes with more than one texture assigned
-# are split and saved as these foomeshes
-class FooMesh:
-
-       class FooVert:
-               def __init__(self, v):
-                       self.v = v
-                       self.index = 0
-
-       class FooFace:
-               def __init__(self, foomesh, f):
-                       self.f = f
-                       foov = foomesh.FooVert
-                       self.v = [foov(f.v[0]), foov(f.v[1])]
-                       len_fv = len(f.v)
-                       if len_fv > 2 and f.v[2]:
-                               self.v.append(foov(f.v[2]))
-                               if len_fv > 3 and f.v[3]: self.v.append(foov(f.v[3]))
-
-               def __getattr__(self, attr):
-                       if attr == 'v': return self.v
-                       return getattr(self.f, attr)
-
-               def __len__(self):
-                       return len(self.f)
-
-       def __init__(self, tex, faces, mesh):
-               self.name = mesh.name
-               self.mesh = mesh
-               self.looseEdges = []
-               self.faceUV = mesh.faceUV
-               self.degr = mesh.degr
-               vidxs = [0]*len(mesh.verts)
-               foofaces = []
-               for f in faces:
-                       foofaces.append(self.FooFace(self, f))
-                       for v in f.v:
-                               if v: vidxs[v.index] = 1
-               i = 0
-               fooverts = []
-               for v in mesh.verts:
-                       if vidxs[v.index]:
-                               fooverts.append(v)
-                               vidxs[v.index] = i
-                               i += 1
-               for f in foofaces:
-                       for v in f.v:
-                               if v: v.index = vidxs[v.v.index]
-               self.faces = foofaces
-               self.verts = fooverts
-
-
-class AC3DExport: # the ac3d exporter part
-
-       def __init__(self, scene_objects, file):
-
-               global ARG, SKIP_DATA, ADD_DEFAULT_MAT, DEFAULT_MAT
-
-               header = 'AC3Db'
-               self.file = file
-               self.buf = ''
-               self.mbuf = []
-               self.mlist = []
-               world_kids = 0
-               parents_list = self.parents_list = []
-               kids_dict = self.kids_dict = {}
-               objs = []
-               exp_objs = self.exp_objs = []
-               tree = {}
-
-               file.write(header+'\n')
-
-               objs = \
-                       [o for o in scene_objects if o.type in ['Mesh', 'Empty']]
-
-               # create a tree from parents to children objects
-
-               for obj in objs[:]:
-                       parent = obj.parent
-                       lineage = [obj]
-
-                       while parent:
-                               parents_list.append(parent.name)
-                               obj = parent
-                               parent = parent.getParent()
-                               lineage.insert(0, obj)
-
-                       d = tree
-                       for i in xrange(len(lineage)):
-                               lname = lineage[i].getType()[:2] + lineage[i].name
-                               if lname not in d.keys():
-                                       d[lname] = {}
-                               d = d[lname]
-
-               # traverse the tree to get an ordered list of names of objects to export
-               self.traverse_dict(tree)
-
-               world_kids = len(tree.keys())
-
-               # get list of objects to export, start writing the .ac file
-
-               objlist = [Object.Get(name) for name in exp_objs]
-
-               meshlist = [o for o in objlist if o.type == 'Mesh']
-
-               # create a temporary mesh to hold actual (modified) mesh data
-               TMP_mesh = Mesh.New('tmp_for_ac_export')
-
-               # write materials
-
-               self.MATERIALS(meshlist, TMP_mesh)
-               mbuf = self.mbuf
-               if not mbuf or ADD_DEFAULT_MAT:
-                       mbuf.insert(0, "%s\n" % DEFAULT_MAT)
-               mbuf = "".join(mbuf)
-               file.write(mbuf)
-
-               file.write('OBJECT world\nkids %s\n' % world_kids)
-
-               # write the objects
-
-               for obj in objlist:
-                       self.obj = obj
-
-                       objtype = obj.type
-                       objname = obj.name
-                       kidsnum = kids_dict[objname]
-
-                       # A parent plus its children are exported as a group.
-                       # If the parent is a mesh, its rot and loc are exported as the
-                       # group rot and loc and the mesh (w/o rot and loc) is added to the group.
-                       if kidsnum:
-                               self.OBJECT('group')
-                               self.name(objname)
-                               if objtype == 'Mesh':
-                                       kidsnum += 1
-                               if not GLOBAL_COORDS:
-                                       localmatrix = obj.getMatrix('localspace')
-                                       if not obj.getParent():
-                                               localmatrix *= BLEND_TO_AC3D_MATRIX
-                                       self.rot(localmatrix.rotationPart()) 
-                                       self.loc(localmatrix.translationPart())
-                               self.kids(kidsnum)
-
-                       if objtype == 'Mesh':
-                               mesh = TMP_mesh # temporary mesh to hold actual (modified) mesh data
-                               mesh.getFromObject(objname)
-                               self.mesh = mesh
-                               if mesh.faceUV:
-                                       meshes = self.split_mesh(mesh)
-                               else:
-                                       meshes = [mesh]
-                               if len(meshes) > 1:
-                                       if NO_SPLIT or self.dont_split(objname):
-                                               self.export_mesh(mesh, ob)
-                                               REPORT_DATA['nosplit'].append(objname)
-                                       else:
-                                               self.OBJECT('group')
-                                               self.name(objname)
-                                               self.kids(len(meshes))
-                                               counter = 0
-                                               for me in meshes:
-                                                       self.export_mesh(me, obj,
-                                                               name = '%s_%s' % (obj.name, counter), foomesh = True)
-                                                       self.kids()
-                                                       counter += 1
-                               else:
-                                       self.export_mesh(mesh, obj)
-                                       self.kids()
-
-
-       def traverse_dict(self, d):
-               kids_dict = self.kids_dict
-               exp_objs = self.exp_objs
-               keys = d.keys()
-               keys.sort() # sort for predictable output
-               keys.reverse()
-               for k in keys:
-                       objname = k[2:]
-                       klen = len(d[k])
-                       kids_dict[objname] = klen
-                       if self.dont_export(objname):
-                               d.pop(k)
-                               parent = Object.Get(objname).getParent()
-                               if parent: kids_dict[parent.name] -= 1
-                               REPORT_DATA['noexport'].append(objname)
-                               continue
-                       if klen:
-                               self.traverse_dict(d[k])
-                               exp_objs.insert(0, objname)
-                       else:
-                               if k.find('Em', 0) == 0: # Empty w/o children
-                                       d.pop(k)
-                                       parent = Object.Get(objname).getParent()
-                                       if parent: kids_dict[parent.name] -= 1
-                               else:
-                                       exp_objs.insert(0, objname)
-
-       def dont_export(self, name): # if name starts with '!' or '#'
-               length = len(name)
-               if length >= 1:
-                       if name[0] in TOKENS_DONT_EXPORT: # '!' or '#' doubled (escaped): export
-                               if length > 1 and name[1] == name[0]:
-                                       return 0
-                               return 1
-
-       def dont_split(self, name): # if name starts with '=' or '$'
-               length = len(name)
-               if length >= 1:
-                       if name[0] in TOKENS_DONT_SPLIT: # '=' or '$' doubled (escaped): split
-                               if length > 1 and name[1] == name[0]:
-                                       return 0
-                               return 1
-
-       def split_mesh(self, mesh):
-               tex_dict = {0:[]}
-               for f in mesh.faces:
-                       if f.image:
-                               if not f.image.name in tex_dict: tex_dict[f.image.name] = []
-                               tex_dict[f.image.name].append(f)
-                       else: tex_dict[0].append(f)
-               keys = tex_dict.keys()
-               len_keys = len(keys)
-               if not tex_dict[0]:
-                       len_keys -= 1
-                       tex_dict.pop(0)
-                       keys.remove(0)
-               elif len_keys > 1:
-                       lines = []
-                       anyimgkey = [k for k in keys if k != 0][0]
-                       for f in tex_dict[0]:
-                               if len(f.v) < 3:
-                                       lines.append(f)
-                       if len(tex_dict[0]) == len(lines):
-                               for l in lines:
-                                       tex_dict[anyimgkey].append(l)
-                               len_keys -= 1
-                               tex_dict.pop(0)
-               if len_keys > 1:
-                       foo_meshes = []
-                       for k in keys:
-                               faces = tex_dict[k]
-                               foo_meshes.append(FooMesh(k, faces, mesh))
-                       foo_meshes[0].edges = get_loose_edges(mesh)
-                       return foo_meshes
-               return [mesh]
-
-       def export_mesh(self, mesh, obj, name = None, foomesh = False):
-               file = self.file
-               self.OBJECT('poly')
-               if not name: name = obj.name
-               self.name(name)
-               if not SKIP_DATA:
-                       meshname = obj.getData(name_only = True)
-                       self.data(len(meshname), meshname)
-               if mesh.faceUV:
-                       texline = self.texture(mesh.faces)
-                       if texline: file.write(texline)
-               if AC3D_4:
-                       self.crease(mesh.degr)
-
-               # If exporting using local coordinates, children object coordinates should not be
-               # transformed to ac3d's coordinate system, since that will be accounted for in
-               # their topmost parents (the parents w/o parents) transformations.
-               if not GLOBAL_COORDS:
-                       # We hold parents in a list, so they also don't get transformed,
-                       # because for each parent we create an ac3d group to hold both the
-                       # parent and its children.
-                       if obj.name not in self.parents_list:
-                               localmatrix = obj.getMatrix('localspace')
-                               if not obj.getParent():
-                                       localmatrix *= BLEND_TO_AC3D_MATRIX
-                               self.rot(localmatrix.rotationPart())
-                               self.loc(localmatrix.translationPart())
-                       matrix = None
-               else:
-                       matrix = obj.getMatrix() * BLEND_TO_AC3D_MATRIX
-
-               self.numvert(mesh.verts, matrix)
-               self.numsurf(mesh, foomesh)
-
-       def MATERIALS(self, meshlist, me):
-               for meobj in meshlist:
-                       me.getFromObject(meobj)
-                       mats = me.materials
-                       mbuf = []
-                       mlist = self.mlist
-                       for m in mats:
-                               if not m: continue
-                               name = m.name
-                               if name not in mlist:
-                                       mlist.append(name)
-                                       M = Material.Get(name)
-                                       material = 'MATERIAL "%s"' % name
-                                       mirCol = "%s %s %s" % (Round_s(M.mirCol[0]), Round_s(M.mirCol[1]),
-                                               Round_s(M.mirCol[2]))
-                                       rgb = "rgb %s %s %s" % (Round_s(M.R), Round_s(M.G), Round_s(M.B))
-                                       ambval = Round_s(M.amb)
-                                       amb = "amb %s %s %s" % (ambval, ambval, ambval)
-                                       spec = "spec %s %s %s" % (Round_s(M.specCol[0]),
-                                                Round_s(M.specCol[1]), Round_s(M.specCol[2]))
-                                       if AC3D_4:
-                                               emit = Round_s(M.emit)
-                                               emis = "emis %s %s %s" % (emit, emit, emit)
-                                               shival = int(M.spec * 64)
-                                       else:
-                                               emis = "emis 0 0 0"
-                                               shival = 72
-                                       shi = "shi %s" % shival
-                                       trans = "trans %s" % (Round_s(1 - M.alpha))
-                                       if MIRCOL_AS_AMB:
-                                               amb = "amb %s" % mirCol 
-                                       if MIRCOL_AS_EMIS:
-                                               emis = "emis %s" % mirCol
-                                       mbuf.append("%s %s %s %s %s %s %s\n" \
-                                               % (material, rgb, amb, emis, spec, shi, trans))
-                       self.mlist = mlist
-                       self.mbuf.append("".join(mbuf))
-
-       def OBJECT(self, type):
-               self.file.write('OBJECT %s\n' % type)
-
-       def name(self, name):
-               if name[0] in TOKENS_DONT_EXPORT or name[0] in TOKENS_DONT_SPLIT:
-                       if len(name) > 1: name = name[1:]
-               self.file.write('name "%s"\n' % name)
-
-       def kids(self, num = 0):
-               self.file.write('kids %s\n' % num)
-
-       def data(self, num, str):
-               self.file.write('data %s\n%s\n' % (num, str))
-
-       def texture(self, faces):
-               tex = ""
-               for f in faces:
-                       if f.image:
-                               tex = f.image.name
-                               break
-               if tex:
-                       image = Image.Get(tex)
-                       texfname = image.filename
-                       if SET_TEX_DIR:
-                               texfname = bsys.basename(texfname)
-                               if TEX_DIR:
-                                       texfname = bsys.join(TEX_DIR, texfname)
-                       buf = 'texture "%s"\n' % texfname
-                       xrep = image.xrep
-                       yrep = image.yrep
-                       buf += 'texrep %s %s\n' % (xrep, yrep)
-                       self.file.write(buf)
-
-       def rot(self, matrix):
-               rot = ''
-               not_I = 0 # not identity
-               matstr = []
-               for i in [0, 1, 2]:
-                       r = map(Round_s, matrix[i])
-                       not_I += (r[0] != '0')+(r[1] != '0')+(r[2] != '0')
-                       not_I -= (r[i] == '1')
-                       for j in [0, 1, 2]:
-                               matstr.append(' %s' % r[j])
-               if not_I: # no need to write identity
-                       self.file.write('rot%s\n' % "".join(matstr))
-                               
-       def loc(self, loc):
-               loc = map(Round_s, loc)
-               if loc != ['0', '0', '0']: # no need to write default
-                       self.file.write('loc %s %s %s\n' % (loc[0], loc[1], loc[2]))
-
-       def crease(self, crease):
-               self.file.write('crease %f\n' % crease)
-
-       def numvert(self, verts, matrix):
-               file = self.file
-               nvstr = []
-               nvstr.append("numvert %s\n" % len(verts))
-
-               if matrix:
-                       verts = transform_verts(verts, matrix)
-                       for v in verts:
-                               v = map (Round_s, v)
-                               nvstr.append("%s %s %s\n" % (v[0], v[1], v[2]))
-               else:
-                       for v in verts:
-                               v = map(Round_s, v.co)
-                               nvstr.append("%s %s %s\n" % (v[0], v[1], v[2]))
-
-               file.write("".join(nvstr))
-
-       def numsurf(self, mesh, foomesh = False):
-
-               global MATIDX_ERROR
-
-               # local vars are faster and so better in tight loops
-               lc_ADD_DEFAULT_MAT = ADD_DEFAULT_MAT
-               lc_MATIDX_ERROR = MATIDX_ERROR
-               lc_PER_FACE_1_OR_2_SIDED = PER_FACE_1_OR_2_SIDED
-               lc_FACE_TWOSIDED = FACE_TWOSIDED
-               lc_MESH_TWOSIDED = MESH_TWOSIDED
-
-               faces = mesh.faces
-               hasFaceUV = mesh.faceUV
-               if foomesh:
-                       looseEdges = mesh.looseEdges
-               else:
-                       looseEdges = get_loose_edges(mesh)
-
-               file = self.file
-               file.write("numsurf %s\n" % (len(faces) + len(looseEdges)))
-
-               if not foomesh: verts = list(self.mesh.verts)
-
-               materials = self.mesh.materials
-               mlist = self.mlist
-               matidx_error_reported = False
-               objmats = []
-               for omat in materials:
-                       if omat: objmats.append(omat.name)
-                       else: objmats.append(None)
-               for f in faces:
-                       if not objmats:
-                               m_idx = 0
-                       elif objmats[f.mat] in mlist:
-                               m_idx = mlist.index(objmats[f.mat])
-                       else:
-                               if not lc_MATIDX_ERROR:
-                                       rdat = REPORT_DATA['warns']
-                                       rdat.append("Object %s" % self.obj.name)
-                                       rdat.append("has at least one material *index* assigned but not")
-                                       rdat.append("defined (not linked to an existing material).")
-                                       rdat.append("Result: some faces may be exported with a wrong color.")
-                                       rdat.append("You can assign materials in the Edit Buttons window (F9).")
-                               elif not matidx_error_reported:
-                                       midxmsg = "- Same for object %s." % self.obj.name
-                                       REPORT_DATA['warns'].append(midxmsg)
-                               lc_MATIDX_ERROR += 1
-                               matidx_error_reported = True
-                               m_idx = 0
-                               if lc_ADD_DEFAULT_MAT: m_idx -= 1
-                       refs = len(f)
-                       flaglow = 0 # polygon
-                       if lc_PER_FACE_1_OR_2_SIDED and hasFaceUV: # per face attribute
-                               two_side = f.mode & lc_FACE_TWOSIDED
-                       else: # global, for the whole mesh
-                               two_side = self.mesh.mode & lc_MESH_TWOSIDED
-                       two_side = (two_side > 0) << 1
-                       flaghigh = f.smooth | two_side
-                       surfstr = "SURF 0x%d%d\n" % (flaghigh, flaglow)
-                       if lc_ADD_DEFAULT_MAT and objmats: m_idx += 1
-                       matstr = "mat %s\n" % m_idx
-                       refstr = "refs %s\n" % refs
-                       u, v, vi = 0, 0, 0
-                       fvstr = []
-                       if foomesh:
-                               for vert in f.v:
-                                       fvstr.append(str(vert.index))
-                                       if hasFaceUV:
-                                               u = f.uv[vi][0]
-                                               v = f.uv[vi][1]
-                                               vi += 1
-                                       fvstr.append(" %s %s\n" % (u, v))
-                       else:
-                               for vert in f.v:
-                                       fvstr.append(str(verts.index(vert)))
-                                       if hasFaceUV:
-                                               u = f.uv[vi][0]
-                                               v = f.uv[vi][1]
-                                               vi += 1
-                                       fvstr.append(" %s %s\n" % (u, v))
-
-                       fvstr = "".join(fvstr)
-
-                       file.write("%s%s%s%s" % (surfstr, matstr, refstr, fvstr))
-
-               # material for loose edges
-               edges_mat = 0 # default to first material
-               for omat in objmats: # but look for a material from this mesh
-                       if omat in mlist:
-                               edges_mat = mlist.index(omat)
-                               if lc_ADD_DEFAULT_MAT: edges_mat += 1
-                               break
-
-               for e in looseEdges:
-                       fvstr = []
-                       #flaglow = 2 # 1 = closed line, 2 = line
-                       #flaghigh = 0
-                       #surfstr = "SURF 0x%d%d\n" % (flaghigh, flaglow)
-                       surfstr = "SURF 0x02\n"
-
-                       fvstr.append("%d 0 0\n" % verts.index(e.v1))
-                       fvstr.append("%d 0 0\n" % verts.index(e.v2))
-                       fvstr = "".join(fvstr)
-
-                       matstr = "mat %d\n" % edges_mat # for now, use first material 
-                       refstr = "refs 2\n" # 2 verts
-
-                       file.write("%s%s%s%s" % (surfstr, matstr, refstr, fvstr))
-
-               MATIDX_ERROR = lc_MATIDX_ERROR
-
-# End of Class AC3DExport
-
-from Blender.Window import FileSelector
-
-def report_data():
-       global VERBOSE
-
-       if not VERBOSE: return
-
-       d = REPORT_DATA
-       msgs = {
-               '0main': '%s\nExporting meshes to AC3D format' % str(19*'-'),
-               '1warns': 'Warnings',
-               '2errors': 'Errors',
-               '3nosplit': 'Not split (because name starts with "=" or "$")',
-               '4noexport': 'Not exported (because name starts with "!" or "#")'
-       }
-       if NO_SPLIT:
-               l = msgs['3nosplit']
-               l = "%s (because OPTION NO_SPLIT is set)" % l.split('(')[0] 
-               msgs['3nosplit'] = l
-       keys = msgs.keys()
-       keys.sort()
-       for k in keys:
-               msgk = msgs[k]
-               msg = '\n'.join(d[k[1:]])
-               if msg:
-                       print '\n-%s:' % msgk
-                       print msg
-
-# File Selector callback:
-def fs_callback(filename):
-       global EXPORT_DIR, OBJS, CONFIRM_OVERWRITE, VERBOSE
-
-       if not filename.endswith('.ac'): filename = '%s.ac' % filename
-
-       if bsys.exists(filename) and CONFIRM_OVERWRITE:
-               if Blender.Draw.PupMenu('OVERWRITE?%t|File exists') != 1:
-                       return
-
-       Blender.Window.WaitCursor(1)
-       starttime = bsys.time()
-
-       export_dir = bsys.dirname(filename)
-       if export_dir != EXPORT_DIR:
-               EXPORT_DIR = export_dir
-               update_RegistryInfo()
-
-       try:
-               file = open(filename, 'w')
-       except IOError, (errno, strerror):
-               error = "IOError #%s: %s" % (errno, strerror)
-               REPORT_DATA['errors'].append("Saving failed - %s." % error)
-               error_msg = "Couldn't save file!%%t|%s" % error
-               Blender.Draw.PupMenu(error_msg)
-               return
-
-       try:
-               test = AC3DExport(OBJS, file)
-       except:
-               file.close()
-               raise
-       else:
-               file.close()
-               endtime = bsys.time() - starttime
-               REPORT_DATA['main'].append("Done. Saved to: %s" % filename)
-               REPORT_DATA['main'].append("Data exported in %.3f seconds." % endtime)
-
-       if VERBOSE: report_data()
-       Blender.Window.WaitCursor(0)
-
-
-# -- End of definitions
-
-scn = Blender.Scene.GetCurrent()
-
-if ONLY_SELECTED:
-       OBJS = list(scn.objects.context)
-else:
-       OBJS = list(scn.objects)
-
-if not OBJS:
-       Blender.Draw.PupMenu('ERROR: no objects selected')
-else:
-       fname = bsys.makename(ext=".ac")
-       if EXPORT_DIR:
-               fname = bsys.join(EXPORT_DIR, bsys.basename(fname))
-       FileSelector(fs_callback, "Export AC3D", fname)
diff --git a/release/scripts/ac3d_import.py b/release/scripts/ac3d_import.py
deleted file mode 100644 (file)
index 2f5512e..0000000
+++ /dev/null
@@ -1,783 +0,0 @@
-#!BPY
-
-""" Registration info for Blender menus:
-Name: 'AC3D (.ac)...'
-Blender: 243
-Group: 'Import'
-Tip: 'Import an AC3D (.ac) file.'
-"""
-
-__author__ = "Willian P. Germano"
-__url__ = ("blender", "blenderartists.org", "AC3D's homepage, http://www.ac3d.org",
-       "PLib 3d gaming lib, http://plib.sf.net")
-__version__ = "2.48.1 2009-01-11"
-
-__bpydoc__ = """\
-This script imports AC3D models into Blender.
-
-AC3D is a simple and affordable commercial 3d modeller also built with OpenGL.
-The .ac file format is an easy to parse text format well supported,
-for example, by the PLib 3d gaming library.
-
-Supported:<br>
-    UV-textured meshes with hierarchy (grouping) information.
-
-Missing:<br>
-    The url tag is irrelevant for Blender.
-
-Known issues:<br>
-    - Some objects may be imported with wrong normals due to wrong information in the model itself. This can be noticed by strange shading, like darker than expected parts in the model. To fix this, select the mesh with wrong normals, enter edit mode and tell Blender to recalculate the normals, either to make them point outside (the usual case) or inside.<br>
-Config Options:<br>
-    - display transp (toggle): if "on", objects that have materials with alpha < 1.0 are shown with translucency (transparency) in the 3D View.<br>
-    - subdiv (toggle): if "on", ac3d objects meant to be subdivided receive a SUBSURF modifier in Blender.<br>
-    - emis as mircol: store the emissive rgb color from AC3D as mirror color in Blender -- this is a hack to preserve the values and be able to export them using the equivalent option in the exporter.<br>
-    - textures dir (string): if non blank, when imported texture paths are
-wrong in the .ac file, Blender will also look for them at this dir.
-
-Notes:<br>
-   - When looking for assigned textures, Blender tries in order: the actual
-paths from the .ac file, the .ac file's dir and the default textures dir path
-users can configure (see config options above).
-"""
-
-# $Id$
-#
-# --------------------------------------------------------------------------
-# AC3DImport version 2.43.1 Feb 21, 2007
-# Program versions: Blender 2.43 and AC3Db files (means version 0xb)
-# changed: better triangulation of ngons, more fixes to support bad .ac files,
-# option to display transp mats in 3d view, support "subdiv" tag (via SUBSURF modifier)
-# --------------------------------------------------------------------------
-# Thanks: Melchior Franz for extensive bug testing and reporting, making this
-# version cope much better with old or bad .ac files, among other improvements;
-# Stewart Andreason for reporting a serious crash; Francesco Brisa for the
-# emis as mircol functionality (w/ patch).
-# --------------------------------------------------------------------------
-# ***** BEGIN GPL LICENSE BLOCK *****
-#
-# Copyright (C) 2004-2009: Willian P. Germano, wgermano _at_ ig.com.br
-#
-# 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 *****
-# --------------------------------------------------------------------------
-
-from math import radians
-
-import Blender
-from Blender import Scene, Object, Mesh, Lamp, Registry, sys as bsys, Window, Image, Material, Modifier
-from Blender.sys import dirsep
-from Blender.Mathutils import Vector, Matrix, Euler
-from Blender.Geometry import PolyFill
-
-# Default folder for AC3D textures, to override wrong paths, change to your
-# liking or leave as "":
-TEXTURES_DIR = ""
-
-DISPLAY_TRANSP = True
-
-SUBDIV = True
-
-EMIS_AS_MIRCOL = False
-
-
-tooltips = {
-       'DISPLAY_TRANSP': 'Turn transparency on in the 3d View for objects using materials with alpha < 1.0.',
-       'SUBDIV': 'Apply a SUBSURF modifier to objects meant to appear subdivided.',
-       'TEXTURES_DIR': 'Additional folder to look for missing textures.',
-       'EMIS_AS_MIRCOL': 'Store emis color as mirror color in Blender.'        
-}
-
-def update_registry():
-       global TEXTURES_DIR, DISPLAY_TRANSP, EMIS_AS_MIRCOL
-       rd = dict([('tooltips', tooltips), ('TEXTURES_DIR', TEXTURES_DIR), ('DISPLAY_TRANSP', DISPLAY_TRANSP), ('SUBDIV', SUBDIV), ('EMIS_AS_MIRCOL', EMIS_AS_MIRCOL)])
-       Registry.SetKey('ac3d_import', rd, True)
-
-rd = Registry.GetKey('ac3d_import', True)
-
-if rd:
-       if 'GROUP' in rd:
-               update_registry()
-       try:
-               TEXTURES_DIR = rd['TEXTURES_DIR']
-               DISPLAY_TRANSP = rd['DISPLAY_TRANSP']
-               SUBDIV = rd['SUBDIV']
-               EMIS_AS_MIRCOL = rd['EMIS_AS_MIRCOL']
-       except:
-               update_registry()
-else: update_registry()
-
-if TEXTURES_DIR:
-       oldtexdir = TEXTURES_DIR
-       if dirsep == '/': TEXTURES_DIR = TEXTURES_DIR.replace('\\', '/')
-       if TEXTURES_DIR[-1] != dirsep: TEXTURES_DIR = "%s%s" % (TEXTURES_DIR, dirsep)
-       if oldtexdir != TEXTURES_DIR: update_registry()
-
-
-VERBOSE = True
-rd = Registry.GetKey('General', True)
-if rd:
-       if rd.has_key('verbose'):
-               VERBOSE = rd['verbose']
-
-       
-errmsg = ""
-
-# Matrix to align ac3d's coordinate system with Blender's one,
-# it's a -90 degrees rotation around the x axis:
-AC_TO_BLEND_MATRIX = Matrix([1, 0, 0], [0, 0, 1], [0, -1, 0])
-
-AC_WORLD = 0
-AC_GROUP = 1
-AC_POLY = 2
-AC_LIGHT = 3
-AC_OB_TYPES = {
-       'world': AC_WORLD,
-       'group': AC_GROUP,
-       'poly':  AC_POLY,
-       'light':  AC_LIGHT
-       }
-
-AC_OB_BAD_TYPES_LIST = [] # to hold references to unknown (wrong) ob types
-
-def inform(msg):
-       global VERBOSE
-       if VERBOSE: print msg
-
-def euler_in_radians(eul):
-       "Used while there's a bug in the BPY API"
-       eul.x = radians(eul.x)
-       eul.y = radians(eul.y)
-       eul.z = radians(eul.z)
-       return eul
-
-class Obj:
-       
-       def __init__(self, type):
-               self.type = type
-               self.dad = None
-               self.name = ''
-               self.data = ''
-               self.tex = ''
-               self.texrep = [1,1]
-               self.texoff = None
-               self.loc = []
-               self.rot = []
-               self.size = []
-               self.crease = 30
-               self.subdiv = 0
-               self.vlist = []
-               self.flist_cfg = []
-               self.flist_v = []
-               self.flist_uv = []
-               self.elist = []
-               self.matlist = []
-               self.kids = 0
-
-               self.bl_obj = None # the actual Blender object created from this data
-
-class AC3DImport:
-
-       def __init__(self, filename):
-
-               global errmsg
-
-               self.scene = Scene.GetCurrent()
-
-               self.i = 0
-               errmsg = ''
-               self.importdir = bsys.dirname(filename)
-               try:
-                       file = open(filename, 'r')
-               except IOError, (errno, strerror):
-                       errmsg = "IOError #%s: %s" % (errno, strerror)
-                       Blender.Draw.PupMenu('ERROR: %s' % errmsg)
-                       inform(errmsg)
-                       return None
-               header = file.read(5)
-               header, version = header[:4], header[-1]
-               if header != 'AC3D':
-                       file.close()
-                       errmsg = 'AC3D header not found (invalid file)'
-                       Blender.Draw.PupMenu('ERROR: %s' % errmsg)
-                       inform(errmsg)
-                       return None
-               elif version != 'b':
-                       inform('AC3D file version 0x%s.' % version)
-                       inform('This importer is for version 0xb, so it may fail.')
-
-               self.token = {'OBJECT':         self.parse_obj,
-                                         'numvert':    self.parse_vert,
-                                         'numsurf':    self.parse_surf,
-                                         'name':               self.parse_name,
-                                         'data':               self.parse_data,
-                                         'kids':               self.parse_kids,
-                                         'loc':                self.parse_loc,
-                                         'rot':                self.parse_rot,
-                                         'MATERIAL':   self.parse_mat,
-                                         'texture':    self.parse_tex,
-                                         'texrep':             self.parse_texrep,
-                                         'texoff':             self.parse_texoff,
-                                         'subdiv':             self.parse_subdiv,
-                                         'crease':             self.parse_crease}
-
-               self.objlist = []
-               self.mlist = []
-               self.kidsnumlist = []
-               self.dad = None
-
-               self.lines = file.readlines()
-               self.lines.append('')
-               self.parse_file()
-     &