Closed samipfjo closed 5 years ago
I think if length is 0 for a level then we should automatically stop generation of that level. We could just put a check within the generation process or we could check the parameters before generation as you suggest and reduce the value of levels to the correct number (i.e. the highest that won't include branches of length 0). Given that the end behaviour would be as expected (i.e. no branches at that level = branches of 0 length at the level), I think this is ok.
I'm not sure whether there are many parameter values that would result in crashes like this, and we'd have to hardcode the checks (whatever they may be) so I'm not sure it's worth implementing some big sanitisation system for all parameters at this stage. I would just put in a check for this specific case and leave it at that for now. Ideally I want to avoid restricting what parameters people can input as much as possible, so rather than getting errors they simply get the model they expect (like I describe above by just skipping the broken level) or stupid looking models causing them to choose better parameters.
Fair enough.
This error is due to several of the stock parameter files having zero in their fourth-tier Length parameter. It can be remedied by simply providing a non-zero length parameter.
How should we want to handle this? I suggest a sanity-check function that executes before anything else when the generate button is pressed. Said function would read the parameters, check for conflicts, and throw a helpful error if it finds one. This would have the added benefit of centralizing most of the addon's "you're doing it wrong" messages, and would be easily expandable as we/others find naughty combinations. Thoughts?
To reproduce: 1) Load Apple tree preset 2) Seed 1000 3) Keep leaf generation enabled 4) Set level count to 4 5) Generate
Full stack trace: