cats-blender-plugin icon indicating copy to clipboard operation
cats-blender-plugin copied to clipboard

Fix using EditBones outside of EDIT mode in create_eye_tracking

Open Mysteryem opened this issue 2 years ago • 0 comments

This is a small patch to fix a UnicodeDecodeError that was brought up by a user on Discord when they were creating eye tracking (I successfully reproduced it after a few tries): image Getting a UnicodeDecodeError when getting a name attribute typically happens when trying to use a variable where Blender has already freed its memory. Sometimes, such code will work fine as the memory hasn't been overwritten yet, but other times the name attribute will now be some other random memory, so there may be unexpected results, errors may occur (such as this) or rarely, Blender could crash.

In this particular case, references to EditBones were still being used after switching to OBJECT mode from EDIT mode, which frees the memory of the EditBones.

To fix the issue, I have created separate variables for the needed attributes of the EditBones, prior to to the switch to OBJECT mode.

Mysteryem avatar Jul 03 '22 01:07 Mysteryem