1 # ##### BEGIN GPL LICENSE BLOCK #####
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program; if not, write to the Free Software Foundation,
15 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 # ##### END GPL LICENSE BLOCK #####
21 from bpy.types import Header, Menu, Panel
22 from bpy.app.translations import pgettext_iface as iface_
23 from bpy.app.translations import contexts as i18n_contexts
26 def opengl_lamp_buttons(column, lamp):
27 split = column.split(percentage=0.1)
29 split.prop(lamp, "use", text="", icon='OUTLINER_OB_LAMP' if lamp.use else 'LAMP_DATA')
34 row.label(text="Diffuse:")
35 row.prop(lamp, "diffuse_color", text="")
37 row.label(text="Specular:")
38 row.prop(lamp, "specular_color", text="")
42 col.prop(lamp, "direction", text="")
45 class USERPREF_HT_header(Header):
46 bl_space_type = 'USER_PREFERENCES'
48 def draw(self, context):
51 layout.template_header()
53 userpref = context.user_preferences
55 layout.operator_context = 'EXEC_AREA'
56 layout.operator("wm.save_userpref")
58 layout.operator_context = 'INVOKE_DEFAULT'
60 if userpref.active_section == 'INPUT':
61 layout.operator("wm.keyconfig_import")
62 layout.operator("wm.keyconfig_export")
63 elif userpref.active_section == 'ADDONS':
64 layout.operator("wm.addon_install", icon='FILESEL')
65 layout.operator("wm.addon_refresh", icon='FILE_REFRESH')
66 layout.menu("USERPREF_MT_addons_dev_guides")
67 elif userpref.active_section == 'THEMES':
68 layout.operator("ui.reset_default_theme")
69 layout.operator("wm.theme_install")
72 class USERPREF_PT_tabs(Panel):
74 bl_space_type = 'USER_PREFERENCES'
75 bl_region_type = 'WINDOW'
76 bl_options = {'HIDE_HEADER'}
78 def draw(self, context):
81 userpref = context.user_preferences
83 layout.prop(userpref, "active_section", expand=True)
86 class USERPREF_MT_interaction_presets(Menu):
88 preset_subdir = "interaction"
89 preset_operator = "script.execute_preset"
90 draw = Menu.draw_preset
93 class USERPREF_MT_appconfigs(Menu):
94 bl_label = "AppPresets"
95 preset_subdir = "keyconfig"
96 preset_operator = "wm.appconfig_activate"
98 def draw(self, context):
99 self.layout.operator("wm.appconfig_default", text="Blender (default)")
101 # now draw the presets
102 Menu.draw_preset(self, context)
105 class USERPREF_MT_splash(Menu):
108 def draw(self, context):
111 split = layout.split()
115 row.label("Interaction:")
117 # text = bpy.path.display_name(context.window_manager.keyconfigs.active.name)
119 # text = "Blender (default)"
120 row.menu("USERPREF_MT_appconfigs", text="Preset")
123 class USERPREF_PT_interface(Panel):
124 bl_space_type = 'USER_PREFERENCES'
125 bl_label = "Interface"
126 bl_region_type = 'WINDOW'
127 bl_options = {'HIDE_HEADER'}
130 def poll(cls, context):
131 userpref = context.user_preferences
132 return (userpref.active_section == 'INTERFACE')
134 def draw(self, context):
138 userpref = context.user_preferences
144 col.label(text="Display:")
145 col.prop(view, "show_tooltips")
146 col.prop(view, "show_tooltips_python")
147 col.prop(view, "show_object_info", text="Object Info")
148 col.prop(view, "show_large_cursors")
149 col.prop(view, "show_view_name", text="View Name")
150 col.prop(view, "show_playback_fps", text="Playback FPS")
151 col.prop(view, "use_global_scene")
152 col.prop(view, "object_origin_size")
158 col.prop(view, "show_mini_axis", text="Display Mini Axis")
160 sub.active = view.show_mini_axis
161 sub.prop(view, "mini_axis_size", text="Size")
162 sub.prop(view, "mini_axis_brightness", text="Brightness")
169 col.label(text="View Manipulation:")
170 col.prop(view, "use_mouse_depth_cursor")
171 col.prop(view, "use_mouse_depth_navigate")
172 col.prop(view, "use_zoom_to_mouse")
173 col.prop(view, "use_rotate_around_active")
174 col.prop(view, "use_global_pivot")
175 col.prop(view, "use_camera_lock_parent")
179 col.prop(view, "use_auto_perspective")
180 col.prop(view, "smooth_view")
181 col.prop(view, "rotation_angle")
186 col.label(text="2D Viewports:")
187 col.prop(view, "view2d_grid_spacing_min", text="Minimum Grid Spacing")
188 col.prop(view, "timecode_style")
194 #Toolbox doesn't exist yet
195 #col.label(text="Toolbox:")
196 #col.prop(view, "show_column_layout")
197 #col.label(text="Open Toolbox Delay:")
198 #col.prop(view, "open_left_mouse_delay", text="Hold LMB")
199 #col.prop(view, "open_right_mouse_delay", text="Hold RMB")
200 col.prop(view, "show_manipulator")
202 sub.active = view.show_manipulator
203 sub.prop(view, "manipulator_size", text="Size")
204 sub.prop(view, "manipulator_handle_size", text="Handle Size")
205 sub.prop(view, "manipulator_hotspot", text="Hotspot")
211 col.label(text="Menus:")
212 col.prop(view, "use_mouse_over_open")
214 sub.active = view.use_mouse_over_open
216 sub.prop(view, "open_toplevel_delay", text="Top Level")
217 sub.prop(view, "open_sublevel_delay", text="Sub Level")
223 col.prop(view, "show_splash")
225 if sys.platform[:3] == "win":
226 col.prop(view, "use_quit_dialog")
229 class USERPREF_PT_edit(Panel):
230 bl_space_type = 'USER_PREFERENCES'
232 bl_region_type = 'WINDOW'
233 bl_options = {'HIDE_HEADER'}
236 def poll(cls, context):
237 userpref = context.user_preferences
238 return (userpref.active_section == 'EDITING')
240 def draw(self, context):
243 userpref = context.user_preferences
249 col.label(text="Link Materials To:")
250 col.prop(edit, "material_link", text="")
256 col.label(text="New Objects:")
257 col.prop(edit, "use_enter_edit_mode")
258 col.label(text="Align To:")
259 col.prop(edit, "object_align", text="")
265 col.label(text="Undo:")
266 col.prop(edit, "use_global_undo")
267 col.prop(edit, "undo_steps", text="Steps")
268 col.prop(edit, "undo_memory_limit", text="Memory Limit")
274 col.label(text="Grease Pencil:")
275 col.prop(edit, "grease_pencil_eraser_radius", text="Eraser Radius")
277 col.prop(edit, "grease_pencil_manhattan_distance", text="Manhattan Distance")
278 col.prop(edit, "grease_pencil_euclidean_distance", text="Euclidean Distance")
280 col.prop(edit, "use_grease_pencil_smooth_stroke", text="Smooth Stroke")
281 col.prop(edit, "use_grease_pencil_simplify_stroke", text="Simplify Stroke")
283 col.prop(edit, "grease_pencil_default_color", text="Default Color")
287 col.label(text="Playback:")
288 col.prop(edit, "use_negative_frames")
292 col.label(text="Animation Editors:")
293 col.prop(edit, "fcurve_unselected_alpha", text="F-Curve Visibility")
299 col.label(text="Keyframing:")
300 col.prop(edit, "use_visual_keying")
301 col.prop(edit, "use_keyframe_insert_needed", text="Only Insert Needed")
305 col.prop(edit, "use_auto_keying", text="Auto Keyframing:")
306 col.prop(edit, "use_auto_keying_warning")
310 #~ sub.active = edit.use_keyframe_insert_auto # incorrect, time-line can enable
311 sub.prop(edit, "use_keyframe_insert_available", text="Only Insert Available")
315 col.label(text="New F-Curve Defaults:")
316 col.prop(edit, "keyframe_new_interpolation_type", text="Interpolation")
317 col.prop(edit, "keyframe_new_handle_type", text="Handles")
318 col.prop(edit, "use_insertkey_xyz_to_rgb", text="XYZ to RGB")
324 col.label(text="Transform:")
325 col.prop(edit, "use_drag_immediately")
331 col.prop(edit, "sculpt_paint_overlay_color", text="Sculpt Overlay Color")
337 col.label(text="Duplicate Data:")
338 col.prop(edit, "use_duplicate_mesh", text="Mesh")
339 col.prop(edit, "use_duplicate_surface", text="Surface")
340 col.prop(edit, "use_duplicate_curve", text="Curve")
341 col.prop(edit, "use_duplicate_text", text="Text")
342 col.prop(edit, "use_duplicate_metaball", text="Metaball")
343 col.prop(edit, "use_duplicate_armature", text="Armature")
344 col.prop(edit, "use_duplicate_lamp", text="Lamp")
345 col.prop(edit, "use_duplicate_material", text="Material")
346 col.prop(edit, "use_duplicate_texture", text="Texture")
347 #col.prop(edit, "use_duplicate_fcurve", text="F-Curve")
348 col.prop(edit, "use_duplicate_action", text="Action")
349 col.prop(edit, "use_duplicate_particle", text="Particle")
352 class USERPREF_PT_system(Panel):
353 bl_space_type = 'USER_PREFERENCES'
355 bl_region_type = 'WINDOW'
356 bl_options = {'HIDE_HEADER'}
359 def poll(cls, context):
360 userpref = context.user_preferences
361 return (userpref.active_section == 'SYSTEM')
363 def draw(self, context):
367 userpref = context.user_preferences
368 system = userpref.system
370 split = layout.split()
373 column = split.column()
374 colsplit = column.split(percentage=0.85)
376 col = colsplit.column()
377 col.label(text="General:")
378 col.prop(system, "dpi")
379 col.prop(system, "frame_server_port")
380 col.prop(system, "scrollback", text="Console Scrollback")
384 col.label(text="Sound:")
385 col.row().prop(system, "audio_device", expand=True)
387 sub.active = system.audio_device != 'NONE'
388 #sub.prop(system, "use_preview_images")
389 sub.prop(system, "audio_channels", text="Channels")
390 sub.prop(system, "audio_mixing_buffer", text="Mixing Buffer")
391 sub.prop(system, "audio_sample_rate", text="Sample Rate")
392 sub.prop(system, "audio_sample_format", text="Sample Format")
396 col.label(text="Screencast:")
397 col.prop(system, "screencast_fps")
398 col.prop(system, "screencast_wait_time")
402 if hasattr(system, "compute_device_type"):
403 col.label(text="Compute Device:")
404 col.row().prop(system, "compute_device_type", expand=True)
406 sub.active = system.compute_device_type != 'CPU'
407 sub.prop(system, "compute_device", text="")
410 column = split.column()
411 colsplit = column.split(percentage=0.85)
413 col = colsplit.column()
414 col.label(text="OpenGL:")
415 col.prop(system, "gl_clip_alpha", slider=True)
416 col.prop(system, "use_mipmaps")
417 col.prop(system, "use_gpu_mipmap")
418 col.prop(system, "use_16bit_textures")
422 col.label(text="Anisotropic Filtering")
423 col.prop(system, "anisotropic_filter", text="")
424 col.prop(system, "use_vertex_buffer_objects")
428 col.label(text="Window Draw Method:")
429 col.prop(system, "window_draw_method", text="")
430 col.prop(system, "multi_sample", text="")
431 if sys.platform == "linux" and system.multi_sample != 'NONE':
432 col.label(text="Might fail for Mesh editing selection!")
434 col.prop(system, "use_region_overlap")
438 col.label(text="Text Draw Options:")
439 col.prop(system, "use_text_antialiasing")
443 col.label(text="Textures:")
444 col.prop(system, "gl_texture_limit", text="Limit Size")
445 col.prop(system, "texture_time_out", text="Time Out")
446 col.prop(system, "texture_collection_rate", text="Collection Rate")
450 col.label(text="Images Draw Method:")
451 col.prop(system, "image_draw_method", text="")
455 col.label(text="Sequencer / Clip Editor:")
456 col.prop(system, "prefetch_frames")
457 col.prop(system, "memory_cache_limit")
460 column = split.column()
462 column.label(text="Solid OpenGL lights:")
464 split = column.split(percentage=0.1)
466 split.label(text="Colors:")
467 split.label(text="Direction:")
469 lamp = system.solid_lights[0]
470 opengl_lamp_buttons(column, lamp)
472 lamp = system.solid_lights[1]
473 opengl_lamp_buttons(column, lamp)
475 lamp = system.solid_lights[2]
476 opengl_lamp_buttons(column, lamp)
480 column.label(text="Color Picker Type:")
481 column.row().prop(system, "color_picker_type", text="")
485 column.prop(system, "use_weight_color_range", text="Custom Weight Paint Range")
486 sub = column.column()
487 sub.active = system.use_weight_color_range
488 sub.template_color_ramp(system, "weight_color_range", expand=True)
491 column.prop(system, "font_path_ui")
493 if bpy.app.build_options.international:
494 column.prop(system, "use_international_fonts")
495 if system.use_international_fonts:
496 column.prop(system, "language")
498 row.label(text="Translate:", text_ctxt=i18n_contexts.id_windowmanager)
499 row = column.row(align=True)
500 row.prop(system, "use_translate_interface", text="Interface", toggle=True)
501 row.prop(system, "use_translate_tooltips", text="Tooltips", toggle=True)
502 row.prop(system, "use_translate_new_dataname", text="New Data", toggle=True)
505 class USERPREF_MT_interface_theme_presets(Menu):
507 preset_subdir = "interface_theme"
508 preset_operator = "script.execute_preset"
511 ("user_preferences.themes[0]", "Theme"),
512 ("user_preferences.ui_styles[0]", "ThemeStyle"),
514 draw = Menu.draw_preset
517 class USERPREF_PT_theme(Panel):
518 bl_space_type = 'USER_PREFERENCES'
520 bl_region_type = 'WINDOW'
521 bl_options = {'HIDE_HEADER'}
524 def _theme_generic(split, themedata):
528 def theme_generic_recurse(data):
529 col.label(data.rna_type.name)
531 subsplit = row.split(percentage=0.95)
533 padding1 = subsplit.split(percentage=0.15)
536 subsplit = row.split(percentage=0.85)
538 padding2 = subsplit.split(percentage=0.15)
541 colsub_pair = padding1.column(), padding2.column()
545 for i, prop in enumerate(data.rna_type.properties):
546 if prop.identifier == "rna_type":
549 props_type.setdefault((prop.type, prop.subtype), []).append(prop)
551 for props_type, props_ls in sorted(props_type.items()):
552 if props_type[0] == 'POINTER':
553 for i, prop in enumerate(props_ls):
554 theme_generic_recurse(getattr(data, prop.identifier))
556 for i, prop in enumerate(props_ls):
557 colsub_pair[i % 2].row().prop(data, prop.identifier)
559 theme_generic_recurse(themedata)
562 def _theme_widget_style(layout, widget_style):
566 subsplit = row.split(percentage=0.95)
568 padding = subsplit.split(percentage=0.15)
569 colsub = padding.column()
570 colsub = padding.column()
571 colsub.row().prop(widget_style, "outline")
572 colsub.row().prop(widget_style, "item", slider=True)
573 colsub.row().prop(widget_style, "inner", slider=True)
574 colsub.row().prop(widget_style, "inner_sel", slider=True)
576 subsplit = row.split(percentage=0.85)
578 padding = subsplit.split(percentage=0.15)
579 colsub = padding.column()
580 colsub = padding.column()
581 colsub.row().prop(widget_style, "text")
582 colsub.row().prop(widget_style, "text_sel")
583 colsub.prop(widget_style, "show_shaded")
584 subsub = colsub.column(align=True)
585 subsub.active = widget_style.show_shaded
586 subsub.prop(widget_style, "shadetop")
587 subsub.prop(widget_style, "shadedown")
592 def _ui_font_style(layout, font_style):
594 split = layout.split()
597 col.label(text="Kerning Style:")
598 col.row().prop(font_style, "font_kerning_style", expand=True)
599 col.prop(font_style, "points")
602 col.label(text="Shadow Offset:")
603 col.prop(font_style, "shadow_offset_x", text="X")
604 col.prop(font_style, "shadow_offset_y", text="Y")
607 col.prop(font_style, "shadow")
608 col.prop(font_style, "shadow_alpha")
609 col.prop(font_style, "shadow_value")
614 def poll(cls, context):
615 userpref = context.user_preferences
616 return (userpref.active_section == 'THEMES')
618 def draw(self, context):
621 theme = context.user_preferences.themes[0]
623 split_themes = layout.split(percentage=0.2)
625 sub = split_themes.column()
627 sub.label(text="Presets:")
628 subrow = sub.row(align=True)
630 subrow.menu("USERPREF_MT_interface_theme_presets", text=USERPREF_MT_interface_theme_presets.bl_label)
631 subrow.operator("wm.interface_theme_preset_add", text="", icon='ZOOMIN')
632 subrow.operator("wm.interface_theme_preset_add", text="", icon='ZOOMOUT').remove_active = True
635 sub.prop(theme, "theme_area", expand=True)
637 split = layout.split(percentage=0.4)
642 split = split_themes.split()
644 if theme.theme_area == 'USER_INTERFACE':
646 ui = theme.user_interface
648 col.label(text="Regular:")
649 self._theme_widget_style(col, ui.wcol_regular)
651 col.label(text="Tool:")
652 self._theme_widget_style(col, ui.wcol_tool)
654 col.label(text="Radio Buttons:")
655 self._theme_widget_style(col, ui.wcol_radio)
657 col.label(text="Text:")
658 self._theme_widget_style(col, ui.wcol_text)
660 col.label(text="Option:")
661 self._theme_widget_style(col, ui.wcol_option)
663 col.label(text="Toggle:")
664 self._theme_widget_style(col, ui.wcol_toggle)
666 col.label(text="Number Field:")
667 self._theme_widget_style(col, ui.wcol_num)
669 col.label(text="Value Slider:")
670 self._theme_widget_style(col, ui.wcol_numslider)
672 col.label(text="Box:")
673 self._theme_widget_style(col, ui.wcol_box)
675 col.label(text="Menu:")
676 self._theme_widget_style(col, ui.wcol_menu)
678 col.label(text="Pulldown:")
679 self._theme_widget_style(col, ui.wcol_pulldown)
681 col.label(text="Menu Back:")
682 self._theme_widget_style(col, ui.wcol_menu_back)
684 col.label(text="Tooltip:")
685 self._theme_widget_style(col, ui.wcol_tooltip)
687 col.label(text="Menu Item:")
688 self._theme_widget_style(col, ui.wcol_menu_item)
690 col.label(text="Scroll Bar:")
691 self._theme_widget_style(col, ui.wcol_scroll)
693 col.label(text="Progress Bar:")
694 self._theme_widget_style(col, ui.wcol_progress)
696 col.label(text="List Item:")
697 self._theme_widget_style(col, ui.wcol_list_item)
699 ui_state = theme.user_interface.wcol_state
700 col.label(text="State:")
704 subsplit = row.split(percentage=0.95)
706 padding = subsplit.split(percentage=0.15)
707 colsub = padding.column()
708 colsub = padding.column()
709 colsub.row().prop(ui_state, "inner_anim")
710 colsub.row().prop(ui_state, "inner_anim_sel")
711 colsub.row().prop(ui_state, "inner_driven")
712 colsub.row().prop(ui_state, "inner_driven_sel")
714 subsplit = row.split(percentage=0.85)
716 padding = subsplit.split(percentage=0.15)
717 colsub = padding.column()
718 colsub = padding.column()
719 colsub.row().prop(ui_state, "inner_key")
720 colsub.row().prop(ui_state, "inner_key_sel")
721 colsub.row().prop(ui_state, "blend")
726 col.label("Menu Shadow:")
730 subsplit = row.split(percentage=0.95)
732 padding = subsplit.split(percentage=0.15)
733 colsub = padding.column()
734 colsub = padding.column()
735 colsub.row().prop(ui, "menu_shadow_fac")
737 subsplit = row.split(percentage=0.85)
739 padding = subsplit.split(percentage=0.15)
740 colsub = padding.column()
741 colsub = padding.column()
742 colsub.row().prop(ui, "menu_shadow_width")
751 subsplit = row.split(percentage=0.95)
753 padding = subsplit.split(percentage=0.15)
754 colsub = padding.column()
755 colsub = padding.column()
757 #~ colsub.active = False
758 #~ colsub.row().prop(ui, "icon_file")
760 subsplit = row.split(percentage=0.85)
762 padding = subsplit.split(percentage=0.15)
763 colsub = padding.column()
764 colsub = padding.column()
765 colsub.row().prop(ui, "icon_alpha")
770 col.label("Axis Colors:")
774 subsplit = row.split(percentage=0.95)
776 padding = subsplit.split(percentage=0.15)
777 colsub = padding.column()
778 colsub = padding.column()
779 colsub.row().prop(ui, "axis_x")
780 colsub.row().prop(ui, "axis_y")
781 colsub.row().prop(ui, "axis_z")
783 subsplit = row.split(percentage=0.85)
785 padding = subsplit.split(percentage=0.15)
786 colsub = padding.column()
787 colsub = padding.column()
791 elif theme.theme_area == 'BONE_COLOR_SETS':
794 for i, ui in enumerate(theme.bone_color_sets):
795 col.label(text=iface_("Color Set %d:") % (i + 1), translate=False) # i starts from 0
799 subsplit = row.split(percentage=0.95)
801 padding = subsplit.split(percentage=0.15)
802 colsub = padding.column()
803 colsub = padding.column()
804 colsub.row().prop(ui, "normal")
805 colsub.row().prop(ui, "select")
806 colsub.row().prop(ui, "active")
808 subsplit = row.split(percentage=0.85)
810 padding = subsplit.split(percentage=0.15)
811 colsub = padding.column()
812 colsub = padding.column()
813 colsub.row().prop(ui, "show_colored_constraints")
814 elif theme.theme_area == 'STYLE':
817 style = context.user_preferences.ui_styles[0]
819 col.label(text="Panel Title:")
820 self._ui_font_style(col, style.panel_title)
824 col.label(text="Widget:")
825 self._ui_font_style(col, style.widget)
829 col.label(text="Widget Label:")
830 self._ui_font_style(col, style.widget_label)
832 self._theme_generic(split, getattr(theme, theme.theme_area.lower()))
835 class USERPREF_PT_file(Panel):
836 bl_space_type = 'USER_PREFERENCES'
838 bl_region_type = 'WINDOW'
839 bl_options = {'HIDE_HEADER'}
842 def poll(cls, context):
843 userpref = context.user_preferences
844 return (userpref.active_section == 'FILES')
846 def draw(self, context):
849 userpref = context.user_preferences
850 paths = userpref.filepaths
851 system = userpref.system
853 split = layout.split(percentage=0.7)
856 col.label(text="File Paths:")
858 colsplit = col.split(percentage=0.95)
859 col1 = colsplit.split(percentage=0.3)
862 sub.label(text="Fonts:")
863 sub.label(text="Textures:")
864 sub.label(text="Render Output:")
865 sub.label(text="Scripts:")
866 sub.label(text="Sounds:")
867 sub.label(text="Temp:")
868 sub.label(text="I18n Branches:")
869 sub.label(text="Image Editor:")
870 sub.label(text="Animation Player:")
873 sub.prop(paths, "font_directory", text="")
874 sub.prop(paths, "texture_directory", text="")
875 sub.prop(paths, "render_output_directory", text="")
876 sub.prop(paths, "script_directory", text="")
877 sub.prop(paths, "sound_directory", text="")
878 sub.prop(paths, "temporary_directory", text="")
879 sub.prop(paths, "i18n_branches_directory", text="")
880 sub.prop(paths, "image_editor", text="")
881 subsplit = sub.split(percentage=0.3)
882 subsplit.prop(paths, "animation_player_preset", text="")
883 subsplit.prop(paths, "animation_player", text="")
888 colsplit = col.split(percentage=0.95)
889 sub = colsplit.column()
891 row = sub.split(percentage=0.3)
892 row.label(text="Auto Execution:")
893 row.prop(system, "use_scripts_auto_execute")
895 if system.use_scripts_auto_execute:
898 row.label(text="Excluded Paths:")
899 row.operator("wm.userpref_autoexec_path_add", text="", icon='ZOOMIN', emboss=False)
900 for i, path_cmp in enumerate(userpref.autoexec_paths):
902 row.prop(path_cmp, "path", text="")
903 row.prop(path_cmp, "use_glob", text="", icon='FILTER')
904 row.operator("wm.userpref_autoexec_path_remove", text="", icon='X', emboss=False).index = i
907 col.label(text="Save & Load:")
908 col.prop(paths, "use_relative_paths")
909 col.prop(paths, "use_file_compression")
910 col.prop(paths, "use_load_ui")
911 col.prop(paths, "use_filter_files")
912 col.prop(paths, "show_hidden_files_datablocks")
913 col.prop(paths, "hide_recent_locations")
914 col.prop(paths, "hide_system_bookmarks")
915 col.prop(paths, "show_thumbnails")
919 col.prop(paths, "save_version")
920 col.prop(paths, "recent_files")
921 col.prop(paths, "use_save_preview_images")
925 col.label(text="Auto Save:")
926 col.prop(paths, "use_keep_session")
927 col.prop(paths, "use_auto_save_temporary_files")
929 sub.active = paths.use_auto_save_temporary_files
930 sub.prop(paths, "auto_save_time", text="Timer (mins)")
934 col.label(text="Text Editor:")
935 col.prop(system, "use_tabs_as_spaces")
937 colsplit = col.split(percentage=0.95)
938 col1 = colsplit.split(percentage=0.3)
941 sub.label(text="Author:")
943 sub.prop(system, "author", text="")
946 class USERPREF_MT_ndof_settings(Menu):
947 # accessed from the window key-bindings in C (only)
948 bl_label = "3D Mouse Settings"
950 def draw(self, context):
953 input_prefs = context.user_preferences.inputs
955 is_view3d = context.space_data.type == 'VIEW_3D'
957 layout.prop(input_prefs, "ndof_sensitivity")
958 layout.prop(input_prefs, "ndof_orbit_sensitivity")
962 layout.prop(input_prefs, "ndof_show_guide")
965 layout.label(text="Orbit style")
966 layout.row().prop(input_prefs, "ndof_view_navigate_method", text="")
967 layout.row().prop(input_prefs, "ndof_view_rotate_method", text="")
969 layout.label(text="Orbit options")
970 layout.prop(input_prefs, "ndof_rotx_invert_axis")
971 layout.prop(input_prefs, "ndof_roty_invert_axis")
972 layout.prop(input_prefs, "ndof_rotz_invert_axis")
974 # view2d use pan/zoom
976 layout.label(text="Pan options")
977 layout.prop(input_prefs, "ndof_panx_invert_axis")
978 layout.prop(input_prefs, "ndof_pany_invert_axis")
979 layout.prop(input_prefs, "ndof_panz_invert_axis")
980 layout.prop(input_prefs, "ndof_pan_yz_swap_axis")
982 layout.label(text="Zoom options")
983 layout.prop(input_prefs, "ndof_zoom_invert")
987 layout.label(text="Fly/Walk options")
988 layout.prop(input_prefs, "ndof_fly_helicopter", icon='NDOF_FLY')
989 layout.prop(input_prefs, "ndof_lock_horizon", icon='NDOF_DOM')
992 class USERPREF_MT_keyconfigs(Menu):
993 bl_label = "KeyPresets"
994 preset_subdir = "keyconfig"
995 preset_operator = "wm.keyconfig_activate"
997 def draw(self, context):
998 props = self.layout.operator("wm.context_set_value", text="Blender (default)")
999 props.data_path = "window_manager.keyconfigs.active"
1000 props.value = "context.window_manager.keyconfigs.default"
1002 # now draw the presets
1003 Menu.draw_preset(self, context)
1006 class USERPREF_PT_input(Panel):
1007 bl_space_type = 'USER_PREFERENCES'
1009 bl_region_type = 'WINDOW'
1010 bl_options = {'HIDE_HEADER'}
1013 def poll(cls, context):
1014 userpref = context.user_preferences
1015 return (userpref.active_section == 'INPUT')
1017 def draw_input_prefs(self, inputs, layout):
1025 sub.label(text="Presets:")
1026 subrow = sub.row(align=True)
1028 subrow.menu("USERPREF_MT_interaction_presets", text=bpy.types.USERPREF_MT_interaction_presets.bl_label)
1029 subrow.operator("wm.interaction_preset_add", text="", icon='ZOOMIN')
1030 subrow.operator("wm.interaction_preset_add", text="", icon='ZOOMOUT').remove_active = True
1033 sub.label(text="Mouse:")
1035 sub1.active = (inputs.select_mouse == 'RIGHT')
1036 sub1.prop(inputs, "use_mouse_emulate_3_button")
1037 sub.prop(inputs, "use_mouse_continuous")
1038 sub.prop(inputs, "drag_threshold")
1039 sub.prop(inputs, "tweak_threshold")
1041 sub.label(text="Select With:")
1042 sub.row().prop(inputs, "select_mouse", expand=True)
1045 sub.label(text="Double Click:")
1046 sub.prop(inputs, "mouse_double_click_time", text="Speed")
1050 sub.prop(inputs, "use_emulate_numpad")
1054 sub.label(text="Orbit Style:")
1055 sub.row().prop(inputs, "view_rotate_method", expand=True)
1059 sub.label(text="Zoom Style:")
1060 sub.row().prop(inputs, "view_zoom_method", text="")
1061 if inputs.view_zoom_method in {'DOLLY', 'CONTINUE'}:
1062 sub.row().prop(inputs, "view_zoom_axis", expand=True)
1063 sub.prop(inputs, "invert_mouse_zoom", text="Invert Mouse Zoom Direction")
1065 #sub.prop(inputs, "use_mouse_mmb_paste")
1070 sub.prop(inputs, "invert_zoom_wheel", text="Invert Wheel Zoom Direction")
1071 #sub.prop(view, "wheel_scroll_lines", text="Scroll Lines")
1073 if sys.platform == "darwin":
1075 sub.prop(inputs, "use_trackpad_natural", text="Natural Trackpad Direction")
1079 sub.label(text="View Navigation:")
1080 sub.row().prop(inputs, "navigation_mode", expand=True)
1081 if inputs.navigation_mode == 'WALK':
1082 walk = inputs.walk_navigation
1084 sub.prop(walk, "use_mouse_reverse")
1085 sub.prop(walk, "mouse_speed")
1086 sub.prop(walk, "teleport_time")
1088 sub = col.column(align=True)
1089 sub.prop(walk, "walk_speed")
1090 sub.prop(walk, "walk_speed_factor")
1093 sub.prop(walk, "use_gravity")
1094 sub = col.column(align=True)
1095 sub.active = walk.use_gravity
1096 sub.prop(walk, "view_height")
1097 sub.prop(walk, "jump_height")
1101 sub.label(text="NDOF Device:")
1102 sub.prop(inputs, "ndof_sensitivity", text="NDOF Sensitivity")
1103 sub.prop(inputs, "ndof_orbit_sensitivity", text="NDOF Orbit Sensitivity")
1104 sub.row().prop(inputs, "ndof_view_navigate_method", expand=True)
1105 sub.row().prop(inputs, "ndof_view_rotate_method", expand=True)
1109 def draw(self, context):
1110 from rna_keymap_ui import draw_keymaps
1112 layout = self.layout
1116 #start = time.time()
1118 userpref = context.user_preferences
1120 inputs = userpref.inputs
1122 split = layout.split(percentage=0.25)
1125 self.draw_input_prefs(inputs, split)
1128 draw_keymaps(context, split)
1130 #print("runtime", time.time() - start)
1133 class USERPREF_MT_addons_dev_guides(Menu):
1134 bl_label = "Development Guides"
1136 # menu to open web-pages with addons development guides
1137 def draw(self, context):
1138 layout = self.layout
1140 layout.operator("wm.url_open", text="API Concepts", icon='URL').url = "http://wiki.blender.org/index.php/Dev:2.5/Py/API/Intro"
1141 layout.operator("wm.url_open", text="Addon Guidelines", icon='URL').url = "http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Guidelines/Addons"
1142 layout.operator("wm.url_open", text="How to share your addon", icon='URL').url = "http://wiki.blender.org/index.php/Dev:Py/Sharing"
1145 class USERPREF_PT_addons(Panel):
1146 bl_space_type = 'USER_PREFERENCES'
1148 bl_region_type = 'WINDOW'
1149 bl_options = {'HIDE_HEADER'}
1151 _support_icon_mapping = {
1152 'OFFICIAL': 'FILE_BLEND',
1153 'COMMUNITY': 'POSE_DATA',
1154 'TESTING': 'MOD_EXPLODE',
1158 def poll(cls, context):
1159 userpref = context.user_preferences
1160 return (userpref.active_section == 'ADDONS')
1163 def is_user_addon(mod, user_addon_paths):
1166 if not user_addon_paths:
1167 for path in (bpy.utils.script_path_user(),
1168 bpy.utils.script_path_pref()):
1169 if path is not None:
1170 user_addon_paths.append(os.path.join(path, "addons"))
1172 for path in user_addon_paths:
1173 if bpy.path.is_subdir(mod.__file__, path):
1178 def draw_error(layout, message):
1179 lines = message.split("\n")
1183 sub.label(icon='ERROR')
1187 def draw(self, context):
1191 layout = self.layout
1193 userpref = context.user_preferences
1194 used_ext = {ext.module for ext in userpref.addons}
1196 userpref_addons_folder = os.path.join(userpref.filepaths.script_directory, "addons")
1197 scripts_addons_folder = bpy.utils.user_resource('SCRIPTS', "addons")
1199 # collect the categories that can be filtered on
1200 addons = [(mod, addon_utils.module_bl_info(mod)) for mod in addon_utils.modules(refresh=False)]
1202 split = layout.split(percentage=0.2)
1203 col = split.column()
1204 col.prop(context.window_manager, "addon_search", text="", icon='VIEWZOOM')
1206 col.label(text="Supported Level")
1207 col.prop(context.window_manager, "addon_support", expand=True)
1209 col.label(text="Categories")
1210 col.prop(context.window_manager, "addon_filter", expand=True)
1212 col = split.column()
1214 # set in addon_utils.modules_refresh()
1215 if addon_utils.error_duplicates:
1216 self.draw_error(col,
1217 "Multiple addons using the same name found!\n"
1218 "likely a problem with the script search path.\n"
1219 "(see console for details)",
1222 if addon_utils.error_encoding:
1223 self.draw_error(col,
1224 "One or more addons do not have UTF-8 encoding\n"
1225 "(see console for details)",
1228 filter = context.window_manager.addon_filter
1229 search = context.window_manager.addon_search.lower()
1230 support = context.window_manager.addon_support
1232 # initialized on demand
1233 user_addon_paths = []
1235 for mod, info in addons:
1236 module_name = mod.__name__
1238 is_enabled = module_name in used_ext
1240 if info["support"] not in support:
1243 # check if addon should be visible with current filters
1244 if ((filter == "All") or
1245 (filter == info["category"]) or
1246 (filter == "Enabled" and is_enabled) or
1247 (filter == "Disabled" and not is_enabled) or
1248 (filter == "User" and (mod.__file__.startswith((scripts_addons_folder, userpref_addons_folder))))
1251 if search and search not in info["name"].lower():
1253 if search not in info["author"].lower():
1259 col_box = col.column()
1261 colsub = box.column()
1264 row.operator("wm.addon_expand", icon='TRIA_DOWN' if info["show_expanded"] else 'TRIA_RIGHT', emboss=False).module = module_name
1267 sub.active = is_enabled
1268 sub.label(text='%s: %s' % (info["category"], info["name"]))
1270 sub.label(icon='ERROR')
1272 # icon showing support level.
1273 sub.label(icon=self._support_icon_mapping.get(info["support"], 'QUESTION'))
1276 row.operator("wm.addon_disable", icon='CHECKBOX_HLT', text="", emboss=False).module = module_name
1278 row.operator("wm.addon_enable", icon='CHECKBOX_DEHLT', text="", emboss=False).module = module_name
1280 # Expanded UI (only if additional info is available)
1281 if info["show_expanded"]:
1282 if info["description"]:
1283 split = colsub.row().split(percentage=0.15)
1284 split.label(text="Description:")
1285 split.label(text=info["description"])
1286 if info["location"]:
1287 split = colsub.row().split(percentage=0.15)
1288 split.label(text="Location:")
1289 split.label(text=info["location"])
1291 split = colsub.row().split(percentage=0.15)
1292 split.label(text="File:")
1293 split.label(text=mod.__file__, translate=False)
1295 split = colsub.row().split(percentage=0.15)
1296 split.label(text="Author:")
1297 split.label(text=info["author"], translate=False)
1299 split = colsub.row().split(percentage=0.15)
1300 split.label(text="Version:")
1301 split.label(text='.'.join(str(x) for x in info["version"]), translate=False)
1303 split = colsub.row().split(percentage=0.15)
1304 split.label(text="Warning:")
1305 split.label(text=' ' + info["warning"], icon='ERROR')
1307 user_addon = USERPREF_PT_addons.is_user_addon(mod, user_addon_paths)
1308 tot_row = bool(info["wiki_url"]) + bool(user_addon)
1311 split = colsub.row().split(percentage=0.15)
1312 split.label(text="Internet:")
1313 if info["wiki_url"]:
1314 split.operator("wm.url_open", text="Documentation", icon='HELP').url = info["wiki_url"]
1315 split.operator("wm.url_open", text="Report a Bug", icon='URL').url = info.get(
1317 "http://developer.blender.org/maniphest/task/create/?project=3&type=Bug")
1319 split.operator("wm.addon_remove", text="Remove", icon='CANCEL').module = mod.__name__
1321 for i in range(4 - tot_row):
1324 # Show addon user preferences
1326 addon_preferences = userpref.addons[module_name].preferences
1327 if addon_preferences is not None:
1328 draw = getattr(addon_preferences, "draw", None)
1329 if draw is not None:
1330 addon_preferences_class = type(addon_preferences)
1331 box_prefs = col_box.box()
1332 box_prefs.label("Preferences:")
1333 addon_preferences_class.layout = box_prefs
1338 traceback.print_exc()
1339 box_prefs.label(text="Error (see console)", icon='ERROR')
1340 del addon_preferences_class.layout
1342 # Append missing scripts
1343 # First collect scripts that are used but have no script file.
1344 module_names = {mod.__name__ for mod, info in addons}
1345 missing_modules = {ext for ext in used_ext if ext not in module_names}
1347 if missing_modules and filter in {"All", "Enabled"}:
1348 col.column().separator()
1349 col.column().label(text="Missing script files")
1351 module_names = {mod.__name__ for mod, info in addons}
1352 for module_name in sorted(missing_modules):
1353 is_enabled = module_name in used_ext
1355 box = col.column().box()
1356 colsub = box.column()
1359 row.label(text=module_name, translate=False, icon='ERROR')
1362 row.operator("wm.addon_disable", icon='CHECKBOX_HLT', text="", emboss=False).module = module_name
1364 if __name__ == "__main__": # only for live edit.
1365 bpy.utils.register_module(__name__)