File: BPyMessages.py

package info (click to toggle)
blender 2.49.2~dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 89,664 kB
  • ctags: 113,718
  • sloc: ansic: 738,048; cpp: 231,960; python: 104,955; asm: 33,960; sh: 16,233; ml: 12,962; makefile: 4,477; perl: 3,474; fortran: 108; java: 8
file content (61 lines) | stat: -rw-r--r-- 1,693 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from Blender import Draw, sys
def Error_NoMeshSelected():
	Draw.PupMenu('Error%t|No mesh objects selected')
def Error_NoActive():
	Draw.PupMenu('Error%t|No active object')
def Error_NoMeshActive():
	Draw.PupMenu('Error%t|Active object is not a mesh')
def Error_NoMeshUvSelected():
	Draw.PupMenu('Error%t|No mesh objects with texface selected')
def Error_NoMeshUvActive():
	Draw.PupMenu('Error%t|Active object is not a mesh with texface')
def Error_NoMeshMultiresEdit():
	Draw.PupMenu('Error%t|Unable to complete action with multires enabled')
def Error_NoMeshFaces():
	Draw.PupMenu('Error%t|Mesh has no faces')

# File I/O messages
def Error_NoFile(path):
	'''True if file missing, False if files there
	
	Use simply by doing...
	if Error_NoFile(path): return
	'''
	if not sys.exists(sys.expandpath(path)):
		Draw.PupMenu("Error%t|Can't open file: " + path)
		return True
	return False

def Error_NoDir(path):
	'''True if dirs missing, False if dirs there
	
	Use simply by doing...
	if Error_NoDir(path): return
	'''
	if not sys.exists(sys.expandpath(path)):
		Draw.PupMenu("Error%t|Path does not exist: " + path)
		return True
	return False


def Warning_MeshDistroyLayers(mesh):
	'''Returns true if we can continue to edit the mesh, warn when using NMesh'''
	if len(mesh.getUVLayerNames()) >1 and len(mesh.getColorLayerNames()) >1:
		return True
	
	ret = Draw.PupMenu('Warning%t|This script will distroy inactive UV and Color layers, OK?')
	if ret == -1:
		return False
	
	return True

def Warning_SaveOver(path):
	'''Returns - True to save, False dont save'''
	if sys.exists(sys.expandpath(path)):
		ret= Draw.PupMenu('Save over%t|' + path)
		if ret == -1:
			return False
	
	return True