[Bf-extensions-cvs] [c6a8aaba] master: io_scene_3ds: move to contrib: T63750

meta-androcto noreply at git.blender.org
Fri May 24 03:06:44 CEST 2019


Commit: c6a8aaba3b334cde1546cd604dd49e5b28bc75ab
Author: meta-androcto
Date:   Fri May 24 11:06:23 2019 +1000
Branches: master
https://developer.blender.org/rBAc6a8aaba3b334cde1546cd604dd49e5b28bc75ab

io_scene_3ds: move to contrib: T63750

===================================================================

D	io_scene_3ds/__init__.py
D	io_scene_3ds/export_3ds.py
D	io_scene_3ds/import_3ds.py

===================================================================

diff --git a/io_scene_3ds/__init__.py b/io_scene_3ds/__init__.py
deleted file mode 100644
index 2d1fe520..00000000
--- a/io_scene_3ds/__init__.py
+++ /dev/null
@@ -1,169 +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-80 compliant>
-
-bl_info = {
-    "name": "Autodesk 3DS format",
-    "author": "Bob Holcomb, Campbell Barton",
-    "version": (1, 0, 0),
-    "blender": (2, 74, 0),
-    "location": "File > Import-Export",
-    "description": "Import-Export 3DS, meshes, uvs, materials, textures, "
-                   "cameras & lamps",
-    "warning": "",
-    "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
-                "Scripts/Import-Export/Autodesk_3DS",
-    "category": "Import-Export"}
-
-if "bpy" in locals():
-    import importlib
-    if "import_3ds" in locals():
-        importlib.reload(import_3ds)
-    if "export_3ds" in locals():
-        importlib.reload(export_3ds)
-
-
-import bpy
-from bpy.props import (
-        BoolProperty,
-        EnumProperty,
-        FloatProperty,
-        StringProperty,
-        )
-from bpy_extras.io_utils import (
-        ImportHelper,
-        ExportHelper,
-        orientation_helper,
-        axis_conversion,
-        )
-
-
- at orientation_helper(axis_forward='Y', axis_up='Z')
-class Import3DS(bpy.types.Operator, ImportHelper):
-    """Import from 3DS file format (.3ds)"""
-    bl_idname = "import_scene.autodesk_3ds"
-    bl_label = 'Import 3DS'
-    bl_options = {'UNDO'}
-
-    filename_ext = ".3ds"
-    filter_glob: StringProperty(default="*.3ds", options={'HIDDEN'})
-
-    constrain_size: FloatProperty(
-            name="Size Constraint",
-            description="Scale the model by 10 until it reaches the "
-                        "size constraint (0 to disable)",
-            min=0.0, max=1000.0,
-            soft_min=0.0, soft_max=1000.0,
-            default=10.0,
-            )
-    use_image_search: BoolProperty(
-            name="Image Search",
-            description="Search subdirectories for any associated images "
-                        "(Warning, may be slow)",
-            default=True,
-            )
-    use_apply_transform: BoolProperty(
-            name="Apply Transform",
-            description="Workaround for object transformations "
-                        "importing incorrectly",
-            default=True,
-            )
-
-    def execute(self, context):
-        from . import import_3ds
-
-        keywords = self.as_keywords(ignore=("axis_forward",
-                                            "axis_up",
-                                            "filter_glob",
-                                            ))
-
-        global_matrix = axis_conversion(from_forward=self.axis_forward,
-                                        from_up=self.axis_up,
-                                        ).to_4x4()
-        keywords["global_matrix"] = global_matrix
-
-        return import_3ds.load(self, context, **keywords)
-
-
- at orientation_helper(axis_forward='Y', axis_up='Z')
-class Export3DS(bpy.types.Operator, ExportHelper):
-    """Export to 3DS file format (.3ds)"""
-    bl_idname = "export_scene.autodesk_3ds"
-    bl_label = 'Export 3DS'
-
-    filename_ext = ".3ds"
-    filter_glob: StringProperty(
-            default="*.3ds",
-            options={'HIDDEN'},
-            )
-
-    use_selection: BoolProperty(
-            name="Selection Only",
-            description="Export selected objects only",
-            default=False,
-            )
-
-    def execute(self, context):
-        from . import export_3ds
-
-        keywords = self.as_keywords(ignore=("axis_forward",
-                                            "axis_up",
-                                            "filter_glob",
-                                            "check_existing",
-                                            ))
-        global_matrix = axis_conversion(to_forward=self.axis_forward,
-                                        to_up=self.axis_up,
-                                        ).to_4x4()
-        keywords["global_matrix"] = global_matrix
-
-        return export_3ds.save(self, context, **keywords)
-
-
-# Add to a menu
-def menu_func_export(self, context):
-    self.layout.operator(Export3DS.bl_idname, text="3D Studio (.3ds)")
-
-
-def menu_func_import(self, context):
-    self.layout.operator(Import3DS.bl_idname, text="3D Studio (.3ds)")
-
-
-def register():
-    bpy.utils.register_module(__name__)
-
-    bpy.types.TOPBAR_MT_file_import.append(menu_func_import)
-    bpy.types.TOPBAR_MT_file_export.append(menu_func_export)
-
-
-def unregister():
-    bpy.utils.unregister_module(__name__)
-
-    bpy.types.TOPBAR_MT_file_import.remove(menu_func_import)
-    bpy.types.TOPBAR_MT_file_export.remove(menu_func_export)
-
-# NOTES:
-# why add 1 extra vertex? and remove it when done? -
-#  "Answer - eekadoodle - would need to re-order UV's without this since face
-#  order isnt always what we give blender, BMesh will solve :D"
-#
-# disabled scaling to size, this requires exposing bb (easy) and understanding
-# how it works (needs some time)
-
-if __name__ == "__main__":
-    register()
diff --git a/io_scene_3ds/export_3ds.py b/io_scene_3ds/export_3ds.py
deleted file mode 100644
index a81cd11d..00000000
--- a/io_scene_3ds/export_3ds.py
+++ /dev/null
@@ -1,1173 +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 = 0x4D4D
-
-#------ Main Chunks
-OBJECTINFO = 0x3D3D  # This gives the version of the mesh and is found right before the material and object information
-VERSION = 0x0002  # This gives the version of the .3ds file
-KFDATA = 0xB000  # 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 = 0xA000  # This holds the material name
-MATAMBIENT = 0xA010  # Ambient color of the object/material
-MATDIFFUSE = 0xA020  # This holds the color of the object/material
-MATSPECULAR = 0xA030  # SPecular color of the object/material
-MATSHINESS = 0xA040  # ??
-
-MAT_DIFFUSEMAP = 0xA200  # This is a header for a new diffuse texture
-MAT_OPACMAP = 0xA210  # head for opacity map
-MAT_BUMPMAP = 0xA230  # read for normal map
-MAT_SPECMAP = 0xA204  # read for specularity map
-
-#>------ sub defines of MAT_???MAP
-MATMAPFILE = 0xA300  # This holds the file name of a texture
-
-MAT_MAP_TILING = 0xa351   # 2nd bit (from LSB) is mirror UV flag
-MAT_MAP_USCALE = 0xA354   # U axis scaling
-MAT_MAP_VSCALE = 0xA356   # V axis scaling
-MAT_MAP_UOFFSET = 0xA358  # U axis offset
-MAT_MAP_VOFFSET = 0xA35A  # V axis offset
-MAT_MAP_ANG = 0xA35C      # UV rotation around the z-axis in rad
-
-RGB1 = 0x0011
-RGB2 = 0x0012
-
-#>------ sub defines of OBJECT
-OBJECT_MESH = 0x4100  # This lets us know that we are reading a new object
-OBJECT_LIGHT = 0x4600  # This lets un know we are reading a light object
-OBJECT_CAMERA = 0x4700  # This lets un know we are reading a camera object
-
-#>------ sub defines of CAMERA
-OBJECT_CAM_RANGES = 0x4720      # The camera range values
-
-#>------ sub defines of OBJECT_MESH
-OBJECT_VERTICES = 0x4110  # The objects vertices
-OBJECT_FACES = 0x4120  # The objects faces
-OBJECT_MATERIAL = 0x4130  # This is found if the object has a material, either texture map or color
-OBJECT_UV = 0x4140  # The UV texture coordinates
-OBJECT_TRANS_MATRIX = 0x4160  # The Object Matrix
-
-#>------ sub defines of KFDATA
-KFDATA_KFHDR = 0xB00A
-KFDATA_KFSEG = 0xB008
-KFDATA_KFCURTIME = 0xB009
-KFDATA_OBJECT_NODE_TAG = 0xB002
-
-#>------ sub defines of OBJECT_NODE_TAG
-OBJECT_NODE_ID = 0xB030
-OBJECT_NODE_HDR = 0xB010
-OBJECT_PIVOT = 0xB013
-OBJECT_INSTANCE_NAME = 0xB011
-POS_TRACK_TAG = 0xB020
-ROT_TRACK_TAG = 0xB021
-SCL_TRACK_TAG = 0xB022
-
-import struct
-
-# So 3ds max can open files, limit names to 12 in length
-# this is very annoying for filenames!
-name_unique = []  # stores str, ascii only
-name_mapping = {}  # stores {orig: byte} mapping
-
-
-def sane_name(name):
-    name_fixed = name_mapping.get(name)
-

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-extensions-cvs mailing list