quiet warnings
[blender-staging.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                 
234 class USERPREF_PT_system(bpy.types.Panel):
235         __space_type__ = 'USER_PREFERENCES'
236         __label__ = "System"
237         __show_header__ = False
238
239         def poll(self, context):
240                 userpref = context.user_preferences
241                 return (userpref.active_section == 'SYSTEM_OPENGL')
242
243         def draw(self, context):
244                 layout = self.layout
245                 
246                 userpref = context.user_preferences
247                 system = userpref.system
248                 lan = userpref.language
249                 
250                 split = layout.split()
251                 
252                 col = split.column()
253                 sub = col.split(percentage=0.85)
254                 
255                 sub1 = sub.column()
256                 sub1.itemR(system, "emulate_numpad")    
257                 sub1.itemS()
258                 sub1.itemS()
259                 
260                 #Weight Colors
261                 sub1.itemL(text="Weight Colors:")
262                 sub1.itemR(system, "use_weight_color_range", text="Use Custom Range")
263                 
264                 sub2 = sub1.column()
265                 sub2.active = system.use_weight_color_range
266                 sub2.template_color_ramp(system.weight_color_range, expand=True)
267                 sub1.itemS()
268                 sub1.itemS()
269                 
270                 #sequencer
271                 sub1.itemL(text="Sequencer:")
272                 sub1.itemR(system, "prefetch_frames")
273                 sub1.itemR(system, "memory_cache_limit")
274                 
275                 col = split.column()    
276                 sub = col.split(percentage=0.85)
277                 
278                 sub1 = sub .column()
279                 #System
280                 sub1.itemL(text="System:")
281                 sub1.itemR(lan, "dpi")
282                 sub1.itemR(system, "auto_run_python_scripts")
283                 sub1.itemR(system, "frame_server_port")
284                 sub1.itemR(system, "filter_file_extensions")
285                 sub1.itemR(system, "hide_dot_files_datablocks")
286                 sub1.itemR(lan, "scrollback", text="Console Scrollback")
287                 sub1.itemS()
288                 sub1.itemS()
289                 sub1.itemL(text="Sound:")
290                 sub1.itemR(system, "audio_device")
291                 sub2 = sub1.column()
292                 sub2.active = system.audio_device != 'AUDIO_DEVICE_NULL'
293                 sub2.itemR(system, "enable_all_codecs")
294                 sub2.itemR(system, "game_sound")
295                 sub2.itemR(system, "audio_channels")
296                 sub2.itemR(system, "audio_mixing_buffer")
297                 sub2.itemR(system, "audio_sample_rate")
298                 sub2.itemR(system, "audio_sample_format")
299                 
300                 col = split.column()
301                 sub = col.split(percentage=0.85)
302                 
303                 sub1 = sub.column()
304                 #OpenGL
305                 sub1.itemL(text="OpenGL:")
306                 sub1.itemR(system, "clip_alpha", slider=True)
307                 sub1.itemR(system, "use_mipmaps")
308                 sub1.itemL(text="Window Draw Method:")
309                 sub1.row().itemR(system, "window_draw_method", expand=True)
310                 sub1.itemL(text="Textures:")
311                 sub1.itemR(system, "gl_texture_limit", text="Limit Size")
312                 sub1.itemR(system, "texture_time_out", text="Time Out")
313                 sub1.itemR(system, "texture_collection_rate", text="Collection Rate")           
314                 
315 class USERPREF_PT_filepaths(bpy.types.Panel):
316         __space_type__ = 'USER_PREFERENCES'
317         __label__ = "File Paths"
318         __show_header__ = False
319
320         def poll(self, context):
321                 userpref = context.user_preferences
322                 return (userpref.active_section == 'FILE_PATHS')
323
324         def draw(self, context):
325                 layout = self.layout
326                 
327                 userpref = context.user_preferences
328                 paths = userpref.filepaths
329                 
330                 split = layout.split()
331                 
332                 col = split.column()
333                 col.itemL(text="File Paths:")
334                 sub = col.split(percentage=0.3)
335                 
336                 sub.itemL(text="Fonts:")
337                 sub.itemR(paths, "fonts_directory", text="")
338                 sub = col.split(percentage=0.3)
339                 sub.itemL(text="Textures:")
340                 sub.itemR(paths, "textures_directory", text="")
341                 sub = col.split(percentage=0.3)
342                 sub.itemL(text="Texture Plugins:")
343                 sub.itemR(paths, "texture_plugin_directory", text="")
344                 sub = col.split(percentage=0.3)
345                 sub.itemL(text="Sequence Plugins:")
346                 sub.itemR(paths, "sequence_plugin_directory", text="")
347                 sub = col.split(percentage=0.3)
348                 sub.itemL(text="Render Output:")
349                 sub.itemR(paths, "render_output_directory", text="")
350                 sub = col.split(percentage=0.3)
351                 sub.itemL(text="Scripts:")
352                 sub.itemR(paths, "python_scripts_directory", text="")
353                 sub = col.split(percentage=0.3)
354                 sub.itemL(text="Sounds:")
355                 sub.itemR(paths, "sounds_directory", text="")
356                 sub = col.split(percentage=0.3)
357                 sub.itemL(text="Temp:")
358                 sub.itemR(paths, "temporary_directory", text="")
359                 
360                 col = split.column()
361                 sub = col.split(percentage=0.2)
362                 sub1 = sub.column()
363                 sub2 = sub.column()
364                 sub2.itemL(text="Save & Load:")
365                 sub2.itemR(paths, "use_relative_paths")
366                 sub2.itemR(paths, "compress_file")
367                 sub2.itemR(paths, "load_ui")
368                 sub2.itemS()
369                 sub2.itemS()
370                 sub2.itemL(text="Auto Save:")
371                 sub2.itemR(paths, "save_version")
372                 sub2.itemR(paths, "recent_files")
373                 sub2.itemR(paths, "save_preview_images")
374                 sub2.itemR(paths, "auto_save_temporary_files")
375                 sub3 = sub2.column()
376                 sub3.enabled = paths.auto_save_temporary_files
377                 sub3.itemR(paths, "auto_save_time", text="Timer (mins)")
378
379 class USERPREF_PT_language(bpy.types.Panel):
380         __space_type__ = 'USER_PREFERENCES'
381         __label__ = "Language"
382         __show_header__ = False
383
384         def poll(self, context):
385                 userpref = context.user_preferences
386                 return (userpref.active_section == 'LANGUAGE_COLORS')
387
388         def draw(self, context):
389                 layout = self.layout
390                 
391                 userpref = context.user_preferences
392                 lan = userpref.language
393                 
394                 split = layout.split()
395                 col = split.column()
396                 
397                 col.itemR(lan, "language")
398                 col.itemL(text="Translate:")
399                 col.itemR(lan, "translate_tooltips", text="Tooltips")
400                 col.itemR(lan, "translate_buttons", text="Labels")
401                 col.itemR(lan, "translate_toolbox", text="Toolbox")
402                 col.itemS()
403                 col.itemS()
404                 col.itemR(lan, "use_textured_fonts")
405                 
406                 col = split.column()
407                 
408
409 bpy.types.register(USERPREF_HT_header)
410 bpy.types.register(USERPREF_MT_view)
411 bpy.types.register(USERPREF_PT_tabs)
412 bpy.types.register(USERPREF_PT_view)
413 bpy.types.register(USERPREF_PT_edit)
414 bpy.types.register(USERPREF_PT_system)
415 bpy.types.register(USERPREF_PT_filepaths)
416 bpy.types.register(USERPREF_PT_language)
417