Edit XML with an external editor
Moderator: Moderators
Edit XML with an external editor
Hello,
Would it be possible to add the option to edit the XML using an external editor (let say, sublime text) when clicking the "Edit as XML (Ctrl + M)" button, instead of using the built-in editor, and then update the project when the file is saved with the external editor?
Would it be possible to add the option to edit the XML using an external editor (let say, sublime text) when clicking the "Edit as XML (Ctrl + M)" button, instead of using the built-in editor, and then update the project when the file is saved with the external editor?
Re: Edit XML with an external editor
I do this sometimes manually by copy paste all into my favorite text editor and then copy it back. But you are right there could be an option for this. ZGE could also autodetect if the zgeproj file have been edited and ask to reload current project.
Re: Edit XML with an external editor
Hello. My game is slowly becoming huge for only one file, even if I comment everything in order to find what and where things are...
I'm planning to write a simple batch file to append several txt files into one final xml project, and so I was wondering if it would be possible to build a zgeproj without having to open ZGameEditor.exe, and then launch the game.
Something like:
Or directly open ZGE with a project:
The classic command functions
I'm planning to write a simple batch file to append several txt files into one final xml project, and so I was wondering if it would be possible to build a zgeproj without having to open ZGameEditor.exe, and then launch the game.
Something like:
Code: Select all
ZGameEditor.exe -b pathTo/myProject.zgeproject
pathTo/myProject.exe
Code: Select all
ZGameEditor.exe -o pathTo/myProject.zgeproject
Re: Edit XML with an external editor
Hi Ats,
K
Can you elaborate on what difficulties you're experiencing because your project is so huge?
Being able to compile / build a .zgeproj from the command line would be super convenient yes.Ats wrote: ↑Thu Apr 20, 2023 9:08 amSomething like:Code: Select all
ZGameEditor.exe -b pathTo/myProject.zgeproject pathTo/myProject.exe
K
Re: Edit XML with an external editor
Mostly, having to deploy the component tree in order to select the right thing to display a lot of lines of code into the little ZGE code editor.Kjell wrote:Can you elaborate on what difficulties you're experiencing because your project is so huge?
And if I edit anything in the XML editor, it will entirely close the project tree afterward. So I spend a lot of time searching things I could simply edit in a dedicated code editor.
Re: Edit XML with an external editor
Hi Ats,
Anyway, perhaps not as convenient .. but you can roll your own solution pretty easily. Attached is a example project that loads a external script into a ZExpression in App.OnRender. If you want to see changes made to the script while preview is running simply select the "Load Script" ZExpression in App.OnLoaded and press F5. Below is a demonstration of the example ( click the GIF for the MP4 version )
K
Gotcha .. would be convenient if there was the option to use a external file with ZExpression / ZLibrary / BitmapFromFile / MeshImport etc. just like you can with ZExternalLibrary ( using DefinitionsFile ). Ideally the editor would then detect any changes made to the external file and automatically update the component.
Anyway, perhaps not as convenient .. but you can roll your own solution pretty easily. Attached is a example project that loads a external script into a ZExpression in App.OnRender. If you want to see changes made to the script while preview is running simply select the "Load Script" ZExpression in App.OnLoaded and press F5. Below is a demonstration of the example ( click the GIF for the MP4 version )
One thing you can do to make this issue a little less annoying is to (ab)use a bunch of CallComponent components as a shortcut / bookmark list. Then using the "click to focus" button you can quickly jump to that component in the project tree.
K
- Attachments
-
- Script.zip
- (875 Bytes) Downloaded 861 times
Re: Edit XML with an external editor
That is a very nice example Kjell! You just have to remember to make sure the script is loaded before generating a binary since the setStringProperty function is not available in the runtime.
A build "/b" switch sounds like a good idea.
I can also look in to keeping project tree nodes open after editing the xml.
I don't have time this week but I will try to check this next week.
A build "/b" switch sounds like a good idea.
I can also look in to keeping project tree nodes open after editing the xml.
I don't have time this week but I will try to check this next week.
Re: Edit XML with an external editor
Hahaha thanks for those overkill examples. I may not directly use them like that, but they could be handy to load some other external data that I get from a spreadsheet
Edit:
Thanks VilleK. There is no rush. I'm just planning my next moves in order to get motivated to continue!
Edit:
Thanks VilleK. There is no rush. I'm just planning my next moves in order to get motivated to continue!
Re: Edit XML with an external editor
Please try new build: http://www.zgameeditor.org/files/ZGameEditor_beta.zip
- attempt to keep nodes opened after xml editor is used
- build project from command line using syntax "/b zgeproj-filename exe-filename". Example:
- attempt to keep nodes opened after xml editor is used
- build project from command line using syntax "/b zgeproj-filename exe-filename". Example:
Code: Select all
ZGameEditor.exe /b "C:\MyProjects\NesEmu.zgeproj" C:\Temp\nesemu.exe
Re: Edit XML with an external editor
Thanks VilleK. I just downloaded and tried on my project.
For starters, I'm not really convinced by the node tree being reopened. It's super slow now. It looks like the whole project is being reopened from scratch. Or maybe it's the same speed as before and I emphasize on it, I'm not sure. Was it that slow before?
The build option is working nicely, with a couple of details:
For starters, I'm not really convinced by the node tree being reopened. It's super slow now. It looks like the whole project is being reopened from scratch. Or maybe it's the same speed as before and I emphasize on it, I'm not sure. Was it that slow before?
The build option is working nicely, with a couple of details:
- Is it possible to not open/close the whole IDE while building from command, or is it mandatory because of the way the program works?
- When I run ZGameEditor.exe /b "C:\MyProjects\NesEmu.zgeproj" C:\Temp\nesemu.exe in a bat file, the exe is produced, but the bat doesn't detect that this step is finished and that it can move on to the next line.
Re: Edit XML with an external editor
I did not notice this. Maybe your project is huge? How many seconds does it take?
Kjell noticed this too. Parts of the functionality of generating binaries is built into the main IDE window (and also error reporting if something goes wrong) so yes it has to show the main window. But I hardly notice it here because it runs so quickly. Again maybe it is because your project is so big that things are more noticeable.
I think it will not wait at all in a batch file unless you use the "start" command. So "start /wait zgameditor" ...
If that is what you are already doing, then please check Task Manager if ZGameEditor process is still loaded. It should not be.
Re: Edit XML with an external editor
I was searching for the bat discussion in the forum, and I just discovered I never replied to your question...
The project tree takes 16 seconds to display after an XML edit, while it takes less than one second to display when loading the project from scratch.
I tried:
and
I'll continue to dig.
Can the command line compress Windows exe as an option? Or should I call that later in my batch?
From ZGE Github:
And can it compile Linux, Mac and Android too?
Lastly, I found a horrible bug when calling ZGameEditor from command line: it erases the Reopen list, and worst, it erases the Tools/Settings too (packer settings, Android paths...)
The project is a blasting 689Ko. Most of the size comes from the 3DS imported objects.Maybe your project is huge? How many seconds does it take?
The project tree takes 16 seconds to display after an XML edit, while it takes less than one second to display when loading the project from scratch.
That's super weird. ZGE isn't in process after completion, but the bat doesn't continue it's life after that.I think it will not wait at all in a batch file unless you use the "start" command. So "start /wait zgameditor" ...
If that is what you are already doing, then please check Task Manager if ZGameEditor process is still loaded. It should not be.
I tried:
Code: Select all
Setlocal EnableDelayedExpansion
C:\Dropbox\Taf\ZGameEditor\ZGameEditor.exe /b Omeganaut.zgeproj Omeganaut.exe
TIMEOUT 0 >nul
Omeganaut.exe
Code: Select all
START /WAIT C:\Dropbox\Taf\ZGameEditor\ZGameEditor.exe /b Omeganaut.zgeproj Omeganaut.exe
Omeganaut.exe
Can the command line compress Windows exe as an option? Or should I call that later in my batch?
From ZGE Github:
Code: Select all
(P:'{$toolpath}upx.exe'; A:'{$exename}'),
(P:'{$toolpath}upx.exe'; A:'--lzma {$exename}'),
(P:'{$toolpath}upx.exe'; A:'--best {$exename}'),
(P:'{$toolpath}upx.exe'; A:'--brute {$exename}'),
Lastly, I found a horrible bug when calling ZGameEditor from command line: it erases the Reopen list, and worst, it erases the Tools/Settings too (packer settings, Android paths...)
Re: Edit XML with an external editor
You could email me this project and I can have a look why it takes so long to reopen after xml-edit.
I think found out why these two problems happened. Please try to download ZGE again, they should be fixed now.Ats wrote: ↑Sun Aug 20, 2023 9:14 am That's super weird. ZGE isn't in process after completion, but the bat doesn't continue it's life after that.
...
Lastly, I found a horrible bug when calling ZGameEditor from command line: it erases the Reopen list, and worst, it erases the Tools/Settings too (packer settings, Android paths...)
Re: Edit XML with an external editor
Thanks. The batch is working nicely now, and it's not erasing the ZGameEditor.ini anymore.