[Bf-extensions-cvs] [1614612f] master: io_scene_vrml2: move to contrib: T63750
meta-androcto
noreply at git.blender.org
Fri May 24 04:29:10 CEST 2019
Commit: 1614612f83ccab3de9789e14f9898ea3c970835b
Author: meta-androcto
Date: Fri May 24 12:28:47 2019 +1000
Branches: master
https://developer.blender.org/rBA1614612f83ccab3de9789e14f9898ea3c970835b
io_scene_vrml2: move to contrib: T63750
===================================================================
D io_scene_vrml2/__init__.py
D io_scene_vrml2/export_vrml2.py
===================================================================
diff --git a/io_scene_vrml2/__init__.py b/io_scene_vrml2/__init__.py
deleted file mode 100644
index e6d80db9..00000000
--- a/io_scene_vrml2/__init__.py
+++ /dev/null
@@ -1,161 +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": "VRML2 (Virtual Reality Modeling Language)",
- "author": "Campbell Barton",
- "blender": (2, 74, 0),
- "location": "File > Export",
- "description": "Exports mesh objects to VRML2, supporting vertex and material colors",
- "warning": "",
- "wiki_url": "http://wiki.blender.org/index.php/Extensions:2.6/Py/"
- "Scripts/Import-Export/VRML2",
- "support": 'OFFICIAL',
- "category": "Import-Export"}
-
-if "bpy" in locals():
- import importlib
- if "export_vrml2" in locals():
- importlib.reload(export_vrml2)
-
-
-import os
-import bpy
-from bpy.props import (
- CollectionProperty,
- StringProperty,
- BoolProperty,
- EnumProperty,
- FloatProperty,
- )
-from bpy_extras.io_utils import (
- ExportHelper,
- orientation_helper,
- path_reference_mode,
- axis_conversion,
- )
-
-
- at orientation_helper(axis_forward='Z', axis_up='Y')
-class ExportVRML(bpy.types.Operator, ExportHelper):
- """Export mesh objects as a VRML2, colors and texture coordinates"""
- bl_idname = "export_scene.vrml2"
- bl_label = "Export VRML2"
-
- filename_ext = ".wrl"
- filter_glob: StringProperty(default="*.wrl", options={'HIDDEN'})
-
- use_selection: BoolProperty(
- name="Selection Only",
- description="Export selected objects only",
- default=False,
- )
-
- use_mesh_modifiers: BoolProperty(
- name="Apply Modifiers",
- description="Apply Modifiers to the exported mesh",
- default=True,
- )
- use_color: BoolProperty(
- name="Vertex Colors",
- description="Export the active vertex color layer",
- default=True,
- )
- color_type: EnumProperty(
- name='Color',
- items=(
- ('VERTEX', "Vertex Color", ""),
- ('MATERIAL', "Material Color", "")),
- )
- use_uv: BoolProperty(
- name="Texture/UVs",
- description="Export the active texture and UV coords",
- default=True,
- )
-
- global_scale: FloatProperty(
- name="Scale",
- min=0.01, max=1000.0,
- default=1.0,
- )
-
- path_mode = path_reference_mode
-
- @classmethod
- def poll(cls, context):
- obj = context.active_object
- return (obj is not None) and obj.type == 'MESH'
-
- def execute(self, context):
- from . import export_vrml2
- from mathutils import Matrix
-
- keywords = self.as_keywords(ignore=("axis_forward",
- "axis_up",
- "global_scale",
- "check_existing",
- "filter_glob",
- ))
-
- global_matrix = axis_conversion(to_forward=self.axis_forward,
- to_up=self.axis_up,
- ).to_4x4() * Matrix.Scale(self.global_scale, 4)
- keywords["global_matrix"] = global_matrix
-
- filepath = self.filepath
- filepath = bpy.path.ensure_ext(filepath, self.filename_ext)
-
- return export_vrml2.save(self, context, **keywords)
-
- def draw(self, context):
- layout = self.layout
-
- layout.prop(self, "use_selection")
- layout.prop(self, "use_mesh_modifiers")
-
- row = layout.row()
- row.prop(self, "use_uv")
- row.prop(self, "use_color")
- row = layout.row()
- row.active = self.use_color
- row.prop(self, "color_type")
- layout.prop(self, "axis_forward")
- layout.prop(self, "axis_up")
- layout.prop(self, "global_scale")
- layout.prop(self, "path_mode")
-
-
-def menu_func_export(self, context):
- self.layout.operator(ExportVRML.bl_idname, text="VRML2 (.wrl)")
-
-
-def register():
- bpy.utils.register_module(__name__)
-
- bpy.types.TOPBAR_MT_file_export.append(menu_func_export)
-
-
-def unregister():
- bpy.utils.unregister_module(__name__)
-
- bpy.types.TOPBAR_MT_file_export.remove(menu_func_export)
-
-if __name__ == "__main__":
- register()
diff --git a/io_scene_vrml2/export_vrml2.py b/io_scene_vrml2/export_vrml2.py
deleted file mode 100644
index e4038990..00000000
--- a/io_scene_vrml2/export_vrml2.py
+++ /dev/null
@@ -1,262 +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>
-
-import bpy
-import bpy_extras
-import bmesh
-import os
-from bpy_extras import object_utils
-
-
-def save_bmesh(fw, bm,
- use_color, color_type, material_colors,
- use_uv, uv_image,
- path_mode, copy_set):
-
- base_src = os.path.dirname(bpy.data.filepath)
- base_dst = os.path.dirname(fw.__self__.name)
-
- fw('Shape {\n')
- fw('\tappearance Appearance {\n')
- if use_uv:
- fw('\t\ttexture ImageTexture {\n')
- filepath = uv_image.filepath
- filepath_full = os.path.normpath(bpy.path.abspath(filepath, library=uv_image.library))
- filepath_ref = bpy_extras.io_utils.path_reference(filepath_full, base_src, base_dst, path_mode, "textures", copy_set, uv_image.library)
- filepath_base = os.path.basename(filepath_full)
-
- images = [
- filepath_ref,
- filepath_base,
- ]
- if path_mode != 'RELATIVE':
- images.append(filepath_full)
-
- fw('\t\t\turl [ %s ]\n' % " ".join(['"%s"' % f for f in images]) )
- del images
- del filepath_ref, filepath_base, filepath_full, filepath
- fw('\t\t}\n') # end 'ImageTexture'
- else:
- fw('\t\tmaterial Material {\n')
- fw('\t\t}\n') # end 'Material'
- fw('\t}\n') # end 'Appearance'
-
- fw('\tgeometry IndexedFaceSet {\n')
- fw('\t\tcoord Coordinate {\n')
- fw('\t\t\tpoint [ ')
- v = None
- for v in bm.verts:
- fw("%.6f %.6f %.6f " % v.co[:])
- del v
- fw(']\n') # end 'point[]'
- fw('\t\t}\n') # end 'Coordinate'
-
- if use_color:
- if color_type == 'MATERIAL':
- fw('\t\tcolorPerVertex FALSE\n')
- fw('\t\tcolor Color {\n')
- fw('\t\t\tcolor [ ')
- c = None
- for c in material_colors:
- fw(c)
- del c
- fw(']\n') # end 'color[]'
- fw('\t\t}\n') # end 'Color'
- elif color_type == 'VERTEX':
- fw('\t\tcolorPerVertex TRUE\n')
- fw('\t\tcolor Color {\n')
- fw('\t\t\tcolor [ ')
- v = None
- c_none = "0.00 0.00 0.00 "
- color_layer = bm.loops.layers.color.active
- assert(color_layer is not None)
- for v in bm.verts:
- # weak, use first loops color
- try:
- l = v.link_loops[0]
- except:
- l = None
- fw(c_none if l is None else ("%.2f %.2f %.2f " % l[color_layer][:]))
-
- del v
- fw(']\n') # end 'color[]'
- fw('\t\t}\n') # end 'Color'
-
- # ---
-
- if color_type == 'MATERIAL':
- fw('\t\tcolorIndex [ ')
- i = None
- for f in bm.faces:
- i = f.material_index
- if i >= len(material_colors):
- i = 0
- fw("%d " % i)
- del i
- fw(']\n') # end 'colorIndex[]'
- elif color_type == 'VERTEX':
- pass
-
- if use_uv:
- fw('\t\ttexCoord TextureCoordinate {\n')
- fw('\t\t\tpoint [ ')
- v = None
- uv_layer = bm.loops.layers.uv.active
- assert(uv_layer is not None)
- for f in bm.faces:
- for l in f.loops:
- fw("%.4f %.4f " % l[uv_layer].uv[:])
-
- del f
- fw(']\n') # end 'point[]'
- fw('\t\t}\n') # end 'TextureCoordinate'
-
- # ---
-
- fw('\t\ttexCoordIndex [ ')
- i = None
- for i in range(0, len(bm.faces) * 3, 3):
- fw("%d %d %d -1 " % (i, i + 1, i + 2))
- del i
- fw(']\n') # end 'coordIndex[]'
-
- fw('\t\tcoordIndex [ ')
- f = fv = None
- for f in bm.faces:
- fv = f.verts[:]
- fw("%d %d %d -1 " % (fv[0].index, fv[1].ind
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-extensions-cvs
mailing list