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)
490 if bpy.app.build_options.international:
492 column.prop(system, "use_international_fonts")
493 if system.use_international_fonts:
494 column.prop(system, "language")
496 row.label(text="Translate:", text_ctxt=i18n_contexts.id_windowmanager)
497 row = column.row(align=True)
498 row.prop(system, "use_translate_interface", text="Interface", toggle=True)
499 row.prop(system, "use_translate_tooltips", text="Tooltips", toggle=True)
500 row.prop(system, "use_translate_new_dataname", text="New Data", toggle=True)
503 class USERPREF_MT_interface_theme_presets(Menu):
505 preset_subdir = "interface_theme"
506 preset_operator = "script.execute_preset"
509 ("user_preferences.themes[0]", "Theme"),
510 ("user_preferences.ui_styles[0]", "ThemeStyle"),
512 draw = Menu.draw_preset
515 class USERPREF_PT_theme(Panel):
516 bl_space_type = 'USER_PREFERENCES'
518 bl_region_type = 'WINDOW'
519 bl_options = {'HIDE_HEADER'}
522 def _theme_generic(split, themedata):
526 def theme_generic_recurse(data):
527 col.label(data.rna_type.name)
529 subsplit = row.split(percentage=0.95)
531 padding1 = subsplit.split(percentage=0.15)
534 subsplit = row.split(percentage=0.85)
536 padding2 = subsplit.split(percentage=0.15)
539 colsub_pair = padding1.column(), padding2.column()
543 for i, prop in enumerate(data.rna_type.properties):
544 if prop.identifier == "rna_type":
547 props_type.setdefault((prop.type, prop.subtype), []).append(prop)
549 for props_type, props_ls in sorted(props_type.items()):
550 if props_type[0] == 'POINTER':
551 for i, prop in enumerate(props_ls):
552 theme_generic_recurse(getattr(data, prop.identifier))
554 for i, prop in enumerate(props_ls):
555 colsub_pair[i % 2].row().prop(data, prop.identifier)
557 theme_generic_recurse(themedata)
560 def _theme_widget_style(layout, widget_style):
564 subsplit = row.split(percentage=0.95)
566 padding = subsplit.split(percentage=0.15)
567 colsub = padding.column()
568 colsub = padding.column()
569 colsub.row().prop(widget_style, "outline")
570 colsub.row().prop(widget_style, "item", slider=True)
571 colsub.row().prop(widget_style, "inner", slider=True)
572 colsub.row().prop(widget_style, "inner_sel", slider=True)
574 subsplit = row.split(percentage=0.85)
576 padding = subsplit.split(percentage=0.15)
577 colsub = padding.column()
578 colsub = padding.column()
579 colsub.row().prop(widget_style, "text")
580 colsub.row().prop(widget_style, "text_sel")
581 colsub.prop(widget_style, "show_shaded")
582 subsub = colsub.column(align=True)
583 subsub.active = widget_style.show_shaded
584 subsub.prop(widget_style, "shadetop")
585 subsub.prop(widget_style, "shadedown")
590 def _ui_font_style(layout, font_style):
592 split = layout.split()
595 col.label(text="Kerning Style:")
596 col.row().prop(font_style, "font_kerning_style", expand=True)
597 col.prop(font_style, "points")
600 col.label(text="Shadow Offset:")
601 col.prop(font_style, "shadow_offset_x", text="X")
602 col.prop(font_style, "shadow_offset_y", text="Y")
605 col.prop(font_style, "shadow")
606 col.prop(font_style, "shadow_alpha")
607 col.prop(font_style, "shadow_value")
612 def poll(cls, context):
613 userpref = context.user_preferences
614 return (userpref.active_section == 'THEMES')
616 def draw(self, context):
619 theme = context.user_preferences.themes[0]
621 split_themes = layout.split(percentage=0.2)
623 sub = split_themes.column()
625 sub.label(text="Presets:")
626 subrow = sub.row(align=True)
628 subrow.menu("USERPREF_MT_interface_theme_presets", text=USERPREF_MT_interface_theme_presets.bl_label)
629 subrow.operator("wm.interface_theme_preset_add", text="", icon='ZOOMIN')
630 subrow.operator("wm.interface_theme_preset_add", text="", icon='ZOOMOUT').remove_active = True
633 sub.prop(theme, "theme_area", expand=True)
635 split = layout.split(percentage=0.4)
640 split = split_themes.split()
642 if theme.theme_area == 'USER_INTERFACE':
644 ui = theme.user_interface
646 col.label(text="Regular:")
647 self._theme_widget_style(col, ui.wcol_regular)
649 col.label(text="Tool:")
650 self._theme_widget_style(col, ui.wcol_tool)
652 col.label(text="Radio Buttons:")
653 self._theme_widget_style(col, ui.wcol_radio)
655 col.label(text="Text:")
656 self._theme_widget_style(col, ui.wcol_text)
658 col.label(text="Option:")
659 self._theme_widget_style(col, ui.wcol_option)
661 col.label(text="Toggle:")
662 self._theme_widget_style(col, ui.wcol_toggle)
664 col.label(text="Number Field:")
665 self._theme_widget_style(col, ui.wcol_num)
667 col.label(text="Value Slider:")
668 self._theme_widget_style(col, ui.wcol_numslider)
670 col.label(text="Box:")
671 self._theme_widget_style(col, ui.wcol_box)
673 col.label(text="Menu:")
674 self._theme_widget_style(col, ui.wcol_menu)
676 col.label(text="Pulldown:")
677 self._theme_widget_style(col, ui.wcol_pulldown)
679 col.label(text="Menu Back:")
680 self._theme_widget_style(col, ui.wcol_menu_back)
682 col.label(text="Tooltip:")
683 self._theme_widget_style(col, ui.wcol_tooltip)
685 col.label(text="Menu Item:")
686 self._theme_widget_style(col, ui.wcol_menu_item)
688 col.label(text="Scroll Bar:")
689 self._theme_widget_style(col, ui.wcol_scroll)
691 col.label(text="Progress Bar:")
692 self._theme_widget_style(col, ui.wcol_progress)
694 col.label(text="List Item:")
695 self._theme_widget_style(col, ui.wcol_list_item)
697 ui_state = theme.user_interface.wcol_state
698 col.label(text="State:")
702 subsplit = row.split(percentage=0.95)
704 padding = subsplit.split(percentage=0.15)
705 colsub = padding.column()
706 colsub = padding.column()
707 colsub.row().prop(ui_state, "inner_anim")
708 colsub.row().prop(ui_state, "inner_anim_sel")
709 colsub.row().prop(ui_state, "inner_driven")
710 colsub.row().prop(ui_state, "inner_driven_sel")
712 subsplit = row.split(percentage=0.85)
714 padding = subsplit.split(percentage=0.15)
715 colsub = padding.column()
716 colsub = padding.column()
717 colsub.row().prop(ui_state, "inner_key")
718 colsub.row().prop(ui_state, "inner_key_sel")
719 colsub.row().prop(ui_state, "blend")
724 col.label("Menu Shadow:")
728 subsplit = row.split(percentage=0.95)
730 padding = subsplit.split(percentage=0.15)
731 colsub = padding.column()
732 colsub = padding.column()
733 colsub.row().prop(ui, "menu_shadow_fac")
735 subsplit = row.split(percentage=0.85)
737 padding = subsplit.split(percentage=0.15)
738 colsub = padding.column()
739 colsub = padding.column()
740 colsub.row().prop(ui, "menu_shadow_width")
749 subsplit = row.split(percentage=0.95)
751 padding = subsplit.split(percentage=0.15)
752 colsub = padding.column()
753 colsub = padding.column()
755 #~ colsub.active = False
756 #~ colsub.row().prop(ui, "icon_file")
758 subsplit = row.split(percentage=0.85)
760 padding = subsplit.split(percentage=0.15)
761 colsub = padding.column()
762 colsub = padding.column()
763 colsub.row().prop(ui, "icon_alpha")
768 col.label("Axis Colors:")
772 subsplit = row.split(percentage=0.95)
774 padding = subsplit.split(percentage=0.15)
775 colsub = padding.column()
776 colsub = padding.column()
777 colsub.row().prop(ui, "axis_x")
778 colsub.row().prop(ui, "axis_y")
779 colsub.row().prop(ui, "axis_z")
781 subsplit = row.split(percentage=0.85)
783 padding = subsplit.split(percentage=0.15)
784 colsub = padding.column()
785 colsub = padding.column()
789 elif theme.theme_area == 'BONE_COLOR_SETS':
792 for i, ui in enumerate(theme.bone_color_sets):
793 col.label(text=iface_("Color Set %d:") % (i + 1), translate=False) # i starts from 0
797 subsplit = row.split(percentage=0.95)
799 padding = subsplit.split(percentage=0.15)
800 colsub = padding.column()
801 colsub = padding.column()
802 colsub.row().prop(ui, "normal")
803 colsub.row().prop(ui, "select")
804 colsub.row().prop(ui, "active")
806 subsplit = row.split(percentage=0.85)
808 padding = subsplit.split(percentage=0.15)
809 colsub = padding.column()
810 colsub = padding.column()
811 colsub.row().prop(ui, "show_colored_constraints")
812 elif theme.theme_area == 'STYLE':
815 style = context.user_preferences.ui_styles[0]
817 col.label(text="Panel Title:")
818 self._ui_font_style(col, style.panel_title)
822 col.label(text="Widget:")
823 self._ui_font_style(col, style.widget)
827 col.label(text="Widget Label:")
828 self._ui_font_style(col, style.widget_label)
830 self._theme_generic(split, getattr(theme, theme.theme_area.lower()))
833 class USERPREF_PT_file(Panel):
834 bl_space_type = 'USER_PREFERENCES'
836 bl_region_type = 'WINDOW'
837 bl_options = {'HIDE_HEADER'}
840 def poll(cls, context):
841 userpref = context.user_preferences
842 return (userpref.active_section == 'FILES')
844 def draw(self, context):
847 userpref = context.user_preferences
848 paths = userpref.filepaths
849 system = userpref.system
851 split = layout.split(percentage=0.7)
854 col.label(text="File Paths:")
856 colsplit = col.split(percentage=0.95)
857 col1 = colsplit.split(percentage=0.3)
860 sub.label(text="Fonts:")
861 sub.label(text="Textures:")
862 sub.label(text="Render Output:")
863 sub.label(text="Scripts:")
864 sub.label(text="Sounds:")
865 sub.label(text="Temp:")
866 sub.label(text="I18n Branches:")
867 sub.label(text="Image Editor:")
868 sub.label(text="Animation Player:")
871 sub.prop(paths, "font_directory", text="")
872 sub.prop(paths, "texture_directory", text="")
873 sub.prop(paths, "render_output_directory", text="")
874 sub.prop(paths, "script_directory", text="")
875 sub.prop(paths, "sound_directory", text="")
876 sub.prop(paths, "temporary_directory", text="")
877 sub.prop(paths, "i18n_branches_directory", text="")
878 sub.prop(paths, "image_editor", text="")
879 subsplit = sub.split(percentage=0.3)
880 subsplit.prop(paths, "animation_player_preset", text="")
881 subsplit.prop(paths, "animation_player", text="")
886 colsplit = col.split(percentage=0.95)
887 sub = colsplit.column()
889 row = sub.split(percentage=0.3)
890 row.label(text="Auto Execution:")
891 row.prop(system, "use_scripts_auto_execute")
893 if system.use_scripts_auto_execute:
896 row.label(text="Excluded Paths:")
897 row.operator("wm.userpref_autoexec_path_add", text="", icon='ZOOMIN', emboss=False)
898 for i, path_cmp in enumerate(userpref.autoexec_paths):
900 row.prop(path_cmp, "path", text="")
901 row.prop(path_cmp, "use_glob", text="", icon='FILTER')
902 row.operator("wm.userpref_autoexec_path_remove", text="", icon='X', emboss=False).index = i
905 col.label(text="Save & Load:")
906 col.prop(paths, "use_relative_paths")
907 col.prop(paths, "use_file_compression")
908 col.prop(paths, "use_load_ui")
909 col.prop(paths, "use_filter_files")
910 col.prop(paths, "show_hidden_files_datablocks")
911 col.prop(paths, "hide_recent_locations")
912 col.prop(paths, "hide_system_bookmarks")
913 col.prop(paths, "show_thumbnails")
917 col.prop(paths, "save_version")
918 col.prop(paths, "recent_files")
919 col.prop(paths, "use_save_preview_images")
923 col.label(text="Auto Save:")
924 col.prop(paths, "use_keep_session")
925 col.prop(paths, "use_auto_save_temporary_files")
927 sub.active = paths.use_auto_save_temporary_files
928 sub.prop(paths, "auto_save_time", text="Timer (mins)")
932 col.label(text="Text Editor:")
933 col.prop(system, "use_tabs_as_spaces")
935 colsplit = col.split(percentage=0.95)
936 col1 = colsplit.split(percentage=0.3)
939 sub.label(text="Author:")
941 sub.prop(system, "author", text="")
944 class USERPREF_MT_ndof_settings(Menu):
945 # accessed from the window key-bindings in C (only)
946 bl_label = "3D Mouse Settings"
948 def draw(self, context):
951 input_prefs = context.user_preferences.inputs
953 is_view3d = context.space_data.type == 'VIEW_3D'
955 layout.prop(input_prefs, "ndof_sensitivity")
956 layout.prop(input_prefs, "ndof_orbit_sensitivity")
960 layout.prop(input_prefs, "ndof_show_guide")
963 layout.label(text="Orbit style")
964 layout.row().prop(input_prefs, "ndof_view_navigate_method", text="")
965 layout.row().prop(input_prefs, "ndof_view_rotate_method", text="")
967 layout.label(text="Orbit options")
968 layout.prop(input_prefs, "ndof_rotx_invert_axis")
969 layout.prop(input_prefs, "ndof_roty_invert_axis")
970 layout.prop(input_prefs, "ndof_rotz_invert_axis")
972 # view2d use pan/zoom
974 layout.label(text="Pan options")
975 layout.prop(input_prefs, "ndof_panx_invert_axis")
976 layout.prop(input_prefs, "ndof_pany_invert_axis")
977 layout.prop(input_prefs, "ndof_panz_invert_axis")
978 layout.prop(input_prefs, "ndof_pan_yz_swap_axis")
980 layout.label(text="Zoom options")
981 layout.prop(input_prefs, "ndof_zoom_invert")
985 layout.label(text="Fly/Walk options")
986 layout.prop(input_prefs, "ndof_fly_helicopter", icon='NDOF_FLY')
987 layout.prop(input_prefs, "ndof_lock_horizon", icon='NDOF_DOM')
990 class USERPREF_MT_keyconfigs(Menu):
991 bl_label = "KeyPresets"
992 preset_subdir = "keyconfig"
993 preset_operator = "wm.keyconfig_activate"
995 def draw(self, context):
996 props = self.layout.operator("wm.context_set_value", text="Blender (default)")
997 props.data_path = "window_manager.keyconfigs.active"
998 props.value = "context.window_manager.keyconfigs.default"
1000 # now draw the presets
1001 Menu.draw_preset(self, context)
1004 class USERPREF_PT_input(Panel):
1005 bl_space_type = 'USER_PREFERENCES'
1007 bl_region_type = 'WINDOW'
1008 bl_options = {'HIDE_HEADER'}
1011 def poll(cls, context):
1012 userpref = context.user_preferences
1013 return (userpref.active_section == 'INPUT')
1015 def draw_input_prefs(self, inputs, layout):
1023 sub.label(text="Presets:")
1024 subrow = sub.row(align=True)
1026 subrow.menu("USERPREF_MT_interaction_presets", text=bpy.types.USERPREF_MT_interaction_presets.bl_label)
1027 subrow.operator("wm.interaction_preset_add", text="", icon='ZOOMIN')
1028 subrow.operator("wm.interaction_preset_add", text="", icon='ZOOMOUT').remove_active = True
1031 sub.label(text="Mouse:")
1033 sub1.active = (inputs.select_mouse == 'RIGHT')
1034 sub1.prop(inputs, "use_mouse_emulate_3_button")
1035 sub.prop(inputs, "use_mouse_continuous")
1036 sub.prop(inputs, "drag_threshold")
1037 sub.prop(inputs, "tweak_threshold")
1039 sub.label(text="Select With:")
1040 sub.row().prop(inputs, "select_mouse", expand=True)
1043 sub.label(text="Double Click:")
1044 sub.prop(inputs, "mouse_double_click_time", text="Speed")
1048 sub.prop(inputs, "use_emulate_numpad")
1052 sub.label(text="Orbit Style:")
1053 sub.row().prop(inputs, "view_rotate_method", expand=True)
1057 sub.label(text="Zoom Style:")
1058 sub.row().prop(inputs, "view_zoom_method", text="")
1059 if inputs.view_zoom_method in {'DOLLY', 'CONTINUE'}:
1060 sub.row().prop(inputs, "view_zoom_axis", expand=True)
1061 sub.prop(inputs, "invert_mouse_zoom", text="Invert Mouse Zoom Direction")
1063 #sub.prop(inputs, "use_mouse_mmb_paste")
1068 sub.prop(inputs, "invert_zoom_wheel", text="Invert Wheel Zoom Direction")
1069 #sub.prop(view, "wheel_scroll_lines", text="Scroll Lines")
1071 if sys.platform == "darwin":
1073 sub.prop(inputs, "use_trackpad_natural", text="Natural Trackpad Direction")
1077 sub.label(text="View Navigation:")
1078 sub.row().prop(inputs, "navigation_mode", expand=True)
1079 if inputs.navigation_mode == 'WALK':
1080 walk = inputs.walk_navigation
1082 sub.prop(walk, "use_mouse_reverse")
1083 sub.prop(walk, "mouse_speed")
1084 sub.prop(walk, "teleport_time")
1086 sub = col.column(align=True)
1087 sub.prop(walk, "walk_speed")
1088 sub.prop(walk, "walk_speed_factor")
1091 sub.prop(walk, "use_gravity")
1092 sub = col.column(align=True)
1093 sub.active = walk.use_gravity
1094 sub.prop(walk, "view_height")
1095 sub.prop(walk, "jump_height")
1099 sub.label(text="NDOF Device:")
1100 sub.prop(inputs, "ndof_sensitivity", text="NDOF Sensitivity")
1101 sub.prop(inputs, "ndof_orbit_sensitivity", text="NDOF Orbit Sensitivity")
1102 sub.row().prop(inputs, "ndof_view_navigate_method", expand=True)
1103 sub.row().prop(inputs, "ndof_view_rotate_method", expand=True)
1107 def draw(self, context):
1108 from rna_keymap_ui import draw_keymaps
1110 layout = self.layout
1114 #start = time.time()
1116 userpref = context.user_preferences
1118 inputs = userpref.inputs
1120 split = layout.split(percentage=0.25)
1123 self.draw_input_prefs(inputs, split)
1126 draw_keymaps(context, split)
1128 #print("runtime", time.time() - start)
1131 class USERPREF_MT_addons_dev_guides(Menu):
1132 bl_label = "Development Guides"
1134 # menu to open web-pages with addons development guides
1135 def draw(self, context):
1136 layout = self.layout
1138 layout.operator("wm.url_open", text="API Concepts", icon='URL').url = "http://wiki.blender.org/index.php/Dev:2.5/Py/API/Intro"
1139 layout.operator("wm.url_open", text="Addon Guidelines", icon='URL').url = "http://wiki.blender.org/index.php/Dev:2.5/Py/Scripts/Guidelines/Addons"
1140 layout.operator("wm.url_open", text="How to share your addon", icon='URL').url = "http://wiki.blender.org/index.php/Dev:Py/Sharing"
1143 class USERPREF_PT_addons(Panel):
1144 bl_space_type = 'USER_PREFERENCES'
1146 bl_region_type = 'WINDOW'
1147 bl_options = {'HIDE_HEADER'}
1149 _support_icon_mapping = {
1150 'OFFICIAL': 'FILE_BLEND',
1151 'COMMUNITY': 'POSE_DATA',
1152 'TESTING': 'MOD_EXPLODE',
1156 def poll(cls, context):
1157 userpref = context.user_preferences
1158 return (userpref.active_section == 'ADDONS')
1161 def is_user_addon(mod, user_addon_paths):
1164 if not user_addon_paths:
1165 for path in (bpy.utils.script_path_user(),
1166 bpy.utils.script_path_pref()):
1167 if path is not None:
1168 user_addon_paths.append(os.path.join(path, "addons"))
1170 for path in user_addon_paths:
1171 if bpy.path.is_subdir(mod.__file__, path):
1176 def draw_error(layout, message):
1177 lines = message.split("\n")
1181 sub.label(icon='ERROR')
1185 def draw(self, context):
1189 layout = self.layout
1191 userpref = context.user_preferences
1192 used_ext = {ext.module for ext in userpref.addons}
1194 userpref_addons_folder = os.path.join(userpref.filepaths.script_directory, "addons")
1195 scripts_addons_folder = bpy.utils.user_resource('SCRIPTS', "addons")
1197 # collect the categories that can be filtered on
1198 addons = [(mod, addon_utils.module_bl_info(mod)) for mod in addon_utils.modules(refresh=False)]
1200 split = layout.split(percentage=0.2)
1201 col = split.column()
1202 col.prop(context.window_manager, "addon_search", text="", icon='VIEWZOOM')
1204 col.label(text="Supported Level")
1205 col.prop(context.window_manager, "addon_support", expand=True)
1207 col.label(text="Categories")
1208 col.prop(context.window_manager, "addon_filter", expand=True)
1210 col = split.column()
1212 # set in addon_utils.modules_refresh()
1213 if addon_utils.error_duplicates:
1214 self.draw_error(col,
1215 "Multiple addons using the same name found!\n"
1216 "likely a problem with the script search path.\n"
1217 "(see console for details)",
1220 if addon_utils.error_encoding:
1221 self.draw_error(col,
1222 "One or more addons do not have UTF-8 encoding\n"
1223 "(see console for details)",
1226 filter = context.window_manager.addon_filter
1227 search = context.window_manager.addon_search.lower()
1228 support = context.window_manager.addon_support
1230 # initialized on demand
1231 user_addon_paths = []
1233 for mod, info in addons:
1234 module_name = mod.__name__
1236 is_enabled = module_name in used_ext
1238 if info["support"] not in support:
1241 # check if addon should be visible with current filters
1242 if ((filter == "All") or
1243 (filter == info["category"]) or
1244 (filter == "Enabled" and is_enabled) or
1245 (filter == "Disabled" and not is_enabled) or
1246 (filter == "User" and (mod.__file__.startswith((scripts_addons_folder, userpref_addons_folder))))
1249 if search and search not in info["name"].lower():
1251 if search not in info["author"].lower():
1257 col_box = col.column()
1259 colsub = box.column()
1262 row.operator("wm.addon_expand", icon='TRIA_DOWN' if info["show_expanded"] else 'TRIA_RIGHT', emboss=False).module = module_name
1265 sub.active = is_enabled
1266 sub.label(text='%s: %s' % (info["category"], info["name"]))
1268 sub.label(icon='ERROR')
1270 # icon showing support level.
1271 sub.label(icon=self._support_icon_mapping.get(info["support"], 'QUESTION'))
1274 row.operator("wm.addon_disable", icon='CHECKBOX_HLT', text="", emboss=False).module = module_name
1276 row.operator("wm.addon_enable", icon='CHECKBOX_DEHLT', text="", emboss=False).module = module_name
1278 # Expanded UI (only if additional info is available)
1279 if info["show_expanded"]:
1280 if info["description"]:
1281 split = colsub.row().split(percentage=0.15)
1282 split.label(text="Description:")
1283 split.label(text=info["description"])
1284 if info["location"]:
1285 split = colsub.row().split(percentage=0.15)
1286 split.label(text="Location:")
1287 split.label(text=info["location"])
1289 split = colsub.row().split(percentage=0.15)
1290 split.label(text="File:")
1291 split.label(text=mod.__file__, translate=False)
1293 split = colsub.row().split(percentage=0.15)
1294 split.label(text="Author:")
1295 split.label(text=info["author"], translate=False)
1297 split = colsub.row().split(percentage=0.15)
1298 split.label(text="Version:")
1299 split.label(text='.'.join(str(x) for x in info["version"]), translate=False)
1301 split = colsub.row().split(percentage=0.15)
1302 split.label(text="Warning:")
1303 split.label(text=' ' + info["warning"], icon='ERROR')
1305 user_addon = USERPREF_PT_addons.is_user_addon(mod, user_addon_paths)
1306 tot_row = bool(info["wiki_url"]) + bool(user_addon)
1309 split = colsub.row().split(percentage=0.15)
1310 split.label(text="Internet:")
1311 if info["wiki_url"]:
1312 split.operator("wm.url_open", text="Documentation", icon='HELP').url = info["wiki_url"]
1313 split.operator("wm.url_open", text="Report a Bug", icon='URL').url = info.get(
1315 "http://developer.blender.org/maniphest/task/create/?project=3&type=Bug")
1317 split.operator("wm.addon_remove", text="Remove", icon='CANCEL').module = mod.__name__
1319 for i in range(4 - tot_row):
1322 # Show addon user preferences
1324 addon_preferences = userpref.addons[module_name].preferences
1325 if addon_preferences is not None:
1326 draw = getattr(addon_preferences, "draw", None)
1327 if draw is not None:
1328 addon_preferences_class = type(addon_preferences)
1329 box_prefs = col_box.box()
1330 box_prefs.label("Preferences:")
1331 addon_preferences_class.layout = box_prefs
1336 traceback.print_exc()
1337 box_prefs.label(text="Error (see console)", icon='ERROR')
1338 del addon_preferences_class.layout
1340 # Append missing scripts
1341 # First collect scripts that are used but have no script file.
1342 module_names = {mod.__name__ for mod, info in addons}
1343 missing_modules = {ext for ext in used_ext if ext not in module_names}
1345 if missing_modules and filter in {"All", "Enabled"}:
1346 col.column().separator()
1347 col.column().label(text="Missing script files")
1349 module_names = {mod.__name__ for mod, info in addons}
1350 for module_name in sorted(missing_modules):
1351 is_enabled = module_name in used_ext
1353 box = col.column().box()
1354 colsub = box.column()
1357 row.label(text=module_name, translate=False, icon='ERROR')
1360 row.operator("wm.addon_disable", icon='CHECKBOX_HLT', text="", emboss=False).module = module_name
1362 if __name__ == "__main__": # only for live edit.
1363 bpy.utils.register_module(__name__)