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.
This commit is contained in:
Campbell Barton 2006-09-26 04:39:46 +00:00
parent 6587c3c6ba
commit e6251f6ae7
6 changed files with 32 additions and 0 deletions

@ -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()

@ -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)):

@ -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)

@ -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)

@ -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)

@ -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",