heyx3 / GPUNoiseForUnity

A Unity plugin for generating noise on the GPU for use in the editor.
Other
108 stars 17 forks source link

[BUG] Redefinition of SimpleNode #1

Closed Bamboy closed 7 years ago

Bamboy commented 7 years ago

Hey! This is amazing. Hoping to be able to use this to (more) quickly generate levels for my worms-style game. There's a few nodes I'd like to add, so maybe I'll contribute them later.

I've run into a bug that seems to have been caused by nodes that somehow managed to share the same ID. This has effectively broken the graph, and I'll have to remake it in a new file. (I've tried deleting and remaking the problematic node(s), doesn't work, only increments the shared ID)

I was mainly playing with all the different tools available all in the same graph, and so I think I just deleted too many things or something? Not sure. I'll link my graph file that is broken.

https://www.dropbox.com/s/77fd5e3bd90wfjc/MyBrokenGraph.gpug?dl=0

Bamboy commented 7 years ago

After recreating the graph, I get the same problem. I'm now confident that this issue is a problem with branching paths that later rejoin, and not a problem with duplicate node IDs.

Bamboy commented 7 years ago

To fix this bug, the else statement at line 255 of Graph.cs needs to be:

toProcess.RemoveAt(toProcess.Count - 1);

if( body.ToString().Contains("float "+n.OutputName ) ) continue; else n.EmitCode(body);

I'll fork and push this later if someone doesnt beat me to it.

heyx3 commented 7 years ago

Thanks for working on this issue! Could you be more clear on what causes this? What do you mean by branching paths?

Bamboy commented 7 years ago

Graphs that have nodes that break into two or more node paths that then later come back together - take a look at the dropbox download.

Bamboy commented 7 years ago

The issue is caused due to the shader script having multiple variables of the same name being defined. (Because of the branching paths)

heyx3 commented 7 years ago

Fixed in 7cd971f60c38d6433885a473742e7f357302312d