Open ApproximateIdentity opened 3 years ago
This hand recognition on/off should be a part property.
There are some options here:
st-image
, or really any part that moves, could have part property called something like recognizeHand: true/false
. This can be a dynamic property which when sets to true
loads up the hand rec. related module; when set to false
shuts it all down.
and for example the Hand Recognition
button in toolbox which now calls the system command toggleHandDetection
would do something like:
on click
add image "Lenin"
tell image "Lenin" to set "src" to [uri]
tell image "Lenin" to set "recognizeHand" to true -- alternatively we can add a private command called `recognizeHand` so `tell image "Lenin" to recognizeHand`
end click
On deserialization, as the parts/views are added and properties are set, the hand recognition would automatically turn on. This is really the only way we have to preserve state and keep with the current design for everything else in the system.
alternatively `recognizeHand` could be a property of card, stack or world doing more or less the same thing...
The way the hand recognition interface works is that it creates the lenin hand when it boots up, moves it around when running, and then removes it again when it turns off. But the hand itself is just an st-image. If you save the page when the interface is running it entirely ignore the fact that the interface is running (which is probably good actually), but as a result it considers the st image as an object that needs saving. Once I reload the saved page, it creates the hand image again as a regular image, but if I re-start the hand recognition it creates a new image. The old one is just a random ST object floating around.
In other words, my previous assumption was that if hand recognition turns off, it destroys the lenin hand image, but that is not true if I save it and reload it. So the serialize/de-serialize process sort of creates an object leak with respect to my assumption. I am not entirely sure what the best way is to fix this. It might be to create some sort of unique id for the hand recognition and check if it exists. Another possible solution is to have the serialization process not save the hand itself. Gotta think of this a little...