You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I get that cloning the materials themselves doesn't make sense. This would be a big performance hit.
But the materials array seems like it is part of the object to me. So if I call Object3D.clone(), I'd expect that array to get cloned as well.
Sharing material references between objects makes sense. But sharing the same reference to an array, less so.
Solution
Cloning the materials array when clone() is called seems like it wouldn't change too much performance wise. Things like the object name and child hierarchy are already cloned as well, so as long as the materials themselves are not cloned, things should be fine I think.
Alternatives
I can clone material arrays myself if I have too, so if it stays like this it's not a huge problem. It's just that this behaviour seemed unexpected. To reiterate, I very much would expect materials themselves to not get cloned. But not cloning the arrays did come as a surprise to me.
Additional context
No response
The text was updated successfully, but these errors were encountered:
I think it makes sense to do the same for an array of materials in all relevant 3D object classes (it should be Mesh, Points and Line). Are you interested in making a PR?
Description
I get that cloning the materials themselves doesn't make sense. This would be a big performance hit.
But the materials array seems like it is part of the object to me. So if I call
Object3D.clone()
, I'd expect that array to get cloned as well.Sharing material references between objects makes sense. But sharing the same reference to an array, less so.
Solution
Cloning the materials array when
clone()
is called seems like it wouldn't change too much performance wise. Things like the object name and child hierarchy are already cloned as well, so as long as the materials themselves are not cloned, things should be fine I think.Alternatives
I can clone material arrays myself if I have too, so if it stays like this it's not a huge problem. It's just that this behaviour seemed unexpected. To reiterate, I very much would expect materials themselves to not get cloned. But not cloning the arrays did come as a surprise to me.
Additional context
No response
The text was updated successfully, but these errors were encountered: