Integrated Freestyle to rendering pipeline
[blender.git] / release / scripts / bpymodules / BPyMessages.py
1 from Blender import Draw, sys
2 def Error_NoMeshSelected():
3         Draw.PupMenu('Error%t|No mesh objects selected')
4 def Error_NoActive():
5         Draw.PupMenu('Error%t|No active object')
6 def Error_NoMeshActive():
7         Draw.PupMenu('Error%t|Active object is not a mesh')
8 def Error_NoMeshUvSelected():
9         Draw.PupMenu('Error%t|No mesh objects with texface selected')
10 def Error_NoMeshUvActive():
11         Draw.PupMenu('Error%t|Active object is not a mesh with texface')
12 def Error_NoMeshMultiresEdit():
13         Draw.PupMenu('Error%t|Unable to complete action with multires enabled')
14 def Error_NoMeshFaces():
15         Draw.PupMenu('Error%t|Mesh has no faces')
16
17 # File I/O messages
18 def Error_NoFile(path):
19         '''True if file missing, False if files there
20         
21         Use simply by doing...
22         if Error_NoFile(path): return
23         '''
24         if not sys.exists(sys.expandpath(path)):
25                 Draw.PupMenu("Error%t|Can't open file: " + path)
26                 return True
27         return False
28
29 def Error_NoDir(path):
30         '''True if dirs missing, False if dirs there
31         
32         Use simply by doing...
33         if Error_NoDir(path): return
34         '''
35         if not sys.exists(sys.expandpath(path)):
36                 Draw.PupMenu("Error%t|Path does not exist: " + path)
37                 return True
38         return False
39
40
41 def Warning_MeshDistroyLayers(mesh):
42         '''Returns true if we can continue to edit the mesh, warn when using NMesh'''
43         if len(mesh.getUVLayerNames()) >1 and len(mesh.getColorLayerNames()) >1:
44                 return True
45         
46         ret = Draw.PupMenu('Warning%t|This script will distroy inactive UV and Color layers, OK?')
47         if ret == -1:
48                 return False
49         
50         return True
51
52 def Warning_SaveOver(path):
53         '''Returns - True to save, False dont save'''
54         if sys.exists(sys.expandpath(path)):
55                 ret= Draw.PupMenu('Save over%t|' + path)
56                 if ret == -1:
57                         return False
58         
59         return True
60
61