attempting to turn on & off undo using either ui.undo.globalState = False or ui.undo.state = False does not behave consistently . expected behaviour is that ui.undo.globalState = False turns off undo redo globally across the project , however it often either doesnt work at all, or only turns off node placement at the level its placed, text input inside dats is never turned off.
def onValueChange(channel, sampleIndex, val, prev):
if channel.name == 'rollover':
if val == 1:
# Mouse is over the panel
ui.undo.globalState = False
print(f"Mouse entered web browser panel, disabled global undo")
else:
# Mouse is not over the panel
ui.undo.globalState = True
print(f"Mouse left web browser panel, enabled global undo")
print(f"Global undo state: {ui.undo.globalState}")
return
changes the state, but the nodes in my network are still undoing even when undo state is globally false. it seems to be possible to have the globalState set to false but the actual state be True.
the most consistent inconsistent behaviour I have noticed is that when undo is turned off its still turned on for text inside of dats , it still logs undoing above in the dialog , which can also inadvertantly lead to the undo state being reversed where it says the state is off in the textport but it acts as if it was on
These features are rarely used, and we’re looking into the effects of some recent changes, thanks for report! Note that text input into fields is generally on a different undo chain than the main editor undo. More info to come.
as a feature request then, If we could have a state for text undo could also be turned off that would be huge.
I am building an interactive code editor built for/in TD. it can handle live text input to any DAT in network. it has its own undo stack, so the idea is to turn off undo state when inside of its panel.
Any help from derivative in this project would be greatly appreciated.
it works for live coding & non live coding. like I said its a fully integrated code editor/micro ide for touchdesigner. it uses monaco editor as the backend, served via webserver . currently configurable to look at any dat in project, adding config for any/every op in project too. its about 3 days old rn…
while this is OffTopic to the undo discussion, I can elaborate a bit further on my thinking. currently coding in touchdesigner is relegated to either directly inside of the dats themselves, without syntax highlighting, QoL features etc that a modern code editor provides, or in an external editor via a tempt file, which does have some QoL but is not integrated , no project awareness & results in orphan files. not only that but there are languages & frameworks supported in touchdesigner which arent supported in the syntax dropdown in dats, such as JS TS via webserver . this solves these issues.
Ah, gotcha. Just so you’re aware, code completion for all TD objects is coming soon for VS Code, with more QoL stuff to come. I’d also recommend using the sync feature to externalize your important DATs into an organized folder and then work in an external editor. Doesn’t solve everything you’re talking about, but some things. Your project also sounds very interesting. I’ll see what the C++ team says about your feature request.
I heard whispers about this. my feeling is that unless the vscode integration provides direct integration with my project & with the dats, such that I can update text live, directly, & without temp files. then it wouldnt be as useful as having the editor integrated. Ive already seen a 10x in my dev speed from ditching external editor & using my own solution & it only took 3 days to build this proto. Monaco is VS codes editor anyways so we get same featureset but trade plugins/extensions for much deeper connection to my TD project. I will just roll the sync feature as a per file option inside my own editor & then have access to those files via external editor whenever necessary.
But yeah a fix for ui.undo.globalState & support for text undo state would be amazing . thank you
Not that DAT editing has many features but syntax highlighting we brought in 2022. The DAT’s language needs to be set on the common page. Just FYI if you missed that addition.
I just want to clarify something. ui.undo.globalState/state enables and disables undo creation. We don’t have anything that turns off the ability to call undo/redo.
The script you post will turn off creating undo/redos while you are inside a panel, so if you are editing, and your mouse isn’t over that panel, the undos for the move/edit will still be created.
On windows, if you want to turn off undo/redo while you are over a panel, you can over write /local/shortcuts with an entry for the undo/redo shortcut keys. On macOS there’s currently a bug
Thanks Ben, I mistyped here, I meant autocompletes & other QoL features, & syntax highlighting for languages supported in touchdesigner via webserver but not natively supported.
Thanks so much for this clarification. this is exactly what I was looking for.
In terms of the bug on mac, what kind of bug are we seeing there, is there any way to work around it ?
I can deal with this component not being fully supported on mac as I believe there are also still issues with webBrowser on mac, meaning mac users may have to use my component in an external browser anyway.
Glad that helped. The issue on macOS is that the undo/redo shortcuts are tied to the system and can’t be over written right now. I’ll log it as a bug but it’s not likely to be a high priority fix.