Deleting Faces as they are drawn -splats
-
I've been working on a plugin and it erases faces as they are drawn with a simple entities observer. It just erases every face.
It worked great at first, but I keep expanding what the observer is doing. And somewhere along the line I've got it so that it splats a lot now. I think its because I'm doing things inside the start/commit stack of the rectangle tool.
But how would I queue up the face to deleted once the tool is done making the rectangle? Does that make sense?
-
face.erase! if face and face.valid?
only tries to erase a face if it [still] exists... -
I'll play with that, but I'm 99% sure the face still exists when I try to erase it. I think it is being erased correctly, and it is only after the rectangle tool tries to complete itself that it splats.
-
It's not good to change the entities from within the observer method. You can use
EntitiesObserver.onElementAdded
to build references to the created faces, and then erase them fromModelObserver.onTransactionCommit
. -
Yea, trying to do any modification to the model in reaction to an observer event is asking for trouble. ( see my old DoubleCut thread ).
Even stacking things off to onTransactionCommit isn't reliable, because onTransactionCommit doesn't map to model.commit_operation. -
You may need to combine your responces with a
ToolsObserver
Advertisement