Welcome to mirror list, hosted at ThFree Co, Russian Federation.

buttons_data_text.py « ui « release - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: bce16e78a40a59d834834f0089523c5e88268b62 (plain)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130

import bpy

class DataButtonsPanel(bpy.types.Panel):
	__space_type__ = "BUTTONS_WINDOW"
	__region_type__ = "WINDOW"
	__context__ = "data"
	
	def poll(self, context):
		return (context.object and context.object.type == 'TEXT' and context.curve)
		
class DATA_PT_shape_text(DataButtonsPanel):
	__idname__ = "DATA_PT_shape_text"
	__label__ = "Shape Text"
	
	def poll(self, context):
		ob = context.object
		return (context.object and context.object.type == 'TEXT')

	def draw(self, context):
		layout = self.layout
		
		ob = context.object
		curve = context.curve
		space = context.space_data

		split = layout.split(percentage=0.65)

		if ob:
			split.template_ID(context, ob, "data")
			split.itemS()
		elif curve:
			split.template_ID(context, space, "pin_id")
			split.itemS()

		if curve:
			layout.itemS()
			layout.itemR(curve, "curve_2d")			
							
			split = layout.split()
		
			sub = split.column()
			sub.itemL(text="Caps:")
			sub.itemR(curve, "front")
			sub.itemR(curve, "back")
			
			sub.itemL(text="Textures:")
			sub.itemR(curve, "uv_orco")
			sub.itemR(curve, "auto_texspace")
			
			sub = split.column()	
			sub.itemL(text="Resolution:")
			sub.itemR(curve, "resolution_u", text="Preview U")
			sub.itemR(curve, "resolution_v", text="Preview V")
			sub.itemR(curve, "render_resolution_u", text="Render U")
			sub.itemR(curve, "render_resolution_v", text="Render V")

			sub.itemL(text="Display:")
			sub.itemR(curve, "fast")
			
class DATA_PT_font(DataButtonsPanel):
	__idname__ = "DATA_PT_font"
	__label__ = "Font"

	def draw(self, context):
		layout = self.layout
		text = context.curve

		layout.row()
		layout.itemR(text, "font")
		
		split = layout.split()
		
		sub = split.column()	
	#	sub.itemR(text, "style")
	#	sub.itemR(text, "bold")
	#	sub.itemR(text, "italic")
	#	sub.itemR(text, "underline")
	# 	ToDo: These settings are in a sub struct (Edit Format). 
		sub.itemR(text, "text_size")		
		sub.itemR(text, "shear")

		sub = split.column()
		sub.itemR(text, "text_on_curve")
		sub.itemR(text, "family")
		sub.itemL(text="Underline:")
		sub.itemR(text, "ul_position", text="Position")
		sub.itemR(text, "ul_height", text="Height")

	#	sub.itemR(text, "edit_format")

class DATA_PT_paragraph(DataButtonsPanel):
	__idname__ = "DATA_PT_paragraph"
	__label__ = "Paragraph"

	def draw(self, context):
		layout = self.layout
		text = context.curve

		layout.itemL(text="Align:")
		layout.itemR(text, "spacemode", expand=True)

		split = layout.split()
		
		sub = split.column()	
		sub.itemL(text="Spacing:")
		sub.itemR(text, "spacing", text="Character")
		sub.itemR(text, "word_spacing", text="Word")
		sub.itemR(text, "line_dist", text="Line")

		sub = split.column()
		sub.itemL(text="Offset:")
		sub.itemR(text, "x_offset", text="X")
		sub.itemR(text, "y_offset", text="Y")
		sub.itemR(text, "wrap")

"""		
class DATA_PT_textboxes(DataButtonsPanel):
		__idname__ = "DATA_PT_textboxes"
		__label__ = "Text Boxes"

		def draw(self, context):
			layout = self.layout
			text = context.curve
"""

bpy.types.register(DATA_PT_shape_text)	
bpy.types.register(DATA_PT_font)
bpy.types.register(DATA_PT_paragraph)
#bpy.types.register(DATA_PT_textboxes)