svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r22717:22875
[blender.git] / release / 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                 sub1.itemR(view, "left_mouse_button_select")
101                 sub1.itemR(view, "right_mouse_button_select")
102                 sub1.itemR(view, "emulate_3_button_mouse")
103                 sub1.itemR(view, "use_middle_mouse_paste")
104                 sub1.itemR(view, "middle_mouse_rotate")
105                 sub1.itemR(view, "middle_mouse_pan")
106                 sub1.itemR(view, "wheel_invert_zoom")
107                 sub1.itemR(view, "wheel_scroll_lines")
108                 sub1.itemS()
109                 sub1.itemS()
110                 sub1.itemS()
111                 sub1.itemL(text="Menus:")
112                 sub1.itemR(view, "open_mouse_over")
113                 sub1.itemL(text="Menu Open Delay:")
114                 sub1.itemR(view, "open_toplevel_delay", text="Top Level")
115                 sub1.itemR(view, "open_sublevel_delay", text="Sub Level")
116
117                 col = split.column()
118                 sub = col.split(percentage=0.85)
119                 
120                 sub1 = sub.column()
121                 #manipulator
122                 sub1.itemR(view, "use_manipulator")
123                 sub2 = sub1.column()
124                 sub2.enabled = view.use_manipulator
125                 sub2.itemR(view, "manipulator_size", text="Size")
126                 sub2.itemR(view, "manipulator_handle_size", text="Handle Size")
127                 sub2.itemR(view, "manipulator_hotspot", text="Hotspot") 
128                 sub1.itemS()
129                 sub1.itemS()
130                 sub1.itemS()                    
131                 sub1.itemL(text="Toolbox:")
132                 sub1.itemR(view, "use_column_layout")
133                 sub1.itemL(text="Open Toolbox Delay:")
134                 sub1.itemR(view, "open_left_mouse_delay", text="Hold LMB")
135                 sub1.itemR(view, "open_right_mouse_delay", text="Hold RMB")
136
137 class USERPREF_PT_edit(bpy.types.Panel):
138         __space_type__ = 'USER_PREFERENCES'
139         __label__ = "Edit"
140         __show_header__ = False
141
142         def poll(self, context):
143                 userpref = context.user_preferences
144                 return (userpref.active_section == 'EDIT_METHODS')
145
146         def draw(self, context):
147                 layout = self.layout
148                 
149                 userpref = context.user_preferences
150                 edit = userpref.edit
151                 view = userpref.view
152                 
153                 split = layout.split()
154                 
155                 col = split.column()
156                 sub = col.split(percentage=0.85)
157                 
158                 sub1 = sub.column()
159                 sub1.itemL(text="Materials:")
160                 sub1.itemR(edit, "material_linked_object", text="Linked to Object")
161                 sub1.itemR(edit, "material_linked_obdata", text="Linked to ObData")
162                 sub1.itemS()
163                 sub1.itemS()
164                 sub1.itemS()
165                 sub1.itemL(text="New Objects:")
166                 sub1.itemR(edit, "enter_edit_mode")
167                 sub1.itemR(edit, "align_to_view")
168                 sub1.itemS()
169                 sub1.itemS()
170                 sub1.itemS()
171                 sub1.itemL(text="Transform:")
172                 sub1.itemR(edit, "drag_immediately")
173
174                 col = split.column()
175                 sub = col.split(percentage=0.85)
176                 
177                 sub1 = sub.column()
178                 sub1.itemL(text="Snap:")
179                 sub1.itemR(edit, "snap_translate", text="Translate")
180                 sub1.itemR(edit, "snap_rotate", text="Rotate")
181                 sub1.itemR(edit, "snap_scale", text="Scale")
182                 sub1.itemS()
183                 sub1.itemS()
184                 sub1.itemS()
185                 sub1.itemL(text="Grease Pencil:")
186                 sub1.itemR(edit, "grease_pencil_manhattan_distance", text="Manhattan Distance")
187                 sub1.itemR(edit, "grease_pencil_euclidean_distance", text="Euclidean Distance")
188                 sub1.itemR(edit, "grease_pencil_smooth_stroke", text="Smooth Stroke")
189                 # sub1.itemR(edit, "grease_pencil_simplify_stroke", text="Simplify Stroke")
190                 sub1.itemR(edit, "grease_pencil_eraser_radius", text="Eraser Radius")
191                 
192                 col = split.column()
193                 sub = col.split(percentage=0.85)
194                 
195                 sub1 = sub.column()
196                 sub1.itemL(text="Keyframing:")
197                 sub1.itemR(edit, "use_visual_keying")
198                 sub1.itemR(edit, "new_interpolation_type")
199                 sub1.itemS()
200                 sub1.itemR(edit, "auto_keying_enable", text="Auto Keyframing")
201                 sub2 = sub1.column()
202                 sub2.enabled = edit.auto_keying_enable
203                 sub2.row().itemR(edit, "auto_keying_mode", expand=True)
204                 sub2.itemR(edit, "auto_keyframe_insert_available", text="Only Insert Available")
205                 sub2.itemR(edit, "auto_keyframe_insert_needed", text="Only Insert Needed")
206                 sub1.itemS()
207                 sub1.itemS()
208                 sub1.itemS()
209                 sub1.itemL(text="Undo:")
210                 sub1.itemR(edit, "global_undo")
211                 sub1.itemR(edit, "undo_steps", text="Steps")
212                 sub1.itemR(edit, "undo_memory_limit", text="Memory Limit")
213                 sub1.itemS()
214                 sub1.itemS()
215                 sub1.itemS()
216
217                 col = split.column()
218                 sub = col.split(percentage=0.85)
219                 
220                 sub1 = sub.column()
221                 sub1.itemL(text="Duplicate:")
222                 sub1.itemR(edit, "duplicate_mesh", text="Mesh")
223                 sub1.itemR(edit, "duplicate_surface", text="Surface")
224                 sub1.itemR(edit, "duplicate_curve", text="Curve")
225                 sub1.itemR(edit, "duplicate_text", text="Text")
226                 sub1.itemR(edit, "duplicate_metaball", text="Metaball")
227                 sub1.itemR(edit, "duplicate_armature", text="Armature")
228                 sub1.itemR(edit, "duplicate_lamp", text="Lamp")
229                 sub1.itemR(edit, "duplicate_material", text="Material")
230                 sub1.itemR(edit, "duplicate_texture", text="Texture")
231                 sub1.itemR(edit, "duplicate_ipo", text="F-Curve")
232                 sub1.itemR(edit, "duplicate_action", text="Action")
233                 sub1.itemR(edit, "duplicate_particle", text="Particle")
234                 
235 class USERPREF_PT_system(bpy.types.Panel):
236         __space_type__ = 'USER_PREFERENCES'
237         __label__ = "System"
238         __show_header__ = False
239
240         def poll(self, context):
241                 userpref = context.user_preferences
242                 return (userpref.active_section == 'SYSTEM_OPENGL')
243
244         def draw(self, context):
245                 layout = self.layout
246                 
247                 userpref = context.user_preferences
248                 system = userpref.system
249                 lan = userpref.language
250                 
251                 split = layout.split()
252                 
253                 col = split.column()
254                 sub = col.split(percentage=0.85)
255                 
256                 sub1 = sub.column()
257                 sub1.itemR(system, "emulate_numpad")    
258                 sub1.itemS()
259                 sub1.itemS()
260                 
261                 #Weight Colors
262                 sub1.itemL(text="Weight Colors:")
263                 sub1.itemR(system, "use_weight_color_range", text="Use Custom Range")
264                 
265                 sub2 = sub1.column()
266                 sub2.active = system.use_weight_color_range
267                 sub2.template_color_ramp(system.weight_color_range, expand=True)
268                 sub1.itemS()
269                 sub1.itemS()
270                 
271                 #sequencer
272                 sub1.itemL(text="Sequencer:")
273                 sub1.itemR(system, "prefetch_frames")
274                 sub1.itemR(system, "memory_cache_limit")
275                 
276                 col = split.column()    
277                 sub = col.split(percentage=0.85)
278                 
279                 sub1 = sub .column()
280                 #System
281                 sub1.itemL(text="System:")
282                 sub1.itemR(lan, "dpi")
283                 sub1.itemR(system, "auto_run_python_scripts")
284                 sub1.itemR(system, "frame_server_port")
285                 sub1.itemR(system, "filter_file_extensions")
286                 sub1.itemR(system, "hide_dot_files_datablocks")
287                 sub1.itemR(lan, "scrollback", text="Console Scrollback")
288                 sub1.itemS()
289                 sub1.itemS()
290                 sub1.itemL(text="Sound:")
291                 sub1.itemR(system, "audio_device")
292                 sub2 = sub1.column()
293                 sub2.active = system.audio_device != 'AUDIO_DEVICE_NULL'
294                 sub2.itemR(system, "enable_all_codecs")
295                 sub2.itemR(system, "game_sound")
296                 sub2.itemR(system, "audio_channels")
297                 sub2.itemR(system, "audio_mixing_buffer")
298                 sub2.itemR(system, "audio_sample_rate")
299                 sub2.itemR(system, "audio_sample_format")
300                 
301                 col = split.column()
302                 sub = col.split(percentage=0.85)
303                 
304                 sub1 = sub.column()
305                 #OpenGL
306                 sub1.itemL(text="OpenGL:")
307                 sub1.itemR(system, "clip_alpha", slider=True)
308                 sub1.itemR(system, "use_mipmaps")
309                 sub1.itemL(text="Window Draw Method:")
310                 sub1.row().itemR(system, "window_draw_method", expand=True)
311                 sub1.itemL(text="Textures:")
312                 sub1.itemR(system, "gl_texture_limit", text="Limit Size")
313                 sub1.itemR(system, "texture_time_out", text="Time Out")
314                 sub1.itemR(system, "texture_collection_rate", text="Collection Rate")           
315                 
316 class USERPREF_PT_filepaths(bpy.types.Panel):
317         __space_type__ = 'USER_PREFERENCES'
318         __label__ = "File Paths"
319         __show_header__ = False
320
321         def poll(self, context):
322                 userpref = context.user_preferences
323                 return (userpref.active_section == 'FILE_PATHS')
324
325         def draw(self, context):
326                 layout = self.layout
327                 
328                 userpref = context.user_preferences
329                 paths = userpref.filepaths
330                 
331                 split = layout.split()
332                 
333                 col = split.column()
334                 col.itemL(text="File Paths:")
335                 sub = col.split(percentage=0.3)
336                 
337                 sub.itemL(text="Fonts:")
338                 sub.itemR(paths, "fonts_directory", text="")
339                 sub = col.split(percentage=0.3)
340                 sub.itemL(text="Textures:")
341                 sub.itemR(paths, "textures_directory", text="")
342                 sub = col.split(percentage=0.3)
343                 sub.itemL(text="Texture Plugins:")
344                 sub.itemR(paths, "texture_plugin_directory", text="")
345                 sub = col.split(percentage=0.3)
346                 sub.itemL(text="Sequence Plugins:")
347                 sub.itemR(paths, "sequence_plugin_directory", text="")
348                 sub = col.split(percentage=0.3)
349                 sub.itemL(text="Render Output:")
350                 sub.itemR(paths, "render_output_directory", text="")
351                 sub = col.split(percentage=0.3)
352                 sub.itemL(text="Scripts:")
353                 sub.itemR(paths, "python_scripts_directory", text="")
354                 sub = col.split(percentage=0.3)
355                 sub.itemL(text="Sounds:")
356                 sub.itemR(paths, "sounds_directory", text="")
357                 sub = col.split(percentage=0.3)
358                 sub.itemL(text="Temp:")
359                 sub.itemR(paths, "temporary_directory", text="")
360                 
361                 col = split.column()
362                 sub = col.split(percentage=0.2)
363                 sub1 = sub.column()
364                 sub2 = sub.column()
365                 sub2.itemL(text="Save & Load:")
366                 sub2.itemR(paths, "use_relative_paths")
367                 sub2.itemR(paths, "compress_file")
368                 sub2.itemR(paths, "load_ui")
369                 sub2.itemS()
370                 sub2.itemS()
371                 sub2.itemL(text="Auto Save:")
372                 sub2.itemR(paths, "save_version")
373                 sub2.itemR(paths, "recent_files")
374                 sub2.itemR(paths, "save_preview_images")
375                 sub2.itemR(paths, "auto_save_temporary_files")
376                 sub3 = sub2.column()
377                 sub3.enabled = paths.auto_save_temporary_files
378                 sub3.itemR(paths, "auto_save_time", text="Timer (mins)")
379
380 class USERPREF_PT_language(bpy.types.Panel):
381         __space_type__ = 'USER_PREFERENCES'
382         __label__ = "Language"
383         __show_header__ = False
384
385         def poll(self, context):
386                 userpref = context.user_preferences
387                 return (userpref.active_section == 'LANGUAGE_COLORS')
388
389         def draw(self, context):
390                 layout = self.layout
391                 
392                 userpref = context.user_preferences
393                 lan = userpref.language
394                 
395                 split = layout.split()
396                 col = split.column()
397                 
398                 col.itemR(lan, "language")
399                 col.itemL(text="Translate:")
400                 col.itemR(lan, "translate_tooltips", text="Tooltips")
401                 col.itemR(lan, "translate_buttons", text="Labels")
402                 col.itemR(lan, "translate_toolbox", text="Toolbox")
403                 col.itemS()
404                 col.itemS()
405                 col.itemR(lan, "use_textured_fonts")
406                 
407                 col = split.column()
408                 
409
410 bpy.types.register(USERPREF_HT_header)
411 bpy.types.register(USERPREF_MT_view)
412 bpy.types.register(USERPREF_PT_tabs)
413 bpy.types.register(USERPREF_PT_view)
414 bpy.types.register(USERPREF_PT_edit)
415 bpy.types.register(USERPREF_PT_system)
416 bpy.types.register(USERPREF_PT_filepaths)
417 bpy.types.register(USERPREF_PT_language)
418