-
Notifications
You must be signed in to change notification settings - Fork 13
fix: BaseBone.clone_value should just copy
#1558
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| def clone_value(self, skel: "SkeletonInstance", src_skel: "SkeletonInstance", bone_name: str) -> None: | ||
| """Clone / Set the value for this bone depending on :attr:`clone_behavior`""" | ||
| match self.clone_behavior.strategy: | ||
| case CloneStrategy.COPY_VALUE: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not tested, but I think this should fix it (before the old code):
| case CloneStrategy.COPY_VALUE: | |
| case CloneStrategy.COPY_VALUE: | |
| _ = skel[boneName] # ensure the bone is being unserialized first |
| skel.renderAccessedValues[bone_name] = copy.deepcopy(src_skel.renderAccessedValues[bone_name]) | ||
| except KeyError: | ||
| pass # bone_name is not in renderAccessedValues, cannot clone it | ||
| skel[bone_name] = copy.deepcopy(src_skel[bone_name]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will fail if renderPreparation is enabled. That's why I implemented it low-level.
The problem, which is probably also responsible for yours, is that the value/entity was not unserialized and is not loaded into the access values, so you are copying something that is not there.
I just found out that the List.clone-prototype function does not copy values correctly.
It was strange, but this simply fixed it, I think it has to do with the intermixing of accessedValues, renderAccessedValues and dbEntity.
This mess must be entirely cleaned up.