diff options
author | Campbell Barton <ideasman42@gmail.com> | 2006-09-26 08:39:46 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2006-09-26 08:39:46 +0400 |
commit | e6251f6ae772e8a8b92112fc10edd7695b205e31 (patch) | |
tree | bee482923f4c752644f9810d664368752df35f75 /release | |
parent | 6587c3c6baffcfde952dd4194f366361f61b5ca6 (diff) |
removed .parent by mistake in Object.c
made some of the importers raise a nice error if a file disnt exist rather then a python error. will eventually apply to all.
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/3ds_import.py | 6 | ||||
-rw-r--r-- | release/scripts/bpymodules/BPyMessages.py | 8 | ||||
-rw-r--r-- | release/scripts/bvh_import.py | 5 | ||||
-rw-r--r-- | release/scripts/import_obj.py | 4 | ||||
-rw-r--r-- | release/scripts/lightwave_import.py | 5 |
5 files changed, 28 insertions, 0 deletions
diff --git a/release/scripts/3ds_import.py b/release/scripts/3ds_import.py index 389644dfdb8..89c104fe247 100644 --- a/release/scripts/3ds_import.py +++ b/release/scripts/3ds_import.py @@ -114,6 +114,8 @@ from Blender import Mesh, Scene, Object, Material, Image, Texture, Lamp, Mathuti from Blender.Mathutils import Vector import BPyImage +import BPyMessages + import struct from struct import calcsize, unpack @@ -711,6 +713,10 @@ def process_next_chunk(file, previous_chunk, importedObjects): putContextMesh(contextMesh_vertls, contextMesh_facels, contextMeshMaterials) def load_3ds(filename, PREF_UI= True): + + if BPyMessages.Error_NoFile(filename): + return + print '\n\nImporting "%s" "%s"' % (filename, Blender.sys.expandpath(filename)) time1= Blender.sys.time() diff --git a/release/scripts/bpymodules/BPyMessages.py b/release/scripts/bpymodules/BPyMessages.py index 2ac6291926c..791cd61feef 100644 --- a/release/scripts/bpymodules/BPyMessages.py +++ b/release/scripts/bpymodules/BPyMessages.py @@ -8,6 +8,14 @@ def Error_NoMeshUvSelected(): def Error_NoMeshUvActive(): Draw.PupMenu('ERROR%t|Active object is not a mesh with texface') +# File I/O messages +def Error_NoFile(path): + '''True if file missing, False if files there''' + if not sys.exists(sys.expandpath(path)): + Draw.PupMenu("Error%t|Can't open file: " + path) + return True + return False + def Warning_SaveOver(path): '''Returns - True to save, False dont save''' if sys.exists(sys.expandpath(path)): diff --git a/release/scripts/bvh_import.py b/release/scripts/bvh_import.py index e9d952b9c15..885d9502bab 100644 --- a/release/scripts/bvh_import.py +++ b/release/scripts/bvh_import.py @@ -39,6 +39,7 @@ as empties or armatures. # -------------------------------------------------------------------------- import Blender +import BPyMessages Vector= Blender.Mathutils.Vector Euler= Blender.Mathutils.Euler Matrix= Blender.Mathutils.Matrix @@ -683,6 +684,10 @@ for f in ('/d/staggered_walk.bvh',): ''' def load_bvh_ui(file): + + if BPyMessages.Error_NoFile(file): + return + Draw= Blender.Draw IMPORT_SCALE = Draw.Create(0.01) diff --git a/release/scripts/import_obj.py b/release/scripts/import_obj.py index 6849121934e..301f0abe88e 100644 --- a/release/scripts/import_obj.py +++ b/release/scripts/import_obj.py @@ -22,6 +22,7 @@ Note, This loads mesh objects and materials only, nurbs and curves are not suppo from Blender import * import BPyMesh import BPyImage +import BPyMessages # Generic path functions @@ -688,6 +689,9 @@ DEBUG= True def load_obj_ui(filepath): + if BPyMessages.Error_NoFile(filepath): + return + CREATE_SMOOTH_GROUPS= Draw.Create(0) CREATE_FGONS= Draw.Create(1) CREATE_EDGES= Draw.Create(1) diff --git a/release/scripts/lightwave_import.py b/release/scripts/lightwave_import.py index d4799cfb171..831e1e7dce2 100644 --- a/release/scripts/lightwave_import.py +++ b/release/scripts/lightwave_import.py @@ -93,6 +93,8 @@ import BPyImage # Use this ngon function import BPyMesh +import BPyMessages + #python specific modules import try: import struct, chunk, os, cStringIO @@ -213,6 +215,9 @@ tobj=dotext(textname) def read(filename): global tobj + if BPyMessages.Error_NoFile(filename): + return + tobj.logcon ("This is: %s" % importername) tobj.logcon ("Importing file:") tobj.logcon (filename) |