diff options
author | William Reynish <billrey@me.com> | 2020-01-23 16:53:19 +0300 |
---|---|---|
committer | William Reynish <billrey@me.com> | 2020-01-23 16:53:19 +0300 |
commit | 8482ba6d2e1a97e038175a7fb693ed40c03ca5d9 (patch) | |
tree | 77d4833e10d29272e909dff7f07845d8b43a8c1c /release/scripts/startup/bl_ui/space_text.py | |
parent | 24ebed4d841ea9828a869d917a5718c829f09430 (diff) |
UI: Text Editor header cleanup
- Register toggle is in the Text menu
- Run Script and Refresh OSL become an icon buttons next to ID block
Differential Revision: https://developer.blender.org/D5686
Reviewed by Campbell Barton
Diffstat (limited to 'release/scripts/startup/bl_ui/space_text.py')
-rw-r--r-- | release/scripts/startup/bl_ui/space_text.py | 33 |
1 files changed, 13 insertions, 20 deletions
diff --git a/release/scripts/startup/bl_ui/space_text.py b/release/scripts/startup/bl_ui/space_text.py index 81ccc9216a1..b7c5dcd5437 100644 --- a/release/scripts/startup/bl_ui/space_text.py +++ b/release/scripts/startup/bl_ui/space_text.py @@ -30,7 +30,7 @@ class TEXT_HT_header(Header): st = context.space_data text = st.text - + is_syntax_highlight_supported = st.is_syntax_highlight_supported() layout.template_header() TEXT_MT_editor_menus.draw_collapsible(context, layout) @@ -43,7 +43,18 @@ class TEXT_HT_header(Header): layout.separator_spacer() row = layout.row(align=True) - row.template_ID(st, "text", new="text.new", unlink="text.unlink", open="text.open") + row.template_ID(st, "text", new="text.new", + unlink="text.unlink", open="text.open") + + if text: + is_osl = text.name.endswith((".osl", ".osl")) + if is_osl: + row.operator("node.shader_script_update", + text="", icon='FILE_REFRESH') + else: + row = layout.row() + row.active = is_syntax_highlight_supported + row.operator("text.run_script", text="", icon='PLAY') layout.separator_spacer() @@ -51,28 +62,10 @@ class TEXT_HT_header(Header): row.prop(st, "show_line_numbers", text="") row.prop(st, "show_word_wrap", text="") - is_syntax_highlight_supported = st.is_syntax_highlight_supported() syntax = row.row(align=True) syntax.active = is_syntax_highlight_supported syntax.prop(st, "show_syntax_highlight", text="") - if text: - text_name = text.name - is_osl = text_name.endswith((".osl", ".oso")) - - row = layout.row() - if is_osl: - row = layout.row() - row.operator("node.shader_script_update") - else: - row = layout.row() - row.active = text_name.endswith(".py") - row.prop(text, "use_module") - - row = layout.row() - row.active = is_syntax_highlight_supported - row.operator("text.run_script") - class TEXT_HT_footer(Header): bl_space_type = 'TEXT_EDITOR' |