[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31686] trunk/blender/release/scripts: moving import/export scripts into packages (just moving scripts, need to add __init__.py still, temp break import/exporters)

Campbell Barton ideasman42 at gmail.com
Wed Sep 1 05:02:30 CEST 2010


Revision: 31686
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31686
Author:   campbellbarton
Date:     2010-09-01 05:02:30 +0200 (Wed, 01 Sep 2010)

Log Message:
-----------
moving import/export scripts into packages (just moving scripts, need to add __init__.py still, temp break import/exporters)

Added Paths:
-----------
    trunk/blender/release/scripts/op/io_3ds/
    trunk/blender/release/scripts/op/io_3ds/export_3ds.py
    trunk/blender/release/scripts/op/io_3ds/import_3ds.py
    trunk/blender/release/scripts/op/io_bvh/
    trunk/blender/release/scripts/op/io_bvh/import_bvh.py
    trunk/blender/release/scripts/op/io_fbx/
    trunk/blender/release/scripts/op/io_fbx/export_fbx.py
    trunk/blender/release/scripts/op/io_mdd/
    trunk/blender/release/scripts/op/io_mdd/export_mdd.py
    trunk/blender/release/scripts/op/io_mdd/import_mdd.py
    trunk/blender/release/scripts/op/io_obj/
    trunk/blender/release/scripts/op/io_obj/export_obj.py
    trunk/blender/release/scripts/op/io_obj/import_obj.py
    trunk/blender/release/scripts/op/io_ply/
    trunk/blender/release/scripts/op/io_ply/export_ply.py
    trunk/blender/release/scripts/op/io_x3d/
    trunk/blender/release/scripts/op/io_x3d/export_x3d.py

Removed Paths:
-------------
    trunk/blender/release/scripts/io/export_3ds.py
    trunk/blender/release/scripts/io/export_fbx.py
    trunk/blender/release/scripts/io/export_mdd.py
    trunk/blender/release/scripts/io/export_obj.py
    trunk/blender/release/scripts/io/export_ply.py
    trunk/blender/release/scripts/io/export_x3d.py
    trunk/blender/release/scripts/io/import_anim_bvh.py
    trunk/blender/release/scripts/io/import_scene_3ds.py
    trunk/blender/release/scripts/io/import_scene_obj.py
    trunk/blender/release/scripts/io/import_shape_mdd.py

Deleted: trunk/blender/release/scripts/io/export_3ds.py
===================================================================
--- trunk/blender/release/scripts/io/export_3ds.py	2010-09-01 02:48:23 UTC (rev 31685)
+++ trunk/blender/release/scripts/io/export_3ds.py	2010-09-01 03:02:30 UTC (rev 31686)
@@ -1,1055 +0,0 @@
-# ##### 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-# ##### END GPL LICENSE BLOCK #####
-
-# <pep8 compliant>
-
-# Script copyright (C) Bob Holcomb
-# Contributors: Campbell Barton, Bob Holcomb, Richard Lärkäng, Damien McGinnes, Mark Stijnman
-
-"""
-Exporting is based on 3ds loader from www.gametutorials.com(Thanks DigiBen) and using information
-from the lib3ds project (http://lib3ds.sourceforge.net/) sourcecode.
-"""
-
-######################################################
-# Data Structures
-######################################################
-
-#Some of the chunks that we will export
-#----- Primary Chunk, at the beginning of each file
-PRIMARY= int("0x4D4D",16)
-
-#------ Main Chunks
-OBJECTINFO   =      int("0x3D3D",16);      #This gives the version of the mesh and is found right before the material and object information
-VERSION      =      int("0x0002",16);      #This gives the version of the .3ds file
-KFDATA       =      int("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    =      int("0xA000",16);      # This holds the material name
-MATAMBIENT   =      int("0xA010",16);      # Ambient color of the object/material
-MATDIFFUSE   =      int("0xA020",16);      # This holds the color of the object/material
-MATSPECULAR   =      int("0xA030",16);      # SPecular color of the object/material
-MATSHINESS   =      int("0xA040",16);      # ??
-MATMAP       =      int("0xA200",16);      # This is a header for a new material
-MATMAPFILE    =      int("0xA300",16);      # This holds the file name of the texture
-
-RGB1=	int("0x0011",16)
-RGB2=	int("0x0012",16)
-
-#>------ sub defines of OBJECT
-OBJECT_MESH  =      int("0x4100",16);      # This lets us know that we are reading a new object
-OBJECT_LIGHT =      int("0x4600",16);      # This lets un know we are reading a light object
-OBJECT_CAMERA=      int("0x4700",16);      # This lets un know we are reading a camera object
-
-#>------ sub defines of CAMERA
-OBJECT_CAM_RANGES=   int("0x4720",16);      # The camera range values
-
-#>------ sub defines of OBJECT_MESH
-OBJECT_VERTICES =   int("0x4110",16);      # The objects vertices
-OBJECT_FACES    =   int("0x4120",16);      # The objects faces
-OBJECT_MATERIAL =   int("0x4130",16);      # This is found if the object has a material, either texture map or color
-OBJECT_UV       =   int("0x4140",16);      # The UV texture coordinates
-OBJECT_TRANS_MATRIX  =   int("0x4160",16); # The Object Matrix
-
-#>------ sub defines of KFDATA
-KFDATA_KFHDR            = int("0xB00A",16);
-KFDATA_KFSEG            = int("0xB008",16);
-KFDATA_KFCURTIME        = int("0xB009",16);
-KFDATA_OBJECT_NODE_TAG  = int("0xB002",16);
-
-#>------ sub defines of OBJECT_NODE_TAG
-OBJECT_NODE_ID          = int("0xB030",16);
-OBJECT_NODE_HDR         = int("0xB010",16);
-OBJECT_PIVOT            = int("0xB013",16);
-OBJECT_INSTANCE_NAME    = int("0xB011",16);
-POS_TRACK_TAG			= int("0xB020",16);
-ROT_TRACK_TAG			= int("0xB021",16);
-SCL_TRACK_TAG			= int("0xB022",16);
-
-def uv_key(uv):
-    return round(uv[0], 6), round(uv[1], 6)
-# 	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('<3B', int(255*self.r), int(255*self.g), int(255*self.b) ) )
-# 		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 range(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'

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list