I recently wrote a rigging module that used classes instead of free floating functions. I’ve never used oop for auto rigging before, and I ran into a set of problems that were unique to this process. I’m wondering if any of you have tackled these issues.
-
Once the code is run, I lose the object’s instance. This is the big problem for me. I enjoyed taking advantage of inheritance, polymorphism, and composite patterns. But none of that matters if I lose the object immediately after running it. I could try to rebuild the instance based on connections, but that almost defeats the whole purpose. This makes it difficult to edit the rig with code after the initial run is done. I tinkered with trying to keep the instance in globals(), but good taste prevailed.
-
Less of an issue, but it deals with using getters and setters. I wasn’t sure if it is cleaner to make the class getters and setters, also get/set the corresponding maya attributes. That way one can be sure that the two values are linked. Or is it better to have a separate one for the object than the actual node attr?
Thanks