Where does the Catholic tradition that Mary did not have pain giving birth to Jesus come from? Where does the Catholic tradition that Mary's birth of Jesus was painless come from?

My wife just got home from a non-denominational study about Mary and she said she thought everybody knew this, but apparently no one knew about it - especially the Protestants!

In any event, what I'm looking for is the origin of the quote that Jesus' birth was "like light passing through glass" and whether that quote is wholly indicative of a painless birth or if it could have been painless in another way?  

I understand that it's a little t tradition in the Church, not a dogma or anything.  But it's definitely a strong tradition; although it's one that could use a little preaching on from what I can tell.
The Catholic &quot;tradition&quot; is just that. It is not an official teaching or doctrine, but rather something one is free to believe. The Church does not take a physiological stance on whether or not Mary experienced pain during child birth. But to understand where this tradition came from, we have to go back to the Garden of Eden.
When Adam and Eve sinned, God said to Eve that because of her sin, women would now experience pain during child birth. The teaching of &quot;Original Sin&quot; is that we have all inherited the sin of Adam and Eve. 
The Catholic Church teaches that Mary was &quot;the ark of the new covenant&quot; and that God prepared her to be the perfect vessel which carried God (Jesus) into the world. That meant that she needed to be free from Original Sin and that she did not commit a sin.
So since she was free from sin, including the sin from Eve, the tradition is that she did not need to experience pain during child birth.
You can read more about the teaching on &quot;the ark of the new covenant&quot; here: https://www.catholic.com/magazine/print-edition/mary-the-ark-of-the-new-covenant