Hey folks.
I am attempting to script up a process to copy custom rig controls from one rig to another. This includes the group/transform hierarchy, anim controls, constraints and connections. The base control rigs are built from a common build tool but various aspects of the base rigs are constructed differently in the top level rig file. I have created custom controls after the fact in the original version of the control rig and I need to move the custom rigging to the new version of the rig. The referenced in skeleton hierarchy has similarly named joints that will be constrained to the rig hierarchy.
I am currently selecting the top-level groups that I want to transfer, duplicating them, including the children, and storing off all of the connections. I have started to store off all of the parent constraints and rebuilding them as well. This is already proving a bit hairy as I am not including upstreamNodes nor inputConnections as it immediately blows up and includes almost everything in the scene.
I am looking for advice on how to proceed here as this is my first foray into this area of Maya rigging. Has anyone attempted anything like this?
Thanks!
Things will be less nasty if you do your work in a new namespace so all of the duplicated stuff will not clash with existing ones. Namespaces stink but they are the only way to manage side-by-side copies of complex arrangements
[QUOTE=Theodox;28205]Things will be less nasty if you do your work in a new namespace so all of the duplicated stuff will not clash with existing ones. Namespaces stink but they are the only way to manage side-by-side copies of complex arrangements[/QUOTE]
That was my first attempt and it was close but far too messy to work with.
My current solution is a bit out of the box but has yielded the best results. I’ll try to share it in a blog post as it’s a little deep. High level, I do a python diff of the two maya ascii scenes. I filter out what I’m looking for and similar objects and rebuild a brand new Maya file with a combination of the two files. The tricky part is all of the maya objects that are auto-generated and don’t have good naming conventions. “Tweak23, ObjectSet102”. I need to resolve the naming of these objects in my diff process back to proper named objects. Once I do this I will have exactly what I’m looking for in a fully realized procedure. Right now I do a couple specific checks but I get precisely what I want. It was a fun challenge either way.
If you really need to do it that way, maybe you could try spinning up 3 copies of maya at once: open up both source scenes as RPC servers which can answer questions about their respective contents and the third scene as the master asking questions and creating the output. At least you don’t have to build a reliable parser
The parser wasn’t really difficult as to the operations I’m performing. The depth of connections reaching too far was my biggest issue, even in Maya. Trying best to determine a cut-off point of the top-level ctrl nodes that I wanted has proved challenging. Even with your suggestion I’d have the same problem. It’s a tough one.
I guess the other way to think about it generally would be the notion of a ‘constraint’ that knew how to copy the numbers from control A to control B in the appropriate frame of reference without caring too much about the upstream setup. But that would be vulnerable to rigs that had custom tweaks.
Me, I just bake everything down to bones and work out how to bake the bones onto controls - or just to add the rig o top as an animation layer.
It’s a difficult problem for sure. Question for your first post - have you tried determining what kind of connections you wanted to store? For example, you could say the connections you’d want are translation/rotation/scale, visibility or added extra attributes. If that’s all you want, you could greatly narrow down the connections on the groups & children that you end up querying. It’s not an ideal solution either, because it’s difficult to account for alllll the different kinds of connections besides the ones I mentioned as an example.
So the layout for the rig_ctrl heirarchy is, for one rig control I have a top-Level Group, Constraints, and Children objects. I want all the connections found relative to all of these objects. It is quite easy to get the first level of connections. However, if I have an IK or something with several multiply/div nodes outside this, like a spline IK, It has the potential to miss those second or third level connections. Unless I put code in to specifically look for them, which is doable but finding all the situations seems to be challenging. I think I need to find a reasonable method to traverse the connection hierarchy and stop when I reach a predetermined level, indicated by nodes that do exist in the other scene. I think that’s the route I may take.