-
Notifications
You must be signed in to change notification settings - Fork 129
Maya: Deformer node ids validation plugin #2826
Conversation
Thanks for the very thorough write-up! This logic already exists elsewhere and I think could be re-used. It's this
I believe you might even get by with only adding EDIT:
Ah, I see now that this is a different check. I'd actually propose to maybe refactor some existing logic and just add an argument to Re-using more of the logic means if we fix one in the future, then all will get fixed. |
Also to add some more details:
I believe this only happens to referenced meshes. |
Another note: It's also technically possible to have multiple mesh shapes under a single transform, which will 'invalidate' with this current logic. I have that seen being used very rarely but I have seen it. It's something to keep in mind at least. |
I saw your other comments after posting, so had to delete my previous comment ;) As you suggest, a mix between the 2 solutions would probably be ideal (in case the history isn't enough, look at the siblings). As for the referenced meshes, yes, it seems to happen in that case (I think it might be related to foster parents nodes when trying to modify the referenced nodes), though I feel like I had cases where the problem also occurred with imported meshes. |
Indeed. |
This can happen when the rigger did for example a delete history in-between. (which I believe would disconnect) But Maya being Maya there's likely a lot more reasons that could happen.
I'd say for now we might want to add this Validator in Admin Settings so that it can be enabled/disabled. Then if someone ever has the case where they need to have multiple shapes under a transform like that, they can disable it for themselves. I wouldn't say it's directly problematic but it's what makes this a potentially difficult case to "always solve correctly". |
OK, so I can refactor the lib function 'get_id_from_history' as you suggested, and use it in this plugin with the added parameter 'history_only' to False. About the admin settings, I could have a look, but it might be a bit complicated as I haven't touched that (yet). |
I think you could remove your Validator and apply your tweak in this Validate Rig Out Set Node Ids so that it does Then we can expose that particular True/False settings in Admin Settings - the plug-in would need to be added in this .json file. Likely we'll want to add it inside the Rig validators entry where you'd want to expose the Once you have it added in the settings all you'd need to do is set the default settings values. You can do that by running |
OK, perfect. I should be able to do it, I think I have enough info. |
openpype/hosts/maya/plugins/publish/validate_rig_out_set_node_ids.py
Outdated
Show resolved
Hide resolved
Also don't forget to add the default settings and make sure to commit them:
They currently appear to be missing. |
I actually agree that in this case, it's more a bugfix, than a pure change. If someone already has a scene prepped, it should be validated against this in the new publish, to prevent potential issues. |
Just a note that this has now been tested on a studio side with one of our clients as well and works as expected |
@2-REC Great work. Testing this now!
raise RuntimeError("Nodes found with mismatching "
"IDs: {0}".format(invalid)) Other than that I can confirm it does take the id from the sibling if no history connection is present. ✅ As a TD my preference would be that it'd log clearly where it's taking the ID from but I think most artists would likely say it confuses them more so I'm fine with current behavior. Let's leave it as is for now. |
Very nice. Thank you. @BigRoy happy on your end? we can included in 3.9.1 coming out today with a swarm of other fixes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @2-REC - sorry for the so much back and forth on this. Really appreciate you sticking through it.
Brief description
In Maya, deformers can create copies of shape nodes without keeping the cbId from the original nodes, breaking subsequent references.
Description
In Maya, when a deformer is added to a mesh, a new shape node is created, copy of the original shape node.
The "deformed" shape node will hold the result of the deformation applied to the original shape node.
The new node doesn't get the cbId of the original node.
Depending on the deformer, the new node will be used as the original node or as the deformed node. Additionally, if applying more deformers, more nodes can be created.
In many cases, the deformed node will not have a cbId and will get a newly generated one, unmatching the original node cbId.
This causes problems downstream in the pipeline, as any reference to the original node's cbId will not match with the deformed shape node's cbId.
Additional info
Typically, this issue will occur when assigning a published look to a rig.
To reproduce the problem, the following steps can be executed:
As a result, the look is not assigned to the mesh, and the following message is displayed in the "History" panel:
The issue is that the process is trying to assign the shaders only to the original shape nodes (referred to by their cbId), which are marked as "intermediate objects" (because of the deformer applied to them).
Shaders cannot be assigned to these nodes, and no other nodes match the cbIds, hence the shaders aren't assigned to anything.
Solution
To fix this issue, and to allow downstream tasks to refer to the deformed nodes as the original nodes without distinction, the solution is to get the cbId from the original shape nodes and "transfer" them to the new deformed shape nodes.
In general, the original shape node can be retrieved from the deformed shape node's history.
In some cases however, it is not possible to retrieve the original shape node this way, as another copy of the original node has been made and is now used as the original for the deformer.
For example, consider the following node graph.
The shape node "MeshShapeDeformedOrig" is used as the original node for the deformer, but its relation with the original "MeshShape" has been lost.
In this case, it is not possible to get the original shape node from the deformed shape node's history (only the new node which is a copy of the original node).
The nodes do however share the same transform node parent, and are related in that way.
Following is a suggested solution:
The original shape node can be found as a sibling of the deformed shape node.
As mentioned earlier, the original node should have the attribute "intermediate object" set.
Additionally, the node should also have a cbId assigned to it, as opposed to the new node.
A node satisfying these conditions should be the original shape node.
The cbId of this node can then be transferred to the deformed node.