UI: Add a custom text editor preference

Add a user preference to set up a custom text editor for editing text
files with the "Edit Source" action in the UI context menu.

- An operator TEXT_OT_jump_to_file_at_point has been added.
- A custom editor can be set in the user preferences.
- A preset has been included for "Visual Studio Code".
- When the editor is not set, use Blender's internal editor.

Ref !108299.
This commit is contained in:
guishe
2023-05-25 16:25:46 -06:00
committed by Campbell Barton
parent 3b634d6f7f
commit e16ec95a16
11 changed files with 191 additions and 3 deletions

View File

@@ -0,0 +1,12 @@
import bpy
import platform
filepaths = bpy.context.preferences.filepaths
filepaths.text_editor_args = "-g $filepath:$line:$column"
match platform.system():
case "Windows":
filepaths.text_editor = "code.cmd"
case _:
filepaths.text_editor = "code"