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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 # ##### END GPL LICENSE BLOCK #####
23 ('Window', 'EMPTY', 'WINDOW', []), # file save, window change, exit
24 ('Screen', 'EMPTY', 'WINDOW', [ # full screen, undo, screenshot
25 ('Screen Editing', 'EMPTY', 'WINDOW', []), # resizing, action corners
28 ('View2D', 'EMPTY', 'WINDOW', []), # view 2d navigation (per region)
29 ('View2D Buttons List', 'EMPTY', 'WINDOW', []), # view 2d with buttons navigation
30 ('Header', 'EMPTY', 'WINDOW', []), # header stuff (per region)
31 ('Grease Pencil', 'EMPTY', 'WINDOW', []), # grease pencil stuff (per region)
33 ('3D View', 'VIEW_3D', 'WINDOW', [ # view 3d navigation and generic stuff (select, transform)
34 ('Object Mode', 'EMPTY', 'WINDOW', []),
35 ('Mesh', 'EMPTY', 'WINDOW', []),
36 ('Curve', 'EMPTY', 'WINDOW', []),
37 ('Armature', 'EMPTY', 'WINDOW', []),
38 ('Metaball', 'EMPTY', 'WINDOW', []),
39 ('Lattice', 'EMPTY', 'WINDOW', []),
40 ('Font', 'EMPTY', 'WINDOW', []),
42 ('Pose', 'EMPTY', 'WINDOW', []),
44 ('Vertex Paint', 'EMPTY', 'WINDOW', []),
45 ('Weight Paint', 'EMPTY', 'WINDOW', []),
46 ('Face Mask', 'EMPTY', 'WINDOW', []),
47 ('Image Paint', 'EMPTY', 'WINDOW', []), # image and view3d
48 ('Sculpt', 'EMPTY', 'WINDOW', []),
50 ('Armature Sketch', 'EMPTY', 'WINDOW', []),
51 ('Particle', 'EMPTY', 'WINDOW', []),
53 ('Object Non-modal', 'EMPTY', 'WINDOW', []), # mode change
55 ('3D View Generic', 'VIEW_3D', 'WINDOW', []) # toolbar and properties
58 ('Frames', 'EMPTY', 'WINDOW', []), # frame navigation (per region)
59 ('Markers', 'EMPTY', 'WINDOW', []), # markers (per region)
60 ('Animation', 'EMPTY', 'WINDOW', []), # frame change on click, preview range (per region)
61 ('Animation Channels', 'EMPTY', 'WINDOW', []),
62 ('Graph Editor', 'GRAPH_EDITOR', 'WINDOW', [
63 ('Graph Editor Generic', 'GRAPH_EDITOR', 'WINDOW', [])
65 ('Dopesheet', 'DOPESHEET_EDITOR', 'WINDOW', []),
66 ('NLA Editor', 'NLA_EDITOR', 'WINDOW', [
67 ('NLA Channels', 'NLA_EDITOR', 'WINDOW', []),
68 ('NLA Generic', 'NLA_EDITOR', 'WINDOW', [])
71 ('Image', 'IMAGE_EDITOR', 'WINDOW', [
72 ('UV Editor', 'EMPTY', 'WINDOW', []), # image (reverse order, UVEdit before Image
73 ('Image Paint', 'EMPTY', 'WINDOW', []), # image and view3d
74 ('Image Generic', 'IMAGE_EDITOR', 'WINDOW', [])
77 ('Timeline', 'TIMELINE', 'WINDOW', []),
78 ('Outliner', 'OUTLINER', 'WINDOW', []),
80 ('Node Editor', 'NODE_EDITOR', 'WINDOW', [
81 ('Node Generic', 'NODE_EDITOR', 'WINDOW', [])
83 ('Sequencer', 'SEQUENCE_EDITOR', 'WINDOW', []),
84 ('Logic Editor', 'LOGIC_EDITOR', 'WINDOW', []),
86 ('File Browser', 'FILE_BROWSER', 'WINDOW', [
87 ('File Browser Main', 'FILE_BROWSER', 'WINDOW', []),
88 ('File Browser Buttons', 'FILE_BROWSER', 'WINDOW', [])
91 ('Property Editor', 'PROPERTIES', 'WINDOW', []), # align context menu
93 ('Script', 'SCRIPTS_WINDOW', 'WINDOW', []),
94 ('Text', 'TEXT_EDITOR', 'WINDOW', []),
95 ('Console', 'CONSOLE', 'WINDOW', []),
97 ('View3D Gesture Circle', 'EMPTY', 'WINDOW', []),
98 ('Gesture Border', 'EMPTY', 'WINDOW', []),
99 ('Standard Modal Map', 'EMPTY', 'WINDOW', []),
100 ('Transform Modal Map', 'EMPTY', 'WINDOW', []),
101 ('View3D Fly Modal', 'EMPTY', 'WINDOW', []),
102 ('View3D Rotate Modal', 'EMPTY', 'WINDOW', []),
103 ('View3D Move Modal', 'EMPTY', 'WINDOW', []),
104 ('View3D Zoom Modal', 'EMPTY', 'WINDOW', []),
108 class USERPREF_HT_header(bpy.types.Header):
109 bl_space_type = 'USER_PREFERENCES'
111 def draw(self, context):
113 layout.template_header(menus=False)
115 userpref = context.user_preferences
117 layout.operator_context = 'EXEC_AREA'
118 layout.operator("wm.save_homefile", text="Save As Default")
120 if userpref.active_section == 'INPUT':
121 layout.operator_context = 'INVOKE_DEFAULT'
122 layout.operator("wm.keyconfig_export", "Export Key Configuration...").path = "keymap.py"
125 class USERPREF_PT_tabs(bpy.types.Panel):
127 bl_space_type = 'USER_PREFERENCES'
128 bl_region_type = 'WINDOW'
129 bl_show_header = False
131 def draw(self, context):
134 userpref = context.user_preferences
136 layout.prop(userpref, "active_section", expand=True)
139 class USERPREF_PT_interface(bpy.types.Panel):
140 bl_space_type = 'USER_PREFERENCES'
141 bl_label = "Interface"
142 bl_region_type = 'WINDOW'
143 bl_show_header = False
145 def poll(self, context):
146 userpref = context.user_preferences
147 return (userpref.active_section == 'INTERFACE')
149 def draw(self, context):
152 userpref = context.user_preferences
159 col.label(text="Display:")
160 col.prop(view, "tooltips")
161 col.prop(view, "display_object_info", text="Object Info")
162 col.prop(view, "use_large_cursors")
163 col.prop(view, "show_view_name", text="View Name")
164 col.prop(view, "show_playback_fps", text="Playback FPS")
165 col.prop(view, "global_scene")
166 col.prop(view, "pin_floating_panels")
167 col.prop(view, "object_origin_size")
173 col.prop(view, "show_mini_axis", text="Display Mini Axis")
175 sub.enabled = view.show_mini_axis
176 sub.prop(view, "mini_axis_size", text="Size")
177 sub.prop(view, "mini_axis_brightness", text="Brightness")
184 col.label(text="View Manipulation:")
185 col.prop(view, "auto_depth")
186 col.prop(view, "zoom_to_mouse")
187 col.prop(view, "rotate_around_selection")
188 col.prop(view, "global_pivot")
192 col.prop(view, "auto_perspective")
193 col.prop(view, "smooth_view")
194 col.prop(view, "rotation_angle")
200 #Toolbox doesn't exist yet
201 #col.label(text="Toolbox:")
202 #col.prop(view, "use_column_layout")
203 #col.label(text="Open Toolbox Delay:")
204 #col.prop(view, "open_left_mouse_delay", text="Hold LMB")
205 #col.prop(view, "open_right_mouse_delay", text="Hold RMB")
206 col.prop(view, "use_manipulator")
208 sub.enabled = view.use_manipulator
209 sub.prop(view, "manipulator_size", text="Size")
210 sub.prop(view, "manipulator_handle_size", text="Handle Size")
211 sub.prop(view, "manipulator_hotspot", text="Hotspot")
217 col.label(text="Menus:")
218 col.prop(view, "open_mouse_over")
219 col.label(text="Menu Open Delay:")
220 col.prop(view, "open_toplevel_delay", text="Top Level")
221 col.prop(view, "open_sublevel_delay", text="Sub Level")
224 class USERPREF_PT_edit(bpy.types.Panel):
225 bl_space_type = 'USER_PREFERENCES'
227 bl_region_type = 'WINDOW'
228 bl_show_header = False
230 def poll(self, context):
231 userpref = context.user_preferences
232 return (userpref.active_section == 'EDITING')
234 def draw(self, context):
237 userpref = context.user_preferences
245 col.label(text="Link Materials To:")
246 col.row().prop(edit, "material_link", expand=True)
252 col.label(text="New Objects:")
253 col.prop(edit, "enter_edit_mode")
254 col.label(text="Align To:")
255 col.row().prop(edit, "object_align", expand=True)
261 col.label(text="Undo:")
262 col.prop(edit, "global_undo")
263 col.prop(edit, "undo_steps", text="Steps")
264 col.prop(edit, "undo_memory_limit", text="Memory Limit")
272 col.label(text="Snap:")
273 col.prop(edit, "snap_translate", text="Translate")
274 col.prop(edit, "snap_rotate", text="Rotate")
275 col.prop(edit, "snap_scale", text="Scale")
279 col.label(text="Grease Pencil:")
280 col.prop(edit, "grease_pencil_manhattan_distance", text="Manhattan Distance")
281 col.prop(edit, "grease_pencil_euclidean_distance", text="Euclidean Distance")
282 #col.prop(edit, "grease_pencil_simplify_stroke", text="Simplify Stroke")
283 col.prop(edit, "grease_pencil_eraser_radius", text="Eraser Radius")
284 col.prop(edit, "grease_pencil_smooth_stroke", text="Smooth Stroke")
292 col.label(text="Keyframing:")
293 col.prop(edit, "use_visual_keying")
294 col.prop(edit, "keyframe_insert_needed", text="Only Insert Needed")
298 col.label(text="New F-Curve Defaults:")
299 col.prop(edit, "new_interpolation_type", text="Interpolation")
300 col.prop(edit, "insertkey_xyz_to_rgb", text="XYZ to RGB")
304 col.prop(edit, "auto_keying_enable", text="Auto Keyframing:")
308 sub.active = edit.auto_keying_enable
309 sub.prop(edit, "auto_keyframe_insert_keyingset", text="Only Insert for Keying Set")
310 sub.prop(edit, "auto_keyframe_insert_available", text="Only Insert Available")
316 col.label(text="Transform:")
317 col.prop(edit, "drag_immediately")
325 col.label(text="Duplicate Data:")
326 col.prop(edit, "duplicate_mesh", text="Mesh")
327 col.prop(edit, "duplicate_surface", text="Surface")
328 col.prop(edit, "duplicate_curve", text="Curve")
329 col.prop(edit, "duplicate_text", text="Text")
330 col.prop(edit, "duplicate_metaball", text="Metaball")
331 col.prop(edit, "duplicate_armature", text="Armature")
332 col.prop(edit, "duplicate_lamp", text="Lamp")
333 col.prop(edit, "duplicate_material", text="Material")
334 col.prop(edit, "duplicate_texture", text="Texture")
335 col.prop(edit, "duplicate_fcurve", text="F-Curve")
336 col.prop(edit, "duplicate_action", text="Action")
337 col.prop(edit, "duplicate_particle", text="Particle")
340 class USERPREF_PT_system(bpy.types.Panel):
341 bl_space_type = 'USER_PREFERENCES'
343 bl_region_type = 'WINDOW'
344 bl_show_header = False
346 def poll(self, context):
347 userpref = context.user_preferences
348 return (userpref.active_section == 'SYSTEM')
350 def draw(self, context):
353 userpref = context.user_preferences
354 system = userpref.system
355 lamp0 = system.solid_lights[0]
356 lamp1 = system.solid_lights[1]
357 lamp2 = system.solid_lights[2]
359 split = layout.split()
361 column = split.column()
362 colsplit = column.split(percentage=0.85)
364 col = colsplit.column()
365 col.label(text="General:")
366 col.prop(system, "dpi")
367 col.prop(system, "frame_server_port")
368 col.prop(system, "scrollback", text="Console Scrollback")
369 col.prop(system, "auto_run_python_scripts")
375 col.label(text="Sound:")
376 col.row().prop(system, "audio_device", expand=True)
378 sub.active = system.audio_device != 'NONE'
379 #sub.prop(system, "enable_all_codecs")
380 sub.prop(system, "game_sound")
381 sub.prop(system, "audio_channels", text="Channels")
382 sub.prop(system, "audio_mixing_buffer", text="Mixing Buffer")
383 sub.prop(system, "audio_sample_rate", text="Sample Rate")
384 sub.prop(system, "audio_sample_format", text="Sample Format")
392 #column = split.column()
393 #colsplit = column.split(percentage=0.85)
395 # No translation in 2.5 yet
396 #col.prop(system, "language")
397 #col.label(text="Translate:")
398 #col.prop(system, "translate_tooltips", text="Tooltips")
399 #col.prop(system, "translate_buttons", text="Labels")
400 #col.prop(system, "translate_toolbox", text="Toolbox")
404 #col.prop(system, "use_textured_fonts")
406 column = split.column()
407 colsplit = column.split(percentage=0.85)
409 col = colsplit.column()
410 col.label(text="OpenGL:")
411 col.prop(system, "clip_alpha", slider=True)
412 col.prop(system, "use_mipmaps")
413 col.prop(system, "use_vbos")
414 #Anti-aliasing is disabled as it breaks broder/lasso select
415 #col.prop(system, "use_antialiasing")
416 col.label(text="Window Draw Method:")
417 col.row().prop(system, "window_draw_method", expand=True)
418 col.label(text="Textures:")
419 col.prop(system, "gl_texture_limit", text="Limit Size")
420 col.prop(system, "texture_time_out", text="Time Out")
421 col.prop(system, "texture_collection_rate", text="Collection Rate")
427 col.label(text="Sequencer:")
428 col.prop(system, "prefetch_frames")
429 col.prop(system, "memory_cache_limit")
431 column = split.column()
433 column.label(text="Solid OpenGL lights:")
435 split = column.split(percentage=0.1)
437 split.label(text="Colors:")
438 split.label(text="Direction:")
441 split = column.split(percentage=0.1)
443 if lamp0.enabled == True:
444 split.prop(lamp0, "enabled", text="", icon='OUTLINER_OB_LAMP')
446 split.prop(lamp0, "enabled", text="", icon='LAMP_DATA')
449 col.active = lamp0.enabled
451 row.label(text="Diffuse:")
452 row.prop(lamp0, "diffuse_color", text="")
454 row.label(text="Specular:")
455 row.prop(lamp0, "specular_color", text="")
458 col.active = lamp0.enabled
459 col.prop(lamp0, "direction", text="")
462 split = column.split(percentage=0.1)
464 if lamp1.enabled == True:
465 split.prop(lamp1, "enabled", text="", icon='OUTLINER_OB_LAMP')
467 split.prop(lamp1, "enabled", text="", icon='LAMP_DATA')
470 col.active = lamp1.enabled
472 row.label(text="Diffuse:")
473 row.prop(lamp1, "diffuse_color", text="")
475 row.label(text="Specular:")
476 row.prop(lamp1, "specular_color", text="")
479 col.active = lamp1.enabled
480 col.prop(lamp1, "direction", text="")
483 split = column.split(percentage=0.1)
485 if lamp2.enabled == True:
486 split.prop(lamp2, "enabled", text="", icon='OUTLINER_OB_LAMP')
488 split.prop(lamp2, "enabled", text="", icon='LAMP_DATA')
491 col.active = lamp2.enabled
493 row.label(text="Diffuse:")
494 row.prop(lamp2, "diffuse_color", text="")
496 row.label(text="Specular:")
497 row.prop(lamp2, "specular_color", text="")
500 col.active = lamp2.enabled
501 col.prop(lamp2, "direction", text="")
508 col = column.column()
510 col.prop(system, "color_picker_type")
514 col.prop(system, "use_weight_color_range", text="Custom Weight Paint Range")
516 sub.active = system.use_weight_color_range
517 sub.template_color_ramp(system, "weight_color_range", expand=True)
520 class USERPREF_PT_theme(bpy.types.Panel):
521 bl_space_type = 'USER_PREFERENCES'
523 bl_region_type = 'WINDOW'
524 bl_show_header = False
526 def poll(self, context):
527 userpref = context.user_preferences
528 return (userpref.active_section == 'THEMES')
530 def draw(self, context):
533 theme = context.user_preferences.themes[0]
535 split = layout.split(percentage=0.33)
536 split.prop(theme, "active_theme", text="")
540 split = layout.split()
542 if theme.active_theme == 'VIEW_3D':
546 col.prop(v3d, "back")
547 col.prop(v3d, "button")
548 col.prop(v3d, "button_title")
549 col.prop(v3d, "button_text")
550 col.prop(v3d, "header")
553 col.prop(v3d, "grid")
554 col.prop(v3d, "wire")
555 col.prop(v3d, "lamp", slider=True)
556 col.prop(v3d, "editmesh_active", slider=True)
559 col.prop(v3d, "object_selected")
560 col.prop(v3d, "object_active")
561 col.prop(v3d, "object_grouped")
562 col.prop(v3d, "object_grouped_active")
563 col.prop(v3d, "transform")
566 col.prop(v3d, "vertex")
567 col.prop(v3d, "face", slider=True)
568 col.prop(v3d, "normal")
569 col.prop(v3d, "bone_solid")
570 col.prop(v3d, "bone_pose")
571 #col.prop(v3d, "edge") Doesn't seem to work
573 elif theme.active_theme == 'USER_INTERFACE':
574 ui = theme.user_interface.wcol_regular
575 layout.label(text="Regular:")
579 sub.prop(ui, "outline")
580 sub.prop(ui, "item", slider=True)
582 sub.prop(ui, "inner", slider=True)
583 sub.prop(ui, "inner_sel", slider=True)
586 sub.prop(ui, "text_sel")
588 sub.prop(ui, "shaded")
589 subsub = sub.column(align=True)
590 subsub.active = ui.shaded
591 subsub.prop(ui, "shadetop")
592 subsub.prop(ui, "shadedown")
596 ui = theme.user_interface.wcol_tool
597 layout.label(text="Tool:")
601 sub.prop(ui, "outline")
602 sub.prop(ui, "item", slider=True)
604 sub.prop(ui, "inner", slider=True)
605 sub.prop(ui, "inner_sel", slider=True)
608 sub.prop(ui, "text_sel")
610 sub.prop(ui, "shaded")
611 subsub = sub.column(align=True)
612 subsub.active = ui.shaded
613 subsub.prop(ui, "shadetop")
614 subsub.prop(ui, "shadedown")
616 ui = theme.user_interface.wcol_radio
617 layout.label(text="Radio Buttons:")
621 sub.prop(ui, "outline")
622 sub.prop(ui, "item", slider=True)
624 sub.prop(ui, "inner", slider=True)
625 sub.prop(ui, "inner_sel", slider=True)
628 sub.prop(ui, "text_sel")
630 sub.prop(ui, "shaded")
631 subsub = sub.column(align=True)
632 subsub.active = ui.shaded
633 subsub.prop(ui, "shadetop")
634 subsub.prop(ui, "shadedown")
636 ui = theme.user_interface.wcol_text
637 layout.label(text="Text:")
641 sub.prop(ui, "outline")
642 sub.prop(ui, "item", slider=True)
644 sub.prop(ui, "inner", slider=True)
645 sub.prop(ui, "inner_sel", slider=True)
648 sub.prop(ui, "text_sel")
650 sub.prop(ui, "shaded")
651 subsub = sub.column(align=True)
652 subsub.active = ui.shaded
653 subsub.prop(ui, "shadetop")
654 subsub.prop(ui, "shadedown")
656 ui = theme.user_interface.wcol_option
657 layout.label(text="Option:")
661 sub.prop(ui, "outline")
662 sub.prop(ui, "item", slider=True)
664 sub.prop(ui, "inner", slider=True)
665 sub.prop(ui, "inner_sel", slider=True)
668 sub.prop(ui, "text_sel")
670 sub.prop(ui, "shaded")
671 subsub = sub.column(align=True)
672 subsub.active = ui.shaded
673 subsub.prop(ui, "shadetop")
674 subsub.prop(ui, "shadedown")
676 ui = theme.user_interface.wcol_toggle
677 layout.label(text="Toggle:")
681 sub.prop(ui, "outline")
682 sub.prop(ui, "item", slider=True)
684 sub.prop(ui, "inner", slider=True)
685 sub.prop(ui, "inner_sel", slider=True)
688 sub.prop(ui, "text_sel")
690 sub.prop(ui, "shaded")
691 subsub = sub.column(align=True)
692 subsub.active = ui.shaded
693 subsub.prop(ui, "shadetop")
694 subsub.prop(ui, "shadedown")
696 ui = theme.user_interface.wcol_num
697 layout.label(text="Number Field:")
701 sub.prop(ui, "outline")
702 sub.prop(ui, "item", slider=True)
704 sub.prop(ui, "inner", slider=True)
705 sub.prop(ui, "inner_sel", slider=True)
708 sub.prop(ui, "text_sel")
710 sub.prop(ui, "shaded")
711 subsub = sub.column(align=True)
712 subsub.active = ui.shaded
713 subsub.prop(ui, "shadetop")
714 subsub.prop(ui, "shadedown")
716 ui = theme.user_interface.wcol_numslider
717 layout.label(text="Value Slider:")
721 sub.prop(ui, "outline")
722 sub.prop(ui, "item", slider=True)
724 sub.prop(ui, "inner", slider=True)
725 sub.prop(ui, "inner_sel", slider=True)
728 sub.prop(ui, "text_sel")
730 sub.prop(ui, "shaded")
731 subsub = sub.column(align=True)
732 subsub.active = ui.shaded
733 subsub.prop(ui, "shadetop")
734 subsub.prop(ui, "shadedown")
736 ui = theme.user_interface.wcol_box
737 layout.label(text="Box:")
741 sub.prop(ui, "outline")
742 sub.prop(ui, "item", slider=True)
744 sub.prop(ui, "inner", slider=True)
745 sub.prop(ui, "inner_sel", slider=True)
748 sub.prop(ui, "text_sel")
750 sub.prop(ui, "shaded")
751 subsub = sub.column(align=True)
752 subsub.active = ui.shaded
753 subsub.prop(ui, "shadetop")
754 subsub.prop(ui, "shadedown")
756 ui = theme.user_interface.wcol_menu
757 layout.label(text="Menu:")
761 sub.prop(ui, "outline")
762 sub.prop(ui, "item", slider=True)
764 sub.prop(ui, "inner", slider=True)
765 sub.prop(ui, "inner_sel", slider=True)
768 sub.prop(ui, "text_sel")
770 sub.prop(ui, "shaded")
771 subsub = sub.column(align=True)
772 subsub.active = ui.shaded
773 subsub.prop(ui, "shadetop")
774 subsub.prop(ui, "shadedown")
776 ui = theme.user_interface.wcol_pulldown
777 layout.label(text="Pulldown:")
781 sub.prop(ui, "outline")
782 sub.prop(ui, "item", slider=True)
784 sub.prop(ui, "inner", slider=True)
785 sub.prop(ui, "inner_sel", slider=True)
788 sub.prop(ui, "text_sel")
790 sub.prop(ui, "shaded")
791 subsub = sub.column(align=True)
792 subsub.active = ui.shaded
793 subsub.prop(ui, "shadetop")
794 subsub.prop(ui, "shadedown")
796 ui = theme.user_interface.wcol_menu_back
797 layout.label(text="Menu Back:")
801 sub.prop(ui, "outline")
802 sub.prop(ui, "item", slider=True)
804 sub.prop(ui, "inner", slider=True)
805 sub.prop(ui, "inner_sel", slider=True)
808 sub.prop(ui, "text_sel")
810 sub.prop(ui, "shaded")
811 subsub = sub.column(align=True)
812 subsub.active = ui.shaded
813 subsub.prop(ui, "shadetop")
814 subsub.prop(ui, "shadedown")
816 ui = theme.user_interface.wcol_menu_item
817 layout.label(text="Menu Item:")
821 sub.prop(ui, "outline")
822 sub.prop(ui, "item", slider=True)
824 sub.prop(ui, "inner", slider=True)
825 sub.prop(ui, "inner_sel", slider=True)
828 sub.prop(ui, "text_sel")
830 sub.prop(ui, "shaded")
831 subsub = sub.column(align=True)
832 subsub.active = ui.shaded
833 subsub.prop(ui, "shadetop")
834 subsub.prop(ui, "shadedown")
836 ui = theme.user_interface.wcol_scroll
837 layout.label(text="Scroll Bar:")
841 sub.prop(ui, "outline")
842 sub.prop(ui, "item", slider=True)
844 sub.prop(ui, "inner", slider=True)
845 sub.prop(ui, "inner_sel", slider=True)
848 sub.prop(ui, "text_sel")
850 sub.prop(ui, "shaded")
851 subsub = sub.column(align=True)
852 subsub.active = ui.shaded
853 subsub.prop(ui, "shadetop")
854 subsub.prop(ui, "shadedown")
856 ui = theme.user_interface.wcol_list_item
857 layout.label(text="List Item:")
861 sub.prop(ui, "outline")
862 sub.prop(ui, "item", slider=True)
864 sub.prop(ui, "inner", slider=True)
865 sub.prop(ui, "inner_sel", slider=True)
868 sub.prop(ui, "text_sel")
870 sub.prop(ui, "shaded")
871 subsub = sub.column(align=True)
872 subsub.active = ui.shaded
873 subsub.prop(ui, "shadetop")
874 subsub.prop(ui, "shadedown")
876 ui = theme.user_interface.wcol_state
877 layout.label(text="State:")
881 sub.prop(ui, "inner_anim")
882 sub.prop(ui, "inner_anim_sel")
884 sub.prop(ui, "inner_driven")
885 sub.prop(ui, "inner_driven_sel")
887 sub.prop(ui, "inner_key")
888 sub.prop(ui, "inner_key_sel")
890 sub.prop(ui, "blend")
892 ui = theme.user_interface
896 sub.prop(ui, "icon_file")
902 elif theme.active_theme == 'GRAPH_EDITOR':
903 graph = theme.graph_editor
906 col.prop(graph, "back")
907 col.prop(graph, "button")
908 col.prop(graph, "button_title")
909 col.prop(graph, "button_text")
912 col.prop(graph, "header")
913 col.prop(graph, "grid")
914 col.prop(graph, "list")
915 col.prop(graph, "channel_group")
918 col.prop(graph, "active_channels_group")
919 col.prop(graph, "dopesheet_channel")
920 col.prop(graph, "dopesheet_subchannel")
921 col.prop(graph, "vertex")
924 col.prop(graph, "current_frame")
925 col.prop(graph, "handle_vertex")
926 col.prop(graph, "handle_vertex_select")
928 col.prop(graph, "handle_vertex_size")
930 elif theme.active_theme == 'FILE_BROWSER':
931 file_browse = theme.file_browser
934 col.prop(file_browse, "back")
935 col.prop(file_browse, "text")
936 col.prop(file_browse, "text_hi")
939 col.prop(file_browse, "header")
940 col.prop(file_browse, "list")
943 col.prop(file_browse, "selected_file")
944 col.prop(file_browse, "tiles")
947 col.prop(file_browse, "active_file")
948 col.prop(file_browse, "active_file_text")
950 elif theme.active_theme == 'NLA_EDITOR':
951 nla = theme.nla_editor
954 col.prop(nla, "back")
955 col.prop(nla, "button")
956 col.prop(nla, "button_title")
959 col.prop(nla, "button_text")
960 col.prop(nla, "text")
961 col.prop(nla, "header")
964 col.prop(nla, "grid")
965 col.prop(nla, "bars")
966 col.prop(nla, "bars_selected")
969 col.prop(nla, "strips")
970 col.prop(nla, "strips_selected")
971 col.prop(nla, "current_frame")
973 elif theme.active_theme == 'DOPESHEET_EDITOR':
974 dope = theme.dopesheet_editor
977 col.prop(dope, "back")
978 col.prop(dope, "list")
979 col.prop(dope, "text")
980 col.prop(dope, "header")
983 col.prop(dope, "grid")
984 col.prop(dope, "channels")
985 col.prop(dope, "channels_selected")
986 col.prop(dope, "channel_group")
989 col.prop(dope, "active_channels_group")
990 col.prop(dope, "long_key")
991 col.prop(dope, "long_key_selected")
994 col.prop(dope, "current_frame")
995 col.prop(dope, "dopesheet_channel")
996 col.prop(dope, "dopesheet_subchannel")
998 elif theme.active_theme == 'IMAGE_EDITOR':
999 image = theme.image_editor
1001 col = split.column()
1002 col.prop(image, "back")
1003 col.prop(image, "button")
1005 col = split.column()
1006 col.prop(image, "button_title")
1007 col.prop(image, "button_text")
1009 col = split.column()
1010 col.prop(image, "header")
1012 col = split.column()
1013 col.prop(image, "editmesh_active", slider=True)
1015 elif theme.active_theme == 'SEQUENCE_EDITOR':
1016 seq = theme.sequence_editor
1018 col = split.column()
1019 col.prop(seq, "back")
1020 col.prop(seq, "button")
1021 col.prop(seq, "button_title")
1022 col.prop(seq, "button_text")
1023 col.prop(seq, "text")
1025 col = split.column()
1026 col.prop(seq, "header")
1027 col.prop(seq, "grid")
1028 col.prop(seq, "movie_strip")
1029 col.prop(seq, "image_strip")
1030 col.prop(seq, "scene_strip")
1032 col = split.column()
1033 col.prop(seq, "audio_strip")
1034 col.prop(seq, "effect_strip")
1035 col.prop(seq, "plugin_strip")
1036 col.prop(seq, "transition_strip")
1038 col = split.column()
1039 col.prop(seq, "meta_strip")
1040 col.prop(seq, "current_frame")
1041 col.prop(seq, "keyframe")
1042 col.prop(seq, "draw_action")
1044 elif theme.active_theme == 'PROPERTIES':
1045 prop = theme.properties
1047 col = split.column()
1048 col.prop(prop, "back")
1050 col = split.column()
1051 col.prop(prop, "title")
1053 col = split.column()
1054 col.prop(prop, "text")
1056 col = split.column()
1057 col.prop(prop, "header")
1059 elif theme.active_theme == 'TEXT_EDITOR':
1060 text = theme.text_editor
1062 col = split.column()
1063 col.prop(text, "back")
1064 col.prop(text, "button")
1065 col.prop(text, "button_title")
1066 col.prop(text, "button_text")
1068 col = split.column()
1069 col.prop(text, "text")
1070 col.prop(text, "text_hi")
1071 col.prop(text, "header")
1072 col.prop(text, "line_numbers_background")
1074 col = split.column()
1075 col.prop(text, "selected_text")
1076 col.prop(text, "cursor")
1077 col.prop(text, "syntax_builtin")
1078 col.prop(text, "syntax_special")
1080 col = split.column()
1081 col.prop(text, "syntax_comment")
1082 col.prop(text, "syntax_string")
1083 col.prop(text, "syntax_numbers")
1085 elif theme.active_theme == 'TIMELINE':
1086 time = theme.timeline
1088 col = split.column()
1089 col.prop(time, "back")
1090 col.prop(time, "text")
1092 col = split.column()
1093 col.prop(time, "header")
1095 col = split.column()
1096 col.prop(time, "grid")
1098 col = split.column()
1099 col.prop(time, "current_frame")
1101 elif theme.active_theme == 'NODE_EDITOR':
1102 node = theme.node_editor
1104 col = split.column()
1105 col.prop(node, "back")
1106 col.prop(node, "button")
1107 col.prop(node, "button_title")
1108 col.prop(node, "button_text")
1110 col = split.column()
1111 col.prop(node, "text")
1112 col.prop(node, "text_hi")
1113 col.prop(node, "header")
1114 col.prop(node, "wires")
1116 col = split.column()
1117 col.prop(node, "wire_select")
1118 col.prop(node, "selected_text")
1119 col.prop(node, "node_backdrop", slider=True)
1120 col.prop(node, "in_out_node")
1122 col = split.column()
1123 col.prop(node, "converter_node")
1124 col.prop(node, "operator_node")
1125 col.prop(node, "group_node")
1127 elif theme.active_theme == 'LOGIC_EDITOR':
1128 logic = theme.logic_editor
1130 col = split.column()
1131 col.prop(logic, "back")
1132 col.prop(logic, "button")
1134 col = split.column()
1135 col.prop(logic, "button_title")
1136 col.prop(logic, "button_text")
1138 col = split.column()
1139 col.prop(logic, "text")
1140 col.prop(logic, "header")
1142 col = split.column()
1143 col.prop(logic, "panel")
1145 elif theme.active_theme == 'OUTLINER':
1146 out = theme.outliner
1148 col = split.column()
1149 col.prop(out, "back")
1151 col = split.column()
1152 col.prop(out, "text")
1154 col = split.column()
1155 col.prop(out, "text_hi")
1157 col = split.column()
1158 col.prop(out, "header")
1160 elif theme.active_theme == 'INFO':
1163 col = split.column()
1164 col.prop(info, "back")
1166 col = split.column()
1167 col.prop(info, "header")
1169 col = split.column()
1170 col.prop(info, "header_text")
1172 col = split.column()
1174 elif theme.active_theme == 'USER_PREFERENCES':
1175 prefs = theme.user_preferences
1177 col = split.column()
1178 col.prop(prefs, "back")
1180 col = split.column()
1181 col.prop(prefs, "text")
1183 col = split.column()
1184 col.prop(prefs, "header")
1186 col = split.column()
1187 col.prop(prefs, "header_text")
1190 class USERPREF_PT_file(bpy.types.Panel):
1191 bl_space_type = 'USER_PREFERENCES'
1193 bl_region_type = 'WINDOW'
1194 bl_show_header = False
1196 def poll(self, context):
1197 userpref = context.user_preferences
1198 return (userpref.active_section == 'FILES')
1200 def draw(self, context):
1201 layout = self.layout
1203 userpref = context.user_preferences
1204 paths = userpref.filepaths
1206 split = layout.split(percentage=0.7)
1208 col = split.column()
1209 col.label(text="File Paths:")
1211 colsplit = col.split(percentage=0.95)
1212 col1 = colsplit.split(percentage=0.3)
1215 sub.label(text="Fonts:")
1216 sub.label(text="Textures:")
1217 sub.label(text="Texture Plugins:")
1218 sub.label(text="Sequence Plugins:")
1219 sub.label(text="Render Output:")
1220 sub.label(text="Scripts:")
1221 sub.label(text="Sounds:")
1222 sub.label(text="Temp:")
1223 sub.label(text="Animation Player:")
1226 sub.prop(paths, "fonts_directory", text="")
1227 sub.prop(paths, "textures_directory", text="")
1228 sub.prop(paths, "texture_plugin_directory", text="")
1229 sub.prop(paths, "sequence_plugin_directory", text="")
1230 sub.prop(paths, "render_output_directory", text="")
1231 sub.prop(paths, "python_scripts_directory", text="")
1232 sub.prop(paths, "sounds_directory", text="")
1233 sub.prop(paths, "temporary_directory", text="")
1234 subsplit = sub.split(percentage=0.3)
1235 subsplit.prop(paths, "animation_player_preset", text="")
1236 subsplit.prop(paths, "animation_player", text="")
1238 col = split.column()
1239 col.label(text="Save & Load:")
1240 col.prop(paths, "use_relative_paths")
1241 col.prop(paths, "compress_file")
1242 col.prop(paths, "load_ui")
1243 col.prop(paths, "filter_file_extensions")
1244 col.prop(paths, "hide_dot_files_datablocks")
1249 col.label(text="Auto Save:")
1250 col.prop(paths, "save_version")
1251 col.prop(paths, "recent_files")
1252 col.prop(paths, "save_preview_images")
1253 col.prop(paths, "auto_save_temporary_files")
1255 sub.enabled = paths.auto_save_temporary_files
1256 sub.prop(paths, "auto_save_time", text="Timer (mins)")
1259 class USERPREF_PT_input(bpy.types.Panel):
1260 bl_space_type = 'USER_PREFERENCES'
1262 bl_region_type = 'WINDOW'
1263 bl_show_header = False
1265 def poll(self, context):
1266 userpref = context.user_preferences
1267 return (userpref.active_section == 'INPUT')
1269 def draw_entry(self, kc, entry, col, level=0):
1270 idname, spaceid, regionid, children = entry
1272 km = kc.find_keymap(idname, space_type=spaceid, region_type=regionid)
1275 self.draw_km(kc, km, children, col, level)
1277 def indented_layout(self, layout, level):
1280 level = 0.0001 # Tweak so that a percentage of 0 won't split by half
1281 indent = level * indentpx / bpy.context.region.width
1283 split = layout.split(percentage=indent)
1284 col = split.column()
1285 col = split.column()
1288 def draw_km(self, kc, km, children, layout, level):
1291 layout.set_context_pointer("keymap", km)
1293 col = self.indented_layout(layout, level)
1296 row.prop(km, "children_expanded", text="", no_bg=True)
1297 row.label(text=km.name)
1303 row.operator("wm.keymap_restore", text="Restore")
1305 row.operator("wm.keymap_edit", text="Edit")
1307 if km.children_expanded:
1309 # Put the Parent key map's entries in a 'global' sub-category
1310 # equal in hierarchy to the other children categories
1311 subcol = self.indented_layout(col, level + 1)
1312 subrow = subcol.row()
1313 subrow.prop(km, "items_expanded", text="", no_bg=True)
1314 subrow.label(text="%s (Global)" % km.name)
1316 km.items_expanded = True
1319 if km.items_expanded:
1320 for kmi in km.items:
1321 self.draw_kmi(kc, km, kmi, col, level + 1)
1323 # "Add New" at end of keymap item list
1324 col = self.indented_layout(col, level + 1)
1325 subcol = col.split(percentage=0.2).column()
1326 subcol.active = km.user_defined
1327 subcol.operator("wm.keyitem_add", text="Add New", icon='ZOOMIN')
1333 subcol = col.column()
1336 for entry in children:
1337 self.draw_entry(kc, entry, col, level + 1)
1339 def draw_kmi(self, kc, km, kmi, layout, level):
1340 layout.set_context_pointer("keyitem", kmi)
1342 col = self.indented_layout(layout, level)
1344 col.enabled = km.user_defined
1347 col = col.column(align=True)
1352 split = box.split(percentage=0.4)
1356 row.prop(kmi, "expanded", text="", no_bg=True)
1357 row.prop(kmi, "active", text="", no_bg=True)
1360 row.prop(kmi, "propvalue", text="")
1362 row.label(text=kmi.name)
1365 row.prop(kmi, "map_type", text="")
1366 if kmi.map_type == 'KEYBOARD':
1367 row.prop(kmi, "type", text="", full_event=True)
1368 elif kmi.map_type == 'MOUSE':
1369 row.prop(kmi, "type", text="", full_event=True)
1370 elif kmi.map_type == 'TWEAK':
1372 subrow.prop(kmi, "type", text="")
1373 subrow.prop(kmi, "value", text="")
1374 elif kmi.map_type == 'TIMER':
1375 row.prop(kmi, "type", text="")
1379 row.operator("wm.keyitem_restore", text="", icon='BACK')
1380 row.operator("wm.keyitem_remove", text="", icon='X')
1382 # Expanded, additional event settings
1386 if kmi.map_type not in ('TEXTINPUT', 'TIMER'):
1387 split = box.split(percentage=0.4)
1391 sub.prop(kmi, "propvalue", text="")
1393 sub.prop(kmi, "idname", text="")
1395 sub = split.column()
1396 subrow = sub.row(align=True)
1398 if kmi.map_type == 'KEYBOARD':
1399 subrow.prop(kmi, "type", text="", event=True)
1400 subrow.prop(kmi, "value", text="")
1401 elif kmi.map_type == 'MOUSE':
1402 subrow.prop(kmi, "type", text="")
1403 subrow.prop(kmi, "value", text="")
1406 subrow.scale_x = 0.75
1407 subrow.prop(kmi, "any")
1408 subrow.prop(kmi, "shift")
1409 subrow.prop(kmi, "ctrl")
1410 subrow.prop(kmi, "alt")
1411 subrow.prop(kmi, "oskey", text="Cmd")
1412 subrow.prop(kmi, "key_modifier", text="", event=True)
1414 # Operator properties
1415 props = kmi.properties
1416 if props is not None:
1418 flow = box.column_flow(columns=2)
1419 for pname in dir(props):
1420 if not props.is_property_hidden(pname):
1421 flow.prop(props, pname)
1423 # Modal key maps attached to this operator
1425 kmm = kc.find_keymap_modal(kmi.idname)
1427 self.draw_km(kc, kmm, None, layout, level + 1)
1429 def draw_input_prefs(self, inputs, layout):
1435 sub.label(text="Mouse:")
1437 sub1.enabled = (inputs.select_mouse == 'RIGHT')
1438 sub1.prop(inputs, "emulate_3_button_mouse")
1439 sub.prop(inputs, "continuous_mouse")
1441 sub.label(text="Select With:")
1442 sub.row().prop(inputs, "select_mouse", expand=True)
1445 sub.label(text="Double Click:")
1446 sub.prop(inputs, "double_click_time", text="Speed")
1450 sub.prop(inputs, "emulate_numpad")
1454 sub.label(text="Orbit Style:")
1455 sub.row().prop(inputs, "view_rotation", expand=True)
1457 sub.label(text="Zoom Style:")
1458 sub.row().prop(inputs, "viewport_zoom_style", expand=True)
1459 if inputs.viewport_zoom_style == 'DOLLY':
1460 sub.row().prop(inputs, "zoom_axis", expand=True)
1461 sub.prop(inputs, "invert_zoom_direction")
1463 #sub.prop(inputs, "use_middle_mouse_paste")
1468 #sub.label(text="Mouse Wheel:")
1469 #sub.prop(view, "wheel_scroll_lines", text="Scroll Lines")
1474 sub.label(text="NDOF Device:")
1475 sub.prop(inputs, "ndof_pan_speed", text="Pan Speed")
1476 sub.prop(inputs, "ndof_rotate_speed", text="Orbit Speed")
1480 def draw_filtered(self, kc, layout):
1481 filter = kc.filter.lower()
1483 for km in kc.keymaps:
1486 filtered_items = [kmi for kmi in km.items if filter in kmi.name.lower()]
1488 if len(filtered_items) != 0:
1489 layout.set_context_pointer("keymap", km)
1490 col = layout.column()
1493 row.label(text=km.name, icon="DOT")
1499 row.operator("wm.keymap_restore", text="Restore")
1501 row.operator("wm.keymap_edit", text="Edit")
1503 for kmi in filtered_items:
1504 self.draw_kmi(kc, km, kmi, col, 1)
1506 # "Add New" at end of keymap item list
1507 col = self.indented_layout(layout, 1)
1508 subcol = col.split(percentage=0.2).column()
1509 subcol.active = km.user_defined
1510 subcol.operator("wm.keyitem_add", text="Add New", icon='ZOOMIN')
1512 def draw_hierarchy(self, defkc, layout):
1513 for entry in KM_HIERARCHY:
1514 self.draw_entry(defkc, entry, layout)
1516 def draw(self, context):
1517 layout = self.layout
1519 userpref = context.user_preferences
1520 wm = context.manager
1522 inputs = userpref.inputs
1524 split = layout.split(percentage=0.25)
1527 self.draw_input_prefs(inputs, split)
1530 col = split.column()
1531 # kc = wm.active_keyconfig
1532 kc = wm.default_keyconfig
1536 subsplit = sub.split()
1537 subcol = subsplit.column()
1538 subcol.prop_object(wm, "active_keyconfig", wm, "keyconfigs", text="Configuration:")
1540 subcol = subsplit.column()
1541 subcol.prop(kc, "filter", icon="VIEWZOOM")
1546 self.draw_filtered(kc, col)
1548 self.draw_hierarchy(kc, col)
1550 bpy.types.register(USERPREF_HT_header)
1551 bpy.types.register(USERPREF_PT_tabs)
1552 bpy.types.register(USERPREF_PT_interface)
1553 bpy.types.register(USERPREF_PT_theme)
1554 bpy.types.register(USERPREF_PT_edit)
1555 bpy.types.register(USERPREF_PT_system)
1556 bpy.types.register(USERPREF_PT_file)
1557 bpy.types.register(USERPREF_PT_input)
1559 from bpy.props import *
1562 class WM_OT_keyconfig_test(bpy.types.Operator):
1563 "Test keyconfig for conflicts."
1564 bl_idname = "wm.keyconfig_test"
1565 bl_label = "Test Key Configuration for Conflicts"
1567 def testEntry(self, kc, entry, src=None, parent=None):
1572 s = ["kmi = km.add_modal_item(\'%s\', \'%s\', \'%s\'" % (kmi.propvalue, kmi.type, kmi.value)]
1574 s = ["kmi = km.add_item(\'%s\', \'%s\', \'%s\'" % (kmi.idname, kmi.type, kmi.value)]
1577 s.append(", any=True")
1580 s.append(", shift=True")
1582 s.append(", ctrl=True")
1584 s.append(", alt=True")
1586 s.append(", oskey=True")
1587 if kmi.key_modifier and kmi.key_modifier != 'NONE':
1588 s.append(", key_modifier=\'%s\'" % kmi.key_modifier)
1592 props = kmi.properties
1594 if props is not None:
1595 for pname in dir(props):
1596 if props.is_property_set(pname) and not props.is_property_hidden(pname):
1597 value = eval("props.%s" % pname)
1598 value = _string_value(value)
1600 s.append("kmi.properties.%s = %s\n" % (pname, value))
1602 return "".join(s).strip()
1604 idname, spaceid, regionid, children = entry
1606 km = kc.find_keymap(idname, space_type=spaceid, region_type=regionid)
1612 for item in km.items:
1613 if src.compare(item):
1614 print("===========")
1621 for child in children:
1622 if self.testEntry(kc, child, src, parent):
1625 for i in range(len(km.items)):
1628 for child in children:
1629 if self.testEntry(kc, child, src, km):
1632 for j in range(len(km.items) - i - 1):
1633 item = km.items[j + i + 1]
1634 if src.compare(item):
1635 print("===========")
1641 for child in children:
1642 if self.testEntry(kc, child):
1647 def testConfig(self, kc):
1649 for entry in KM_HIERARCHY:
1650 if self.testEntry(kc, entry):
1654 def execute(self, context):
1655 wm = context.manager
1656 kc = wm.default_keyconfig
1658 if self.testConfig(kc):
1664 def _string_value(value):
1666 if isinstance(value, str):
1668 result = "\'%s\'" % value
1669 elif isinstance(value, bool):
1674 elif isinstance(value, float):
1675 result = "%.10f" % value
1676 elif isinstance(value, int):
1677 result = "%d" % value
1678 elif getattr(value, '__len__', False):
1681 for i in range(0, len(value)):
1682 result += _string_value(value[i])
1683 if i != len(value)-1:
1687 print("Export key configuration: can't write ", value)
1692 class WM_OT_keyconfig_export(bpy.types.Operator):
1693 "Export key configuration to a python script."
1694 bl_idname = "wm.keyconfig_export"
1695 bl_label = "Export Key Configuration..."
1697 path = bpy.props.StringProperty(name="File Path", description="File path to write file to.")
1699 def execute(self, context):
1700 if not self.properties.path:
1701 raise Exception("File path not set.")
1703 f = open(self.properties.path, "w")
1705 raise Exception("Could not open file.")
1707 wm = context.manager
1708 kc = wm.active_keyconfig
1710 f.write('# Configuration %s\n' % kc.name)
1712 f.write("wm = bpy.data.windowmanagers[0]\n")
1713 f.write("kc = wm.add_keyconfig(\'%s\')\n\n" % kc.name)
1715 for km in kc.keymaps:
1717 f.write("# Map %s\n" % km.name)
1718 f.write("km = kc.add_keymap(\'%s\', space_type=\'%s\', region_type=\'%s\', modal=%s)\n\n" % (km.name, km.space_type, km.region_type, km.modal))
1719 for kmi in km.items:
1721 f.write("kmi = km.add_modal_item(\'%s\', \'%s\', \'%s\'" % (kmi.propvalue, kmi.type, kmi.value))
1723 f.write("kmi = km.add_item(\'%s\', \'%s\', \'%s\'" % (kmi.idname, kmi.type, kmi.value))
1725 f.write(", any=True")
1728 f.write(", shift=True")
1730 f.write(", ctrl=True")
1732 f.write(", alt=True")
1734 f.write(", oskey=True")
1735 if kmi.key_modifier and kmi.key_modifier != 'NONE':
1736 f.write(", key_modifier=\'%s\'" % kmi.key_modifier)
1739 props = kmi.properties
1741 if props is not None:
1742 for pname in dir(props):
1743 if props.is_property_set(pname) and not props.is_property_hidden(pname):
1744 value = eval("props.%s" % pname)
1745 value = _string_value(value)
1747 f.write("kmi.properties.%s = %s\n" % (pname, value))
1755 def invoke(self, context, event):
1756 wm = context.manager
1757 wm.add_fileselect(self)
1758 return {'RUNNING_MODAL'}
1761 class WM_OT_keymap_edit(bpy.types.Operator):
1763 bl_idname = "wm.keymap_edit"
1764 bl_label = "Edit Key Map"
1766 def execute(self, context):
1767 wm = context.manager
1773 class WM_OT_keymap_restore(bpy.types.Operator):
1774 "Restore key map(s)."
1775 bl_idname = "wm.keymap_restore"
1776 bl_label = "Restore Key Map(s)"
1778 all = BoolProperty(attr="all", name="All Keymaps", description="Restore all keymaps to default.")
1780 def execute(self, context):
1781 wm = context.manager
1783 if self.properties.all:
1784 for km in wm.default_keyconfig.keymaps:
1785 km.restore_to_default()
1788 km.restore_to_default()
1793 class WM_OT_keyitem_restore(bpy.types.Operator):
1794 "Restore key map item."
1795 bl_idname = "wm.keyitem_restore"
1796 bl_label = "Restore Key Map Item"
1798 def poll(self, context):
1799 kmi = context.keyitem
1801 return km and kmi and kmi.id != 0
1803 def execute(self, context):
1804 wm = context.manager
1805 kmi = context.keyitem
1808 km.restore_item_to_default(kmi)
1813 class WM_OT_keyitem_add(bpy.types.Operator):
1815 bl_idname = "wm.keyitem_add"
1816 bl_label = "Add Key Map Item"
1818 def execute(self, context):
1819 wm = context.manager
1821 kc = wm.default_keyconfig
1824 km.add_modal_item("", 'A', 'PRESS') # kmi
1826 km.add_item("none", 'A', 'PRESS') # kmi
1828 # clear filter and expand keymap so we can see the newly added item
1831 km.items_expanded = True
1832 km.children_expanded = True
1837 class WM_OT_keyitem_remove(bpy.types.Operator):
1838 "Remove key map item."
1839 bl_idname = "wm.keyitem_remove"
1840 bl_label = "Remove Key Map Item"
1842 def execute(self, context):
1843 wm = context.manager
1844 kmi = context.keyitem
1849 bpy.types.register(WM_OT_keyconfig_export)
1850 bpy.types.register(WM_OT_keyconfig_test)
1851 bpy.types.register(WM_OT_keymap_edit)
1852 bpy.types.register(WM_OT_keymap_restore)
1853 bpy.types.register(WM_OT_keyitem_add)
1854 bpy.types.register(WM_OT_keyitem_remove)
1855 bpy.types.register(WM_OT_keyitem_restore)