d4rkc0d3r / d4rkAvatarOptimizer

d4rkpl4y3r's VRChat Avatar 3.0 optimizer
MIT License
402 stars 17 forks source link

Unchecking Merge Static meshes as skinned causes errors #19

Closed Asovrix closed 1 year ago

Asovrix commented 2 years ago

I have quite a complex avatar with some props that I do not want to get merged as meshes, since I suspect it could break stuff. Unchecking Merge Static Meshes as Skinned or Merge Skinned Meshes causes Merge preview and Debug info to disappear and spews a lot of the same error in console:

IndexOutOfRangeException: Index was outside the bounds of the array. d4rkAvatarOptimizerEditor.OnInspectorGUI () (at Assets/d4rkAvatarOptimizer/src/d4rkAvatarOptimizerEditor.cs:2999) UnityEditor.UIElements.InspectorElement+<>c__DisplayClass58_0.b__0 () (at :0) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)

Edit: after some debugging it seems that even just adding AvatarProp root object from ThatFatKidsMom prefab as an exclusion to optimizer causes above error. Adding "object container" for your prop works fine. Link to that prefab: https://github.com/ThatFatKidsMom/Avatar-Prop

Asovrix commented 2 years ago

I can still press Create optimized copy, it takes a while because of how large this avatar is, but it produces a copy tagged with (BrokenCopy). The reason I do not want to merge static meshes is because one of them can be dropped in world (VRLabs World Constraint), some not and one of them is even using ThatFatKidsMom's Avatar Prop prefab, which allows that prop to be manipulated by other players as if it was a world prop.

d4rkc0d3r commented 2 years ago

Have you tried if it actually does what you want with the settings enabled? When merging static meshes to skinned meshes the vertices of that previously static mesh will get weight painted to the transform it was previously on.

Asovrix commented 2 years ago

No, it spits out a broken copy. I need to manually exclude props for it to create something not broken, but aside from that I still have unrelated issues... materials turning pink, material losing reference to its maintex only once avatar is loaded and object that should be toggleable being stuck enabled. I guess at least for pink material I should create a separate issue?

Asovrix commented 2 years ago

Okay, I found exactly what is causing titular issue, it's a mesh called "Cull" that is a part of Avatar Prop package. If I add it to exclusions it immediately causes optimizer script to spit out same errors. Changing name doesn't do anything. It looks like this: Unity_2022-12-04_18-06-43 My guess is it's the fact that it has 0 materials?

d4rkc0d3r commented 2 years ago

Yeah is def the fact it has 0 materials. I did not account for that to happen. Thanks for the detailed report, I'll probably fix it tomorrow.

d4rkc0d3r commented 1 year ago

As usual get the fix by downloading the current repo form here.