Arnklit / Waterways

A tool to generate river meshes with flow and foam maps based on bezier curves.
https://github.com/Arnklit/WaterGenGodotDemo
MIT License
1.03k stars 68 forks source link

Duplicating nodes should create unique curves #12

Open TokisanGames opened 3 years ago

TokisanGames commented 3 years ago

I have created a river with a texture I like. Since there's no way to copy the material, which would be a nice feature, I duplicate the node.

However this only sometimes gives me a unique curve.

Today I duplicated the node several times trying to get a unique curve, saving at different times, closing the scene, etc. Nothing I could do in the editor would give me a unique curve, which meant if I edited the curve in one node, it changed the other.

The only way I could fix this today was to edit the .tscn file and manually create a unique subresource so I could have an additional node.

However the very first time I did this, weeks ago it duplicated and I didn't notice any issue. I wasn't able to pinpoint the behavior that caused it to make it unique or not, but this is a needed function that should done be automaticly.

Win10/64 Godot 3.2.1 GTX1060 GLES3 7fbac1222f0493592fcb5fdac68aff00fc5c3674

sairam4123 commented 3 years ago

Well, it's a issue with Godot, godot shares the resources with other nodes you duplicate. So it's a godot issue not this plugin's issue.

Arnklit commented 3 years ago

Sorry for the delay on answering this.

It is basically expected that the resources are shared, because that's how Godot works in general. But I am aware that it's an issue.

I'll see about moving the material and curve over to a resource in some way so it can be copied and made unique in a way that makes sense.

TokisanGames commented 3 years ago

Perhaps if there is an on_duplicate signal you can connect to, or just having a button in the interface for manual control, and either allows you to make unique the curve resource. As it is editing the scene file by hand to force a unique copy is not ideal.

Or you could expose the curve resource in the inspector. Then it will have the manual make unique option built-in. Then you just need documentation to explain the process.

TokisanGames commented 3 years ago

There are several notifications sent out on various events. You could capture NOTIFICATION_INSTANCED, NOTIFICATION_READY, or NOTIFICATION_ENTER_TREE and then:

var curve = curve.duplicate()

That way every instance is making itself unique on every run in the editor or game.