soupday / cc_unity_tools_URP

Package for importing and auto setup of Character Creator (3 & 4) and iClone (7 & 8) character exports for Unity URP Pipeline.
GNU General Public License v3.0
102 stars 26 forks source link

[URP 12] Bad importing of CollisionShapes for JSONs 1.20.1822.1 #49

Open BrianAmadori opened 1 year ago

BrianAmadori commented 1 year ago

In 1.20 we have:

            "FatherJackV2": {
                "Generation": "RL_CC3_Plus",
                "Physics": {
                    "Shadow_Catcher": {},
                    "Preview_Camera": {},
                    "Father_Jack": {
                        "Collision Shapes": {
                            "CC_Base_Hip": {

                            },
                            ...

In 1.10, however, the Physics / Collision Shapes hierarchy is reversed:

        "Object": {
            "David": {
                "Generation": "",
                "Physics": {
                    "Collision Shapes": {
                         "CC_Base_Hip": {
                         ... 
                         }, 
                         "Misc": { }
                    }

The current parser is only supporting the 1.10 model, 1.20 fails and no colliders nor cloth is generated. For me, this currently means that CC3+ characters cannot get working clothes.

I suspect there are more changes because JSON schema versioning is just not supported at all in the source code.

BrianAmadori commented 1 year ago

Offending code in Physics.cs:

        private void ReadPhysicsJson(QuickJSON physicsJson, QuickJSON characterJson)
        {
            QuickJSON shapesJson = physicsJson.GetObjectAtPath("Collision Shapes");
            QuickJSON softPhysicsJson = physicsJson.GetObjectAtPath("Soft Physics/Meshes");            

            if (shapesJson != null)
            { 
                ....
soupday commented 1 year ago

What's exporting JSON version 1.20?

CC4.31 / iC8.31 only ever export 1.10. (at least to Unity & Blender)

BrianAmadori commented 1 year ago

I am just producing an FBX via the export route.

image
BrianAmadori commented 1 year ago
image
BrianAmadori commented 1 year ago

i'm starting to suspect that the json export have changed in a very recent version. I'm re-exporting old-characters and now all of them have the new json format.

soupday commented 1 year ago

I'm on the same version and everything is still 1.10.

Have you installed any add-ons (from the reallusion hub or otherwise) to CC4 or iClone recently? (iClone and CC4 share some functionality) I'm wondering if something there could have 'upgraded' the json export.

BrianAmadori commented 1 year ago

i have headshot 2 and skingen. all the official stuff. nothing fancy.

this was working ok a few days ago and i just downloaded some assets, but no plugins.

there's some way i can check the full status of the app for you to debug? like a initialization log?

El jue, 17 ago 2023 a las 0:45, Victor Soupday @.***>) escribió:

I'm on the same version and everything is still 1.10.

Have you installed any add-ons (from the reallusion hub) to CC4 or iClone recently? (iClone and CC4 share some functionality) I'm wondering if something there could have 'upgraded' the json export.

— Reply to this email directly, view it on GitHub https://github.com/soupday/cc_unity_tools_URP/issues/49#issuecomment-1681566635, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABUOVJSPNI73QMID2QHZGQDXVWHWDANCNFSM6AAAAAA3TI5IV4 . You are receiving this because you authored the thread.Message ID: @.***>

BrianAmadori commented 1 year ago

Well... this is weird as hell. I restarted CC4 and...

So, I wasted all my day with this issue, now it fixed itself and I don't have a way to reproduce it again. I swear that my sanity is OK.

soupday commented 1 year ago

I think I can reproduce it:

Did you by any chance accidentally export a character to Maya first. (Exports to Maya use version 1.20.) Any subsequent exports after that even if you change the target to something else are locked to 1.20.

As this is quite easy to do by accident, I think I may need to add a warning message that the JSON is wrong if it detects version 1.20.

This might also explain some odd import results some people report, where the character looks like it was exported with the wrong target even though they are sure it was for Unity.

soupday commented 1 year ago

Or if it's not too much effort, I'll just have it parse version 1.20 correctly, then it won't matter.

BrianAmadori commented 1 year ago

Oh, good call, that makes total sense.

I just tried to export a character with Maya target, and then with Unity3D hoping that i'd get stuck with the 1.20, but the behaviour was correct. I wonder if after an entire day of work without closing the app it glitched out somehow.

You can try to parse 1.20, but maybe a cheaper fix is to just throw a log error with the recommendation of changing targets and restart CC / iC if the version keeps being wrong?

soupday commented 1 year ago

In all honesty it is less effort just to make it work with 1.20 than having to explain over and over that this is bug and how to fix it.

And you'd be surprised at how many people just completely ignore the console logs.