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

Fallback logic for VRMLookAtQuaternionProxy.name doesn't execute #1516

Open
mattrossman opened this issue Oct 28, 2024 · 1 comment
Open

Comments

@mattrossman
Copy link
Contributor

I got tripped up when I tried adding a VRMLookAtQuaternionProxy to my VRM scene without manually setting its .name. I didn't see a warning message indicating what went wrong.

} else if (proxy.name == null) {
// if found but name is not set, set the name automatically
console.warn(
'createVRMAnimationClip: VRMLookAtQuaternionProxy is found but its name is not set. Setting the name automatically. To suppress this warning, set the name manually',
);
proxy.name = 'VRMLookAtQuaternionProxy';
}

The above logic attempts to set a default name if one is not manually set and warn the user to set it themselves.

However the logic here checks for a null name, when an unset name actually contains an empty string ''. This is reflected in the type of proxy.name which is string. This means the fallback logic and helpful warning message don't execute.

I suggest changing this to check for empty string instead of null.

@0b5vr
Copy link
Contributor

0b5vr commented Nov 12, 2024

That's true! Object3D constructor is already putting '' to its .name.
https://github.com/mrdoob/three.js/blob/beab9e845f9e5ae11d648f55b24a0e910b56a85a/src/core/Object3D.js#L43

Would else if (proxy.name === '') be appropriate? I'm 99% sure but want to make sure.

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

2 participants