title: How to store and then retreive parent-child dependency data (Maya MEL/Python script)
body: <p>I have a hierarchy that I need to:</p>
  
  <ol>
  <li>break apart </li>
  <li>doSomething()</li>
  <li>put it back together the same way it was before.</li>
  </ol>
  
  <p>I know how to break things for sure, and have plan about what I need to do when they are flat in hierarchy. The problem is how do I parent them back?</p>
  
  <hr>
  
  <p>Details</p>
  
  <p>This is related to my previous question: </p>
  
  <p><a href="https://stackoverflow.com/q/45757754/8483714">Freeze scale transform on a parent object with animated child (MAYA MEL/Python script)</a></p>
  
  <p>I need to freeze scale transforms on all nodes in a hierarchy. Problem is that nodes have translate animations on them, and if I try to freeze scale on a parent node, it's child animation gets weird.
  However it looks like there is a solution, but I need help with implementation of it.
  I want to:</p>
  
  <ol>
  <li>Group each object</li>
  <li>Parent each group to the world</li>
  <li>Bake animation to the world space (getting rid of the group node)</li>
  <li>Freeze scale transform</li>
  <li>re Parent them back</li>
  </ol>
  
  <p>It works when I do it manually, so everything should be ok. But if you think there is better way to achieve my main goal, please do tell me.</p>
  
  <p>So, I've been thinking to write all nodes to a string and call them from there, but I don't know how to handle branches. 
  For example:
  If it was a branchless hierarchy (one parent and one child all along) I could call them by two, and parent easily.
  But branches make names in string go like "parent, child, child, child, parent..."</p>
  
  <p>Probably I'm thinking too much and in wrong direction. Any ideas?</p>