[Bf-extensions-cvs] [64b1f812] master: io_scene_ms3d: move to contrib: T63750
meta-androcto
noreply at git.blender.org
Fri May 24 04:07:46 CEST 2019
Commit: 64b1f812d4e249aff579237ede8b7e908b2900a6
Author: meta-androcto
Date: Fri May 24 12:07:25 2019 +1000
Branches: master
https://developer.blender.org/rBA64b1f812d4e249aff579237ede8b7e908b2900a6
io_scene_ms3d: move to contrib: T63750
===================================================================
D io_scene_ms3d/__init__.py
D io_scene_ms3d/ms3d_export.py
D io_scene_ms3d/ms3d_import.py
D io_scene_ms3d/ms3d_spec.py
D io_scene_ms3d/ms3d_strings.py
D io_scene_ms3d/ms3d_ui.py
D io_scene_ms3d/ms3d_utils.py
===================================================================
diff --git a/io_scene_ms3d/__init__.py b/io_scene_ms3d/__init__.py
deleted file mode 100644
index 02b0e0a2..00000000
--- a/io_scene_ms3d/__init__.py
+++ /dev/null
@@ -1,100 +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>
-
-bl_info = {
- "name": "MilkShape3D MS3D format (.ms3d)",
- "description": "Import / Export MilkShape3D MS3D files "
- "(conform with MilkShape3D v1.8.4)",
- "author": "Alexander Nussbaumer",
- "version": (2, 72, 2),
- "blender": (2, 72, 2),
- "location": "File > Import & File > Export",
- "warning": "",
- "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
- "Scripts/Import-Export/MilkShape3D_MS3D",
- "category": "Import-Export",
-}
-
-
-###############################################################################
-#234567890123456789012345678901234567890123456789012345678901234567890123456789
-#--------1---------2---------3---------4---------5---------6---------7---------
-
-
-# ##### BEGIN COPYRIGHT BLOCK #####
-#
-# initial script copyright (c)2011-2013 Alexander Nussbaumer
-#
-# ##### END COPYRIGHT BLOCK #####
-
-
-# To support reload properly, try to access a package var,
-# if it's there, reload everything
-if 'bpy' in locals():
- import importlib
- if 'io_scene_ms3d.ms3d_ui' in locals():
- importlib.reload(io_scene_ms3d.ms3d_ui)
-else:
- from io_scene_ms3d.ms3d_ui import (
- Ms3dImportOperator,
- Ms3dExportOperator,
- )
-
-
-#import blender stuff
-from bpy.types import (
- TOPBAR_MT_file_export,
- TOPBAR_MT_file_import,
- )
-
-
-###############################################################################
-# registration
-def register():
- ####################
- # F8 - key
- import importlib
- importlib.reload(ms3d_ui)
- # F8 - key
- ####################
-
- ms3d_ui.register()
-
- TOPBAR_MT_file_export.append(Ms3dExportOperator.menu_func)
- TOPBAR_MT_file_import.append(Ms3dImportOperator.menu_func)
-
-
-def unregister():
- ms3d_ui.unregister()
-
- TOPBAR_MT_file_export.remove(Ms3dExportOperator.menu_func)
- TOPBAR_MT_file_import.remove(Ms3dImportOperator.menu_func)
-
-
-###############################################################################
-# global entry point
-if (__name__ == "__main__"):
- register()
-
-
-###############################################################################
-#234567890123456789012345678901234567890123456789012345678901234567890123456789
-#--------1---------2---------3---------4---------5---------6---------7---------
-# ##### END OF FILE #####
diff --git a/io_scene_ms3d/ms3d_export.py b/io_scene_ms3d/ms3d_export.py
deleted file mode 100644
index bd5d2f2f..00000000
--- a/io_scene_ms3d/ms3d_export.py
+++ /dev/null
@@ -1,945 +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>
-
-###############################################################################
-#234567890123456789012345678901234567890123456789012345678901234567890123456789
-#--------1---------2---------3---------4---------5---------6---------7---------
-
-
-# ##### BEGIN COPYRIGHT BLOCK #####
-#
-# initial script copyright (c)2011-2013 Alexander Nussbaumer
-#
-# ##### END COPYRIGHT BLOCK #####
-
-
-#import python stuff
-import io
-from math import (
- pi,
- )
-from mathutils import (
- Matrix,
- )
-from os import (
- path,
- )
-from sys import (
- exc_info,
- )
-from time import (
- time,
- )
-
-
-# import io_scene_ms3d stuff
-from io_scene_ms3d.ms3d_strings import (
- ms3d_str,
- )
-from io_scene_ms3d.ms3d_spec import (
- Ms3dSpec,
- Ms3dModel,
- Ms3dVertex,
- Ms3dTriangle,
- Ms3dGroup,
- Ms3dMaterial,
- Ms3dJoint,
- Ms3dRotationKeyframe,
- Ms3dTranslationKeyframe,
- Ms3dCommentEx,
- Ms3dComment,
- )
-from io_scene_ms3d.ms3d_utils import (
- select_all,
- enable_edit_mode,
- pre_setup_environment,
- post_setup_environment,
- matrix_difference,
- )
-from io_scene_ms3d.ms3d_ui import (
- Ms3dUi,
- Ms3dMaterialProperties,
- Ms3dMaterialHelper,
- )
-
-
-#import blender stuff
-from bpy import (
- ops,
- )
-import bmesh
-
-
-###############################################################################
-class Ms3dExporter():
- """
- Load a MilkShape3D MS3D File
- """
- def __init__(self,
- report,
- verbose='NONE',
- use_blender_names=True,
- use_blender_materials=False,
- apply_transform=True,
- apply_modifiers=True,
- apply_modifiers_mode='PREVIEW',
- use_animation=True,
- normalize_weights=True,
- shrink_to_keys=False,
- bake_each_frame=True,
- ):
- self.report = report
- self.options_verbose = verbose
- self.options_use_blender_names = use_blender_names
- self.options_use_blender_materials = use_blender_materials
- self.options_apply_transform = apply_transform
- self.options_apply_modifiers = apply_modifiers
- self.options_apply_modifiers_mode = apply_modifiers_mode
- self.options_use_animation = use_animation
- self.options_normalize_weights = normalize_weights
- self.options_shrink_to_keys = shrink_to_keys
- self.options_bake_each_frame = bake_each_frame
- pass
-
- # create a empty ms3d ms3d_model
- # fill ms3d_model with blender content
- # writer ms3d file
- def write(self, blender_context, filepath):
- """convert bender content to ms3d content and write it to file"""
-
- t1 = time()
- t2 = None
-
- try:
- # setup environment
- pre_setup_environment(self, blender_context)
-
- # create an empty ms3d template
- ms3d_model = Ms3dModel()
-
- # inject blender data to ms3d file
- self.from_blender(blender_context, ms3d_model)
-
- t2 = time()
-
- try:
- # write ms3d file to disk
- with io.FileIO(filepath, "wb") as raw_io:
- debug_out = ms3d_model.write(raw_io)
- raw_io.flush()
- raw_io.close()
-
- if self.options_verbose in Ms3dUi.VERBOSE_MAXIMAL:
- print(debug_out)
- finally:
- pass
-
- # if option is set, this time will enlargs the io time
- if self.options_verbose in Ms3dUi.VERBOSE_MAXIMAL:
- ms3d_model.print_internal()
-
- post_setup_environment(self, blender_context)
- # restore active object
- blender_context.view_layer.objects.active = self.active_object
-
- if ((not blender_context.view_layer.objects.active)
- and (blender_context.selected_objects)):
- blender_context.view_layer.objects.active \
- = blender_context.selected_objects[0]
-
- is_valid, statistics = ms3d_model.is_valid()
- if self.options_verbose in Ms3dUi.VERBOSE_NORMAL:
- print()
- print("##########################################################")
- print("Export from Blender to MS3D")
- print(statistics)
- print("##########################################################")
-
- except Exception:
- type, value, traceback = exc_info()
- if self.options_verbose in Ms3dUi.VERBOSE_NORMAL:
- print("write - exception in try block\n type: '{0}'\n"
- " value: '{1}'".format(type, value, traceback))
- if self.report:
- self.report({'WARNING', 'ERROR', }, "write - exception.")
-
- if t2 is None:
- t2 = time()
-
- return False
-
- else:
- pass
-
- t3 = time()
- if self.options_verbose in Ms3dUi.VERBOSE_NORMAL:
- print(ms3d_str['SUMMARY_EXPORT'].format(
- (t3 - t1), (t2 - t1), (t3 - t2)))
-
- return True
-
-
- ###########################################################################
- def from_blender(self, blender_context, ms3d_model):
- blender_mesh_objects = []
-
- source = (blender_context.active_object, )
-
- for blender_object in source:
- if blender_object and blender_object.type == 'MESH' \
-
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list