-
Notifications
You must be signed in to change notification settings - Fork 165
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
Reworked memory management mechanism, resolving position and history restoration issues #1394
Reworked memory management mechanism, resolving position and history restoration issues #1394
Conversation
…patible; Disabled history system due to conflicts
…m updates during posing
… process; Fixed issue with ProperyChanged not updating UI
I've done some quick tests today and have some observations so far :> First ObservationThe first observation relates to importing when posing mode is off. Nothing happens when I import the first time, but when I import a second time, the pose will load. This behavior happens in the following scenarios:
When manually toggling on posing mode before attempting to import, only the following scenario is affected:
I've attached the portion of output for the above. (Taken by clearing before performing an action.) Second ObservationI noticed in your notes that when posing mode is enabled, freeze positions is now enabled by default. Just curious, what is the reason for this? When doing a general import or importing by body pose, the body becomes mangled. When toggling freeze positions off, and then importing, the result is a good import: (ignoring the known caveat with expressions) Other resultsI am not noticing any smearing! I did a couple of quick, rough tests with some smearing that I'm used to, particularly with the fingies and face, and wasn't able to get smearing. Basic validation with some memorized values for all the fingies. Despite the first two items, I was able to run through some of my normal workflows and complete a few simple poses. I will keep testing as I have time :> Overall its looking good! |
Oopsies, that's on me. I completely forgot to test pose importing.
Now that posing with positions enabled no longer seems to be buggy in Anamnesis, I think it makes sense to have it toggled on as part of the default user experience. It is a necessity for creating anything beyond basic facial expressions. Regardless of whether they are enabled or disabled, I think that pose importing should work in both scenarios and behaviour should be visually indistinguishable. So, in my opinion, this should be considered a drawback of the current pose import implementation. That's why I think it makes most sense to now focus our attention on updating pose importing. I think our next changes should be:
There are two ways we can approach the implementation:
Still, that's just my opinion so I am interested to hear what you think. |
Havent had the time to look at it in practice yet, only reviewd the premise. I do agree that, if posing works reliable, it should be turned on by default and in turn "Full Transform" (aka. importing with Position, not necessarily Scale) becomming the norm. I have some worries about the long standing and often revised .pose files and if they have always been correctly exporting position, but as long as we keep a way to load without position it should be fine. Additionally we need to consider some things:
thats it for now, I may add more things later. |
…ze positions for selected bones import option
Both of the observations I noted above have been resolved, and I haven't noticed any other issues during my (brief) testing. Thanks! |
This pull request proposes a bunch of changes to Anamnesis:
History
andHistoryService
classes to fix the broken undo procedure, leading to skeleton deformations.PosePage
,SkeletonVisual3d
andBoneVisual3d
to resolve position "smearing", leading to skeleton deformations over time.How is the new memory management mechanism different from the old one?
The new mechanism uses a hierarchical thread locking approach. In other words, if an object is claimed by a thread for synchronization, either reading or writing, the object will not only claim its own thread lock but also all of its descendants' as well. In comparison, the old mechanism used per-object thread locking, allowing for reads from/writes to a memory object, while its ascendant is possibly being updated.
Hierarchical locking ensures that for an overlapping memory-bound property, either reading or writing is being performed at a given time but not both. For example, it is important that whenever a skeleton's memory is changed (e.g. when you change race to one with more bones, forcing the skeleton object in memory to move addresses). you do not access skeleton's member properties until it is synchronized. The old system was attempting to read from/write to transform/bone memories while the skeleton's address was changing, which resulted in corrupted memory and several failures. This will not occur in the new implementation, as the write procedure will wait for the thread locks to be released first. Ultimately, memory and thread safety are achieved at the cost of performance.
Furthermore, game memory changes caused by the game and the user now have independent paths of execution to prevent the synchronization process from calling the internal property changed event handler, which previously resulted in memory de-synchronizations due to
Bind.IsReading
:Detailed changes:
ReadTransform()
andWriteTransform()
now have transform locks, we want to avoid redundant calls whenever possible.CustomizeEditor
).Utf8String
to 0x40 (64 bits).short
toushort
.HkaPoseMemory
transforms array memory offsets. Previously, the count was incorrectly offset due to the weird offset of the entire array.CustomizeEditor.xaml.cs
. There was a converter forcing the gender of Hrothgar to male. As there is now a female counterpart that users can select, we do not need it.CustomizeEditor.xaml.cs
to act nicely with the new memory mechanism.And possibly more. I tried to include everything I could think of.
Investigated issues:
AddressService.SkeletonFreezePhysics
andAddressService.SkeletonFreezePhysics2
. The currently NOP-ed SIMD instructions in the game's memory result in this funky behaviour. No steps were taken to resolve this issue. It should be handled in a separate pull request.Good luck with the review o7
If you have any questions, don't hesitate to ask.