-
Notifications
You must be signed in to change notification settings - Fork 218
Adds PlayAtlas and SnapToMultiple operators #428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
{ | ||
var v = Value.GetValue(context); | ||
var mod = Mod.GetValue(context); | ||
if (mod == 0){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this part is not needed, in this case the "end test" (second field) of the for
statement will trigger before the first run, and the loop content won't be executed.
var mod = Mod.GetValue(context); | ||
if (mod == 0){ | ||
return; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
keep indentation consistent for easier code maintenance (your ide can do that for you)
if (mod == 0){ | ||
return; | ||
} | ||
for(int goodvalue=mod;goodvalue>0;goodvalue--){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be optimized starting from 0 until iterator==mod
, as we want the minimal value, and the mod
value can be huge.
also goodvalue
is not a very good variable name.
Result.Value = goodvalue; | ||
return; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto indent.
Thanks for this PR ! Thus it's working fine, there's a few cosmetic and optimization issues you can fix 👍 |
removed redundant check, changed indentation for consistency, clarified nextLowestMod variable name, adjusted clamping behavior
I went ahead and made all of the changes you mentioned, except for the loop optimization. I think what you proposed would always return the lowest possible modulo, whereas I'm looking for the next lowest modulo (at, or below, the given input for Mod). Also, my "IDE" is notepad++, so it might not actually take care of the indentation for me. I'm not sure. 😅 |
Thanks for this awesome contribution! |
An operator for turning Atlases into animations, for use with GIFs, sprite sheets, etc. For a better user experience, I've also included SnapToMultiple, which will return the lowest divisor of a number that has a modulus of 0.
