Entities observer

Ok I can put an entity observer on every element but why can’t the EntitiesObserver.onElementRemoved give me the element itself instead of the entityID? It’s not that this entity doesn’t exist anymore for sketchup because sketchup knows it’s a deleted element. Or is there an easy way to know the original entity pointer from the EntityID? The only way I know is to keep track of all entities with an hash entity, entityID.

The object was partially dead already. Returning the entity could lead to crashes I believe. I’m not 100% sure about the details, but there where issues which mean you couldn’t really do much to the entity. Which is not surprisingly as the current observer system just taps directly into the internal notifications and they are not sent with an API in mind.

But returning the pointer gives the opportunity to clean up your own code. It’s not the intension to do something with the element itself.

Trouble was that some people did. There is much in the current observer system that isn’t ideal.
We are in need of a new one.

What is the status of observers 2.0?

2 Likes