Skip to content
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

boneOrientationVector should be private #12

Open
KosRud opened this issue Jan 30, 2024 · 0 comments
Open

boneOrientationVector should be private #12

KosRud opened this issue Jan 30, 2024 · 0 comments

Comments

@KosRud
Copy link
Owner

KosRud commented Jan 30, 2024

/// <summary>
/// Bone orientation is required for bulge-compensation.<br>
/// Do not set directly, use custom editor instead.
/// </summary>
public Vector3 boneOrientationVector = Vector3.up;

Use private field with SerializeField and public getter/setter functions. Do not use property, use functions to emphasize that changing the value requires additional internal logic and can be expensive.

Logic for setter:

var newOrientation = (BoneOrientation)EditorGUILayout.EnumPopup("Bone orientation: ", currentOrientation);
if (this.dqs.boneOrientationVector != this.boneOrientationVectors[newOrientation])
{
this.dqs.boneOrientationVector = this.boneOrientationVectors[newOrientation];
this.dqs.UpdatePerVertexCompensationCoef();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant