cats-blender-plugin
cats-blender-plugin copied to clipboard
Fix using EditBones outside of EDIT mode in create_eye_tracking
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):
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 EditBone
s were still being used after switching to OBJECT
mode from EDIT
mode, which frees the memory of the EditBone
s.
To fix the issue, I have created separate variables for the needed attributes of the EditBone
s, prior to to the switch to OBJECT
mode.