Closed jarkkosyrjala closed 7 years ago
A MeshStyle
cannot be used on multiple objects simultaneously. It's mentioned here in the API reference, but I should add that information at the style
property, too, probably.
The reason: a MeshStyle
is not only a set of properties (like e.g. a TextFormat
), but it's an extension of the actual Mesh
, inherently connected with it.
I know this makes some things a little bothersome, but there's (currently) no way around that. You can use, however, MeshStyle.clone()
to get an exact duplicate of a style. To synchronize two styles, you can use MeshStyle.copyFrom()
. That should help for most issues.
Nevertheless, I should throw a better error message when a style is used on two meshes. I'll look into that!
(That's also why I just labelled this Bug. This does not mean that having one style on separate meshes should be fixed.)
Thanks and sorry for not noticing the line in the API reference.
A style instance may only be used on one object at a time
No need to apologize! I definitely need to emphasize this information more, and mention it at other places, as well. Thanks for making me aware of that!
I updated the reference to make it easier to see that a style can only be used on one mesh. Furthermore, I fixed the error you were seeing: now, the previously used mesh simply reverts to a standard style.
Using an instance of DistanceFieldStyle in more than one TextField causes an exception:
Here's a small Class to reproduce the error:
Obvious workaround is to use unique instance of DistanceFieldStyle for each TextField, but it should be possible to use shared instance of DistanceFieldStyle.