soc-2008-mxcurioni: merged changes to revision 23516
[blender.git] / release / scripts / ui / space_userpref.py
1  
2 import bpy
3
4 class USERPREF_HT_header(bpy.types.Header):
5         __space_type__ = 'USER_PREFERENCES'
6
7         def draw(self, context):
8                 layout = self.layout
9                 layout.template_header(menus=False)
10                 
11                 userpref = context.user_preferences
12         
13                 layout.operator_context = "EXEC_AREA"
14                 layout.itemO("wm.save_homefile", text="Save As Default")
15                         
16 class USERPREF_MT_view(bpy.types.Menu):
17         __space_type__ = 'USER_PREFERENCES'
18         __label__ = "View"
19
20         def draw(self, context):
21                 layout = self.layout
22
23 class USERPREF_PT_tabs(bpy.types.Panel):
24         __space_type__ = 'USER_PREFERENCES'
25         __show_header__ = False
26
27         def draw(self, context):
28                 layout = self.layout
29                 
30                 userpref = context.user_preferences
31
32                 layout.itemR(userpref, "active_section", expand=True)
33
34 class USERPREF_PT_view(bpy.types.Panel):
35         __space_type__ = 'USER_PREFERENCES'
36         __label__ = "View"
37         __show_header__ = False
38
39         def poll(self, context):
40                 userpref = context.user_preferences
41                 return (userpref.active_section == 'VIEW_CONTROLS')
42
43         def draw(self, context):
44                 layout = self.layout
45                 
46                 userpref = context.user_preferences
47                 view = userpref.view
48
49                 split = layout.split()
50                 
51                 col = split.column()
52                 sub = col.split(percentage=0.85)
53                 
54                 sub1 = sub.column()
55                 sub1.itemL(text="Display:")
56                 sub1.itemR(view, "tooltips")
57                 sub1.itemR(view, "display_object_info", text="Object Info")
58                 sub1.itemR(view, "use_large_cursors")
59                 sub1.itemR(view, "show_view_name", text="View Name")
60                 sub1.itemR(view, "show_playback_fps", text="Playback FPS")
61                 sub1.itemR(view, "global_scene")
62                 sub1.itemR(view, "pin_floating_panels")
63                 sub1.itemR(view, "object_center_size")
64                 sub1.itemS()
65                 sub1.itemS()
66                 sub1.itemS()
67                 sub1.itemR(view, "show_mini_axis", text="Display Mini Axis")
68                 sub2 = sub1.column()
69                 sub2.enabled = view.show_mini_axis
70                 sub2.itemR(view, "mini_axis_size", text="Size")
71                 sub2.itemR(view, "mini_axis_brightness", text="Brightness")
72                 
73                 col = split.column()
74                 sub = col.split(percentage=0.85)
75                 
76                 sub1 = sub.column()
77                 sub1.itemL(text="View Manipulation:")
78                 sub1.itemR(view, "auto_depth")
79                 sub1.itemR(view, "global_pivot")
80                 sub1.itemR(view, "zoom_to_mouse")
81                 sub1.itemR(view, "rotate_around_selection")
82                 sub1.itemS()
83                 sub1.itemL(text="Zoom Style:")
84                 sub1.row().itemR(view, "viewport_zoom_style", expand=True)
85                 sub1.itemL(text="Orbit Style:")
86                 sub1.row().itemR(view, "view_rotation", expand=True)
87                 sub1.itemR(view, "perspective_orthographic_switch")
88                 sub1.itemR(view, "smooth_view")
89                 sub1.itemR(view, "rotation_angle")
90                 sub1.itemS()
91                 sub1.itemL(text="NDOF Device:")
92                 sub1.itemR(view, "ndof_pan_speed", text="Pan Speed")
93                 sub1.itemR(view, "ndof_rotate_speed", text="Orbit Speed")
94                 
95                 col = split.column()
96                 sub = col.split(percentage=0.85)
97                 
98                 sub1 = sub.column()
99                 sub1.itemL(text="Mouse Buttons:")
100                 
101                 sub2 = sub1.column()
102                 sub2.enabled = (view.select_mouse == 'RIGHT')
103                 sub2.itemR(view, "emulate_3_button_mouse")
104                 sub1.itemL(text="Select With:")
105                 sub1.row().itemR(view, "select_mouse", expand=True)
106                 sub1.itemL(text="Middle Mouse:")
107                 sub1.row().itemR(view, "middle_mouse", expand=True)
108                 sub1.itemR(view, "use_middle_mouse_paste")
109                 sub1.itemL(text="Mouse Wheel:")
110                 sub1.itemR(view, "wheel_invert_zoom", text="Invert Zoom")
111                 sub1.itemR(view, "wheel_scroll_lines", text="Scroll Lines")
112                 sub1.itemS()
113                 sub1.itemS()
114                 sub1.itemS()
115                 sub1.itemL(text="Menus:")
116                 sub1.itemR(view, "open_mouse_over")
117                 sub1.itemL(text="Menu Open Delay:")
118                 sub1.itemR(view, "open_toplevel_delay", text="Top Level")
119                 sub1.itemR(view, "open_sublevel_delay", text="Sub Level")
120
121                 col = split.column()
122                 sub = col.split(percentage=0.85)
123                 
124                 sub1 = sub.column()
125                 #manipulator
126                 sub1.itemR(view, "use_manipulator")
127                 sub2 = sub1.column()
128                 sub2.enabled = view.use_manipulator
129                 sub2.itemR(view, "manipulator_size", text="Size")
130                 sub2.itemR(view, "manipulator_handle_size", text="Handle Size")
131                 sub2.itemR(view, "manipulator_hotspot", text="Hotspot") 
132                 sub1.itemS()
133                 sub1.itemS()
134                 sub1.itemS()                    
135                 sub1.itemL(text="Toolbox:")
136                 sub1.itemR(view, "use_column_layout")
137                 sub1.itemL(text="Open Toolbox Delay:")
138                 sub1.itemR(view, "open_left_mouse_delay", text="Hold LMB")
139                 sub1.itemR(view, "open_right_mouse_delay", text="Hold RMB")
140
141 class USERPREF_PT_edit(bpy.types.Panel):
142         __space_type__ = 'USER_PREFERENCES'
143         __label__ = "Edit"
144         __show_header__ = False
145
146         def poll(self, context):
147                 userpref = context.user_preferences
148                 return (userpref.active_section == 'EDIT_METHODS')
149
150         def draw(self, context):
151                 layout = self.layout
152                 
153                 userpref = context.user_preferences
154                 edit = userpref.edit
155                 view = userpref.view
156                 
157                 split = layout.split()
158                 
159                 col = split.column()
160                 sub = col.split(percentage=0.85)
161                 
162                 sub1 = sub.column()
163                 sub1.itemL(text="Link Materials To:")
164                 sub1.row().itemR(edit, "material_link", expand=True)
165                 sub1.itemS()
166                 sub1.itemS()
167                 sub1.itemS()
168                 sub1.itemL(text="New Objects:")
169                 sub1.itemR(edit, "enter_edit_mode")
170                 sub1.itemL(text="Align To:")
171                 sub1.row().itemR(edit, "object_align", expand=True)
172                 sub1.itemS()
173                 sub1.itemS()
174                 sub1.itemS()
175                 sub1.itemL(text="Transform:")
176                 sub1.itemR(edit, "drag_immediately")
177
178                 col = split.column()
179                 sub = col.split(percentage=0.85)
180                 
181                 sub1 = sub.column()
182                 sub1.itemL(text="Snap:")
183                 sub1.itemR(edit, "snap_translate", text="Translate")
184                 sub1.itemR(edit, "snap_rotate", text="Rotate")
185                 sub1.itemR(edit, "snap_scale", text="Scale")
186                 sub1.itemS()
187                 sub1.itemS()
188                 sub1.itemS()
189                 sub1.itemL(text="Grease Pencil:")
190                 sub1.itemR(edit, "grease_pencil_manhattan_distance", text="Manhattan Distance")
191                 sub1.itemR(edit, "grease_pencil_euclidean_distance", text="Euclidean Distance")
192                 # sub1.itemR(edit, "grease_pencil_simplify_stroke", text="Simplify Stroke")
193                 sub1.itemR(edit, "grease_pencil_eraser_radius", text="Eraser Radius")
194                 sub1.itemR(edit, "grease_pencil_smooth_stroke", text="Smooth Stroke")
195                 
196                 col = split.column()
197                 sub = col.split(percentage=0.85)
198                 
199                 sub1 = sub.column()
200                 sub1.itemL(text="Keyframing:")
201                 sub1.itemR(edit, "use_visual_keying")
202                 sub1.itemR(edit, "new_interpolation_type", text="New F-Curves")
203                 sub1.itemS()
204                 sub1.itemR(edit, "auto_keying_enable", text="Auto Keyframing")
205                 sub2 = sub1.column()
206                 sub2.enabled = edit.auto_keying_enable
207                 sub2.row().itemR(edit, "auto_keying_mode", expand=True)
208                 sub2.itemR(edit, "auto_keyframe_insert_available", text="Only Insert Available")
209                 sub2.itemR(edit, "auto_keyframe_insert_needed", text="Only Insert Needed")
210                 
211                 sub1.itemS()
212                 sub1.itemS()
213                 sub1.itemS()
214                 
215                 sub1.itemL(text="Undo:")
216                 sub1.itemR(edit, "global_undo")
217                 sub1.itemR(edit, "undo_steps", text="Steps")
218                 sub1.itemR(edit, "undo_memory_limit", text="Memory Limit")
219                 
220                 sub1.itemS()
221                 sub1.itemS()
222                 sub1.itemS()
223
224                 col = split.column()
225                 sub = col.split(percentage=0.85)
226                 
227                 sub1 = sub.column()
228                 sub1.itemL(text="Duplicate Data:")
229                 sub1.itemR(edit, "duplicate_mesh", text="Mesh")
230                 sub1.itemR(edit, "duplicate_surface", text="Surface")
231                 sub1.itemR(edit, "duplicate_curve", text="Curve")
232                 sub1.itemR(edit, "duplicate_text", text="Text")
233                 sub1.itemR(edit, "duplicate_metaball", text="Metaball")
234                 sub1.itemR(edit, "duplicate_armature", text="Armature")
235                 sub1.itemR(edit, "duplicate_lamp", text="Lamp")
236                 sub1.itemR(edit, "duplicate_material", text="Material")
237                 sub1.itemR(edit, "duplicate_texture", text="Texture")
238                 sub1.itemR(edit, "duplicate_ipo", text="F-Curve")
239                 sub1.itemR(edit, "duplicate_action", text="Action")
240                 sub1.itemR(edit, "duplicate_particle", text="Particle")
241                 
242 class USERPREF_PT_system(bpy.types.Panel):
243         __space_type__ = 'USER_PREFERENCES'
244         __label__ = "System"
245         __show_header__ = False
246
247         def poll(self, context):
248                 userpref = context.user_preferences
249                 return (userpref.active_section == 'SYSTEM_OPENGL')
250
251         def draw(self, context):
252                 layout = self.layout
253                 
254                 userpref = context.user_preferences
255                 system = userpref.system
256                 
257                 split = layout.split()
258                 
259                 col = split.column()
260                 sub = col.split(percentage=0.9)
261                 
262                 sub1 = sub.column()
263                 sub1.itemL(text="General:")
264                 sub1.itemR(system, "dpi")
265                 sub1.itemR(system, "frame_server_port")
266                 sub1.itemR(system, "scrollback", text="Console Scrollback")
267                 sub1.itemR(system, "emulate_numpad")
268                 sub1.itemR(system, "auto_run_python_scripts")
269                 
270                 sub1.itemS()
271                 sub1.itemS()
272                 sub1.itemS()
273                 
274                 sub1.itemL(text="Sound:")
275                 sub1.row().itemR(system, "audio_device", expand=True)
276                 sub2 = sub1.column()
277                 sub2.active = system.audio_device != 'AUDIO_DEVICE_NULL'
278                 sub2.itemR(system, "enable_all_codecs")
279                 sub2.itemR(system, "game_sound")
280                 sub2.itemR(system, "audio_channels", text="Channels")
281                 sub2.itemR(system, "audio_mixing_buffer", text="Mixing Buffer")
282                 sub2.itemR(system, "audio_sample_rate", text="Sample Rate")
283                 sub2.itemR(system, "audio_sample_format", text="Sample Format")
284                 
285                 col = split.column()    
286                 sub = col.split(percentage=0.9)
287                 
288                 sub1 = sub .column()
289                 sub1.itemL(text="Weight Colors:")
290                 sub1.itemR(system, "use_weight_color_range", text="Use Custom Range")
291                 sub2 = sub1.column()
292                 sub2.active = system.use_weight_color_range
293                 sub2.template_color_ramp(system, "weight_color_range", expand=True)
294                 
295                 sub1.itemS()
296                 sub1.itemS()
297                 sub1.itemS()
298                 
299                 sub1.itemR(system, "language")
300                 sub1.itemL(text="Translate:")
301                 sub1.itemR(system, "translate_tooltips", text="Tooltips")
302                 sub1.itemR(system, "translate_buttons", text="Labels")
303                 sub1.itemR(system, "translate_toolbox", text="Toolbox")
304                 
305                 sub1.itemS()
306                 
307                 sub1.itemR(system, "use_textured_fonts")
308                 
309                 col = split.column()
310                 sub = col.split(percentage=0.9)
311                 
312                 sub1 = sub.column()
313
314                 sub1.itemL(text="OpenGL:")
315                 sub1.itemR(system, "clip_alpha", slider=True)
316                 sub1.itemR(system, "use_mipmaps")
317                 sub1.itemL(text="Window Draw Method:")
318                 sub1.row().itemR(system, "window_draw_method", expand=True)
319                 sub1.itemL(text="Textures:")
320                 sub1.itemR(system, "gl_texture_limit", text="Limit Size")
321                 sub1.itemR(system, "texture_time_out", text="Time Out")
322                 sub1.itemR(system, "texture_collection_rate", text="Collection Rate")
323                 
324                 sub1.itemS()
325                 sub1.itemS()
326                 sub1.itemS()
327                 
328                 sub1.itemL(text="Sequencer:")
329                 sub1.itemR(system, "prefetch_frames")
330                 sub1.itemR(system, "memory_cache_limit")
331                 
332 class USERPREF_PT_filepaths(bpy.types.Panel):
333         __space_type__ = 'USER_PREFERENCES'
334         __label__ = "File Paths"
335         __show_header__ = False
336
337         def poll(self, context):
338                 userpref = context.user_preferences
339                 return (userpref.active_section == 'FILE_PATHS')
340
341         def draw(self, context):
342                 layout = self.layout
343                 
344                 userpref = context.user_preferences
345                 paths = userpref.filepaths
346                 
347                 split = layout.split(percentage=0.6)
348                 
349                 col = split.column()
350                 col.itemL(text="File Paths:")
351                 sub = col.split(percentage=0.3)
352                 
353                 sub.itemL(text="Fonts:")
354                 sub.itemR(paths, "fonts_directory", text="")
355                 sub = col.split(percentage=0.3)
356                 sub.itemL(text="Textures:")
357                 sub.itemR(paths, "textures_directory", text="")
358                 sub = col.split(percentage=0.3)
359                 sub.itemL(text="Texture Plugins:")
360                 sub.itemR(paths, "texture_plugin_directory", text="")
361                 sub = col.split(percentage=0.3)
362                 sub.itemL(text="Sequence Plugins:")
363                 sub.itemR(paths, "sequence_plugin_directory", text="")
364                 sub = col.split(percentage=0.3)
365                 sub.itemL(text="Render Output:")
366                 sub.itemR(paths, "render_output_directory", text="")
367                 sub = col.split(percentage=0.3)
368                 sub.itemL(text="Scripts:")
369                 sub.itemR(paths, "python_scripts_directory", text="")
370                 sub = col.split(percentage=0.3)
371                 sub.itemL(text="Sounds:")
372                 sub.itemR(paths, "sounds_directory", text="")
373                 sub = col.split(percentage=0.3)
374                 sub.itemL(text="Temp:")
375                 sub.itemR(paths, "temporary_directory", text="")
376                 
377                 col = split.column()
378                 sub = col.split(percentage=0.2)
379                 sub1 = sub.column()
380                 sub2 = sub.column()
381                 sub2.itemL(text="Save & Load:")
382                 sub2.itemR(paths, "use_relative_paths")
383                 sub2.itemR(paths, "compress_file")
384                 sub2.itemR(paths, "load_ui")
385                 sub2.itemR(paths, "filter_file_extensions")
386                 sub2.itemR(paths, "hide_dot_files_datablocks")
387                 sub2.itemS()
388                 sub2.itemS()
389                 sub2.itemL(text="Auto Save:")
390                 sub2.itemR(paths, "save_version")
391                 sub2.itemR(paths, "recent_files")
392                 sub2.itemR(paths, "save_preview_images")
393                 sub2.itemR(paths, "auto_save_temporary_files")
394                 sub3 = sub2.column()
395                 sub3.enabled = paths.auto_save_temporary_files
396                 sub3.itemR(paths, "auto_save_time", text="Timer (mins)")
397
398 bpy.types.register(USERPREF_HT_header)
399 bpy.types.register(USERPREF_MT_view)
400 bpy.types.register(USERPREF_PT_tabs)
401 bpy.types.register(USERPREF_PT_view)
402 bpy.types.register(USERPREF_PT_edit)
403 bpy.types.register(USERPREF_PT_system)
404 bpy.types.register(USERPREF_PT_filepaths)
405