removed .parent by mistake in Object.c
authorCampbell Barton <ideasman42@gmail.com>
Tue, 26 Sep 2006 04:39:46 +0000 (04:39 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Tue, 26 Sep 2006 04:39:46 +0000 (04:39 +0000)
made some of the importers raise a nice error if a file disnt exist rather then a python error. will eventually apply to all.

release/scripts/3ds_import.py
release/scripts/bpymodules/BPyMessages.py
release/scripts/bvh_import.py
release/scripts/import_obj.py
release/scripts/lightwave_import.py
source/blender/python/api2_2x/Object.c

index 389644dfdb818c0e88044aa78240fecef0d162a3..89c104fe247eaf7699ff2ac98941fb7646a9d271 100644 (file)
@@ -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()
index 2ac6291926cfea773b9b37923193737de1804097..791cd61feeffae61c992b7bd411caeecc252bdfc 100644 (file)
@@ -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)):
index e9d952b9c1560e8848e063fd4d2890592a4f37ac..885d9502babfa883f2284b2e2ce61fa0fe85e2c6 100644 (file)
@@ -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)
index 6849121934e0b40785c64991857a995ec89058c5..301f0abe88ea634ba8a6a56fdad2ad274a8672dc 100644 (file)
@@ -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)
index d4799cfb1719c12c71925624ddfd57a068e68790..831e1e7dce2c37a37e1ffca8e9f78476de9a983c 100644 (file)
@@ -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)
index 2859352210d1a58215ac40d0660dba83da43ae9c..b4f784c67b504a477c271135dc6a8003997041fe 100644 (file)
@@ -4714,6 +4714,10 @@ static PyGetSetDef BPy_Object_getseters[] = {
         (getter)Object_getSelected, (setter)Object_setSelect,
         "The object's selection state",
         NULL},
+       {"parent",
+        (getter)Object_getParent, (setter)NULL,
+        "The object's parent object (if parented)",
+        NULL},
        {"parentbonename",
         (getter)Object_getParentBoneName, (setter)NULL,
         "Returns the object's parent object's sub name",