I'm not sure whether your question is simply a reflection of curiosity or whether something important occurred after the officer opened your door. Police officers have wide latitude in how they conduct traffic stops in order to maintain control and safety of everyone. I see no problem with what you have described. If you told me he then removed you from your vehicle and proceeded to do a thorough search of the interior and trunk, then I'd say you have something. Hope I answered your wuestion.
If the office had a reason to stop your vehicle to conduct an "investigatoty stop" (your weaving in the roadway), he has the right to approach the vehicle and ask for your drivers license, insurance card and registration. He has the right to assess any danger to himself and others which might include opening the car door. I have never seen that specific fact pattern alone before. The real question is, did he search and seize any contraband and charge you with it. Then his actions become more important in court relative to a defense motion to supress evidence.
I am trying to give you a general answer to your question. We do not have an attorney-client relationship by this response on the avvo website. I have not been retained to represent you. I am licensed to practice law in Kentucky and in federal court in this state and the Southern District of Indiana. You need to seek legal advice from an attorney licensed to practice in your area..