for example i use:
- sublimeText for vex
- pycharm for py
but as far as i can tell, it's not possible to have houdini work with both apps. best i can do is close houdini / edit the houdini.env file and swap these two lines to switch which editor to use and that's not great. I have to use different apps because I've gotten vex autocomplete working in sublimeText and houdini python autocomplete working in pycharm... (plus pycharm is good at py but not vex and i have py macros in pycharm but not sublimeText and vice versa, so there's a number of reasons why i wouldn't want to just use one app even if i could get the sublimeText hou py autocomplete working.. )
EDITOR = "C:/Program Files/Sublime Text 3/sublime_text.exe"
EDITOR = "C:/Program Files/JetBrains/PyCharm Community Edition 2021.1.1/bin/pycharm64.exe"
is it possible to have 2 different text editors?
1631 14 1- indigosm
- Member
- 48 posts
- Joined: April 2020
- Offline
- SWest
- Member
- 313 posts
- Joined: Oct. 2016
- Offline
It took near an hour to do this, and it works on my system.
You will need to set the labels and the paths in the code directly.
If you place it in the shelf you can add a keyboard hotkey.
It is free for the community and there is room for improvement.
You will need to set the labels and the paths in the code directly.
If you place it in the shelf you can add a keyboard hotkey.
It is free for the community and there is room for improvement.
import os # license: # free for the Houdini community # authors # SWest (2023) # internal ext_editors_dict={} # please set the paths to all your preferred external apps here # copy paste the line and edit ext_dict = {} ext_dict['KDevelop']='/usr/bin/kdevelop' ext_dict['PyCharm']='/opt/pycharm/pycharm-community-2022.2.2/bin/pycharm.sh' ext_dict['Notepad']='/not/installed/just_for_demo.sh' # make labels labels_list = [] for k in ext_dict.keys(): labels_list.append(k) # get user choice user_choice_num = hou.ui.displayMessage("Please choose your weapon.", buttons=(labels_list)) user_choice_key = labels_list[user_choice_num] user_choice_path = ext_dict[user_choice_key] # internal path_to_home_houdini = hou.homeHoudiniDirectory() tgt_file="ExternalEditor.cfg" tgt_path = os.path.join(path_to_home_houdini, tgt_file) # write that thing with open(tgt_path, 'w') as it: it.write(user_choice_path) # troubleshooting # make sure this user has write permission to the "tgt_file" (should be so) # make sure your paths are correct and exact
Interested in character concepts, modeling, rigging, and animation. Related tool dev with Py and VEX.
- indigosm
- Member
- 48 posts
- Joined: April 2020
- Offline
that's crazy. so i can and can't get it to work because it appears there's a number of different 'edit in external editor' commands that aren't the same.
your script :
- works : in vex, rightClick->expressions->edit in external editor
- fails : in vex, alt-e hotkey (and normally alt-e does nothing, but i just today got that working by enabling toolbar->preferences->scripting->edit strings and expressions with external editor) <uses notepad, not the app in ExternalEditor.cfg>
- fails : in HDA properties window->interactive tab->edit text with an external editor button <uses notepad, not the app in ExternalEditor.cfg>
also, i had to comment out my command in the houdini.env file (EDITOR = "C:/Program Files/Sublime Text 3/sublime_text.exe") or i -think- all 3 of those edit in external editors would use this exe and not the one you're defining in ExternalEditor.cfg
so it sounds like this is the kind of thing that needs to be cleaned up on sideFX's end because there's too many contradictions. i haven't even mentioned how in just the env file alone, there's TWO ways to define your external text editor?! So it sounds like there's THREE ways to define your external text editor and all conflict in various ways :
1) houdini.env EDITOR = ...
2) houdini.env VISUAL = ...
3) ExternalEditor.cfg
and if any of these fail, it uses notepad.....
your script :
- works : in vex, rightClick->expressions->edit in external editor
- fails : in vex, alt-e hotkey (and normally alt-e does nothing, but i just today got that working by enabling toolbar->preferences->scripting->edit strings and expressions with external editor) <uses notepad, not the app in ExternalEditor.cfg>
- fails : in HDA properties window->interactive tab->edit text with an external editor button <uses notepad, not the app in ExternalEditor.cfg>
also, i had to comment out my command in the houdini.env file (EDITOR = "C:/Program Files/Sublime Text 3/sublime_text.exe") or i -think- all 3 of those edit in external editors would use this exe and not the one you're defining in ExternalEditor.cfg
so it sounds like this is the kind of thing that needs to be cleaned up on sideFX's end because there's too many contradictions. i haven't even mentioned how in just the env file alone, there's TWO ways to define your external text editor?! So it sounds like there's THREE ways to define your external text editor and all conflict in various ways :
1) houdini.env EDITOR = ...
2) houdini.env VISUAL = ...
3) ExternalEditor.cfg
and if any of these fail, it uses notepad.....
- SWest
- Member
- 313 posts
- Joined: Oct. 2016
- Offline
Hi,
actually I was expecting something like that on your end.
Being able to define things in different places is not very unusual.
This idea, to access something multiple ways. is typical for the entire Windows OS.
In my system I think this seem to be set (by me) only in one place.
However, there is room for improvement in the code because it is a hack.
I’d expect a thank you because this I did not need. Ungratefulness simply lead to less community support.
Good luck!
P.S. Alt+e is not external editor in Linux. Your first option is. Your last option I don’t know about. If something really need fixing you can write a short RFE/BUG-report and be happy. This is just the nature of software.
actually I was expecting something like that on your end.
Being able to define things in different places is not very unusual.
This idea, to access something multiple ways. is typical for the entire Windows OS.
In my system I think this seem to be set (by me) only in one place.
However, there is room for improvement in the code because it is a hack.
I’d expect a thank you because this I did not need. Ungratefulness simply lead to less community support.
Good luck!
P.S. Alt+e is not external editor in Linux. Your first option is. Your last option I don’t know about. If something really need fixing you can write a short RFE/BUG-report and be happy. This is just the nature of software.
Edited by SWest - Oct. 10, 2023 02:03:52
Interested in character concepts, modeling, rigging, and animation. Related tool dev with Py and VEX.
- anon_user_95266836
- Member
- 64 posts
- Joined: April 2022
- Offline
- indigosm
- Member
- 48 posts
- Joined: April 2020
- Offline
SWest
Hi,
actually I was expecting something like that on your end.
Being able to define things in different places is not very unusual.
This idea, to access something multiple ways. is typical for the entire Windows OS.
In my system I think this seem to be set (by me) only in one place.
However, there is room for improvement in the code because it is a hack.
I’d expect a thank you because this I did not need. Ungratefulness simply lead to less community support.
Good luck!
P.S. Alt+e is not external editor in Linux. Your first option is. Your last option I don’t know about. If something really need fixing you can write a short RFE/BUG-report and be happy. This is just the nature of software.
sorry i should have phrased it better. when i said that's crazy, i meant that's a great idea you came up with. i wouldn't ever think you could redefine which text editor is used on the fly. it's a shame that this trick doesn't work in all text editor cases and that's outside our control. i was curious if i could try pulling this same trick to rewrite the houdini.env file on the fly because that file does redefine which text editor is used in all usage cases, but sadly that doesn't work either because it's read at app launch and never reloaded. pooo...
so hmmmmm. definitely a tricky problem. the best hack i know of so far is to rewrite the text editor manually in the env file and close/restart the app. pretty bad.
- SWest
- Member
- 313 posts
- Joined: Oct. 2016
- Offline
indigosm
that's outside our control
Not convinced about that. The more I dig, the more I find. (I’m refereing to the HOM here which is a hack friendly well organized haystack)
However, I searched the preferences using Python but did not find the ”external” or ”editor” variable. That led me to that file.
Anyway, it seem to work on Linux.
Maybe next step for you is an RFE?
Here’s a proposal: Use the known value for this variable, then search the entire HOM for the variable that has it.
Another proposal: Check if notepad is the default editor for Windows. Maybe Houdini inherits that. If so, maybe this can be overridden as well (i.e hacked).
Also I suggest that you remove as many definitions as possible and try only one place. Getting answers become simpler.
Edited by SWest - Oct. 10, 2023 11:31:47
Interested in character concepts, modeling, rigging, and animation. Related tool dev with Py and VEX.
- indigosm
- Member
- 48 posts
- Joined: April 2020
- Offline
- SWest
- Member
- 313 posts
- Joined: Oct. 2016
- Offline
- anon_user_95266836
- Member
- 64 posts
- Joined: April 2022
- Offline
- indigosm
- Member
- 48 posts
- Joined: April 2020
- Offline
Alexey_Vanzhulainnnnteresting.... it kinda appears you have to set the editor twice using two different ways in order for it work in all cases.
ge EDITOR in Houdini o
hou.putenv
works : edit interactive portion of hda
works : alt-e in wrangler
works : alt-e in python node
fails : right click in wrangler and choose to edit in external editor
fails : right click in python node and choose to edit in external editor
ExternalEditor.CFG
is the opposite of the ones i just listed. hah
so if you put both, then it will edit the file in the app of your choice in all cases it appears. awesome.
import os # license: # free for the Houdini community # authors # SWest / Alexey_Vanzhula (2023) # internal ext_editors_dict={} # please set the paths to all your preferred external apps here # copy paste the line and edit ext_dict = {} #ext_dict['PyCharm']='/opt/pycharm/pycharm-community-2022.2.2/bin/pycharm.sh' ext_dict['PyCharm']='C:/Program Files/JetBrains/PyCharm Community Edition 2021.1.1/bin/pycharm64.exe' ext_dict['Sublime']='C:/Program Files/Sublime Text 3/sublime_text.exe' # make labels labels_list = [] for k in ext_dict.keys(): labels_list.append(k) # get user choice user_choice_num = hou.ui.displayMessage("Please choose your weapon.", buttons=(labels_list)) user_choice_key = labels_list[user_choice_num] user_choice_path = ext_dict[user_choice_key] # set editor 1 for alt-e / HDA script edit hou.putenv("EDITOR",user_choice_path) # set editor 2 for right click edit in external editor path_to_home_houdini = hou.homeHoudiniDirectory() tgt_file="ExternalEditor.cfg" tgt_path = os.path.join(path_to_home_houdini, tgt_file) # write that thing with open(tgt_path, 'w') as it: it.write(user_choice_path) # troubleshooting # make sure this user has write permission to the "tgt_file" (should be so) # make sure your paths are correct and exact
Edited by indigosm - Oct. 10, 2023 12:02:33
- anon_user_95266836
- Member
- 64 posts
- Joined: April 2022
- Offline
Just a simplified script:
EDITORS = { 'PyCharm' : 'C:/Program Files/JetBrains/PyCharm Community Edition 2021.1.1/bin/pycharm64.exe', 'Sublime' : 'C:/Program Files/Sublime Text 3/sublime_text.exe' } editor_id = hou.ui.displayMessage("Please choose your weapon.", buttons=tuple(EDITORS.keys())) editor_path = tuple(EDITORS.values())[editor_id] # set editor 1 for alt-e / HDA script edit hou.putenv("EDITOR", editor_path) # set editor 2 for right click edit in external editor with open(hou.homeHoudiniDirectory() + "/ExternalEditor.cfg", 'w') as f: f.write(editor_path)
Edited by anon_user_95266836 - Oct. 10, 2023 13:02:50
- SWest
- Member
- 313 posts
- Joined: Oct. 2016
- Offline
- jomaro
- Member
- 86 posts
- Joined: April 2017
- Offline
Alexey_Vanzhula
Just a simplified script:EDITORS = { 'PyCharm' : 'C:/Program Files/JetBrains/PyCharm Community Edition 2021.1.1/bin/pycharm64.exe', 'Sublime' : 'C:/Program Files/Sublime Text 3/sublime_text.exe' } editor_id = hou.ui.displayMessage("Please choose your weapon.", buttons=tuple(EDITORS.keys())) editor_path = tuple(EDITORS.values())[editor_id] # set editor 1 for alt-e / HDA script edit hou.putenv("EDITOR", editor_path) # set editor 2 for right click edit in external editor with open(hou.homeHoudiniDirectory() + "/ExternalEditor.cfg", 'w') as f: f.write(editor_path)
Sorry where do you put this script?
In ExternalEditor.cfg??
- indigosm
- Member
- 48 posts
- Joined: April 2020
- Offline
jomaro
Sorry where do you put this script?
In ExternalEditor.cfg??
1 - on shelf, create new tool
2 - right click on tool and edit
3 - paste the script into the script tab of the tool and edit your script editor exe paths
4 - run script to choose your scripting app
5 - now send the text to the external editor. there's a couple of ways for different windows so i'll list 'em all :
5a - in vex editor \ python editor, right click on empty space and choose expression->edit in external editor
5b - in vex editor \ python editor, press alt-e hotkey (might have to enable it in preferences->scripting->edit strings and expressions using external editor)
5c - in HDA properties window's interactive tab, click on the 'edit text with an external editor' button
-
- Quick Links