diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-01-03 02:14:01 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-01-03 02:14:01 +0300 |
commit | 04d0261c37ccd28e8466312f5a2d8260c5a4c9e9 (patch) | |
tree | 1e86df8239609c76f93d2cc15f65db27aeceef3d /release/scripts | |
parent | e7d863cee530d477f0aa494a4f0f9e70ac5012c7 (diff) |
new python submodule. eg.
from bpy.app import binary_path, version, version_string, home
can add constant variables from blender here as needed (maybe functions too... bpy.app.memory_usage() ?)
Diffstat (limited to 'release/scripts')
-rw-r--r-- | release/scripts/io/export_fbx.py | 2 | ||||
-rw-r--r-- | release/scripts/io/export_obj.py | 2 | ||||
-rw-r--r-- | release/scripts/io/export_ply.py | 2 | ||||
-rw-r--r-- | release/scripts/modules/bpy/__init__.py | 6 | ||||
-rw-r--r-- | release/scripts/modules/bpy/app.py | 26 | ||||
-rw-r--r-- | release/scripts/ui/space_info.py | 2 |
6 files changed, 31 insertions, 9 deletions
diff --git a/release/scripts/io/export_fbx.py b/release/scripts/io/export_fbx.py index 6407f9b6e49..22e75f65705 100644 --- a/release/scripts/io/export_fbx.py +++ b/release/scripts/io/export_fbx.py @@ -651,7 +651,7 @@ def write(filename, batch_objects = None, \ }''' % (curtime)) file.write('\nCreationTime: "%.4i-%.2i-%.2i %.2i:%.2i:%.2i:000"' % curtime) - file.write('\nCreator: "Blender3D version %s"' % bpy.version_string) + file.write('\nCreator: "Blender3D version %s"' % bpy.app.version_string) pose_items = [] # list of (fbxName, matrix) to write pose data for, easier to collect allong the way diff --git a/release/scripts/io/export_obj.py b/release/scripts/io/export_obj.py index 6135375d185..50a40f4662c 100644 --- a/release/scripts/io/export_obj.py +++ b/release/scripts/io/export_obj.py @@ -361,7 +361,7 @@ def write(filename, objects, scene, file = open(filename, "w") # Write Header - file.write('# Blender3D v%s OBJ File: %s\n' % (bpy.version_string, bpy.data.filename.split('/')[-1].split('\\')[-1] )) + file.write('# Blender3D v%s OBJ File: %s\n' % (bpy.app.version_string, bpy.data.filename.split('/')[-1].split('\\')[-1] )) file.write('# www.blender3d.org\n') # Tell the obj file what material file to use. diff --git a/release/scripts/io/export_ply.py b/release/scripts/io/export_ply.py index 3c9e1f86ee2..6f28b79c8f0 100644 --- a/release/scripts/io/export_ply.py +++ b/release/scripts/io/export_ply.py @@ -205,7 +205,7 @@ def write(filename, scene, ob, \ file.write('ply\n') file.write('format ascii 1.0\n') - file.write('comment Created by Blender3D %s - www.blender.org, source file: %s\n' % (bpy.version_string, bpy.data.filename.split('/')[-1].split('\\')[-1])) + file.write('comment Created by Blender3D %s - www.blender.org, source file: %s\n' % (bpy.app.version_string, bpy.data.filename.split('/')[-1].split('\\')[-1])) file.write('element vertex %d\n' % len(ply_verts)) diff --git a/release/scripts/modules/bpy/__init__.py b/release/scripts/modules/bpy/__init__.py index 65bf75b43e9..6209cbe4f0e 100644 --- a/release/scripts/modules/bpy/__init__.py +++ b/release/scripts/modules/bpy/__init__.py @@ -27,6 +27,7 @@ context = _bpy.context # python modules from bpy import utils +from bpy import app from bpy import ops as _ops_module @@ -100,9 +101,4 @@ def _main(): load_scripts() -# constants -version = _bpy._VERSION -version_string = _bpy._VERSION_STR -home = _bpy._HOME - _main() diff --git a/release/scripts/modules/bpy/app.py b/release/scripts/modules/bpy/app.py new file mode 100644 index 00000000000..da45ab8eb30 --- /dev/null +++ b/release/scripts/modules/bpy/app.py @@ -0,0 +1,26 @@ +# ##### 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# ##### END GPL LICENSE BLOCK ##### + +# <pep8 compliant> + +# constants +import _bpy +version = _bpy._VERSION +version_string = _bpy._VERSION_STR +home = _bpy._HOME +binary_path = _bpy._BINPATH diff --git a/release/scripts/ui/space_info.py b/release/scripts/ui/space_info.py index 4f6a85156d0..b15315b8668 100644 --- a/release/scripts/ui/space_info.py +++ b/release/scripts/ui/space_info.py @@ -121,7 +121,7 @@ class INFO_MT_file_open_recent(bpy.types.Menu): import os layout = self.layout layout.operator_context = 'EXEC_AREA' - file = open(os.path.join(bpy.home, ".Blog"), "rU") + file = open(os.path.join(bpy.app.home, ".Blog"), "rU") for line in file: line = line.rstrip() layout.operator("wm.open_mainfile", text=line, icon='FILE_BLEND').path = line |