I'm not totally sure what you mean by 'motivation' but I'll take a stab at answering anyways.
First, it's important to keep in mind that this is just another hurdle in a sport that is truly a journey. Trust the recovery process. Listen to your doctor. Don't rush back to the gym. Expect ramp up time when you are able to return to the gym.
If you are totally out of the gym, meaning zero conditioning, enjoy the break! Use the time to connect with non-gym friends, take a non-gymnastics class (my daughter took drivers ed when she was out of the gym completely for 8 weeks), do another activity you enjoy or work on a scrap book. Go to practice for a bit just to cheer on your teammates. Do something nice for your teammates like bring a little treat or write notes of encouragement. If you are released to do conditioning or have PT, do these at the gym. Even if you go for just part of the practice.