swnolan / metahuman_facial_transfer

Extracts/Transfers Metahuman Facial from exported FBX onto Maya face control board
MIT License
140 stars 23 forks source link

Runtime Error on Locked Attributes #10

Closed RobertoHSG closed 7 months ago

RobertoHSG commented 7 months ago

Hi, first of all thank you for creating this script, it's been a massive help.

I'm having an odd issue with a custom metahuman where the api throws a runtime error on a few locked or connected attributes.

This is the error in question and there are about four or five attributes causing this: RuntimeError: setAttr: The attribute 'CTRL_GUIswitch.translateY' is locked or connected and cannot be modified.

It is worth noting that the script does run correctly on a previous version of our Metahuman (on Maya 2022) and the only difference is that we've update version of Metapipe and exported our character again.

I've checked the attributes that cause the runtime error on both rigs but they seem consistent in the way the connections and locks are setup and therefore I can't really figure out why the script suddenly doesn't run as expected.

As a workaround, I've edited the metahuman_api code to check for locked and connected attributes and skip them when retargeting however as I'm not a technical animator or coder, I thought of letting you know about this potential issue as you might encounter it in the future and might need a code revision on your end.

swnolan commented 7 months ago

Hi Roberto, Glad to hear it’s been working aside from this hiccup. Haven’t ran across this in my tests. Do make sure you have my latest code as there’s been a few updates.

Sounds like you’re using the level sequence import? Is that correct? If so, might want to switch over to the animation sequence workflow as it’s more compatible with different Maya versions. While the other is pretty quick to apply, it can be finicky and not as reliable.

How’s the Metapipe? Still have yet to try it but looks really good.

RobertoHSG commented 7 months ago

Hi Sean, thanks for your reply.

I wouldn't know how to trigger a repro as the only difference in our workflow was updating Metapipe to the latest version. I was also using your latest code from github and upgraded maya to 2022.5 just to be sure.

On top of that I was already using the animation sequence workflow to import the animation.

I'm not exactly sure as to why the locked attributes would throw a runtime error as the attributes have the same locks and connection across both versions of our character. Introducing a check to skip locked attributes in the code, solved the issue for me.

My guess is that there is some difference introduced in the file by the new Metapipe that causes this to happen as I haven't encountered this issue with metahumans downloaded from Bridge or when using previous versions of Metapipe.

If it helps, I've narrowed it down to this list of controllers: CTRL_GUIswitch.translateY CTRL_L_mouth_lipsPressD.translateY CTRL_R_mouth_lipsPressD.translateY CTRL_expressions.translateY CTRL_rigLogic.translateY

Metapipe has been useful to overcome some of the MH technical limitations.

Appreciate your time supporting the metahuman facial transfer tool :)

swnolan commented 7 months ago

Hey Roberto, Thanks for the list of these controls. These should be part of the list of controls to be excluded from getting data. Easy enough to update. Thanks for letting me know. I'll close this ticket once I've updated and tested it out. Thanks again!

RobertoHSG commented 7 months ago

Thank you, really appreciate that you are supporting this tool, it's been really useful being to transfer animations to Maya!

swnolan commented 7 months ago

Code is updated. Let me know if you run into issues with latest code.

RobertoHSG commented 7 months ago

I've tested it today and all seems to work, thank you again for the update.