-
Notifications
You must be signed in to change notification settings - Fork 144
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
Building a mirror table takes WAY too long #483
Comments
So, I got it building a 1:1 match of the mirror table down to 0.07 seconds. After some more consolidation and simplification, I got to this
|
Hey Tyler, thanks for sharing! I'll take a closer look after we finish testing a major update we’re currently working on. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There are 1148 controls on my rig, and it takes almost 45 seconds to build the mirror table
It looks like you're creating and deleting 4 helper transform nodes for every unmirrored control.
One here
https://github.com/krathjen/studiolibrary/blob/main/src/mutils/mirrortable.py#L525
And one for each of the 3
axisWorldPosition
callsAnd 6 helper transform nodes for every mirrored control. Two for every call to
isAxisMirrored
https://github.com/krathjen/studiolibrary/blob/main/src/mutils/mirrortable.py#L505
For the mirrored controls, it looks like you're getting the worldspace pivot, then the worldspace axes, and subtracting points to get the worldspace axis vectors... But the result of that vector subtraction will just be one of the rows of the worldspace matrix.
Your
isAxisMirrored
function could be boiled down to this:For the unmirrored controls, it looks like what you're doing is getting the axis directions of the control.
Same deal. You can get those axis directions directly from the worldspace matrix.
And then you convert those values to string for some reason? You could simplify that with
[round(i, 3) for i in t1]
... Actually, why are those values being rounded at all? I feel like those could just be left alone.So I think you could replace
MirrorTable._calculateMirrorAxis
with this:With these changes, it goes from 45 seconds down to less than 1 for me.
I may be missing some nuance somewhere with pivots and rounding (hence why I'm writing an issue, and not a PR), but this would be a welcome change.
The text was updated successfully, but these errors were encountered: