godotengine / godot-visual-script

VisualScript as a Godot Engine c++ module
MIT License
121 stars 29 forks source link

Save VisualScript in a text-based format instead of a binary format #18

Open aaronfranke opened 4 years ago

aaronfranke commented 4 years ago

This supersedes #16023.

Describe the project you are working on:

https://github.com/godotengine/godot-demo-projects/tree/master/visual_script

Describe the problem or limitation you are having in your project:

The problem is that VisualScript files are saved as binary, not text.

Describe the feature / enhancement and how it helps to overcome the problem or limitation:

Storing VisualScript files as text would fix all of these problems. It would take up less space in Git history when things are changed, it makes changes easy to review, it would become possible to combine changes, and it would allow sharing VisualScript files by pasting some text.

Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:

I propose the file format would be called tvs, and files would end in .tvs. It would behave like tscn or tres, with tvs simply being a text version of vs, and new files are saved as tvs.

If this enhancement will not be used often, can it be worked around with a few lines of script?:

The only workaround is to use built-in scripts, or hack them to save as .tres.

Is there a reason why this should be core and not an add-on in the asset library?:

Even if it could be worked around, this kind of thing must be a part of the engine, because if you send a .tvs file then you'd also need to send the add-on, which defeats some of the point.

Zireael07 commented 4 years ago

Addendum: saving visual scripts as text would probably also prevent/workaround the "corrupting to rscc" issue?

orion78fr commented 4 years ago

I agree with this being a huge problem with git (and other VCS).

Right now, the workaround is to create the file with the .vs file format (as the dialog forbids using another extension) then use 'Save as' to rename it with the .tres extension (and remember to choose all extensions in the save dialog). However, you lose the information from the file format that it's a visual script file.

mrjustaguy commented 4 years ago

VS as .tres works 100% fine, on 3.2.3. only thing is that the creation doesn't allow .tres extension when creating a Visual Script... a quick UX fix (to prevent the need for the Save as with all files in the file dialog and rename the .vs to .tres, which is like 3 steps really and it's a one time deal per script) would be to allow the New Script dialog to recognize .tres as a valid format for a Visual Script, as VisualScript.tres works just fine as VisualScript.vs, just with none of the major drawbacks of .vs

If anyone knows where to look (I don't, otherwise I'd probably make a PR to add that, even despite my fairly poor C++ skills) to set the new script dialog to recognize .tres as valid for a new Visual Script, should be a fairly simple change/addition

fire commented 2 years ago

https://github.com/godotengine/godot-proposals/issues/1240 is a similar proposal.

Gallilus commented 1 year ago

I did some tests when trying to create my own module and wanted to share the results.

If you do the following the file is able to be saved and loaded as a text file.

I also want to mention the proposal of reduz

While I was not able to actually save My Script as a resource and will probably use a ConfigFile I hope this helps.