
But there's still one major catch -- TMZ has learned the judge is refusing to allow Gary and Amber to be around their daughter Leah at the same time.
We're told the three of them are only allowed to be in the same room while trading custody of Leah.
Amber still faces two felony counts of domestic battery, one felony count of neglect of a dependent, and one misdemeanor count of domestic battery for allegedly beating the crap out of Gary in front of Leah ... and MTV cameras.
And get this -- we're told the former couple "hugged it out" in court today.