- use relative imports for packages
- reload() has been removed from pythons builtins. use imp.reload() instead (still need to apply globally). - fixed own mistake, not ignoring 'filter_glob' as a keyword argument (broke fbx, obj, 3ds export)
This commit is contained in:
@@ -26,9 +26,8 @@ data = _bpy.data
|
|||||||
context = _bpy.context
|
context = _bpy.context
|
||||||
|
|
||||||
# python modules
|
# python modules
|
||||||
from bpy import utils, path
|
from . import utils, path
|
||||||
|
from . import ops as _ops_module
|
||||||
from bpy import ops as _ops_module
|
|
||||||
|
|
||||||
# fake operator module
|
# fake operator module
|
||||||
ops = _ops_module.ops_fake_module
|
ops = _ops_module.ops_fake_module
|
||||||
|
|||||||
@@ -23,13 +23,12 @@ This module contains utility functions specific to blender but
|
|||||||
not assosiated with blenders internal data.
|
not assosiated with blenders internal data.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import bpy as _bpy
|
|
||||||
import os as _os
|
|
||||||
import sys as _sys
|
|
||||||
|
|
||||||
from _bpy import blend_paths, user_resource
|
from _bpy import blend_paths, user_resource
|
||||||
from _bpy import script_paths as _bpy_script_paths
|
from _bpy import script_paths as _bpy_script_paths
|
||||||
|
|
||||||
|
import bpy as _bpy
|
||||||
|
import os as _os
|
||||||
|
import sys as _sys
|
||||||
|
|
||||||
def _test_import(module_name, loaded_modules):
|
def _test_import(module_name, loaded_modules):
|
||||||
import traceback
|
import traceback
|
||||||
|
|||||||
@@ -83,6 +83,9 @@ def get_console(console_id):
|
|||||||
namespace["bpy"] = bpy
|
namespace["bpy"] = bpy
|
||||||
namespace["C"] = bpy.context
|
namespace["C"] = bpy.context
|
||||||
|
|
||||||
|
namespace.update(__import__("mathutils").__dict__) # from mathutils import *
|
||||||
|
namespace.update(__import__("math").__dict__) # from math import *
|
||||||
|
|
||||||
console = InteractiveConsole(locals=namespace, filename="<blender_console>")
|
console = InteractiveConsole(locals=namespace, filename="<blender_console>")
|
||||||
|
|
||||||
if _BPY_MAIN_OWN:
|
if _BPY_MAIN_OWN:
|
||||||
@@ -263,6 +266,7 @@ def banner(context):
|
|||||||
add_scrollback("Autocomplete: Ctrl+Space", 'OUTPUT')
|
add_scrollback("Autocomplete: Ctrl+Space", 'OUTPUT')
|
||||||
add_scrollback("Ctrl +/- Wheel: Zoom", 'OUTPUT')
|
add_scrollback("Ctrl +/- Wheel: Zoom", 'OUTPUT')
|
||||||
add_scrollback("Builtin Modules: bpy, bpy.data, bpy.ops, bpy.props, bpy.types, bpy.context, bgl, blf, mathutils", 'OUTPUT')
|
add_scrollback("Builtin Modules: bpy, bpy.data, bpy.ops, bpy.props, bpy.types, bpy.context, bgl, blf, mathutils", 'OUTPUT')
|
||||||
|
add_scrollback("Convenience Imports: from mathutils import *; from math import *", 'OUTPUT')
|
||||||
add_scrollback("", 'OUTPUT')
|
add_scrollback("", 'OUTPUT')
|
||||||
add_scrollback(" WARNING!!! Blender 2.5 API is subject to change, see API reference for more info.", 'ERROR')
|
add_scrollback(" WARNING!!! Blender 2.5 API is subject to change, see API reference for more info.", 'ERROR')
|
||||||
add_scrollback("", 'OUTPUT')
|
add_scrollback("", 'OUTPUT')
|
||||||
|
|||||||
@@ -20,9 +20,9 @@
|
|||||||
|
|
||||||
# To support reload properly, try to access a package var, if it's there, reload everything
|
# To support reload properly, try to access a package var, if it's there, reload everything
|
||||||
if "bpy" in locals():
|
if "bpy" in locals():
|
||||||
# only reload if we alredy loaded, highly annoying
|
from imp import reload
|
||||||
import sys
|
if "import_bvh" in locals():
|
||||||
reload(sys.modules.get("io_anim_bvh.import_bvh", sys))
|
reload(import_bvh)
|
||||||
|
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
@@ -56,8 +56,8 @@ class BvhImporter(bpy.types.Operator, ImportHelper):
|
|||||||
default='NATIVE')
|
default='NATIVE')
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
import io_anim_bvh.import_bvh
|
from . import import_bvh
|
||||||
return io_anim_bvh.import_bvh.load(self, context, **self.as_keywords(ignore=("filter_glob",)))
|
return import_bvh.load(self, context, **self.as_keywords(ignore=("filter_glob",)))
|
||||||
|
|
||||||
|
|
||||||
def menu_func(self, context):
|
def menu_func(self, context):
|
||||||
|
|||||||
@@ -18,8 +18,9 @@
|
|||||||
|
|
||||||
# To support reload properly, try to access a package var, if it's there, reload everything
|
# To support reload properly, try to access a package var, if it's there, reload everything
|
||||||
if "bpy" in locals():
|
if "bpy" in locals():
|
||||||
import sys
|
from imp import reload
|
||||||
reload(sys.modules.get("io_mesh_ply.export_ply", sys))
|
if "export_ply" in locals():
|
||||||
|
reload(export_ply)
|
||||||
|
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
@@ -47,8 +48,8 @@ class ExportPLY(bpy.types.Operator, ExportHelper):
|
|||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
filepath = self.filepath
|
filepath = self.filepath
|
||||||
filepath = bpy.path.ensure_ext(filepath, self.filename_ext)
|
filepath = bpy.path.ensure_ext(filepath, self.filename_ext)
|
||||||
import io_mesh_ply.export_ply
|
from . import export_ply
|
||||||
return io_mesh_ply.export_ply.save(self, context, **self.as_keywords(ignore=("check_existing",)))
|
return export_ply.save(self, context, **self.as_keywords(ignore=("check_existing", "filter_glob")))
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
|
|||||||
@@ -20,9 +20,11 @@
|
|||||||
|
|
||||||
# To support reload properly, try to access a package var, if it's there, reload everything
|
# To support reload properly, try to access a package var, if it's there, reload everything
|
||||||
if "bpy" in locals():
|
if "bpy" in locals():
|
||||||
import sys
|
from imp import reload
|
||||||
reload(sys.modules.get("io_scene_3ds.import_3ds", sys))
|
if "import_3ds" in locals():
|
||||||
reload(sys.modules.get("io_scene_3ds.export_3ds", sys))
|
reload(import_3ds)
|
||||||
|
if "export_3ds" in locals():
|
||||||
|
reload(export_3ds)
|
||||||
|
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
@@ -43,8 +45,8 @@ class Import3DS(bpy.types.Operator, ImportHelper):
|
|||||||
use_apply_transform = BoolProperty(name="Apply Transform", description="Workaround for object transformations importing incorrectly", default=True)
|
use_apply_transform = BoolProperty(name="Apply Transform", description="Workaround for object transformations importing incorrectly", default=True)
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
import io_scene_3ds.import_3ds
|
from . import import_3ds
|
||||||
return io_scene_3ds.import_3ds.load(self, context, **self.as_keywords(ignore=("filter_glob",)))
|
return import_3ds.load(self, context, **self.as_keywords(ignore=("filter_glob",)))
|
||||||
|
|
||||||
|
|
||||||
class Export3DS(bpy.types.Operator, ExportHelper):
|
class Export3DS(bpy.types.Operator, ExportHelper):
|
||||||
@@ -56,8 +58,8 @@ class Export3DS(bpy.types.Operator, ExportHelper):
|
|||||||
filter_glob = StringProperty(default="*.3ds", options={'HIDDEN'})
|
filter_glob = StringProperty(default="*.3ds", options={'HIDDEN'})
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
import io_scene_3ds.export_3ds
|
from . import export_3ds
|
||||||
return io_scene_3ds.export_3ds.save(self, context, **self.as_keywords(ignore=("check_existing",)))
|
return export_3ds.save(self, context, **self.as_keywords(ignore=("check_existing", "filter_glob")))
|
||||||
|
|
||||||
|
|
||||||
# Add to a menu
|
# Add to a menu
|
||||||
|
|||||||
@@ -20,9 +20,9 @@
|
|||||||
|
|
||||||
# To support reload properly, try to access a package var, if it's there, reload everything
|
# To support reload properly, try to access a package var, if it's there, reload everything
|
||||||
if "bpy" in locals():
|
if "bpy" in locals():
|
||||||
# only reload if we alredy loaded, highly annoying
|
from imp import reload
|
||||||
import sys
|
if "export_fbx" in locals():
|
||||||
reload(sys.modules.get("io_scene_fbx.export_fbx", sys))
|
reload(export_fbx)
|
||||||
|
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
@@ -87,7 +87,7 @@ class ExportFBX(bpy.types.Operator, ExportHelper):
|
|||||||
GLOBAL_MATRIX = mtx4_z90n * GLOBAL_MATRIX
|
GLOBAL_MATRIX = mtx4_z90n * GLOBAL_MATRIX
|
||||||
|
|
||||||
import io_scene_fbx.export_fbx
|
import io_scene_fbx.export_fbx
|
||||||
return io_scene_fbx.export_fbx.save(self, context, **self.as_keywords(ignore=("TX_XROT90", "TX_YROT90", "TX_ZROT90", "TX_SCALE", "check_existing")))
|
return io_scene_fbx.export_fbx.save(self, context, **self.as_keywords(ignore=("TX_XROT90", "TX_YROT90", "TX_ZROT90", "TX_SCALE", "check_existing", "filter_glob")))
|
||||||
|
|
||||||
|
|
||||||
def menu_func(self, context):
|
def menu_func(self, context):
|
||||||
|
|||||||
@@ -20,10 +20,11 @@
|
|||||||
|
|
||||||
# To support reload properly, try to access a package var, if it's there, reload everything
|
# To support reload properly, try to access a package var, if it's there, reload everything
|
||||||
if "bpy" in locals():
|
if "bpy" in locals():
|
||||||
# only reload if we alredy loaded, highly annoying
|
from imp import reload
|
||||||
import sys
|
if "import_obj" in locals():
|
||||||
reload(sys.modules.get("io_scene_obj.import_obj", sys))
|
reload(import_obj)
|
||||||
reload(sys.modules.get("io_scene_obj.export_obj", sys))
|
if "export_obj" in locals():
|
||||||
|
reload(export_obj)
|
||||||
|
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
@@ -55,8 +56,8 @@ class ImportOBJ(bpy.types.Operator, ImportHelper):
|
|||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
# print("Selected: " + context.active_object.name)
|
# print("Selected: " + context.active_object.name)
|
||||||
import io_scene_obj.import_obj
|
from . import import_obj
|
||||||
return io_scene_obj.import_obj.load(self, context, **self.as_keywords(ignore=("filter_glob",)))
|
return import_obj.load(self, context, **self.as_keywords(ignore=("filter_glob",)))
|
||||||
|
|
||||||
|
|
||||||
class ExportOBJ(bpy.types.Operator, ExportHelper):
|
class ExportOBJ(bpy.types.Operator, ExportHelper):
|
||||||
@@ -99,8 +100,8 @@ class ExportOBJ(bpy.types.Operator, ExportHelper):
|
|||||||
|
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
import io_scene_obj.export_obj
|
from . import export_obj
|
||||||
return io_scene_obj.export_obj.save(self, context, **self.as_keywords(ignore=("check_existing",)))
|
return export_obj.save(self, context, **self.as_keywords(ignore=("check_existing", "filter_glob")))
|
||||||
|
|
||||||
|
|
||||||
def menu_func_import(self, context):
|
def menu_func_import(self, context):
|
||||||
|
|||||||
@@ -18,9 +18,9 @@
|
|||||||
|
|
||||||
# To support reload properly, try to access a package var, if it's there, reload everything
|
# To support reload properly, try to access a package var, if it's there, reload everything
|
||||||
if "bpy" in locals():
|
if "bpy" in locals():
|
||||||
# only reload if we alredy loaded, highly annoying
|
from imp import reload
|
||||||
import sys
|
if "export_x3d" in locals():
|
||||||
reload(sys.modules.get("io_scene_x3d.export_x3d", sys))
|
reload(export_x3d)
|
||||||
|
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
@@ -41,8 +41,8 @@ class ExportX3D(bpy.types.Operator, ExportHelper):
|
|||||||
use_compress = BoolProperty(name="Compress", description="GZip the resulting file, requires a full python install", default=False)
|
use_compress = BoolProperty(name="Compress", description="GZip the resulting file, requires a full python install", default=False)
|
||||||
|
|
||||||
def execute(self, context):
|
def execute(self, context):
|
||||||
import io_scene_x3d.export_x3d
|
from . import export_x3d
|
||||||
return io_scene_x3d.export_x3d.save(self, context, **self.as_keywords(ignore=("check_existing",)))
|
return export_x3d.save(self, context, **self.as_keywords(ignore=("check_existing", "filter_glob")))
|
||||||
|
|
||||||
|
|
||||||
def menu_func(self, context):
|
def menu_func(self, context):
|
||||||
|
|||||||
@@ -20,10 +20,11 @@
|
|||||||
|
|
||||||
# To support reload properly, try to access a package var, if it's there, reload everything
|
# To support reload properly, try to access a package var, if it's there, reload everything
|
||||||
if "bpy" in locals():
|
if "bpy" in locals():
|
||||||
# only reload if we alredy loaded, highly annoying
|
from imp import reload
|
||||||
import sys
|
if "import_mdd" in locals():
|
||||||
reload(sys.modules.get("io_shape_mdd.import_mdd", sys))
|
reload(import_mdd)
|
||||||
reload(sys.modules.get("io_shape_mdd.export_mdd", sys))
|
if "export_mdd" in locals():
|
||||||
|
reload(export_mdd)
|
||||||
|
|
||||||
|
|
||||||
import bpy
|
import bpy
|
||||||
@@ -54,8 +55,8 @@ class ImportMDD(bpy.types.Operator, ImportHelper):
|
|||||||
if not self.frame_start:
|
if not self.frame_start:
|
||||||
self.frame_start = scene.frame_current
|
self.frame_start = scene.frame_current
|
||||||
|
|
||||||
import io_shape_mdd.import_mdd
|
from . import import_mdd
|
||||||
return io_shape_mdd.import_mdd.load(self, context, **self.as_keywords(ignore=("filter_glob",)))
|
return import_mdd.load(self, context, **self.as_keywords(ignore=("filter_glob",)))
|
||||||
|
|
||||||
class ExportMDD(bpy.types.Operator, ExportHelper):
|
class ExportMDD(bpy.types.Operator, ExportHelper):
|
||||||
'''Animated mesh to MDD vertex keyframe file'''
|
'''Animated mesh to MDD vertex keyframe file'''
|
||||||
@@ -93,8 +94,8 @@ class ExportMDD(bpy.types.Operator, ExportHelper):
|
|||||||
if not self.fps:
|
if not self.fps:
|
||||||
self.fps = scene.render.fps
|
self.fps = scene.render.fps
|
||||||
|
|
||||||
import io_shape_mdd.export_mdd
|
from . import export_mdd
|
||||||
return io_shape_mdd.export_mdd.save(self, context, **self.as_keywords(ignore=("check_existing",)))
|
return export_mdd.save(self, context, **self.as_keywords(ignore=("check_existing", "filter_glob")))
|
||||||
|
|
||||||
|
|
||||||
def menu_func_import(self, context):
|
def menu_func_import(self, context):
|
||||||
|
|||||||
Reference in New Issue
Block a user