-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
BatchedMesh silent errors on : setMatrixAt
, setColorAt
, setVisibleAt
, etc..
#29379
Comments
I personally prefer a solution other than logging console warnings which can't be detected with code. My opinion is these functions should return a documented value (like null or false) that indicates whether the function succeeded or an error should be thrown. I think adjusting the functions and documentation to use the first solution (returning null etc if not successful) is the least intrusive. |
@gkjohnson I understand your point, it should be detected by code and less intrusive. I strongly feel devs will not write the bellow example using the current return value as it feels unatural and heavy :
Usually dev will write :
So maybe, we want to remove the test and let the error happening like when i do It can also be intercepted by
|
I don't consider returning "null" to be a silent error because it's possible to handle - you just have to "listen" for it. Though I understand it's a difference in stylistic code patterns. Three.js hasn't typically thrown errors in some of these these cases previously, though I do prefer it. I'm fine with an error in this case since it would mean a user is book keeping an id they shouldn't be. If you'd like to make a PR handling these cases I think we can get it merged. |
Description
BatchedMesh have many silent errors on :
setMatrixAt
,setColorAt
,setVisibleAt
, etc..So if I do
setMatrixAt(outOfRangeIndex, matrix)
it will do nothing and return this, I feel we should inform the developer via a warn there is an error.Also sometimes it return
null
,this
,false
I dont know whats the current policy of threejs for this kind of error and how its manage across three, but good error message help for debugging and avoid issue/stackoverflow thread.
Solution
I suggest to add a little warning like :
BatchedMesh instanceId[${instanceId}] wasnt update, this can be cause if the instance is not visible/active or wrong index
Also be consistant in the return
Alternatives
Additional context
No response
The text was updated successfully, but these errors were encountered: