ShalltyB / BlendshapeCreator

Koikatsu plugin to add custom blendshapes to meshes.
GNU General Public License v3.0
3 stars 0 forks source link

[KKS] Issue with Clothing and Timeline in Studio #2

Closed Kayinnasaki closed 2 months ago

Kayinnasaki commented 2 months ago

Sorry for another one but this one seems potentially more serious.

I have not been able to get blendshapes to animated with timeline to load properly. The file will load, an error will appear in the console and the blendshapes will be removed from the timeline. If you force a blendshape refresh in KKPE, they'll be there still. A good example of this error is...

[Debug  :DynamicBoneDistributionEditor] Applying Data for outfit 0 on character Haruno Chika (from Delayed)
[Debug  :DynamicBoneDistributionEditor] Refreshing Bone List on Haruno Chika - Outfit 0 | removeDead True
[Debug  :DynamicBoneDistributionEditor] Applying Data for outfit 0 on character Haruno Chika
[Debug  :IllusionFixes] Skipping cleanup because of low memory load (56% RAM, 61% Page file, 24651MB available in PF)
[Info   :BlendshapeCreator] New blendshape loaded: BS-C: Key 1
[Error  :  Timeline] Couldn't load interpolable with the following XML:
<interpolable enabled="true" owner="KKPE" objectIndex="0" id="groupBlendShape" parameter="BodyTop/ct_clothesBot/n_o_root_kkss/bot/defpants/n_bot_a/bot_defpants_a" bgColorR="1" bgColorG="1" bgColorB="1" alias=""><keyframe time="0" valueCount="1" value0="0" name0="BS-C: Key 1"><curveKeyframe time="0" value="0" inTangent="0" outTangent="1" /><curveKeyframe time="1" value="1" inTangent="1" outTangent="0" /></keyframe><keyframe time="2" valueCount="1" value0="100" name0="BS-C: Key 1"><curveKeyframe time="0" value="0" inTangent="0" outTangent="1" /><curveKeyframe time="1" value="1" inTangent="1" outTangent="0" /></keyframe></interpolable>
System.NullReferenceException: Object reference not set to an instance of an object

object HSPE.AMModules.BlendShapesEditor+TimelineCompatibility.ReadGroupValueFromXml(object, XmlNode)
object Timeline.Interpolable.ReadValueFromXml(XmlNode)
void Timeline.Timeline.ReadInterpolable(XmlNode, List<KeyValuePair<int, ObjectCtrlInfo>>, ObjectCtrlInfo, GroupNode<InterpolableGroup>)
[Info   :BlendshapeCreator] New blendshape loaded: BS-C: Key 1
[Debug  :Modding API] SceneManager.sceneUnloaded - StudioNotification
[Debug  :Modding API] SceneManager.sceneUnloaded - StudioSceneLoad
[Info   :Studio Optimizations] Scene loading completed: 2.3[s]

I also have compiled two test scenes (hopefully github won't strip out the metadata)

pretimeline.png pretimeline

This file is before adding the bottoms to the time line. In this, both sets of blendshapes load fine (just some simple vertex spikes for testing). The head spike animates fine, while they pants, which I haven't attempted to animate yet, do nothing. Everything working as intended.

posttimeline.png posttimeline

Now both animations are broken. The pants leave, the the head still exists but the key values are malformed. Whats more, if you load posttimeline before pretimeline and then lore pretimeline, animations there will be broken to.

This isn't isolated to just this scene, I had it come up when trying to make a personal scene and had the same errors. All relevant plugins (KKAPI, the joan plugins, ShalltyUtils, and obviously the blendshape creator) should be up to date and I double checked everything before submitting these.

ShalltyB commented 2 months ago

hi, could you please try this version?

blendshape creator.zip

Kayinnasaki commented 2 months ago

Progress! First load from a freshly opened studio loads things fine. but further scene loading seems to cause issues.

If I open the post scene, adjust the timeline, save, and load the save, things break again. So whatever direction you went seems right, but it seems like something isn't getting cleaned up on reloads?

Here's one of the errors from me experimenting with this.

<interpolable enabled="true" owner="KKPE" objectIndex="0" id="groupBlendShape" parameter="BodyTop/ct_clothesBot/n_o_root_kkss/bot/defpants/n_bot_a/bot_defpants_a" bgColorR="1" bgColorG="1" bgColorB="1" alias=""><keyframe time="0" valueCount="1" value0="0" name0="BS-C: Key 1"><curveKeyframe time="0" value="0" inTangent="0" outTangent="1" /><curveKeyframe time="1" value="1" inTangent="1" outTangent="0" /></keyframe><keyframe time="2" valueCount="1" value0="100" name0="BS-C: Key 1"><curveKeyframe time="0" value="0" inTangent="0" outTangent="1" /><curveKeyframe time="1" value="1" inTangent="1" outTangent="0" /></keyframe></interpolable>
System.NullReferenceException: Object reference not set to an instance of an object

object HSPE.AMModules.BlendShapesEditor+TimelineCompatibility.ReadGroupValueFromXml(object, XmlNode)
object Timeline.Interpolable.ReadValueFromXml(XmlNode)
void Timeline.Timeline.ReadInterpolable(XmlNode, List<KeyValuePair<int, ObjectCtrlInfo>>, ObjectCtrlInfo, GroupNode<InterpolableGroup>)
[Info   :BlendshapeCreator] New blendshape loaded: BS-C: Key 1
[Debug  :IllusionFixes] Skipping cleanup because of low memory load (51% RAM, 58% Page file, 26712MB available in PF)
[Info   :BlendshapeCreator] New blendshape loaded: BS-C: Key 1
[Debug  :Modding API] SceneManager.sceneUnloaded - StudioNotification
[Error  : Unity Log] ArgumentNullException: Value cannot be null.
Parameter name: asyncOperation
Stack trace:
void Cysharp.Threading.Tasks.Internal.Error.ThrowArgumentNullExceptionCore(string)
void Manager.Scene+<UnloadAsync>d__75.MoveNext()
void System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
bool Cysharp.Threading.Tasks.UniTask+ExceptionResultSource<bool>.GetResult(short)
void Cysharp.Threading.Tasks.UniTaskExtensions.Forget<bool>(UniTask<bool>)
UnityEngine.Debug:LogException(Exception)
Cysharp.Threading.Tasks.UniTaskScheduler:PublishUnobservedTaskException(Exception)
Cysharp.Threading.Tasks.UniTaskExtensions:Forget(UniTask`1)
Manager.Scene:Unload(Boolean)
Studio.SceneLoadScene:OnClickClose()
System.Reflection.MethodBase:Invoke(Object, Object[])
Extension.Reflection:_Invoke(Object, String, Object[])
System.Reflection.MethodBase:Invoke(Object, Object[])
Extension.Reflection:Invoke(Object, String, Object[])
StudioAutoCloseLoadingSceneWindow.<UnloadLoadScene>d__6:MoveNext()
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
ShalltyB commented 2 months ago

the blendshapes that you're animating, where they created within studio or maker?

ShalltyB commented 2 months ago

and could you please try this one? blendshape creator.zip

Kayinnasaki commented 2 months ago

In the original scene file, the headspike was added in the char maker and the pants spikes were added in studio. I had tried seeing if it made a difference in another scene so I decided to save time after testing the headspike. That said I'm trying to do it now with a fresh Chika, both blend shapes added in the char maker and... same deal. Almost. Now I'm noticing default values for clothing adjustments don't save.

So I successfully made a scene that saves, but had a weird error while doing it (the key 1 keyframe on the face being replaced with a mouth movement. Keyframe 87-81). This definitely wasn't a weird miss click on my end but at the same time this might be a bug that popped up only because I'm working with some possibly malformed scenes due to all the testing.

A clean scene with a clean Chika and the same animations saved fine, loaded fine, with the only problem being the "default clothes blend values don't load" so this seems pretty close!

ShalltyB commented 2 months ago

could you share with me the character file and the scene file?

Kayinnasaki commented 2 months ago

Absolutely.

KoikatsuSun_F_20240824181140138_Haruno Chika

2024_0824_1830_46_215

and while we're at it, the bscds I used.

blendexport.zip

ShalltyB commented 2 months ago

sorry I didn't understand the problem, what do you mean by "default clothes blend values don't load"

Kayinnasaki commented 2 months ago

https://github.com/user-attachments/assets/34459fb3-7433-4271-bcd2-716c839ec70d

No problem, hopefully this helps. Won't load in studio either.

ShalltyB commented 2 months ago

Now I get it, thank you for the video, it seems that the bug was caused by the two blendshapes having the exact same name, I changed the way it worked, so It must be fixed now. (You have to do it in a clean Chika)

blendshapecreator.zip

Kayinnasaki commented 2 months ago

LOL of course it was something like that. Hell yes, working super good, but still some issues, seemingly around the sexface mod which I've just been able to isolate. I'm gonna close this one and make a more relevant new issue

Thank you for everything though! For my part I'm ready to go work on stuff again. I just turned sexface mod off.