godot-metadata-inspector icon indicating copy to clipboard operation
godot-metadata-inspector copied to clipboard

Copy and paste metaData structure to another node

Open marcelogamedeveloper opened this issue 4 years ago • 5 comments

Hi guys, sorry for asking here. Couldn't find other place to ask.

First of all, i love your plugin, because with hin we don't need to use the "export variables" method. At least not right now in my project.

I'm using your plugin to create a prototype (enemy, for example), that will scale my production.

All enemies will have properties such as: burnable, smashable, poisonResist, hp, speed and the list goes on.

How can i copy all node's metadata and paste into another node?

marcelogamedeveloper avatar Oct 25 '20 13:10 marcelogamedeveloper

Thanks for the feedback.

I don't think I have implemented that feature. I am not that much into game dev right now. But I believed at the time that it wasn't really that necessary. Mostly you would either set up a new prototype with an entire new set of values from scratch, so you hardly need copy&paste for that. Or you would take a lot of common values rather from a separate common scene, e.g. "enemy" or "food item", if your prototypes had this high level of sophistication. I have never made anything that sophisticated though, so I don't know how well that really works out.

I will maybe do this the next days, its not difficult. I was thinking though to offer only to copy a single metadata value (like "myenemyarray"), not all of them. Its better to group your data, and it doesn't need dozens of has_meta, get_meta, set_meta. Anyway ...

If you really need this right now:

You can manipulate metadata from inside metadata_inspector.gd, with set_meta / get_meta as if from inside the game. But it will be permanent in your project (you must press save though, not simply close the window it will not ask you).

In metadata_inspector.gd, you could for example hack the "path?" function from the context menu. Edit ui_copy_path_to_clipboard() and then make it either copy or paste the metadata from the node "activenode", depending on whether or not it has or hasn't for example "myenemyarray" that contains all your data. Don't forget to use arr_or_dict.duplicate(true), which duplicates recursively.

If you change the plugin you have to unload and load it from the settings for changes to take effect and it will spawn in new additional "Meta2" ... "MetaX" tabs. There is also a plugin reloader plugin for that.

If your data is not nested the way you want to, you can either solve this by code in metadata_inspector.gd as well, or you can also open your tscn files in an external text editor. It will have all the metavalues as a dictionary __meta__ = { ... }. You can of course also copy & paste values this way.

ballerburg9005 avatar Oct 25 '20 15:10 ballerburg9005

Nice ! I will use Visual Studio Code and check it out.

Thanks for the quick response.

Have you launched any game?

marcelogamedeveloper avatar Oct 26 '20 00:10 marcelogamedeveloper

Is there a chance that with new versions of godot the plugin gets deprecated?

I'm building a really nice project using it.

marcelogamedeveloper avatar Oct 26 '20 00:10 marcelogamedeveloper

Plugins usually don't work straight away in new versions (but projects don't even more so), they need a few fixes here and there. I will definitively maintain the plugin for a long time.

There is no reason to believe that there will be issues in Godot 4. It was once discussed to remove meta values all together, but since then it has been decided to keep them and even make them editable (but they wanted to remove all the underscored variables from the engine first). That was before I wrote the plugin. I was hoping maybe they will just take my code and put it into the engine. Most people aren't even aware of most plugins and what they do.

I haven't launched a game. I started some mini-games in 2D, and did a few experiments in 3D, but then I got bored and thought my time is better spent elsewhere.

I am currently working on http://ideamarket.org .

ballerburg9005 avatar Oct 26 '20 18:10 ballerburg9005

@marcelogamedeveloper I was coding the feature, but with multi-select and usual copy,cut,paste functionality it wasn't that simple anymore. I am not sure if I will have enough time next week.

If you really need a lot of copy & paste I recommend you edit the .tscn file directly in the meantime.

ballerburg9005 avatar Oct 29 '20 23:10 ballerburg9005